testLieScalar.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
19 #include <gtsam/base/Testable.h>
20 #include <gtsam/base/Manifold.h>
21 
22 using namespace gtsam;
23 
26 
27 const double tol=1e-9;
28 
29 //******************************************************************************
30 TEST(LieScalar , Concept) {
32  BOOST_CONCEPT_ASSERT((IsManifold<LieScalar>));
34 }
35 
36 //******************************************************************************
37 TEST(LieScalar , Invariants) {
38  LieScalar lie1(2), lie2(3);
39  CHECK(check_group_invariants(lie1, lie2));
40  CHECK(check_manifold_invariants(lie1, lie2));
41 }
42 
43 /* ************************************************************************* */
44 TEST( testLieScalar, construction ) {
45  double d = 2.;
46  LieScalar lie1(d), lie2(d);
47 
48  EXPECT_DOUBLES_EQUAL(2., lie1.value(),tol);
49  EXPECT_DOUBLES_EQUAL(2., lie2.value(),tol);
51  EXPECT(assert_equal(lie1, lie2));
52 }
53 
54 /* ************************************************************************* */
55 TEST( testLieScalar, localCoordinates ) {
56  LieScalar lie1(1.), lie2(3.);
57 
58  Vector1 actual = traits<LieScalar>::Local(lie1, lie2);
59  EXPECT( assert_equal((Vector)(Vector(1) << 2).finished(), actual));
60 }
61 
62 /* ************************************************************************* */
63 int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
64 /* ************************************************************************* */
#define CHECK(condition)
Definition: Test.h:109
Concept check for values that can be used in unit tests.
static int runAllTests(TestResult &result)
BOOST_CONCEPT_ASSERT((boost::RandomAccessRangeConcept< ListOfOneContainer< int > >))
int main()
#define GTSAM_CONCEPT_LIE_INST(T)
Definition: Lie.h:355
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
Definition: Test.h:162
Eigen::VectorXd Vector
Definition: Vector.h:38
Base class and basic functions for Manifold types.
#define EXPECT(condition)
Definition: Test.h:151
Array< double, 1, 3 > e(1./3., 0.5, 2.)
traits
Definition: chartTesting.h:28
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:42
TEST(LPInitSolver, InfiniteLoopSingleVar)
const G double tol
Definition: Group.h:83
double value() const
The matrix class, also used for vectors and row-vectors.
#define GTSAM_CONCEPT_TESTABLE_INST(T)
Definition: Testable.h:174


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:47:47