Skip to content

Commit

Permalink
fix: some bugs in testcases of pattern16 challenge2
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiwei-Feng committed Jun 17, 2021
1 parent e308801 commit 439fd33
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Pattern16 - Topological Sort/Challenge2/solution_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package Challenge2

import (
"reflect"
"testing"
)

Expand All @@ -24,7 +23,15 @@ func Test_findMinHeightTrees(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := findMinHeightTrees(tt.args.n, tt.args.edges); !reflect.DeepEqual(got, tt.want) {
m := make(map[int]int)
got := findMinHeightTrees(tt.args.n, tt.args.edges)
for _, v := range got {
m[v] = 1
}
for _, v := range tt.want {
delete(m, v)
}
if len(m) != 0 {
t.Errorf("findMinHeightTrees() = %v, want %v", got, tt.want)
}
})
Expand Down

0 comments on commit 439fd33

Please sign in to comment.