diff --git a/cpp/FactorGraph-inl.h b/cpp/FactorGraph-inl.h index 2b30b983e..d59af0168 100644 --- a/cpp/FactorGraph-inl.h +++ b/cpp/FactorGraph-inl.h @@ -12,6 +12,7 @@ #include #include +#include #include #include #include diff --git a/cpp/Makefile.am b/cpp/Makefile.am index 63d3e291b..101a6834c 100644 --- a/cpp/Makefile.am +++ b/cpp/Makefile.am @@ -64,13 +64,15 @@ example = smallExample.cpp headers += inference.h inference-inl.h headers += FactorGraph.h FactorGraph-inl.h headers += BayesNet.h BayesNet-inl.h BayesTree.h BayesTree-inl.h -check_PROGRAMS += testFactorgraph testBayesTree testInference +check_PROGRAMS += testFactorgraph testBayesTree testInference testIncremental testFactorgraph_SOURCES = testFactorgraph.cpp testBayesTree_SOURCES = $(example) testBayesTree.cpp testInference_SOURCES = $(example) testInference.cpp +testIncremental_SOURCES = $(example) testIncremental.cpp testFactorgraph_LDADD = libgtsam.la testBayesTree_LDADD = libgtsam.la testInference_LDADD = libgtsam.la +testIncremental_LDADD = libgtsam.la # Symbolic Inference headers += SymbolicConditional.h diff --git a/cpp/testIncremental.cpp b/cpp/testIncremental.cpp new file mode 100644 index 000000000..67b65bda8 --- /dev/null +++ b/cpp/testIncremental.cpp @@ -0,0 +1,53 @@ +/** + * @file testIncremental.cpp + * @brief Unit tests for graph-based iSAM + * @author Michael Kaess + */ + +#include // for operator += +using namespace boost::assign; + +#include + +#include "SymbolicBayesNet.h" +#include "GaussianBayesNet.h" +#include "Ordering.h" +#include "BayesTree-inl.h" +#include "smallExample.h" + +using namespace gtsam; + +typedef BayesTree SymbolicBayesTree; +typedef BayesTree GaussianBayesTree; + + + +// todo: copied from testBayesTree + + +// Conditionals for ASIA example from the tutorial with A and D evidence +SymbolicConditional::shared_ptr B(new SymbolicConditional("B")), L( + new SymbolicConditional("L", "B")), E( + new SymbolicConditional("E", "L", "B")), S(new SymbolicConditional("S", + "L", "B")), T(new SymbolicConditional("T", "E", "L")), X( + new SymbolicConditional("X", "E")); + +/* ************************************************************************* */ +TEST( BayesTree, Front ) +{ + SymbolicBayesNet f1; + f1.push_back(B); + f1.push_back(L); + SymbolicBayesNet f2; + f2.push_back(L); + f2.push_back(B); + CHECK(f1.equals(f1)); + CHECK(!f1.equals(f2)); +} + +/* ************************************************************************* */ +int main() { + TestResult tr; + return TestRegistry::runAllTests(tr); +} +/* ************************************************************************* */