Lines Matching refs:cnv
25 namespace cnv = boost::cnv;
26 namespace arg = boost::cnv::parameter;
33 boost::cnv::cstream cnv; in test_dbl_to_str() local
35 cnv(std::fixed); in test_dbl_to_str()
37 BOOST_TEST(convert<string>( 99.999, cnv(arg::precision = 2)).value_or("bad") == "100.00"); in test_dbl_to_str()
38 BOOST_TEST(convert<string>( 99.949, cnv(arg::precision = 2)).value_or("bad") == "99.95"); in test_dbl_to_str()
39 BOOST_TEST(convert<string>(-99.949, cnv(arg::precision = 2)).value_or("bad") == "-99.95"); in test_dbl_to_str()
40 BOOST_TEST(convert<string>( 99.949, cnv(arg::precision = 1)).value_or("bad") == "99.9"); in test_dbl_to_str()
41 BOOST_TEST(convert<string>( 0.999, cnv(arg::precision = 2)).value_or("bad") == "1.00"); in test_dbl_to_str()
42 BOOST_TEST(convert<string>( -0.999, cnv(arg::precision = 2)).value_or("bad") == "-1.00"); in test_dbl_to_str()
43 BOOST_TEST(convert<string>( 0.949, cnv(arg::precision = 2)).value_or("bad") == "0.95"); in test_dbl_to_str()
44 BOOST_TEST(convert<string>( -0.949, cnv(arg::precision = 2)).value_or("bad") == "-0.95"); in test_dbl_to_str()
45 BOOST_TEST(convert<string>( 1.949, cnv(arg::precision = 1)).value_or("bad") == "1.9"); in test_dbl_to_str()
46 BOOST_TEST(convert<string>( -1.949, cnv(arg::precision = 1)).value_or("bad") == "-1.9"); in test_dbl_to_str()
57 boost::cnv::cstream ccnv; in test_numbase()
66 …BOOST_TEST(convert<string>(255, ccnv(arg::base = boost::cnv::base::oct)).value_or("bad") == "377"); in test_numbase()
67 …BOOST_TEST(convert<string>(255, ccnv(arg::base = boost::cnv::base::hex)).value_or("bad") == "ff"); in test_numbase()
68 …BOOST_TEST(convert<string>(255, ccnv(arg::base = boost::cnv::base::dec)).value_or("bad") == "255"); in test_numbase()
80 BOOST_TEST(convert<int>("11", ccnv(arg::base = cnv::base::hex)).value_or(0) == 17); in test_numbase()
81 BOOST_TEST(convert<int>("11", ccnv(arg::base = cnv::base::oct)).value_or(0) == 9); in test_numbase()
82 BOOST_TEST(convert<int>("11", ccnv(arg::base = cnv::base::dec)).value_or(0) == 11); in test_numbase()
85 boost::cnv::wstream wcnv; in test_numbase()
91 BOOST_TEST(convert<wstring>(254, wcnv(arg::base = cnv::base::dec)).value_or(L"bad") == L"254"); in test_numbase()
92 BOOST_TEST(convert<wstring>(254, wcnv(arg::base = cnv::base::hex)).value_or(L"bad") == L"fe"); in test_numbase()
93 BOOST_TEST(convert<wstring>(254, wcnv(arg::base = cnv::base::oct)).value_or(L"bad") == L"376"); in test_numbase()
101 boost::cnv::cstream cnv; in test_boolalpha() local
103 BOOST_TEST(convert<string>( true, cnv(std::boolalpha)).value_or("bad") == "true"); in test_boolalpha()
104 BOOST_TEST(convert<string>(false, cnv(std::boolalpha)).value_or("bad") == "false"); in test_boolalpha()
106 BOOST_TEST(convert<bool>( "true", cnv(std::boolalpha)).value_or(false) == true); in test_boolalpha()
107 BOOST_TEST(convert<bool>("false", cnv(std::boolalpha)).value_or( true) == false); in test_boolalpha()
109 BOOST_TEST(convert<string>( true, cnv(std::noboolalpha)).value_or("bad") == "1"); in test_boolalpha()
110 BOOST_TEST(convert<string>(false, cnv(std::noboolalpha)).value_or("bad") == "0"); in test_boolalpha()
112 BOOST_TEST(convert<bool>("1", cnv(std::noboolalpha)).value_or(false) == true); in test_boolalpha()
113 BOOST_TEST(convert<bool>("0", cnv(std::noboolalpha)).value_or( true) == false); in test_boolalpha()
122 boost::cnv::cstream ccnv; in test_skipws_char()
148 boost::cnv::wstream wcnv; in test_skipws_wchar()
169 boost::cnv::cstream cnv; in test_width() local
171 boost::optional<string> s01 = convert<string>(12, cnv(std::setw(4))); in test_width()
172 boost::optional<string> s02 = convert<string>(12, cnv(std::setw(5))(std::setfill('*'))); in test_width()
173 …boost::optional<string> s03 = convert<string>(12, cnv(std::setw(5))(std::setfill('*'))(std::left)); in test_width()
186 boost::optional<string> s11 = convert<string>(12, cnv(arg::width = 4)); in test_width()
187 boost::optional<string> s12 = convert<string>(12, cnv(arg::width = 5) in test_width()
189 (arg::adjust = cnv::adjust::right)); in test_width()
200 boost::cnv::cstream ccnv; in test_manipulators()
201 boost::cnv::wstream wcnv; in test_manipulators()
233 ccnv(std::showbase)(arg::uppercase = true)(arg::base = cnv::base::hex); in test_manipulators()
243 boost::cnv::cstream cnv; in test_locale_example() local
247 char const* eng_locale_name = test::cnv::is_msc ? "English_United States.1251" : "en_US.UTF-8"; in test_locale_example()
248 char const* rus_locale_name = test::cnv::is_msc ? "Russian_Russia.1251" : "ru_RU.UTF-8"; in test_locale_example()
249 char const* rus_expected = test::cnv::is_msc ? "1,235e-002" : "1,235e-02"; in test_locale_example()
250 char const* eng_expected = test::cnv::is_msc ? "1.235e-002" : "1.235e-02"; in test_locale_example()
251 char const* dbl_expected = test::cnv::is_msc ? "1.2345E-002" : "1.2345E-02"; in test_locale_example()
254 cnv(arg::precision = 4) in test_locale_example()
256 (arg::notation = cnv::notation::scientific); in test_locale_example()
258 double double_v01 = convert<double>(dbl_expected, cnv).value_or(0); in test_locale_example()
259 string double_s02 = convert<string>(double_v01, cnv).value_or("bad"); in test_locale_example()
270 cnv(arg::precision = 3)(arg::uppercase = false); in test_locale_example()
272 string double_rus = convert<string>(double_v01, cnv(rus_locale)).value_or("bad double_rus"); in test_locale_example()
273 string double_eng = convert<string>(double_v01, cnv(eng_locale)).value_or("bad double_eng"); in test_locale_example()
281 test_locale(double v, boost::cnv::cstream const& cnv, char const* expected) in test_locale() argument
283 boost::optional<string> res = convert<string>(v, cnv); in test_locale()
297 boost::cnv::cstream cnv; in test_locale() local
302 char const* eng_locale_name = test::cnv::is_msc ? "English_United States.1251" : "en_US.UTF-8"; in test_locale()
303 char const* rus_locale_name = test::cnv::is_msc ? "Russian_Russia.1251" : "ru_RU.UTF-8"; in test_locale()
304 char const* eng_expected = test::cnv::is_old_msc ? "1.235e-002" : "1.235e-02"; in test_locale()
305 char const* rus_expected = test::cnv::is_old_msc ? "1,235e-002" : "1,235e-02"; in test_locale()
306 char const* dbl_expected = test::cnv::is_old_msc ? "1.2345E-002" : "1.2345E-02"; in test_locale()
308 cnv(arg::precision = 4) in test_locale()
310 (arg::notation = cnv::notation::scientific); in test_locale()
312 double const double_v01 = convert<double>(dbl_expected, cnv).value_or(0); in test_locale()
313 string const double_s02 = convert<string>(double_v01, cnv).value_or("bad"); in test_locale()
328 cnv(arg::precision = 3)(arg::uppercase = false); in test_locale()
330 if (!eng_ignore) test_locale(double_v01, cnv(eng_locale), eng_expected); in test_locale()
331 if (!rus_ignore) test_locale(double_v01, cnv(rus_locale), rus_expected); in test_locale()
339 boost::cnv::cstream cnv; in test_user_str() local
342 cnv(std::setprecision(2))(std::fixed); in test_user_str()
344 BOOST_TEST(convert<int>(my_str, cnv).value_or(0) == 123); in test_user_str()
346 BOOST_TEST(convert<my_string>( 99.999, cnv).value_or("bad") == "100.00"); in test_user_str()
347 BOOST_TEST(convert<my_string>( 99.949, cnv).value_or("bad") == "99.95"); in test_user_str()
348 BOOST_TEST(convert<my_string>(-99.949, cnv).value_or("bad") == "-99.95"); in test_user_str()
360 if (!test::cnv::is_qnx) test_skipws_wchar(); in main()