summaryrefslogtreecommitdiff
path: root/bin/test_automata.py
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-02-21 12:04:50 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-02-21 12:04:50 +0100
commit46e69c4f402414d93e6efb2a7138e1fc13bb66d3 (patch)
tree88d19091947a1fa76adde5963a954e1433bf8db8 /bin/test_automata.py
parentcc3bac282f011310cdb7e29e797a9f766d860faf (diff)
automata: .states -> .state (it's a dict)
Diffstat (limited to 'bin/test_automata.py')
-rwxr-xr-xbin/test_automata.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/test_automata.py b/bin/test_automata.py
index 3b64783..c117c56 100755
--- a/bin/test_automata.py
+++ b/bin/test_automata.py
@@ -6,7 +6,7 @@ import unittest
example_json_1 = {
'parameters' : ['datarate', 'txbytes', 'txpower'],
'initial_param_values' : [None, None],
- 'states' : {
+ 'state' : {
'IDLE' : {
'power' : {
'static' : 5,
@@ -107,9 +107,9 @@ class TestPTA(unittest.TestCase):
def test_from_json(self):
pta = PTA.from_json(example_json_1)
self.assertEqual(pta.parameters, ['datarate', 'txbytes', 'txpower'])
- self.assertEqual(pta.states['UNINITIALIZED'].name, 'UNINITIALIZED')
- self.assertEqual(pta.states['IDLE'].name, 'IDLE')
- self.assertEqual(pta.states['TX'].name, 'TX')
+ self.assertEqual(pta.state['UNINITIALIZED'].name, 'UNINITIALIZED')
+ self.assertEqual(pta.state['IDLE'].name, 'IDLE')
+ self.assertEqual(pta.state['TX'].name, 'TX')
self.assertEqual(len(pta.transitions), 5)
self.assertEqual(pta.transitions[0].name, 'init')
self.assertEqual(pta.transitions[1].name, 'init')
@@ -123,7 +123,7 @@ class TestPTA(unittest.TestCase):
def test_from_json_function(self):
pta = PTA.from_json(example_json_1)
- self.assertEqual(pta.states['TX'].get_energy(1000, {'datarate' : 10, 'txbytes' : 6, 'txpower' : 10 }), 1000 * (100 + 2 * 10))
+ self.assertEqual(pta.state['TX'].get_energy(1000, {'datarate' : 10, 'txbytes' : 6, 'txpower' : 10 }), 1000 * (100 + 2 * 10))
self.assertEqual(pta.transitions[4].get_timeout({'datarate' : 10, 'txbytes' : 6, 'txpower' : 10 }), 500 + 16 * 6)
def test_simulation(self):