added missing include to satisfy stricter compiler; added isam test file

release/4.3a0
Michael Kaess 2009-11-17 21:47:42 +00:00
parent 4f7d31986c
commit f56bf8c79f
3 changed files with 57 additions and 1 deletions

View File

@ -12,6 +12,7 @@
#include <list>
#include <sstream>
#include <stdexcept>
#include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp>
#include <colamd/colamd.h>

View File

@ -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

53
cpp/testIncremental.cpp Normal file
View File

@ -0,0 +1,53 @@
/**
* @file testIncremental.cpp
* @brief Unit tests for graph-based iSAM
* @author Michael Kaess
*/
#include <boost/assign/std/list.hpp> // for operator +=
using namespace boost::assign;
#include <CppUnitLite/TestHarness.h>
#include "SymbolicBayesNet.h"
#include "GaussianBayesNet.h"
#include "Ordering.h"
#include "BayesTree-inl.h"
#include "smallExample.h"
using namespace gtsam;
typedef BayesTree<SymbolicConditional> SymbolicBayesTree;
typedef BayesTree<GaussianConditional> 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);
}
/* ************************************************************************* */