aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-07-14 19:52:37 +0800
committerMistivia <i@mistivia.com>2025-07-14 19:55:14 +0800
commitdab2284cd5aae14bb166c90105a8e7b1bd290dcd (patch)
treed5009f5434c8f4f78d812c0068425b6d0bced236 /tests
parentaec1c5667b130d40c86403037bb16463f77db7bb (diff)
add vector
Diffstat (limited to 'tests')
-rw-r--r--tests/test.lisp2
-rw-r--r--tests/vector.lisp20
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/test.lisp b/tests/test.lisp
index 4013888..241f69c 100644
--- a/tests/test.lisp
+++ b/tests/test.lisp
@@ -22,6 +22,7 @@
(test-module type)
(test-module char)
(test-module bitwise)
+(test-module vector)
(princ "\n\nTest with intensive GC:\n\n")
(_alwaysgc #t)
@@ -43,5 +44,6 @@
(test-module type)
(test-module char)
(test-module bitwise)
+(test-module vector)
(exit)
diff --git a/tests/vector.lisp b/tests/vector.lisp
new file mode 100644
index 0000000..9146168
--- /dev/null
+++ b/tests/vector.lisp
@@ -0,0 +1,20 @@
+(assert (vector? (make-vector)))
+(assert (not (vector? 1)))
+
+(defvar v (make-vector))
+
+(assert (= 0 (vector-length v)))
+(assert-error (vector-ref v 0))
+
+(vector-append v 0)
+(vector-append v "123")
+(vector-append v 1.2)
+
+(assert (= 3 (vector-length v)))
+
+(vector-insert v 1 99)
+
+(assert (equal? (vector-ref v 0) 0))
+(assert (equal? (vector-ref v 1) 99))
+(assert (equal? (vector-ref v 2) "123"))
+(assert (equal? (vector-ref v 3) 1.2))