Skip to content
Snippets Groups Projects
Commit c3c3b5a8 authored by Phil's avatar Phil
Browse files

Added new automaton regression tests

parent 7cf15249
No related branches found
No related tags found
No related merge requests found
......@@ -896,6 +896,10 @@ a=ATMT6()
a.run()
assert( _ == 'Mercury' )
a.restart()
a.run()
assert( _ == 'Mercury' )
= Automaton test io event
~ automaton
......@@ -927,6 +931,14 @@ a.io.tst.send(_)
a.run()
assert( _ == "Saturn" )
a.restart()
a.run(wait=False)
a.io.tst.send("at")
a.io.tst.recv()
a.io.tst.send(_)
a.run()
assert( _ == "Saturn" )
= Automaton test io event from external fd
~ automaton
class ATMT8(Automaton):
......@@ -957,7 +969,54 @@ os.write(w,"ra")
os.write(w,"nu")
a.run()
assert( _ == "Uranus" )
a.restart()
a.run(wait=False)
os.write(w,"ra")
os.write(w,"nu")
a.run()
assert( _ == "Uranus" )
= Automaton test interception_points, and restart
~ automaton
class ATMT9(Automaton):
def my_send(self, x):
self.io.loop.send(x)
@ATMT.state(initial=1)
def BEGIN(self):
self.res = "V"
self.send(Raw("ENU"))
@ATMT.ioevent(BEGIN, name="loop")
def received_sth(self, fd):
self.res += fd.recv().load
raise self.END()
@ATMT.state(final=1)
def END(self):
self.res += "s"
return self.res
a=ATMT9(debug=5)
a.run()
assert( _ == "VENUs" )
a.restart()
a.run()
assert( _ == "VENUs" )
a.restart()
a.BEGIN.intercepts()
while True:
try:
x = a.run()
except Automaton.InterceptionPoint,p:
a.accept_packet(Raw(p.packet.load.lower()), wait=False)
else:
break
x
assert( _ == "Venus" )
+ Test IP options
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment