aboutsummaryrefslogtreecommitdiff
path: root/tests/functions.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functions.lisp')
-rw-r--r--tests/functions.lisp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/functions.lisp b/tests/functions.lisp
index b629c1f..ac8599d 100644
--- a/tests/functions.lisp
+++ b/tests/functions.lisp
@@ -93,3 +93,22 @@
(is equal 3 (->> (assoc #\t res) cdr length))
(is equal 2 (->> (assoc #\space res) cdr length))
(is equal 2 (->> (assoc #\s res) cdr length))))
+
+(define-test (function-test remove-at-indices)
+ :depends-on (range)
+ :compile-at :execute
+ (fail (remove-at-indices "a string" "another string"))
+ (true (null (remove-at-indices nil nil)))
+ (is equal '(1 2 3) (remove-at-indices nil '(1 2 3)))
+ (is equal '(2) (remove-at-indices '(0 2) '(1 2 3)))
+ (let* ((inp (range 100 200))
+ (t1 (remove-at-indices (range 0 100 2) inp))
+ (t2 (remove-at-indices (range 1 100 2) inp)))
+ (is equal 50 (length t1))
+ (is equal 50 (length t2))
+ (true (every (lambda (n) (not (member n t2))) t1))
+ (true (every (lambda (n) (not (member n t1))) t2)))
+ (let* ((indices (list 0 5 6 7 8 9 10))
+ (str-lst (remove-at-indices indices "Hello World"))
+ (ret (coerce str-lst 'string)))
+ (is string= "ello" ret)))