瀏覽代碼

+ test for already fixed mantis #11309

git-svn-id: trunk@11026 -
Jonas Maebe 17 年之前
父節點
當前提交
63abaeecea
共有 2 個文件被更改,包括 44 次插入0 次删除
  1. 1 0
      .gitattributes
  2. 43 0
      tests/webtbs/tw11309.pp

+ 1 - 0
.gitattributes

@@ -8276,6 +8276,7 @@ tests/webtbs/tw11255.pp svneol=native#text/plain
 tests/webtbs/tw11288.pp svneol=native#text/plain
 tests/webtbs/tw11288.pp svneol=native#text/plain
 tests/webtbs/tw11290.pp svneol=native#text/plain
 tests/webtbs/tw11290.pp svneol=native#text/plain
 tests/webtbs/tw11308.pp svneol=native#text/plain
 tests/webtbs/tw11308.pp svneol=native#text/plain
+tests/webtbs/tw11309.pp svneol=native#text/plain
 tests/webtbs/tw11312.pp svneol=native#text/plain
 tests/webtbs/tw11312.pp svneol=native#text/plain
 tests/webtbs/tw1132.pp svneol=native#text/plain
 tests/webtbs/tw1132.pp svneol=native#text/plain
 tests/webtbs/tw1133.pp svneol=native#text/plain
 tests/webtbs/tw1133.pp svneol=native#text/plain

+ 43 - 0
tests/webtbs/tw11309.pp

@@ -0,0 +1,43 @@
+{$ifdef fpc}
+{$mode delphi}
+{$endif}
+
+uses
+  SysUtils;
+
+const
+  csMoney = '58.195';
+
+Function Format_Currency_String1(sMoney : string) : string;
+var
+aCurrency : Currency;
+begin
+  TRY
+aCurrency := strtoCurr(sMoney);
+  EXCEPT
+   on E: EConvertError do aCurrency := 0;
+  END;
+//result := CurrToStrF(currBetrag,ffFixed,2);
+result := FloatToStrF(aCurrency,ffFixed,19,2);
+end;
+
+Function Format_Currency_String2(sMoney : string) : string;
+var
+aCurrency : real;
+begin
+  TRY
+aCurrency := strtofloat(sMoney);
+  EXCEPT
+   on E: EConvertError do aCurrency := 0;
+  END;
+result := FloatToStrF(aCurrency,ffFixed,19,2);
+end;
+
+begin
+  writeln(Format_Currency_String1(csMoney));
+  writeln(Format_Currency_String2(csMoney));
+  if Format_Currency_String1(csMoney)<>'58.20' then
+    halt(1);
+  if Format_Currency_String2(csMoney)<>'58.20' then
+    halt(2);
+end.