;;; .EnTete "Le-Lisp (c) version 15.2" " " "Test de la fonction FORMAT"
;;; .EnPied "testformat.ll" "%" " "
;;;
;;; .SuperTitre "Test de la fonction FORMAT"
;;;
;;;
;;; .Centre "*****************************************************************"
;;; .Centre " Ce fichier est en lecture seule hors du projet ALE de l'INRIA.  "
;;; .Centre " Il est maintenu par ILOG SA, 2 Avenue Gallie'ni, 94250 Gentilly "
;;; .Centre " (c) Le-Lisp est une marque de'pose'e de l'INRIA                 "
;;; .Centre "*****************************************************************"
;;;
;;; .Centre "$Header: testformat.ll,v 4.1 88/01/13 12:31:33 kuczynsk Rel $"

(unless (>= (version) 15.2)
        (error 'load 'erricf 'testfn))

(unless (featurep 'testcomm)
        (libload testcomm))

(unless (featurep 'format)
        (print "Je charge format interpre'te'")
        (libload format))

(testfn ())

          (test-serie "Test de la fonction Format" ())

(format () "Le test de Format")         "Le test de Format"
(format () "~A jej?" 'coco)             "coco jej?"
(format () "~S ~A" "meuh" "mia")        """meuh"" mia"
(format () "~A" 'coco)                  "coco"
(format () "~6A" 'coco)                 "  coco"
(format () "~6@A" 'coco)                "coco  "
(format () "~#@A" 'coco () () () () ()) "coco  "
(format () "~vA ~V@A" 6 'coco 4 1)      "  coco 1   "
(format () "~6,32A" 'coco)              "  coco"
(format () "~6,'*@A" 'coco)             "coco**"
(format () "~,,,A" 'coco)               "coco"
(format () "~6,,,A" 'coco)              "  coco"
(format () "~6,,,'*@A" 'coco)           "coco**"
(format () "~1,,2A" 'coco)              "  coco"
(format () "~8,,2A" 'coco)              "    coco"
(format () "~8,10,2A" 'coco)            "            coco"
(format () "~8,10,2,'*A" 'coco)         "************coco"
(format () "~8,10,2,V@A" #/↑ 'coco)     "coco↑↑↑↑↑↑↑↑↑↑↑↑"
(format () "~S" ())                     "()"
(format () "~D" 5)                      "5"
(format () "~3D" 5)                     "  5"
(format () "~3,'*@D" 5)                 "5**"
(format () "~7D" 'coco)                 "   coco"
(format () "~5,vB" #/0 15)              "01111"
(format () "~#,'0O" 63 7 8)             "077"
(format () "~5@X" 17)                   "11   "
(format () "~2R" 15)                    "1111"
(format () "~3,5,'*@R" 13)              "111**"
(format () "~P" 1)                      ""
(format () "~P" 'coco)                  "s"
(format () "~D tr~:@P/~D win~:P" 7 1)   "7 tries/1 win"
(format () "~D tr~:@P/~D win~:P" 1 0)   "1 try/0 wins"
(format () "~D tr~:@P/~D win~:P" 1 3)   "1 try/3 wins"
(format () "~C" #/+)                    "+"
(format () "~:C" #/+)                   "+"
(format () "~:C" #↑A)                   "control-A"
(format () "~:C" #↑I)                   "tab"
(format () "~@C" #/+)                   "#/+"
(format () "~@C" #\sp)                  "#\sp"
(format () "~@C" #↑A)                   "#↑A"
(format () "~6,2F" 3.14159)             "  3.14"
(format () "~6,2F" -3.14159)            " -3.14"
(format () "~6,2F" 100)                 "100.00"
(format () "~6,2F" 1234.0)              "1234.00"
(format () "~6,2F" 999.999)             "999.99"
(format () "~6,2,1,'*F" 3.14159)        " 31.42"
(format () "~6,2,1,'*F" -3.14159)       "-31.42"
(format () "~6,2,1,'*F" 100)            "******"
(format () "~6,2,1,'*F" 1234.0)         "******"
(format () "~6,2,1,'*F" 0.006)          "  0.06"
(format () "~6,2,,'?F" 3.14159)         "  3.14"
(format () "~6,2,,'?F" -3.14159)        " -3.14"
(format () "~6,2,,'?F" 100)             "100.00"
(format () "~6,2,,'?F" 1234.0)          "??????"
(format () "~6,2,,'?F" 0.006)           "  0.01"
(format () "~6F" 3.14159)               "3.1416"
(format () "~6F" -3.14159)              "-3.142"
(format () "~6F" 100)                   "100.00"
(format () "~6F" 1234.0)                "1234.0"
(format () "~6F" 0.006)                 "0.0060"
(format () "~6F" 99.99999)              "99.999"
(format () "~,2F" 3.14159)              "3.14"
(format () "~,2F" -3.14159)             "-3.14"
(format () "~,2F" 100)                  "100.00"
(format () "~,2F" 1234.0)               "1234.00"
(format () "~,2F" 0.006)                "0.01"
(format () "~,2F" 9.999)                "9.99"
(format () "~,1F" 9.9)                  "9.9"
(format () "~,1F" 9.99)                 "9.9"
(format () "~,1F" 999.99)               "999.9"
(format () "~F" 'coco)                  "coco"
(format () "~6F" 'coco)                 "  coco"
(format () "~6,2@F" 3.14159)            " +3.14"
(format () "~6,4F" 0.006)               "0.0060"
(format () "~6,5F" 0.006)               ".00600"
(format () "~6,6F" 0.006)               "0.006000"
(format () "~9,2,1,,'*E" 3.14159)       "  3.14e+0"
(format () "~9,2,1,,'*E" -3.14159)      " -3.14e+0"
(format () "~9,2,1,,'*E" 1100.)         "  1.10e+3"
(format () "~9,2,1,,'*E" 1.1e+13)       "*********"
(format () "~10,3,2,2,'?,,'$E" 3.14159) " 31.42$-01"
(format () "~10,3,2,2,'?,,'$E" -3.14159)          "-31.42$-01"
(format () "~10,3,2,2,'?,,'$E" 1100.)   " 11.00$+02"
(format () "~10,3,2,2,'?,,'$E" 1.1e+13) " 11.00$+12"
(format () "~9,3,2,-2,'%@E" 3.14159)    "+.003e+03"
(format () "~9,3,2,-2,'%@E" -3.14159)   "-.003e+03"
(format () "~9,3,2,-2,'%@E" 1100.)      "+.001e+06"
(format () "~9,3,2,-2,'%@E" 1.1e+13)    "+.001e+16"
(format () "~9,2E" 3.14159)             "  3.14e+0"
(format () "~9,2E" -3.14159)            " -3.14e+0"
(format () "~9,2E" 1100.)               "  1.10e+3"
(format () "~9,2E" 1.1e+13)             " 1.10e+13"
(format () "~13,6,2,VE" -7 3.14159)     ".00000003e+08"
(format () "~13,6,2,VE" -6 3.14159)     "0.0000003e+07"
(format () "~13,6,2,VE" -5 3.14159)     " 0.000003e+06"
(format () "~13,6,2,VE" -4 3.14159)     " 0.000031e+05"
(format () "~13,6,2,VE" -3 3.14159)     " 0.000314e+04"
(format () "~13,6,2,VE" -2 3.14159)     " 0.003142e+03"
(format () "~13,6,2,VE" -1 3.14159)     " 0.031416e+02"
(format () "~13,6,2,VE" 0 3.14159)      " 0.314159e+01"
(format () "~% a")                      #.(string '(#\lf #\sp #/a) )
(format () "~2% a")                     #.(string '(#\lf #\lf #\sp #/a) )
(format () "~~")                        "~"
(format () "~v~" 3)                     "~~~"
(format () #.(string '(#/~ #\lf #\sp #\tab #/b))) "b"
(format () #.(string '(#/~ #/: #\lf #\sp #\tab #/b)))
           #.(string '(#\sp #\tab #/b) )
(format () #.(string '(#/~ #/@ #\lf #\sp #\tab #/b)))
           #.(string '(#\lf #/b) ) 
(format () "~T")                        " "
(format () "~8T")                       "        "
(format () "aa~8,2T")                   "aa      "
(format () "0212335459~8T")             "0212335459"
(format () "0212335459~8,5T")           "0212335459   "
(format () "~4@T")                      "    "
(format () "hh~2,5@T")                  "hh   "
(format () "~A ~A ~*~A" 12 13 14 15 16) "12 13 15"
(format () "~2*~A" 1 2 3 4)             "3"
(format () "~D ~:* ~D" 1 2)             "1  1"
(format () "~D~2* ~:2*~D" 12 3 4)       "12 3"
(format () "~D ~D ~@*~D" 1 2 3)         "1 2 1"
(format () "~? ~A" "~2@*~D ~:*~2A" '(12 3 7 8) 'coco)       "7  7 coco"
(format () "~? ~D" "<~A ~D>" '("foo" 5) 7)                  "<foo 5> 7"
(format () "~? ~D" "<~A ~D>" '("foo" 5 14) 7)               "<foo 5> 7"
(format () "~@? ~D" "<~A ~D>" "foo" 5 7)                    "<foo 5> 7"
(format () "~@? ~D" "<~A ~D>" "foo" 5 14 7)                 "<foo 5> 14"
(format () "~[Siamese~;Manx~;Persian~] Cat" 0)              "Siamese Cat"
(format () "~[Siamese~;Manx~;Persian~] Cat" 2)              "Persian Cat"
(format () "~[Siamese~;Manx~;Persian~] Cat" 8)              " Cat"
(format () "~[Siamese~;Manx~:;Persian~] Cat" 0)             "Siamese Cat"
(format () "~[Siamese~;Manx~:;Persian~] Cat" 8)             "Persian Cat"
(format () "~:[true~;false~]" t)        "false"
(format () "~:[true~;false~]" ())       "true"
(format () "~@[ print level = ~D~]~@[ print length = ~D~]" () 5)
           " print length = 5"
(format () "The winners are:~{ ~S~}." '(fred harry jill))
                     "The winners are: fred harry jill."
(format () "Pairs:~{ <~S,~S>~}." '(a 1 b 2 c 3))
                     "Pairs: <a,1> <b,2> <c,3>."
(format () "Pairs:~:{ <~S,~S>~}." '((a 1)(b 2)(c 3)))
                     "Pairs: <a,1> <b,2> <c,3>."
(format () "Pairs:~@{ <~S,~S>~}." 'a 1 'b 2 'c 3)
                     "Pairs: <a,1> <b,2> <c,3>."
(format () "Pairs:~:@{ <~S,~S>~}." '(a 1) '(b 2) '(c 3))
                     "Pairs: <a,1> <b,2> <c,3>."
(format () "~1{~}" "~A" '(coco))        "coco"
(format () "~2{~D ~}" '(1 2 3 4))        "1 2 "
(format () "~{aaa~:}")                  "aaa"
(format () "~0{buh~:}")                 ""
(format () "Done.~↑ ~D warning~:P.~↑ ~D error~:P.")         "Done."
(format () "Done.~↑ ~D warning~:P.~↑ ~D error~:P." 3)
           "Done. 3 warnings."
(format () "Done.~↑ ~D warning~:P.~↑ ~D error~:P." 1 5)
           "Done. 1 warning. 5 errors."

          (test-serie "Fin du test" ()) 

()                                      ()