summaryrefslogtreecommitdiff
path: root/lib/automata.py
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-02-21 13:35:29 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-02-21 13:35:29 +0100
commit7d8fafad61c7639e3551939942e5ea507c6a134e (patch)
tree905b25e8336c511e8a3b8c2ef5fe0720c5a53de7 /lib/automata.py
parentd734d1a5deaa6a05d126f32f48e7dd5abcdd2ba5 (diff)
support legacy argument / benchmark test value definitions
Diffstat (limited to 'lib/automata.py')
-rwxr-xr-xlib/automata.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/automata.py b/lib/automata.py
index be0b3d8..563ff4d 100755
--- a/lib/automata.py
+++ b/lib/automata.py
@@ -87,7 +87,7 @@ class State:
for trans in self.outgoing_transitions.values():
if with_arguments:
for args in itertools.product(*trans.argument_values):
- yield [[trans.name, args]]
+ yield [(trans.name, args)]
else:
yield [trans.name]
else:
@@ -95,7 +95,7 @@ class State:
for suffix in trans.destination.dfs(depth - 1, with_arguments = with_arguments):
if with_arguments:
for args in itertools.product(*trans.argument_values):
- new_suffix = [[trans.name, args]]
+ new_suffix = [(trans.name, args)]
new_suffix.extend(suffix)
yield new_suffix
else:
@@ -212,6 +212,7 @@ class Transition:
'destination' : self.destination.name,
'is_interrupt' : self.is_interrupt,
'arguments' : self.arguments,
+ 'argument_values' : self.argument_values,
'arg_to_param_map' : self.arg_to_param_map,
'set_param' : self.set_param,
'duration' : _attribute_to_json(self.duration, self.duration_function),
@@ -326,10 +327,16 @@ class PTA:
for trans_name in sorted(json_input['transition'].keys()):
transition = json_input['transition'][trans_name]
destination = transition['destination']
+ arguments = list()
+ argument_values = list()
if type(destination) == list:
destination = destination[0]
+ for arg in transition['parameters']:
+ arguments.append(arg['name'])
+ argument_values.append(arg['values'])
for origin in transition['origins']:
- pta.add_transition(origin, destination, trans_name)
+ pta.add_transition(origin, destination, trans_name,
+ arguments = arguments, argument_values = argument_values)
return pta