mirror of
https://github.com/jefferyjob/go-easy-utils.git
synced 2025-11-02 21:14:07 +08:00
version 1.0.1 (#8)
* anyutil test * fix:delete debug * unit test utils * unit test * strUtil unit test * fix;4, 6, 9, 11 Month determination error * fix:The last digit of ID number is x, and the weighted sum comparison condition is wrong * test * test * docs * fix:docs * idcard test * test unit * no message * docs update * 单元测试覆盖 --------- Co-authored-by: libin <libinjob@163.com> Co-authored-by: 李斌 <libin1-hj@huafang.com>
This commit is contained in:
@@ -17,6 +17,7 @@ func TestAnyToUint(t *testing.T) {
|
||||
{-5, 0, go_easy_utils.ErrUnsignedInt},
|
||||
{"20", 20, nil},
|
||||
{1.5, 1, nil},
|
||||
{make(chan int), 0, go_easy_utils.ErrType},
|
||||
}
|
||||
|
||||
// Test loop
|
||||
@@ -40,6 +41,7 @@ func TestAnyToUint8(t *testing.T) {
|
||||
{300, 0, go_easy_utils.ErrValOut},
|
||||
{"20", 20, nil},
|
||||
{1.5, 1, nil},
|
||||
{make(chan int), 0, go_easy_utils.ErrType},
|
||||
}
|
||||
|
||||
// Test loop
|
||||
@@ -63,6 +65,7 @@ func TestAnyToUint16(t *testing.T) {
|
||||
{70000, 0, go_easy_utils.ErrValOut},
|
||||
{"20", 20, nil},
|
||||
{1.5, 1, nil},
|
||||
{make(chan int), 0, go_easy_utils.ErrType},
|
||||
}
|
||||
|
||||
// Test loop
|
||||
@@ -86,6 +89,7 @@ func TestAnyToUint32(t *testing.T) {
|
||||
{5000000000, 0, go_easy_utils.ErrValOut},
|
||||
{"20", 20, nil},
|
||||
{1.5, 1, nil},
|
||||
{make(chan int), 0, go_easy_utils.ErrType},
|
||||
}
|
||||
|
||||
// Test loop
|
||||
@@ -99,6 +103,8 @@ func TestAnyToUint32(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAnyToUint64(t *testing.T) {
|
||||
iPtr := 90
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
input interface{}
|
||||
@@ -231,6 +237,21 @@ func TestAnyToUint64(t *testing.T) {
|
||||
input: false,
|
||||
want: 0,
|
||||
},
|
||||
{
|
||||
name: "Test int point",
|
||||
input: &iPtr,
|
||||
want: 90,
|
||||
},
|
||||
{
|
||||
name: "Test nil",
|
||||
input: nil,
|
||||
want: 0,
|
||||
},
|
||||
{
|
||||
name: "test -complex",
|
||||
input: complex(-1, -1),
|
||||
wantError: go_easy_utils.ErrUnsignedInt,
|
||||
},
|
||||
{
|
||||
name: "Test invalid type",
|
||||
input: make(chan int),
|
||||
|
||||
Reference in New Issue
Block a user