[fdo-commits] r196 - in branches/3.2.x/Providers/SHP/Src: . Provider UnitTest

svn_fdo at osgeo.org svn_fdo at osgeo.org
Thu Feb 22 08:39:30 EST 2007


Author: pierredalcourt
Date: 2007-02-22 08:39:30 -0500 (Thu, 22 Feb 2007)
New Revision: 196

Removed:
   branches/3.2.x/Providers/SHP/Src/UnitTest/UnitTestUtil.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/UnitTestUtil.h
Modified:
   branches/3.2.x/Providers/SHP/Src/Provider/ShpDeleteCommand.cpp
   branches/3.2.x/Providers/SHP/Src/Provider/ShpExpressionCapabilities.cpp
   branches/3.2.x/Providers/SHP/Src/Provider/ShpSelectCommand.cpp
   branches/3.2.x/Providers/SHP/Src/Provider/stdafx.h
   branches/3.2.x/Providers/SHP/Src/SHP.sln
   branches/3.2.x/Providers/SHP/Src/UnitTest/BigPerformanceTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/ComparisonTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/ConnectTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/DeleteTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/FidelityTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/FileAccessTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/FilterTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/IndexTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/InsertTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/Makefile.am
   branches/3.2.x/Providers/SHP/Src/UnitTest/OverridesTest.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/Pch.h
   branches/3.2.x/Providers/SHP/Src/UnitTest/PerformanceTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/ReadOnlyTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/SchemaTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/SelectAggregatesTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/SelectAggregatesTests.h
   branches/3.2.x/Providers/SHP/Src/UnitTest/SelectTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/SelectTests.h
   branches/3.2.x/Providers/SHP/Src/UnitTest/ShpTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/ShpTests.h
   branches/3.2.x/Providers/SHP/Src/UnitTest/SpatialFilterTests.cpp
   branches/3.2.x/Providers/SHP/Src/UnitTest/UnitTest.vcproj
   branches/3.2.x/Providers/SHP/Src/UnitTest/UpdateTests.cpp
Log:
TRAC Ticket #17 "SHP/SDF: fix various Select/SelectAggregates defects"


Modified: branches/3.2.x/Providers/SHP/Src/Provider/ShpDeleteCommand.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/Provider/ShpDeleteCommand.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/Provider/ShpDeleteCommand.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -92,7 +92,7 @@
         while (reader->ReadNext ())
         {
             id = (int)reader->GetInt32 (featid);
-            id--;  // featids are 0-based internally and 1-basd externally (outside the FDO API)
+            id--;  // featids are 0-based internally and 1-based externally (outside the FDO API)
             fileset->DeleteObjectAt (id);
             ret++;
         }

Modified: branches/3.2.x/Providers/SHP/Src/Provider/ShpExpressionCapabilities.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/Provider/ShpExpressionCapabilities.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/Provider/ShpExpressionCapabilities.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -115,6 +115,8 @@
         desc = FdoException::NLSGetMessage(FUNCTION_MIN, "Returns the minimum value of an expression");
         function = FdoCommonMiscUtil::CreateFunctionDefinition(FDO_FUNCTION_MIN, desc, true, 2,
             FdoPropertyType_DataProperty, FdoDataType_Double, 1, FdoPropertyType_DataProperty, FdoDataType_Decimal, 
+            FdoPropertyType_DataProperty, FdoDataType_DateTime, 1, FdoPropertyType_DataProperty, FdoDataType_DateTime,
+            FdoPropertyType_DataProperty, FdoDataType_String, 1, FdoPropertyType_DataProperty, FdoDataType_String,
             FdoPropertyType_DataProperty, FdoDataType_Double, 1, FdoPropertyType_DataProperty, FdoDataType_Int32);
         m_supportedFunctions->Add(function);
 
@@ -127,6 +129,8 @@
         desc = FdoException::NLSGetMessage(FUNCTION_MAX, "Returns the maximum value of an expression");
         function = FdoCommonMiscUtil::CreateFunctionDefinition(FDO_FUNCTION_MAX, desc, true, 2,
             FdoPropertyType_DataProperty, FdoDataType_Double, 1, FdoPropertyType_DataProperty, FdoDataType_Decimal, 
+            FdoPropertyType_DataProperty, FdoDataType_DateTime, 1, FdoPropertyType_DataProperty, FdoDataType_DateTime,
+            FdoPropertyType_DataProperty, FdoDataType_String, 1, FdoPropertyType_DataProperty, FdoDataType_String,
             FdoPropertyType_DataProperty, FdoDataType_Double, 1, FdoPropertyType_DataProperty, FdoDataType_Int32);
         m_supportedFunctions->Add(function);
     }

Modified: branches/3.2.x/Providers/SHP/Src/Provider/ShpSelectCommand.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/Provider/ShpSelectCommand.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/Provider/ShpSelectCommand.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -20,8 +20,9 @@
 #include "stdafx.h"
 #include "ShpSelectCommand.h"
 #include "ShpFeatureReader.h"
+#include <algorithm>
+#include "FdoCommonDataReader.h"
 
-#include <malloc.h>
 
 ShpSelectCommand::ShpSelectCommand (ShpConnection* connection) :
     FdoCommonFeatureCommand<FdoISelect, ShpConnection> (connection)
@@ -92,10 +93,28 @@
     FdoString* class_name;
     FdoPtr<ShpFeatureReader> ret;
 
+    // Validate that there are no aggregate functions:
+    FdoCommonExpressionType exprType;
+    FdoPtr< FdoArray<FdoFunction*> > functions = FdoCommonDataReader::GetAggregateFunctions(mPropertiesToSelect, exprType);
+    if (exprType == FdoCommonExpressionType_Aggregate)
+        throw FdoCommandException::Create(FdoException::NLSGetMessage(FDO_182_AGGREGATE_IN_SELECT, "Aggregate functions are not supported by the Select command; use the SelectAggregates command instead."));
+
+    FdoPtr<ShpConnection> shpConn = (ShpConnection*)GetConnection ();
     id = GetFeatureClassName ();
     class_name = id->GetText ();
-    FdoPtr<ShpConnection> shpConn = (ShpConnection*)GetConnection ();
 
+    // Validate that the expressions are correct:
+    FdoPtr<FdoClassDefinition> fdoClass = FdoPtr<ShpLpClassDefinition>(ShpSchemaUtilities::GetLpClassDefinition (mConnection, class_name))->GetLogicalClass();
+    FdoPropertyType propType;
+    FdoDataType dataType;
+    for (int i=0; mPropertiesToSelect && i<mPropertiesToSelect->GetCount(); i++)
+    {
+        FdoPtr<FdoIdentifier> id = mPropertiesToSelect->GetItem(i);
+        FdoCommonFilterExecutor::GetExpressionType(shpConn, fdoClass, id, propType, dataType);
+    }
+
+    // Create the reader:
+
 	// Validate the filter. The filter may contain computed expressions involving not selected properties.
 	// Also check for unsupported spatial operations.
 	if( mFilter != NULL )

Modified: branches/3.2.x/Providers/SHP/Src/Provider/stdafx.h
===================================================================
--- branches/3.2.x/Providers/SHP/Src/Provider/stdafx.h	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/Provider/stdafx.h	2007-02-22 13:39:30 UTC (rev 196)
@@ -18,6 +18,18 @@
 #ifndef SHP_STDAFX_H
 #define SHP_STDAFX_H
 
+//defines that helps us use hash_map (and similar STL classes) in the same way 
+//under Linux and Windows.
+#ifdef WIN32
+#include <hash_map>
+#include <functional>
+#else
+#include <ext/hash_map>
+#include <ext/functional>
+namespace stdext = ::__gnu_cxx;
+using namespace std;
+#endif
+
 #ifdef _WIN32
 #pragma once
 
@@ -69,10 +81,7 @@
 
 #endif // _WIN32
 
-// number of elements in an array
-#define ELEMENTS(x) (sizeof(x)/sizeof(x[0]))
 
-
 // Base FDO headers
 #include <Fdo.h>
 #include <Fdo/Xml/SpatialContextReader.h>

Modified: branches/3.2.x/Providers/SHP/Src/SHP.sln
===================================================================
--- branches/3.2.x/Providers/SHP/Src/SHP.sln	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/SHP.sln	2007-02-22 13:39:30 UTC (rev 196)
@@ -3,18 +3,19 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest", "UnitTest\UnitTest.vcproj", "{02AF5684-A940-41EE-A372-E1639768414A}"
 	ProjectSection(ProjectDependencies) = postProject
 		{B1774502-83C9-41D5-BA1D-B53509DBE76D} = {B1774502-83C9-41D5-BA1D-B53509DBE76D}
+		{31607A09-F8CA-43B3-9195-C1D5FB18E0D7} = {31607A09-F8CA-43B3-9195-C1D5FB18E0D7}
+		{0A982097-4896-4F2B-81EC-43100004311D} = {0A982097-4896-4F2B-81EC-43100004311D}
+		{4164FE65-7AB4-45D0-8975-70465E0248A5} = {4164FE65-7AB4-45D0-8975-70465E0248A5}
 		{7C94A70E-9E83-4553-90B1-B47C1961EDBB} = {7C94A70E-9E83-4553-90B1-B47C1961EDBB}
-		{4164FE65-7AB4-45D0-8975-70465E0248A5} = {4164FE65-7AB4-45D0-8975-70465E0248A5}
-		{0A982097-4896-4F2B-81EC-43100004311D} = {0A982097-4896-4F2B-81EC-43100004311D}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Provider", "Provider\ShpProvider.vcproj", "{4164FE65-7AB4-45D0-8975-70465E0248A5}"
 	ProjectSection(ProjectDependencies) = postProject
+		{0A982097-4896-4F2B-81EC-43100004311D} = {0A982097-4896-4F2B-81EC-43100004311D}
+		{9037A345-04EB-418C-98D0-3D5B19FC9D55} = {9037A345-04EB-418C-98D0-3D5B19FC9D55}
+		{EFE86138-FF68-4ACD-8BAC-0D2A97AF0B95} = {EFE86138-FF68-4ACD-8BAC-0D2A97AF0B95}
+		{7C94A70E-9E83-4553-90B1-B47C1961EDBB} = {7C94A70E-9E83-4553-90B1-B47C1961EDBB}
 		{B1774502-83C9-41D5-BA1D-B53509DBE76D} = {B1774502-83C9-41D5-BA1D-B53509DBE76D}
-		{7C94A70E-9E83-4553-90B1-B47C1961EDBB} = {7C94A70E-9E83-4553-90B1-B47C1961EDBB}
-		{EFE86138-FF68-4ACD-8BAC-0D2A97AF0B95} = {EFE86138-FF68-4ACD-8BAC-0D2A97AF0B95}
-		{9037A345-04EB-418C-98D0-3D5B19FC9D55} = {9037A345-04EB-418C-98D0-3D5B19FC9D55}
-		{0A982097-4896-4F2B-81EC-43100004311D} = {0A982097-4896-4F2B-81EC-43100004311D}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Message", "Message\ShpMessage.vcproj", "{EFE86138-FF68-4ACD-8BAC-0D2A97AF0B95}"
@@ -28,17 +29,19 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Overrides", "Overrides\ShpOverrides.vcproj", "{0A982097-4896-4F2B-81EC-43100004311D}"
 	ProjectSection(ProjectDependencies) = postProject
+		{9037A345-04EB-418C-98D0-3D5B19FC9D55} = {9037A345-04EB-418C-98D0-3D5B19FC9D55}
 		{EFE86138-FF68-4ACD-8BAC-0D2A97AF0B95} = {EFE86138-FF68-4ACD-8BAC-0D2A97AF0B95}
-		{9037A345-04EB-418C-98D0-3D5B19FC9D55} = {9037A345-04EB-418C-98D0-3D5B19FC9D55}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SpatialIndex", "ShpSpatialIndex\ShpSpatialIndex.vcproj", "{7C94A70E-9E83-4553-90B1-B47C1961EDBB}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MgShapeOverrides", "..\Managed\project\MgShapeOverrides.vcproj", "{5BECC553-34ED-4770-A983-43E0B6540655}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MgOverrides", "..\Managed\Project\MgShapeOverrides.vcproj", "{5BECC553-34ED-4770-A983-43E0B6540655}"
 	ProjectSection(ProjectDependencies) = postProject
 		{0A982097-4896-4F2B-81EC-43100004311D} = {0A982097-4896-4F2B-81EC-43100004311D}
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCommon", "%FDOUTILITIES%\TestCommon\TestCommon.vcproj", "{31607A09-F8CA-43B3-9195-C1D5FB18E0D7}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -76,6 +79,10 @@
 		{5BECC553-34ED-4770-A983-43E0B6540655}.Debug|Win32.Build.0 = Debug|Win32
 		{5BECC553-34ED-4770-A983-43E0B6540655}.Release|Win32.ActiveCfg = Release|Win32
 		{5BECC553-34ED-4770-A983-43E0B6540655}.Release|Win32.Build.0 = Release|Win32
