diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-07-11 20:48:34 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-07-11 20:48:34 -0700 |
commit | b2bb2af765a550efd92adb25687cb76f955574e3 (patch) | |
tree | f1eaa8bf8750b3cba95a5d40f95e808d94fb60ca /tests | |
parent | d9d8beefbf45eaea89d4174e55df37ed89690ec9 (diff) | |
download | txr-b2bb2af765a550efd92adb25687cb76f955574e3.tar.gz txr-b2bb2af765a550efd92adb25687cb76f955574e3.tar.bz2 txr-b2bb2af765a550efd92adb25687cb76f955574e3.zip |
New funtion related to where function.
* eval.c (eval_init): register intrinsics wheref, whereq,
whereql and wherequal.
* lib.c (wheref_fun): New static function.
(wheref, whereq, whereql, wherequal): New functions.
* lib.h (wheref, whereq, whereql, wherequal): Declared.
* tests/012/seq.tl: New tests.
* txr.1: Documented.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/012/seq.tl | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/012/seq.tl b/tests/012/seq.tl index 5746939b..45cf2b67 100644 --- a/tests/012/seq.tl +++ b/tests/012/seq.tl @@ -1537,3 +1537,42 @@ (mtest (partition "abcdef" '(4 -1)) ("abcd" "e" "f") (partition "abcdef" '(4 5)) ("abcd" "e" "f")) + +(mtest + (where (op eq #\z) "") nil + (where (op eq #\z) "abc") nil + (where (op eq 'z) #()) nil + (where (op eq 'z) #(a b c)) nil + (where (op eq 'z) '()) nil + (where (op eq 'z) '(a b c)) nil + (where (op eq 10) 1..4) nil + (where (op eq 10) 1..1) nil) + +(mtest + (where (op eq #\c) "abcabc") (2 5) + (where (op eq 'c) #(a b c a b c)) (2 5) + (where (op eq 'c) '(a b c a b c)) (2 5) + (where (op eq 3) 0..9) (3)) + +(mtest + [[wheref oddp] '()] nil + [[wheref oddp] '(1 2 3 4 5 6)] (0 2 4)) + +(mtest + [(whereq #\c) "abcabc"] (2 5) + [(whereq 'c) #(a b c a b c)] (2 5) + [(whereq 'c) '(a b c a b c)] (2 5) + [(whereq 3) 0..9] (3)) + +(mtest + [(whereql #\c) "abcabc"] (2 5) + [(whereq 'c) #(a b c a b c)] (2 5) + [(whereql 'c) '(a b c a b c)] (2 5) + [(whereql 3) 0..9] (3)) + +(mtest + [(wherequal #xFFFFFFFFFFFFFFFFFFFF) '(#xFFFFFFFFFFFFFFFFFFFF)] (0) + [(wherequal 'c) #(a b c a b c)] (2 5) + [(wherequal 'c) '(a b c a b c)] (2 5) + [(wherequal 3) '(3 3.0 b c a b c)] (0) + [(wherequal 3) 0..9] (3)) |