diff --git a/include/ss/converter.hpp b/include/ss/converter.hpp index f18ed29..51b1004 100644 --- a/include/ss/converter.hpp +++ b/include/ss/converter.hpp @@ -370,7 +370,7 @@ private: std::vector input_; std::string string_error_; bool bool_error_; - enum error_mode error_mode_ { error_mode::String }; + enum error_mode error_mode_ { error_mode::Bool }; }; template <> diff --git a/include/ss/parser.hpp b/include/ss/parser.hpp index 5093cb1..845b2d8 100644 --- a/include/ss/parser.hpp +++ b/include/ss/parser.hpp @@ -331,7 +331,7 @@ private: const std::string delim_; std::string string_error_; bool bool_error_; - error_mode error_mode_{error_mode::String}; + error_mode error_mode_{error_mode::Bool}; converter converter_; converter::split_input split_input_; FILE* file_{nullptr}; diff --git a/test/test_converter.cpp b/test/test_converter.cpp index 6ded5f7..3e55d8d 100644 --- a/test/test_converter.cpp +++ b/test/test_converter.cpp @@ -328,10 +328,10 @@ TEST_CASE("testing error mode") { c.convert("junk"); CHECK(!c.valid()); - CHECK(!c.error_msg().empty()); + CHECK(c.error_msg().empty()); - c.set_error_mode(ss::error_mode::Bool); + c.set_error_mode(ss::error_mode::String); c.convert("junk"); CHECK(!c.valid()); - CHECK(c.error_msg().empty()); + CHECK(!c.error_msg().empty()); } diff --git a/test/test_parser.cpp b/test/test_parser.cpp index c1eae76..d7cbb74 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -186,6 +186,7 @@ TEST_CASE("testing composite conversion") { } ss::parser p{f.name, ","}; + p.set_error_mode(ss::error_mode::String); auto fail = [] { FAIL(""); }; auto expect_error = [](auto error) { CHECK(!error.empty()); }; @@ -452,12 +453,12 @@ TEST_CASE("testing error mode") { REQUIRE(!p.eof()); p.get_next(); CHECK(!p.valid()); - CHECK(!p.error_msg().empty()); + CHECK(p.error_msg().empty()); - p.set_error_mode(ss::error_mode::Bool); + p.set_error_mode(ss::error_mode::String); REQUIRE(!p.eof()); p.get_next(); CHECK(!p.valid()); - CHECK(p.error_msg().empty()); + CHECK(!p.error_msg().empty()); }