Formatting for the BOOST_CHECK_CLOSE failure output?

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?

Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » Formatting for the BOOST_CHECK_CLOSE failure output?

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录