diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/os/time.moon | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/unit/os/time.moon b/test/unit/os/time.moon new file mode 100644 index 0000000000..76ad86b799 --- /dev/null +++ b/test/unit/os/time.moon @@ -0,0 +1,15 @@ +{time: lua_time} = require 'os' +{:cimport, :eq} = require 'test.unit.helpers' + +time = cimport './src/os/time.h' + +describe 'time function', -> + describe 'mch_delay', -> + mch_delay = (ms) -> + time.mch_delay ms, false + + it 'sleeps at least the number of requested milliseconds', -> + curtime = lua_time! + mch_delay 1000 + ellapsed = lua_time! - curtime + eq true, ellapsed >= 1 and ellapsed <=2 |