diff --git a/gtsam/hybrid/tests/testHybridGaussianConditional.cpp b/gtsam/hybrid/tests/testHybridGaussianConditional.cpp index 88a4fa485..fafbce525 100644 --- a/gtsam/hybrid/tests/testHybridGaussianConditional.cpp +++ b/gtsam/hybrid/tests/testHybridGaussianConditional.cpp @@ -318,21 +318,27 @@ TEST(HybridGaussianConditional, Restrict) { const auto hc = std::make_shared(two_mode_measurement::hgc); - const HybridConditional::shared_ptr same = hc->restrict({}); + const auto same = + std::dynamic_pointer_cast(hc->restrict({})); + CHECK(same); EXPECT(same->isHybrid()); EXPECT(same->asHybrid()->nrComponents() == 4); - const HybridConditional::shared_ptr oneParent = hc->restrict({{M(1), 0}}); + const auto oneParent = + std::dynamic_pointer_cast(hc->restrict({{M(1), 0}})); + CHECK(oneParent); EXPECT(oneParent->isHybrid()); EXPECT(oneParent->asHybrid()->nrComponents() == 2); - const HybridConditional::shared_ptr oneParent2 = - hc->restrict({{M(7), 0}, {M(1), 0}}); + const auto oneParent2 = std::dynamic_pointer_cast( + hc->restrict({{M(7), 0}, {M(1), 0}})); + CHECK(oneParent2); EXPECT(oneParent2->isHybrid()); EXPECT(oneParent2->asHybrid()->nrComponents() == 2); - const HybridConditional::shared_ptr gaussian = - hc->restrict({{M(1), 0}, {M(2), 1}}); + const auto gaussian = std::dynamic_pointer_cast( + hc->restrict({{M(1), 0}, {M(2), 1}})); + CHECK(gaussian); EXPECT(gaussian->asGaussian()); } diff --git a/gtsam/hybrid/tests/testHybridSmoother.cpp b/gtsam/hybrid/tests/testHybridSmoother.cpp index 97a302faf..0d3608e40 100644 --- a/gtsam/hybrid/tests/testHybridSmoother.cpp +++ b/gtsam/hybrid/tests/testHybridSmoother.cpp @@ -102,12 +102,16 @@ TEST(HybridSmoother, IncrementalSmoother) { graph.resize(0); } - EXPECT_LONGS_EQUAL(11, - smoother.hybridBayesNet().at(5)->asDiscrete()->nrValues()); + auto& hybridBayesNet = smoother.hybridBayesNet(); +#ifdef GTSAM_DT_MERGING + EXPECT_LONGS_EQUAL(11, hybridBayesNet.at(5)->asDiscrete()->nrValues()); +#else + EXPECT_LONGS_EQUAL(16, hybridBayesNet.at(5)->asDiscrete()->nrValues()); +#endif // Get the continuous delta update as well as // the optimal discrete assignment. - HybridValues delta = smoother.hybridBayesNet().optimize(); + HybridValues delta = hybridBayesNet.optimize(); // Check discrete assignment DiscreteValues expected_discrete; @@ -156,8 +160,12 @@ TEST(HybridSmoother, ValidPruningError) { graph.resize(0); } - EXPECT_LONGS_EQUAL(14, - smoother.hybridBayesNet().at(8)->asDiscrete()->nrValues()); + auto& hybridBayesNet = smoother.hybridBayesNet(); +#ifdef GTSAM_DT_MERGING + EXPECT_LONGS_EQUAL(14, hybridBayesNet.at(8)->asDiscrete()->nrValues()); +#else + EXPECT_LONGS_EQUAL(128, hybridBayesNet.at(8)->asDiscrete()->nrValues()); +#endif // Get the continuous delta update as well as // the optimal discrete assignment.