RegressionTests__NumberTest.st
changeset 2396 86b690d8f903
parent 2394 168fb84c7806
child 2407 74a7f4e15ade
--- a/RegressionTests__NumberTest.st	Sat Aug 31 11:47:14 2019 +0200
+++ b/RegressionTests__NumberTest.st	Sat Aug 31 11:50:14 2019 +0200
@@ -480,6 +480,36 @@
     self assert:( (20 printfPrintString:'%d%%') = '20%' ).
     self assert:( (20 printfPrintString:'%d%') = '20' ).
 
+    {
+        '%f'   .   Float NaN                .  'nan'  .
+        '%F'   .   Float NaN                .  'NAN'  .
+        '%f'   .   Float infinity           .  'inf'  .
+        '%F'   .   Float infinity           .  'INF'  .
+        '%f'   .   Float negativeInfinity   .  '-inf'  .
+        '%F'   .   Float negativeInfinity   .  '-INF'  .
+
+        '%+f'  .   Float NaN                .  'nan'  .    
+        '%+F'  .   Float NaN                .  'NAN'  .    
+        '%+f'  .   Float infinity           .  '+inf'  .
+        '%+F'  .   Float infinity           .  '+INF'  .
+        '%+f'  .   Float negativeInfinity   .  '-inf'  .
+        '%+F'  .   Float negativeInfinity   .  '-INF'  .
+
+        '% f'  .   Float NaN                .  'nan'  .    "/ not sure if that is reasonable (but printf does the same) 
+        '% F'  .   Float NaN                .  'NAN'  .    "/ not sure if that is reasonable (but printf does the same)
+        '% f'  .   Float infinity           .  ' inf'  .
+        '% F'  .   Float infinity           .  ' INF'  .
+        '% f'  .   Float negativeInfinity   .  '-inf'  .
+        '% F'  .   Float negativeInfinity   .  '-INF'  .
+    } inGroupsOf:3 do:[:fmt :val :expected|
+        |printfGenerated stxGenerated|
+
+        printfGenerated := val printfPrintString:fmt.
+        stxGenerated := PrintfScanf printf:fmt argument:val.
+        self assert:(stxGenerated = printfGenerated).
+        self assert:(printfGenerated = expected).
+    ].
+
     #(
         '%r'       1234      'r'  
         '%3r'      1234      '  r'