fix tests
parent
3fe2682d93
commit
2f3fcff916
|
|
@ -25,6 +25,7 @@
|
||||||
#include <gtsam/base/serializationTestHelpers.h>
|
#include <gtsam/base/serializationTestHelpers.h>
|
||||||
#include <gtsam/discrete/DecisionTree-inl.h>
|
#include <gtsam/discrete/DecisionTree-inl.h>
|
||||||
#include <gtsam/discrete/Signature.h>
|
#include <gtsam/discrete/Signature.h>
|
||||||
|
#include <gtsam/inference/Symbol.h>
|
||||||
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
|
|
@ -531,38 +532,6 @@ TEST(DecisionTree, ApplyWithAssignment) {
|
||||||
EXPECT_LONGS_EQUAL(5, count);
|
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() {
|
int main() {
|
||||||
TestResult tr;
|
TestResult tr;
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,8 @@ TEST(MixtureFactor, Printing) {
|
||||||
R"(Hybrid [x1 x2; 1]
|
R"(Hybrid [x1 x2; 1]
|
||||||
MixtureFactor
|
MixtureFactor
|
||||||
Choice(1)
|
Choice(1)
|
||||||
0 Leaf Nonlinear factor on 2 keys
|
0 Leaf [1]Nonlinear factor on 2 keys
|
||||||
1 Leaf Nonlinear factor on 2 keys
|
1 Leaf [1]Nonlinear factor on 2 keys
|
||||||
)";
|
)";
|
||||||
EXPECT(assert_print_equal(expected, mixtureFactor));
|
EXPECT(assert_print_equal(expected, mixtureFactor));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue