diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-29 18:44:07 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-29 18:49:05 +0100 |
commit | 385ebecece12ad556683f8c98b8f9d612795737a (patch) | |
tree | a58818c4cbd79b917ac217e60f25a3abbd05580b /tests/util.scm | |
parent | Add ~b and ~p flags to datetime parser. (diff) | |
download | calp-385ebecece12ad556683f8c98b8f9d612795737a.tar.gz calp-385ebecece12ad556683f8c98b8f9d612795737a.tar.xz |
Add span-upto.
Diffstat (limited to '')
-rw-r--r-- | tests/util.scm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/util.scm b/tests/util.scm index de8d4b2a..6d4ca262 100644 --- a/tests/util.scm +++ b/tests/util.scm @@ -3,7 +3,7 @@ ;;; Code: (((calp util) filter-sorted set/r! - find-min find-max)) + find-min find-max span-upto)) (test-equal "Filter sorted" '(3 4 5) @@ -36,3 +36,13 @@ (test-error 'misc-error (find-extreme '())) + +(call-with-values (lambda () (span-upto 2 char-numeric? (string->list "123456"))) + (lambda (head tail) + (test-equal '(#\1 #\2) head) + (test-equal '(#\3 #\4 #\5 #\6) tail))) + +(call-with-values (lambda () (span-upto 2 char-numeric? (string->list "H123456"))) + (lambda (head tail) + (test-equal '() head) + (test-equal '(#\H #\1 #\2 #\3 #\4 #\5 #\6) tail))) |