Преглед на файлове

fcl-db: tests: add comment for SQLite why some test for exact numeric (currency) values, which can not be expressed lossless as double, fail.
Add to testCurrencyValues, also value with decimal point which can be expressed lossless as double.

git-svn-id: trunk@27668 -

lacak преди 11 години
родител
ревизия
2d785d1035
променени са 2 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 2 0
      packages/fcl-db/tests/sqldbtoolsunit.pas
  2. 1 1
      packages/fcl-db/tests/toolsunit.pas

+ 2 - 0
packages/fcl-db/tests/sqldbtoolsunit.pas

@@ -330,6 +330,8 @@ begin
       end;
     ssSQLite:
       begin
+      // SQLite stores all values with decimal point as 8 byte (double) IEEE floating point numbers
+      // (it causes that some tests (for BCD, FmtBCD fields) fails for exact numeric values, which can't be lossless expressed as 8 byte floating point values)
       FieldtypeDefinitions[ftWord] := 'WORD';
       FieldtypeDefinitions[ftCurrency] := 'CURRENCY';
       FieldtypeDefinitions[ftBytes] := 'BINARY(5)';

+ 1 - 1
packages/fcl-db/tests/toolsunit.pas

@@ -124,7 +124,7 @@ const
 const
   testValuesCount = 25;
   testFloatValues : Array[0..testValuesCount-1] of double = (-maxSmallint-1,-maxSmallint,-256,-255,-128,-127,-1,0,1,127,128,255,256,maxSmallint,maxSmallint+1,0.123456,-0.123456,4.35,12.434E7,9.876e-5,123.45678,2.4,3.2,0.4,23);
-  testCurrencyValues : Array[0..testValuesCount-1] of currency = (-MaxLongInt-1,-MaxSmallint-1,-256,-255,-43.34,-2.5,-0.21,0,0.32,45.45,255,256,45,1234.56,12.34,0.12,MaxSmallInt+1,MaxLongInt+1,-6871947.67,68719476736,2748779069.44,-9223372036854.8,922337203685.47,-92233720368547,99999999999999);
+  testCurrencyValues : Array[0..testValuesCount-1] of currency = (-MaxLongInt-1,-MaxSmallint-1,-256,-255,-43.34,-2.5,-0.21,0,0.32,45.45,256,45,1234.56,12.34,0.12,MaxSmallInt+1,MaxLongInt+1,-6871947.67,68719476736,2748779069.44,-9223372036854.0625,922337203685.47,-92233720368547,99999999999999,-9223372036854.7);
   testFmtBCDValues : Array[0..testValuesCount-1] of string = ('-100','-65.5','-54.3333','-43.3334','-2.5','-0.234567','45.4','0.3','45.414585','127','128','255','256','45','0.3','45.4','127','128','255','256','45','1234.56789','43.23','43.500001','99.88');
   testIntValues : Array[0..testValuesCount-1] of integer = (-maxInt,-maxInt+1,-maxSmallint-1,-maxSmallint,-256,-255,-128,-127,-1,0,1,127,128,255,256,maxSmallint,maxSmallint+1,MaxInt-1,MaxInt,100,130,150,-150,-132,234);
   testWordValues : Array[0..testValuesCount-1] of Word = (1,2,3,4,5,6,7,8,0,1,127,128,255,256,maxSmallint,maxSmallint+1,maxSmallInt-1,maxSmallInt,65535,100,130,150,151,132,234);