From 3ee46ec2802dd4cfc396307e938483c05bff82b8 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Wed, 28 Jun 2023 18:24:39 -0400 Subject: [PATCH] test to construct DecisionTreeFactor from DiscreteConditional --- gtsam/discrete/tests/testDecisionTreeFactor.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gtsam/discrete/tests/testDecisionTreeFactor.cpp b/gtsam/discrete/tests/testDecisionTreeFactor.cpp index 3dbb3e64f..57584a03b 100644 --- a/gtsam/discrete/tests/testDecisionTreeFactor.cpp +++ b/gtsam/discrete/tests/testDecisionTreeFactor.cpp @@ -51,6 +51,11 @@ TEST( DecisionTreeFactor, constructors) // Assert that error = -log(value) EXPECT_DOUBLES_EQUAL(-log(f1(values)), f1.error(values), 1e-9); + + // Construct from DiscreteConditional + DiscreteConditional conditional(X | Y = "1/1 2/3 1/4"); + DecisionTreeFactor f4(conditional); + EXPECT_DOUBLES_EQUAL(0.8, f4(values), 1e-9); } /* ************************************************************************* */