+		{31607A09-F8CA-43B3-9195-C1D5FB18E0D7}.Debug|Win32.ActiveCfg = Debug|Win32
+		{31607A09-F8CA-43B3-9195-C1D5FB18E0D7}.Debug|Win32.Build.0 = Debug|Win32
+		{31607A09-F8CA-43B3-9195-C1D5FB18E0D7}.Release|Win32.ActiveCfg = Release|Win32
+		{31607A09-F8CA-43B3-9195-C1D5FB18E0D7}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/BigPerformanceTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/BigPerformanceTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/BigPerformanceTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -95,7 +95,7 @@
     }
     catch (FdoException* ge)
     {
-        ShpTests::fail (ge);
+        TestCommonFail (ge);
     }
 }
 

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/ComparisonTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/ComparisonTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/ComparisonTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -104,7 +104,7 @@
     }
     catch (FdoException* ge)
     {
-        ShpTests::fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -160,7 +160,7 @@
     }
     catch (FdoException* ge)
     {
-        ShpTests::fail (ge);
+        TestCommonFail (ge);
     }
 }
 

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/ConnectTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/ConnectTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/ConnectTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -88,7 +88,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
     catch (...)
     {
@@ -111,7 +111,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
     catch (...)
     {
@@ -150,7 +150,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
     catch (...)
     {
@@ -177,7 +177,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
     catch (...)
     {
@@ -256,7 +256,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
     catch (...)
     {
@@ -291,7 +291,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -322,7 +322,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -353,7 +353,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -418,7 +418,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
     catch (...)
     {
@@ -467,7 +467,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
     catch (...)
     {
@@ -493,7 +493,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
     catch (...)
     {
@@ -542,7 +542,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
     catch (...)
     {
@@ -570,7 +570,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
     catch (...)
     {

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/DeleteTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/DeleteTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/DeleteTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -57,7 +57,7 @@
 void DeleteTests::tearDown ()
 {
     // delete the class, if its there:
-    CleanUpClass(mConnection, NULL, L"Test");
+    TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, L"Test");
 
     mConnection->Close ();
 
@@ -74,7 +74,7 @@
 void DeleteTests::create_schema (FdoGeometricType type, bool elevation, bool measure)
 {
     // delete the class, if its there:
-    CleanUpClass(mConnection, NULL, L"Test");
+    TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, L"Test");
 
     // create the class
     FdoPtr<FdoFeatureSchema> schema = FdoFeatureSchema::Create (L"TheSchema", L" test schema");
@@ -179,7 +179,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -228,7 +228,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -368,7 +368,7 @@
         FdoPtr<FdoByteArray> geomWritten1 = geometry1->GetGeometry();
         FdoPtr<FdoIGeometry> geomRead1B = agf->CreateGeometryFromFgf(geomRead1);
         FdoPtr<FdoIGeometry> geomWritten1B = agf->CreateGeometryFromFgf(geomWritten1);
-        CPPUNIT_ASSERT_MESSAGE ("wrong geometry", ShpTests::GeometriesEquivalent(geomRead1B, geomWritten1B));
+        CPPUNIT_ASSERT_MESSAGE ("wrong geometry", TestCommonGeomUtil::GeometriesEquivalent(geomRead1B, geomWritten1B));
 
         // Check feature #3  (it is #2 due to compressing and renumbering)
         CPPUNIT_ASSERT_MESSAGE ("not enough features", reader2->ReadNext ());
@@ -380,7 +380,7 @@
         FdoPtr<FdoByteArray> geomWritten3 = geometry3->GetGeometry();
         FdoPtr<FdoIGeometry> geomRead3B = agf->CreateGeometryFromFgf(geomRead3);
         FdoPtr<FdoIGeometry> geomWritten3B = agf->CreateGeometryFromFgf(geomWritten3);
-        CPPUNIT_ASSERT_MESSAGE ("wrong geometry", ShpTests::GeometriesEquivalent(geomRead3B, geomWritten3B));
+        CPPUNIT_ASSERT_MESSAGE ("wrong geometry", TestCommonGeomUtil::GeometriesEquivalent(geomRead3B, geomWritten3B));
 
         // Make sure nothing is left:
         CPPUNIT_ASSERT_MESSAGE ("still features left", !reader2->ReadNext ());
@@ -401,7 +401,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -416,7 +416,7 @@
         CPPUNIT_ASSERT_MESSAGE ("connection state not open", FdoConnectionState_Open == conn->Open ());
 
         // Delete any old data:
-        CleanUpClass(mConnection, NULL, L"ShpWithoutDbf");
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, L"ShpWithoutDbf");
 
         // Get existing schema:
         FdoPtr<FdoIDescribeSchema> descSchema = (FdoIDescribeSchema*)conn->CreateCommand(FdoCommandType_DescribeSchema);
@@ -526,6 +526,6 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/FidelityTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/FidelityTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/FidelityTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -56,7 +56,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -65,8 +65,8 @@
     try
     {
         // delete the class, if its there:
-        CleanUpClass(mConnection, NULL, L"Test");
-        CleanUpClass(mConnection, NULL, L"coundist01_n83");
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, L"Test");
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, L"coundist01_n83");
 
         mConnection->Close ();
 		FDO_SAFE_RELEASE(mConnection.p);
@@ -78,7 +78,7 @@
     }
     catch (FdoException *ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -112,7 +112,7 @@
     reference = (wchar_t*)alloca (length);
     FdoCommonOSUtil::swprintf (reference, length, format, LOCATION, separator, target_class_name, extension);
     
-    Compare (target, reference, skip);
+    TestCommonFileUtil::CompareFiles (target, reference, skip);
 }
 
 void FidelityTests::ontario ()
@@ -133,7 +133,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -155,7 +155,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -177,7 +177,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -199,7 +199,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/FileAccessTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/FileAccessTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/FileAccessTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -168,7 +168,7 @@
     try
     {
         // diff
-        Compare (GENERATED_SHX_FILE, REFERENCE_SHX_FILE);
+        TestCommonFileUtil::CompareFiles (GENERATED_SHX_FILE, REFERENCE_SHX_FILE);
     }
     catch (...)
     {
@@ -232,7 +232,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -251,7 +251,7 @@
         CPPUNIT_ASSERT_MESSAGE ("connection state not open", FdoConnectionState_Open == connection->Open ());
 
         // Clean up leftovers from previous tests:
-        CleanUpClass (connection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass (connection, NULL, NEW_CLASS_NAME);
 
         FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)connection->CreateCommand (FdoCommandType_ApplySchema);
         FdoPtr<FdoFeatureSchema> schema = FdoFeatureSchema::Create (NEW_SCHEMA_NAME, L"");
@@ -332,7 +332,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 
     // reopen, read and close the connection
@@ -366,7 +366,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 
     // OK, now delete the file

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/FilterTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/FilterTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/FilterTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -19,7 +19,6 @@
 
 #include "Pch.h"
 #include "FilterTests.h"
-#include "UnitTestUtil.h"
 
 CPPUNIT_TEST_SUITE_REGISTRATION (FilterTests);
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION (FilterTests, "FilterTests");
@@ -81,7 +80,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -115,7 +114,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -149,7 +148,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -184,7 +183,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -219,7 +218,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -265,7 +264,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -299,7 +298,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -334,7 +333,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -368,7 +367,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -402,7 +401,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -436,7 +435,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -465,7 +464,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -493,7 +492,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -540,7 +539,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -668,7 +667,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -682,27 +681,21 @@
         int         count = 0;
         FdoString*  query;
 
-#ifdef _WIN32       
-        double time1 = UnitTestUtil::GetTime_S();
-#endif
+        double time1 = TestCommonMiscUtil::GetTime_S();
 
         // This is the max featId, should return 1 row.
         query = L"FeatId = 1087";
         count = featid_roads_query( query, NUM_RUNS );
         CPPUNIT_ASSERT_MESSAGE ("P. not 2 feature selected", NUM_RUNS == count);
 
-#ifdef _WIN32
-        double time2 = UnitTestUtil::GetTime_S();
+        double time2 = TestCommonMiscUtil::GetTime_S();
         double elapsed = time2 - time1;
 
         if (VERBOSE)
 			printf("Elapsed: %lf sec\n",elapsed);
-#endif
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
-
-

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/IndexTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/IndexTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/IndexTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -301,7 +301,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -387,7 +387,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -477,7 +477,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -564,7 +564,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/InsertTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/InsertTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/InsertTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -69,9 +69,9 @@
 	mConnection->Open ();
 
     // Delete old class, if its there:
-    CleanUpClass(mConnection, NULL, L"Test");
-	CleanUpClass(mConnection, NULL, L"Test2");
-	CleanUpClass(mConnection, NULL, L"TestFdoClass");
+    TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, L"Test");
+	TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, L"Test2");
+	TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, L"TestFdoClass");
 
     mConnection->Close ();
 	FDO_SAFE_RELEASE(mConnection.p);
@@ -85,9 +85,9 @@
 void InsertTests::create_schema (FdoGeometricType type, bool elevation, bool measure)
 {
     // Delete old class, if its still there:
-    CleanUpClass(mConnection, L"TheSchema", L"Test");
-	CleanUpClass(mConnection, L"TheSchema", L"Test2");
-    CleanUpClass(mConnection, L"TheSchema", L"TestFdoClass");
+    TestCommonSchemaUtil::CleanUpClass(mConnection, L"TheSchema", L"Test");
+	TestCommonSchemaUtil::CleanUpClass(mConnection, L"TheSchema", L"Test2");
+    TestCommonSchemaUtil::CleanUpClass(mConnection, L"TheSchema", L"TestFdoClass");
 
 
     // Create the FdoFeatureClass "Test":
@@ -400,7 +400,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -523,7 +523,7 @@
    }
    catch (FdoException* ge) 
    {
-       	fail (ge);
+       	TestCommonFail (ge);
    }
 }
 
@@ -606,7 +606,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -699,7 +699,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -810,7 +810,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -921,7 +921,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1032,7 +1032,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1126,7 +1126,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1237,7 +1237,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1348,7 +1348,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1459,7 +1459,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1570,7 +1570,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1681,7 +1681,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1792,7 +1792,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1903,7 +1903,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -2014,7 +2014,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -2125,7 +2125,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -2236,7 +2236,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -2347,7 +2347,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -2458,7 +2458,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -2569,7 +2569,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -2680,7 +2680,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -2791,7 +2791,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -2913,7 +2913,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -3035,7 +3035,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -3157,7 +3157,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -3279,7 +3279,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -3372,7 +3372,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -3602,7 +3602,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -3879,7 +3879,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -3933,7 +3933,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -4452,7 +4452,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -4606,7 +4606,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -4660,7 +4660,7 @@
 	}
 	catch (FdoException* ge) 
 	{
-		fail (ge);
+		TestCommonFail (ge);
 	}
 }
 
@@ -4749,7 +4749,7 @@
 	}
 	catch (FdoException* ge) 
 	{
-		fail (ge);
+		TestCommonFail (ge);
 	}
 }
 

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/Makefile.am
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/Makefile.am	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/Makefile.am	2007-02-22 13:39:30 UTC (rev 196)
@@ -47,7 +47,6 @@
   PerformanceTests.cpp \
   UpdateTests.cpp \
   FidelityTests.cpp \
-  UnitTestUtil.cpp \
   BigPerformanceTests.cpp \
   ExtendedSelectTests.cpp
 
@@ -69,7 +68,6 @@
   DeleteTests.h \
   InsertTests.h \
   SchemaTests.h \
-  UnitTestUtil.h \
   FidelityTests.h \
   OverridesTest.h \
   SelectAggregatesTests.h \
@@ -82,6 +80,7 @@
   -I$(FDO)/Unmanaged/Inc \
   -I$(FDOTHIRDPARTY)/linux/cppunit/include \
   -I$(FDOUTILITIES)/Common/Inc \
+  -I$(FDOUTILITIES)/TestCommon/Inc \
   -I../../Inc  \
   -I../Provider
 
@@ -90,6 +89,7 @@
   ../ShpSpatialIndex/libSHPSpatialIndex.la \
   ../Overrides/libSHPOverridesSrc.la \
   $(FDOUTILITIES)/Common/libProvidersCommon.la \
+  $(FDOUTILITIES)/TestCommon/libTestCommon.la \
   $(FDOTHIRDPARTY)/linux/cppunit/lib/libcppunit.a \
   $(FDO)/Unmanaged/Src/libFDO.la \
   -lxerces-c \

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/OverridesTest.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/OverridesTest.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/OverridesTest.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -19,7 +19,6 @@
 
 #include "Pch.h"
 #include "OverridesTest.h"
-#include "UnitTestUtil.h"
 #include "XmlFormatter.h"
 #include "FdoCommonFile.h"
 #include <Fdo/Xml/SpatialContextSerializer.h>
@@ -142,7 +141,7 @@
     }
 	catch (FdoException* e) 
     {
-        fail (e);
+        TestCommonFail (e);
 	}
 }
 
@@ -187,7 +186,7 @@
     }
 	catch (FdoException* e) 
     {
-        fail (e);
+        TestCommonFail (e);
 	}
 }
 
@@ -221,18 +220,18 @@
         Stream2File(configStream, configFileName);
 
 #ifdef _WIN32
-        UnitTestUtil::CheckOutput(baseConfigFileName, configFileName);
+        TestCommonFileUtil::CompareFilesAndThrow(baseConfigFileName, configFileName);
 #else
         // throw FdoCommandException::Create(L"Test Not Supported yet on Linux");
 #endif
     }
 	catch (FdoException* e) 
     {
-        fail (e);
+        TestCommonFail (e);
 	}
 	catch (char* error) 
     {
-        fail (error);
+        TestCommonFail (error);
 	}
 }
 
@@ -264,11 +263,11 @@
     }
 	catch (FdoException* e) 
     {
-        fail (e);
+        TestCommonFail (e);
 	}
 	catch (char* error) 
     {
-        fail (error);
+        TestCommonFail (error);
 	}
 }
 
@@ -282,11 +281,11 @@
     }
 	catch (FdoException* e) 
     {
-        fail (e);
+        TestCommonFail (e);
 	}
 	catch (char* error) 
     {
-        fail (error);
+        TestCommonFail (error);
 	}
 }
 
@@ -330,7 +329,7 @@
     }
 	catch (FdoException* e) 
     {
-        fail (e);
+        TestCommonFail (e);
 	}
 }
 
@@ -371,7 +370,7 @@
     }
 	catch (FdoException* e) 
     {
-        fail (e);
+        TestCommonFail (e);
 	}
 }
 
@@ -617,7 +616,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -748,8 +747,8 @@
         conn->Open();
 
         // Clean up leftovers from previous tests:
-        CleanUpClass(conn, NULL, L"NewOntario");
-        CleanUpClass(conn, NULL, L"NewNanboku");
+        TestCommonSchemaUtil::CleanUpClass(conn, NULL, L"NewOntario");
+        TestCommonSchemaUtil::CleanUpClass(conn, NULL, L"NewNanboku");
 
 
         // Create the new classes using ApplySchema and the overrides:
@@ -791,7 +790,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/Pch.h
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/Pch.h	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/Pch.h	2007-02-22 13:39:30 UTC (rev 196)
@@ -47,6 +47,10 @@
 #include <FdoCommonMiscUtil.h>
 #include <cppunit/TestCase.h>
 #include <cppunit/extensions/HelperMacros.h>
+#include <TestCommonMiscUtil.h>
+#include <TestCommonFileUtil.h>
+#include <TestCommonGeomUtil.h>
+#include <TestCommonSchemaUtil.h>
 
 #define _CRTDBG_MAP_ALLOC
 

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/PerformanceTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/PerformanceTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/PerformanceTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -80,7 +80,7 @@
     }
     catch (FdoException* ge)
     {
-        ShpTests::fail (ge);
+        TestCommonFail (ge);
     }
 }
 

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/ReadOnlyTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/ReadOnlyTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/ReadOnlyTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -55,7 +55,7 @@
 void ReadOnlyTests::create_schema (FdoGeometricType type, bool elevation, bool measure)
 {
     // delete the class, if its there:
-    CleanUpClass (mConnection, NULL, L"Test");
+    TestCommonSchemaUtil::CleanUpClass (mConnection, NULL, L"Test");
 
     // create the class
     FdoPtr<FdoFeatureSchema> schema = FdoFeatureSchema::Create (L"TheSchema", L" test schema");
@@ -167,13 +167,13 @@
             reader->GetDouble (L"ONTARIO_ID");
             FdoPtr<FdoByteArray> geometry = reader->GetGeometry (L"Geometry");
 
-            AnalyzeGeometry( L"ontario", count, geometry, length, area);
+            TestCommonGeomUtil::PrintGeometryAnalysis( L"ontario", count, geometry, length, area, VERBOSE);
         }
         CPPUNIT_ASSERT_MESSAGE ("no ontario features selected", 0 != count);
     }
     catch (FdoException* ge)
     {
-        fail(ge);
+        TestCommonFail(ge);
     }
     catch(...)
     {

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/SchemaTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/SchemaTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/SchemaTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -77,7 +77,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -86,9 +86,9 @@
     try
     {
         // delete the classes, if they're there:
-        CleanUpClass(mConnection, NULL, L"Test");
-        CleanUpClass(mConnection, NULL, L"Test1");
-        CleanUpClass(mConnection, NULL, L"Test2");
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, L"Test");
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, L"Test1");
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, L"Test2");
 
         mConnection->Close ();
 		FDO_SAFE_RELEASE(mConnection.p);
@@ -102,7 +102,7 @@
     }
     catch (FdoException *ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -159,7 +159,7 @@
                 if ((definition->GetDescription () != NULL) && (0 != wcscmp (definition->GetDescription (), L"")))
                     printf ("            Description: %ls\n", definition->GetDescription ());
                 printf ("            Type: %ls Length: %d Precision: %d %ls\n",
-                    ShpTests::GetDataTypeString (definition->GetDataType ()),
+                    FdoCommonMiscUtil::FdoDataTypeToString (definition->GetDataType ()),
                     definition->GetLength (),
                     definition->GetPrecision (),
                     definition->GetNullable () ? L"Nullable" : L"NotNull");
@@ -180,7 +180,7 @@
                         if ((data_definition->GetDescription () != NULL) && (0 != wcscmp (data_definition->GetDescription (), L"")))
                             printf ("            Description: %ls\n", data_definition->GetDescription ());
                         printf ("            Type: %ls Length: %d Precision: %d %ls\n",
-                            ShpTests::GetDataTypeString (data_definition->GetDataType ()),
+                            FdoCommonMiscUtil::FdoDataTypeToString (data_definition->GetDataType ()),
                             data_definition->GetLength (),
                             data_definition->GetPrecision (),
                             data_definition->GetNullable () ? L"Nullable" : L"NotNull");
@@ -252,7 +252,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -278,7 +278,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -299,7 +299,7 @@
         FdoString* NEW_CLASS_NAME = L"Test";
 
         // Clean up leftovers from previous tests:
-        CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
 
         FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)mConnection->CreateCommand (FdoCommandType_ApplySchema);
         FdoPtr<FdoFeatureSchema> schema = FdoFeatureSchema::Create (NEW_SCHEMA_NAME, L"");
