refactor: rewrite all unit test functions with assert

This commit is contained in:
dudaodong committed 2022-01-09 14:01:51 +08:00
1 parent 25b2ae6b98
commit 642d0b8077
1 file changed
+3 -2
+3 -2
View File
@@ -31,14 +31,14 @@ func TestRandInt(t *testing.T) {
assert := internal.NewAssert(t, "TestRandInt") assert := internal.NewAssert(t, "TestRandInt")
r1 := RandInt(1, 10) r1 := RandInt(1, 10)
assert.Greater(r1, 1) assert.GreaterOrEqual(r1, 1)
assert.Less(r1, 10) assert.Less(r1, 10)
r2 := RandInt(1, 1) r2 := RandInt(1, 1)
assert.Equal(1, r2) assert.Equal(1, r2)
r3 := RandInt(10, 1) r3 := RandInt(10, 1)
assert.Greater(r1, 1) assert.GreaterOrEqual(r1, 1)
assert.Less(r3, 10) assert.Less(r3, 10)
} }
@@ -53,4 +53,5 @@ func TestRandBytes(t *testing.T) {
assert.Equal(reflect.Slice, v.Kind()) assert.Equal(reflect.Slice, v.Kind())
assert.Equal(reflect.Uint8, elemType.Kind()) assert.Equal(reflect.Uint8, elemType.Kind())
assert.Equal([]byte{}, RandBytes(0))
} }