aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/time_spec.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/time_spec.lua b/spec/time_spec.lua
index c9d3d6d..e1b457a 100644
--- a/spec/time_spec.lua
+++ b/spec/time_spec.lua
@@ -12,9 +12,20 @@ describe('Test time functions', function()
12 assert.is_near(expected, avg, 1 + delta) 12 assert.is_near(expected, avg, 1 + delta)
13 end) 13 end)
14 14
15 it('monottime returns monotonically increasing time', function()
16 local starttime = system.monotime()
17 local endtime = system.monotime()
18 local delta = endtime - starttime
19 assert.is_true(starttime > 0)
20 assert.is_true(delta >= 0)
21 assert.is_true(system.monotime() - endtime >= 0)
22 end)
23
15 it('sleep will wait for specified amount of time', function() 24 it('sleep will wait for specified amount of time', function()
16 local starttime = system.gettime() 25 local starttime = system.gettime()
26 local starttick = system.monotime()
17 system.sleep(0.5) 27 system.sleep(0.5)
18 assert.is_near(0.5, system.gettime() - starttime, 0.1) 28 assert.is_near(0.5, system.gettime() - starttime, 0.1)
29 assert.is_near(0.5, system.monotime() - starttick, 0.1)
19 end) 30 end)
20end) 31end)