@@ -366,7 +366,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -379,7 +379,7 @@
         FdoString* NEW_CLASS_NAME = L"";
 
         // Clean up leftovers from previous tests:
-        CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
 
         FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)mConnection->CreateCommand (FdoCommandType_ApplySchema);
         FdoPtr<FdoFeatureSchema> schema = FdoFeatureSchema::Create (NEW_SCHEMA_NAME, L"");
@@ -446,7 +446,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -478,7 +478,7 @@
     }
     catch (FdoException* e)
     {
-        fail (e);
+        TestCommonFail (e);
     }
 }
 
@@ -500,7 +500,7 @@
     }
     catch (FdoException* e)
     {
-        fail (e);
+        TestCommonFail (e);
     }
 }
 
@@ -625,7 +625,7 @@
 {
     try
     {
-        CleanUpClass (mConnection, L"Default", L"Test");
+        TestCommonSchemaUtil::CleanUpClass (mConnection, L"Default", L"Test");
 
         FdoPtr<FdoIDescribeSchema> describe = (FdoIDescribeSchema*)mConnection->CreateCommand (FdoCommandType_DescribeSchema);
         FdoPtr<FdoFeatureSchemaCollection> schemas = describe->Execute ();
@@ -701,7 +701,7 @@
     }
     catch (FdoException* e)
     {
-        fail (e);
+        TestCommonFail (e);
     }
 }
 
@@ -714,7 +714,7 @@
         FdoString* NEW_CLASS_NAME = L"Test";
 
         // Clean up leftovers from previous tests:
-        CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
 
 
         FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)mConnection->CreateCommand (FdoCommandType_ApplySchema);
@@ -775,7 +775,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -788,7 +788,7 @@
         FdoString* NEW_CLASS_NAME = L"Test";
 
         // Clean up leftovers from previous tests:
-        CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
 
         FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)mConnection->CreateCommand (FdoCommandType_ApplySchema);
         FdoPtr<FdoFeatureSchema> schema = FdoFeatureSchema::Create (NEW_SCHEMA_NAME, L"");
@@ -845,7 +845,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -853,7 +853,7 @@
 {
     try
     {
-        CleanUpClass (mConnection, L"Default", L"Test");
+        TestCommonSchemaUtil::CleanUpClass (mConnection, L"Default", L"Test");
 
         FdoPtr<FdoIDescribeSchema> describe = (FdoIDescribeSchema*)mConnection->CreateCommand (FdoCommandType_DescribeSchema);
         FdoPtr<FdoFeatureSchemaCollection> schemas = describe->Execute ();
@@ -923,7 +923,7 @@
     }
     catch (FdoException* e)
     {
-        fail (e);
+        TestCommonFail (e);
     }
 }
 
@@ -969,7 +969,7 @@
     }
     catch (FdoException* e)
     {
-        fail (e);
+        TestCommonFail (e);
     }
 }
 
@@ -1031,7 +1031,7 @@
     }
     catch (FdoException* ge)
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1043,7 +1043,7 @@
         FdoString* NEW_CLASS_NAME = L"Test";
 
         // Clean up leftovers from previous tests:
-        CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
 
 
         FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)mConnection->CreateCommand (FdoCommandType_ApplySchema);
@@ -1123,7 +1123,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1135,7 +1135,7 @@
         FdoString* NEW_CLASS_NAME = L"T\x00E9st";
 
         // Clean up leftovers from previous tests:
-        CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
 
         FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)mConnection->CreateCommand (FdoCommandType_ApplySchema);
         FdoPtr<FdoFeatureSchema> schema = FdoFeatureSchema::Create (NEW_SCHEMA_NAME, L"");
@@ -1214,7 +1214,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1226,7 +1226,7 @@
         FdoString* NEW_CLASS_NAME = L"T\x5348\x524dst";
 
         // Clean up leftovers from previous tests:
-        CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
 
         FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)mConnection->CreateCommand (FdoCommandType_ApplySchema);
         FdoPtr<FdoFeatureSchema> schema = FdoFeatureSchema::Create (NEW_SCHEMA_NAME, L"");
@@ -1305,7 +1305,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1317,7 +1317,7 @@
         FdoString* NEW_CLASS_NAME = L"T\x5348\x524dst";
 
         // Clean up leftovers from previous tests:
-        CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
 
         FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)mConnection->CreateCommand (FdoCommandType_ApplySchema);
         FdoPtr<FdoFeatureSchema> schema = FdoFeatureSchema::Create (NEW_SCHEMA_NAME, L"");
@@ -1396,7 +1396,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1416,13 +1416,13 @@
         }
         catch (FdoException* ge)
         {
-            fail (ge);
+            TestCommonFail (ge);
         }
         FdoString* NEW_SCHEMA_NAME = L"N\x5348\x524dwSchema";
         FdoString* NEW_CLASS_NAME = L"T\x5348\x524dst";
 
         // Clean up leftovers from previous tests:
-        CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
 
         FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)mConnection->CreateCommand (FdoCommandType_ApplySchema);
         FdoPtr<FdoFeatureSchema> schema = FdoFeatureSchema::Create (NEW_SCHEMA_NAME, L"");
@@ -1510,7 +1510,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1524,7 +1524,7 @@
         FdoString* NEW_CLASS_NAME = L"TestModify";
 
         // Clean up leftovers from previous tests:
-        CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
 
 
         // Create new schema with one class :
@@ -1645,7 +1645,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1658,7 +1658,7 @@
         FdoString* NEW_CLASS_NAME = L"TestModify";
 
         // Clean up leftovers from previous tests:
-        CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
 
 
         // Create new schema with one class :
@@ -1720,7 +1720,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1773,7 +1773,7 @@
 	}
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1797,7 +1797,7 @@
 		mConnection->Open();
 
 		// Clean up leftovers from previous tests:
-        CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
 
 		//Generating default data property
 		FdoPtr<FdoDataPropertyDefinition> featid = FdoDataPropertyDefinition::Create(L"FeatId",L"Default identity property");
@@ -1930,7 +1930,7 @@
 	}
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -1981,7 +1981,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -2047,7 +2047,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -2073,7 +2073,7 @@
         FdoString* NEW_CLASS_NAME = L"Test";
 
         // Clean up leftovers from previous tests:
-        CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, NEW_CLASS_NAME);
 
 
         FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)mConnection->CreateCommand (FdoCommandType_ApplySchema);
@@ -2180,6 +2180,6 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/SelectAggregatesTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/SelectAggregatesTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/SelectAggregatesTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -56,7 +56,7 @@
 void SelectAggregatesTests::tearDown ()
 {
     // Delete old class, if its there:
-    CleanUpClass (mConnection, NULL, L"MyClass");
+    TestCommonSchemaUtil::CleanUpClass (mConnection, NULL, L"MyClass");
 
     mConnection->Close ();
 	FDO_SAFE_RELEASE(mConnection.p);
@@ -117,7 +117,7 @@
     }
     catch (FdoException* e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -162,7 +162,7 @@
     }
     catch (FdoException* e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -180,7 +180,7 @@
         FdoString *schemaName = L"MySchema";
 
         create_schema(schemaName, className, FdoGeometricType_Curve, false, false, true);
-        CleanUpClass(mConnection, schemaName, className, true);
+        TestCommonSchemaUtil::CleanUpClass(mConnection, schemaName, className, true);
 
 
         //////////////////////////////////////////////////////////////////////
@@ -301,10 +301,29 @@
         CPPUNIT_ASSERT_MESSAGE("Expected 1 aggregate result", !datareader->ReadNext ());
         datareader->Close();
         datareader = NULL;
+
+
+        //////////////////////////////////////////////////////////////////////
+        // Try sum with filter
+        //////////////////////////////////////////////////////////////////////
+
+        select = (FdoISelectAggregates*)mConnection->CreateCommand (FdoCommandType_SelectAggregates);
+        select->SetFeatureClassName (className);
+        select->SetDistinct(false);
+        selectedIds = select->GetPropertyNames();
+        selectedIds->Clear();
+        selectedIds->Add(FdoPtr<FdoComputedIdentifier>(FdoComputedIdentifier::Create(L"SumWithFilter", FdoPtr<FdoExpression>(FdoExpression::Parse(L"Sum(HeadCount)")))));
+        select->SetFilter(L"Street > 'B'");
+        datareader = select->Execute ();
+        CPPUNIT_ASSERT_MESSAGE("Expected 1 aggregate result", datareader->ReadNext ());
+        CPPUNIT_ASSERT_MESSAGE("Didn't get expected aggregate result", datareader->GetDouble(L"SumWithFilter")==12);
+        CPPUNIT_ASSERT_MESSAGE("Expected 1 aggregate result", !datareader->ReadNext ());
+        datareader->Close();
+        datareader = NULL;
     }
     catch (FdoException* e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -312,7 +331,7 @@
 void SelectAggregatesTests::create_schema (FdoString *schemaName, FdoString* className, FdoGeometricType type, bool elevation, bool measure, bool bInsertTestData)
 {
     // Clean up leftover class, if any:
-    CleanUpClass(mConnection, NULL, className);
+    TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, className);
 
     //////////////////////////////////////////////////////////////////////
     // Create the schema:
@@ -345,26 +364,39 @@
     date->SetDataType (FdoDataType_DateTime);
 
     // build a location geometry property
-    FdoPtr<FdoGeometricPropertyDefinition> location = FdoGeometricPropertyDefinition::Create (L"Geometry", L"geometry");
-    location->SetGeometryTypes (type);
-    location->SetHasElevation (elevation);
-    location->SetHasMeasure (measure);
+    FdoPtr<FdoGeometricPropertyDefinition> location;
+    if (type != -1)
+    {
+        location = FdoGeometricPropertyDefinition::Create (L"Geometry", L"geometry");
+        location->SetGeometryTypes (type);
+        location->SetHasElevation (elevation);
+        location->SetHasMeasure (measure);
+    }
 
-    //// assemble the feature class
-    FdoPtr<FdoFeatureClass> feature = FdoFeatureClass::Create (className, L"test class created with apply schema");
-    FdoPtr<FdoPropertyDefinitionCollection> properties = feature->GetProperties ();
-    FdoPtr<FdoDataPropertyDefinitionCollection> identities = feature->GetIdentityProperties ();
+    //// assemble the class
+    FdoPtr<FdoClassDefinition> classDef;
+    if (type != -1)
+        classDef = FdoFeatureClass::Create (className, L"test feature class created with apply schema");
+    else
+        classDef = FdoClass::Create(className, L"test non-feature class created with apply schema");
+    FdoPtr<FdoPropertyDefinitionCollection> properties = classDef->GetProperties ();
+    FdoPtr<FdoDataPropertyDefinitionCollection> identities = classDef->GetIdentityProperties ();
     properties->Add (featid);
     identities->Add (featid);
     properties->Add (street);
     properties->Add (date);
     properties->Add (lotsize);
     properties->Add (headcount);
-    properties->Add (location);
-    feature->SetGeometryProperty (location);
+    if (type != -1)
+    {
+        properties->Add (location);
+        FdoFeatureClass *featureClassDef = (FdoFeatureClass*)classDef.p;
+        featureClassDef->SetGeometryProperty (location);
+    }
+    classes->Add (classDef);
 
+
     // submit the new schema
-    classes->Add (feature);
     FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)mConnection->CreateCommand (FdoCommandType_ApplySchema);
     apply->SetFeatureSchema (schema);
     apply->Execute ();
@@ -390,9 +422,12 @@
         expr = FdoExpression::Parse(L"DATE '1999-12-31'");
         propVal = FdoPropertyValue::Create(L"Date", (FdoValueExpression*)expr.p);
         propVals->Add(propVal);
-        expr = FdoExpression::Parse(L"GEOMFROMTEXT('LINESTRING XY (1.0 1.0, 2.0 2.0, 1.0 3.0)')");
-        propVal = FdoPropertyValue::Create(L"Geometry", (FdoValueExpression*)expr.p);
-        propVals->Add(propVal);
+        if (type != -1)
+        {
+            expr = FdoExpression::Parse(L"GEOMFROMTEXT('LINESTRING XY (1.0 1.0, 2.0 2.0, 1.0 3.0)')");
+            propVal = FdoPropertyValue::Create(L"Geometry", (FdoValueExpression*)expr.p);
+            propVals->Add(propVal);
+        }
         expr = ShpTests::ParseByDataType(L"5", FdoDataType_Decimal);
         propVal = FdoPropertyValue::Create(L"HeadCount", (FdoValueExpression*)expr.p);
         propVals->Add(propVal);
@@ -408,9 +443,12 @@
         expr = FdoExpression::Parse(L"DATE '2003-05-21'");
         propVal = FdoPropertyValue::Create(L"Date", (FdoValueExpression*)expr.p);
         propVals->Add(propVal);
-        expr = FdoExpression::Parse(L"GEOMFROMTEXT('LINESTRING XY (10.0 10.0, 20.0 20.0, 10.0 30.0)')");
-        propVal = FdoPropertyValue::Create(L"Geometry", (FdoValueExpression*)expr.p);
-        propVals->Add(propVal);
+        if (type != -1)
+        {
+            expr = FdoExpression::Parse(L"GEOMFROMTEXT('LINESTRING XY (10.0 10.0, 20.0 20.0, 10.0 30.0)')");
+            propVal = FdoPropertyValue::Create(L"Geometry", (FdoValueExpression*)expr.p);
+            propVals->Add(propVal);
+        }
         expr = ShpTests::ParseByDataType(L"3", FdoDataType_Decimal);
         propVal = FdoPropertyValue::Create(L"HeadCount", (FdoValueExpression*)expr.p);
         propVals->Add(propVal);
@@ -426,9 +464,12 @@
         expr = FdoExpression::Parse(L"DATE '2003-05-21'");
         propVal = FdoPropertyValue::Create(L"Date", (FdoValueExpression*)expr.p);
         propVals->Add(propVal);
-        expr = FdoExpression::Parse(L"GEOMFROMTEXT('LINESTRING XY (3.0 3.0, 4.0 4.0, 5.0 5.0)')");
-        propVal = FdoPropertyValue::Create(L"Geometry", (FdoValueExpression*)expr.p);
-        propVals->Add(propVal);
+        if (type != -1)
+        {
+            expr = FdoExpression::Parse(L"GEOMFROMTEXT('LINESTRING XY (3.0 3.0, 4.0 4.0, 5.0 5.0)')");
+            propVal = FdoPropertyValue::Create(L"Geometry", (FdoValueExpression*)expr.p);
+            propVals->Add(propVal);
+        }
         expr = ShpTests::ParseByDataType(L"4", FdoDataType_Decimal);
         propVal = FdoPropertyValue::Create(L"HeadCount", (FdoValueExpression*)expr.p);
         propVals->Add(propVal);
@@ -444,9 +485,12 @@
         expr = FdoExpression::Parse(L"DATE '2003-05-21'");
         propVal = FdoPropertyValue::Create(L"Date", (FdoValueExpression*)expr.p);
         propVals->Add(propVal);
-        expr = FdoExpression::Parse(L"GEOMFROMTEXT('LINESTRING XY (1.0 1.0, -2.0 -2.0, -1.0 -3.0)')");
-        propVal = FdoPropertyValue::Create(L"Geometry", (FdoValueExpression*)expr.p);
-        propVals->Add(propVal);
+        if (type != -1)
+        {
+            expr = FdoExpression::Parse(L"GEOMFROMTEXT('LINESTRING XY (1.0 1.0, -2.0 -2.0, -1.0 -3.0)')");
+            propVal = FdoPropertyValue::Create(L"Geometry", (FdoValueExpression*)expr.p);
+            propVals->Add(propVal);
+        }
         expr = ShpTests::ParseByDataType(L"7", FdoDataType_Decimal);
         propVal = FdoPropertyValue::Create(L"HeadCount", (FdoValueExpression*)expr.p);
         propVals->Add(propVal);
