-
Notifications
You must be signed in to change notification settings - Fork 0
/
graph_test.go
69 lines (60 loc) · 1.97 KB
/
graph_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
57
58
59
60
61
62
63
64
65
66
67
68
69
package bits
import (
"testing"
)
func TestCreateGraphMaskSinZeros(t *testing.T) {
blank := [][]byte{
CreateBytesFromString("0 0 0 0 0 0 0 0"),
CreateBytesFromString("0 0 0 0 0 0 0 0"),
CreateBytesFromString("0 0 0 0 0 0 0 0"),
CreateBytesFromString("0 0 0 0 0 0 0 0"),
CreateBytesFromString("0 0 0 0 0 0 0 0"),
CreateBytesFromString("0 0 0 0 0 0 0 0"),
CreateBytesFromString("0 0 0 0 0 0 0 0"),
CreateBytesFromString("0 0 0 0 0 0 0 0"),
}
graph := [][]byte{
CreateBytesFromString("1 1 1 0 0 0 0 1"),
CreateBytesFromString("1 0 1 0 0 0 1 1"),
CreateBytesFromString("1 0 1 0 0 0 1 0"),
CreateBytesFromString("1 0 1 1 0 0 1 0"),
CreateBytesFromString("0 0 0 1 0 0 1 0"),
CreateBytesFromString("0 0 0 1 0 1 0 0"),
CreateBytesFromString("0 0 0 1 0 1 0 0"),
CreateBytesFromString("0 0 0 0 1 1 0 0"),
}
t.Log("Expected matrix:")
printMatrix(t, graph)
t.Log("Actual matrix:")
newMatrix := SinWave(blank, 4, 1)
printMatrix(t, newMatrix)
assertMatrixMatches(t, graph, newMatrix, 1, true)
}
func TestCreateGraphMaskSinOnes(t *testing.T) {
blank := [][]byte{
CreateBytesFromString("1 1 1 1 1 1 1 1"),
CreateBytesFromString("1 1 1 1 1 1 1 1"),
CreateBytesFromString("1 1 1 1 1 1 1 1"),
CreateBytesFromString("1 1 1 1 1 1 1 1"),
CreateBytesFromString("1 1 1 1 1 1 1 1"),
CreateBytesFromString("1 1 1 1 1 1 1 1"),
CreateBytesFromString("1 1 1 1 1 1 1 1"),
CreateBytesFromString("1 1 1 1 1 1 1 1"),
}
graph := [][]byte{
CreateBytesFromString("0 0 0 1 1 1 1 0"),
CreateBytesFromString("0 1 0 1 1 1 0 0"),
CreateBytesFromString("0 1 0 1 1 1 0 1"),
CreateBytesFromString("0 1 0 0 1 1 0 1"),
CreateBytesFromString("1 1 1 0 1 1 0 1"),
CreateBytesFromString("1 1 1 0 1 0 1 1"),
CreateBytesFromString("1 1 1 0 1 0 1 1"),
CreateBytesFromString("1 1 1 1 0 0 1 1"),
}
t.Log("Expected matrix:")
printMatrix(t, graph)
t.Log("Actual matrix:")
newMatrix := SinWave(blank, 4, 1)
printMatrix(t, newMatrix)
assertMatrixMatches(t, graph, newMatrix, 1, true)
}