Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal committed Jul 17, 2023
1 parent 3fe2682 commit 2f3fcff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
33 changes: 1 addition & 32 deletions gtsam/discrete/tests/testDecisionTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <gtsam/base/serializationTestHelpers.h>
#include <gtsam/discrete/DecisionTree-inl.h>
#include <gtsam/discrete/Signature.h>
#include <gtsam/inference/Symbol.h>

#include <iomanip>

Expand Down Expand Up @@ -531,38 +532,6 @@ TEST(DecisionTree, ApplyWithAssignment) {
EXPECT_LONGS_EQUAL(5, count);
}

/* ************************************************************************** */
// Test number of assignments.
TEST(DecisionTree, NrAssignments2) {
using gtsam::symbol_shorthand::M;

std::vector<double> probs = {0, 0, 1, 2};

/* Create the decision tree
Choice(m1)
0 Leaf 0.000000
1 Choice(m0)
1 0 Leaf 1.000000
1 1 Leaf 2.000000
*/
DiscreteKeys keys{{M(1), 2}, {M(0), 2}};
DecisionTree<Key, double> dt1(keys, probs);
EXPECT_LONGS_EQUAL(4, dt1.nrAssignments());

/* Create the DecisionTree
Choice(m1)
0 Choice(m0)
0 0 Leaf 0.000000
0 1 Leaf 1.000000
1 Choice(m0)
1 0 Leaf 0.000000
1 1 Leaf 2.000000
*/
DiscreteKeys keys2{{M(0), 2}, {M(1), 2}};
DecisionTree<Key, double> dt2(keys2, probs);
EXPECT_LONGS_EQUAL(4, dt2.nrAssignments());
}

/* ************************************************************************* */
int main() {
TestResult tr;
Expand Down
4 changes: 2 additions & 2 deletions gtsam/hybrid/tests/testMixtureFactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ TEST(MixtureFactor, Printing) {
R"(Hybrid [x1 x2; 1]
MixtureFactor
Choice(1)
0 Leaf Nonlinear factor on 2 keys
1 Leaf Nonlinear factor on 2 keys
0 Leaf [1]Nonlinear factor on 2 keys
1 Leaf [1]Nonlinear factor on 2 keys
)";
EXPECT(assert_print_equal(expected, mixtureFactor));
}
Expand Down

0 comments on commit 2f3fcff

Please sign in to comment.