Skip to content

Commit a67b94c

Browse files
authored
Standardize min/max value calls (#902)
1 parent 838785d commit a67b94c

2 files changed

Lines changed: 7 additions & 13 deletions

File tree

test/clojure/core_test/dec.cljc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@
2424
(is (NaN? (dec ##NaN))))
2525

2626
(testing "underflow"
27-
#?(:cljr (is (p/thrown? (dec Int64/MinValue)))
28-
:phel (is (= (dec php/PHP_INT_MIN) (dec php/PHP_INT_MIN)))
27+
#?(:phel (is (= (dec min-int) (dec min-int)))
2928
:lpy [] ; Python integers cannot underflow
30-
:jank (is (p/thrown? (dec min-int)))
31-
:cljs (is (= (dec js/Number.MIN_SAFE_INTEGER) (- js/Number.MIN_SAFE_INTEGER 2)))
32-
:clj (is (p/thrown? (dec Long/MIN_VALUE)))
33-
:default (is false "TODO underflow")))
29+
:cljs (is (= (dec min-int) (- min-int 2)))
30+
:default (is (p/thrown? (dec min-int)))))
3431

3532
(testing "dec-nil"
3633
;; ClojureScript says (= -1 (dec nil)) because JavaScript casts null to 0

test/clojure/core_test/inc.cljc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,11 @@
2525
(is (NaN? (inc ##NaN))))
2626

2727
(testing "overflow"
28-
#?(:cljr (is (p/thrown? (inc Int64/MaxValue)))
29-
;; Phel integers avoid overflow by being promoted to BigInteger
30-
:phel (is (not (= (inc php/PHP_INT_MAX) (+ 2 php/PHP_INT_MAX))))
28+
#?(;; Phel integers avoid overflow by being promoted to BigInteger
29+
:phel (is (not (= (inc max-int) (+ 2 max-int))))
3130
:lpy nil ; Python integers cannot overflow
32-
:jank (is (p/thrown? (inc max-int)))
33-
:cljs (is (= (inc js/Number.MAX_SAFE_INTEGER) (+ 2 js/Number.MAX_SAFE_INTEGER)))
34-
:clj (is (p/thrown? (inc Long/MAX_VALUE)))
35-
:default (is false "overflow untested")))
31+
:cljs (is (= (inc max-int) (+ 2 max-int)))
32+
:default (is (p/thrown? (inc max-int)))))
3633

3734
(testing "inc-nil"
3835
;; ClojureScript says (= 1 (inc nil)) because JavaScript casts null to 0

0 commit comments

Comments
 (0)