Branch: Tag:

2014-08-28

2014-08-28 16:47:20 by Martin Nilsson <nilsson@opera.com>

filter tests.

566:   test_equal(Array.filter( ({ 1,2,3,4,5,6, }), lambda(int i) { return i%2; } ),    ({1,3,5}))   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 ),    ({ 1,2 }))