From 752b1c95e7dae28225f0b7d6cf9680a879269eb6 Mon Sep 17 00:00:00 2001 From: bigchimp Date: Sat, 19 Jul 2014 09:53:48 +0000 Subject: [PATCH] fpspreadsheet: allow margin for error testing writing reading date/time. Test failures from 29 to 6 git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3334 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/tests/datetests.pas | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/fpspreadsheet/tests/datetests.pas b/components/fpspreadsheet/tests/datetests.pas index df5619d55..1c03b0694 100644 --- a/components/fpspreadsheet/tests/datetests.pas +++ b/components/fpspreadsheet/tests/datetests.pas @@ -370,12 +370,15 @@ end; procedure TSpreadReadDateTests.TestReadDate(FileName: string; Row: integer); var ActualDateTime: TDateTime; + ErrorMargin: TDateTime; //margin for error in comparison test begin + ErrorMargin:=0.000000000000001; if Row>High(SollDates) then fail('Error in test code: array bounds overflow. Check array size is correct.'); // Load the file only if is the file name changes. - if TestFileName <> FileName then begin + if TestFileName <> FileName then + begin if TestWorkbook <> nil then TestWorkbook.Free; @@ -389,7 +392,7 @@ begin end; TestWorksheet := GetWorksheetByName(TestWorkBook, DatesSheet); if TestWorksheet=nil then - fail('Error in test code. Failed to get named worksheet'); + fail('Error in test code. Failed to get named worksheet '+DatesSheet); TestFileName := FileName; end; @@ -402,7 +405,7 @@ begin if not(TestWorkSheet.ReadAsDateTime(Row, 0, ActualDateTime)) then Fail('Could not read date time value for cell '+CellNotation(TestWorkSheet,Row)); - CheckEquals(SollDates[Row],ActualDateTime,'Test date/time value mismatch, ' + CheckEquals(SollDates[Row],ActualDateTime,ErrorMargin,'Test date/time value mismatch, ' +'cell '+CellNotation(TestWorksheet,Row)); // Don't free the workbook here - it will be reused. It is destroyed at finalization.