You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
// +build ignore
|
|
|
|
|
|
|
|
package solutions
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
student "../student"
|
|
|
|
)
|
|
|
|
|
|
|
|
func CompareNode(t *testing.T, a *solutions.TreeNode, b *student.TreeNode) {
|
|
|
|
if a != nil && b != nil {
|
|
|
|
if a.Data != b.Data {
|
|
|
|
t.Fatalf("expected %s instead of %s\n",
|
|
|
|
a.Data,
|
|
|
|
b.Data,
|
|
|
|
)
|
|
|
|
CompareNode(t, a.Parent, b.Parent)
|
|
|
|
CompareNode(t, a.Left, b.Left)
|
|
|
|
CompareNode(t, a.Right, b.Right)
|
|
|
|
}
|
|
|
|
} else if a != nil && b == nil {
|
|
|
|
t.Fatalf("expected %s instead of %v\n",
|
|
|
|
a.Data,
|
|
|
|
b,
|
|
|
|
)
|
|
|
|
} else if a == nil && b != nil {
|
|
|
|
t.Fatalf("expected %v instead of %v\n",
|
|
|
|
a,
|
|
|
|
b.Data,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|