Skip to content

Commit b648581

Browse files
committed
FSM: correctly handle empty args in composition
Also, in steppers, omit initial test message because it can remain in buffers and confuse test results
1 parent 1d11b73 commit b648581

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

pymodel/FSM.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def ActionEnabled(self, a, args):
4848
action a with args is enabled in the current state
4949
"""
5050
# no cleanup check here
51-
return any([(a == action and args == arguments)
51+
# any args matches empty arguments in FSM
52+
return any([(a == action and (not arguments or args == arguments))
5253
for (current,(action, arguments, result),next)
5354
in self.module.graph
5455
if current == self.current ])

samples/Socket/Stepper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@
5959
# Now server can read by repeating data=server.recv(n) until EOF
6060
# Then should server.close()
6161

62-
# DOESN'T ALWAYS WORK WITH socket_simulator.py WHEN
63-
# len(buffers) < len('Hello world!')
62+
# Omit - can leave stuff in buffers that confuses test runs
6463
# Test the connection
6564
#client.send('Hello world!')
6665
#data = server.recv(line_length)

samples/Socket/stepper_a.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@
6767
# Now server can read by repeating data=server.recv(n) until EOF
6868
# Then should server.close()
6969

70+
# Omit - can leave stuff in buffers that confuses test runs
7071
# Test the connection
71-
client.send('Hello world!')
72-
data = server.recv(line_length)
73-
print 'Try a test message, server got "%s"\n' % data
72+
#client.send('Hello world!')
73+
#data = server.recv(line_length)
74+
#print 'Try a test message, server got "%s"\n' % data
7475

7576
def test_action(aname, args, modelResult):
7677
"""

samples/Socket/stepper_o.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@
6464
# Now server can read by repeating data=server.recv(n) until EOF
6565
# Then should server.close()
6666

67+
# Omit - can leave stuff in buffers that confuses test runs
6768
# Test the connection
68-
client.send('Hello world!')
69-
data = server.recv(line_length)
70-
print 'Try a test message, server got "%s"\n' % data
69+
#client.send('Hello world!')
70+
#data = server.recv(line_length)
71+
#print 'Try a test message, server got "%s"\n' % data
7172

7273
def test_action(aname, args, modelResult):
7374
"""

0 commit comments

Comments
 (0)