-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathstatic_test.go
More file actions
33 lines (25 loc) · 779 Bytes
/
Copy pathstatic_test.go
File metadata and controls
33 lines (25 loc) · 779 Bytes
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
package rush
import (
"reflect"
"testing"
)
func TestBlockedSquares(t *testing.T) {
test := func(w int, positions, sizes, blocked, expected []int) {
result := theStaticAnalyzer.blockedSquares(w, positions, sizes, blocked)
if !reflect.DeepEqual(result, expected) {
t.Fail()
}
}
// ..xAA. => ....x.
test(6, []int{3}, []int{2}, []int{2}, []int{4})
// AAA.BB => .xx.x.
test(6, []int{0, 4}, []int{3, 2}, []int{}, []int{1, 2, 4})
// AA..BB => ......
test(6, []int{0, 4}, []int{2, 2}, []int{}, []int{})
// .x.AA. => ......
test(6, []int{3}, []int{2}, []int{1}, []int{})
// .xAA..BBx.. => ...........
test(11, []int{2, 6}, []int{2, 2}, []int{1, 8}, []int{})
// .xAAA.BBx.. => ...xx.x....
test(11, []int{2, 6}, []int{3, 2}, []int{1, 8}, []int{3, 4, 6})
}