mirror of
https://github.com/boostorg/locale.git
synced 2026-01-19 04:22:08 +00:00
Test value only after successful parsing
Avoid subsequent failure reports if the parsing already failed
This commit is contained in:
@@ -907,8 +907,8 @@ void test_uint64_format()
|
||||
TEST_NE(ss.str(), posix_value);
|
||||
|
||||
uint64_t parsed_value{};
|
||||
TEST(ss >> parsed_value);
|
||||
TEST_EQ(parsed_value, value);
|
||||
if TEST(ss >> parsed_value)
|
||||
TEST_EQ(parsed_value, value);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ void test_by_char(const std::locale& l, locale_t lreal)
|
||||
|
||||
TEST(ss << 1045.45);
|
||||
double n;
|
||||
TEST(ss >> n);
|
||||
TEST_EQ(n, 1045.45);
|
||||
if TEST(ss >> n)
|
||||
TEST_EQ(n, 1045.45);
|
||||
TEST_EQ(ss.str(), ascii_to<CharType>("1045.45"));
|
||||
}
|
||||
|
||||
@@ -74,8 +74,8 @@ void test_by_char(const std::locale& l, locale_t lreal)
|
||||
ss << as::number;
|
||||
TEST(ss << 1045.45);
|
||||
double n;
|
||||
TEST(ss >> n);
|
||||
TEST_EQ(n, 1045.45);
|
||||
if TEST(ss >> n)
|
||||
TEST_EQ(n, 1045.45);
|
||||
|
||||
if(std::use_facet<boost::locale::info>(l).country() == "US")
|
||||
TEST_EQ(ss.str(), from_narrow<CharType>("1,045.45", lreal));
|
||||
|
||||
@@ -31,8 +31,8 @@ void test_by_char(const std::locale& l, const std::locale& lreal)
|
||||
|
||||
TEST(ss << 1045.45);
|
||||
double n;
|
||||
TEST(ss >> n);
|
||||
TEST_EQ(n, 1045.45);
|
||||
if TEST(ss >> n)
|
||||
TEST_EQ(n, 1045.45);
|
||||
TEST_EQ(ss.str(), ascii_to<CharType>("1045.45"));
|
||||
ss_ref_type ss_ref;
|
||||
ss_ref.imbue(std::locale::classic());
|
||||
@@ -51,8 +51,8 @@ void test_by_char(const std::locale& l, const std::locale& lreal)
|
||||
TEST(ss << as::number);
|
||||
TEST(ss << 1045.45);
|
||||
double n;
|
||||
TEST(ss >> n);
|
||||
TEST_EQ(n, 1045.45);
|
||||
if TEST(ss >> n)
|
||||
TEST_EQ(n, 1045.45);
|
||||
|
||||
ss_ref_type ss_ref;
|
||||
ss_ref.imbue(lreal);
|
||||
@@ -88,8 +88,8 @@ void test_by_char(const std::locale& l, const std::locale& lreal)
|
||||
TEST(ss << 1043.34);
|
||||
if(!bad_parsing) {
|
||||
double v1;
|
||||
TEST(ss >> v1);
|
||||
TEST_EQ(v1, 1043.34);
|
||||
if TEST(ss >> v1)
|
||||
TEST_EQ(v1, 1043.34);
|
||||
}
|
||||
|
||||
TEST_EQ(to_utf8(ss.str()), to_utf8(ss_ref.str()));
|
||||
@@ -103,8 +103,8 @@ void test_by_char(const std::locale& l, const std::locale& lreal)
|
||||
ss << as::currency << as::currency_iso;
|
||||
TEST(ss << 1043.34);
|
||||
double v1;
|
||||
TEST(ss >> v1);
|
||||
TEST_EQ(v1, 1043.34);
|
||||
if TEST(ss >> v1)
|
||||
TEST_EQ(v1, 1043.34);
|
||||
|
||||
ss_ref_type ss_ref;
|
||||
ss_ref.imbue(lreal);
|
||||
|
||||
@@ -39,8 +39,8 @@ void test_by_char(const std::locale& l, std::string name, int lcid)
|
||||
|
||||
TEST(ss << 1045.45);
|
||||
double n;
|
||||
TEST(ss >> n);
|
||||
TEST_EQ(n, 1045.45);
|
||||
if TEST(ss >> n)
|
||||
TEST_EQ(n, 1045.45);
|
||||
TEST_EQ(to_utf8(ss.str()), "1045.45");
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ void test_by_char(const std::locale& l, std::string name, int lcid)
|
||||
ss << as::number;
|
||||
TEST(ss << 1045.45);
|
||||
double n;
|
||||
TEST(ss >> n);
|
||||
TEST_EQ(n, 1045.45);
|
||||
if TEST(ss >> n)
|
||||
TEST_EQ(n, 1045.45);
|
||||
|
||||
if(name == "ru_RU.UTF-8") {
|
||||
BOOST_LOCALE_START_CONST_CONDITION
|
||||
|
||||
Reference in New Issue
Block a user