Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions tests/misc/cexample_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@
print("SKIP")
raise SystemExit

t = cexample.Timer()

print(t)
print(t.time() <= 1)
SLEEP_MS = 100
TOLERANCE_MS = 20

timer = cexample.Timer()

t_start = timer.time()

time.sleep_ms(100)

elapsed = t.time()
t_end = timer.time()

if not (99 <= elapsed <= 110):
print("Elapsed time should be approx. 100ms but it is", elapsed)
print(timer)
print(0 <= t_start <= TOLERANCE_MS)
print(SLEEP_MS - TOLERANCE_MS <= t_end <= SLEEP_MS + TOLERANCE_MS)
1 change: 1 addition & 0 deletions tests/misc/cexample_class.py.exp
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<Timer>
True
True
2 changes: 2 additions & 0 deletions tests/misc/cexample_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
raise SystemExit

print(cexample)
print(cexample.__name__)

d = dir(cexample)
d.index("add_ints")
d.index("Timer")

print(cexample.add_ints(1, 3))
1 change: 1 addition & 0 deletions tests/misc/cexample_module.py.exp
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<module 'cexample'>
cexample
4