diff --git a/gtsam/symbolic/tests/testConditional.cpp b/gtsam/symbolic/tests/testSymbolicConditional.cpp similarity index 65% rename from gtsam/symbolic/tests/testConditional.cpp rename to gtsam/symbolic/tests/testSymbolicConditional.cpp index 5ee695bb5..9a8e3daec 100644 --- a/gtsam/symbolic/tests/testConditional.cpp +++ b/gtsam/symbolic/tests/testSymbolicConditional.cpp @@ -10,86 +10,84 @@ * -------------------------------------------------------------------------- */ /** - * @file testConditional.cpp - * @brief Unit tests for IndexConditional class + * @file testSymbolicConditional.cpp + * @brief Unit tests for SymbolicConditional class * @author Frank Dellaert */ -#include // for operator += -#include // for operator += +#include using namespace boost::assign; +#include #include -#include -#include +#include using namespace std; using namespace gtsam; /* ************************************************************************* */ -TEST( IndexConditional, empty ) +TEST( SymbolicConditional, empty ) { - IndexConditional c0; + SymbolicConditionalUnordered c0; LONGS_EQUAL(0,c0.nrFrontals()) LONGS_EQUAL(0,c0.nrParents()) } /* ************************************************************************* */ -TEST( IndexConditional, noParents ) +TEST( SymbolicConditional, noParents ) { - IndexConditional c0(0); + SymbolicConditionalUnordered c0(0); LONGS_EQUAL(1,c0.nrFrontals()) LONGS_EQUAL(0,c0.nrParents()) } /* ************************************************************************* */ -TEST( IndexConditional, oneParents ) +TEST( SymbolicConditional, oneParents ) { - IndexConditional c0(0,1); + SymbolicConditionalUnordered c0(0,1); LONGS_EQUAL(1,c0.nrFrontals()) LONGS_EQUAL(1,c0.nrParents()) } /* ************************************************************************* */ -TEST( IndexConditional, twoParents ) +TEST( SymbolicConditional, twoParents ) { - IndexConditional c0(0,1,2); + SymbolicConditionalUnordered c0(0,1,2); LONGS_EQUAL(1,c0.nrFrontals()) LONGS_EQUAL(2,c0.nrParents()) } /* ************************************************************************* */ -TEST( IndexConditional, threeParents ) +TEST( SymbolicConditional, threeParents ) { - IndexConditional c0(0,1,2,3); + SymbolicConditionalUnordered c0(0,1,2,3); LONGS_EQUAL(1,c0.nrFrontals()) LONGS_EQUAL(3,c0.nrParents()) } /* ************************************************************************* */ -TEST( IndexConditional, fourParents ) +TEST( SymbolicConditional, fourParents ) { - vector parents; - parents += 1,2,3,4; - IndexConditional c0(0,parents); + SymbolicConditionalUnordered c0 = SymbolicConditionalUnordered::FromKeys( + list_of(0)(1)(2)(3)(4), 1); LONGS_EQUAL(1,c0.nrFrontals()) LONGS_EQUAL(4,c0.nrParents()) } /* ************************************************************************* */ -TEST( IndexConditional, FromRange ) +TEST( SymbolicConditional, FromRange ) { - vector keys; - keys += 1,2,3,4,5; - IndexConditional::shared_ptr c0(new IndexConditional(keys,2)); + SymbolicConditionalUnordered::shared_ptr c0 = + boost::make_shared( + SymbolicConditionalUnordered::FromKeys(list_of(1)(2)(3)(4)(5), 2)); LONGS_EQUAL(2,c0->nrFrontals()) LONGS_EQUAL(3,c0->nrParents()) } /* ************************************************************************* */ -TEST( IndexConditional, equals ) +TEST( SymbolicConditional, equals ) { - IndexConditional c0(0, 1, 2), c1(0, 1, 2), c2(1, 2, 3), c3(3,4); + SymbolicConditionalUnordered c0(0, 1, 2), c1(0, 1, 2), c2(1, 2, 3), c3(3,4); CHECK(c0.equals(c1)); CHECK(c1.equals(c0)); CHECK(!c0.equals(c2));