diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-12-17 20:37:34 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-12-17 20:37:34 -0800 |
commit | 3cbec98b7e80e75b4cd1e164c56c6e82ab0d7240 (patch) | |
tree | 3325cd36e631fe07b2c4e67b4ef1605a81a1f870 /tests/010 | |
parent | f0493b337617d403dc572975784f1a54c741a76e (diff) | |
download | txr-3cbec98b7e80e75b4cd1e164c56c6e82ab0d7240.tar.gz txr-3cbec98b7e80e75b4cd1e164c56c6e82ab0d7240.tar.bz2 txr-3cbec98b7e80e75b4cd1e164c56c6e82ab0d7240.zip |
tree-count: new function.
* tree.c (tree_count): New function.
(tree_init): tree-count intrinsic registered.
* tree.h (tree_count): Declared.
* lib.c (length): Support search tree argument via tree_count.
* tests/010/tree.tl: Test cases for tree-count, indirectly via len.
* txr.1: Documented.
Diffstat (limited to 'tests/010')
-rw-r--r-- | tests/010/tree.tl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/010/tree.tl b/tests/010/tree.tl index 06d02ce6..f5bfac42 100644 --- a/tests/010/tree.tl +++ b/tests/010/tree.tl @@ -5,8 +5,16 @@ (test tr #T(())) -(test (treep tr) t) -(test (treep 42) nil) +(mtest + (treep tr) t + (treep 42) nil) + +(mtest + (len #T()) 0 + (len #T(() 1)) 1 + (len #T(() 1 2)) 2 + (len #T(() 1 2 3)) 3 + (len #T(() 1 1 1)) 3) (each ((n keys)) (tree-insert tr n)) |