New tests on traceSize

release/4.3a0
dellaert 2014-10-16 15:07:05 +02:00
parent 0bcca2c386
commit 02d25f6658
1 changed files with 21 additions and 2 deletions

View File

@ -52,6 +52,7 @@ TEST(Expression, constant) {
EXPECT(assert_equal(someR, actual)); EXPECT(assert_equal(someR, actual));
JacobianMap expected; JacobianMap expected;
EXPECT(actualMap == expected); EXPECT(actualMap == expected);
EXPECT_LONGS_EQUAL(0, R.traceSize())
} }
/* ************************************************************************* */ /* ************************************************************************* */
@ -112,11 +113,18 @@ TEST(Expression, BinaryKeys) {
/* ************************************************************************* */ /* ************************************************************************* */
// dimensions // dimensions
TEST(Expression, BinaryDimensions) { TEST(Expression, BinaryDimensions) {
map<Key,size_t> actual, expected = map_list_of<Key,size_t>(1,6)(2,3); map<Key, size_t> actual, expected = map_list_of<Key, size_t>(1, 6)(2, 3);
binary::p_cam.dims(actual); binary::p_cam.dims(actual);
EXPECT(actual==expected); EXPECT(actual==expected);
} }
/* ************************************************************************* */ /* ************************************************************************* */
// dimensions
TEST(Expression, BinaryTraceSize) {
typedef BinaryExpression<Point3, Pose3, Point3> Binary;
size_t expectedTraceSize = sizeof(Binary::Record);
EXPECT_LONGS_EQUAL(expectedTraceSize, binary::p_cam.traceSize());
}
/* ************************************************************************* */
// Binary(Leaf,Unary(Binary(Leaf,Leaf))) // Binary(Leaf,Unary(Binary(Leaf,Leaf)))
namespace tree { namespace tree {
using namespace binary; using namespace binary;
@ -136,11 +144,22 @@ TEST(Expression, TreeKeys) {
/* ************************************************************************* */ /* ************************************************************************* */
// dimensions // dimensions
TEST(Expression, TreeDimensions) { TEST(Expression, TreeDimensions) {
map<Key,size_t> actual, expected = map_list_of<Key,size_t>(1,6)(2,3)(3,5); map<Key, size_t> actual, expected = map_list_of<Key, size_t>(1, 6)(2, 3)(3,
5);
tree::uv_hat.dims(actual); tree::uv_hat.dims(actual);
EXPECT(actual==expected); EXPECT(actual==expected);
} }
/* ************************************************************************* */ /* ************************************************************************* */
// TraceSize
TEST(Expression, TreeTraceSize) {
typedef UnaryExpression<Point2, Point3> Unary;
typedef BinaryExpression<Point3, Pose3, Point3> Binary1;
typedef BinaryExpression<Point2, Point2, Cal3_S2> Binary2;
size_t expectedTraceSize = sizeof(Unary::Record) + sizeof(Binary1::Record)
+ sizeof(Binary2::Record);
EXPECT_LONGS_EQUAL(expectedTraceSize, tree::uv_hat.traceSize());
}
/* ************************************************************************* */
TEST(Expression, compose1) { TEST(Expression, compose1) {