Compiles
parent
6f82458bee
commit
71e77b8c87
|
@ -10,8 +10,8 @@
|
||||||
* -------------------------------------------------------------------------- */
|
* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file testCyclic.cpp
|
* @file Cyclic.h
|
||||||
* @brief Unit tests for cyclic group
|
* @brief Cyclic group, can act on 2D vector spaces
|
||||||
* @author Frank Dellaert
|
* @author Frank Dellaert
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@ -22,17 +22,21 @@ namespace gtsam {
|
||||||
|
|
||||||
template<size_t N>
|
template<size_t N>
|
||||||
class Cyclic {
|
class Cyclic {
|
||||||
size_t i_;
|
size_t i_; ///< we just use an unsigned int
|
||||||
public:
|
public:
|
||||||
static const Cyclic Identity = Cyclic(0);
|
/// Constructor
|
||||||
Cyclic(size_t i) :
|
Cyclic(size_t i) :
|
||||||
i_(i) {
|
i_(i) {
|
||||||
}
|
}
|
||||||
|
/// Cast to size_t
|
||||||
|
operator size_t() const {
|
||||||
|
return i_;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace traits {
|
namespace traits {
|
||||||
template<size_t N> struct identity<Cyclic<N> > {
|
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;
|
typedef Cyclic<N> value_type;
|
||||||
};
|
};
|
||||||
template<size_t N> struct group_flavor<Cyclic<N> > {
|
template<size_t N> struct group_flavor<Cyclic<N> > {
|
||||||
|
@ -42,6 +46,27 @@ template<size_t N> struct group_flavor<Cyclic<N> > {
|
||||||
|
|
||||||
} // \namespace gtsam
|
} // \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/geometry/Cyclic.h>
|
||||||
#include <gtsam/base/Testable.h>
|
#include <gtsam/base/Testable.h>
|
||||||
#include <CppUnitLite/TestHarness.h>
|
#include <CppUnitLite/TestHarness.h>
|
||||||
|
@ -49,19 +74,27 @@ template<size_t N> struct group_flavor<Cyclic<N> > {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace gtsam;
|
using namespace gtsam;
|
||||||
|
|
||||||
BOOST_CONCEPT_ASSERT((GroupConcept<Cyclic<6> >));
|
typedef Cyclic<6> G;
|
||||||
|
|
||||||
/* ************************************************************************* */
|
//******************************************************************************
|
||||||
TEST(Cyclic, Constructor) {
|
TEST(Cyclic, Concept) {
|
||||||
Cyclic<6> g(0);
|
EXPECT_LONGS_EQUAL(0,traits::identity<G>::value);
|
||||||
|
//BOOST_CONCEPT_ASSERT((GroupConcept<Cyclic<6> >));
|
||||||
// EXPECT(assert_equal(p1, p2));
|
// EXPECT(assert_equal(p1, p2));
|
||||||
// EXPECT_LONGS_EQUAL(2,offset2.size());
|
// EXPECT_LONGS_EQUAL(2,offset2.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
//******************************************************************************
|
||||||
|
TEST(Cyclic, Constructor) {
|
||||||
|
G g(0);
|
||||||
|
// EXPECT(assert_equal(p1, p2));
|
||||||
|
// EXPECT_LONGS_EQUAL(2,offset2.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
//******************************************************************************
|
||||||
int main() {
|
int main() {
|
||||||
TestResult tr;
|
TestResult tr;
|
||||||
return TestRegistry::runAllTests(tr);
|
return TestRegistry::runAllTests(tr);
|
||||||
}
|
}
|
||||||
/* ************************************************************************* */
|
//******************************************************************************
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue