Testable assertion for std::vector<Vector3> ?

Issue #218 new
krunal chande created an issue

If I write

std::vector<Vector3> expected;
std::vector<Vector3> actual;

EXPECT(assert_equal(expected, actual)); //  error: ‘const class Eigen::Matrix<double, 3, 1>’ has no member named ‘equals’, 'print'

It does not work.

Instead,

int n = 100;
std::vector<Vector> expected(n, Vector3());
std::vector<Vector> actual(n, Vector3());

EXPECT(assert_equal(expected, actual));

This does. What's the correct way to fix this?

Comments (1)

  1. krunal chande reporter

    Actually the issue lies in testing an object of Vector2, Vector3, etc; and does not have anything to do with std::vector itself. i.e.

    Vector3 expected;
    Vector3 actual;
    EXPECT(assert_equal(expected, actual)); // error
    
    
    Vector expected;
    Vector actual;
    EXPECT(assert_equal(expected, actual)); // works fine although with a memory leak in this case
    

    Adding 10 different assert_equals in Vector.h for each Vector2, Vector3, ... etc seems like a hack. Is there an elegant way to do this?

  2. Log in to comment