1
0
Fork 0

simulator: tests: Parameterize the basic app tests

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
Daniel Thompson 2020-12-04 20:32:40 +00:00
parent 2bb5ae3a89
commit 901e43870e

View file

@ -5,17 +5,9 @@ import wasp
def step(): def step():
wasp.system._tick() wasp.system._tick()
wasp.machine.deepsleep() wasp.machine.deepsleep()
time.sleep(0.1)
wasp.system.step = step wasp.system.step = step
def play(appname):
system = wasp.system
system.switch(system.apps[appname])
for i in range(4):
system.step()
time.sleep(0.125)
system.switch(system.quick_ring[0])
wasp.system.play = play
wasp.system.apps = {} wasp.system.apps = {}
for app in wasp.system.quick_ring + wasp.system.launcher_ring: for app in wasp.system.quick_ring + wasp.system.launcher_ring:
wasp.system.apps[app.NAME] = app wasp.system.apps[app.NAME] = app
@ -45,20 +37,10 @@ def test_launcher_ring(system):
assert('Settings' in names) assert('Settings' in names)
assert('Torch' in names) assert('Torch' in names)
def test_steps(system): @pytest.mark.parametrize("name",
system.play('Steps') ('Steps', 'Timer', 'Heart', 'Self Test', 'Settings', 'Torch'))
def test_app(system, name):
def test_timer(system): system.switch(system.apps[name])
system.play('Timer') for i in range(4):
system.step()
def test_heart(system): system.switch(system.quick_ring[0])
system.play('Heart')
def test_self_test(system):
system.play('Self Test')
def test_settings(system):
system.play('Settings')
def test_torch(system):
system.play('Torch')