-
Notifications
You must be signed in to change notification settings - Fork 0
/
node_test.go
45 lines (38 loc) · 1.38 KB
/
node_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
package marchingsquares
import "testing"
func Test_NewNode(t *testing.T) {
n := NewNode(Vector2{1, 2})
t.Logf("n: %#+v\n", n)
}
func Test_NewControlNode(t *testing.T) {
// topleft
n := NewControlNode(Vector2{0, 0}, true, 10)
t.Logf("topleft active: %v", n.active)
t.Logf("above : %v", n.above.position)
t.Logf("node : %v", n.node.position)
t.Logf("right : %v\n\n", n.right.position)
// topright
n = NewControlNode(Vector2{0, 10}, false, 10)
t.Logf("topright active: %v", n.active)
t.Logf("above : %v", n.above.position)
t.Logf("node : %v", n.node.position)
t.Logf("right : %v\n\n", n.right.position)
// bottomleft
n = NewControlNode(Vector2{10, 0}, false, 10)
t.Logf("bottomleft active: %v", n.active)
t.Logf("above : %v", n.above.position)
t.Logf("node : %v", n.node.position)
t.Logf("right : %v\n\n", n.right.position)
// bottomright
n = NewControlNode(Vector2{10, 10}, false, 10)
t.Logf("bottomright active: %v", n.active)
t.Logf("above : %v", n.above.position)
t.Logf("node : %v", n.node.position)
t.Logf("right : %v\n\n", n.right.position)
}
func Test_Consumption(t *testing.T) {
n := NewControlNode(Vector2{2, 1}, false, 10)
t.Logf("IsConsumed: %#+v\n", n.above.IsConsumed())
n.above.Consume()
t.Logf("IsConsumed: %#+v\n\n", n.above.IsConsumed())
}