github.com/mkevac/monotime@v0.0.0-20161125163931-92ece95d55b6/monotime_test.go (about)

     1  // Copyright (C) 2016  Arista Networks, Inc.
     2  // Use of this source code is governed by the Apache License 2.0
     3  // that can be found in the COPYING file.
     4  
     5  // Package monotime provides a fast monotonic clock source.
     6  package monotime
     7  
     8  import (
     9  	"testing"
    10  )
    11  
    12  func TestNanoseconds(t *testing.T) {
    13  	for i := 0; i < 100; i++ {
    14  		t1 := Nanoseconds()
    15  		t2 := Nanoseconds()
    16  		if t1 >= t2 {
    17  			t.Fatalf("t1=%d should have been strictly less than t2=%d", t1, t2)
    18  		}
    19  	}
    20  }