summaryrefslogtreecommitdiffstats
path: root/tests/016/arith.tl
Commit message (Collapse)AuthorAgeFilesLines
* math: forbid dubious inequality comparisons.Kaz Kylheku2021-06-151-0/+56
| | | | | | | | | | | | | | | | | | | The issue, reported by Paul A. Patience, is that code like (< 1 "abc") is successfully producing a result. The root cause is that 1 is an iterable object, and so is treated as a sequence opposite to the "abc" operand. We should allow only true sequences in this situation. * arith.c (seq_lt_compat_check): New static function. Checks that neither of two sequences is SEQ_NOTSEQ or SEQ_HASHLIKE. (seq_lt, seq_le): Use seq_lt_compat_check to reject dubious inputs. * txr.1: Minor wording change in the related documentation, removing a gratuitous adjective. * tests/016/arith.tl: Inequality tests.
* arith: switch sum and prod to seq_iter.Kaz Kylheku2021-06-091-0/+24
| | | | | | | | | | | | | | * arith.c (nary_op_keyfun): Static function removed. (nary_op_seq, nary_op_seq_keyfun): New static functions. (sumv, prodv): Static functions removed. (sum, prod): Reimplement using nary_op_seq and nary_op_seq_keyfun. Conversion of sequence to list smuggled via args is gone. * tests/016/arith.tl: new sum and prod tests. * txr.1: Note about sum and prod taking an iterable sequence added.
* match: binary-integer conv tests for #x-8000...Kaz Kylheku2021-05-211-0/+21
| | | | | | * tests/016/arith.tl: Test providing coverage for the most negative two's complement integer, #x-800...00 in various sizes. The 64 bit cases are failing.
* math: add some tests related to integer conversion.Kaz Kylheku2021-05-211-0/+50
| | | | | | * tests/016/arith.tl: Add tests covering the fixnum/bignum knee, and ffi operations of various sizes that provide coverage of various conversion routines.
* bracket: bug: wrong result when function is applied.Kaz Kylheku2019-09-101-0/+14
| | | | | | | | | | | | 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.
* tests: add tests for digits function.Kaz Kylheku2019-09-091-0/+18
| | | | * tests/016/arith.tl: Add various digits tests.
* New arithmetic tests.Kaz Kylheku2016-11-151-0/+41
* Makefile (TXR_DBG_OPTS): Suppress for new directory tests/016. * tests/016/arith.tl: New file. * tests/016/arith.expected: New file.