From 878c626a96cbabdeff0fe2b5665548bd65576357 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 10 Oct 2024 09:32:55 -0400 Subject: [PATCH] fix test TODOs --- .../tests/testHybridGaussianProductFactor.cpp | 15 ++++++++++----- .../tests/testHybridNonlinearFactorGraph.cpp | 2 -- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gtsam/hybrid/tests/testHybridGaussianProductFactor.cpp b/gtsam/hybrid/tests/testHybridGaussianProductFactor.cpp index f41c5f0aa2..3a4a6c1f41 100644 --- a/gtsam/hybrid/tests/testHybridGaussianProductFactor.cpp +++ b/gtsam/hybrid/tests/testHybridGaussianProductFactor.cpp @@ -128,7 +128,10 @@ TEST(HybridGaussianProductFactor, AsProductFactor) { EXPECT(actual.first.at(0) == f10); EXPECT_DOUBLES_EQUAL(10, actual.second, 1e-9); - // TODO(Frank): when killed hiding, f11 should also be there + mode[m1.first] = 1; + actual = product(mode); + EXPECT(actual.first.at(0) == f11); + EXPECT_DOUBLES_EQUAL(11, actual.second, 1e-9); } /* ************************************************************************* */ @@ -145,7 +148,10 @@ TEST(HybridGaussianProductFactor, AddOne) { EXPECT(actual.first.at(0) == f10); EXPECT_DOUBLES_EQUAL(10, actual.second, 1e-9); - // TODO(Frank): when killed hiding, f11 should also be there + mode[m1.first] = 1; + actual = product(mode); + EXPECT(actual.first.at(0) == f11); + EXPECT_DOUBLES_EQUAL(11, actual.second, 1e-9); } /* ************************************************************************* */ @@ -166,9 +172,8 @@ TEST(HybridGaussianProductFactor, AddTwo) { EXPECT_DOUBLES_EQUAL(10 + 20, actual00.second, 1e-9); auto actual12 = product({{M(1), 1}, {M(2), 2}}); - // TODO(Frank): when killed hiding, these should also equal: - // EXPECT(actual12.first.at(0) == f11); - // EXPECT(actual12.first.at(1) == f22); + EXPECT(actual12.first.at(0) == f11); + EXPECT(actual12.first.at(1) == f22); EXPECT_DOUBLES_EQUAL(11 + 22, actual12.second, 1e-9); } diff --git a/gtsam/hybrid/tests/testHybridNonlinearFactorGraph.cpp b/gtsam/hybrid/tests/testHybridNonlinearFactorGraph.cpp index bbf427ecb2..e77476e258 100644 --- a/gtsam/hybrid/tests/testHybridNonlinearFactorGraph.cpp +++ b/gtsam/hybrid/tests/testHybridNonlinearFactorGraph.cpp @@ -973,8 +973,6 @@ TEST(HybridNonlinearFactorGraph, DifferentMeans) { VectorValues cont0 = bn->optimize(dv0); double error0 = bn->error(HybridValues(cont0, dv0)); - // TODO(Varun) Perform importance sampling to estimate error? - // regression EXPECT_DOUBLES_EQUAL(0.69314718056, error0, 1e-9);