@@ -505,7 +549,7 @@
     }
     catch (FdoException* e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -547,232 +591,10 @@
     }
     catch (FdoException* e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
-void SelectAggregatesTests::ceil_floor ()
-{
-    try
-    {
-        //////////////////////////////////////////////////////////////////////
-        // Create a SHP file:
-        //////////////////////////////////////////////////////////////////////
-
-        FdoString *className  = L"MyClass";
-        FdoString *schemaName = L"MySchema";
-
-        create_schema(schemaName, className, FdoGeometricType_Curve, false, false, true);
-
-
-        //////////////////////////////////////////////////////////////////////
-        // Try numerical function ceil():
-        //////////////////////////////////////////////////////////////////////
-
-        FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select);
-
-        select->SetFeatureClassName (className);
-        FdoPtr<FdoIdentifierCollection> selectedIds = select->GetPropertyNames();
-        selectedIds->Clear();
-
-        FdoPtr<FdoComputedIdentifier> cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Ceil(LotSize)) AS TestCeil");
-		selectedIds->Add(cid);
-
-		FdoPtr<FdoIReader> datareader = select->Execute ();
-
-		// [2702.7, 10000]
-        long count = 0;
-        while (datareader->ReadNext ())
-        {
-            double result = datareader->GetDouble(L"TestCeil");
-            CPPUNIT_ASSERT_MESSAGE("Ceil wrong", result >= 2703 && result <= 10000);
-            count++;
-        }
-        CPPUNIT_ASSERT_MESSAGE("Wrong count(*) rowcount", count==4);
-        datareader->Close();
-        datareader = NULL;
-
-        //////////////////////////////////////////////////////////////////////
-        // Try numerical function floor():
-        //////////////////////////////////////////////////////////////////////
-        selectedIds = select->GetPropertyNames();
-        selectedIds->Clear();
-
-        cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Floor(LotSize)) AS TestFloor");
-		selectedIds->Add(cid);
-
-		datareader = select->Execute ();
-
-		// [2702.7, 10000]
-        count = 0;
-        while (datareader->ReadNext ())
-        {
-            double result = datareader->GetDouble(L"TestFloor");
-            CPPUNIT_ASSERT_MESSAGE("Floor wrong",  result >= 2702 && result <= 10000);
-            count++;
-        }
-        CPPUNIT_ASSERT_MESSAGE("Wrong count(*) rowcount", count==4);
-        datareader->Close();
-        datareader = NULL;
-
-        //////////////////////////////////////////////////////////////////////
-        // Try numerical function floor() with Int32:
-        //////////////////////////////////////////////////////////////////////
-        selectedIds->Clear();
-
-        cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Floor(FeatId)) AS TestFloor");
-		selectedIds->Add(cid);
-
-		datareader = select->Execute ();
-
-        count = 0;
-        while (datareader->ReadNext ())
-        {
-            double result = datareader->GetDouble(L"TestFloor");
-            CPPUNIT_ASSERT_MESSAGE("Floor(FeatId) wrong",  result >= 1 && result <= 4);
-            count++;
-        }
-        CPPUNIT_ASSERT_MESSAGE("Wrong count(*) rowcount", count==4);
-        datareader->Close();
-        datareader = NULL;
-
-        //////////////////////////////////////////////////////////////////////
-        // Try some wrong datatypes:
-        //////////////////////////////////////////////////////////////////////
-
-		bool error = false;
-		try
-		{
-			selectedIds->Clear();
-
-			FdoPtr<FdoComputedIdentifier> cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Ceil(Street)) AS TestCeil");
-			selectedIds->Add(cid);
-
-			datareader = select->Execute ();
-			while (datareader->ReadNext ())
-			{
-				double result = datareader->GetDouble(L"TestCeil");
-			}
-		}
-		catch (FdoException* e)
-		{
-			//printf("Expected: %ls\n", e->GetExceptionMessage());
-			e->Release();
-			error = true;
-		}
-		datareader->Close();
-		datareader = NULL;
-
-		CPPUNIT_ASSERT_MESSAGE("Ceil succeeded with wrong datatype", error == true );
-    }
-    catch (FdoException* e)
-    {
-        fail(e);
-    }
-}
-
-void SelectAggregatesTests::upper_lower ()
-{
-    try
-    {
-        //////////////////////////////////////////////////////////////////////
-        // Create a SHP file:
-        //////////////////////////////////////////////////////////////////////
-
-        FdoString *className  = L"MyClass";
-        FdoString *schemaName = L"MySchema";
-
-        create_schema(schemaName, className, FdoGeometricType_Curve, false, false, true);
-
-        //////////////////////////////////////////////////////////////////////
-        // Try numerical function upper():
-        //////////////////////////////////////////////////////////////////////
-
-        FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select);
-        select->SetFeatureClassName (className);
-        FdoPtr<FdoIdentifierCollection> selectedIds = select->GetPropertyNames();
-        selectedIds->Clear();
-
-        FdoPtr<FdoComputedIdentifier> cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Upper(Street)) AS TestUpper");
-		selectedIds->Add(cid);
-
-		FdoPtr<FdoIReader>  datareader = select->Execute ();
-
-        long count = 0;
-        while (datareader->ReadNext ())
-        {
-            FdoString *street = datareader->GetString(L"TestUpper");
-            CPPUNIT_ASSERT_MESSAGE("Upper wrong",          
-				(0==wcscmp(street, L"SLATER")) || (0==wcscmp(street, L"ALBERT")) || (0==wcscmp(street, L"QUEEN")) );
-
-            count++;
-        }
-        CPPUNIT_ASSERT_MESSAGE("Wrong count(*) rowcount", count==4);
-        datareader->Close();
-        datareader = NULL;
-
-
-        //////////////////////////////////////////////////////////////////////
-        // Try numerical function lower():
-        //////////////////////////////////////////////////////////////////////
-        selectedIds = select->GetPropertyNames();
-        selectedIds->Clear();
-
-        cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Lower(Street)) AS TestLower");
-
-		selectedIds->Add(cid);
-
-		datareader = select->Execute ();
-
-        count = 0;
-        while (datareader->ReadNext ())
-        {
-            FdoString *street = datareader->GetString(L"TestLower");
-            CPPUNIT_ASSERT_MESSAGE("Lower wrong",          
-				(0==wcscmp(street, L"slater")) || (0==wcscmp(street, L"albert")) || (0==wcscmp(street, L"queen")) );
-
-            count++;
-        }
-        CPPUNIT_ASSERT_MESSAGE("Wrong count(*) rowcount", count==4);
-        datareader->Close();
-        datareader = NULL;
-
-        //////////////////////////////////////////////////////////////////////
-        // Try some wrong datatypes:
-        //////////////////////////////////////////////////////////////////////
-
-		bool error = false;
-		try
-		{
-			selectedIds->Clear();
-
-			FdoPtr<FdoComputedIdentifier> cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Upper(LotSize)) AS TestUpper");
-
-			selectedIds->Add(cid);
-
-			datareader = select->Execute ();
-			while (datareader->ReadNext ())
-			{
-				double result = datareader->GetDouble(L"TestUpper");
-			}
-		}
-		catch (FdoException* e)
-		{
-			//printf("Expected: %ls\n", e->GetExceptionMessage());
-			e->Release();
-			error = true;
-		}
-		datareader->Close();
-		datareader = NULL;
-
-		CPPUNIT_ASSERT_MESSAGE("Upper succeeded with wrong datatype", error == true );
-    }
-    catch (FdoException* e)
-    {
-        fail(e);
-    }
-}
-
 void SelectAggregatesTests::select_orderby_decimal ()
 {
     try
@@ -818,7 +640,7 @@
     }
     catch (FdoException* e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -882,7 +704,7 @@
     }
     catch (FdoException* e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -939,7 +761,7 @@
     }
     catch (FdoException* e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -1208,7 +1030,7 @@
 		}
 	catch (FdoException* e)
 	{
-		fail(e);
+		TestCommonFail(e);
 	}
 
 }
@@ -1348,6 +1170,51 @@
     }
     catch (FdoException* e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
+
+
+void SelectAggregatesTests::select_aggregates_fdoclass()
+{
+    try
+    {
+        //////////////////////////////////////////////////////////////////////
+        // Create a SHP file:
+        //////////////////////////////////////////////////////////////////////
+
+        FdoString *className  = L"MyClass";
+        FdoString *schemaName = L"MySchema";
+
+        create_schema(schemaName, className, (FdoGeometricType)-1, false, false, true);
+
+
+        //////////////////////////////////////////////////////////////////////
+        // Select some data via aggregate sum:
+        //////////////////////////////////////////////////////////////////////
+
+        FdoPtr<FdoISelectAggregates> select = (FdoISelectAggregates*)mConnection->CreateCommand (FdoCommandType_SelectAggregates);
+        select->SetFeatureClassName (className);
+        select->SetDistinct(false);
+        FdoPtr<FdoIdentifierCollection> selectedIds = select->GetPropertyNames();
+        selectedIds->Clear();
+        selectedIds->Add(FdoPtr<FdoComputedIdentifier>(FdoComputedIdentifier::Create(L"HeadTally", FdoPtr<FdoExpression>(FdoExpression::Parse(L"Max(HeadCount)")))));
+        FdoPtr<FdoIDataReader> datareader = select->Execute ();
+        long count = 0;
+        FdoInt32 headcounttally = 0;
+        while (datareader->ReadNext ())
+        {
+            headcounttally = (FdoInt32)datareader->GetDouble(L"HeadTally");
+            count++;
+        }
+        CPPUNIT_ASSERT_MESSAGE("Wrong sum rowcount", count==1);
+        CPPUNIT_ASSERT_MESSAGE("Wrong headcount sum", headcounttally==7);
+        datareader->Close();
+        datareader = NULL;
+    }
+    catch (FdoException* e)
+    {
+        TestCommonFail(e);
+    }
+}
+

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/SelectAggregatesTests.h
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/SelectAggregatesTests.h	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/SelectAggregatesTests.h	2007-02-22 13:39:30 UTC (rev 196)
@@ -33,13 +33,12 @@
     CPPUNIT_TEST (select_aggregates_null);
     CPPUNIT_TEST (select_orderby);
     CPPUNIT_TEST (count);
-	CPPUNIT_TEST (ceil_floor);
-	CPPUNIT_TEST (upper_lower);
     CPPUNIT_TEST (select_orderby_decimal);
     CPPUNIT_TEST (select_orderby_scrambled_property_ids);
     CPPUNIT_TEST (select_orderby_empty_select_list);
     CPPUNIT_TEST (selectAggregatesSpatialExtentsTest);
 	CPPUNIT_TEST (performance_count_mbr);
+    CPPUNIT_TEST (select_aggregates_fdoclass);
     CPPUNIT_TEST_SUITE_END ();
 
     static FdoPtr<FdoIConnection> mConnection;
@@ -56,13 +55,12 @@
     void select_aggregates_null ();
     void select_orderby();
     void count ();
-	void ceil_floor ();
-	void upper_lower();
     void select_orderby_decimal ();
     void select_orderby_scrambled_property_ids();
     void select_orderby_empty_select_list();
     void selectAggregatesSpatialExtentsTest();  // This test is ported from SDF Provider
 	void performance_count_mbr ();
+    void select_aggregates_fdoclass();
 
     // utility methods:
     void create_schema (FdoString *schemaName, FdoString* className, FdoGeometricType type, bool elevation, bool measure, bool bInsertTestData);

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/SelectTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/SelectTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/SelectTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -53,6 +53,183 @@
 	FDO_SAFE_RELEASE(mConnection.p);
 }
 
