robotology / robot-testing-framework

Robot Testing Framework (RTF)
http://robotology.github.io/robot-testing-framework/index.html
GNU Lesser General Public License v2.1
19 stars 11 forks source link

Approximal equality helpers #16

Closed traversaro closed 8 years ago

traversaro commented 9 years ago

We need some helpers for testing approximate equality of floating point values.

An important feature to have is to print the values when the comparison fails, for easy debugging of failing tests (as in gtest EXPECT_NEAR, ASSERT_NEAR in https://code.google.com/p/googletest/wiki/AdvancedGuide ),

arocchi commented 9 years ago

I think the right way to have gtest-like functionality is to use gtest :)

traversaro commented 9 years ago

The main problems for using directly GTest, beside the problems of dependency handling (that are not trivial, especially on windows) are:

In the end, given that this approximal equality helpers can be written in probably 10 lines of code, we have to consider that the "Not Invented Here Syndrome" is a problem, but another risk is to always try to rely on external dependencies, even if sometimes the simplest and more manteinable way of doing things is an ad-hoc solution.

apaikan commented 9 years ago

Agree with @traversaro . We can provide more basic checking and assertion macros/function. They are pretty easy to implement (some useful cppuint macros can be found here http://cppunit.sourceforge.net/doc/cvs/group___assertions.html) .

apaikan commented 8 years ago

A new class (RTF::YARP::YarpTestAsserter) has been added within the RTF_yarp_utility library which aggregates some of the auxiliary checker functions (e.g., YarpTestAsserter::isApproxEqual).
We can collect more helper functions as we need in future.