Made unit test local vars/functions in anonymous namespace

release/4.3a0
Richard Roberts 2013-04-22 17:44:09 +00:00
parent dd84ffcc8e
commit 124a38f72d
4 changed files with 30 additions and 11 deletions

View File

@ -11,6 +11,8 @@
using namespace gtsam;
using namespace gtsam::symbol_shorthand;
namespace {
const double tol=1e-5;
const double h = 0.1;
const double g = 9.81, l = 1.0;
@ -19,6 +21,8 @@ const double deg2rad = M_PI/180.0;
LieScalar origin, q1(deg2rad*30.0), q2(deg2rad*31.0);
LieScalar v1(deg2rad*1.0/h), v2((v1-h*g/l*sin(q1)));
}
/* ************************************************************************* */
TEST( testPendulumFactor1, evaluateError) {
// hard constraints don't need a noise model

View File

@ -5,21 +5,29 @@
#include <CppUnitLite/TestHarness.h>
#include <gtsam/nonlinear/Symbol.h>
#include <gtsam_unstable/dynamics/VelocityConstraint3.h>
/* ************************************************************************* */
using namespace gtsam;
namespace {
const double tol=1e-5;
const double dt = 1.0;
LieScalar origin,
x1(1.0), x2(2.0), v(1.0);
}
/* ************************************************************************* */
TEST( testVelocityConstraint3, evaluateError) {
using namespace gtsam::symbol_shorthand;
// hard constraints don't need a noise model
VelocityConstraint3 constraint(x1, x2, v, dt);
VelocityConstraint3 constraint(X(1), X(2), V(1), dt);
// verify error function
EXPECT(assert_equal(zero(1), constraint.evaluateError(x1, x2, v), tol));

View File

@ -35,6 +35,7 @@
using namespace std;
using namespace gtsam;
namespace {
// Set up initial pose, odometry difference, loop closure difference, and initialization errors
const Pose3 poseInitial;
@ -431,6 +432,8 @@ void FindFactorsWithOnly(const CONTAINER& keys, const NonlinearFactorGraph& sour
}
}
/* ************************************************************************* */
TEST( ConcurrentBatchFilter, update_batch )
{

View File

@ -34,6 +34,8 @@
using namespace std;
using namespace gtsam;
namespace {
// Set up initial pose, odometry difference, loop closure difference, and initialization errors
const Pose3 poseInitial;
const Pose3 poseOdometry( Rot3::RzRyRx(Vector_(3, 0.05, 0.10, -0.75)), Point3(1.0, -0.25, 0.10) );
@ -395,6 +397,8 @@ void FindFactorsWithOnly(const std::set<Key>& keys, const NonlinearFactorGraph&
}
}
/* ************************************************************************* */
TEST( ConcurrentBatchSmoother, update_batch )
{