+void SelectTests::create_schema (FdoString *schemaName, FdoString* className, FdoGeometricType type, bool elevation, bool measure, bool bInsertTestData, bool bUseDoubleType)
+{
+    // Clean up leftover class, if any:
+    TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, className);
+
+    //////////////////////////////////////////////////////////////////////
+    // Create the schema:
+    //////////////////////////////////////////////////////////////////////
+
+    FdoDataType dDecimalDataType = bUseDoubleType ? FdoDataType_Double : FdoDataType_Decimal;
+
+    // create the class
+    FdoPtr<FdoFeatureSchema> schema = FdoFeatureSchema::Create (schemaName, L" test schema");
+    FdoPtr<FdoClassCollection> classes = schema->GetClasses ();
+
+    FdoPtr<FdoDataPropertyDefinition> featid = FdoDataPropertyDefinition::Create (L"FeatId", L"integer");
+    featid->SetDataType (FdoDataType_Int32);
+    featid->SetIsAutoGenerated (true);
+    featid->SetNullable (false);
+
+    FdoPtr<FdoDataPropertyDefinition> street = FdoDataPropertyDefinition::Create (L"Street", L"text");
+    street->SetDataType (FdoDataType_String);
+    street->SetLength (64);
+
+    FdoPtr<FdoDataPropertyDefinition> lotsize = FdoDataPropertyDefinition::Create (L"LotSize", L"size");
+    lotsize->SetDataType (dDecimalDataType);
+    lotsize->SetPrecision (20);
+    lotsize->SetScale (8);
+
+    FdoPtr<FdoDataPropertyDefinition> headcount = FdoDataPropertyDefinition::Create (L"HeadCount", L"size");
+    headcount->SetDataType (dDecimalDataType);
+    headcount->SetPrecision(10);
+    headcount->SetScale(0);
+
+    FdoPtr<FdoDataPropertyDefinition> date = FdoDataPropertyDefinition::Create (L"Date", L"date");
+    date->SetDataType (FdoDataType_DateTime);
+
+    // build a location geometry property
+    FdoPtr<FdoGeometricPropertyDefinition> location;
+    if (type != -1)
+    {
+        location = FdoGeometricPropertyDefinition::Create (L"Geometry", L"geometry");
+        location->SetGeometryTypes (type);
+        location->SetHasElevation (elevation);
+        location->SetHasMeasure (measure);
+    }
+
+    //// assemble the class
+    FdoPtr<FdoClassDefinition> classDef;
+    if (type != -1)
+        classDef = FdoFeatureClass::Create (className, L"test feature class created with apply schema");
+    else
+        classDef = FdoClass::Create(className, L"test non-feature class created with apply schema");
+    FdoPtr<FdoPropertyDefinitionCollection> properties = classDef->GetProperties ();
+    FdoPtr<FdoDataPropertyDefinitionCollection> identities = classDef->GetIdentityProperties ();
+    properties->Add (featid);
+    identities->Add (featid);
+    properties->Add (street);
+    properties->Add (date);
+    properties->Add (lotsize);
+    properties->Add (headcount);
+    if (type != -1)
+    {
+        properties->Add (location);
+        FdoFeatureClass *featureClassDef = (FdoFeatureClass*)classDef.p;
+        featureClassDef->SetGeometryProperty (location);
+    }
+    classes->Add (classDef);
+
+
+    // submit the new schema
+    FdoPtr<FdoIApplySchema> apply = (FdoIApplySchema*)mConnection->CreateCommand (FdoCommandType_ApplySchema);
+    apply->SetFeatureSchema (schema);
+    apply->Execute ();
+
+
+    //////////////////////////////////////////////////////////////////////
+    // Insert some test data (with redundant values):
+    //////////////////////////////////////////////////////////////////////
+
+    if (bInsertTestData)
+    {
+        FdoPtr<FdoIInsert> insert = (FdoIInsert*)mConnection->CreateCommand(FdoCommandType_Insert);
+        insert->SetFeatureClassName(className);
+        FdoPtr<FdoPropertyValueCollection> propVals = insert->GetPropertyValues();
+        FdoPtr<FdoPropertyValue> propVal;
+        FdoPtr<FdoIFeatureReader> reader;
+        FdoPtr<FdoExpression> expr;
+
+        propVals->Clear();
+        expr = FdoExpression::Parse(L"'Slater'");
+        propVal = FdoPropertyValue::Create(L"Street", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        expr = FdoExpression::Parse(L"DATE '1999-12-31'");
+        propVal = FdoPropertyValue::Create(L"Date", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        if (type != -1)
+        {
+            expr = FdoExpression::Parse(L"GEOMFROMTEXT('LINESTRING XY (1.0 1.0, 2.0 2.0, 1.0 3.0)')");
+            propVal = FdoPropertyValue::Create(L"Geometry", (FdoValueExpression*)expr.p);
+            propVals->Add(propVal);
+        }
+        expr = ShpTests::ParseByDataType(L"5", dDecimalDataType);
+        propVal = FdoPropertyValue::Create(L"HeadCount", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        expr = ShpTests::ParseByDataType(L"7500.1", bUseDoubleType ? FdoDataType_Double : FdoDataType_Decimal);
+        propVal = FdoPropertyValue::Create(L"LotSize", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        reader = insert->Execute();
+
+        propVals->Clear();
+        expr = FdoExpression::Parse(L"'Slater'");
+        propVal = FdoPropertyValue::Create(L"Street", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        expr = FdoExpression::Parse(L"DATE '2003-05-21'");
+        propVal = FdoPropertyValue::Create(L"Date", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        if (type != -1)
+        {
+            expr = FdoExpression::Parse(L"GEOMFROMTEXT('LINESTRING XY (10.0 10.0, 20.0 20.0, 10.0 30.0)')");
+            propVal = FdoPropertyValue::Create(L"Geometry", (FdoValueExpression*)expr.p);
+            propVals->Add(propVal);
+        }
+        expr = ShpTests::ParseByDataType(L"3", bUseDoubleType ? FdoDataType_Double : FdoDataType_Decimal);
+        propVal = FdoPropertyValue::Create(L"HeadCount", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        expr = ShpTests::ParseByDataType(L"5500.5", bUseDoubleType ? FdoDataType_Double : FdoDataType_Decimal);
+        propVal = FdoPropertyValue::Create(L"LotSize", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        reader = insert->Execute();
+
+        propVals->Clear();
+        expr = FdoExpression::Parse(L"'Albert'");
+        propVal = FdoPropertyValue::Create(L"Street", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        expr = FdoExpression::Parse(L"DATE '2003-05-21'");
+        propVal = FdoPropertyValue::Create(L"Date", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        if (type != -1)
+        {
+            expr = FdoExpression::Parse(L"GEOMFROMTEXT('LINESTRING XY (3.0 3.0, 4.0 4.0, 5.0 5.0)')");
+            propVal = FdoPropertyValue::Create(L"Geometry", (FdoValueExpression*)expr.p);
+            propVals->Add(propVal);
+        }
+        expr = ShpTests::ParseByDataType(L"4", bUseDoubleType ? FdoDataType_Double : FdoDataType_Decimal);
+        propVal = FdoPropertyValue::Create(L"HeadCount", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        expr = ShpTests::ParseByDataType(L"10000.0", bUseDoubleType ? FdoDataType_Double : FdoDataType_Decimal);
+        propVal = FdoPropertyValue::Create(L"LotSize", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        reader = insert->Execute();
+
+        propVals->Clear();
+        expr = FdoExpression::Parse(L"'Queen'");
+        propVal = FdoPropertyValue::Create(L"Street", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        expr = FdoExpression::Parse(L"DATE '2003-05-21'");
+        propVal = FdoPropertyValue::Create(L"Date", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        if (type != -1)
+        {
+            expr = FdoExpression::Parse(L"GEOMFROMTEXT('LINESTRING XY (1.0 1.0, -2.0 -2.0, -1.0 -3.0)')");
+            propVal = FdoPropertyValue::Create(L"Geometry", (FdoValueExpression*)expr.p);
+            propVals->Add(propVal);
+        }
+        expr = ShpTests::ParseByDataType(L"7", bUseDoubleType ? FdoDataType_Double : FdoDataType_Decimal);
+        propVal = FdoPropertyValue::Create(L"HeadCount", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        expr = ShpTests::ParseByDataType(L"2702.7", bUseDoubleType ? FdoDataType_Double : FdoDataType_Decimal);
+        propVal = FdoPropertyValue::Create(L"LotSize", (FdoValueExpression*)expr.p);
+        propVals->Add(propVal);
+        reader = insert->Execute();
+    }
+}
+
+
+
 void SelectTests::select ()
 {
     double  area;
@@ -75,7 +252,7 @@
             reader->GetDouble (L"ONTARIO_ID");
             FdoPtr<FdoByteArray> geometry = reader->GetGeometry (L"Geometry");
 
-            AnalyzeGeometry( L"ontario", count, geometry, length, area);
+            TestCommonGeomUtil::PrintGeometryAnalysis( L"ontario", count, geometry, length, area, VERBOSE);
         }
         CPPUNIT_ASSERT_MESSAGE ("no ontario features selected", 0 != count);
 
@@ -97,7 +274,7 @@
             reader->GetString (L"FCODE");
             FdoPtr<FdoByteArray> geometry = reader->GetGeometry (L"Geometry");
 
-            AnalyzeGeometry( L"ontario", count, geometry, length, area);
+            TestCommonGeomUtil::PrintGeometryAnalysis( L"ontario", count, geometry, length, area, VERBOSE);
         }
         CPPUNIT_ASSERT_MESSAGE ("no roads features selected", 0 != count);
 
@@ -116,13 +293,13 @@
                 reader->GetString (L"HOTLINK");
             FdoPtr<FdoByteArray> geometry = reader->GetGeometry (L"Geometry");
 
-            AnalyzeGeometry( L"ontario", count, geometry, length, area);
+            TestCommonGeomUtil::PrintGeometryAnalysis( L"ontario", count, geometry, length, area, VERBOSE);
         }
         CPPUNIT_ASSERT_MESSAGE ("no lakes features selected", 0 != count);
     }
     catch (FdoException* ge)
     {
-        fail(ge);
+        TestCommonFail(ge);
     }
     catch (CppUnit::Exception error)
     {
@@ -245,7 +422,7 @@
     }
     catch (FdoException* ge)
     {
-        fail(ge);
+        TestCommonFail(ge);
     }
     catch (CppUnit::Exception error)
     {
@@ -259,26 +436,33 @@
 
 void SelectTests::get_class_definition ()
 {
-    FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select);
-    select->SetFeatureClassName (L"ontario");
-    FdoPtr<FdoIFeatureReader> reader = select->Execute ();
-    reader->ReadNext ();
-    FdoPtr<FdoClassDefinition> definition = reader->GetClassDefinition ();
-    CPPUNIT_ASSERT_MESSAGE ("wrong class type", FdoClassType_FeatureClass == definition->GetClassType ());
-    CPPUNIT_ASSERT_MESSAGE ("wrong class name", 0 == wcscmp (L"ontario", definition->GetName ()));
-    FdoPtr<FdoClassCapabilities> caps = definition->GetCapabilities ();
-    CPPUNIT_ASSERT_MESSAGE ("supports locking?", !caps->SupportsLocking ());
-    CPPUNIT_ASSERT_MESSAGE ("supports long transactions?", !caps->SupportsLongTransactions ());
-    FdoPtr<FdoDataPropertyDefinitionCollection> identities = definition->GetIdentityProperties ();
-    CPPUNIT_ASSERT_MESSAGE ("too many id properties", 1 == identities->GetCount ());
-    FdoPtr<FdoDataPropertyDefinition> id = identities->GetItem (0);
-    CPPUNIT_ASSERT_MESSAGE ("id property wrong name", 0 == wcscmp (L"FeatId", id->GetName ()));
-    CPPUNIT_ASSERT_MESSAGE ("id property wrong type", FdoDataType_Int32 == id->GetDataType ());
-    CPPUNIT_ASSERT_MESSAGE ("id property is null", !reader->IsNull (id->GetName ()));
-    // ToDo: check regular properties...
-    FdoPtr<FdoGeometricPropertyDefinition> geometry = ((FdoFeatureClass*)(definition.p))->GetGeometryProperty ();
-    CPPUNIT_ASSERT_MESSAGE ("geometry property wrong name", 0 == wcscmp (L"Geometry", geometry->GetName ()));
-    CPPUNIT_ASSERT_MESSAGE ("geometry property wrong types", FdoGeometricType_Surface == geometry->GetGeometryTypes ());
+    try
+    {
+        FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select);
+        select->SetFeatureClassName (L"ontario");
+        FdoPtr<FdoIFeatureReader> reader = select->Execute ();
+        reader->ReadNext ();
+        FdoPtr<FdoClassDefinition> definition = reader->GetClassDefinition ();
+        CPPUNIT_ASSERT_MESSAGE ("wrong class type", FdoClassType_FeatureClass == definition->GetClassType ());
+        CPPUNIT_ASSERT_MESSAGE ("wrong class name", 0 == wcscmp (L"ontario", definition->GetName ()));
+        FdoPtr<FdoClassCapabilities> caps = definition->GetCapabilities ();
+        CPPUNIT_ASSERT_MESSAGE ("supports locking?", !caps->SupportsLocking ());
+        CPPUNIT_ASSERT_MESSAGE ("supports long transactions?", !caps->SupportsLongTransactions ());
+        FdoPtr<FdoDataPropertyDefinitionCollection> identities = definition->GetIdentityProperties ();
+        CPPUNIT_ASSERT_MESSAGE ("too many id properties", 1 == identities->GetCount ());
+        FdoPtr<FdoDataPropertyDefinition> id = identities->GetItem (0);
+        CPPUNIT_ASSERT_MESSAGE ("id property wrong name", 0 == wcscmp (L"FeatId", id->GetName ()));
+        CPPUNIT_ASSERT_MESSAGE ("id property wrong type", FdoDataType_Int32 == id->GetDataType ());
+        CPPUNIT_ASSERT_MESSAGE ("id property is null", !reader->IsNull (id->GetName ()));
+        // ToDo: check regular properties...
+        FdoPtr<FdoGeometricPropertyDefinition> geometry = ((FdoFeatureClass*)(definition.p))->GetGeometryProperty ();
+        CPPUNIT_ASSERT_MESSAGE ("geometry property wrong name", 0 == wcscmp (L"Geometry", geometry->GetName ()));
+        CPPUNIT_ASSERT_MESSAGE ("geometry property wrong types", FdoGeometricType_Surface == geometry->GetGeometryTypes ());
+    }
+    catch (FdoException* ge)
+    {
+        TestCommonFail(ge);
+    }
 }
 
 void SelectTests::requery ()
@@ -303,38 +487,45 @@
     }
     catch (FdoException* ge)
     {
-        fail(ge);
+        TestCommonFail(ge);
     }
 }
 
 void SelectTests::select_subset ()
 {
-    FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select);
-    select->SetFeatureClassName (L"ontario");
-    FdoPtr <FdoIdentifierCollection> ids = select->GetPropertyNames ();
-    FdoPtr <FdoIdentifier> id = FdoIdentifier::Create (L"PERIMETER");
-    ids->Add (id);
-    FdoPtr<FdoIFeatureReader> reader = select->Execute ();
-    reader->ReadNext ();
-    FdoPtr<FdoClassDefinition> definition = reader->GetClassDefinition ();
-    FdoPtr<FdoPropertyDefinitionCollection> properties = definition->GetProperties ();
-    CPPUNIT_ASSERT_MESSAGE ("properties has wrong number of values", 1 == properties->GetCount ());  // 2 == the selected property (PERIMITER) + the identity properties (FEATID; they never get filtered out)
-    FdoPtr<FdoPropertyDefinition> property = properties->GetItem (L"PERIMETER");
-    CPPUNIT_ASSERT_MESSAGE ("property is not a data property", FdoPropertyType_DataProperty == property->GetPropertyType ());
-    CPPUNIT_ASSERT_MESSAGE ("property is wrong", 0 == wcscmp (L"PERIMETER", property->GetName ()));
-    double d = reader->GetDouble (L"PERIMETER");
-    bool bad;
     try
     {
-        d= reader->GetDouble (L"AREA");
-        bad = true;
+        FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select);
+        select->SetFeatureClassName (L"ontario");
+        FdoPtr <FdoIdentifierCollection> ids = select->GetPropertyNames ();
+        FdoPtr <FdoIdentifier> id = FdoIdentifier::Create (L"PERIMETER");
+        ids->Add (id);
+        FdoPtr<FdoIFeatureReader> reader = select->Execute ();
+        reader->ReadNext ();
+        FdoPtr<FdoClassDefinition> definition = reader->GetClassDefinition ();
+        FdoPtr<FdoPropertyDefinitionCollection> properties = definition->GetProperties ();
+        CPPUNIT_ASSERT_MESSAGE ("properties has wrong number of values", 1 == properties->GetCount ());  // 2 == the selected property (PERIMITER) + the identity properties (FEATID; they never get filtered out)
+        FdoPtr<FdoPropertyDefinition> property = properties->GetItem (L"PERIMETER");
+        CPPUNIT_ASSERT_MESSAGE ("property is not a data property", FdoPropertyType_DataProperty == property->GetPropertyType ());
+        CPPUNIT_ASSERT_MESSAGE ("property is wrong", 0 == wcscmp (L"PERIMETER", property->GetName ()));
+        double d = reader->GetDouble (L"PERIMETER");
+        bool bad;
+        try
+        {
+            d= reader->GetDouble (L"AREA");
+            bad = true;
+        }
+        catch (FdoException* ge)
+        {
+            ge->Release();
+            bad = false;
+        }
+        CPPUNIT_ASSERT_MESSAGE ("non-selected property is accessible", !bad);
     }
     catch (FdoException* ge)
     {
-        ge->Release();
-        bad = false;
+        TestCommonFail(ge);
     }
-    CPPUNIT_ASSERT_MESSAGE ("non-selected property is accessible", !bad);
 }
 
 void SelectTests::select_all ()
@@ -343,21 +534,28 @@
     double  length;
     int     count = 0;
 
-    FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select);
-    select->SetFeatureClassName (L"ontario");
-    FdoPtr <FdoIdentifierCollection> ids = select->GetPropertyNames ();
-    FdoPtr<FdoIFeatureReader> reader = select->Execute ();
-    while (reader->ReadNext ())
+    try
     {
-        reader->GetInt32 (L"FeatId");
-        area = reader->GetDouble (L"AREA");
-        length = reader->GetDouble (L"PERIMETER");
-        reader->GetDouble (L"ONTARIO_");
-        reader->GetDouble (L"ONTARIO_ID");
-        FdoPtr<FdoByteArray> geometry = reader->GetGeometry (L"Geometry");
+        FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select);
+        select->SetFeatureClassName (L"ontario");
+        FdoPtr <FdoIdentifierCollection> ids = select->GetPropertyNames ();
+        FdoPtr<FdoIFeatureReader> reader = select->Execute ();
+        while (reader->ReadNext ())
+        {
+            reader->GetInt32 (L"FeatId");
+            area = reader->GetDouble (L"AREA");
+            length = reader->GetDouble (L"PERIMETER");
+            reader->GetDouble (L"ONTARIO_");
+            reader->GetDouble (L"ONTARIO_ID");
+            FdoPtr<FdoByteArray> geometry = reader->GetGeometry (L"Geometry");
 
-        AnalyzeGeometry( L"ontario", count++, geometry, length, area);
+            TestCommonGeomUtil::PrintGeometryAnalysis( L"ontario", count++, geometry, length, area, VERBOSE);
+        }
     }
+    catch (FdoException* ge)
+    {
+        TestCommonFail(ge);
+    }
 }
 
 
@@ -392,7 +590,7 @@
     }
     catch (FdoException *e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -430,7 +628,7 @@
     }
     catch (FdoException* ge)
     {
-        fail(ge);
+        TestCommonFail(ge);
     }
     catch (CppUnit::Exception error)
     {
@@ -479,7 +677,7 @@
     }
     catch (FdoException* ge)
     {
-        fail(ge);
+        TestCommonFail(ge);
     }
     catch (CppUnit::Exception error)
     {
@@ -492,61 +690,6 @@
 
 }
 
-static FdoStringP FdoGeometryTypeToString (FdoGeometryType type)
-{
-    FdoStringP ret;
-
-    switch (type)
-    {
-        case FdoGeometryType_None:
-            ret = L"FdoGeometryType_None";
-            break;
-        case FdoGeometryType_Point:
-            ret = L"FdoGeometryType_Point";
-            break;
-        case FdoGeometryType_LineString:
-            ret = L"FdoGeometryType_LineString";
-            break;
-        case FdoGeometryType_Polygon:
-            ret = L"FdoGeometryType_Polygon";
-            break;
-        case FdoGeometryType_MultiPoint:
-            ret = L"FdoGeometryType_MultiPoint";
-            break;
-        case FdoGeometryType_MultiLineString:
-            ret = L"FdoGeometryType_MultiLineString";
-            break;
-        case FdoGeometryType_MultiPolygon:
-            ret = L"FdoGeometryType_MultiPolygon";
-            break;
-        case FdoGeometryType_MultiGeometry:
-            ret = L"FdoGeometryType_MultiGeometry";
-            break;
-        case FdoGeometryType_CurveString:
-            ret = L"FdoGeometryType_CurveString";
-            break;
-        case FdoGeometryType_CurvePolygon:
-            ret = L"FdoGeometryType_CurvePolygon";
-            break;
-        case FdoGeometryType_MultiCurveString:
-            ret = L"FdoGeometryType_MultiCurveString";
-            break;
-        case FdoGeometryType_MultiCurvePolygon:
-            ret = L"FdoGeometryType_MultiCurvePolygon";
-            break;
-        default:
-            {
-                wchar_t buffer[9];
-
-                FdoCommonOSUtil::swprintf (buffer, ELEMENTS(buffer), L"#%d", type);
-                ret = buffer;
-            }
-            break;
-    }
-
-    return (ret);
-}
-
 void SelectTests::select_hawaii ()
 {
     int count;
@@ -578,7 +721,7 @@
             FdoPtr<FdoIGeometry> geometry = factory->CreateGeometryFromFgf (bytes, byte_count);
             FdoGeometryType type = geometry->GetDerivedType ();
             if (VERBOSE)
-                wprintf (L"\n%d %s", (int)id, (const wchar_t*)FdoGeometryTypeToString (type));
+                wprintf (L"\n%d %s", (int)id, (const wchar_t*)FdoCommonMiscUtil::FdoGeometryTypeToString(type));
             CPPUNIT_ASSERT_MESSAGE ("not a polygon", FdoGeometryType_Polygon == type);
             FdoIPolygon* poly = (FdoIPolygon*)geometry.p;
             FdoPtr<FdoILinearRing> ring = poly->GetExteriorRing ();
@@ -600,7 +743,7 @@
     }
     catch (FdoException* ge)
     {
-        fail(ge);
+        TestCommonFail(ge);
     }
     catch (CppUnit::Exception error)
     {
@@ -655,7 +798,7 @@
 			ge->Release();
 		}
 		else
-			fail(ge);
+			TestCommonFail(ge);
     }
     catch (CppUnit::Exception error)
     {
@@ -699,7 +842,7 @@
     }
     catch (FdoException* e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -927,7 +1070,7 @@
     }
     catch (FdoException* e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
 
@@ -988,6 +1131,252 @@
     }
     catch (FdoException* e)
     {
-        fail(e);
+        TestCommonFail(e);
     }
 }
