aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2025-02-21 14:06:05 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2025-02-21 14:20:34 +0000
commit7c64d23b0af1f33292fa47f9201ad42bb984af60 (patch)
tree57c3a2909fc926815cb18b94f900fb174d4fba5d /tests
parent1edd618b42821f26b0a31ae63f393c09259c046b (diff)
downloadcantedraw-7c64d23b0af1f33292fa47f9201ad42bb984af60.tar.gz
cantedraw-7c64d23b0af1f33292fa47f9201ad42bb984af60.tar.bz2
cantedraw-7c64d23b0af1f33292fa47f9201ad42bb984af60.zip
Add unit tests for lib.functions.remove-at-indices
Diffstat (limited to 'tests')
-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)))