diff options
-rwxr-xr-x | lib/automata.py | 4 | ||||
-rwxr-xr-x | test/test_codegen.py | 4 | ||||
-rwxr-xr-x | test/test_pta.py | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/lib/automata.py b/lib/automata.py index 1715841..3bba65c 100755 --- a/lib/automata.py +++ b/lib/automata.py @@ -266,7 +266,7 @@ class Transition: ret = param_dict.copy() if self.arg_to_param_map: for k, v in self.arg_to_param_map.items(): - ret[k] = args[v] + ret[v] = args[k] if self.set_param: for k, v in self.set_param.items(): ret[k] = v @@ -482,7 +482,7 @@ class PTA: arguments.append(argument['name']) argument_values.append(argument['values']) if 'parameter' in argument: - arg_to_param_map[argument['parameter']] = i + arg_to_param_map[i] = argument['parameter'] if 'argument_combination' in transition: kwargs['argument_combination'] = transition['argument_combination'] if 'set_param' in transition: diff --git a/test/test_codegen.py b/test/test_codegen.py index e1bb942..e9b4067 100755 --- a/test/test_codegen.py +++ b/test/test_codegen.py @@ -42,7 +42,7 @@ example_json_1 = { 'destination' : 'IDLE', 'duration' : { 'static' : 120 }, 'energy ' : { 'static' : 10000 }, - 'arg_to_param_map' : { 'txpower' : 0 }, + 'arg_to_param_map' : { 0: 'txpower'}, 'argument_values' : [ [10, 20, 30] ], }, { @@ -65,7 +65,7 @@ example_json_1 = { 'regression_args' : [3, 5], }, }, - 'arg_to_param_map' : { 'txbytes' : 1 }, + 'arg_to_param_map' : { 1: 'txbytes'}, 'argument_values' : [ ['"foo"', '"hodor"'], [3, 5] ], 'argument_combination' : 'zip', }, diff --git a/test/test_pta.py b/test/test_pta.py index 4c727cc..c41f6a3 100755 --- a/test/test_pta.py +++ b/test/test_pta.py @@ -42,7 +42,7 @@ example_json_1 = { 'destination' : 'IDLE', 'duration' : { 'static' : 120 }, 'energy ' : { 'static' : 10000 }, - 'arg_to_param_map' : { 'txpower' : 0 }, + 'arg_to_param_map' : { 0: 'txpower'}, 'argument_values' : [ [10, 20, 30] ], }, { @@ -65,7 +65,7 @@ example_json_1 = { 'regression_args' : [3, 5], }, }, - 'arg_to_param_map' : { 'txbytes' : 1 }, + 'arg_to_param_map' : { 1: 'txbytes'}, 'argument_values' : [ ['"foo"', '"hodor"'], [3, 5] ], 'argument_combination' : 'zip', }, @@ -499,7 +499,7 @@ class TestPTA(unittest.TestCase): pta.add_state('TX', power = 100) pta.add_transition('UNINITIALIZED', 'IDLE', 'init', energy = 500000, duration = 50000) pta.add_transition('IDLE', 'IDLE', 'setTxPower', energy = 10000, duration = 120, - arg_to_param_map = {'txpower' : 0}) + arg_to_param_map = {0: 'txpower'}) pta.add_transition('IDLE', 'TX', 'send', energy = 3, duration = 10) pta.add_transition('TX', 'IDLE', 'txComplete', timeout = 2000, is_interrupt = True) trace = [ |