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

Function TestNodeID

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

Source from the content-addressed store, hash-verified

423}
424
425func TestNodeID(t *testing.T) {
426 nid := []byte{1, 2, 3, 4, 5, 6}
427 SetNodeInterface("")
428 s := NodeInterface()
429 if runtime.GOARCH != "js" {
430 if s == "" || s == "user" {
431 t.Errorf("NodeInterface %q after SetInterface", s)
432 }
433 }
434 node1 := NodeID()
435 if node1 == nil {
436 t.Error("NodeID nil after SetNodeInterface", s)
437 }
438 SetNodeID(nid)
439 s = NodeInterface()
440 if s != "user" {
441 t.Errorf("Expected NodeInterface %q got %q", "user", s)
442 }
443 node2 := NodeID()
444 if node2 == nil {
445 t.Error("NodeID nil after SetNodeID", s)
446 }
447 if bytes.Equal(node1, node2) {
448 t.Error("NodeID not changed after SetNodeID", s)
449 } else if !bytes.Equal(nid, node2) {
450 t.Errorf("NodeID is %x, expected %x", node2, nid)
451 }
452}
453
454func testDCE(t *testing.T, name string, uuid UUID, err error, domain Domain, id uint32) {
455 if err != nil {

Callers

nothing calls this directly

Calls 5

SetNodeInterfaceFunction · 0.85
NodeInterfaceFunction · 0.85
NodeIDFunction · 0.85
SetNodeIDFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected