From d0e9b1d51a2c883ebdc028144d247a42c735085b Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Sat, 11 Feb 2012 22:38:53 +0000 Subject: [PATCH] Fixed cmake build problem to allow for excluding test files, switched testPose3SLAM to use a different interface to values --- gtsam/slam/tests/testPose3SLAM.cpp | 3 ++- tests/CMakeLists.txt | 9 +++++++++ tests/testPose2SLAMwSPCG.cpp | 2 -- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gtsam/slam/tests/testPose3SLAM.cpp b/gtsam/slam/tests/testPose3SLAM.cpp index 77c206918..4fa815cdc 100644 --- a/gtsam/slam/tests/testPose3SLAM.cpp +++ b/gtsam/slam/tests/testPose3SLAM.cpp @@ -50,7 +50,8 @@ TEST(Pose3Graph, optimizeCircle) { // Create a hexagon of poses double radius = 10; 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(PoseKey(0)), gT1 = hexagon.at(PoseKey(1)); // Works // create a Pose graph with one equality constraint and one measurement shared_ptr fg(new Pose3Graph); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 240623a22..05c51f4d5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -12,10 +12,18 @@ else (GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS) gtsam-static) 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 if (GTSAM_BUILD_TESTS) add_custom_target(check.tests COMMAND ${CMAKE_CTEST_COMMAND}) file(GLOB tests_srcs "test*.cpp") + list(REMOVE_ITEM tests_srcs ${tests_exclude}) foreach(test_src ${tests_srcs}) get_filename_component(test_base ${test_src} NAME_WE) set( test_bin tests.${test_base} ) @@ -33,6 +41,7 @@ endif (GTSAM_BUILD_TESTS) if (GTSAM_BUILD_TIMING) add_custom_target(timing.tests) file(GLOB timing_srcs "time*.cpp") + list(REMOVE_ITEM timing_srcs ${tests_exclude}) foreach(time_src ${timing_srcs}) get_filename_component(time_base ${time_src} NAME_WE) set( time_bin tests.${time_base} ) diff --git a/tests/testPose2SLAMwSPCG.cpp b/tests/testPose2SLAMwSPCG.cpp index 58020051d..439228c79 100644 --- a/tests/testPose2SLAMwSPCG.cpp +++ b/tests/testPose2SLAMwSPCG.cpp @@ -14,7 +14,6 @@ using namespace pose2SLAM; const double tol = 1e-5; -#if ENABLE_SPCG /* ************************************************************************* */ TEST(testPose2SLAMwSPCG, example1) { @@ -67,7 +66,6 @@ TEST(testPose2SLAMwSPCG, example1) { EXPECT(assert_equal(expected, actual, tol)); } -#endif /* ************************************************************************* */ int main() { TestResult tr; return TestRegistry::runAllTests(tr); }