diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-09-10 19:06:58 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-09-10 19:06:58 -0700 |
commit | 595c0bee41e0c7286c9779ab8f08ca6ec140c8d7 (patch) | |
tree | a9b82c42e45f50a259e339aea9f597391d10dce1 /tests | |
parent | b23424f8d0b093b3438e9c6a2665a543decd7355 (diff) | |
download | txr-595c0bee41e0c7286c9779ab8f08ca6ec140c8d7.tar.gz txr-595c0bee41e0c7286c9779ab8f08ca6ec140c8d7.tar.bz2 txr-595c0bee41e0c7286c9779ab8f08ca6ec140c8d7.zip |
bracket: bug: wrong result when function is applied.
Reported by user vapnik spaknik.
* lib.c (bracket): Don't rely on the index variable to step
through the arguments, because it only counts fixed arguments.
The args_get function doesn't increment the index beyond
args->fill; when popping arguments from args->list, index
stays unmodified.
* tests/016/arith.tl: Tests for bracket added.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/016/arith.tl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/016/arith.tl b/tests/016/arith.tl index eaa7fe2f..6a99b24a 100644 --- a/tests/016/arith.tl +++ b/tests/016/arith.tl @@ -57,3 +57,17 @@ (test (digits 3 2) (1 1)) (test (digits 7 2) (1 1 1)) (test (digits 8 2) (1 0 0 0)) + +(test (bracket 0 10 20 30) 0) +(test (bracket 9 10 20 30) 0) +(test (bracket 10 10 20 30) 1) +(test (bracket 15 10 20 30) 1) +(test (bracket 25 10 20 30) 2) +(test (bracket 30 10 20 30) 3) + +(test [apply bracket '(0 10 20 30)] 0) +(test [apply bracket '(9 10 20 30)] 0) +(test [apply bracket '(10 10 20 30)] 1) +(test [apply bracket '(15 10 20 30)] 1) +(test [apply bracket '(25 10 20 30)] 2) +(test [apply bracket '(30 10 20 30)] 3) |