File: monotonic_test.go

package info (click to toggle)
golang-github-juju-clock 1.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 176 kB
  • sloc: makefile: 18
file content (33 lines) | stat: -rw-r--r-- 539 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2017 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.

package monotonic_test

import (
	"testing"
	"time"

	gc "gopkg.in/check.v1"

	"github.com/juju/clock/monotonic"
)

func TestPackage(t *testing.T) {
	gc.TestingT(t)
}

type MonotonicSuite struct {
}

var _ = gc.Suite(&MonotonicSuite{})

func (s *MonotonicSuite) TestNow(c *gc.C) {
	var prev time.Duration
	for i := 0; i < 1000; i++ {
		val := monotonic.Now()
		if val < prev {
			c.Fatal("now is less than previous value")
		}
		prev = val
	}
}