mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-12 08:42:29 +08:00
Slice: Add none func (#13)
Returns true whether no elements of this slice match the provided predicate func. Negated form of Every func
This commit is contained in:
@@ -108,6 +108,18 @@ func TestEvery(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNone(t *testing.T) {
|
||||
nums := []int{1, 2, 3, 5}
|
||||
check := func(i, num int) bool {
|
||||
return num%2 == 1
|
||||
}
|
||||
res := None(nums, check)
|
||||
if res != false {
|
||||
internal.LogFailedTestInfo(t, "Every", nums, false, res)
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
func TestSome(t *testing.T) {
|
||||
nums := []int{1, 2, 3, 5}
|
||||
isEven := func(i, num int) bool {
|
||||
|
||||
Reference in New Issue
Block a user