diff options
| author | Mistivia <i@mistivia.com> | 2025-07-14 19:52:37 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-07-14 19:55:14 +0800 |
| commit | dab2284cd5aae14bb166c90105a8e7b1bd290dcd (patch) | |
| tree | d5009f5434c8f4f78d812c0068425b6d0bced236 /tests | |
| parent | aec1c5667b130d40c86403037bb16463f77db7bb (diff) | |
add vector
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test.lisp | 2 | ||||
| -rw-r--r-- | tests/vector.lisp | 20 |
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)) |
