OSVR / OSVR-Core

The core libraries, applications, and plugins of the OSVR software platform.
Apache License 2.0
330 stars 124 forks source link

Update tests: port all to Catch2 2.8.0, removing old gtest #602

Closed rpavlik closed 5 years ago

rpavlik commented 5 years ago

I was able to relatively quickly update most tests to Catch2, leaving behind the old version of catch entirely. I have also now done the last remaining gtest test (QuatExpMap) which became simpler when moved to Catch2, meaning that google test is no longer needed either and has been removed.

Builds on Debian Buster, tests pass except for test_fwd_headers which I'm pretty sure I didn't touch.

rpavlik commented 5 years ago

OK, I have now ported all the tests, so they should all build on MSVC2019 now too :)

russell-taylor commented 5 years ago

When I run the tests, all but #6 QuatExpMap succeed. It fails. Here is its output:

$ ./QuatExpMap.exe


QuatExpMap.exe is a Catch v2.8.0 host application.
Run with -? for options

-----------------------------------------------------------------------------------------------------------------------
UnitQuatInput
  Basic quats
  Basic run ln
  Round trip
-----------------------------------------------------------------------------------------------------------------------
F:\tmp\src\OSVR-Core\tests\cplusplus\Util\QuatExpMap.cpp(173)
.......................................................................................................................

F:\tmp\src\OSVR-Core\tests\cplusplus\Util\QuatExpMap.cpp(177): FAILED:
  REQUIRE( q == exp_ln_q )
with expansion:
  [(0.70710678118654757                   0                   0), 0.70710678118654757]
  ==
  [(0.70710678118654757                   0                   0), 0.70710678118654746]
with messages:
  qCreator := Angle 1.5708, Axis 1 0 0
  q := [(0.70710678118654757                   0                   0), 0.70710678118654757]
  isIdentityQuat := false

-----------------------------------------------------------------------------------------------------------------------
UnitQuatInput
  Basic quats
  Basic run ln
  Round trip
-----------------------------------------------------------------------------------------------------------------------
F:\tmp\src\OSVR-Core\tests\cplusplus\Util\QuatExpMap.cpp(173)
.......................................................................................................................

F:\tmp\src\OSVR-Core\tests\cplusplus\Util\QuatExpMap.cpp(177): FAILED:
  REQUIRE( q == exp_ln_q )
with expansion:
  [(                  0 0.70710678118654757                   0), 0.70710678118654757]
  ==
  [(                  0 0.70710678118654757                   0), 0.70710678118654746]
with messages:
  qCreator := Angle 1.5708, Axis 0 1 0
  q := [(                  0 0.70710678118654757                   0), 0.70710678118654757]
  isIdentityQuat := false

-----------------------------------------------------------------------------------------------------------------------
UnitQuatInput
  Basic quats
  Basic run ln
  Round trip
-----------------------------------------------------------------------------------------------------------------------
F:\tmp\src\OSVR-Core\tests\cplusplus\Util\QuatExpMap.cpp(173)
.......................................................................................................................

F:\tmp\src\OSVR-Core\tests\cplusplus\Util\QuatExpMap.cpp(177): FAILED:
  REQUIRE( q == exp_ln_q )
with expansion:
  [(                  0                   0 0.70710678118654757), 0.70710678118654757]
  ==
  [(                  0                   0 0.70710678118654757), 0.70710678118654746]
with messages:
  qCreator := Angle 1.5708, Axis 0 0 1
  q := [(                  0                   0 0.70710678118654757), 0.70710678118654757]
  isIdentityQuat := false

-----------------------------------------------------------------------------------------------------------------------
UnitQuatInput
  Basic quats
  Basic run ln
  Round trip
-----------------------------------------------------------------------------------------------------------------------
F:\tmp\src\OSVR-Core\tests\cplusplus\Util\QuatExpMap.cpp(173)
.......................................................................................................................

F:\tmp\src\OSVR-Core\tests\cplusplus\Util\QuatExpMap.cpp(177): FAILED:
  REQUIRE( q == exp_ln_q )
with expansion:
  [(-0.70710678118654757                   -0                   -0), 0.70710678118654757]
  ==
  [(-0.70710678118654757                   -0                   -0), 0.70710678118654746]
with messages:
  qCreator := Angle -1.5708, Axis 1 0 0
  q := [(-0.70710678118654757                   -0                   -0), 0.70710678118654757]
  isIdentityQuat := false

-----------------------------------------------------------------------------------------------------------------------
UnitQuatInput
  Basic quats
  Basic run ln
  Round trip
-----------------------------------------------------------------------------------------------------------------------
F:\tmp\src\OSVR-Core\tests\cplusplus\Util\QuatExpMap.cpp(173)
.......................................................................................................................

F:\tmp\src\OSVR-Core\tests\cplusplus\Util\QuatExpMap.cpp(177): FAILED:
  REQUIRE( q == exp_ln_q )
with expansion:
  [(                  -0 -0.70710678118654757                   -0), 0.70710678118654757]
  ==
  [(                  -0 -0.70710678118654757                   -0), 0.70710678118654746]
with messages:
  qCreator := Angle -1.5708, Axis 0 1 0
  q := [(                  -0 -0.70710678118654757                   -0), 0.70710678118654757]
  isIdentityQuat := false

-----------------------------------------------------------------------------------------------------------------------
UnitQuatInput
  Basic quats
  Basic run ln
  Round trip
-----------------------------------------------------------------------------------------------------------------------
F:\tmp\src\OSVR-Core\tests\cplusplus\Util\QuatExpMap.cpp(173)
.......................................................................................................................

F:\tmp\src\OSVR-Core\tests\cplusplus\Util\QuatExpMap.cpp(177): FAILED:
  REQUIRE( q == exp_ln_q )
with expansion:
  [(                  -0                   -0 -0.70710678118654757), 0.70710678118654757]
  ==
  [(                  -0                   -0 -0.70710678118654757), 0.70710678118654746]
with messages:
  qCreator := Angle -1.5708, Axis 0 0 1
  q := [(                  -0                   -0 -0.70710678118654757), 0.70710678118654757]
  isIdentityQuat := false

=======================================================================================================================
test cases:   5 |   4 passed | 1 failed
assertions: 238 | 232 passed | 6 failed
rpavlik commented 5 years ago

That's interesting that the round-trips are close but not quite. I was getting exact here on Linux. However, I see I already made the other direction of round trip "approximate" (wrapping one endpoint in ApproxVec), so I'll try that with the quat one too. (ApproxQuat, in this case - these two were added by me but function equivalently to the Catch2 Approx() feature with doubles - basically a safe floating-point compare.)