release/4.3a0
dellaert 2014-12-06 10:58:16 +01:00
parent 6f82458bee
commit 71e77b8c87
1 changed files with 47 additions and 14 deletions

View File

@ -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<size_t N>
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<size_t N> struct identity<Cyclic<N> > {
static const Cyclic<N> value = Cyclic<N>::Identity;
static const Cyclic<N> value;
typedef Cyclic<N> value_type;
};
template<size_t N> struct group_flavor<Cyclic<N> > {
@ -42,6 +46,27 @@ template<size_t N> struct group_flavor<Cyclic<N> > {
} // \namespace gtsam
/**
* @file Cyclic.cpp
* @brief Cyclic group implementation
* @author Frank Dellaert
**/
namespace gtsam {
namespace traits {
template<size_t N>
const Cyclic<N> identity<Cyclic<N> >::value = Cyclic<N>(0);
} // \namespace traits
} // \namespace gtsam
/**
* @file testCyclic.cpp
* @brief Unit tests for cyclic group
* @author Frank Dellaert
**/
//#include <gtsam/geometry/Cyclic.h>
#include <gtsam/base/Testable.h>
#include <CppUnitLite/TestHarness.h>
@ -49,19 +74,27 @@ template<size_t N> struct group_flavor<Cyclic<N> > {
using namespace std;
using namespace gtsam;
BOOST_CONCEPT_ASSERT((GroupConcept<Cyclic<6> >));
typedef Cyclic<6> G;
/* ************************************************************************* */
TEST(Cyclic, Constructor) {
Cyclic<6> g(0);
//******************************************************************************
TEST(Cyclic, Concept) {
EXPECT_LONGS_EQUAL(0,traits::identity<G>::value);
//BOOST_CONCEPT_ASSERT((GroupConcept<Cyclic<6> >));
// 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);
}
//******************************************************************************