made a useful constructor for PairConfigs public and tested

release/4.3a0
Alex Cunningham 2010-06-07 18:00:43 +00:00
parent 8ab0e0ac59
commit d2d6a26ff1
2 changed files with 25 additions and 5 deletions

View File

@ -397,12 +397,11 @@ namespace gtsam {
LieConfig<J1, X1> first_;
LieConfig<J2, X2> second_;
private:
public:
PairConfig(const LieConfig<J1,X1>& config1, const LieConfig<J2,X2>& config2) :
first_(config1), second_(config2){}
public:
/**
* Default constructor creates an empty config.

View File

@ -27,11 +27,33 @@ typedef TypedSymbol<Pose2, 'x'> PoseKey;
typedef TypedSymbol<Point2, 'l'> PointKey;
typedef PairConfig<PoseKey, Pose2, PointKey, Point2> Config;
/* ************************************************************************* */
TEST( PairConfig, constructors )
{
Pose2 x1(1,2,3), x2(6,7,8);
Point2 l1(4,5), l2(9,10);
Config::Config1 cfg1;
cfg1.insert(PoseKey(1), x1);
cfg1.insert(PoseKey(2), x2);
Config::Config2 cfg2;
cfg2.insert(PointKey(1), l1);
cfg2.insert(PointKey(2), l2);
Config actual(cfg1, cfg2), expected;
expected.insert(PoseKey(1), x1);
expected.insert(PoseKey(2), x2);
expected.insert(PointKey(1), l1);
expected.insert(PointKey(2), l2);
CHECK(assert_equal(expected, actual));
}
/* ************************************************************************* */
TEST( PairConfig, insert_equals1 )
{
Pose2 x1(1,2,3), x2(6,7,8);
Point2 l1(4,5), l2(9,10);
Pose2 x1(1,2,3), x2(6,7,8);
Point2 l1(4,5), l2(9,10);
Config expected;
expected.insert(PoseKey(1), x1);
@ -48,7 +70,6 @@ TEST( PairConfig, insert_equals1 )
CHECK(assert_equal(expected,actual));
}
/* ************************************************************************* */
TEST( PairConfig, insert_equals2 )
{
Pose2 x1(1,2,3), x2(6,7,8);