fpspreadsheet: error margin seems to be needed on Windows (FPC 2.6.4+FPC trunk), not on *nix (FPC 2.6.4) in contrast to previous commit.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3340 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
bigchimp
2014-07-19 15:24:24 +00:00
parent 8f4a5ac6ad
commit dae9095083
2 changed files with 14 additions and 10 deletions

View File

@ -372,12 +372,8 @@ var
ActualDateTime: TDateTime;
ErrorMargin: TDateTime; //margin for error in comparison test
begin
// Seems to be needed for testing with FPC 2.7.x; 2.6.4 shows more precise comparison
{$if FPC_FULLVERSION>=20701}
ErrorMargin := 1E-5/(24*60*60*1000); // = 10 nsec = 1E-8 sec (1 ns fails)
{$else}
ErrorMargin:=0;
{$endif}
if Row>High(SollDates) then
fail('Error in test code: array bounds overflow. Check array size is correct.');
@ -410,8 +406,14 @@ begin
if not(TestWorkSheet.ReadAsDateTime(Row, 0, ActualDateTime)) then
Fail('Could not read date time value for cell '+CellNotation(TestWorkSheet,Row));
{$ifdef mswindows}
CheckEquals(SollDates[Row],ActualDateTime,ErrorMargin,'Test date/time value mismatch, '
+'cell '+CellNotation(TestWorksheet,Row));
{$else}
// Non-windows: test without error margin
CheckEquals(SollDates[Row],ActualDateTime,'Test date/time value mismatch, '
+'cell '+CellNotation(TestWorksheet,Row));
{$endif}
// Don't free the workbook here - it will be reused. It is destroyed at finalization.
end;

View File

@ -157,17 +157,12 @@ var
hr,min,sec,msec: Word;
ErrorMargin: double;
begin
// Seems to be needed for testing with FPC 2.7.x; 2.6.4 shows more precise comparison
{$if FPC_FULLVERSION>=20701}
ErrorMargin:=1.44E-7;
//1.44E-7 for SUMSQ formula
//6.0E-8 for SUM formula
//4.8E-8 for MAX formula
//2.4E-8 for now formula
//about 1E-15 is needed for some trig functions
{$else}
ErrorMargin:=0;
{$endif}
// Create test workbook
MyWorkbook := TsWorkbook.Create;
@ -219,9 +214,16 @@ begin
'Test read calculated formula result mismatch, formula "' + formula +
'", cell '+CellNotation(MyWorkSheet,Row,1));
atNumber:
{$ifdef mswindows}
CheckEquals(expected.NumberValue, actual.NumberValue, ErrorMargin,
'Test read calculated formula result mismatch, formula "' + formula +
'", cell '+CellNotation(MyWorkSheet,Row,1));
{$else}
// Non-Windows: test without error margin
CheckEquals(expected.NumberValue, actual.NumberValue,
'Test read calculated formula result mismatch, formula "' + formula +
'", cell '+CellNotation(MyWorkSheet,Row,1));
{$endif}
atString:
CheckEquals(expected.StringValue, actual.StringValue,
'Test read calculated formula result mismatch, formula "' + formula +