[cig-commits] r3986 - in cs/spatialdata-0.1/trunk: .
libsrc/spatialdb tests/libtests/spatialdb
baagaard at geodynamics.org
baagaard at geodynamics.org
Fri Jul 7 16:35:42 PDT 2006
Author: baagaard
Date: 2006-07-07 16:35:41 -0700 (Fri, 07 Jul 2006)
New Revision: 3986
Removed:
cs/spatialdata-0.1/trunk/pkgs/
Modified:
cs/spatialdata-0.1/trunk/README
cs/spatialdata-0.1/trunk/TODO
cs/spatialdata-0.1/trunk/libsrc/spatialdb/Makefile.am
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/Makefile.am
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.hh
Log:
Added testing of C bindings for SpatialDB::query().
Modified: cs/spatialdata-0.1/trunk/README
===================================================================
--- cs/spatialdata-0.1/trunk/README 2006-07-07 23:07:35 UTC (rev 3985)
+++ cs/spatialdata-0.1/trunk/README 2006-07-07 23:35:41 UTC (rev 3986)
@@ -27,8 +27,8 @@
* included.
*
* The software is built using the GNU build procedure. It is possible
- * to build only the C++ library with C and Fortran 77 bindings for
- * the routines. Building the complete package with the Pyre framework
+ * to build only the C++ library with C bindings for the
+ * routines. Building the complete package with the Pyre framework
* requires pythia-0.8.
*
* @section dirs Directories
@@ -38,7 +38,7 @@
* @li \b tests Regression tests of library
*
* @section reqs Required software
- * @li GNU build tools w/C++, C, and Fortran 77 compilers
+ * @li GNU build tools w/C++ and C compilers
* @li Proj.4 cartographic projections library (http://proj.maptools.org)
*
* @section ops Optional software
Modified: cs/spatialdata-0.1/trunk/TODO
===================================================================
--- cs/spatialdata-0.1/trunk/TODO 2006-07-07 23:07:35 UTC (rev 3985)
+++ cs/spatialdata-0.1/trunk/TODO 2006-07-07 23:35:41 UTC (rev 3986)
@@ -7,9 +7,6 @@
SPATIALDB
Testing
- Test C and Fortran wrappers (use in combination with C++ to get
- around passing array of strings)
-
Test generator code.
Get units by parsing header with Python
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/Makefile.am 2006-07-07 23:07:35 UTC (rev 3985)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/Makefile.am 2006-07-07 23:35:41 UTC (rev 3986)
@@ -21,8 +21,7 @@
SimpleDBQuery.cc \
SimpleIO.cc \
SimpleIOAscii.cc \
- cspatialdb.cc \
- f77spatialdb.cc
+ cspatialdb.cc
libspatialdataspatialdb_la_LDFLAGS =
@@ -43,7 +42,6 @@
SimpleIOAscii.hh \
SimpleIOAscii.icc \
cspatialdb.h \
- f77spatialdb.h \
SimpleDBQuery.hh \
SimpleDBTypes.hh \
SimpleDBTypes.icc
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/Makefile.am 2006-07-07 23:07:35 UTC (rev 3985)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/Makefile.am 2006-07-07 23:35:41 UTC (rev 3986)
@@ -28,6 +28,7 @@
TestSimpleDBVolume.cc \
TestSimpleIOAscii.cc \
TestSpatialDB.cc \
+ testcquery.c \
testspatial.cc
noinst_HEADERS = \
@@ -38,6 +39,7 @@
TestSimpleDBQuery.hh \
TestSimpleDBVolume.hh \
TestSimpleIOAscii.hh \
+ testcquery.h \
TestSpatialDB.hh
testspatial_LDFLAGS =
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.cc 2006-07-07 23:07:35 UTC (rev 3985)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.cc 2006-07-07 23:35:41 UTC (rev 3986)
@@ -23,6 +23,10 @@
#include "spatialdata/geocoords/CoordSys.hh" // USES CSCart
#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
+extern "C" {
+#include "testcquery.h"
+}
+
// ----------------------------------------------------------------------
CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSpatialDB );
@@ -85,7 +89,38 @@
_pDB->close();
} // testDB
-// version
-// $Id$
+// ----------------------------------------------------------------------
+// Test SpatialDB w/C query
+void
+spatialdata::spatialdb::TestSpatialDB::testDB_c(void)
+{ // testDB_c
+ CPPUNIT_ASSERT(0 != _pDB);
+ const char* names[] = {"two", "one"};
+ const char* units[] = {"m", "m"};
+ const int numVals = 2;
+ const double queryLoc[] = { 1.0, 2.0, 3.0 };
+ const double pVals[] = { 6.3, 4.7 };
+ const int errFlags[] = { 0 };
+
+ _pDB->queryVals(names, numVals);
+
+ double* pValsQ = (0 < numVals) ? new double[numVals] : 0;
+ spatialdata::geocoords::CSCart csCart;
+ csCart.initialize();
+
+ const int err = testcquery((void*) _pDB, &pValsQ, numVals,
+ queryLoc[0], queryLoc[1], queryLoc[2],
+ (void*) &csCart);
+ CPPUNIT_ASSERT(err == errFlags[0]);
+
+ const double tolerance = 1.0e-06;
+ for (int iVal=0; iVal < numVals; ++iVal)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(pValsQ[iVal]/pVals[numVals-iVal-1],
+ 1.0, tolerance);
+
+ delete[] pValsQ; pValsQ = 0;
+ _pDB->close();
+} // testDB_c
+
// End of file
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.hh 2006-07-07 23:07:35 UTC (rev 3985)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.hh 2006-07-07 23:35:41 UTC (rev 3986)
@@ -37,6 +37,7 @@
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
CPPUNIT_TEST_SUITE( TestSpatialDB );
CPPUNIT_TEST( testDB );
+ CPPUNIT_TEST( testDB_c );
CPPUNIT_TEST_SUITE_END();
// PUBLIC METHODS /////////////////////////////////////////////////////
@@ -51,6 +52,9 @@
/// Test SpatialDB
void testDB(void);
+ /// Test SpatialDB w/C query
+ void testDB_c(void);
+
// PRIVATE MEMBERS ////////////////////////////////////////////////////
private :
More information about the cig-commits
mailing list