Skip to content

Commit 5bca2b0

Browse files
authored
Merge pull request #31 from dgr/zero-arg-arithmetic
Add cases for zero arg, one arg, and multi-arg to arithmetic fns
2 parents 59cbdba + 9db48a3 commit 5bca2b0

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

test/clojure/core_test/minus.cljc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
5.0M 10.0M 5.0M
6565
-1.0M 1.0M 2.0M)
6666

67+
;; Zero arg
68+
(is (thrown? Exception (-)))
69+
6770
;; Single arg
6871
(is (= -3 (- 3)))
6972
(is (= 3 (- -3)))

test/clojure/core_test/plus.cljc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@
5959
6N 1N 5
6060
6N 1N 5N)
6161

62+
;; Zero arg
63+
(is (= 0 (+)))
64+
65+
;; One arg
66+
(is (= 1 (+ 1)))
67+
(is (= 2 (+ 2)))
68+
69+
;; Multi arg
70+
(is (= 45 (+ 0 1 2 3 4 5 6 7 8 9)))
71+
6272

6373
(is (thrown? Exception (+ 1 nil)))
6474
(is (thrown? Exception (+ nil 1)))

test/clojure/core_test/slash.cljc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@
109109
-1.0M -1.0M 1.0M
110110
1.0M -1.0M -1.0M)
111111

112+
;; Zero arg
113+
(is (thrown? Exception (/)))
114+
112115
;; Single arg
113116
(is (= 1/2 (/ 2)))
114117
(is (= 0.5 (/ 2.0)))

test/clojure/core_test/star.cljc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@
5959
5 1N 5
6060
5 1N 5N)
6161

62+
;; Zero arg
63+
(is (= 1 (*)))
64+
65+
;; One arg
66+
(is (= 1 (* 1)))
67+
(is (= 2 (* 2)))
68+
69+
;; Multi arg
70+
(is (= 362880 (* 1 2 3 4 5 6 7 8 9)))
71+
6272
(is (thrown? Exception (* 1 nil)))
6373
(is (thrown? Exception (* nil 1)))
6474

0 commit comments

Comments
 (0)