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 /* ************************************************************************* */
TestRegistry::runAllTests
static int runAllTests(TestResult &result)
Definition: TestRegistry.cpp:27
SymbolicEliminationTree.h
EXPECT
#define EXPECT(condition)
Definition: Test.h:150
TestHarness.h
SymbolicJunctionTree.h
TestableAssertions.h
Provides additional testing facilities for common data structures.
gtsam::SymbolicJunctionTree
Definition: SymbolicJunctionTree.h:50
SymbolicFactorGraph.h
TestResult
Definition: TestResult.h:26
gtsam
traits
Definition: SFMdata.h:40
gtsam::TEST
TEST(SmartFactorBase, Pinhole)
Definition: testSmartFactorBase.cpp:38
main
int main()
Definition: testSymbolicJunctionTree.cpp:58
symbolicExampleGraphs.h
constructor
Definition: init.h:200
gtsam::JunctionTree
Definition: JunctionTree.h:50
std
Definition: BFloat16.h:88
gtsam::assert_container_equality
bool assert_container_equality(const std::map< size_t, V2 > &expected, const std::map< size_t, V2 > &actual)
Definition: TestableAssertions.h:237
gtsam::assert_equal
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:41
gtsam::Ordering
Definition: inference/Ordering.h:33
LONGS_EQUAL
#define LONGS_EQUAL(expected, actual)
Definition: Test.h:134
gtsam::SymbolicEliminationTree
Definition: SymbolicEliminationTree.h:27


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:17:31