Skip to content
Snippets Groups Projects
Commit a3d0eea0 authored by Martin Nilsson's avatar Martin Nilsson
Browse files

filter tests.

parent 1c36f69d
Branches
Tags
No related merge requests found
...@@ -566,6 +566,13 @@ test_equal(Array.filter( ({ 1,2,3,4,5,6, }), lambda(int i) { return 1; } ), ...@@ -566,6 +566,13 @@ test_equal(Array.filter( ({ 1,2,3,4,5,6, }), lambda(int i) { return 1; } ),
test_equal(Array.filter( ({ 1,2,3,4,5,6, }), lambda(int i) { return i%2; } ), test_equal(Array.filter( ({ 1,2,3,4,5,6, }), lambda(int i) { return i%2; } ),
({1,3,5})) ({1,3,5}))
test_equal([[ Array.filter( ({}), lambda(int i) { return 1; })]], ({})) test_equal([[ Array.filter( ({}), lambda(int i) { return 1; })]], ({}))
test_eq(filter("\0\1\2", `<, 2), "\0\1")
test_equal(filter((["a":1,"b":2]), `<, 2), (["a":1]))
test_equal(filter((<0,1,2>), `<, 2), (<0,1>))
test_any_equal(class A { constant a=1; constant b=2; }; return filter(A, `<, 2);, (["a":1]))
test_any_equal(class A { protected mixed cast(string t) { if(t=="mapping") return (["a":1,"b":2]);}}; return filter(A(), `<, 2);, (["a":1]))
test_any_equal(class A { protected mixed cast(string t) { if(t=="array") return ({1,2,3});}}; return filter(A(), `<, 2);, ({1}))
test_any_equal(class A { protected mixed cast(string t) { if(t=="multiset") return (<1,2,3>);}}; return filter(A(), `<, 2);, (<1>))
test_equal(Array.permute( ({ 1,2 }), 0 ), test_equal(Array.permute( ({ 1,2 }), 0 ),
({ 1,2 })) ({ 1,2 }))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment