Przeglądaj źródła

* Applied patch from Laco to fix bug ID #25939

git-svn-id: trunk@27846 -
michael 11 lat temu
rodzic
commit
6c7ab322a1
1 zmienionych plików z 24 dodań i 2 usunięć
  1. 24 2
      tests/test/units/fmtbcd/tfmtbcd.pp

+ 24 - 2
tests/test/units/fmtbcd/tfmtbcd.pp

@@ -35,6 +35,17 @@ begin
   end;
 end;
 
+procedure testBCDToStr(const bcd: TBCD; const Output: string);
+var s: string;
+begin
+  s := BCDToStr(bcd);
+  if s <> Output then
+  begin
+    writeln('BCDToStr: ', s, ' Expected: ', Output);
+    inc(ErrorCount);
+  end;
+end;
+
 procedure testBCDToStrF(const s1, s2: string);
 begin
   if s1 <> s2 then
@@ -44,7 +55,7 @@ begin
   end;
 end;
 
-procedure testFormatBCD(const Format: string; BCD: TBCD; Output: string);
+procedure testFormatBCD(const Format: string; BCD: TBCD; const Output: string);
 var s: string;
 begin
   s := FormatBCD(Format, BCD);
@@ -138,9 +149,20 @@ end;
 begin
   ErrorCount := 0;
 
-  // test BCDToStrF:
+  // test BCDToStr:
   DFS:=DefaultFormatSettings;
 
+  FS.DecimalSeparator:=',';
+  FS.ThousandSeparator:=#0;
+  DefaultFormatSettings:=FS;
+  testBCDToStr(0, '0');
+  testBCDToStr(-123, '-123');
+  testBCDToStr(0.5, '0,5');
+  testBCDToStr(-1.03125, '-1,03125');
+  testBCDToStr(CurrToBCD(1.2345), '1,2345');
+  testBCDToStr(CurrToBCD(-0.0045), '-0,0045');
+
+  // test BCDToStrF:
   FS.DecimalSeparator:=',';
   FS.ThousandSeparator:=' ';
   FS.CurrencyDecimals:=2;