| 387 | } |
| 388 | |
| 389 | func 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 | |
| 409 | func TestMD5(t *testing.T) { |
| 410 | uuid := NewMD5(NameSpaceDNS, []byte("python.org")).String() |