-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathtree_test.go
56 lines (45 loc) · 1.2 KB
/
tree_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package build
import "testing"
func TestTree(t *testing.T) {
exp := "0 []"
if mess, diff := diff(Tree(1, 0).String(), exp); diff {
t.Errorf("Tree %s", mess)
}
exp = "1 []"
if mess, diff := diff(Tree(1, 1).String(), exp); diff {
t.Errorf("Tree %s", mess)
}
exp = "2 [{0 1}]"
if mess, diff := diff(Tree(1, 2).String(), exp); diff {
t.Errorf("Tree %s", mess)
}
exp = "0 []"
if mess, diff := diff(Tree(2, 0).String(), exp); diff {
t.Errorf("Tree %s", mess)
}
exp = "1 []"
if mess, diff := diff(Tree(2, 1).String(), exp); diff {
t.Errorf("Tree %s", mess)
}
exp = "3 [{0 1} {0 2}]"
if mess, diff := diff(Tree(2, 2).String(), exp); diff {
t.Errorf("Tree %s", mess)
}
exp = "7 [{0 1} {0 2} {1 3} {1 4} {2 5} {2 6}]"
if mess, diff := diff(Tree(2, 3).String(), exp); diff {
t.Errorf("Tree %s", mess)
}
exp = "4 [{0 1} {0 2} {0 3}]"
if mess, diff := diff(Tree(3, 2).String(), exp); diff {
t.Errorf("Tree %s", mess)
}
exp = "13 [{0 1} {0 2} {0 3} {1 4} {1 5} {1 6} {2 7} {2 8} {2 9} {3 10} {3 11} {3 12}]"
if mess, diff := diff(Tree(3, 3).String(), exp); diff {
t.Errorf("Tree %s", mess)
}
for k := 1; k < 4; k++ {
for n := 0; n < 4; n++ {
Consistent("Tree", t, Tree(k, n))
}
}
}