diff options
Diffstat (limited to 'filter/test.conf')
-rw-r--r-- | filter/test.conf | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/filter/test.conf b/filter/test.conf index a8c3a508..e65b3ebb 100644 --- a/filter/test.conf +++ b/filter/test.conf @@ -31,6 +31,11 @@ function 'mkpair-a'(int a) return (1, a); } +function mktrip(int a) +{ + return (a, 2*a, 3*a); +} + function mkpath(int a; int b) { return [= a b 3 2 1 =]; @@ -95,6 +100,8 @@ clist l; clist l2; eclist el; eclist el2; +lclist ll; +lclist ll2; { print "Entering path test..."; pm1 = / 4 3 2 1 /; @@ -160,7 +167,7 @@ eclist el2; print "Community list (1,2) (3,1) (3,5) ", l, " len: ", l.len; l = add( l, (3,2) ); l = add( l, (4,5) ); - print "Community list (1,2) (3,1) (3,2) (3,5) (4,5) ", l, " len: ", l.len; + print "Community list (1,2) (3,1) (3,5) (3,2) (4,5) ", l, " len: ", l.len; print "Should be true: ", l ~ [(*,2)], " ", l ~ [(*,5)], " ", l ~ [(*, one)]; print "Should be false: ", l ~ [(*,3)], " ", l ~ [(*,(one+6))], " ", l ~ [(*, (one+one+one))]; l = delete( l, [(*,(one+onef(3)))] ); @@ -175,7 +182,7 @@ eclist el2; print "clist B (3..6): ", l2; print "clist A union B: ", add( l2, l ); print "clist A isect B: ", filter( l, l2 ); - print "clist A \ B: ", delete( l, l2 ); + print "clist A \ B: ", delete( l, l2 ); el = -- empty --; el = add(el, (rt, 10, 20)); @@ -207,7 +214,34 @@ eclist el2; print "eclist B (30,40,50): ", el2; print "eclist A union B: ", add( el2, el ); print "eclist A isect B: ", filter( el, el2 ); - print "eclist A \ B: ", delete( el, el2 ); + print "eclist A \ B: ", delete( el, el2 ); + + ll = --- empty ---; + ll = add(ll, (ten, 20, 30)); + ll = add(ll, (1000, 2000, 3000)); + ll = add(ll, mktrip(100000)); + print "LC list (10, 20, 30) (1000, 2000, 3000) (100000, 200000, 300000):"; + print ll; + print "LC len: ", el.len; + print "Should be true: ", mktrip(1000) ~ ll, " ", ll ~ [(5,10,15), (10,20,30)], " ", ll ~ [(10,15..25,*)], " ", ll ~ [(ten, *, *)]; + print "Should be false: ", mktrip(100) ~ ll, " ", ll ~ [(5,10,15), (10,21,30)], " ", ll ~ [(10,21..25,*)], " ", ll ~ [(11, *, *)]; + print "LC filtered: ", filter(ll, [(5..15, *, *), (100000, 500..500000, *)]); + + ll = --- empty ---; + ll = add(ll, (10, 10, 10)); + ll = add(ll, (20, 20, 20)); + ll = add(ll, (30, 30, 30)); + + ll2 = --- empty ---; + ll2 = add(ll2, (20, 20, 20)); + ll2 = add(ll2, (30, 30, 30)); + ll2 = add(ll2, (40, 40, 40)); + + print "lclist A (10,20,30): ", ll; + print "lclist B (20,30,40): ", ll2; + print "lclist A union B: ", add(ll, ll2); + print "lclist A isect B: ", filter(ll, ll2); + print "lclist A \ B: ", delete(ll, ll2); # test_roa(); } |