From df64982d7227142370f97c8600a3608840c72aa3 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 23 Aug 2022 12:17:42 -0400 Subject: [PATCH] add extra tests --- gtsam/hybrid/tests/testHybridLookupDAG.cpp | 2 +- .../tests/testHybridNonlinearFactorGraph.cpp | 15 +++++++++++++++ gtsam/hybrid/tests/testHybridValues.cpp | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gtsam/hybrid/tests/testHybridLookupDAG.cpp b/gtsam/hybrid/tests/testHybridLookupDAG.cpp index c472aa22f5..0ab012d104 100644 --- a/gtsam/hybrid/tests/testHybridLookupDAG.cpp +++ b/gtsam/hybrid/tests/testHybridLookupDAG.cpp @@ -269,4 +269,4 @@ int main() { TestResult tr; return TestRegistry::runAllTests(tr); } -/* ************************************************************************* */ \ No newline at end of file +/* ************************************************************************* */ diff --git a/gtsam/hybrid/tests/testHybridNonlinearFactorGraph.cpp b/gtsam/hybrid/tests/testHybridNonlinearFactorGraph.cpp index c10310b5ed..018b017a9d 100644 --- a/gtsam/hybrid/tests/testHybridNonlinearFactorGraph.cpp +++ b/gtsam/hybrid/tests/testHybridNonlinearFactorGraph.cpp @@ -188,7 +188,22 @@ TEST(HybridFactorGraph, PushBack) { ghfg = HybridGaussianFactorGraph(); ghfg.push_back(dcFactor); + HybridGaussianFactorGraph hgfg2; + hgfg2.push_back(ghfg.begin(), ghfg.end()); + EXPECT_LONGS_EQUAL(ghfg.size(), 1); + + HybridNonlinearFactorGraph hnfg; + NonlinearFactorGraph factors; + auto noise = noiseModel::Isotropic::Sigma(3, 1.0); + factors.emplace_shared>(0, Pose2(0, 0, 0), noise); + factors.emplace_shared>(1, Pose2(1, 0, 0), noise); + factors.emplace_shared>(2, Pose2(2, 0, 0), noise); + // TODO(Varun) This does not currently work. It should work once HybridFactor + // becomes a base class of NonlinearFactor. + // hnfg.push_back(factors.begin(), factors.end()); + + // EXPECT_LONGS_EQUAL(3, hnfg.size()); } /**************************************************************************** diff --git a/gtsam/hybrid/tests/testHybridValues.cpp b/gtsam/hybrid/tests/testHybridValues.cpp index 9581faaa09..6f510601d4 100644 --- a/gtsam/hybrid/tests/testHybridValues.cpp +++ b/gtsam/hybrid/tests/testHybridValues.cpp @@ -55,4 +55,4 @@ int main() { TestResult tr; return TestRegistry::runAllTests(tr); } -/* ************************************************************************* */ \ No newline at end of file +/* ************************************************************************* */