Fixed cmake build problem to allow for excluding test files, switched testPose3SLAM to use a different interface to values

release/4.3a0
Alex Cunningham 2012-02-11 22:38:53 +00:00
parent c17446463a
commit d0e9b1d51a
3 changed files with 11 additions and 3 deletions

View File

@ -50,7 +50,8 @@ TEST(Pose3Graph, optimizeCircle) {
// Create a hexagon of poses // Create a hexagon of poses
double radius = 10; double radius = 10;
Values hexagon = pose3SLAM::circle(6,radius); Values hexagon = pose3SLAM::circle(6,radius);
Pose3 gT0 = hexagon[PoseKey(0)], gT1 = hexagon[PoseKey(1)]; // Pose3 gT0 = hexagon[PoseKey(0)], gT1 = hexagon[PoseKey(1)]; // FAIL: cannot cast ValueAutomaticCasting
Pose3 gT0 = hexagon.at<Pose3>(PoseKey(0)), gT1 = hexagon.at<Pose3>(PoseKey(1)); // Works
// create a Pose graph with one equality constraint and one measurement // create a Pose graph with one equality constraint and one measurement
shared_ptr<Pose3Graph> fg(new Pose3Graph); shared_ptr<Pose3Graph> fg(new Pose3Graph);

View File

@ -12,10 +12,18 @@ else (GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS)
gtsam-static) gtsam-static)
endif (GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS) endif (GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS)
# exclude certain files
# note the source dir on each
set (tests_exclude
"${CMAKE_CURRENT_SOURCE_DIR}/testTupleValues.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/testPose2SLAMwSPCG.cpp"
)
# Build tests # Build tests
if (GTSAM_BUILD_TESTS) if (GTSAM_BUILD_TESTS)
add_custom_target(check.tests COMMAND ${CMAKE_CTEST_COMMAND}) add_custom_target(check.tests COMMAND ${CMAKE_CTEST_COMMAND})
file(GLOB tests_srcs "test*.cpp") file(GLOB tests_srcs "test*.cpp")
list(REMOVE_ITEM tests_srcs ${tests_exclude})
foreach(test_src ${tests_srcs}) foreach(test_src ${tests_srcs})
get_filename_component(test_base ${test_src} NAME_WE) get_filename_component(test_base ${test_src} NAME_WE)
set( test_bin tests.${test_base} ) set( test_bin tests.${test_base} )
@ -33,6 +41,7 @@ endif (GTSAM_BUILD_TESTS)
if (GTSAM_BUILD_TIMING) if (GTSAM_BUILD_TIMING)
add_custom_target(timing.tests) add_custom_target(timing.tests)
file(GLOB timing_srcs "time*.cpp") file(GLOB timing_srcs "time*.cpp")
list(REMOVE_ITEM timing_srcs ${tests_exclude})
foreach(time_src ${timing_srcs}) foreach(time_src ${timing_srcs})
get_filename_component(time_base ${time_src} NAME_WE) get_filename_component(time_base ${time_src} NAME_WE)
set( time_bin tests.${time_base} ) set( time_bin tests.${time_base} )

View File

@ -14,7 +14,6 @@ using namespace pose2SLAM;
const double tol = 1e-5; const double tol = 1e-5;
#if ENABLE_SPCG
/* ************************************************************************* */ /* ************************************************************************* */
TEST(testPose2SLAMwSPCG, example1) { TEST(testPose2SLAMwSPCG, example1) {
@ -67,7 +66,6 @@ TEST(testPose2SLAMwSPCG, example1) {
EXPECT(assert_equal(expected, actual, tol)); EXPECT(assert_equal(expected, actual, tol));
} }
#endif
/* ************************************************************************* */ /* ************************************************************************* */
int main() { TestResult tr; return TestRegistry::runAllTests(tr); } int main() { TestResult tr; return TestRegistry::runAllTests(tr); }