wireguard-go/internal/tai64n/tai64n_test.go
Mathias Hall-Andersen ea4ea6f933 Revert "Don't use modules"
This reverts commit bffe99aead.
2018-02-12 22:29:11 +01:00

22 lines
370 B
Go

package tai64n
import (
"testing"
"time"
)
/* Testing the essential property of the timestamp
* as used by WireGuard.
*/
func TestMonotonic(t *testing.T) {
old := Now()
for i := 0; i < 10000; i++ {
time.Sleep(time.Nanosecond)
next := Now()
if !next.After(old) {
t.Error("TAI64N, not monotonically increasing on nano-second scale")
}
old = next
}
}