Compare Eigen matrices in Google Test or Google Mock

后端 未结 3 2085
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-14 13:03

I was wondering if there is a good way to test two Eigen matrices for approximate equality using Google Test, or Google Mock.

Take the following test-case as a

3条回答
  •  既然无缘
    2021-02-14 13:32

    Why not use the isApprox or isMuchSmallerThan member functions of Eigen Matrix types?

    The documentation of these above functions are available here

    So for most cases ASSERT_TRUE(C_actual.isApprox(C_expect)); is what you need. You can also provide a precision parameter as the second arguement to isApprox.

提交回复
热议问题