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

Function TestNodeAndTime

uuid_test.go:389–407  ·  uuid_test.go::TestNodeAndTime
(t *testing.T)

Source from the content-addressed store, hash-verified

387}
388
389func TestNodeAndTime(t *testing.T) {
390 // Time is February 5, 1998 12:30:23.136364800 AM GMT
391
392 uuid, err := Parse("7d444840-9dc0-11d1-b245-5ffdce74fad2")
393 if err != nil {
394 t.Fatalf("Parser returned unexpected error %v", err)
395 }
396 node := []byte{0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2}
397
398 ts := uuid.Time()
399 c := time.Unix(ts.UnixTime())
400 want := time.Date(1998, 2, 5, 0, 30, 23, 136364800, time.UTC)
401 if !c.Equal(want) {
402 t.Errorf("Got time %v, want %v", c, want)
403 }
404 if !bytes.Equal(node, uuid.NodeID()) {
405 t.Errorf("Expected node %v got %v", node, uuid.NodeID())
406 }
407}
408
409func TestMD5(t *testing.T) {
410 uuid := NewMD5(NameSpaceDNS, []byte("python.org")).String()

Callers

nothing calls this directly

Calls 4

ParseFunction · 0.85
TimeMethod · 0.80
UnixTimeMethod · 0.80
NodeIDMethod · 0.80

Tested by

no test coverage detected