From acea9352a97480c6cab9a57a87581ffda2681faf Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Tue, 20 Oct 2015 01:53:10 +0300 Subject: [PATCH] tests/extmod: Add tests for sleep_ms/us(), ticks_ms/us/diff(). Simple smoke tests, mostly for coverage. Added to extmod based on the fact that they're extensions to standard modules. --- tests/extmod/time_ms_us.py | 12 ++++++++++++ tests/extmod/time_ms_us.py.exp | 2 ++ 2 files changed, 14 insertions(+) create mode 100644 tests/extmod/time_ms_us.py create mode 100644 tests/extmod/time_ms_us.py.exp diff --git a/tests/extmod/time_ms_us.py b/tests/extmod/time_ms_us.py new file mode 100644 index 0000000000..2078f1bb53 --- /dev/null +++ b/tests/extmod/time_ms_us.py @@ -0,0 +1,12 @@ +import sys +import utime +try: + utime.sleep_ms +except AttributeError: + print("SKIP") + sys.exit() + +utime.sleep_ms(1) +utime.sleep_us(1) +print(utime.ticks_diff(utime.ticks_ms(), utime.ticks_ms()) <= 1) +print(utime.ticks_diff(utime.ticks_us(), utime.ticks_us()) <= 500) diff --git a/tests/extmod/time_ms_us.py.exp b/tests/extmod/time_ms_us.py.exp new file mode 100644 index 0000000000..dbde422651 --- /dev/null +++ b/tests/extmod/time_ms_us.py.exp @@ -0,0 +1,2 @@ +True +True