diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-04-29 07:14:40 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-04-29 07:14:40 -0700 |
commit | bc483048cfc2c9db80f4fcca18e882d646d30510 (patch) | |
tree | 124cda8cd39785e21393903115c43d947f16b566 /tests | |
parent | e3642f07ef877609d45f3dc737e686957d675d8a (diff) | |
download | txr-bc483048cfc2c9db80f4fcca18e882d646d30510.tar.gz txr-bc483048cfc2c9db80f4fcca18e882d646d30510.tar.bz2 txr-bc483048cfc2c9db80f4fcca18e882d646d30510.zip |
tree: incorrect lookup function.
* tree.c (tn_lookup): The right case is incorrectly
chasing the left pointer.
* tests/010/tree.tl: New file.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/010/tree.tl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/010/tree.tl b/tests/010/tree.tl index e69de29b..b4990d04 100644 --- a/tests/010/tree.tl +++ b/tests/010/tree.tl @@ -0,0 +1,31 @@ +(load "../common") + +(defvarl tr (tree)) +(defvarl keys '(0 6 8 11 10 2 16 3 17 7 19 12 15 13 18 4 14 5 1 9)) + +(test tr #T(())) + +(each ((n keys)) + (tree-insert tr n)) + +(mtest + (tree-lookup tr 0) 0 + (tree-lookup tr 1) 1 + (tree-lookup tr 2) 2 + (tree-lookup tr 3) 3 + (tree-lookup tr 4) 4 + (tree-lookup tr 5) 5 + (tree-lookup tr 6) 6 + (tree-lookup tr 7) 7 + (tree-lookup tr 8) 8 + (tree-lookup tr 9) 9 + (tree-lookup tr 10) 10 + (tree-lookup tr 11) 11 + (tree-lookup tr 12) 12 + (tree-lookup tr 13) 13 + (tree-lookup tr 14) 14 + (tree-lookup tr 15) 15 + (tree-lookup tr 16) 16 + (tree-lookup tr 17) 17 + (tree-lookup tr 18) 18 + (tree-lookup tr 19) 19) |