mirror of https://github.com/01-edu/public.git
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.
34 lines
594 B
34 lines
594 B
![]()
4 years ago
|
// +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.Errorf("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.Errorf("expected %s instead of %v\n",
|
||
|
a.Data,
|
||
|
b,
|
||
|
)
|
||
|
} else if a == nil && b != nil {
|
||
|
t.Errorf("expected %v instead of %v\n",
|
||
|
a,
|
||
|
b.Data,
|
||
|
)
|
||
|
}
|
||
|
}
|