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 <boost/assign/list_of.hpp>
27 using namespace boost::assign;
28 
29 #include "symbolicExampleGraphs.h"
30 
31 using namespace gtsam;
32 using namespace std;
33 
34 /* ************************************************************************* *
35  * 1 - 0 - 2 - 3
36  * 2 3
37  * 0 1 : 2
38  ****************************************************************************/
40 {
41  Ordering order; order += 0, 1, 2, 3;
42 
43  SymbolicJunctionTree actual(SymbolicEliminationTree(simpleChain, order));
44 
45  SymbolicJunctionTree::Node::Keys
46  frontal1 = list_of(2)(3),
47  frontal2 = list_of(0)(1),
48  sep1, sep2 = list_of(2);
49  EXPECT(assert_container_equality(frontal1, actual.roots().front()->orderedFrontalKeys));
50  //EXPECT(assert_equal(sep1, actual.roots().front()->separator));
51  LONGS_EQUAL(1, (long)actual.roots().front()->factors.size());
52  EXPECT(assert_container_equality(frontal2, actual.roots().front()->children.front()->orderedFrontalKeys));
53  //EXPECT(assert_equal(sep2, actual.roots().front()->children.front()->separator));
54  LONGS_EQUAL(2, (long)actual.roots().front()->children.front()->factors.size());
55  EXPECT(assert_equal(*simpleChain[2], *actual.roots().front()->factors[0]));
56  EXPECT(assert_equal(*simpleChain[0], *actual.roots().front()->children.front()->factors[0]));
57  EXPECT(assert_equal(*simpleChain[1], *actual.roots().front()->children.front()->factors[1]));
58 }
59 
60 /* ************************************************************************* */
61 int main() {
62  TestResult tr;
63  return TestRegistry::runAllTests(tr);
64 }
65 /* ************************************************************************* */
Provides additional testing facilities for common data structures.
static int runAllTests(TestResult &result)
Definition: Half.h:150
bool assert_container_equality(const std::map< size_t, V2 > &expected, const std::map< size_t, V2 > &actual)
#define EXPECT(condition)
Definition: Test.h:151
#define LONGS_EQUAL(expected, actual)
Definition: Test.h:135
traits
Definition: chartTesting.h:28
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:42
TEST(JunctionTree, constructor)
const FastVector< sharedNode > & roots() const
Definition: ClusterTree.h:160


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:49:57