diff --git a/test/test_std_formatting.cpp b/test/test_std_formatting.cpp index 003bbfd..1a8386a 100644 --- a/test/test_std_formatting.cpp +++ b/test/test_std_formatting.cpp @@ -66,8 +66,7 @@ void test_by_char(const std::locale& l, const std::locale& lreal) const bool bad_parsing = [&]() { ss_ref_type ss_ref; ss_ref.imbue(lreal); - ss_ref << std::showbase; - std::use_facet>(lreal).put(ss_ref, false, ss_ref, RefCharType(' '), 104334); + ss_ref << std::showbase << std::put_money(104334, false); std::ios_base::iostate err = std::ios_base::iostate(); typename std::money_get::iter_type end; long double tmp; @@ -80,46 +79,41 @@ void test_by_char(const std::locale& l, const std::locale& lreal) }(); { - std::cout << "- Testing as::currency national " << std::endl; - - ss_type ss; - ss.imbue(l); - - TEST(ss << as::currency); - TEST(ss << 1043.34); - if(!bad_parsing) { - double v1; - if TEST(ss >> v1) - TEST_EQ(v1, 1043.34); - } - ss_ref_type ss_ref; ss_ref.imbue(lreal); ss_ref << std::showbase; - std::use_facet>(lreal).put(ss_ref, false, ss_ref, RefCharType(' '), 104334); + { + std::cout << "- Testing as::currency national " << std::endl; + ss_type ss; + ss.imbue(l); - TEST_EQ(to_utf8(ss.str()), to_utf8(ss_ref.str())); - } + TEST(ss << as::currency); + TEST(ss << 1043.34); + if(!bad_parsing) { + double v1; + if TEST(ss >> v1) + TEST_EQ(v1, 1043.34); + } - { - std::cout << "- Testing as::currency iso" << std::endl; - ss_type ss; - ss.imbue(l); - - ss << as::currency << as::currency_iso; - TEST(ss << 1043.34); - if(!bad_parsing) { - double v1; - if TEST(ss >> v1) - TEST_EQ(v1, 1043.34); + empty_stream(ss_ref) << std::put_money(104334, false); + TEST_EQ(to_utf8(ss.str()), to_utf8(ss_ref.str())); } + { + std::cout << "- Testing as::currency iso" << std::endl; + ss_type ss; + ss.imbue(l); - ss_ref_type ss_ref; - ss_ref.imbue(lreal); - ss_ref << std::showbase; - std::use_facet>(lreal).put(ss_ref, true, ss_ref, RefCharType(' '), 104334); + ss << as::currency << as::currency_iso; + TEST(ss << 1043.34); + if(!bad_parsing) { + double v1; + if TEST(ss >> v1) + TEST_EQ(v1, 1043.34); + } - TEST_EQ(to_utf8(ss.str()), to_utf8(ss_ref.str())); + empty_stream(ss_ref) << std::put_money(104334, true); + TEST_EQ(to_utf8(ss.str()), to_utf8(ss_ref.str())); + } } {