From cb9cec30e39895b4745a4727aa896718dcccc467 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 3 Jan 2025 13:28:21 -0500 Subject: [PATCH] unit test exposing division bug --- gtsam/discrete/tests/testDecisionTreeFactor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gtsam/discrete/tests/testDecisionTreeFactor.cpp b/gtsam/discrete/tests/testDecisionTreeFactor.cpp index 1828db525..73420c860 100644 --- a/gtsam/discrete/tests/testDecisionTreeFactor.cpp +++ b/gtsam/discrete/tests/testDecisionTreeFactor.cpp @@ -69,6 +69,15 @@ TEST(DecisionTreeFactor, constructors) { EXPECT_DOUBLES_EQUAL(0.8, f4(x121), 1e-9); } +/* ************************************************************************* */ +TEST(DecisionTreeFactor, Divide) { + DiscreteKey A(0, 2), S(1, 2); + DecisionTreeFactor pA(A % "99/1"), pS(S % "50/50"); + DecisionTreeFactor joint = pA * pS; + DecisionTreeFactor s = joint / pA; + EXPECT(assert_equal(pS, s)); +} + /* ************************************************************************* */ TEST(DecisionTreeFactor, Error) { // Declare a bunch of keys