summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-09-09 20:41:51 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-09-09 20:41:51 -0700
commit7f471fde70ef66c3e9bcbe4d96885e9455722da1 (patch)
treea203902a8a5ea3e1039918f62b95dbe06cc415bb
parent99fcc68c3d43b6eb5ca737c1eed08666e59c5b15 (diff)
downloadtxr-7f471fde70ef66c3e9bcbe4d96885e9455722da1.tar.gz
txr-7f471fde70ef66c3e9bcbe4d96885e9455722da1.tar.bz2
txr-7f471fde70ef66c3e9bcbe4d96885e9455722da1.zip
tests: add tests for digits function.
* tests/016/arith.tl: Add various digits tests.
-rw-r--r--tests/016/arith.tl18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/016/arith.tl b/tests/016/arith.tl
index f1f34c4f..eaa7fe2f 100644
--- a/tests/016/arith.tl
+++ b/tests/016/arith.tl
@@ -39,3 +39,21 @@
(vtest (mod c b) 0)
(vtest (mod (pred c) a) (pred a))
(vtest (mod (pred c) b) (pred b))))
+
+(test (digits 0) (0))
+(test (digits 1) (1))
+(test (digits 9) (9))
+(test (digits 10) (1 0))
+(test (digits 19) (1 9))
+(test (digits 20) (2 0))
+(test (digits 37) (3 7))
+(test (digits 100) (1 0 0))
+(test (digits 101) (1 0 1))
+(test (digits 999) (9 9 9))
+(test (digits 1000) (1 0 0 0))
+(test (digits 0 2) (0))
+(test (digits 1 2) (1))
+(test (digits 2 2) (1 0))
+(test (digits 3 2) (1 1))
+(test (digits 7 2) (1 1 1))
+(test (digits 8 2) (1 0 0 0))