示例#1
0
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)
	}
}
示例#2
0
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)

}