1 assert = require "assert"
3 delay = (ms, fn) -> setTimeout fn, ms
6 it "initially gives a near zero (< 20 ms) time ", ->
10 it "gives a positive time", ->
13 it "two subsequent calls return an increasing number", ->
18 it "has less than 10 microseconds overhead", ->
19 Math.abs(now() - now()) < 0.010
21 it "can do 1,000,000 calls really quickly", ->
22 now() for i in [0...1000000]
24 it "shows that at least 990 ms has passed after a timeout of 1 second", (done) ->
29 return done new Error "Diff (#{diff}) lower than 990." if diff < 990
32 it "shows that not more than 1020 ms has passed after a timeout of 1 second", (done) ->
37 return done new Error "Diff (#{diff}) higher than 1020." if diff > 1020