From d8def4c164a5b56212d8fd81c377174ecf4edf64 Mon Sep 17 00:00:00 2001 From: Tal Regev Date: Tue, 18 Jul 2023 05:20:58 +0300 Subject: [PATCH] fix more tests --- .github/workflows/build-windows.yml | 4 ++++ gtsam/inference/Ordering.h | 26 +++++++++++++------------- gtsam/navigation/tests/CMakeLists.txt | 3 +++ gtsam/nonlinear/tests/CMakeLists.txt | 3 +++ gtsam/sfm/tests/CMakeLists.txt | 4 +++- gtsam/symbolic/tests/CMakeLists.txt | 3 +++ 6 files changed, 29 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 7123d6eeaa..a97916cba6 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -120,11 +120,15 @@ jobs: cmake --build build -j4 --config ${{ matrix.build_type }} --target check.inference cmake --build build -j4 --config ${{ matrix.build_type }} --target check.linear cmake --build build -j4 --config ${{ matrix.build_type }} --target check.navigation + cmake --build build -j4 --config ${{ matrix.build_type }} --target check.navigation2 cmake --build build -j4 --config ${{ matrix.build_type }} --target check.sam cmake --build build -j4 --config ${{ matrix.build_type }} --target check.sfm + cmake --build build -j4 --config ${{ matrix.build_type }} --target check.sfm2 cmake --build build -j4 --config ${{ matrix.build_type }} --target check.symbolic + cmake --build build -j4 --config ${{ matrix.build_type }} --target check.symbolic2 cmake --build build -j4 --config ${{ matrix.build_type }} --target check.hybrid cmake --build build -j4 --config ${{ matrix.build_type }} --target check.nonlinear + cmake --build build -j4 --config ${{ matrix.build_type }} --target check.nonlinear2 cmake --build build -j4 --config ${{ matrix.build_type }} --target check.slam # Run GTSAM_UNSTABLE tests diff --git a/gtsam/inference/Ordering.h b/gtsam/inference/Ordering.h index 574a4c19b1..ac6fc775ff 100644 --- a/gtsam/inference/Ordering.h +++ b/gtsam/inference/Ordering.h @@ -30,7 +30,7 @@ namespace gtsam { -class Ordering: public KeyVector { +class GTSAM_EXPORT Ordering: public KeyVector { protected: typedef KeyVector Base; @@ -45,7 +45,7 @@ class Ordering: public KeyVector { typedef std::shared_ptr shared_ptr; ///< shared_ptr to this class /// Create an empty ordering - GTSAM_EXPORT + Ordering() { } @@ -71,11 +71,11 @@ class Ordering: public KeyVector { * @param keys The key vector to append to this ordering. * @return The ordering variable with appended keys. */ - GTSAM_EXPORT + This& operator+=(KeyVector& keys); /// Check if key exists in ordering. - GTSAM_EXPORT + bool contains(const Key& key) const; /** @@ -101,7 +101,7 @@ class Ordering: public KeyVector { } /// Compute a fill-reducing ordering using COLAMD from a VariableIndex. - static GTSAM_EXPORT Ordering Colamd(const VariableIndex& variableIndex); + static Ordering Colamd(const VariableIndex& variableIndex); /// Compute a fill-reducing ordering using constrained COLAMD from a factor graph (see details /// for note on performance). This internally builds a VariableIndex so if you already have a @@ -126,7 +126,7 @@ class Ordering: public KeyVector { /// variables in \c constrainLast will be ordered in the same order specified in the KeyVector /// \c constrainLast. If \c forceOrder is false, the variables in \c constrainLast will be /// ordered after all the others, but will be rearranged by CCOLAMD to reduce fill-in as well. - static GTSAM_EXPORT Ordering ColamdConstrainedLast( + static Ordering ColamdConstrainedLast( const VariableIndex& variableIndex, const KeyVector& constrainLast, bool forceOrder = false); @@ -154,7 +154,7 @@ class Ordering: public KeyVector { /// KeyVector \c constrainFirst. If \c forceOrder is false, the variables in \c /// constrainFirst will be ordered before all the others, but will be rearranged by CCOLAMD to /// reduce fill-in as well. - static GTSAM_EXPORT Ordering ColamdConstrainedFirst( + static Ordering ColamdConstrainedFirst( const VariableIndex& variableIndex, const KeyVector& constrainFirst, bool forceOrder = false); @@ -183,7 +183,7 @@ class Ordering: public KeyVector { /// appear in \c groups in arbitrary order. Any variables not present in \c groups will be /// assigned to group 0. This function simply fills the \c cmember argument to CCOLAMD with the /// supplied indices, see the CCOLAMD documentation for more information. - static GTSAM_EXPORT Ordering ColamdConstrained( + static Ordering ColamdConstrained( const VariableIndex& variableIndex, const FastMap& groups); /// Return a natural Ordering. Typically used by iterative solvers @@ -197,11 +197,11 @@ class Ordering: public KeyVector { /// METIS Formatting function template - static GTSAM_EXPORT void CSRFormat(std::vector& xadj, + static void CSRFormat(std::vector& xadj, std::vector& adj, const FACTOR_GRAPH& graph); /// Compute an ordering determined by METIS from a VariableIndex - static GTSAM_EXPORT Ordering Metis(const MetisIndex& met); + static Ordering Metis(const MetisIndex& met); template static Ordering Metis(const FACTOR_GRAPH& graph) { @@ -243,18 +243,18 @@ class Ordering: public KeyVector { /// @name Testable /// @{ - GTSAM_EXPORT + void print(const std::string& str = "", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const; - GTSAM_EXPORT + bool equals(const Ordering& other, double tol = 1e-9) const; /// @} private: /// Internal COLAMD function - static GTSAM_EXPORT Ordering ColamdConstrained( + static Ordering ColamdConstrained( const VariableIndex& variableIndex, std::vector& cmember); #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION diff --git a/gtsam/navigation/tests/CMakeLists.txt b/gtsam/navigation/tests/CMakeLists.txt index a7212da34c..720fc92c59 100644 --- a/gtsam/navigation/tests/CMakeLists.txt +++ b/gtsam/navigation/tests/CMakeLists.txt @@ -29,4 +29,7 @@ if (NOT GTSAM_ENABLE_BOOST_SERIALIZATION) list(APPEND tests_excluded testSerializationNavigation.cpp) endif() +list(APPEND tests_excluded testImuFactor.cpp testMagPoseFactor.cpp) + gtsamAddTestsGlob(navigation "test*.cpp" "${tests_excluded}" "${test_link_libraries}") +gtsamAddTestsGlob(navigation2 "testImuFactor.cpp testMagPoseFactor.cpp" "" "${test_link_libraries}") diff --git a/gtsam/nonlinear/tests/CMakeLists.txt b/gtsam/nonlinear/tests/CMakeLists.txt index 4dcd5f4e9c..06fa6ba6ef 100644 --- a/gtsam/nonlinear/tests/CMakeLists.txt +++ b/gtsam/nonlinear/tests/CMakeLists.txt @@ -6,4 +6,7 @@ else() set(EXCLUDE_TESTS "") endif() +list(APPEND EXCLUDE_TESTS testExpression.cpp) + gtsamAddTestsGlob(nonlinear "test*.cpp" "${EXCLUDE_TESTS}" "gtsam") +gtsamAddTestsGlob(nonlinear2 "testExpression.cpp" "" "gtsam") diff --git a/gtsam/sfm/tests/CMakeLists.txt b/gtsam/sfm/tests/CMakeLists.txt index 22245dffec..05e3007bec 100644 --- a/gtsam/sfm/tests/CMakeLists.txt +++ b/gtsam/sfm/tests/CMakeLists.txt @@ -1 +1,3 @@ -gtsamAddTestsGlob(sfm "test*.cpp" "" "gtsam") +set(tests_excluded testMFAS.cpp testBinaryMeasurement.cpp) +gtsamAddTestsGlob(sfm "test*.cpp" "${tests_excluded}" "gtsam") +gtsamAddTestsGlob(sfm2 "testBinaryMeasurement.cpp testMFAS.cpp" "" "gtsam") diff --git a/gtsam/symbolic/tests/CMakeLists.txt b/gtsam/symbolic/tests/CMakeLists.txt index 65a7cf719c..bc6de8ed47 100644 --- a/gtsam/symbolic/tests/CMakeLists.txt +++ b/gtsam/symbolic/tests/CMakeLists.txt @@ -6,4 +6,7 @@ else() set(EXCLUDE_TESTS "") endif() +list(APPEND EXCLUDE_TESTS testSymbolicConditional.cpp) + gtsamAddTestsGlob(symbolic "test*.cpp" "${EXCLUDE_TESTS}" "gtsam") +gtsamAddTestsGlob(symbolic2 "testSymbolicConditional.cpp" "" "gtsam")