mirror of
https://github.com/duke-git/lancet.git
synced 2026-03-01 00:35:28 +08:00
refactor: rewrite all unit test functions with assert
This commit is contained in:
@@ -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))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user