digraph: fix flaky test

This commit is contained in:
Mitchell Hashimoto 2014-07-02 11:30:09 -07:00
parent c493d60358
commit ae07b26908
1 changed files with 8 additions and 4 deletions

View File

@ -33,11 +33,15 @@ d -> e`)
t.Fatalf("bad: %v", sccs)
}
if cycle[0].(*BasicNode).Name != "c" {
t.Fatalf("bad: %v", cycle)
cycleNodes := make([]string, len(cycle))
for i, c := range cycle {
cycleNodes[i] = c.(*BasicNode).Name
}
if cycle[1].(*BasicNode).Name != "b" {
t.Fatalf("bad: %v", cycle)
sort.Strings(cycleNodes)
expected := []string{"b", "c"}
if !reflect.DeepEqual(cycleNodes, expected) {
t.Fatalf("bad: %#v", cycleNodes)
}
}