diff options
Diffstat (limited to 'test/clojure/test_clojure')
-rw-r--r-- | test/clojure/test_clojure/java_interop.clj | 28 | ||||
-rw-r--r-- | test/clojure/test_clojure/protocols.clj | 2 | ||||
-rw-r--r-- | test/clojure/test_clojure/reader.clj | 18 | ||||
-rw-r--r-- | test/clojure/test_clojure/sequences.clj | 2 | ||||
-rw-r--r-- | test/clojure/test_clojure/test.clj | 2 |
5 files changed, 26 insertions, 26 deletions
diff --git a/test/clojure/test_clojure/java_interop.clj b/test/clojure/test_clojure/java_interop.clj index 93d35935..77ed538b 100644 --- a/test/clojure/test_clojure/java_interop.clj +++ b/test/clojure/test_clojure/java_interop.clj @@ -76,21 +76,21 @@ (deftest test-instance? ; evaluation (are [x y] (= x y) - (instance? java.lang.Integer (+ 1 2)) true - (instance? java.lang.Long (+ 1 2)) false ) + (instance? java.lang.Integer (+ 1 2)) false + (instance? java.lang.Long (+ 1 2)) true ) ; different types (are [type literal] (instance? literal type) - 1 java.lang.Integer + 1 java.lang.Long 1.0 java.lang.Double 1M java.math.BigDecimal \a java.lang.Character "a" java.lang.String ) - ; it is an int, nothing else + ; it is a Long, nothing else (are [x y] (= (instance? x 42) y) - java.lang.Integer true - java.lang.Long false + java.lang.Integer false + java.lang.Long true java.lang.Character false java.lang.String false )) @@ -199,14 +199,14 @@ (are [x] (= (alength (make-array Integer x)) x) 0 1 5 ) - (let [a (make-array Integer 5)] + (let [a (make-array Long 5)] (aset a 3 42) (are [x y] (= x y) (aget a 3) 42 - (class (aget a 3)) Integer )) + (class (aget a 3)) Long )) ; multi-dimensional - (let [a (make-array Integer 3 2 4)] + (let [a (make-array Long 3 2 4)] (aset a 0 1 2 987) (are [x y] (= x y) (alength a) 3 @@ -214,7 +214,7 @@ (alength (first (first a))) 4 (aget a 0 1 2) 987 - (class (aget a 0 1 2)) Integer ))) + (class (aget a 0 1 2)) Long ))) (deftest test-to-array @@ -264,8 +264,8 @@ (class (first a)) (class (first v)) )) ; given type - (let [a (into-array Integer/TYPE [(byte 2) (short 3) (int 4)])] - (are [x] (= x Integer) + #_(let [a (into-array Integer/TYPE [(byte 2) (short 3) (int 4)])] + (are [x] (= x Long) (class (aget a 0)) (class (aget a 1)) (class (aget a 2)) )) @@ -273,8 +273,8 @@ ; different kinds of collections (are [x] (and (= (alength (into-array x)) (count x)) (= (vec (into-array x)) (vec x)) - (= (alength (into-array Integer/TYPE x)) (count x)) - (= (vec (into-array Integer/TYPE x)) (vec x))) + (= (alength (into-array Long/TYPE x)) (count x)) + (= (vec (into-array Long/TYPE x)) (vec x))) () '(1 2) [] diff --git a/test/clojure/test_clojure/protocols.clj b/test/clojure/test_clojure/protocols.clj index 57062aac..b2f03dd7 100644 --- a/test/clojure/test_clojure/protocols.clj +++ b/test/clojure/test_clojure/protocols.clj @@ -55,7 +55,7 @@ (testing "protocol fns throw IllegalArgumentException if no impl matches" (is (thrown-with-msg? IllegalArgumentException - #"No implementation of method: :foo of protocol: #'clojure.test-clojure.protocols.examples/ExampleProtocol found for class: java.lang.Integer" + #"No implementation of method: :foo of protocol: #'clojure.test-clojure.protocols.examples/ExampleProtocol found for class: java.lang.Long" (foo 10)))) (testing "protocols generate a corresponding interface using _ instead of - for method names" (is (= ["bar" "baz" "baz" "foo" "with_quux"] (method-names clojure.test_clojure.protocols.examples.ExampleProtocol)))) diff --git a/test/clojure/test_clojure/reader.clj b/test/clojure/test_clojure/reader.clj index d11eb311..e3bee190 100644 --- a/test/clojure/test_clojure/reader.clj +++ b/test/clojure/test_clojure/reader.clj @@ -53,14 +53,14 @@ (deftest Numbers ; Read Integer - (is (instance? Integer 2147483647)) - (is (instance? Integer +1)) - (is (instance? Integer 1)) - (is (instance? Integer +0)) - (is (instance? Integer 0)) - (is (instance? Integer -0)) - (is (instance? Integer -1)) - (is (instance? Integer -2147483648)) + (is (instance? Long 2147483647)) + (is (instance? Long +1)) + (is (instance? Long 1)) + (is (instance? Long +0)) + (is (instance? Long 0)) + (is (instance? Long -0)) + (is (instance? Long -1)) + (is (instance? Long -2147483648)) ; Read Long (is (instance? Long 2147483648)) @@ -77,7 +77,7 @@ (recur (inc i) (conj l i)) l))] (is (= [4 3 2 1 0] sequence)) - (is (every? #(instance? Integer %) + (is (every? #(instance? Long %) sequence)))) ; Read BigInteger diff --git a/test/clojure/test_clojure/sequences.clj b/test/clojure/test_clojure/sequences.clj index 4da82e98..e69fdbbd 100644 --- a/test/clojure/test_clojure/sequences.clj +++ b/test/clojure/test_clojure/sequences.clj @@ -27,7 +27,7 @@ avec (into [] arange) alist (into () arange) obj-array (into-array arange) - int-array (into-array Integer/TYPE arange) + int-array (into-array Integer/TYPE (map #(Integer. (int %)) arange)) long-array (into-array Long/TYPE arange) float-array (into-array Float/TYPE arange) char-array (into-array Character/TYPE (map char arange)) diff --git a/test/clojure/test_clojure/test.clj b/test/clojure/test_clojure/test.clj index 002af625..8a7a1e1c 100644 --- a/test/clojure/test_clojure/test.clj +++ b/test/clojure/test_clojure/test.clj @@ -36,7 +36,7 @@ (is (= 3 (+ 2 2)) "Should fail")) (deftest can-test-instance - (is (instance? Integer (+ 2 2)) "Should pass") + (is (instance? Long (+ 2 2)) "Should pass") (is (instance? Float (+ 1 1)) "Should fail")) (deftest can-test-thrown |