MCPcopy Create free account
hub / github.com/MikeLankamp/fpm / test_invalid_conversion

Method test_invalid_conversion

tests/input.cpp:60–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58 }
59
60 void test_invalid_conversion(const std::string& text, const std::string& expected_remaining = "")
61 {
62 std::istringstream ss(text);
63 ss.imbue(m_locale);
64
65 fpm::fixed_16_16 value;
66 ss >> value;
67
68 // Stream should have a parse error
69 EXPECT_TRUE(ss.fail()) << "for text: \"" << text << "\"";;
70 EXPECT_FALSE(ss.bad()) << "for text: \"" << text << "\"";;
71 EXPECT_FALSE(ss.good()) << "for text: \"" << text << "\"";;
72
73 EXPECT_EQ(get_remainder(ss), expected_remaining) << "for text: \"" << text << "\"";
74 }
75
76 private:
77 static std::string get_remainder(std::istream& is)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected