Browse Source

* More testcases (and they will fail)

git-svn-id: trunk@12336 -
michael 16 years ago
parent
commit
b0eee3cb7d
1 changed files with 21 additions and 24 deletions
  1. 21 24
      tests/webtbs/tw12385.pp

+ 21 - 24
tests/webtbs/tw12385.pp

@@ -10,32 +10,29 @@ var
   s: string; 
   cr: Extended; 
 
+Procedure TestIt(CR : Extended; Fmt,Expected : String);
+  
 begin
-  cr := 1234.567;
-  s:=FormatFloat('00000000.00', cr);
-  if s<>'00001234.57' then 
+  S:=FormatFloat(Fmt,cr);
+  If S<>Expected then
     begin
-    Writeln(S,'<> 00001234.57 (latter is correct)');
+    Writeln('"',S,'"<>"',Expected,'" (latter is correct)');
     Halt(1);
     end;
-  cr := -1234.567;
-  s:=FormatFloat('00000000.00', cr);
-  if s<>'-00001234.57' then 
-    begin
-    Writeln(S,'<> -00001234.57 (latter is correct)');
-    Halt(1);
-    end;
-  cr := -1234.567;
-  s:=FormatFloat('000.00', cr);
-  if s<>'-1234.57' then 
-    begin
-    Writeln(S,'<> -1234.57 (latter is correct)');
-    Halt(1);
-    end;
-  S:=FormatFloat('000.000',-1); //returns 0-1.000
-  if s<>'-001.000' then
-     begin
-     Writeln(S,'<> -001.000 (latter is correct)');
-     Halt(1);
-     end;
+end;
+
+begin
+  DecimalSeparator:='.';
+  ThousandSeparator:=',';
+  TestIt(1234.567,'00000000.00','00001234.57');
+  TestIt(-1234.567,'00000000.00','-00001234.57');
+  TestIt(-1234.567,'000.00','-1234.57');
+  TestIt(-1,'000.000','-001.000');
+//  TestIt(-80,'#,##0.00','-80.00');
+  TestIt(-140,'#,##0.00','-140.00');
+  TestIt(140,'#,##0.00','140.00');
+  TestIt(80,'#,##0.00','80.00');
+  TestIt(-2.45,'#,##0.00','-2.45');
+  TestIt(-1400,'#,##0.00','-1,400.00');
+  TestIt(-1400,'##,##0.00','-1,400.00');
 end.