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

Function TestNew

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

Source from the content-addressed store, hash-verified

204}
205
206func TestNew(t *testing.T) {
207 m := make(map[UUID]bool)
208 for x := 1; x < 32; x++ {
209 s := New()
210 if m[s] {
211 t.Errorf("New returned duplicated UUID %s", s)
212 }
213 m[s] = true
214 uuid, err := Parse(s.String())
215 if err != nil {
216 t.Errorf("New.String() returned %q which does not decode", s)
217 continue
218 }
219 if v := uuid.Version(); v != 4 {
220 t.Errorf("Random UUID of version %s", v)
221 }
222 if uuid.Variant() != RFC4122 {
223 t.Errorf("Random UUID is variant %d", uuid.Variant())
224 }
225 }
226}
227
228func TestClockSeq(t *testing.T) {
229 // Fake time.Now for this test to return a monotonically advancing time; restore it at end.

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
ParseFunction · 0.85
VersionMethod · 0.80
VariantMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected