aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_time_spec.lua
blob: 54a99b824829578259b7da8830e5be25662940f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
describe("util.time", function ()
	local time;
	setup(function ()
		time = require "util.time";
	end);
	describe("now()", function ()
		it("exists", function ()
			assert.is_function(time.now);
		end);
		it("returns a number", function ()
			assert.is_number(time.now());
		end);
	end);
	describe("monotonic()", function ()
		it("exists", function ()
			assert.is_function(time.monotonic);
		end);
		it("returns a number", function ()
			assert.is_number(time.monotonic());
		end);
		it("time goes in one direction", function ()
			local a = time.monotonic();
			local b	= time.monotonic();
			assert.truthy(a <= b);
		end);
	end);
end);