-
Notifications
You must be signed in to change notification settings - Fork 19
/
numbervalid_test.go
57 lines (48 loc) · 1.07 KB
/
numbervalid_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
package gongular
import (
"reflect"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCheckIntRangeInt8(t *testing.T) {
var i int64
i = 30
bool, _, _ := checkIntRange(reflect.Int8, i)
assert.True(t, bool)
}
func TestCheckIntNotRangeInt8(t *testing.T) {
var i int64
i = 300
bool, _, _ := checkIntRange(reflect.Int8, i)
assert.False(t, bool)
}
func TestCheckIntRangeInt16(t *testing.T) {
var i int64
i = 4398
bool, _, _ := checkIntRange(reflect.Int16, i)
assert.True(t, bool)
}
func TestCheckIntNotRangeInt16(t *testing.T) {
var i int64
i = 30000000
bool, _, _ := checkIntRange(reflect.Int16, i)
assert.False(t, bool)
}
func TestCheckIntRangeInt(t *testing.T) {
var i int64
i = 912389012
bool, _, _ := checkIntRange(reflect.Int32, i)
assert.True(t, bool)
}
func TestCheckIntNotRangeInt(t *testing.T) {
var i int64
i = 30000000000000
bool, _, _ := checkIntRange(reflect.Int32, i)
assert.False(t, bool)
}
func TestCheckIntRangeInt64(t *testing.T) {
var i int64
i = 912389012132
bool, _, _ := checkIntRange(reflect.Int64, i)
assert.True(t, bool)
}