testSymbolicJunctionTree.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
21 
25 
26 #include "symbolicExampleGraphs.h"
27 
28 using namespace gtsam;
29 using namespace std;
30 
31 /* ************************************************************************* *
32  * 1 - 0 - 2 - 3
33  * 2 3
34  * 0 1 : 2
35  ****************************************************************************/
37 {
38  const Ordering order{0, 1, 2, 3};
39 
40  SymbolicJunctionTree actual(SymbolicEliminationTree(simpleChain, order));
41 
42  SymbolicJunctionTree::Node::Keys
43  frontal1 {2, 3},
44  frontal2 {0, 1},
45  sep1, sep2 {2};
46  EXPECT(assert_container_equality(frontal1, actual.roots().front()->orderedFrontalKeys));
47  //EXPECT(assert_equal(sep1, actual.roots().front()->separator));
48  LONGS_EQUAL(1, (long)actual.roots().front()->factors.size());
49  EXPECT(assert_container_equality(frontal2, actual.roots().front()->children.front()->orderedFrontalKeys));
50  //EXPECT(assert_equal(sep2, actual.roots().front()->children.front()->separator));
51  LONGS_EQUAL(2, (long)actual.roots().front()->children.front()->factors.size());
52  EXPECT(assert_equal(*simpleChain[2], *actual.roots().front()->factors[0]));
53  EXPECT(assert_equal(*simpleChain[0], *actual.roots().front()->children.front()->factors[0]));
54  EXPECT(assert_equal(*simpleChain[1], *actual.roots().front()->children.front()->factors[1]));
55 }
56 
57 /* ************************************************************************* */
58 int main() {
59  TestResult tr;
60  return TestRegistry::runAllTests(tr);
61 }
62 /* ************************************************************************* */
Provides additional testing facilities for common data structures.
static int runAllTests(TestResult &result)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:40
Definition: BFloat16.h:88
bool assert_container_equality(const std::map< size_t, V2 > &expected, const std::map< size_t, V2 > &actual)
const FastVector< sharedNode > & roots() const
Definition: ClusterTree.h:159
#define EXPECT(condition)
Definition: Test.h:150
#define LONGS_EQUAL(expected, actual)
Definition: Test.h:134
traits
Definition: chartTesting.h:28
TEST(SmartFactorBase, Pinhole)


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:39:43