mirror of
https://github.com/jefferyjob/go-easy-utils.git
synced 2025-10-12 18:30:08 +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:
@@ -31,6 +31,7 @@ func TestAnyToFloat32(t *testing.T) {
|
||||
{uint64(64), 64, nil},
|
||||
{"3.14", 3.14, nil},
|
||||
{math.MaxFloat64, 0, go_easy_utils.ErrValOut},
|
||||
{make(chan int), 0, go_easy_utils.ErrType},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
@@ -51,6 +52,8 @@ func TestAnyToFloat32(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAnyToFloat64(t *testing.T) {
|
||||
iPtr := 90
|
||||
|
||||
tests := []struct {
|
||||
input interface{}
|
||||
want float64
|
||||
@@ -70,6 +73,13 @@ func TestAnyToFloat64(t *testing.T) {
|
||||
{uint32(32), 32, nil},
|
||||
{uint64(64), 64, nil},
|
||||
{"3.14", 3.14, nil},
|
||||
{true, 1, nil},
|
||||
{false, 0, nil},
|
||||
{complex64(1 + 2i), 1, nil},
|
||||
{complex128(1 + 2i), 1, nil},
|
||||
{&iPtr, 90, nil},
|
||||
{(*int)(nil), 0, nil},
|
||||
{"abc", 0, go_easy_utils.ErrSyntax},
|
||||
{[]int{}, 0, go_easy_utils.ErrType},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user