nanotime_test.go 523 B

12345678910111213141516171819202122
  1. // Copyright (C) 2016 Arista Networks, Inc.
  2. // Use of this source code is governed by the Apache License 2.0
  3. // Package monotime provides a fast monotonic clock source.
  4. package monotime
  5. import (
  6. "testing"
  7. )
  8. func TestNow(t *testing.T) {
  9. for i := 0; i < 100; i++ {
  10. t1 := Now()
  11. t2 := Now()
  12. // I honestly thought that we needed >= here, but in some environments
  13. // two consecutive calls can return the same value!
  14. if t1 > t2 {
  15. t.Fatalf("t1=%d should have been less than or equal to t2=%d", t1, t2)
  16. }
  17. }
  18. }