MCPcopy
hub / github.com/google/uuid / TestVersion7MonotonicityStrict

Function TestVersion7MonotonicityStrict

uuid_test.go:909–930  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

907}
908
909func TestVersion7MonotonicityStrict(t *testing.T) {
910 timeNow = func() time.Time {
911 return time.Date(2008, 8, 8, 8, 8, 8, 8, time.UTC)
912 }
913 defer func() {
914 timeNow = time.Now
915 }()
916
917 SetRand(fakeRand{})
918 defer SetRand(nil)
919
920 length := 100000 // > 3906
921 u1 := Must(NewV7())
922 for i := 0; i < length; i++ {
923 u2 := Must(NewV7())
924 if Compare(u1, u2) >= 0 {
925 t.Errorf("monotonicity failed at #%d: %s(next) < %s(before)", i, u2, u1)
926 break
927 }
928 u1 = u2
929 }
930}

Callers

nothing calls this directly

Calls 4

SetRandFunction · 0.85
MustFunction · 0.85
NewV7Function · 0.85
CompareFunction · 0.85

Tested by

no test coverage detected