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

Function TestVersion7_pooled

uuid_test.go:849–872  ·  view source on GitHub ↗

uuid v7 time is only unix milliseconds, so uuid1.Time() == uuid2.Time() is right, but uuid1 must != uuid2

(t *testing.T)

Source from the content-addressed store, hash-verified

847// uuid v7 time is only unix milliseconds, so
848// uuid1.Time() == uuid2.Time() is right, but uuid1 must != uuid2
849func TestVersion7_pooled(t *testing.T) {
850 SetRand(nil)
851 EnableRandPool()
852 defer DisableRandPool()
853
854 m := make(map[string]bool)
855 for x := 1; x < 128; x++ {
856 uuid, err := NewV7()
857 if err != nil {
858 t.Fatalf("could not create UUID: %v", err)
859 }
860 s := uuid.String()
861 if m[s] {
862 t.Errorf("NewV7 returned duplicated UUID %s", s)
863 }
864 m[s] = true
865 if v := uuid.Version(); v != 7 {
866 t.Errorf("UUID of version %s", v)
867 }
868 if uuid.Variant() != RFC4122 {
869 t.Errorf("UUID is variant %d", uuid.Variant())
870 }
871 }
872}
873
874func TestVersion7FromReader(t *testing.T) {
875 myString := "8059ddhdle77cb52"

Callers

nothing calls this directly

Calls 7

SetRandFunction · 0.85
EnableRandPoolFunction · 0.85
DisableRandPoolFunction · 0.85
NewV7Function · 0.85
VersionMethod · 0.80
VariantMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected