aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-06-27 21:21:42 +0800
committerMistivia <i@mistivia.com>2025-06-27 21:21:42 +0800
commit878a056f3accafaa797446eb3a3b1a66b36d0d07 (patch)
treef56330127b96bdff11f2bd37b7229a94d02fcacc /tests
parent0ba662762023b7e3788690d9990ab39e89fd6f34 (diff)
add more funcs
Diffstat (limited to 'tests')
-rw-r--r--tests/bitwise.lisp2
-rw-r--r--tests/list.lisp23
-rw-r--r--tests/test.lisp2
3 files changed, 27 insertions, 0 deletions
diff --git a/tests/bitwise.lisp b/tests/bitwise.lisp
new file mode 100644
index 0000000..7371058
--- /dev/null
+++ b/tests/bitwise.lisp
@@ -0,0 +1,2 @@
+(assert (= 16 (logand 31 16)))
+(assert (= 24 (logand 31 25 24)))
diff --git a/tests/list.lisp b/tests/list.lisp
index 07fd08c..7826afb 100644
--- a/tests/list.lisp
+++ b/tests/list.lisp
@@ -55,3 +55,26 @@
(assert (not (member? nil (list 1 2))))
(assert (not (member? 3 (list 1 2))))
+ ;;Interp_add_userfunc(self, "nconc", builtin_reverse);
+
+(let ((lst '(1 2 999 4)))
+ (set-nth 2 lst 3)
+ (assert (equal? '(1 2 3 4) lst)))
+
+(let ((lst '(1 2 999 4)))
+ (set-nthcdr 2 lst '(1000 1001))
+ (assert (equal? '(1 2 999 1000 1001) lst)))
+
+(assert (= 10 (foldl #'+ 0 '(1 2 3 4))))
+
+(let ((a '(1 2 3))
+ (b '(4 5 6))
+ (c '(7 8 9)))
+ (assert (equal? '(1 2 3 4 5 6 7 8 9) (append a b c)))
+ (assert (equal? '(1 2 3) a))
+ (assert (equal? '(4 5 6) b))
+ (assert (equal? '(7 8 9) c)))
+
+(let ((a '(1 2 3))
+ (b '(4 5 6)))
+ (assert (equal? '(1 2 3 4 5 6) (nconc a b))))
diff --git a/tests/test.lisp b/tests/test.lisp
index 5d5d807..4013888 100644
--- a/tests/test.lisp
+++ b/tests/test.lisp
@@ -21,6 +21,7 @@
(test-module list)
(test-module type)
(test-module char)
+(test-module bitwise)
(princ "\n\nTest with intensive GC:\n\n")
(_alwaysgc #t)
@@ -41,5 +42,6 @@
(test-module list)
(test-module type)
(test-module char)
+(test-module bitwise)
(exit)