github.com/leanovate/gopter@v0.2.9/gen/time_shrink_test.go (about)

     1  package gen_test
     2  
     3  import (
     4  	"reflect"
     5  	"testing"
     6  	"time"
     7  
     8  	"github.com/leanovate/gopter/gen"
     9  )
    10  
    11  func TestTimeShrink(t *testing.T) {
    12  	timeShrink := gen.TimeShrinker(time.Unix(20, 10)).All()
    13  	if !reflect.DeepEqual(timeShrink, []interface{}{
    14  		time.Unix(0, 10),
    15  		time.Unix(20, 0),
    16  		time.Unix(10, 10),
    17  		time.Unix(20, 5),
    18  		time.Unix(15, 10),
    19  		time.Unix(20, 8),
    20  		time.Unix(18, 10),
    21  		time.Unix(20, 9),
    22  		time.Unix(19, 10),
    23  	}) {
    24  		t.Errorf("Invalid timeShrink: %#v", timeShrink)
    25  	}
    26  
    27  }