+
+
+void SelectTests::select_with_aggregates_should_fail()
+{
+    try
+    {
+        FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select);
+        select->SetFeatureClassName (L"ontario");
+        FdoPtr <FdoIdentifierCollection> ids = select->GetPropertyNames ();
+        FdoPtr <FdoIdentifier> id = FdoComputedIdentifier::Create(L"AVG_AREA", FdoPtr<FdoExpression>(FdoExpression::Parse(L"Avg(AREA)")));
+        ids->Add(id);
+
+        try
+        {
+            FdoPtr<FdoIFeatureReader> reader = select->Execute ();
+            CPPUNIT_FAIL("Expected an exception when using aggregate functions with the Select command, but didn't get one.");
+        }
+        catch (FdoException* e)
+        {
+            // We expect to get an exception here, so absorb it silently:
+            e->Release();
+        }
+    }
+    catch (FdoException* e)
+    {
+        TestCommonFail(e);
+    }
+}
+
+
+
+void SelectTests::upper_lower ()
+{
+    try
+    {
+        //////////////////////////////////////////////////////////////////////
+        // Create a SHP file:
+        //////////////////////////////////////////////////////////////////////
+
+        FdoString *className  = L"MyClass";
+        FdoString *schemaName = L"MySchema";
+
+        create_schema(schemaName, className, FdoGeometricType_Curve, false, false, true, false);
+
+        //////////////////////////////////////////////////////////////////////
+        // Try numerical function upper():
+        //////////////////////////////////////////////////////////////////////
+
+        FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select);
+        select->SetFeatureClassName (className);
+        FdoPtr<FdoIdentifierCollection> selectedIds = select->GetPropertyNames();
+        selectedIds->Clear();
+
+        FdoPtr<FdoComputedIdentifier> cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Upper(Street)) AS TestUpper");
+		selectedIds->Add(cid);
+
+		FdoPtr<FdoIReader>  datareader = select->Execute ();
+
+        long count = 0;
+        while (datareader->ReadNext ())
+        {
+            FdoString *street = datareader->GetString(L"TestUpper");
+            CPPUNIT_ASSERT_MESSAGE("Upper wrong",          
+				(0==wcscmp(street, L"SLATER")) || (0==wcscmp(street, L"ALBERT")) || (0==wcscmp(street, L"QUEEN")) );
+
+            count++;
+        }
+        CPPUNIT_ASSERT_MESSAGE("Wrong count(*) rowcount", count==4);
+        datareader->Close();
+        datareader = NULL;
+
+
+        //////////////////////////////////////////////////////////////////////
+        // Try numerical function lower():
+        //////////////////////////////////////////////////////////////////////
+
+        selectedIds = select->GetPropertyNames();
+        selectedIds->Clear();
+
+        cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Lower(Street)) AS TestLower");
+
+		selectedIds->Add(cid);
+
+		datareader = select->Execute ();
+
+        count = 0;
+        while (datareader->ReadNext ())
+        {
+            FdoString *street = datareader->GetString(L"TestLower");
+            CPPUNIT_ASSERT_MESSAGE("Lower wrong",          
+				(0==wcscmp(street, L"slater")) || (0==wcscmp(street, L"albert")) || (0==wcscmp(street, L"queen")) );
+
+            count++;
+        }
+        CPPUNIT_ASSERT_MESSAGE("Wrong count(*) rowcount", count==4);
+        datareader->Close();
+        datareader = NULL;
+
+        //////////////////////////////////////////////////////////////////////
+        // Try some wrong datatypes:
+        //////////////////////////////////////////////////////////////////////
+
+		bool error = false;
+
+        selectedIds->Clear();
+
+		cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Upper(LotSize)) AS TestUpper");
+
+		selectedIds->Add(cid);
+
+		try
+		{
+			datareader = select->Execute ();
+		}
+		catch (FdoException* e)
+		{
+			e->Release();
+			error = true;
+		}
+
+        datareader = NULL;
+
+		CPPUNIT_ASSERT_MESSAGE("Upper succeeded with wrong datatype", error == true );
+    }
+    catch (FdoException* e)
+    {
+        TestCommonFail(e);
+    }
+}
+
+
+
+void SelectTests::ceil_floor ()
+{
+    try
+    {
+        //////////////////////////////////////////////////////////////////////
+        // Create a SHP file:
+        //////////////////////////////////////////////////////////////////////
+
+        FdoString *className  = L"MyClass";
+        FdoString *schemaName = L"MySchema";
+
+        create_schema(schemaName, className, FdoGeometricType_Curve, false, false, true, false);
+
+
+        //////////////////////////////////////////////////////////////////////
+        // Try numerical function ceil():
+        //////////////////////////////////////////////////////////////////////
+
+        FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select);
+
+        select->SetFeatureClassName (className);
+        FdoPtr<FdoIdentifierCollection> selectedIds = select->GetPropertyNames();
+        selectedIds->Clear();
+
+        FdoPtr<FdoComputedIdentifier> cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Ceil(LotSize)) AS TestCeil");
+		selectedIds->Add(cid);
+
+		FdoPtr<FdoIReader> datareader = select->Execute ();
+
+		// [2702.7, 10000]
+        long count = 0;
+        while (datareader->ReadNext ())
+        {
+            double result = datareader->GetDouble(L"TestCeil");
+            CPPUNIT_ASSERT_MESSAGE("Ceil wrong", result >= 2703 && result <= 10000);
+            count++;
+        }
+        CPPUNIT_ASSERT_MESSAGE("Wrong count(*) rowcount", count==4);
+        datareader->Close();
+        datareader = NULL;
+
+        //////////////////////////////////////////////////////////////////////
+        // Try numerical function floor():
+        //////////////////////////////////////////////////////////////////////
+        selectedIds = select->GetPropertyNames();
+        selectedIds->Clear();
+
+        cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Floor(LotSize)) AS TestFloor");
+		selectedIds->Add(cid);
+
+		datareader = select->Execute ();
+
+		// [2702.7, 10000]
+        count = 0;
+        while (datareader->ReadNext ())
+        {
+            double result = datareader->GetDouble(L"TestFloor");
+            CPPUNIT_ASSERT_MESSAGE("Floor wrong",  result >= 2702 && result <= 10000);
+            count++;
+        }
+        CPPUNIT_ASSERT_MESSAGE("Wrong count(*) rowcount", count==4);
+        datareader->Close();
+        datareader = NULL;
+
+        //////////////////////////////////////////////////////////////////////
+        // Try Floor() on an Int32:  (should fail)
+        //////////////////////////////////////////////////////////////////////
+        selectedIds->Clear();
+
+        cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Floor(FeatId)) AS TestFloor");
+		selectedIds->Add(cid);
+
+        bool error = false;
+		try
+		{
+			datareader = select->Execute ();
+		}
+		catch (FdoException* e)
+		{
+			e->Release();
+			error = true;
+		}
+
+		CPPUNIT_ASSERT_MESSAGE("Floor succeeded with wrong datatype Int32", error == true );
+        datareader = NULL;
+
+        //////////////////////////////////////////////////////////////////////
+        // Try Ceil() on a string (should fail):
+        //////////////////////////////////////////////////////////////////////
+
+		error = false;
+		selectedIds->Clear();
+		cid = (FdoComputedIdentifier*)FdoExpression::Parse(L"(Ceil(Street)) AS TestCeil");
+		selectedIds->Add(cid);
+
+		try
+		{
+			datareader = select->Execute ();
+		}
+		catch (FdoException* e)
+		{
+			e->Release();
+			error = true;
+		}
+		datareader = NULL;
+
+		CPPUNIT_ASSERT_MESSAGE("Ceil succeeded with wrong datatype", error == true );
+    }
+    catch (FdoException* e)
+    {
+        TestCommonFail(e);
+    }
+}
+

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/SelectTests.h
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/SelectTests.h	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/SelectTests.h	2007-02-22 13:39:30 UTC (rev 196)
@@ -46,6 +46,9 @@
     CPPUNIT_TEST (select_date_time);
     CPPUNIT_TEST (select_large_geometries);
     CPPUNIT_TEST (analyze_polygons);
+    CPPUNIT_TEST (select_with_aggregates_should_fail);
+    CPPUNIT_TEST (upper_lower);
+    CPPUNIT_TEST (ceil_floor);
     CPPUNIT_TEST_SUITE_END ();
 
     static FdoPtr<FdoIConnection> mConnection;
@@ -71,9 +74,14 @@
     void select_date_time ();
     void select_large_geometries ();
     void analyze_polygons();
+    void select_with_aggregates_should_fail();
+    void upper_lower();
+    void ceil_floor();
 
 private:
+    // utility methods:
     void get_spatial_context (FdoIConnection* connection, FdoString* cs_name, int expected_num_sc);
+    void create_schema (FdoString *schemaName, FdoString* className, FdoGeometricType type, bool elevation, bool measure, bool bInsertTestData, bool bUseDoubleType);
 };
 
 #endif // SELECTTESTS_H

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/ShpTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/ShpTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/ShpTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -23,6 +23,9 @@
 
 #include <FdoCommonFile.h>
 
+#define SHP_MESSAGE_DEFINE
+#include <../Message/Inc/ShpMessage.h>
+
 bool ShpTests::VERBOSE = false;
 wchar_t* ShpTests::sLocation = L"";
 
@@ -40,35 +43,8 @@
     return (manager->CreateConnection (L"OSGeo.SHP.3.2"));
 }
 
-void ShpTests::fail (FdoException* ge)
-{
-    wchar_t message[2000];
-    char* multibyte;
-	FdoPtr<FdoException> cause;
 
-    wcscpy(message, (wchar_t*)ge->GetExceptionMessage ());
-	cause = ge->GetCause();
-	while (cause != NULL)
-	{
-		wcscat(message, L" [");
-		wcscat(message, cause->GetExceptionMessage());
-		wcscat(message, L"]");
-		cause = cause->GetCause();
-	}
-    wide_to_multibyte (multibyte, message);
-    if (NULL == multibyte)
-        multibyte = "Exception message could not be converted.";
-    ge->Release ();
-    CPPUNIT_FAIL (multibyte);
-}
 
-void ShpTests::fail (char* error)
-{
-    char message[1024];
-    sprintf (message, "\nFAILURE: %s\n", error);
-    CPPUNIT_FAIL (message);
-}
-
 void ShpTests::Expect (FdoIConnection* connection, UnitTestClass* definition, std::vector<int*> *map)
 {
     FdoPtr<FdoISelect> select;
@@ -214,57 +190,7 @@
             CPPUNIT_FAIL ("missing object");
 }
 
-wchar_t* ShpTests::GetDataTypeString (FdoDataType type)
-{
-    wchar_t* ret;
 
-    switch (type)
-    {
-        case FdoDataType_Boolean: // Represents a Boolean value of true or false.
-            ret = L"FdoDataType_Boolean";
-            break;
-        case FdoDataType_Byte: // Represents unsigned 8-bit integers with values between 0 and 255.
-            ret = L"FdoDataType_Byte";
-            break;
-        case FdoDataType_DateTime: // Represents a date and time value.
-            ret = L"FdoDataType_DateTime";
-            break;
-        case FdoDataType_Decimal: // Represents values ranging from 1.0 x 10^-28 to approximately 7.9 x 10^28 with 28-29 significant digits.
-            ret = L"FdoDataType_Decimal";
-            break;
-        case FdoDataType_Double: // Represents a floating point value ranging from approximately 5.0 x 10^-324 to 1.7 x 10^308 with a precision of 15-16 digits.
-            ret = L"FdoDataType_Double";
-            break;
-        case FdoDataType_Int16: // Represents signed 16-bit integers with values between -32768 and 32767.
-            ret = L"FdoDataType_Int16";
-            break;
-        case FdoDataType_Int32: // Represents signed 32-bit integers with values between -2147483648 and 2147483647.
-            ret = L"FdoDataType_Int32";
-            break;
-        case FdoDataType_Int64: // Represents signed 64-bit integers with values between -9223372036854775808 and 9223372036854775807.
-            ret = L"FdoDataType_Int64";
-            break;
-        case FdoDataType_Single: // Represents floating point values ranging from approximately 1.5 x 10^-45 to 3.4 x 10^38 with a precision of 7 digits.
-            ret = L"FdoDataType_Single";
-            break;
-        case FdoDataType_String: // Represents a Unicode character strings.
-            ret = L"FdoDataType_String";
-            break;
-        case FdoDataType_BLOB: // Represents a binary large object stored as a collection of bytes.
-            ret = L"FdoDataType_BLOB";
-            break;
-        case FdoDataType_CLOB: // Represents a character large object stored as a collection of  characters.
-            ret = L"FdoDataType_CLOB";
-            break;
-        default:
-            ret = L"Unknown return type";
-            break;
-    }
-
-    return (ret);
-}
-
-
 FdoExpression* ShpTests::ParseByDataType(const wchar_t* data, FdoDataType dataType)
 {
     FdoPtr<FdoExpression> expr;
@@ -649,15 +575,6 @@
     }
 }
 
