update CppUnitLite to not rely on boost

release/4.3a0
Varun Agrawal 2023-02-06 10:48:10 -05:00
parent 798e4c79c4
commit 775d2e877e
5 changed files with 18 additions and 22 deletions

View File

@ -15,8 +15,6 @@
#include "TestResult.h"
#include "Failure.h"
#include <string>
Test::Test (const std::string& testName)
: name_ (testName), next_(0), lineNumber_(-1), safeCheck_(true)
{

View File

@ -144,7 +144,7 @@ std::to_string(actualTemp))); return; } }
double expectedTemp = expected; \
if (!std::isfinite(actualTemp) || !std::isfinite(expectedTemp) || fabs ((expectedTemp)-(actualTemp)) > threshold) \
{ result_.addFailure (Failure (name_, __FILE__, __LINE__, \
std::to_string(expectedTemp), std::to_string(actualTemp))); return; } }
std::to_string((double)expectedTemp), std::to_string((double)actualTemp))); return; } }
/* EXPECTs: tests will continue running after a failure */
@ -164,7 +164,7 @@ std::to_string(actualTemp))); } }
double expectedTemp = expected; \
if (!std::isfinite(actualTemp) || !std::isfinite(expectedTemp) || fabs ((expectedTemp)-(actualTemp)) > threshold) \
{ result_.addFailure (Failure (name_, __FILE__, __LINE__, \
std::to_string(expectedTemp), std::to_string(actualTemp))); } }
std::to_string((double)expectedTemp), std::to_string((double)actualTemp))); } }
#define FAIL(text) \

View File

@ -12,6 +12,6 @@ add_executable(example
)
# By using CMake exported targets, a simple "link" dependency introduces the
# include directories (-I) flags, links against Boost, and add any other
# include directories (-I) flags, and add any other
# required build flags (e.g. C++11, etc.)
target_link_libraries(example PRIVATE gtsam)

View File

@ -2,7 +2,7 @@
# Macro for adding categorized tests in a "tests" folder, with
# optional exclusion of tests and convenience library linking options
#
# By default, all tests are linked with CppUnitLite and boost
# By default, all tests are linked with CppUnitLite
# Arguments:
# - subdir The name of the category for this test
# - local_libs A list of convenience libraries to use (if GTSAM_BUILD_CONVENIENCE_LIBRARIES is true)
@ -32,7 +32,6 @@ endfunction()
# Macro for adding categorized timing scripts in a "tests" folder, with
# optional exclusion of tests and convenience library linking options
#
# By default, all tests are linked with boost
# Arguments:
# - subdir The name of the category for this timing script
# - local_libs A list of convenience libraries to use (if GTSAM_BUILD_CONVENIENCE_LIBRARIES is true)
@ -51,8 +50,7 @@ macro(gtsam_add_subdir_timing subdir local_libs full_libs excluded_srcs)
endmacro()
# Macro for adding executables matching a pattern - builds one executable for
# each file matching the pattern. These exectuables are automatically linked
# with boost.
# each file matching the pattern.
# Arguments:
# - pattern The glob pattern to match source files
# - local_libs A list of convenience libraries to use (if GTSAM_BUILD_CONVENIENCE_LIBRARIES is true)
@ -138,9 +136,9 @@ macro(gtsam_add_grouped_scripts group pattern target_prefix pretty_prefix_name l
# Linking and dependendencies
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
target_link_libraries(${script_bin} ${local_libs} ${GTSAM_BOOST_LIBRARIES})
target_link_libraries(${script_bin} ${local_libs})
else()
target_link_libraries(${script_bin} ${full_libs} ${GTSAM_BOOST_LIBRARIES})
target_link_libraries(${script_bin} ${full_libs})
endif()
# Add .run target

View File

@ -71,17 +71,17 @@ TEST(Lago, findMinimumSpanningTree) {
auto gPlus = initialize::buildPoseGraph<Pose2>(g);
lago::PredecessorMap tree = lago::findMinimumSpanningTree(gPlus);
// We should recover the following spanning tree:
//
// x2
// / \
// / \
// x3 x1
// /
// /
// x0
// |
// a
/* We should recover the following spanning tree:
x2
/ \
/ \
x3 x1
/
/
x0
|
a
*/
using initialize::kAnchorKey;
EXPECT_LONGS_EQUAL(kAnchorKey, tree[kAnchorKey]);
EXPECT_LONGS_EQUAL(kAnchorKey, tree[x0]);