func assertRandomRootNode(t *testing.T, expected string, discovery d.Discovery) { rootNode := discovery.GetRandomNode() if rootNode != expected { t.Fatalf("RootNode's value should be '%s'", expected) } }
func assertRootNodeRandomValues(t *testing.T, expected []string, discovery d.Discovery) { rootNode := discovery.GetRandomNode() if !inArray(rootNode, expected) { t.Fatalf("RootNode's value should be one of '%v'", expected) } // Now test that a random value is sometimes returned for i := 0; i < 100; i++ { if val := discovery.GetRandomNode(); rootNode != val { return } } t.Fatalf("returned value was always %s", rootNode) }