File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed
Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ (ns clojure.core-test.denominator
2+ (:require [clojure.test :as t :refer [deftest testing is are]]
3+ [clojure.core-test.portability :as p]))
4+
5+ (p/when-var-exists 'clojure.core/denominator
6+ (deftest test-denominator
7+ (is (= 2 (denominator 1/2 )))
8+ (is (= 3 (denominator 2/3 )))
9+ (is (= 4 (denominator 3/4 )))
10+
11+ (is (thrown? Exception (denominator 1 )))
12+ (is (thrown? Exception (denominator 1.0 )))
13+ (is (thrown? Exception (denominator 1N )))
14+ (is (thrown? Exception (denominator 1.0M )))
15+ (is (thrown? Exception (denominator ##Inf )))
16+ (is (thrown? Exception (denominator ##NaN )))
17+ (is (thrown? Exception (denominator nil )))))
Original file line number Diff line number Diff line change 1+ (ns clojure.core-test.numerator
2+ (:require [clojure.test :as t :refer [deftest testing is are]]
3+ [clojure.core-test.portability :as p]))
4+
5+ (p/when-var-exists 'clojure.core/numerator
6+ (deftest test-numerator
7+ (is (= 1 (numerator 1/2 )))
8+ (is (= 2 (numerator 2/3 )))
9+ (is (= 3 (numerator 3/4 )))
10+
11+ (is (thrown? Exception (numerator 1 )))
12+ (is (thrown? Exception (numerator 1.0 )))
13+ (is (thrown? Exception (numerator 1N )))
14+ (is (thrown? Exception (numerator 1.0M )))
15+ (is (thrown? Exception (numerator ##Inf )))
16+ (is (thrown? Exception (numerator ##NaN )))
17+ (is (thrown? Exception (numerator nil )))))
Original file line number Diff line number Diff line change 11(ns clojure.core-test.portability )
22
3+ (defmacro when-var-exists [var-sym & body]
4+ `(let [s# ~var-sym
5+ v# (resolve s#)]
6+ (if v#
7+ (do
8+ ~@body)
9+ (println " SKIP -" s#))))
10+
311(defn big-int? [n]
412 (and (integer? n)
513 (not (int? n))))
You can’t perform that action at this time.
0 commit comments