diff --git a/include/boost/static_string/static_string.hpp b/include/boost/static_string/static_string.hpp index 05d1a02..6c26c20 100644 --- a/include/boost/static_string/static_string.hpp +++ b/include/boost/static_string/static_string.hpp @@ -542,8 +542,10 @@ to_static_wstring_float_impl(long double value) noexcept wchar_t buffer[N + 1]; // swprintf returns a negative number if it can't // fit all the characters in the buffer + std::cout << "trying swprintf\n"; if (std::swprintf(buffer, N + 1, L"%Lf", value) < 0) { + std::cout << "swprintf < 0\n"; // the + 4 is for the decimal, 'e', // its sign, and the sign of the integral portion const int reserved_count = diff --git a/test/static_string.cpp b/test/static_string.cpp index aeab141..166698d 100644 --- a/test/static_string.cpp +++ b/test/static_string.cpp @@ -3680,66 +3680,66 @@ 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; + 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; + 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; + std::wcout << str << '\n'; } }