diff --git a/gtsam/discrete/tests/testDecisionTreeFactor.cpp b/gtsam/discrete/tests/testDecisionTreeFactor.cpp index dc18e0ab2..7210622d8 100644 --- a/gtsam/discrete/tests/testDecisionTreeFactor.cpp +++ b/gtsam/discrete/tests/testDecisionTreeFactor.cpp @@ -30,6 +30,12 @@ using namespace std; using namespace gtsam; +/** Convert Signature into CPT */ +DecisionTreeFactor create(const Signature& signature) { + DecisionTreeFactor p(signature.discreteKeys(), signature.cpt()); + return p; +} + /* ************************************************************************* */ TEST(DecisionTreeFactor, ConstructorsMatch) { // Declare two keys @@ -69,15 +75,6 @@ TEST(DecisionTreeFactor, constructors) { EXPECT_DOUBLES_EQUAL(0.8, f4(x121), 1e-9); } -/* ************************************************************************* */ -TEST(DecisionTreeFactor, Divide) { - DiscreteKey A(0, 2), S(1, 2); - DecisionTreeFactor pA = create(A % "99/1"), pS = create(S % "50/50"); - DecisionTreeFactor joint = pA * pS; - DecisionTreeFactor s = joint / pA; - EXPECT(assert_equal(pS, s)); -} - /* ************************************************************************* */ TEST(DecisionTreeFactor, Error) { // Declare a bunch of keys @@ -114,6 +111,15 @@ TEST(DecisionTreeFactor, multiplication) { CHECK(assert_equal(expected2, actual)); } +/* ************************************************************************* */ +TEST(DecisionTreeFactor, Divide) { + DiscreteKey A(0, 2), S(1, 2); + DecisionTreeFactor pA = create(A % "99/1"), pS = create(S % "50/50"); + DecisionTreeFactor joint = pA * pS; + DecisionTreeFactor s = joint / pA; + EXPECT(assert_equal(pS, s)); +} + /* ************************************************************************* */ TEST(DecisionTreeFactor, sum_max) { DiscreteKey v0(0, 3), v1(1, 2); @@ -226,12 +232,6 @@ void maybeSaveDotFile(const DecisionTreeFactor& f, const string& filename) { #endif } -/** Convert Signature into CPT */ -DecisionTreeFactor create(const Signature& signature) { - DecisionTreeFactor p(signature.discreteKeys(), signature.cpt()); - return p; -} - /* ************************************************************************* */ // test Asia Joint TEST(DecisionTreeFactor, joint) {