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 @@ | |||
1 | local system = require 'system.core' | ||
2 | |||
3 | describe('Test time functions', function() | ||
4 | it('gettime returns current time', function() | ||
5 | assert.is_near(os.time(), system.gettime(), 1.0) | ||
6 | end) | ||
7 | |||
8 | it('sleep will wait for specified amount of time', function() | ||
9 | local starttime = system.gettime() | ||
10 | system.sleep(0.5) | ||
11 | assert.is_near(0.5, system.gettime() - starttime, 0.1) | ||
12 | end) | ||
13 | end) | ||