-bool ShpTests::fuzzyEqual (const double d1, const double d2)
-{
-    if ((d1==0.0) || (d2==0.0))
-        return 1e-5 > fabs(d1 - d2);
-    else
-        return 1e-5 > fabs(1.0 - (d2 / d1));
-}
-
-
 // Accesses all the data on the current feature.
 void ShpTests::ProcessFeature (FdoIFeatureReader* featureReader, FdoIdentifierCollection* IDs)
 {
@@ -829,189 +746,6 @@
 
 
 
-bool ShpTests::GeometriesEquivalent(FdoIGeometry *geom1, FdoIGeometry *geom2)
-{
-    FdoInt32 dummyInt32 = 0;
-    bool bRet = true;
-    FdoGeometryType type1 = geom1->GetDerivedType();
-    FdoGeometryType type2 = geom2->GetDerivedType();
-    FdoDimensionality dim1 = (FdoDimensionality)geom1->GetDimensionality();
-    FdoDimensionality dim2 = (FdoDimensionality)geom1->GetDimensionality();
-
-    // Make sure types are the same:
-    if (type1 != type2)
-        return false;
-
-    // Make sure dimensionalities are the same:
-    if (dim1 != dim2)
-        return false;
-
-    // Make sure contents are the same:
-    FdoPtr<FdoIDirectPosition> pos1;
-    FdoPtr<FdoIDirectPosition> pos2;
-    bool bHasZ = (dim1 & FdoDimensionality_Z) > 0;
-    bool bHasM = (dim1 & FdoDimensionality_M) > 0;
-    switch (type1)
-    {
-        case FdoGeometryType_Point:
-        {
-            FdoIPoint* p1 = (FdoIPoint*)geom1;
-            FdoIPoint* p2 = (FdoIPoint*)geom2;
-            pos1 = p1->GetPosition();
-            pos2 = p2->GetPosition();
-            if (!PointsEquivalent(pos1, pos2))
-                return false;
-        }
-        break;
-
-        case FdoGeometryType_LineString:
-        {
-            FdoILineString* l1 = (FdoILineString*)geom1;
-            FdoILineString* l2 = (FdoILineString*)geom2;
-            FdoInt32 iCount1 = l1->GetCount();
-            FdoInt32 iCount2 = l2->GetCount();
-            if (iCount1 != iCount2)
-                return false;
-            for (FdoInt32 i=0; i<iCount1; i++)
-            {
-                pos1 = l1->GetItem(i);
-                pos2 = l2->GetItem(i);
-                if (!PointsEquivalent(pos1, pos2))
-                    return false;
-            }
-        }
-        break;
-
-        case FdoGeometryType_Polygon:
-        {
-            FdoIPolygon* p1 = (FdoIPolygon*)geom1;
-            FdoIPolygon* p2 = (FdoIPolygon*)geom2;
-            FdoPtr<FdoILinearRing> ring1 = p1->GetExteriorRing();
-            FdoPtr<FdoILinearRing> ring2 = p2->GetExteriorRing();
-            if (!LinearRingsEquivalent(ring1, ring2))
-                return false;
-            FdoInt32 iIntRingCount1 = p1->GetInteriorRingCount();
-            FdoInt32 iIntRingCount2 = p2->GetInteriorRingCount();
-            if (iIntRingCount1 != iIntRingCount2)
-                return false;
-            for (FdoInt32 i=0; i<iIntRingCount1; i++)
-            {
-                ring1 = p1->GetInteriorRing(i);
-                ring2 = p2->GetInteriorRing(i);
-                if (!LinearRingsEquivalent(ring1, ring2))
-                    return false;
-            }
-        }
-        break;
-
-        case FdoGeometryType_MultiPoint:
-        {
-            FdoIMultiPoint* multi1 = (FdoIMultiPoint*)geom1;
-            FdoIMultiPoint* multi2 = (FdoIMultiPoint*)geom2;
-            FdoInt32 count1 = multi1->GetCount();
-            FdoInt32 count2 = multi2->GetCount();
-            if (count1 != count2)
-                return false;
-            for (FdoInt32 i=0; i<count1; i++)
-            {
-                FdoPtr<FdoIGeometry> item1 = multi1->GetItem(i);
-                FdoPtr<FdoIGeometry> item2 = multi2->GetItem(i);
-                if (!GeometriesEquivalent(item1,item2))
-                    return false;
-            }
-        }
-        break;
-
-        case FdoGeometryType_MultiLineString:
-        {
-            FdoIMultiLineString* multi1 = (FdoIMultiLineString*)geom1;
-            FdoIMultiLineString* multi2 = (FdoIMultiLineString*)geom2;
-            FdoInt32 count1 = multi1->GetCount();
-            FdoInt32 count2 = multi2->GetCount();
-            if (count1 != count2)
-                return false;
-            for (FdoInt32 i=0; i<count1; i++)
-            {
-                FdoPtr<FdoIGeometry> item1 = multi1->GetItem(i);
-                FdoPtr<FdoIGeometry> item2 = multi2->GetItem(i);
-                if (!GeometriesEquivalent(item1,item2))
-                    return false;
-            }
-        }
-        break;
-
-        case FdoGeometryType_MultiPolygon:
-        {
-            FdoIMultiPolygon* multi1 = (FdoIMultiPolygon*)geom1;
-            FdoIMultiPolygon* multi2 = (FdoIMultiPolygon*)geom2;
-            FdoInt32 count1 = multi1->GetCount();
-            FdoInt32 count2 = multi2->GetCount();
-            if (count1 != count2)
-                return false;
-            for (FdoInt32 i=0; i<count1; i++)
-            {
-                FdoPtr<FdoIGeometry> item1 = multi1->GetItem(i);
-                FdoPtr<FdoIGeometry> item2 = multi2->GetItem(i);
-                if (!GeometriesEquivalent(item1,item2))
-                    return false;
-            }
-        }
-        break;
-
-        case FdoGeometryType_MultiGeometry:
-        case FdoGeometryType_CurveString:
-        case FdoGeometryType_CurvePolygon:
-        case FdoGeometryType_MultiCurveString:
-        case FdoGeometryType_MultiCurvePolygon:
-        default:
-            throw FdoException::Create(L"Don't know how to compare these 2 geometries");
-        break;
-    }
-
-    return bRet;
-}
-
-
-bool ShpTests::PointsEquivalent(FdoIDirectPosition* pos1, FdoIDirectPosition* pos2)
-{
-    if (pos1->GetDimensionality() != pos2->GetDimensionality())
-        return false;
-
-    bool bHasZ = (pos1->GetDimensionality() & FdoDimensionality_Z) > 0;
-    bool bHasM = (pos1->GetDimensionality() & FdoDimensionality_M) > 0;
-
-    if (!fuzzyEqual(pos1->GetX(), pos2->GetX()))
-        return false;
-    if (!fuzzyEqual(pos1->GetY(), pos2->GetY()))
-        return false;
-    if (bHasZ && !fuzzyEqual(pos1->GetZ(),pos2->GetZ()))
-        return false;
-    if (bHasM && !fuzzyEqual(pos1->GetM(),pos2->GetM()))
-        return false;
-
-    return true;
-}
-
-
-bool ShpTests::LinearRingsEquivalent(FdoILinearRing* lr1, FdoILinearRing* lr2)
-{
-    FdoInt32 count1 = lr1->GetCount();
-    FdoInt32 count2 = lr2->GetCount();
-    if (count1 != count2)
-        return false;
-
-    // Compare all the points in the 2 linear rings:
-    for (FdoInt32 i=0; i<count1; i++)
-    {
-        FdoPtr<FdoIDirectPosition> pos1 = lr1->GetItem(i);
-        FdoPtr<FdoIDirectPosition> pos2 = lr2->GetItem(i);
-        if (!PointsEquivalent(pos1,pos2))
-            return false;
-    }
-
-    return true;
-}
-
 wchar_t* ShpTests::ColumnTypeToString (eDBFColumnType type)
 {
     wchar_t* ret;
@@ -1042,225 +776,6 @@
 
 
 
-// Delete a class (if bDeleteRowsOnly==false) or delete the rows of a class (if bDeleteRowsOnly==true):
-void ShpTests::CleanUpClass(FdoIConnection *connection, const wchar_t* schema_name, const wchar_t* class_name, bool bDeleteRowsOnly)
-{
-    try
-    {
-        FdoPtr<FdoIdentifier> identifier = FdoIdentifier::Create (class_name);
-	    FdoPtr<FdoIDescribeSchema> descSchema = (FdoIDescribeSchema*)connection->CreateCommand(FdoCommandType_DescribeSchema);
-        // NOTE: in case the schema_name no longer exists, we dont specify it up front because it will cause an exception:
-	    //if (NULL!=schema_name)
-		//    descSchema->SetSchemaName(schema_name);
-	    FdoPtr<FdoFeatureSchemaCollection> schemas = descSchema->Execute();
-
-	    bool bFound = false;
-	    for (FdoInt32 iSchemaIndex = 0; iSchemaIndex<schemas->GetCount(); iSchemaIndex++)
-	    {
-		    FdoPtr<FdoFeatureSchema> schema = schemas->GetItem(iSchemaIndex);
-		    if ((NULL==schema_name) || (0==wcscmp(schema->GetName(), schema_name)))
-		    {
-			    FdoPtr<FdoClassCollection> classes = schema->GetClasses();
-			    for (FdoInt32 iClassIndex = 0; iClassIndex<classes->GetCount(); iClassIndex++)
-			    {
-				    FdoPtr<FdoClassDefinition> classDef = classes->GetItem(iClassIndex);
-				    if (0==FdoCommonOSUtil::wcsicmp(classDef->GetName(), identifier->GetName ()))
-				    {
-					    bFound = true;
-                        // delete the rows of this class, but not the class itself:
-                        FdoPtr<FdoIDelete> deleteCmd = (FdoIDelete*)connection->CreateCommand (FdoCommandType_Delete);
-                        deleteCmd->SetFeatureClassName(classDef->GetName());
-                        deleteCmd->Execute();
-
-                        if (!bDeleteRowsOnly)
-						{
-                             // delete the entire class:
-					        classDef->Delete();
-					        FdoPtr<FdoIApplySchema> applySchema = (FdoIApplySchema*)connection->CreateCommand(FdoCommandType_ApplySchema);
-					        applySchema->SetFeatureSchema(schema);
-					        applySchema->Execute();
-                        }
-
-					    break;
-				    }
-			    }
-		    }
-
-		    if (bFound)
-			    break;
-	    }
-
-	    // recurse with default schema, if class not found:
-	    if (!bFound && (NULL!=schema_name) && (wcslen(schema_name)>0))
-		    CleanUpClass(connection, NULL, class_name);
-    }
-    catch (FdoException* ge)
-    {
-        fail (ge);
-    }
-}
-
-void ShpTests::AnalyzeGeometry( const wchar_t *class_name, int index, FdoByteArray * geom_fgf, double length0, double area0 )
-{
-    FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance ();
-    FdoIGeometry    *geom = gf->CreateGeometryFromFgf( geom_fgf );
-
-    switch (geom->GetDerivedType())
-    {
-   	case FdoGeometryType_LineString:
-        if (VERBOSE)
-            printf("%ls-%d. FdoGeometryType_LineString!\n", class_name, index);
-		break;
-
-	case FdoGeometryType_Point:
-        if (VERBOSE)
-            printf("%ls-%d. FdoGeometryType_Point!\n", class_name, index);
-		break;
-
-	case FdoGeometryType_Polygon:
-        {
-            FdoIPolygon *poly = (FdoIPolygon *)geom;
-            FdoILinearRing *extRing = poly->GetExteriorRing();
-            double area = FdoSpatialUtility::ComputeLinearRingArea( extRing );
-            double length = FdoSpatialUtility::ComputeLinearRingLength( extRing );
-            if (VERBOSE)
-                printf("%ls-%d. FdoGeometryType_Polygon  length=%lf (%lf) area=%lf (%lf)\n", class_name, index, length, length0, area, area0);
-            
-            for ( int j = 0; j < poly->GetInteriorRingCount(); j++ )
-            {
-                FdoILinearRing *intRing = poly->GetInteriorRing(j);   
-                area = FdoSpatialUtility::ComputeLinearRingArea( intRing );
-                if (VERBOSE)
-                    printf("    %d. intPolygon  area=%lf\n", j, area);
-                FDO_SAFE_RELEASE(intRing);
-            }
-
-            FDO_SAFE_RELEASE(extRing);
-        }
-		break;
-
-	case FdoGeometryType_MultiPoint:
-        if (VERBOSE)
-            printf("%ls-%d. FdoGeometryType_MultiPoint!\n", class_name, index);
-		break;
-
-	case FdoGeometryType_MultiGeometry:
-        if (VERBOSE)
-            printf("%ls-%d. FdoGeometryType_MultiGeometry!\n", class_name, index);
-		break;
-
-	case FdoGeometryType_MultiLineString:
-        if (VERBOSE)
-            printf("%ls-%d. FdoGeometryType_MultiLineString!\n", class_name, index);
-		break;
-
-	case FdoGeometryType_MultiPolygon:
-        {
-            if (VERBOSE)
-                printf("%ls-%d. FdoGeometryType_MultiPolygon (%lf)\n", class_name, index, area0);
-
-            FdoIMultiPolygon *mpoly = (FdoIMultiPolygon *)geom;
-            for (int i = 0; i < mpoly->GetCount(); i++ )
-            {
-                FdoIPolygon *poly = mpoly->GetItem(i);
-                FdoILinearRing *extRing = poly->GetExteriorRing();
-                double area = FdoSpatialUtility::ComputeLinearRingArea( extRing );
-                double length = FdoSpatialUtility::ComputeLinearRingLength( extRing );
-                if (VERBOSE)
-                    printf("    %d. extPolygon length=%lf (%lf) area=%lf (%lf) \n", i, length, length0, area, area0);
- 
-                for ( int j = 0; j < poly->GetInteriorRingCount(); j++ )
-                {
-                    FdoILinearRing *intRing = poly->GetInteriorRing(j);   
-                    area = FdoSpatialUtility::ComputeLinearRingArea( intRing );
-                    if (VERBOSE)
-                        printf("    %d. intPolygon  area=%lf\n", j, area);
-                    FDO_SAFE_RELEASE(intRing);
-                }
-                FDO_SAFE_RELEASE(poly);
-                FDO_SAFE_RELEASE(extRing);
-            }
-        }
-		break;
-
-	case FdoGeometryType_CurveString:
-        if (VERBOSE)
-            printf("%ls-%d. FdoGeometryType_CurveString!\n", class_name, index);
-		break;
-
-	case FdoGeometryType_MultiCurveString:
-        if (VERBOSE)
-            printf("%ls-%d. FdoGeometryType_MultiCurveString!\n", class_name, index);
-		break;
-
-	case FdoGeometryType_CurvePolygon:
-        if (VERBOSE)
-            printf("%ls-%d. FdoGeometryType_CurvePolygon!\n", class_name, index);
-		break;
-
-	case FdoGeometryType_MultiCurvePolygon:
-        if (VERBOSE)
-            printf("%ls-%d. FdoGeometryType_MultiCurvePolygon!\n", class_name, index);
-		break;
- 
-    default:
-        ;
-    }
-
-    FDO_SAFE_RELEASE(geom);
-}
-
-void ShpTests::Compare (const wchar_t* fut, const wchar_t* ref, unsigned long start, unsigned long end)
-{
-    FdoCommonFile bad;
-    FdoCommonFile good;
-    FdoCommonFile::ErrorCode code;
-    unsigned char buffer1;
-    unsigned char buffer2;
-    unsigned long count;
-
-    if (bad.OpenFile (fut, FdoCommonFile::IDF_OPEN_READ, code))
-        if (good.OpenFile (ref, FdoCommonFile::IDF_OPEN_READ, code))
-        {
-            bad.SetFilePointer (start);
-            good.SetFilePointer (start);
-            if (-1L == end)
-            {
-                good.GetFileSize (end);
-                bad.GetFileSize (count);
-                if (count > end)
-                    end = count;
-            }
-            count = 0;
-            while (bad.ReadFile (&buffer1, 1L))
-                if (good.ReadFile (&buffer2, 1L))
-                {
-					// The 29th byte is LDID. The original file might not have it set but (i.e. is 0) but the 
-					// copy file does (takes the locale into account).
-					bool isLDID = ((count + start) == 29);
-                    if ((buffer1 != buffer2) && (buffer1 != 0 && isLDID))
-                    {
-                        char message[1024];
-                        sprintf (message, "compare error at offset 0x%x, expected 0x%x, got 0x%x", count + start, buffer2, buffer1);
-                        CPPUNIT_FAIL (message);
-                    }
-                    count++;
-                    if (count > end)
-                        return;
-                }
-                else
-                    CPPUNIT_FAIL ("reference has fewer bytes");
-            // check the good file has been sucked dry too
-            CPPUNIT_ASSERT_MESSAGE ("reference has more bytes", !good.ReadFile (&buffer2, 1L));
-
-        }
-        else
-            CPPUNIT_FAIL ("can't open reference file");
-    else
-        CPPUNIT_FAIL ("can't open target file");
-   
-}
-
 /// <summary>Copy a class.</summary>
 /// <param name="target_connection">A connection for the target class.</param> 
 /// <param name="target_class">The class name for the duplicate class.</param> 
@@ -1269,7 +784,7 @@
 void ShpTests::copy_schema (FdoIConnection* target_connection, FdoString* target_class, FdoFeatureClass* source_class, bool new_schema)
 {
     // delete the class, if its there:
-    CleanUpClass(target_connection, NULL, target_class);
+    TestCommonSchemaUtil::CleanUpClass(target_connection, NULL, target_class);
 
     // create the class
     FdoPtr<FdoFeatureSchema> schema;

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/ShpTests.h
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/ShpTests.h	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/ShpTests.h	2007-02-22 13:39:30 UTC (rev 196)
@@ -117,12 +117,6 @@
 	static wchar_t* sLocation;
     static FdoIConnection* GetConnection ();
 
-    static void fail (FdoException* ge);
-    static void fail (char* error);
-
-	// Converts the given FdoDataType to an equivalent string representation:
-	static wchar_t* GetDataTypeString (FdoDataType type);
-
     // Parses the given Fdo string into an FdoExpression, making sure to validate and convert to the given type:
     static FdoExpression* ParseByDataType (const wchar_t* data, FdoDataType dataType);
 
@@ -132,32 +126,15 @@
     // check for the objects in the map (pairs of property index values & id numbers) by doing a select
     static void Expect (FdoIConnection* connection, UnitTestClass* definition, std::vector<int*> *map);
 
-    // check that 2 doubles are roughly equal:
-    static bool fuzzyEqual (const double d1, const double d2);
-
     // Accesses all the data on the current feature.
     void ProcessFeature (FdoIFeatureReader* featureReader, FdoIdentifierCollection* IDs = NULL);
 
     // Activate the given spatial context; don't report error if spatial context not found:
     void ActivateSpatialContext (FdoIConnection* connection, FdoString* scName);
 
-    // Compare two geometries for equivalence:
-    bool GeometriesEquivalent (FdoIGeometry *geom1, FdoIGeometry *geom2);
-    bool LinearRingsEquivalent (FdoILinearRing* lr1, FdoILinearRing* lr2);
-    bool PointsEquivalent (FdoIDirectPosition* pos1, FdoIDirectPosition* pos2);
-
     // DBF column type to string
     static wchar_t* ColumnTypeToString (eDBFColumnType type);
 
-    // Delete a class (if bDeleteRowsOnly==false) or delete the rows of a class (if bDeleteRowsOnly==true):
-    void CleanUpClass(FdoIConnection *connection, const wchar_t* schema_name, const wchar_t* class_name, bool bDeleteRowsOnly=false);
-
-    // Print out info about the given geometry:
-    void AnalyzeGeometry( const wchar_t *class_name, int index, FdoByteArray * geom_fgf, double length, double area );
-
-    // Compare two files, FileUnderTest (fut) vs. a reference file (ref)
-    void Compare (const wchar_t* fut, const wchar_t* ref, unsigned long start = 0L, unsigned long end = (unsigned long) -1L);
-
     /// <summary>Copy a class.</summary>
     /// <param name="target_connection">A connection for the source class.</param> 
     /// <param name="target_class">The class name for the duplicate class.</param> 

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/SpatialFilterTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/SpatialFilterTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/SpatialFilterTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -19,7 +19,6 @@
 
 #include "Pch.h"
 #include "SpatialFilterTests.h"
-#include "UnitTestUtil.h"
 
 #include <ShpSpatialIndex.h>
 #include <ShapeFile.h>
@@ -181,7 +180,7 @@
 		FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance ();
 
 #ifdef _WIN32       
-		double time1 = UnitTestUtil::GetTime_S();
+		double time1 = TestCommonMiscUtil::GetTime_S();
 #endif
 
 		FdoPtr<FdoIConnection> connection = ShpTests::GetConnection ();
@@ -194,13 +193,13 @@
 		FdoPtr<FdoIFeatureReader> reader = select->Execute ();
 
 #ifdef _WIN32       
-		double time2 = UnitTestUtil::GetTime_S();
+		double time2 = TestCommonMiscUtil::GetTime_S();
 		double elapsed = time2 - time1;
 		printf("Elapsed select->Execute(): %lf sec\n",elapsed);
 #endif
 
 #ifdef _WIN32       
-		time1 = UnitTestUtil::GetTime_S();
+		time1 = TestCommonMiscUtil::GetTime_S();
 #endif
 
 		int count = 0;
@@ -222,7 +221,7 @@
 			}
 		}
 #ifdef _WIN32       
-		time2 = UnitTestUtil::GetTime_S();
+		time2 = TestCommonMiscUtil::GetTime_S();
 		elapsed = time2 - time1;
 		printf("Elapsed select->ReadNext(): %lf sec\n",elapsed);
 #endif
@@ -230,7 +229,7 @@
 	}
     catch( FdoException* ex)
     {
-        fail (ex);
+        TestCommonFail (ex);
     }
 }
 
