From: Jason A. Donenfeld Date: Wed, 29 May 2019 16:43:17 +0000 (+0200) Subject: tai64n: account for whitening in test X-Git-Tag: 0.0.20190805~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0ab883adaae3b458ec6a54af04c9df347f378f5;p=thirdparty%2Fwireguard-go.git tai64n: account for whitening in test --- diff --git a/tai64n/tai64n_test.go b/tai64n/tai64n_test.go index 36b0c57..859660f 100644 --- a/tai64n/tai64n_test.go +++ b/tai64n/tai64n_test.go @@ -15,11 +15,15 @@ import ( */ func TestMonotonic(t *testing.T) { old := Now() - for i := 0; i < 10000; i++ { - time.Sleep(time.Nanosecond) + for i := 0; i < 50; i++ { next := Now() + if next.After(old) { + t.Error("Whitening insufficient") + } + time.Sleep(time.Duration(whitenerMask)/time.Nanosecond + 1) + next = Now() if !next.After(old) { - t.Error("TAI64N, not monotonically increasing on nano-second scale") + t.Error("Not monotonically increasing on whitened nano-second scale") } old = next }