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

Function TestCoding

uuid_test.go:280–304  ·  uuid_test.go::TestCoding
(t *testing.T)

Source from the content-addressed store, hash-verified

278}
279
280func TestCoding(t *testing.T) {
281 text := "7d444840-9dc0-11d1-b245-5ffdce74fad2"
282 urn := "urn:uuid:7d444840-9dc0-11d1-b245-5ffdce74fad2"
283 data := UUID{
284 0x7d, 0x44, 0x48, 0x40,
285 0x9d, 0xc0,
286 0x11, 0xd1,
287 0xb2, 0x45,
288 0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2,
289 }
290 if v := data.String(); v != text {
291 t.Errorf("%x: encoded to %s, expected %s", data, v, text)
292 }
293 if v := data.URN(); v != urn {
294 t.Errorf("%x: urn is %s, expected %s", data, v, urn)
295 }
296
297 uuid, err := Parse(text)
298 if err != nil {
299 t.Errorf("Parse returned unexpected error %v", err)
300 }
301 if data != uuid {
302 t.Errorf("%s: decoded to %s, expected %s", text, uuid, data)
303 }
304}
305
306func TestVersion1(t *testing.T) {
307 uuid1, err := NewUUID()

Callers

nothing calls this directly

Calls 3

StringMethod · 0.95
URNMethod · 0.95
ParseFunction · 0.85

Tested by

no test coverage detected