@@ -269,7 +268,7 @@
         select->SetFilter(filter);
 
 #ifdef _WIN32       
-        double time1 = UnitTestUtil::GetTime_S();
+        double time1 = TestCommonMiscUtil::GetTime_S();
 #endif
 
         FdoPtr<FdoIFeatureReader> reader = select->Execute();
@@ -288,7 +287,7 @@
             printf("Count = %d\n", count);
 
 #ifdef _WIN32       
-        double time2 = UnitTestUtil::GetTime_S();
+        double time2 = TestCommonMiscUtil::GetTime_S();
         double elapsed = time2 - time1;
         if (VERBOSE)
 			printf("Elapsed: %lf sec\n",elapsed);
@@ -296,7 +295,7 @@
     }
     catch( FdoException* ex)
     {
-        fail (ex);
+        TestCommonFail (ex);
     }
     catch( ... )
     {

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/UnitTest.vcproj
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/UnitTest.vcproj	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/UnitTest.vcproj	2007-02-22 13:39:30 UTC (rev 196)
@@ -42,7 +42,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="$(FDO)\Unmanaged\inc;$(FDOTHIRDPARTY)\cppunit\include;$(FDOUTILITIES)\Common\inc;..\ShpRead;..\ShpSpatialIndex;..\..\inc;..\Provider"
+				AdditionalIncludeDirectories="$(FDO)\Unmanaged\inc;$(FDOTHIRDPARTY)\cppunit\include;$(FDOUTILITIES)\Common\inc;..\ShpRead;..\ShpSpatialIndex;..\..\inc;..\Provider;$(FDOUTILITIES)\TestCommon\Inc"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;GISSPATIAL_STATIC;_CRT_SECURE_NO_DEPRECATE"
 				GeneratePreprocessedFile="0"
 				KeepComments="false"
@@ -132,7 +132,7 @@
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				OmitFramePointers="true"
-				AdditionalIncludeDirectories="$(FDO)\Unmanaged\inc;$(FDOTHIRDPARTY)\cppunit\include;$(FDOUTILITIES)\Common\inc;..\ShpRead;..\ShpSpatialIndex;..\..\inc;..\Provider"
+				AdditionalIncludeDirectories="$(FDO)\Unmanaged\inc;$(FDOTHIRDPARTY)\cppunit\include;$(FDOUTILITIES)\Common\inc;..\ShpRead;..\ShpSpatialIndex;..\..\inc;..\Provider;$(FDOUTILITIES)\TestCommon\Inc"
 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
 				StringPooling="true"
 				MinimalRebuild="true"
@@ -298,10 +298,6 @@
 				>
 			</File>
 			<File
-				RelativePath="UnitTestUtil.cpp"
-				>
-			</File>
-			<File
 				RelativePath="UpdateTests.cpp"
 				>
 			</File>
@@ -395,10 +391,6 @@
 				>
 			</File>
 			<File
-				RelativePath="UnitTestUtil.h"
-				>
-			</File>
-			<File
 				RelativePath="UpdateTests.h"
 				>
 			</File>

Deleted: branches/3.2.x/Providers/SHP/Src/UnitTest/UnitTestUtil.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/UnitTestUtil.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/UnitTestUtil.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -1,120 +0,0 @@
-/*
- * 
-* Copyright (C) 2004-2006  Autodesk, Inc.
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of version 2.1 of the GNU Lesser
-* General Public License as published by the Free Software Foundation.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-* 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-* 
- */
-
-#include "Pch.h"
-#include "UnitTestUtil.h"
-#ifdef _WIN32
-#include <io.h>
-#include <stddef.h>
-#else
-#include <sys/time.h>
-#endif
-
-#define SHP_MESSAGE_DEFINE
-#include <../Message/Inc/ShpMessage.h>
-
-UnitTestUtil::UnitTestUtil(void)
-{
-}
-
-UnitTestUtil::~UnitTestUtil(void)
-{
-}
-
-void UnitTestUtil::CheckOutput( const char* masterFileName, const char* outFileName )
-{
-	if ( CompareFiles( masterFileName, outFileName ) != 0 ) {
-		char buffer[5000];
-		sprintf( buffer, "Output file %s differs from expected output file %s", outFileName, masterFileName );
-        CPPUNIT_FAIL (buffer);
-	}
-}
-
-FdoInt32 UnitTestUtil::CompareFiles( const char* file1Name, const char* file2Name )
-{
-	char buffer[500];
-	char buffer1[5000];
-	char buffer2[5000];
-
-	FdoInt32 retcode = -1;
-
-	FILE* fp1 = fopen( file1Name, "r" );
-	FILE* fp2 = fopen( file2Name, "r" );
-	
-	if ( fp1 == NULL ) {
-		sprintf( buffer, "UnitTestUtil::CompareFiles: failed to open file %s", file1Name );
-        CPPUNIT_FAIL (buffer);
-	}
-
-	if ( fp2 == NULL ) {
-    	fclose(fp1);
-		sprintf( buffer, "UnitTestUtil::CompareFiles: failed to open file %s", file2Name );
-        CPPUNIT_FAIL (buffer);
-	}
-
-	while ( fgets( buffer1, sizeof(buffer1-1), fp1 ) != NULL ) {
-		if ( !fgets( buffer2, sizeof(buffer2-1), fp2  ) ) 
-			// different: file2 has fewer lines.
-			goto the_exit;
-
-		if ( strcmp( buffer1, buffer2 ) )
-			// different: a line is different
-			goto the_exit;
-	}
-
-	if ( fgets( buffer2, sizeof(buffer2-1), fp2 ) ) 
-		// different: file2 has more lines.
-		goto the_exit;
-
-	retcode = 0;
-
-the_exit:
-	fclose(fp1);
-	fclose(fp2);
-
-	return( retcode );
-}
-
-// Get time on system clock (in seconds) -- used for computing elapsed time.
-double UnitTestUtil::GetTime_S(void)
-{
-#ifdef _WIN32   
-
-   double our_time;
- 
-   our_time = GetTickCount() / 1000.0;
-   return our_time;
- 
-#else
-
-	struct timeval			this_time;
-	static struct timezone	time_zone = { 0, 0 };
-	double					sec, micro, time;
-
-
-	if (gettimeofday(&this_time, &time_zone) == -1)
-		return (double) 0.0;
-
-	micro = (double) ((double) this_time.tv_usec / (double) 1000000.0);
-	sec = (double) this_time.tv_sec;
-	time = micro + sec;
-	return time;
-	
-#endif 
-}

Deleted: branches/3.2.x/Providers/SHP/Src/UnitTest/UnitTestUtil.h
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/UnitTestUtil.h	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/UnitTestUtil.h	2007-02-22 13:39:30 UTC (rev 196)
@@ -1,46 +0,0 @@
-#ifndef CPP_FDOSHP_UNIT_TESTUTIL_H
-#define CPP_FDOSHP_UNIT_TESTUTIL_H
-/*
- * Copyright (C) 2004-2006  Autodesk, Inc.
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of version 2.1 of the GNU Lesser
-* General Public License as published by the Free Software Foundation.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-* 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-#ifdef _WIN32
-#pragma once
-#endif
-
-// Various utility functions to help with unit testing.
-class UnitTestUtil
-{
-public:
-	UnitTestUtil(void);
-   ~UnitTestUtil(void);
-
-public:
-	// Compare an output file against its master (expected) copy.
-	// Fail if they are different.
-	static void CheckOutput( const char* masterFileName, const char* outFileName );
-
-	// Compare two files.
-	// Returns:
-	//		0 - they are the same
-	//	   -1 - they are different.
-	static FdoInt32 CompareFiles( const char* file1Name, const char* file2Name );
-
-	// Get the current time in seconds.
-	static double GetTime_S( void );
-};
-
-#endif // CPP_FDOSHP_UNIT_TESTUTIL_H
-

Modified: branches/3.2.x/Providers/SHP/Src/UnitTest/UpdateTests.cpp
===================================================================
--- branches/3.2.x/Providers/SHP/Src/UnitTest/UpdateTests.cpp	2007-02-22 00:38:16 UTC (rev 195)
+++ branches/3.2.x/Providers/SHP/Src/UnitTest/UpdateTests.cpp	2007-02-22 13:39:30 UTC (rev 196)
@@ -54,7 +54,7 @@
 void UpdateTests::tearDown ()
 {
     // delete the class, if its there:
-    CleanUpClass(mConnection, NULL, L"Test");
+    TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, L"Test");
 
     mConnection->Close ();
 	FDO_SAFE_RELEASE(mConnection.p);
@@ -66,7 +66,7 @@
 void UpdateTests::create_schema (FdoGeometricType type, bool elevation, bool measure)
 {
     // delete the class, if its there:
-    CleanUpClass(mConnection, NULL, L"Test");
+    TestCommonSchemaUtil::CleanUpClass(mConnection, NULL, L"Test");
 
     // create the class
     FdoPtr<FdoFeatureSchema> schema = FdoFeatureSchema::Create (L"TheSchema", L" test schema");
@@ -192,7 +192,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -270,7 +270,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -403,7 +403,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -535,7 +535,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -609,7 +609,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 
@@ -723,7 +723,7 @@
     }
     catch (FdoException* ge) 
     {
-        fail (ge);
+        TestCommonFail (ge);
     }
 }
 



More information about the fdo-commits mailing list