-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuint128_iszero_test.go
61 lines (51 loc) · 1.03 KB
/
uint128_iszero_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
package bits128_test
import (
"testing"
"github.com/reiver/go-bits128"
)
func TestUint128_IsZero(t *testing.T) {
tests := []struct{
Uint128 bits128.Uint128
Expected bool
}{
{
Uint128: bits128.Uint128FromUint8(0),
Expected: true,
},
{
Uint128: bits128.Uint128FromUint8(1),
Expected: false,
},
{
Uint128: bits128.Uint128FromUint8(2),
Expected: false,
},
{
Uint128: bits128.Uint128FromUint8(3),
Expected: false,
},
{
Uint128: bits128.Uint128FromUint8(4),
Expected: false,
},
{
Uint128: bits128.Uint128FromUint8(5),
Expected: false,
},
{
Uint128: bits128.MaxUint128(),
Expected: false,
},
}
for testNumber, test := range tests {
var actual bool = test.Uint128.IsZero()
var expected bool = test.Expected
if expected != actual {
t.Errorf("For test #%d, the actual is-zero value is not what was expected.", testNumber)
t.Logf("EXPECTED: %t", expected)
t.Logf("ACTUAL: %t", actual)
t.Logf("INT128: %s", test.Uint128.HexString())
continue
}
}
}