github.com/scaleft/monotime@v0.0.0-20180209174256-2da272f3dad0/monotime_test.go (about)

     1  package monotime
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  )
     8  
     9  func TestNow(t *testing.T) {
    10  	start := Now()
    11  	require.NotEmpty(t, start)
    12  
    13  	end := Now()
    14  	require.NotEmpty(t, end)
    15  	require.NotEmpty(t, start, end)
    16  
    17  	d := Duration(start, end)
    18  	require.NotEmpty(t, d)
    19  }
    20  
    21  func TestTimer(t *testing.T) {
    22  	d := New()
    23  	require.NotEmpty(t, d)
    24  
    25  	x := d.Elapsed()
    26  	require.NotEmpty(t, x)
    27  	require.True(t, x > 0)
    28  }