summaryrefslogtreecommitdiffstats
path: root/tests/010
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-09-21 16:52:13 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-09-21 16:52:13 -0700
commit64848265157738f0a0951a70cf05b88732dbec24 (patch)
treee78e8f45cc70769218a5055dad53a2be291f3e00 /tests/010
parent3b8d68039907ce6070d7b03dcab3a20b4be85983 (diff)
downloadtxr-64848265157738f0a0951a70cf05b88732dbec24.tar.gz
txr-64848265157738f0a0951a70cf05b88732dbec24.tar.bz2
txr-64848265157738f0a0951a70cf05b88732dbec24.zip
New functions: nested-vec-of and nested-vec.
* eval.c (eval_init): Register nestd-vec-of and nested-vec intrinsics. * lib.[ch] (vec_allocate, vec_own, vec_init): New static functions. (vector, copy_vec): Expressed in terms of new functions. (nested_vec_of_v, nested_vec_v): New functions. * args.[ch] (args_cat_from): New function. * tests/010/vec.tl: New tests. * txr.1: Documented.
Diffstat (limited to 'tests/010')
-rw-r--r--tests/010/vec.tl21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/010/vec.tl b/tests/010/vec.tl
index c1d435b9..f7b182c1 100644
--- a/tests/010/vec.tl
+++ b/tests/010/vec.tl
@@ -30,3 +30,24 @@
(fill-vec v3 2 -1) #(1 0 2)
(fill-vec v3 3 -3) #(3 3 3))
(fill-vec v3 0 -2 -1) #(3 0 3))
+
+(mtest
+ (nested-vec) nil
+ (nested-vec-of 0 4) #(0 0 0 0)
+ (nested-vec-of 0 4 3) #(#(0 0 0)
+ #(0 0 0)
+ #(0 0 0)
+ #(0 0 0))
+ (nested-vec-of 'a 4 3 2) #(#(#(a a) #(a a) #(a a))
+ #(#(a a) #(a a) #(a a))
+ #(#(a a) #(a a) #(a a))
+ #(#(a a) #(a a) #(a a)))
+ (nested-vec-of 'a 1 1 1) #(#(#(a)))
+ (nested-vec-of 'a 1 1 0) #(#(#()))
+ (nested-vec-of 'a 1 0 1) #(#())
+ (nested-vec-of 'a 1 0) #(#())
+ (nested-vec-of 'a 0 1) #()
+ (nested-vec-of 'a 0) #()
+
+ (nested-vec-of 'a 4 0 1) #(#() #() #() #())
+ (nested-vec-of 'a 4 0) #(#() #() #() #()))