added failing number formatting test
Wed Jul 27 05:36:21 PDT 2011 attila.lendvai@gmail.com
* added failing number formatting test
diff -rN -u old-cl-l10n/cl-l10n.asd new-cl-l10n/cl-l10n.asd
--- old-cl-l10n/cl-l10n.asd 2014-07-28 19:38:37.000000000 -0700
+++ new-cl-l10n/cl-l10n.asd 2014-07-28 19:38:37.000000000 -0700
@@ -62,6 +62,7 @@
:components
((:file "package")
(:file "cldr" :depends-on ("package"))
+ (:file "formatting" :depends-on ("package" "cldr"))
(:file "resources" :depends-on ("package" "cldr"))))))
(defmethod perform ((op test-op) (sys (eql (find-system :cl-l10n))))
diff -rN -u old-cl-l10n/test/formatting.lisp new-cl-l10n/test/formatting.lisp
--- old-cl-l10n/test/formatting.lisp 1969-12-31 16:00:00.000000000 -0800
+++ new-cl-l10n/test/formatting.lisp 2014-07-28 19:38:37.000000000 -0700
@@ -0,0 +1,19 @@
+;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+;; See the file LICENCE for licence information.
+
+(in-package :cl-l10n.test)
+
+(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)
+ (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")))))