On Sun, 8 Mar 2020 at 01:06, Leo Carreon via Boost-users
Hi Boost.Users,
I’m using Boost.Test from Boost 1.72.0 and I’m getting a failure when I perform the following test:
auto string_1 = u8”value”s; auto string_2 = u8”value”s; BOOST_TEST(string_1 == string_2);
If you are getting a failure, tell what is the failure (crystal spheres not always work ;)) I suspect you are hitting two issues: 1. std::u8string is not "eligible for string comparison" https://www.boost.org/libs/test/doc/html/boost_test/testing_tools/extended_c... 2. reporting of char8_t falls into reporting of user-defined type https://www.boost.org/libs/test/doc/html/boost_test/test_output/test_tools_s... A possible hack to work around these two could be namespace std { std::ostream& boost_test_print_type(std::ostream& os, char8_t const& c) { // convert c return os; } } BOOST_TEST(string_1 == string_2, boost::test_tools::per_element());
However, the problem goes away when I change the test line to:
BOOST_TEST((string_1 == string_2));
What is the reason why Boost.Test is failing without the double parentheses?
It disables (de)constructing of the expression from macro input, see https://www.boost.org/libs/test/doc/html/boost_test/testing_tools/internal_d... https://www.boost.org/libs/test/doc/html/boost_test/testing_tools/boost_test... Best regards, -- Mateusz Loskot, http://mateusz.loskot.net