-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_test.go
174 lines (136 loc) · 2.67 KB
/
get_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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
package sbm
import (
"testing"
"github.com/vault-thirteen/auxie/bit"
"github.com/vault-thirteen/auxie/tester"
)
func Test_GetFormat(t *testing.T) {
var format SbmFormat
var formatExpected SbmFormat
var sbm *Sbm
var tst *tester.Test
tst = tester.New(t)
sbm = &Sbm{
format: SbmFormat{
version: SbmFormatVersion1,
},
}
formatExpected = SbmFormat{
version: SbmFormatVersion1,
}
// Get the format.
format = sbm.GetFormat()
// Check the result.
tst.MustBeEqual(format, formatExpected)
}
func Test_GetArrayBytes(t *testing.T) {
var arrayBytes []byte
var arrayBytesExpected []byte
var sbm *Sbm
var tst *tester.Test
tst = tester.New(t)
sbm = &Sbm{
pixelArray: SbmPixelArray{
data: SbmPixelArrayData{
bytes: []byte{
1,
2,
3,
},
},
},
}
arrayBytesExpected = []byte{
1,
2,
3,
}
// Get the format.
arrayBytes = sbm.GetArrayBytes()
// Check the result.
tst.MustBeEqual(arrayBytes, arrayBytesExpected)
}
func Test_GetArrayBits(t *testing.T) {
var arrayBits []bit.Bit
var arrayBitsExpected []bit.Bit
var sbm *Sbm
var tst *tester.Test
tst = tester.New(t)
sbm = &Sbm{
pixelArray: SbmPixelArray{
data: SbmPixelArrayData{
bits: []bit.Bit{
bit.One,
bit.Zero,
bit.One,
},
},
},
}
arrayBitsExpected = []bit.Bit{
bit.One,
bit.Zero,
bit.One,
}
// Get the format.
arrayBits = sbm.GetArrayBits()
// Check the result.
tst.MustBeEqual(arrayBits, arrayBitsExpected)
}
func Test_GetArrayWidth(t *testing.T) {
var arrayWidth uint
var arrayWidthExpected uint
var sbm *Sbm
var tst *tester.Test
tst = tester.New(t)
sbm = &Sbm{
pixelArray: SbmPixelArray{
metaData: SbmPixelArrayMetaData{
width: 123,
},
},
}
arrayWidthExpected = 123
// Get the format.
arrayWidth = sbm.GetArrayWidth()
// Check the result.
tst.MustBeEqual(arrayWidth, arrayWidthExpected)
}
func Test_GetArrayHeight(t *testing.T) {
var arrayHeight uint
var arrayHeightExpected uint
var sbm *Sbm
var tst *tester.Test
tst = tester.New(t)
sbm = &Sbm{
pixelArray: SbmPixelArray{
metaData: SbmPixelArrayMetaData{
height: 456,
},
},
}
arrayHeightExpected = 456
// Get the format.
arrayHeight = sbm.GetArrayHeight()
// Check the result.
tst.MustBeEqual(arrayHeight, arrayHeightExpected)
}
func Test_GetArrayArea(t *testing.T) {
var arrayArea uint
var arrayAreaExpected uint
var sbm *Sbm
var tst *tester.Test
tst = tester.New(t)
sbm = &Sbm{
pixelArray: SbmPixelArray{
metaData: SbmPixelArrayMetaData{
area: 789,
},
},
}
arrayAreaExpected = 789
// Get the format.
arrayArea = sbm.GetArrayArea()
// Check the result.
tst.MustBeEqual(arrayArea, arrayAreaExpected)
}