summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-03-30 08:48:48 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-03-30 08:48:48 -0700
commit06021c4b490ff237bf7ef13ab0f7bce0e5ef11be (patch)
treeafb7d4fc2156df0ec3d7b23681586654be6365df /tests
parente819894211d50c40ac7c7519528aa6f62940c6d2 (diff)
downloadtxr-06021c4b490ff237bf7ef13ab0f7bce0e5ef11be.tar.gz
txr-06021c4b490ff237bf7ef13ab0f7bce0e5ef11be.tar.bz2
txr-06021c4b490ff237bf7ef13ab0f7bce0e5ef11be.zip
u-d-arithmetic: proper treatment of ceil & round.
* arith.c (r_ceil_s, r_round_s): New symbol variables. (ceildiv, roundiv): Route binary cases involving struts directly to binary methods so the object is responsible for the complete implementation. (arith_init): Initialize r_ceil_s and r_round_s. * tests/016/ud-arith.tl (numbase): Binary methods added for ceil and round. Test cases added. * txr.1: Descriptions for binary ceil and round methods added; Notes about non-existence of binary methods removed from unary ceil and round removed.
Diffstat (limited to 'tests')
-rw-r--r--tests/016/ud-arith.tl12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/016/ud-arith.tl b/tests/016/ud-arith.tl
index d086b9e6..052fcaed 100644
--- a/tests/016/ud-arith.tl
+++ b/tests/016/ud-arith.tl
@@ -35,8 +35,12 @@
(:method floor (me arg) ^(floor ,me.v ,arg))
(:method r-floor (me arg) ^(floor ,arg ,me.v))
(:method floor1 (me) ^(floor ,me.v))
- (:method round1 (me) ^(round ,me.v))
+ (:method ceil (me arg) ^(ceil ,me.v ,arg))
+ (:method r-ceil (me arg) ^(ceil ,arg ,me.v))
(:method ceil1 (me) ^(ceil ,me.v))
+ (:method round (me arg) ^(round ,me.v ,arg))
+ (:method r-round (me arg) ^(round ,arg ,me.v))
+ (:method round1 (me) ^(round ,me.v))
(:method sin (me) ^(sin ,me.v))
(:method cos (me) ^(cos ,me.v))
(:method tan (me) ^(tan ,me.v))
@@ -102,8 +106,12 @@
(test (floor n 0) (floor 1 0))
(test (floor 0 n) (floor 0 1))
(test (floor n) (floor 1))
-(test (round n) (round 1))
+(test (ceil n 0) (ceil 1 0))
+(test (ceil 0 n) (ceil 0 1))
(test (ceil n) (ceil 1))
+(test (round n 0) (round 1 0))
+(test (round 0 n) (round 0 1))
+(test (round n) (round 1))
(test (sin n) (sin 1))
(test (cos n) (cos 1))
(test (tan n) (tan 1))