summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-04 20:34:23 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-04 20:34:23 (GMT)
commit46bd4543929e815ca1db071292155fc4b353c5b0 (patch)
treee6a091df76e9ededd906488a9817d877e742f857
parent901e43870e0394ee09d3bead6ef57582f76ddee1 (diff)
simulator: test: Grey box stopwatch test
Currently we can act on the controls but we cannot "see" the display in the test suite. That leads us to a slightly odd form of "grey box" testing. It's functionally black box testing but some of the asserts have to reach inside the components instead of looking at the display. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
-rw-r--r--wasp/boards/simulator/test_smoke.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/wasp/boards/simulator/test_smoke.py b/wasp/boards/simulator/test_smoke.py
index 62d570b..d86b4e7 100644
--- a/wasp/boards/simulator/test_smoke.py
+++ b/wasp/boards/simulator/test_smoke.py
@@ -44,3 +44,24 @@ def test_app(system, name):
for i in range(4):
system.step()
system.switch(system.quick_ring[0])
+
+def test_stopwatch(system):
+ system.switch(system.apps['Timer'])
+
+ system.step()
+
+ wasp.watch.button.value(0)
+ system.step()
+ assert(system.app._started_at > 0)
+ wasp.watch.button.value(1)
+
+ system.step()
+ system.step()
+ system.step()
+
+ wasp.watch.button.value(0)
+ system.step()
+ assert(system.app._started_at == 0)
+ wasp.watch.button.value(1)
+
+ system.step()