more tests work, except for serialization based tests

release/4.3a0
Mike Bosse 2014-10-24 23:47:02 +02:00
parent 5b2a61682d
commit 4a3dc51f85
5 changed files with 24 additions and 27 deletions

View File

@ -1,3 +1 @@
VERTEX_SE3:QUAT 0 0 0 0 0 0 0 1
VERTEX_SE3:QUAT 1 1.00137 0.01539 0.004948 0.190253 0.283162 -0.392318 0.85423
EDGE_SE3:QUAT 0 1 1.00137 0.01539 0.004948 0.190253 0.283162 -0.392318 0.85423 10000 1 1 1 1 1 10000 2 2 2 2 10000 3 3 3 10000 4 4 10000 5 10000 EDGE_SE3:QUAT 0 1 1.00137 0.01539 0.004948 0.190253 0.283162 -0.392318 0.85423 10000 1 1 1 1 1 10000 2 2 2 2 10000 3 3 3 10000 4 4 10000 5 10000

View File

@ -1,8 +1,3 @@
VERTEX_SE3:QUAT 0 0 0 0 0 0 0 1
VERTEX_SE3:QUAT 1 1.00137 0.01539 0.004948 0.190253 0.283162 -0.392318 0.85423
VERTEX_SE3:QUAT 2 1.9935 0.023275 0.003793 0.351729 0.597838 -0.584174 -0.421446
VERTEX_SE3:QUAT 3 2.00429 1.02431 0.018047 0.331798 -0.200659 0.919323 0.067024
VERTEX_SE3:QUAT 4 0.999908 1.05507 0.020212 -0.035697 -0.46249 0.445933 0.765488
EDGE_SE3:QUAT 0 1 1.00137 0.01539 0.004948 0.190253 0.283162 -0.392318 0.85423 10000 0 0 0 0 0 10000 0 0 0 0 10000 0 0 0 10000 0 0 10000 0 10000 EDGE_SE3:QUAT 0 1 1.00137 0.01539 0.004948 0.190253 0.283162 -0.392318 0.85423 10000 0 0 0 0 0 10000 0 0 0 0 10000 0 0 0 10000 0 0 10000 0 10000
EDGE_SE3:QUAT 1 2 0.523923 0.776654 0.326659 -0.311512 -0.656877 0.678505 -0.105373 10000 0 0 0 0 0 10000 0 0 0 0 10000 0 0 0 10000 0 0 10000 0 10000 EDGE_SE3:QUAT 1 2 0.523923 0.776654 0.326659 -0.311512 -0.656877 0.678505 -0.105373 10000 0 0 0 0 0 10000 0 0 0 0 10000 0 0 0 10000 0 0 10000 0 10000
EDGE_SE3:QUAT 2 3 0.910927 0.055169 -0.411761 0.595795 -0.561677 0.079353 0.568551 10000 0 0 0 0 0 10000 0 0 0 0 10000 0 0 0 10000 0 0 10000 0 10000 EDGE_SE3:QUAT 2 3 0.910927 0.055169 -0.411761 0.595795 -0.561677 0.079353 0.568551 10000 0 0 0 0 0 10000 0 0 0 0 10000 0 0 0 10000 0 0 10000 0 10000

View File

