Skip to content

Clean up float comparisons and other test assertions

To address ACTS-531, this MR proposes to do the following:

  • Introduce a new family of CHECK_XYZ assertions for floating-point data and container comparison, which supersede all previous methods.
  • Drop almost all use of BOOST_TEST as it is a massive usability footgun (test assertions should have a simple and easily predictable behavior, whereas BOOST_TEST fails at both).

By the standards described in ACTS-531, the new CHECK_XYZ assertions have the following properties:

  • Support relative tolerances expressed as a fraction, absolute tolerances, and a zero threshold.
  • Tolerate some degree of type heterogeneity (support for it can be extended if there is demand).
  • Support scalars, Eigen types, and STL containers.
  • The tolerance must always be specified. No global state, no hard-coded number.
  • Errors are reported with both numerical information (which numbers failed the assertion and why) and source line information.
  • Zeroes can be handled using either absolute tolerances or relative tolerances + a zero threshold.
  • Containers are compared by size, then element-wise. No norm.
  • The first parameter of a comparison is treated as actual data, the second parameter is treated as a reference value.

Closes ACTS-531 .

Edited by Hadrien Benjamin Grasland

Merge request reports