Browse Source

tai64n: account for whitening in test

Jason A. Donenfeld 1 year ago
parent
commit
d0ab883ada
1 changed files with 7 additions and 3 deletions
  1. 7
    3
      tai64n/tai64n_test.go

+ 7
- 3
tai64n/tai64n_test.go View File

@@ -15,11 +15,15 @@ import (
15 15
  */
16 16
 func TestMonotonic(t *testing.T) {
17 17
 	old := Now()
18
-	for i := 0; i < 10000; i++ {
19
-		time.Sleep(time.Nanosecond)
18
+	for i := 0; i < 50; i++ {
20 19
 		next := Now()
20
+		if next.After(old) {
21
+			t.Error("Whitening insufficient")
22
+		}
23
+		time.Sleep(time.Duration(whitenerMask)/time.Nanosecond + 1)
24
+		next = Now()
21 25
 		if !next.After(old) {
22
-			t.Error("TAI64N, not monotonically increasing on nano-second scale")
26
+			t.Error("Not monotonically increasing on whitened nano-second scale")
23 27
 		}
24 28
 		old = next
25 29
 	}

Loading…
Cancel
Save