[fdo-commits] r676 - in branches/3.2.x/Utilities/TestCommon: Inc Src
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Thu Jan 25 21:55:21 EST 2007
Author: brentrobinson
Date: 2007-01-25 21:55:21 -0500 (Thu, 25 Jan 2007)
New Revision: 676
Modified:
branches/3.2.x/Utilities/TestCommon/Inc/TestCommonConstraints.h
branches/3.2.x/Utilities/TestCommon/Src/TestCommonConstraints.cpp
branches/3.2.x/Utilities/TestCommon/Src/TestCommonMiscUtil.cpp
Log:
Activated more constrained value update tests for RDBMS providers.
Modified: branches/3.2.x/Utilities/TestCommon/Inc/TestCommonConstraints.h
===================================================================
--- branches/3.2.x/Utilities/TestCommon/Inc/TestCommonConstraints.h 2007-01-26 02:51:00 UTC (rev 675)
+++ branches/3.2.x/Utilities/TestCommon/Inc/TestCommonConstraints.h 2007-01-26 02:55:21 UTC (rev 676)
@@ -62,7 +62,8 @@
virtual FdoIConnection* CreateConnection( FdoBoolean recreateDb = false );
virtual FdoBoolean CanRestrictCheckConstraint();
- virtual FdoBoolean CanHandleExactFloatValue();
+ virtual FdoDouble GetDoubleRounding(FdoDataType dataType);
+ virtual FdoFloat GetSecondsIncrement();
virtual FdoInt32 GetExpectedCheckConstraintCount( FdoIConnection* connection );
Modified: branches/3.2.x/Utilities/TestCommon/Src/TestCommonConstraints.cpp
===================================================================
--- branches/3.2.x/Utilities/TestCommon/Src/TestCommonConstraints.cpp 2007-01-26 02:51:00 UTC (rev 675)
+++ branches/3.2.x/Utilities/TestCommon/Src/TestCommonConstraints.cpp 2007-01-26 02:55:21 UTC (rev 676)
@@ -1296,34 +1296,31 @@
CPPUNIT_ASSERT_MESSAGE("Should get check constraint violation prop #3", checkSuccess == false );
- if ( CanHandleExactFloatValue() ) {
+ TestCommonMiscUtil::InsertObject(
+ connection,
+ insertCmd,
+ SCHEMA_NAME,
+ CLASS_NAME,
+ PROP_FEATID, FdoDataType_Int32, 99999999,
+ PROP_INT32_R , FdoDataType_Int32, (FdoInt32) 10,
+ PROP_INT32_L, FdoDataType_Int32, (FdoInt32) 20,
+ PROP_STRING_L, FdoDataType_String, L"open",
+ PROP_UNIQUE1, FdoDataType_Int32, (FdoInt32) 8000,
+ PROP_UNIQUE2_1, FdoDataType_Int32, (FdoInt32) 8000,
+ (FdoString*) NULL
+ );
- TestCommonMiscUtil::InsertObject(
- connection,
- insertCmd,
- SCHEMA_NAME,
- CLASS_NAME,
- PROP_FEATID, FdoDataType_Int32, 99999999,
- PROP_INT32_R , FdoDataType_Int32, (FdoInt32) 10,
- PROP_INT32_L, FdoDataType_Int32, (FdoInt32) 20,
- PROP_STRING_L, FdoDataType_String, L"open",
- PROP_UNIQUE1, FdoDataType_Int32, (FdoInt32) 8000,
- PROP_UNIQUE2_1, FdoDataType_Int32, (FdoInt32) 8000,
- (FdoString*) NULL
- );
+ UpdateAllValues( connection, CLASS_NAME, 99999999);
- UpdateAllValues( connection, CLASS_NAME, 99999999);
-
- TestCommonMiscUtil::DeleteObjects(
- connection,
- SCHEMA_NAME,
- CLASS_NAME,
- PROP_FEATID,
- FdoDataType_Int32,
- (FdoInt32) 99999999,
- NULL
- );
- }
+ TestCommonMiscUtil::DeleteObjects(
+ connection,
+ SCHEMA_NAME,
+ CLASS_NAME,
+ PROP_FEATID,
+ FdoDataType_Int32,
+ (FdoInt32) 99999999,
+ NULL
+ );
}
}
@@ -1338,7 +1335,7 @@
UpdateRangeIntegralValues( connection, pClassName, PROP_FEATID, featId, PROP_INT32_R, INT32_RANGE );
UpdateRangeIntegralValues( connection, pClassName, PROP_FEATID, featId, PROP_INT64_R, INT64_RANGE );
UpdateRangeDoubleValues( connection, pClassName, PROP_FEATID, featId, PROP_DOUBLE_R, FdoDataType_Double, DOUBLE_RANGE );
- if ( CanHandleExactFloatValue() )
+ if ( GetDoubleRounding(FdoDataType_Decimal) == 0 )
UpdateRangeDoubleValues( connection, pClassName, PROP_FEATID, featId, PROP_DECIMAL_R, FdoDataType_Decimal, DOUBLE_RANGE );
UpdateRangeSingleValues( connection, pClassName, PROP_FEATID, featId);
UpdateRangeStringValues( connection, pClassName, PROP_FEATID, featId);
@@ -1348,7 +1345,7 @@
UpdateListValues( connection, pClassName, PROP_FEATID, featId, PROP_INT32_L, INT32_LIST[1], (FdoInt32) 500 );
UpdateListValues( connection, pClassName, PROP_FEATID, featId, PROP_INT64_L, INT64_LIST[1], (FdoInt64) 800 );
- if ( this->CanHandleExactFloatValue() ) {
+ if ( GetDoubleRounding(FdoDataType_Decimal) == 0 ) {
UpdateListDoubleValues( connection, pClassName, PROP_FEATID, featId, PROP_DOUBLE_L, FdoDataType_Double);
UpdateListValues( connection, pClassName, PROP_FEATID, featId, PROP_SINGLE_L, SINGLE_LIST[1], (FdoFloat) 200.43 );
}
@@ -1371,24 +1368,10 @@
FdoPtr<FdoDataValueCollection> badValues = FdoDataValueCollection::Create();
FdoPtr<FdoDataValueCollection> goodValues = FdoDataValueCollection::Create();
- badValues->Add(
- FdoPtr<FdoDataValue>(
- FdoDataValue::Create(
- this->CanHandleExactFloatValue() ? (FdoDouble) pRange[0] : (FdoDouble)(pRange[0] - 0.01),
- dataType
- )
- )
- );
- badValues->Add( FdoPtr<FdoDataValue>(FdoDataValue::Create((FdoDouble)(pRange[1] + 0.01), dataType)) );
- goodValues->Add( FdoPtr<FdoDataValue>(FdoDataValue::Create((FdoDouble) (pRange[0] + 0.01), dataType)) );
- goodValues->Add(
- FdoPtr<FdoDataValue>(
- FdoDataValue::Create(
- this->CanHandleExactFloatValue() ? (FdoDouble)pRange[1] : (FdoDouble)(pRange[1] - 0.01),
- dataType
- )
- )
- );
+ badValues->Add( FdoPtr<FdoDataValue>(FdoDataValue::Create((FdoDouble)(pRange[0] - GetDoubleRounding(dataType)), dataType)) );
+ badValues->Add( FdoPtr<FdoDataValue>(FdoDataValue::Create((FdoDouble)(pRange[1] + 0.05), dataType)) );
+ goodValues->Add( FdoPtr<FdoDataValue>(FdoDataValue::Create((FdoDouble) (pRange[0] + 0.05), dataType)) );
+ goodValues->Add( FdoPtr<FdoDataValue>(FdoDataValue::Create((FdoDouble)(pRange[1] - GetDoubleRounding(dataType)), dataType)) );
UpdateRangeValues( connection, pClassName, pIdName, idValue, pPropName, goodValues, badValues );
}
@@ -1442,10 +1425,10 @@
badValues->Add( FdoPtr<FdoDataValue>(FdoDataValue::Create(dateTime)) );
dateTime = minDateTime;
dateTime.minute = dateTime.minute - 1;
- dateTime.seconds = (FdoFloat)(dateTime.seconds + 0.001);
+ dateTime.seconds = (FdoFloat)(dateTime.seconds + GetSecondsIncrement());
badValues->Add( FdoPtr<FdoDataValue>(FdoDataValue::Create(dateTime)) );
dateTime = minDateTime;
- dateTime.seconds = (FdoFloat)(dateTime.seconds - 0.001);
+ dateTime.seconds = (FdoFloat)(dateTime.seconds - GetSecondsIncrement());
badValues->Add( FdoPtr<FdoDataValue>(FdoDataValue::Create(dateTime)) );
dateTime = maxDateTime;
@@ -1467,9 +1450,9 @@
dateTime = maxDateTime;
dateTime.minute = dateTime.minute + 1;
badValues->Add( FdoPtr<FdoDataValue>(FdoDataValue::Create(dateTime)) );
- dateTime.seconds = (FdoFloat)(dateTime.seconds - 0.001);
+ dateTime.seconds = (FdoFloat)(dateTime.seconds - GetSecondsIncrement());
dateTime = maxDateTime;
- dateTime.seconds = (FdoFloat)(dateTime.seconds + 0.001);
+ dateTime.seconds = (FdoFloat)(dateTime.seconds + GetSecondsIncrement());
badValues->Add( FdoPtr<FdoDataValue>(FdoDataValue::Create(dateTime)) );
UpdateRangeValues( connection, pClassName, pIdName, idValue, PROP_DATE_R, goodValues, badValues );
@@ -3424,11 +3407,16 @@
return true;
}
-FdoBoolean TestCommonConstraints::CanHandleExactFloatValue()
+FdoDouble TestCommonConstraints::GetDoubleRounding(FdoDataType dataType)
{
- return true;
+ return (FdoDouble) 0.0;
}
+FdoFloat TestCommonConstraints::GetSecondsIncrement()
+{
+ return (FdoFloat) 0.001;
+}
+
FdoInt32 TestCommonConstraints::GetExpectedCheckConstraintCount( FdoIConnection* connection )
{
FdoPtr<FdoISchemaCapabilities> schemaCap = connection->GetSchemaCapabilities();
Modified: branches/3.2.x/Utilities/TestCommon/Src/TestCommonMiscUtil.cpp
===================================================================
--- branches/3.2.x/Utilities/TestCommon/Src/TestCommonMiscUtil.cpp 2007-01-26 02:51:00 UTC (rev 675)
+++ branches/3.2.x/Utilities/TestCommon/Src/TestCommonMiscUtil.cpp 2007-01-26 02:55:21 UTC (rev 676)
@@ -133,6 +133,7 @@
FdoByte byteArg;
FdoInt32 int32Arg;
FdoFloat floatArg;
+ FdoDouble doubleArg;
FdoString* strArg;
FdoDataType dataType = (FdoDataType) va_arg(arguments,int);
@@ -154,6 +155,11 @@
floatArg = (FdoFloat) va_arg(arguments,double);
dataValue = FdoDataValue::Create(floatArg);
break;
+ case FdoDataType_Double:
+ case FdoDataType_Decimal:
+ doubleArg = (FdoDouble) va_arg(arguments,double);
+ dataValue = FdoDataValue::Create(doubleArg, dataType);
+ break;
case FdoDataType_String:
strArg = va_arg(arguments,FdoString*);
dataValue = FdoDataValue::Create(strArg);
More information about the fdo-commits
mailing list