diff --git a/test/static_string.cpp b/test/static_string.cpp index 166698d..63796ff 100644 --- a/test/static_string.cpp +++ b/test/static_string.cpp @@ -20,8 +20,6 @@ #include #include -#include - namespace boost { namespace static_string { @@ -3680,66 +3678,63 @@ testGeneral() void testToStaticString() { - //BOOST_TEST(testTS(0, "0", L"0", true)); - //BOOST_TEST(testTS(0u, "0", L"0", true)); - //BOOST_TEST(testTS(0xffff, "65535", L"65535", true)); - //BOOST_TEST(testTS(0x10000, "65536", L"65536", true)); - //BOOST_TEST(testTS(0xffffffff, "4294967295", L"4294967295", true)); - //BOOST_TEST(testTS(-65535, "-65535", L"-65535", true)); - //BOOST_TEST(testTS(-65536, "-65536", L"-65536", true)); - //BOOST_TEST(testTS(-4294967295ll, "-4294967295", L"-4294967295", true)); - //BOOST_TEST(testTS(1, "1", L"1", true)); - //BOOST_TEST(testTS(-1, "-1", L"-1", true)); - //BOOST_TEST(testTS(0.1)); - //BOOST_TEST(testTS(0.0000001)); - //BOOST_TEST(testTS(-0.0000001)); - //BOOST_TEST(testTS(-0.1)); - //BOOST_TEST(testTS(1234567890.0001)); - //BOOST_TEST(testTS(1.123456789012345)); - //BOOST_TEST(testTS(-1234567890.1234)); - //BOOST_TEST(testTS(-1.123456789012345)); + BOOST_TEST(testTS(0, "0", L"0", true)); + BOOST_TEST(testTS(0u, "0", L"0", true)); + BOOST_TEST(testTS(0xffff, "65535", L"65535", true)); + BOOST_TEST(testTS(0x10000, "65536", L"65536", true)); + BOOST_TEST(testTS(0xffffffff, "4294967295", L"4294967295", true)); + BOOST_TEST(testTS(-65535, "-65535", L"-65535", true)); + BOOST_TEST(testTS(-65536, "-65536", L"-65536", true)); + BOOST_TEST(testTS(-4294967295ll, "-4294967295", L"-4294967295", true)); + BOOST_TEST(testTS(1, "1", L"1", true)); + BOOST_TEST(testTS(-1, "-1", L"-1", true)); + BOOST_TEST(testTS(0.1)); + BOOST_TEST(testTS(0.0000001)); + BOOST_TEST(testTS(-0.0000001)); + BOOST_TEST(testTS(-0.1)); + BOOST_TEST(testTS(1234567890.0001)); + BOOST_TEST(testTS(1.123456789012345)); + BOOST_TEST(testTS(-1234567890.1234)); + BOOST_TEST(testTS(-1.123456789012345)); - //BOOST_TEST(testTS(std::numeric_limits::max())); - //BOOST_TEST(testTS(std::numeric_limits::min())); - //BOOST_TEST(testTS(std::numeric_limits::max())); - //BOOST_TEST(testTS(std::numeric_limits::max())); - //BOOST_TEST(testTS(std::numeric_limits::min())); - //BOOST_TEST(testTS(std::numeric_limits::min())); - // - //// these tests technically are not portable, but they will work - //// 99% of the time. - //{ - // auto str = to_static_string(std::numeric_limits::max()); - // BOOST_TEST(str.find('e') != static_string<0>::npos || str.find('.') != - // static_string<0>::npos || str == "infinity" || str == "inf"); - //} - //{ - // auto str = to_static_string(std::numeric_limits::max()); - // BOOST_TEST(str.find('e') != static_string<0>::npos || str.find('.') != - // static_string<0>::npos || str == "infinity" || str == "inf"); - //} - //{ - // auto str = to_static_string(std::numeric_limits::max()); - // BOOST_TEST(str.find('e') != static_string<0>::npos || str.find('.') != - // static_string<0>::npos || str == "infinity" || str == "inf"); - //} + BOOST_TEST(testTS(std::numeric_limits::max())); + BOOST_TEST(testTS(std::numeric_limits::min())); + BOOST_TEST(testTS(std::numeric_limits::max())); + BOOST_TEST(testTS(std::numeric_limits::max())); + BOOST_TEST(testTS(std::numeric_limits::min())); + BOOST_TEST(testTS(std::numeric_limits::min())); + + // these tests technically are not portable, but they will work + // 99% of the time. + { + auto str = to_static_string(std::numeric_limits::max()); + BOOST_TEST(str.find('e') != static_string<0>::npos || str.find('.') != + static_string<0>::npos || str == "infinity" || str == "inf"); + } + { + auto str = to_static_string(std::numeric_limits::max()); + BOOST_TEST(str.find('e') != static_string<0>::npos || str.find('.') != + static_string<0>::npos || str == "infinity" || str == "inf"); + } + { + auto str = to_static_string(std::numeric_limits::max()); + BOOST_TEST(str.find('e') != static_string<0>::npos || str.find('.') != + static_string<0>::npos || str == "infinity" || str == "inf"); + } { auto str = to_static_wstring(std::numeric_limits::max()); BOOST_TEST(str.find('e') != static_string<0>::npos || str.find('.') != static_string<0>::npos || str == L"infinity" || str == L"inf"); - std::wcout << str << '\n'; } { auto str = to_static_wstring(std::numeric_limits::max()); BOOST_TEST(str.find('e') != static_string<0>::npos || str.find('.') != static_string<0>::npos || str == L"infinity" || str == L"inf"); - std::wcout << str << '\n'; } { auto str = to_static_wstring(std::numeric_limits::max()); BOOST_TEST(str.find('e') != static_string<0>::npos || str.find('.') != static_string<0>::npos || str == L"infinity" || str == L"inf"); - std::wcout << str << '\n'; } }