diff --git a/gtsam_unstable/nonlinear/tests/testExpression.cpp b/gtsam_unstable/nonlinear/tests/testExpression.cpp index 2e6d52545..c66cc3b8b 100644 --- a/gtsam_unstable/nonlinear/tests/testExpression.cpp +++ b/gtsam_unstable/nonlinear/tests/testExpression.cpp @@ -52,6 +52,7 @@ TEST(Expression, constant) { EXPECT(assert_equal(someR, actual)); JacobianMap expected; EXPECT(actualMap == expected); + EXPECT_LONGS_EQUAL(0, R.traceSize()) } /* ************************************************************************* */ @@ -112,11 +113,18 @@ TEST(Expression, BinaryKeys) { /* ************************************************************************* */ // dimensions TEST(Expression, BinaryDimensions) { - map actual, expected = map_list_of(1,6)(2,3); + map actual, expected = map_list_of(1, 6)(2, 3); binary::p_cam.dims(actual); EXPECT(actual==expected); } /* ************************************************************************* */ +// dimensions +TEST(Expression, BinaryTraceSize) { + typedef BinaryExpression Binary; + size_t expectedTraceSize = sizeof(Binary::Record); + EXPECT_LONGS_EQUAL(expectedTraceSize, binary::p_cam.traceSize()); +} +/* ************************************************************************* */ // Binary(Leaf,Unary(Binary(Leaf,Leaf))) namespace tree { using namespace binary; @@ -136,11 +144,22 @@ TEST(Expression, TreeKeys) { /* ************************************************************************* */ // dimensions TEST(Expression, TreeDimensions) { - map actual, expected = map_list_of(1,6)(2,3)(3,5); + map actual, expected = map_list_of(1, 6)(2, 3)(3, + 5); tree::uv_hat.dims(actual); EXPECT(actual==expected); } /* ************************************************************************* */ +// TraceSize +TEST(Expression, TreeTraceSize) { + typedef UnaryExpression Unary; + typedef BinaryExpression Binary1; + typedef BinaryExpression Binary2; + size_t expectedTraceSize = sizeof(Unary::Record) + sizeof(Binary1::Record) + + sizeof(Binary2::Record); + EXPECT_LONGS_EQUAL(expectedTraceSize, tree::uv_hat.traceSize()); +} +/* ************************************************************************* */ TEST(Expression, compose1) {