github.com/juju/clock@v1.0.3/monotonic/monotonic_test.go (about)

     1  // Copyright 2017 Canonical Ltd.
     2  // Licensed under the LGPLv3, see LICENCE file for details.
     3  
     4  package monotonic_test
     5  
     6  import (
     7  	"testing"
     8  	"time"
     9  
    10  	gc "gopkg.in/check.v1"
    11  
    12  	"github.com/juju/clock/monotonic"
    13  )
    14  
    15  func TestPackage(t *testing.T) {
    16  	gc.TestingT(t)
    17  }
    18  
    19  type MonotonicSuite struct {
    20  }
    21  
    22  var _ = gc.Suite(&MonotonicSuite{})
    23  
    24  func (s *MonotonicSuite) TestNow(c *gc.C) {
    25  	var prev time.Duration
    26  	for i := 0; i < 1000; i++ {
    27  		val := monotonic.Now()
    28  		if val < prev {
    29  			c.Fatal("now is less than previous value")
    30  		}
    31  		prev = val
    32  	}
    33  }