2022-11-21 13:10:02 +00:00
|
|
|
# test custom native class
|
|
|
|
|
|
|
|
try:
|
|
|
|
import cexample
|
|
|
|
import time
|
|
|
|
except ImportError:
|
|
|
|
print("SKIP")
|
|
|
|
raise SystemExit
|
|
|
|
|
|
|
|
|
2022-11-24 07:58:10 +00:00
|
|
|
SLEEP_MS = 100
|
|
|
|
TOLERANCE_MS = 20
|
|
|
|
|
|
|
|
timer = cexample.Timer()
|
|
|
|
|
|
|
|
t_start = timer.time()
|
2022-11-21 13:10:02 +00:00
|
|
|
|
|
|
|
time.sleep_ms(100)
|
|
|
|
|
2022-11-24 07:58:10 +00:00
|
|
|
t_end = timer.time()
|
2022-11-21 13:10:02 +00:00
|
|
|
|
2022-11-24 07:58:10 +00:00
|
|
|
print(timer)
|
|
|
|
print(0 <= t_start <= TOLERANCE_MS)
|
|
|
|
print(SLEEP_MS - TOLERANCE_MS <= t_end <= SLEEP_MS + TOLERANCE_MS)
|