mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
array: test !in and filter
This commit is contained in:
parent
449d839684
commit
39245f088a
@ -452,6 +452,8 @@ fn test_in() {
|
||||
assert 3 in a
|
||||
assert !(4 in a)
|
||||
assert !(0 in a)
|
||||
assert 0 !in a
|
||||
assert 4 !in a
|
||||
}
|
||||
|
||||
fn sum(prev int, curr int) int {
|
||||
@ -490,6 +492,13 @@ fn test_filter() {
|
||||
d := c.filter(it.len > 1)
|
||||
assert d[0] == 'is'
|
||||
assert d[1] == 'awesome'
|
||||
////////
|
||||
arr :=[1,2,3,4,5,6,7,8,9,10]
|
||||
println(arr.filter(it % 2 == 0 || it % 3 == 0))
|
||||
assert true
|
||||
assert [1,2,3].len == 3
|
||||
// TODO
|
||||
//assert arr.filter(arr % 2).len == 5
|
||||
}
|
||||
|
||||
fn test_map() {
|
||||
|
Loading…
Reference in New Issue
Block a user