mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-23 17:19:38 +02:00
+ test for mantis #21449, already fixed in the mean time
git-svn-id: trunk@28863 -
This commit is contained in:
parent
f1c45eeae3
commit
d117402673
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13824,6 +13824,7 @@ tests/webtbs/tw21350a.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw21350b.pp svneol=native#text/pascal
|
tests/webtbs/tw21350b.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw21443.pp svneol=native#text/plain
|
tests/webtbs/tw21443.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw21443a.pp svneol=native#text/plain
|
tests/webtbs/tw21443a.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw21449.pp -text svneol=native#text/plain
|
||||||
tests/webtbs/tw2145.pp svneol=native#text/plain
|
tests/webtbs/tw2145.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw21457.pp svneol=native#text/pascal
|
tests/webtbs/tw21457.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw21472.pp svneol=native#text/pascal
|
tests/webtbs/tw21472.pp svneol=native#text/pascal
|
||||||
|
54
tests/webtbs/tw21449.pp
Normal file
54
tests/webtbs/tw21449.pp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
data_record = record
|
||||||
|
amountStr:String;
|
||||||
|
amount:Currency;
|
||||||
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
kColCount = 5;
|
||||||
|
kFormatString:array[0..kColCount-1]of String = ( '%1.0f', '%1.1f', '%1.2f', '%1.3f', '%1.4f' );
|
||||||
|
|
||||||
|
kRowCount = 2;
|
||||||
|
kTestData:array[0..kRowCount-1] of data_record = (
|
||||||
|
(amountStr:'209.98'; amount:209.98 ),
|
||||||
|
(amountStr:'9.94'; amount:9.94 ) );
|
||||||
|
ExpectedResults: array[0..kRowCount-1,0..kColCount-1] of string =
|
||||||
|
(('210','210.0','209.98','209.980','209.9800'),
|
||||||
|
('10','9.9','9.94','9.940','9.9400'));
|
||||||
|
|
||||||
|
procedure test;
|
||||||
|
var
|
||||||
|
amount:Currency;
|
||||||
|
index:Integer;
|
||||||
|
rowIndex:Integer;
|
||||||
|
begin
|
||||||
|
rowIndex := 0;
|
||||||
|
while( rowIndex < kRowCount )do
|
||||||
|
begin
|
||||||
|
val(kTestData[rowIndex].amountStr,amount,index);
|
||||||
|
if index<>0 then
|
||||||
|
halt(1);
|
||||||
|
write(kTestData[rowIndex].amountStr,' -- ',amount:0:4,': ');
|
||||||
|
index := 0;
|
||||||
|
while( index < kColCount )do
|
||||||
|
begin
|
||||||
|
write(Format( kFormatString[index], [amount] ),',');
|
||||||
|
if Format( kFormatString[index], [amount] )<>ExpectedResults[rowindex,index] then
|
||||||
|
halt(2);
|
||||||
|
Inc( index );
|
||||||
|
end;
|
||||||
|
writeln;
|
||||||
|
Inc( rowIndex );
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
test;
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user