Formatting for the BOOST_CHECK_CLOSE failure output?

综合编程 2018-03-14

I am adding tests to legacy code using the boost test framework.

One such test might be

double expectedPrice = /*...local computation*/
BOOST_CHECK_CLOSE(expectedPrice, object->price, ACCURACY_THRESHOLD);

Where expectedPrice is a double computed locally and the object is retrieved from the system under test.

error in "MyTest": difference{0.21097%} between expectedPrice{4.7300000000000004} and object->price{4.7400000000000002} exceeds 1.0000000000000001e-05%

Of course, that is a little hard to read, given all the decimals. Any way to have the test output formatted better/differently given that I am using naked doubles and not some other type?

您可能感兴趣的

SQL Server 2016 Priority Boost Setting Caused Cons... By: Scott Murray | | Related Tips:More > SQL Server Configurations Problem What happens when you have a SQL Server 2016 machine t...
4 Features to Boost React-Redux Performance Recently, I’ve been optimizing one of our websites and I’ve seen tremendous improvement by adding or modifying some behaviors of how Redux and Reac...
OpenShift In Action Breakfast Boost Scheduled We are excited to announce the next free public Keyhole Software educational event: OpenShift In Action! This Breakfast Boost event is a live learn...
TensorFlow Quiz Questions Part 1 2018 | Boost Your... TensorFlow Quiz Questions In this TensorFlow Quiz, we are going to discuss Best TensorFlow Quiz questions with their answers. This TensorFlow Qui...
8 Non-Programming Books That Will Boost Your Progr... There are many lists of books about becoming a better programmer . They likely include books like Refactoring, Code Complete, The Mythical Man ...