-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgt_null_uint_test.go
37 lines (33 loc) · 1.01 KB
/
gt_null_uint_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
package gt_test
import (
"testing"
"github.com/mitranim/gt"
)
// TODO: test various invalid inputs.
func TestNullUint(t *testing.T) {
var (
primZero = uint64(0)
primNonZero = uint64(123)
zero = gt.NullUint(primZero)
nonZero = gt.NullUint(primNonZero)
dec = new(gt.NullUint)
)
t.Run(`Decodable/sql.Scanner`, func(t *testing.T) {
t.Run(`uint`, func(t *testing.T) {
testScanEmpty(t, zero, nonZero, dec, uint(primZero))
testScanNonEmpty(t, zero, nonZero, dec, uint(primNonZero))
})
t.Run(`uint8`, func(t *testing.T) {
testScanEmpty(t, zero, nonZero, dec, uint8(primZero))
testScanNonEmpty(t, zero, nonZero, dec, uint8(primNonZero))
})
t.Run(`uint16`, func(t *testing.T) {
testScanEmpty(t, zero, nonZero, dec, uint16(primZero))
testScanNonEmpty(t, zero, nonZero, dec, uint16(primNonZero))
})
t.Run(`uint32`, func(t *testing.T) {
testScanEmpty(t, zero, nonZero, dec, uint32(primZero))
testScanNonEmpty(t, zero, nonZero, dec, uint32(primNonZero))
})
})
}