diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/time_spec.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/time_spec.lua b/spec/time_spec.lua new file mode 100644 index 0000000..8bee5f7 --- /dev/null +++ b/spec/time_spec.lua @@ -0,0 +1,13 @@ +local system = require 'system.core' + +describe('Test time functions', function() + it('gettime returns current time', function() + assert.is_near(os.time(), system.gettime(), 1.0) + end) + + it('sleep will wait for specified amount of time', function() + local starttime = system.gettime() + system.sleep(0.5) + assert.is_near(0.5, system.gettime() - starttime, 0.1) + end) +end) |