@ -54,9 +54,9 @@ int TestValueData::DestructorCount = 0;
class TestValue { class TestValue {
TestValueData data_; TestValueData data_;
public: public:
virtual void print(const std::string& str = "") const {} void print(const std::string& str = "") const {}
bool equals(const TestValue& other, double tol = 1e-9) const { return true; } bool equals(const TestValue& other, double tol = 1e-9) const { return true; }
virtual size_t dim() const { return 0; } size_t dim() const { return 0; }
TestValue retract(const Vector&) const { return TestValue(); } TestValue retract(const Vector&) const { return TestValue(); }
Vector localCoordinates(const TestValue&) const { return Vector(); } Vector localCoordinates(const TestValue&) const { return Vector(); }
}; };
@ -353,12 +353,12 @@ TEST(Values, filter) {
BOOST_FOREACH(const Values::Filtered<>::KeyValuePair& key_value, filtered) { BOOST_FOREACH(const Values::Filtered<>::KeyValuePair& key_value, filtered) {
if(i == 0) { if(i == 0) {
LONGS_EQUAL(2, (long)key_value.key); LONGS_EQUAL(2, (long)key_value.key);
EXPECT(typeid(Pose2) == typeid(key_value.value)); EXPECT(typeid(GenericValue<Pose2>) == typeid(key_value.value));
EXPECT(assert_equal(pose2, dynamic_cast<const Pose2&>(key_value.value))); EXPECT(assert_equal(pose2, dynamic_cast<const GenericValue<Pose2>&>(key_value.value).value()));
} else if(i == 1) { } else if(i == 1) {
LONGS_EQUAL(3, (long)key_value.key); LONGS_EQUAL(3, (long)key_value.key);
EXPECT(typeid(Pose3) == typeid(key_value.value)); EXPECT(typeid(GenericValue<Pose3>) == typeid(key_value.value));
EXPECT(assert_equal(pose3, dynamic_cast<const Pose3&>(key_value.value))); EXPECT(assert_equal(pose3, dynamic_cast<const GenericValue<Pose3>&>(key_value.value).value()));
} else { } else {
EXPECT(false); EXPECT(false);
} }
@ -416,10 +416,10 @@ TEST(Values, Symbol_filter) {
BOOST_FOREACH(const Values::Filtered<Value>::KeyValuePair& key_value, values.filter(Symbol::ChrTest('y'))) { BOOST_FOREACH(const Values::Filtered<Value>::KeyValuePair& key_value, values.filter(Symbol::ChrTest('y'))) {
if(i == 0) { if(i == 0) {
LONGS_EQUAL(Symbol('y', 1), (long)key_value.key); LONGS_EQUAL(Symbol('y', 1), (long)key_value.key);
EXPECT(assert_equal(pose1, dynamic_cast<const Pose3&>(key_value.value))); EXPECT(assert_equal(pose1, dynamic_cast<const GenericValue<Pose3>&>(key_value.value).value()));
} else if(i == 1) { } else if(i == 1) {
LONGS_EQUAL(Symbol('y', 3), (long)key_value.key); LONGS_EQUAL(Symbol('y', 3), (long)key_value.key);
EXPECT(assert_equal(pose3, dynamic_cast<const Pose3&>(key_value.value))); EXPECT(assert_equal(pose3, dynamic_cast<const GenericValue<Pose3>&>(key_value.value).value()));
} else { } else {
EXPECT(false); EXPECT(false);
} }
@ -441,11 +441,15 @@ TEST(Values, Destructors) {
values.insert(0, value1); values.insert(0, value1);
values.insert(1, value2); values.insert(1, value2);
} }
LONGS_EQUAL(4, (long)TestValueData::ConstructorCount); // additional 2 con/destructor counts for the temporary
LONGS_EQUAL(2, (long)TestValueData::DestructorCount); // GenericValue<TestValue> in insert()
// but I'm sure some advanced programmer can figure out
// a way to avoid the temporary, or optimize it out
LONGS_EQUAL(4+2, (long)TestValueData::ConstructorCount);
LONGS_EQUAL(2+2, (long)TestValueData::DestructorCount);
} }
LONGS_EQUAL(4, (long)TestValueData::ConstructorCount); LONGS_EQUAL(4+2, (long)TestValueData::ConstructorCount);
LONGS_EQUAL(4, (long)TestValueData::DestructorCount); LONGS_EQUAL(4+2, (long)TestValueData::DestructorCount);
} }
/* ************************************************************************* */ /* ************************************************************************* */

View File

@ -202,7 +202,7 @@ TEST(Expression, Snavely) {
#ifdef GTSAM_USE_QUATERNIONS #ifdef GTSAM_USE_QUATERNIONS
EXPECT_LONGS_EQUAL(480,expression.traceSize()); // Todo, should be zero EXPECT_LONGS_EQUAL(480,expression.traceSize()); // Todo, should be zero
#else #else
EXPECT_LONGS_EQUAL(528,expression.traceSize()); // Todo, should be zero EXPECT_LONGS_EQUAL(432,expression.traceSize()); // Todo, should be zero
#endif #endif
set<Key> expected = list_of(1)(2); set<Key> expected = list_of(1)(2);
EXPECT(expected == expression.keys()); EXPECT(expected == expression.keys());

View File

@ -144,19 +144,19 @@ TEST(ExpressionFactor, Binary) {
// traceRaw will fill raw with [Trace<Point2> | Binary::Record] // traceRaw will fill raw with [Trace<Point2> | Binary::Record]
EXPECT_LONGS_EQUAL(8, sizeof(double)); EXPECT_LONGS_EQUAL(8, sizeof(double));
EXPECT_LONGS_EQUAL(24, sizeof(Point2)); EXPECT_LONGS_EQUAL(16, sizeof(Point2));
EXPECT_LONGS_EQUAL(48, sizeof(Cal3_S2)); EXPECT_LONGS_EQUAL(40, sizeof(Cal3_S2));
EXPECT_LONGS_EQUAL(16, sizeof(ExecutionTrace<Point2>)); EXPECT_LONGS_EQUAL(16, sizeof(ExecutionTrace<Point2>));
EXPECT_LONGS_EQUAL(16, sizeof(ExecutionTrace<Cal3_S2>)); EXPECT_LONGS_EQUAL(16, sizeof(ExecutionTrace<Cal3_S2>));
EXPECT_LONGS_EQUAL(2*5*8, sizeof(Jacobian<Point2,Cal3_S2>::type)); EXPECT_LONGS_EQUAL(2*5*8, sizeof(Jacobian<Point2,Cal3_S2>::type));
EXPECT_LONGS_EQUAL(2*2*8, sizeof(Jacobian<Point2,Point2>::type)); EXPECT_LONGS_EQUAL(2*2*8, sizeof(Jacobian<Point2,Point2>::type));
size_t expectedRecordSize = 24 + 24 + 48 + 2 * 16 + 80 + 32; size_t expectedRecordSize = 16 + 16 + 40 + 2 * 16 + 80 + 32;
EXPECT_LONGS_EQUAL(expectedRecordSize, sizeof(Binary::Record)); EXPECT_LONGS_EQUAL(expectedRecordSize + 8, sizeof(Binary::Record));
// Check size // Check size
size_t size = binary.traceSize(); size_t size = binary.traceSize();
CHECK(size); CHECK(size);
EXPECT_LONGS_EQUAL(expectedRecordSize, size); EXPECT_LONGS_EQUAL(expectedRecordSize + 8, size);
// Use Variable Length Array, allocated on stack by gcc // Use Variable Length Array, allocated on stack by gcc
// Note unclear for Clang: http://clang.llvm.org/compatibility.html#vla // Note unclear for Clang: http://clang.llvm.org/compatibility.html#vla
char raw[size]; char raw[size];
@ -208,8 +208,8 @@ TEST(ExpressionFactor, Shallow) {
EXPECT_LONGS_EQUAL(464, sizeof(Binary::Record)); EXPECT_LONGS_EQUAL(464, sizeof(Binary::Record));
LONGS_EQUAL(112+464, expectedTraceSize); LONGS_EQUAL(112+464, expectedTraceSize);
#else #else
EXPECT_LONGS_EQUAL(496, sizeof(Binary::Record)); EXPECT_LONGS_EQUAL(400, sizeof(Binary::Record));
LONGS_EQUAL(112+496, expectedTraceSize); LONGS_EQUAL(112+400, expectedTraceSize);
#endif #endif
size_t size = expression.traceSize(); size_t size = expression.traceSize();
CHECK(size); CHECK(size);