fix-fiveam-test-comparisons
Sun Nov 4 13:49:32 PST 2012 rpgoldman@sift.info
* fix-fiveam-test-comparisons
FiveAM would like the expected value to be before the computed value, for
best printing when tests fail. I reversed the arguments to the
JSON-NUMBER test to agree with this convention.
diff -rN -u old-cl-json/t/testdecoder.lisp new-cl-json/t/testdecoder.lisp
--- old-cl-json/t/testdecoder.lisp 2014-07-23 07:03:17.000000000 -0700
+++ new-cl-json/t/testdecoder.lisp 2014-07-23 07:03:17.000000000 -0700
@@ -241,29 +241,29 @@
,@body)))
(test json-number
- (is (= (decode-json-from-string "100") 100))
- (is (= (decode-json-from-string "10.01") 10.01))
- (is (= (decode-json-from-string "-2.3") -2.3))
- (is (= (decode-json-from-string "-2.3e3") -2.3e3))
- (is (= (decode-json-from-string "-3e4") -3e4))
- (is (= (decode-json-from-string "3e4") 3e4))
+ (is (= 100 (decode-json-from-string "100")))
+ (is (= 10.01 (decode-json-from-string "10.01")))
+ (is (= -2.3 (decode-json-from-string "-2.3")))
+ (is (= -2.3e3 (decode-json-from-string "-2.3e3")))
+ (is (= -3e4 (decode-json-from-string "-3e4")))
+ (is (= 3e4 (decode-json-from-string "3e4")))
(let ((*read-default-float-format* 'double-float))
- (is (= (decode-json-from-string "2e40") 2d40)))
+ (is (= 2d40 (decode-json-from-string "2e40"))))
#-(or (and sbcl darwin) (and allegro macosx))
- (is (equalp (with-fp-overflow-handler
+ (is (equalp "BIG:2e444"
+ (with-fp-overflow-handler
(invoke-restart 'bignumber-string "BIG:")
- (decode-json-from-string "2e444"))
- "BIG:2e444"))
+ (decode-json-from-string "2e444"))))
#-(or (and sbcl darwin) (and allegro macosx))
- (is (= (with-fp-overflow-handler
+ (is (= (* 2 (expt 10 444))
+ (with-fp-overflow-handler
(invoke-restart 'rational-approximation)
- (decode-json-from-string "2e444"))
- (* 2 (expt 10 444))))
+ (decode-json-from-string "2e444"))))
;; In SBCL on Darwin, constructing the float from parts by explicit
;; operations yields #.SB-EXT:SINGLE-FLOAT-POSITIVE-INFINITY.
#+(and sbcl darwin)
- (is (= (decode-json-from-string "2e444")
- (* 2.0 (expt 10.0 444)))))
+ (is (= (* 2.0 (expt 10.0 444))
+ (decode-json-from-string "2e444"))))
(defparameter *json-test-files-path*