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:
parent
8f4a5ac6ad
commit
dae9095083
@ -372,12 +372,8 @@ var
|
|||||||
ActualDateTime: TDateTime;
|
ActualDateTime: TDateTime;
|
||||||
ErrorMargin: TDateTime; //margin for error in comparison test
|
ErrorMargin: TDateTime; //margin for error in comparison test
|
||||||
begin
|
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)
|
ErrorMargin := 1E-5/(24*60*60*1000); // = 10 nsec = 1E-8 sec (1 ns fails)
|
||||||
{$else}
|
|
||||||
ErrorMargin:=0;
|
|
||||||
{$endif}
|
|
||||||
if Row>High(SollDates) then
|
if Row>High(SollDates) then
|
||||||
fail('Error in test code: array bounds overflow. Check array size is correct.');
|
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
|
if not(TestWorkSheet.ReadAsDateTime(Row, 0, ActualDateTime)) then
|
||||||
Fail('Could not read date time value for cell '+CellNotation(TestWorkSheet,Row));
|
Fail('Could not read date time value for cell '+CellNotation(TestWorkSheet,Row));
|
||||||
|
{$ifdef mswindows}
|
||||||
CheckEquals(SollDates[Row],ActualDateTime,ErrorMargin,'Test date/time value mismatch, '
|
CheckEquals(SollDates[Row],ActualDateTime,ErrorMargin,'Test date/time value mismatch, '
|
||||||
+'cell '+CellNotation(TestWorksheet,Row));
|
+'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.
|
// Don't free the workbook here - it will be reused. It is destroyed at finalization.
|
||||||
end;
|
end;
|
||||||
|
@ -157,17 +157,12 @@ var
|
|||||||
hr,min,sec,msec: Word;
|
hr,min,sec,msec: Word;
|
||||||
ErrorMargin: double;
|
ErrorMargin: double;
|
||||||
begin
|
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;
|
ErrorMargin:=1.44E-7;
|
||||||
//1.44E-7 for SUMSQ formula
|
//1.44E-7 for SUMSQ formula
|
||||||
//6.0E-8 for SUM formula
|
//6.0E-8 for SUM formula
|
||||||
//4.8E-8 for MAX formula
|
//4.8E-8 for MAX formula
|
||||||
//2.4E-8 for now formula
|
//2.4E-8 for now formula
|
||||||
//about 1E-15 is needed for some trig functions
|
//about 1E-15 is needed for some trig functions
|
||||||
{$else}
|
|
||||||
ErrorMargin:=0;
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
// Create test workbook
|
// Create test workbook
|
||||||
MyWorkbook := TsWorkbook.Create;
|
MyWorkbook := TsWorkbook.Create;
|
||||||
@ -219,9 +214,16 @@ begin
|
|||||||
'Test read calculated formula result mismatch, formula "' + formula +
|
'Test read calculated formula result mismatch, formula "' + formula +
|
||||||
'", cell '+CellNotation(MyWorkSheet,Row,1));
|
'", cell '+CellNotation(MyWorkSheet,Row,1));
|
||||||
atNumber:
|
atNumber:
|
||||||
|
{$ifdef mswindows}
|
||||||
CheckEquals(expected.NumberValue, actual.NumberValue, ErrorMargin,
|
CheckEquals(expected.NumberValue, actual.NumberValue, ErrorMargin,
|
||||||
'Test read calculated formula result mismatch, formula "' + formula +
|
'Test read calculated formula result mismatch, formula "' + formula +
|
||||||
'", cell '+CellNotation(MyWorkSheet,Row,1));
|
'", 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:
|
atString:
|
||||||
CheckEquals(expected.StringValue, actual.StringValue,
|
CheckEquals(expected.StringValue, actual.StringValue,
|
||||||
'Test read calculated formula result mismatch, formula "' + formula +
|
'Test read calculated formula result mismatch, formula "' + formula +
|
||||||
|
Loading…
Reference in New Issue
Block a user