diff --git a/gtsam/geometry/tests/testCyclic.cpp b/gtsam/geometry/tests/testCyclic.cpp index f15654b2e..bdf0c3e98 100644 --- a/gtsam/geometry/tests/testCyclic.cpp +++ b/gtsam/geometry/tests/testCyclic.cpp @@ -10,8 +10,8 @@ * -------------------------------------------------------------------------- */ /** - * @file testCyclic.cpp - * @brief Unit tests for cyclic group + * @file Cyclic.h + * @brief Cyclic group, can act on 2D vector spaces * @author Frank Dellaert **/ @@ -22,17 +22,21 @@ namespace gtsam { template class Cyclic { - size_t i_; + size_t i_; ///< we just use an unsigned int public: - static const Cyclic Identity = Cyclic(0); + /// Constructor Cyclic(size_t i) : i_(i) { } + /// Cast to size_t + operator size_t() const { + return i_; + } }; namespace traits { template struct identity > { - static const Cyclic value = Cyclic::Identity; + static const Cyclic value; typedef Cyclic value_type; }; template struct group_flavor > { @@ -42,6 +46,27 @@ template struct group_flavor > { } // \namespace gtsam +/** + * @file Cyclic.cpp + * @brief Cyclic group implementation + * @author Frank Dellaert + **/ + +namespace gtsam { + +namespace traits { +template +const Cyclic identity >::value = Cyclic(0); +} // \namespace traits + +} // \namespace gtsam + +/** + * @file testCyclic.cpp + * @brief Unit tests for cyclic group + * @author Frank Dellaert + **/ + //#include #include #include @@ -49,19 +74,27 @@ template struct group_flavor > { using namespace std; using namespace gtsam; -BOOST_CONCEPT_ASSERT((GroupConcept >)); +typedef Cyclic<6> G; -/* ************************************************************************* */ -TEST(Cyclic, Constructor) { -Cyclic<6> g(0); +//****************************************************************************** +TEST(Cyclic, Concept) { + EXPECT_LONGS_EQUAL(0,traits::identity::value); + //BOOST_CONCEPT_ASSERT((GroupConcept >)); // EXPECT(assert_equal(p1, p2)); // EXPECT_LONGS_EQUAL(2,offset2.size()); } -/* ************************************************************************* */ -int main() { -TestResult tr; -return TestRegistry::runAllTests(tr); +//****************************************************************************** +TEST(Cyclic, Constructor) { + G g(0); +// EXPECT(assert_equal(p1, p2)); +// EXPECT_LONGS_EQUAL(2,offset2.size()); } -/* ************************************************************************* */ + +//****************************************************************************** +int main() { + TestResult tr; + return TestRegistry::runAllTests(tr); +} +//******************************************************************************