test/ more decimal formatting tests, some of them fail
Wed Jul 27 06:57:27 PDT 2011 attila.lendvai@gmail.com
* test/ more decimal formatting tests, some of them fail
diff -rN -u old-cl-l10n/test/formatting.lisp new-cl-l10n/test/formatting.lisp
--- old-cl-l10n/test/formatting.lisp 2014-04-17 14:34:51.000000000 -0700
+++ new-cl-l10n/test/formatting.lisp 2014-04-17 14:34:51.000000000 -0700
@@ -6,14 +6,26 @@
(defsuite* (test/cldr/formatting :in test/cldr))
(deftest (test/cldr/formatting/bug/1) ()
- (bind ((compiled-pattern (compile-number-pattern/decimal "#,##0.###")))
+ (flet ((to-string (number)
+ (format-number/decimal nil number :pattern "#,##0.###")))
+ (is (string= (to-string 3.9990) "3.999"))
+ (is (string= (to-string 3.9995) "3.999"))
+ (is (string= (to-string 3.9995d0) "3.999"))
+ (is (string= (to-string 3.9996) "4"))
+ (is (string= (to-string 3.9999) "4"))
+ (is (string= (to-string 3.99999999999d0) "4"))
+ (is (string= (to-string 4) "4"))))
+
+;; i'm not sure if the following two is strictly speaking a bug, but it's definitely annoying behaviour...
+(deftest (test/cldr/formatting/bug/2) ()
+ (with-expected-failures
+ (is (string= (format-number/decimal nil 3.9995d0 :pattern "#,##0.########################")
+ "3.9995"))))
+
+(deftest (test/cldr/formatting/bug/3) ()
+ (bind ((number (/ 7999 2000)))
(flet ((to-string (number)
- (bind ((stream nil))
- (with-normalized-stream-variable stream
- (funcall compiled-pattern stream number)))))
- (is (string= (to-string 3.9990) "3.999"))
- (is (string= (to-string 3.9995) "3.999"))
- (is (string= (to-string 3.9996) "4"))
- (is (string= (to-string 3.9999) "4"))
- (is (string= (to-string 3.99999999999d0) "4"))
- (is (string= (to-string 4) "4")))))
+ (format-number/decimal nil number :pattern "#,##0.###")))
+ (with-expected-failures
+ (is (string= (to-string number)
+ (to-string (coerce number 'double-float))))))))