From f4bca3915f8717f9872682a384f0d9203c0bc21f Mon Sep 17 00:00:00 2001 From: red0124 <75804778+red0124@users.noreply.github.com> Date: Thu, 14 Mar 2024 04:28:33 +0100 Subject: [PATCH] Add [[nodiscard]] where fitting, update unit tests (#49) --- include/ss/common.hpp | 23 +- include/ss/converter.hpp | 40 +-- include/ss/exception.hpp | 4 +- include/ss/extract.hpp | 57 +++-- include/ss/parser.hpp | 75 +++--- include/ss/restrictions.hpp | 28 +-- include/ss/splitter.hpp | 20 +- include/ss/type_traits.hpp | 4 +- ssp.hpp | 249 ++++++++++--------- test/test_converter.cpp | 205 ++++++++------- test/test_extractions_without_fast_float.cpp | 1 - test/test_helpers.hpp | 1 + test/test_parser1.hpp | 15 +- test/test_parser1_1.cpp | 5 +- test/test_parser1_2.cpp | 25 +- test/test_parser1_3.cpp | 2 +- test/test_parser1_4.cpp | 14 +- test/test_parser2.hpp | 8 +- test/test_parser2_1.cpp | 1 - test/test_parser2_2.cpp | 1 - test/test_parser2_3.cpp | 1 - test/test_parser2_4.cpp | 1 - test/test_parser2_5.cpp | 1 - test/test_parser2_6.cpp | 1 - 24 files changed, 417 insertions(+), 365 deletions(-) diff --git a/include/ss/common.hpp b/include/ss/common.hpp index 61b0983..046e4e5 100644 --- a/include/ss/common.hpp +++ b/include/ss/common.hpp @@ -32,7 +32,7 @@ void assert_throw_on_error_not_defined() { "'throw_on_error' is enabled"); } -inline void* strict_realloc(void* ptr, size_t size) { +[[nodiscard]] inline void* strict_realloc(void* ptr, size_t size) { ptr = std::realloc(ptr, size); if (!ptr) { throw std::bad_alloc{}; @@ -42,14 +42,16 @@ inline void* strict_realloc(void* ptr, size_t size) { } #if __unix__ -inline ssize_t get_line_file(char*& lineptr, size_t& n, FILE* file) { +[[nodiscard]] inline ssize_t get_line_file(char*& lineptr, size_t& n, + FILE* file) { return getline(&lineptr, &n, file); } #else using ssize_t = intptr_t; -inline ssize_t get_line_file(char*& lineptr, size_t& n, FILE* file) { +[[nodiscard]] inline ssize_t get_line_file(char*& lineptr, size_t& n, + FILE* file) { std::array buff; if (lineptr == nullptr || n < sizeof(buff)) { @@ -85,9 +87,10 @@ inline ssize_t get_line_file(char*& lineptr, size_t& n, FILE* file) { #endif -inline ssize_t get_line_buffer(char*& lineptr, size_t& n, - const char* const csv_data_buffer, size_t csv_data_size, - size_t& curr_char) { +[[nodiscard]] inline ssize_t get_line_buffer(char*& lineptr, size_t& n, + const char* const csv_data_buffer, + size_t csv_data_size, + size_t& curr_char) { if (curr_char >= csv_data_size) { return -1; } @@ -122,10 +125,10 @@ inline ssize_t get_line_buffer(char*& lineptr, size_t& n, return line_used; } -inline std::tuple get_line(char*& buffer, size_t& buffer_size, - FILE* file, - const char* const csv_data_buffer, - size_t csv_data_size, size_t& curr_char) { +[[nodiscard]] inline std::tuple get_line( + char*& buffer, size_t& buffer_size, FILE* file, + const char* const csv_data_buffer, size_t csv_data_size, + size_t& curr_char) { ssize_t ssize = 0; if (file) { ssize = get_line_file(buffer, buffer_size, file); diff --git a/include/ss/converter.hpp b/include/ss/converter.hpp index 7855ea2..ca99122 100644 --- a/include/ss/converter.hpp +++ b/include/ss/converter.hpp @@ -110,15 +110,15 @@ public: // parses line with given delimiter, returns a 'T' object created with // extracted values of type 'Ts' template - T convert_object(line_ptr_type line, - const std::string& delim = default_delimiter) { + [[nodiscard]] T convert_object( + line_ptr_type line, const std::string& delim = default_delimiter) { return to_object(convert(line, delim)); } // parses line with given delimiter, returns tuple of objects with // extracted values of type 'Ts' template - no_void_validator_tup_t convert( + [[nodiscard]] no_void_validator_tup_t convert( line_ptr_type line, const std::string& delim = default_delimiter) { split(line, delim); if (splitter_.valid()) { @@ -131,13 +131,13 @@ public: // parses already split line, returns 'T' object with extracted values template - T convert_object(const split_data& elems) { + [[nodiscard]] T convert_object(const split_data& elems) { return to_object(convert(elems)); } // same as above, but uses cached split line template - T convert_object() { + [[nodiscard]] T convert_object() { return to_object(convert()); } @@ -146,7 +146,8 @@ public: // one argument is given which is a class which has a tied // method which returns a tuple, returns that type template - no_void_validator_tup_t convert(const split_data& elems) { + [[nodiscard]] no_void_validator_tup_t convert( + const split_data& elems) { if constexpr (sizeof...(Ts) == 0 && is_instance_of_v) { return convert_impl(elems, static_cast(nullptr)); } else if constexpr (tied_class_v) { @@ -162,11 +163,11 @@ public: // same as above, but uses cached split line template - no_void_validator_tup_t convert() { + [[nodiscard]] no_void_validator_tup_t convert() { return convert(splitter_.split_data_); } - bool valid() const { + [[nodiscard]] bool valid() const { if constexpr (string_error) { return error_.empty(); } else if constexpr (throw_on_error) { @@ -176,12 +177,12 @@ public: } } - const std::string& error_msg() const { + [[nodiscard]] const std::string& error_msg() const { assert_string_error_defined(); return error_; } - bool unterminated_quote() const { + [[nodiscard]] bool unterminated_quote() const { return splitter_.unterminated_quote(); } @@ -207,7 +208,7 @@ private: return splitter_.resplit(new_line, new_size, delim); } - size_t size_shifted() { + [[nodiscard]] size_t size_shifted() { return splitter_.size_shifted(); } @@ -223,7 +224,8 @@ private: } } - std::string error_sufix(const string_range msg, size_t pos) const { + [[nodiscard]] std::string error_sufix(const string_range msg, + size_t pos) const { constexpr static auto reserve_size = 32; std::string error; error.reserve(reserve_size); @@ -351,7 +353,8 @@ private: //////////////// template - no_void_validator_tup_t convert_impl(const split_data& elems) { + [[nodiscard]] no_void_validator_tup_t convert_impl( + const split_data& elems) { clear_error(); if (!splitter_.valid()) { @@ -382,7 +385,7 @@ private: } template - no_void_validator_tup_t> convert_impl( + [[nodiscard]] no_void_validator_tup_t> convert_impl( const split_data& elems, const std::tuple*) { return convert_impl(elems); } @@ -391,11 +394,11 @@ private: // column mapping //////////////// - bool columns_mapped() const { + [[nodiscard]] bool columns_mapped() const { return !column_mappings_.empty(); } - size_t column_position(size_t tuple_position) const { + [[nodiscard]] size_t column_position(size_t tuple_position) const { if (!columns_mapped()) { return tuple_position; } @@ -426,7 +429,7 @@ private: } if constexpr (std::is_same_v) { - extract(msg.first, msg.second, dst); + static_cast(extract(msg.first, msg.second, dst)); return; } @@ -472,7 +475,8 @@ private: } template - no_void_validator_tup_t extract_tuple(const split_data& elems) { + [[nodiscard]] no_void_validator_tup_t extract_tuple( + const split_data& elems) { static_assert(!all_of_v, "at least one parameter must be non void"); no_void_validator_tup_t ret{}; diff --git a/include/ss/exception.hpp b/include/ss/exception.hpp index 652967c..90f1441 100644 --- a/include/ss/exception.hpp +++ b/include/ss/exception.hpp @@ -12,10 +12,10 @@ class exception : public std::exception { std::string msg_; public: - exception(std::string msg): msg_{std::move(msg)} { + exception(std::string msg) : msg_{std::move(msg)} { } - char const* what() const noexcept override { + [[nodiscard]] char const* what() const noexcept override { return msg_.c_str(); } }; diff --git a/include/ss/extract.hpp b/include/ss/extract.hpp index 3c2f82e..3f662c7 100644 --- a/include/ss/extract.hpp +++ b/include/ss/extract.hpp @@ -13,8 +13,8 @@ #include #else #include -#include #include +#include #endif namespace ss { @@ -26,8 +26,8 @@ namespace ss { #ifndef SSP_DISABLE_FAST_FLOAT template -std::enable_if_t, std::optional> to_num( - const char* const begin, const char* const end) { +[[nodiscard]] std::enable_if_t, std::optional> +to_num(const char* const begin, const char* const end) { T ret; auto [ptr, ec] = fast_float::from_chars(begin, end, ret); @@ -40,8 +40,8 @@ std::enable_if_t, std::optional> to_num( #else template -std::enable_if_t, std::optional> to_num( - const char* const begin, const char* const end) { +[[nodiscard]] std::enable_if_t, std::optional> +to_num(const char* const begin, const char* const end) { static_assert(!std::is_same_v, "Conversion to long double is disabled"); @@ -114,7 +114,7 @@ using int8 = numeric_wrapper; using uint8 = numeric_wrapper; template -std::enable_if_t, std::optional> to_num( +[[nodiscard]] std::enable_if_t, std::optional> to_num( const char* const begin, const char* const end) { T ret; auto [ptr, ec] = std::from_chars(begin, end, ret); @@ -126,8 +126,9 @@ std::enable_if_t, std::optional> to_num( } template -std::enable_if_t, std::optional> to_num( - const char* const begin, const char* const end) { +[[nodiscard]] std::enable_if_t, + std::optional> +to_num(const char* const begin, const char* const end) { T ret; auto [ptr, ec] = std::from_chars(begin, end, ret.value); @@ -149,11 +150,12 @@ struct unsupported_type { } /* namespace errors */ template -std::enable_if_t && !std::is_floating_point_v && - !is_instance_of_v && - !is_instance_of_v && - !is_instance_of_v, - bool> +[[nodiscard]] std::enable_if_t && + !std::is_floating_point_v && + !is_instance_of_v && + !is_instance_of_v && + !is_instance_of_v, + bool> extract(const char*, const char*, T&) { static_assert(error::unsupported_type::value, "Conversion for given type is not defined, an " @@ -161,9 +163,10 @@ extract(const char*, const char*, T&) { } template -std::enable_if_t || std::is_floating_point_v || - is_instance_of_v, - bool> +[[nodiscard]] std::enable_if_t || + std::is_floating_point_v || + is_instance_of_v, + bool> extract(const char* begin, const char* end, T& value) { auto optional_value = to_num(begin, end); if (!optional_value) { @@ -174,8 +177,8 @@ extract(const char* begin, const char* end, T& value) { } template -std::enable_if_t, bool> extract( - const char* begin, const char* end, T& value) { +[[nodiscard]] std::enable_if_t, bool> +extract(const char* begin, const char* end, T& value) { typename T::value_type raw_value; if (extract(begin, end, raw_value)) { value = raw_value; @@ -186,7 +189,8 @@ std::enable_if_t, bool> extract( } template -bool extract_variant(const char* begin, const char* end, T& value) { +[[nodiscard]] bool extract_variant(const char* begin, const char* end, + T& value) { using IthType = std::variant_alternative_t>; IthType ithValue; if (extract(begin, end, ithValue)) { @@ -199,7 +203,7 @@ bool extract_variant(const char* begin, const char* end, T& value) { } template -std::enable_if_t, bool> extract( +[[nodiscard]] std::enable_if_t, bool> extract( const char* begin, const char* end, T& value) { return extract_variant(begin, end, value); } @@ -209,7 +213,8 @@ std::enable_if_t, bool> extract( //////////////// template <> -inline bool extract(const char* begin, const char* end, bool& value) { +[[nodiscard]] inline bool extract(const char* begin, const char* end, + bool& value) { if (end == begin + 1) { if (*begin == '1') { value = true; @@ -236,20 +241,22 @@ inline bool extract(const char* begin, const char* end, bool& value) { } template <> -inline bool extract(const char* begin, const char* end, char& value) { +[[nodiscard]] inline bool extract(const char* begin, const char* end, + char& value) { value = *begin; return (end == begin + 1); } template <> -inline bool extract(const char* begin, const char* end, std::string& value) { +[[nodiscard]] inline bool extract(const char* begin, const char* end, + std::string& value) { value = std::string{begin, end}; return true; } template <> -inline bool extract(const char* begin, const char* end, - std::string_view& value) { +[[nodiscard]] inline bool extract(const char* begin, const char* end, + std::string_view& value) { value = std::string_view{begin, static_cast(end - begin)}; return true; } diff --git a/include/ss/parser.hpp b/include/ss/parser.hpp index 5305a29..112fe1d 100644 --- a/include/ss/parser.hpp +++ b/include/ss/parser.hpp @@ -75,7 +75,7 @@ public: parser(const parser& other) = delete; parser& operator=(const parser& other) = delete; - bool valid() const { + [[nodiscard]] bool valid() const { if constexpr (string_error) { return error_.empty(); } else if constexpr (throw_on_error) { @@ -85,12 +85,12 @@ public: } } - const std::string& error_msg() const { + [[nodiscard]] const std::string& error_msg() const { assert_string_error_defined(); return error_; } - bool eof() const { + [[nodiscard]] bool eof() const { return eof_; } @@ -99,21 +99,21 @@ public: } template - T get_object() { + [[nodiscard]] T get_object() { return to_object(get_next()); } - size_t line() const { + [[nodiscard]] size_t line() const { return reader_.line_number_ > 0 ? reader_.line_number_ - 1 : reader_.line_number_; } - size_t position() const { + [[nodiscard]] size_t position() const { return reader_.chars_read_; } template - no_void_validator_tup_t get_next() { + [[nodiscard]] no_void_validator_tup_t get_next() { std::optional error; if (!eof_) { @@ -164,12 +164,12 @@ public: return value; } - std::string raw_header() const { + [[nodiscard]] std::string raw_header() const { assert_ignore_header_not_defined(); return raw_header_; } - std::vector header() { + [[nodiscard]] std::vector header() { assert_ignore_header_not_defined(); clear_error(); @@ -188,7 +188,7 @@ public: return split_header; } - bool field_exists(const std::string& field) { + [[nodiscard]] bool field_exists(const std::string& field) { assert_ignore_header_not_defined(); clear_error(); @@ -273,11 +273,11 @@ public: iterator& operator=(const iterator& other) = delete; iterator& operator=(iterator&& other) = delete; - value& operator*() { + [[nodiscard]] value& operator*() { return value_; } - value* operator->() { + [[nodiscard]] value* operator->() { return &value_; } @@ -302,13 +302,15 @@ public: return result; } - friend bool operator==(const iterator& lhs, const iterator& rhs) { + [[nodiscard]] friend bool operator==(const iterator& lhs, + const iterator& rhs) { return (lhs.parser_ == nullptr && rhs.parser_ == nullptr) || (lhs.parser_ == rhs.parser_ && &lhs.value_ == &rhs.value_); } - friend bool operator!=(const iterator& lhs, const iterator& rhs) { + [[nodiscard]] friend bool operator!=(const iterator& lhs, + const iterator& rhs) { return !(lhs == rhs); } @@ -320,11 +322,11 @@ public: iterable(parser* parser) : parser_{parser} { } - iterator begin() { + [[nodiscard]] iterator begin() { return ++iterator{parser_}; } - iterator end() { + [[nodiscard]] iterator end() { return iterator{}; } @@ -333,12 +335,12 @@ public: }; template - auto iterate() { + [[nodiscard]] auto iterate() { return iterable{this}; } template - auto iterate_object() { + [[nodiscard]] auto iterate_object() { return iterable{this}; } @@ -376,7 +378,7 @@ public: return composite_with(std::move(value)); } - std::tuple values() { + [[nodiscard]] std::tuple values() { return values_; } @@ -399,7 +401,7 @@ public: private: template - composite composite_with(T&& new_value) { + [[nodiscard]] composite composite_with(T&& new_value) { auto merged_values = std::tuple_cat(std::move(values_), std::tuple{parser_.valid() @@ -429,7 +431,7 @@ public: } template - no_void_validator_tup_t try_same() { + [[nodiscard]] no_void_validator_tup_t try_same() { parser_.clear_error(); auto value = parser_.reader_.converter_.template convert(); @@ -450,8 +452,8 @@ public: // tries to convert a line and returns a composite which is // able to try additional conversions in case of failure template - composite>> try_next( - Fun&& fun = none{}) { + [[nodiscard]] composite>> + try_next(Fun&& fun = none{}) { assert_throw_on_error_not_defined(); using Ret = no_void_validator_tup_t; return try_invoke_and_make_composite< @@ -461,7 +463,7 @@ public: // identical to try_next but returns composite with object instead of a // tuple template - composite> try_object(Fun&& fun = none{}) { + [[nodiscard]] composite> try_object(Fun&& fun = none{}) { assert_throw_on_error_not_defined(); return try_invoke_and_make_composite< std::optional>(get_object(), std::forward(fun)); @@ -512,7 +514,8 @@ private: } template - composite try_invoke_and_make_composite(T&& value, Fun&& fun) { + [[nodiscard]] composite try_invoke_and_make_composite(T&& value, + Fun&& fun) { if (valid()) { try_invoke(*value, std::forward(fun)); } @@ -528,7 +531,8 @@ private: "cannot use this method when 'ignore_header' is defined"); } - bool strict_split(header_splitter& splitter, std::string& header) { + [[nodiscard]] bool strict_split(header_splitter& splitter, + std::string& header) { if (header.empty()) { return false; } @@ -575,7 +579,7 @@ private: } } - std::optional header_index(const std::string& field) { + [[nodiscard]] std::optional header_index(const std::string& field) { auto it = std::find(header_.begin(), header_.end(), field); if (it == header_.end()) { @@ -846,7 +850,7 @@ private: reader& operator=(const reader& other) = delete; // read next line each time in order to set eof_ - bool read_next() { + [[nodiscard]] bool read_next() { next_line_converter_.clear_error(); size_t size = 0; while (size == 0) { @@ -938,7 +942,7 @@ private: std::swap(converter_, next_line_converter_); } - bool multiline_limit_reached(size_t& limit) { + [[nodiscard]] bool multiline_limit_reached(size_t& limit) { if constexpr (multiline::size > 0) { if (limit++ >= multiline::size) { next_line_converter_.handle_error_multiline_limit_reached(); @@ -948,7 +952,7 @@ private: return false; } - bool escaped_eol(size_t size) { + [[nodiscard]] bool escaped_eol(size_t size) { const char* curr = nullptr; for (curr = next_line_buffer_ + size - 1; curr >= next_line_buffer_ && @@ -958,7 +962,7 @@ private: return (next_line_buffer_ - curr + size) % 2 == 0; } - bool unterminated_quote() { + [[nodiscard]] bool unterminated_quote() { return next_line_converter_.unterminated_quote(); } @@ -973,7 +977,7 @@ private: } } - size_t remove_eol(char*& buffer, size_t ssize) { + [[nodiscard]] size_t remove_eol(char*& buffer, size_t ssize) { if (buffer[ssize - 1] != '\n') { crlf_ = false; return ssize; @@ -1003,8 +1007,9 @@ private: first_size += second_size; } - bool append_next_line_to_buffer(char*& buffer, size_t& line_size, - size_t buffer_size) { + [[nodiscard]] bool append_next_line_to_buffer(char*& buffer, + size_t& line_size, + size_t buffer_size) { undo_remove_eol(buffer, line_size, buffer_size); chars_read_ = curr_char_; @@ -1023,7 +1028,7 @@ private: return true; } - std::string get_buffer() { + [[nodiscard]] std::string get_buffer() { return std::string{next_line_buffer_, next_line_size_}; } diff --git a/include/ss/restrictions.hpp b/include/ss/restrictions.hpp index e21a473..bcd8335 100644 --- a/include/ss/restrictions.hpp +++ b/include/ss/restrictions.hpp @@ -10,7 +10,7 @@ template struct ax { private: template - bool ss_valid_impl(const T& x) const { + [[nodiscard]] bool ss_valid_impl(const T& x) const { if constexpr (sizeof...(Xs) != 0) { return x != X && ss_valid_impl(x); } @@ -18,11 +18,11 @@ private: } public: - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return ss_valid_impl(value); } - const char* error() const { + [[nodiscard]] const char* error() const { return "value excluded"; } }; @@ -35,7 +35,7 @@ template struct nx { private: template - bool ss_valid_impl(const T& x) const { + [[nodiscard]] bool ss_valid_impl(const T& x) const { if constexpr (sizeof...(Xs) != 0) { return x == X || ss_valid_impl(x); } @@ -43,11 +43,11 @@ private: } public: - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return ss_valid_impl(value); } - const char* error() const { + [[nodiscard]] const char* error() const { return "value excluded"; } }; @@ -61,28 +61,28 @@ public: template struct gt { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return value > N; } }; template struct gte { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return value >= N; } }; template struct lt { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return value < N; } }; template struct lte { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return value <= N; } }; @@ -93,7 +93,7 @@ struct lte { template struct ir { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return value >= Min && value <= Max; } }; @@ -104,7 +104,7 @@ struct ir { template struct oor { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return value < Min || value > Max; } }; @@ -115,11 +115,11 @@ struct oor { template struct ne { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return !value.empty(); } - const char* error() const { + [[nodiscard]] const char* error() const { return "empty field"; } }; diff --git a/include/ss/splitter.hpp b/include/ss/splitter.hpp index d6278ff..da15a9d 100644 --- a/include/ss/splitter.hpp +++ b/include/ss/splitter.hpp @@ -28,7 +28,7 @@ private: public: using line_ptr_type = std::conditional_t; - bool valid() const { + [[nodiscard]] bool valid() const { if constexpr (string_error) { return error_.empty(); } else if constexpr (throw_on_error) { @@ -38,12 +38,12 @@ public: } } - const std::string& error_msg() const { + [[nodiscard]] const std::string& error_msg() const { assert_string_error_defined(); return error_; } - bool unterminated_quote() const { + [[nodiscard]] bool unterminated_quote() const { return unterminated_quote_; } @@ -61,7 +61,7 @@ private: //////////////// // number of characters the end of line is shifted backwards - size_t size_shifted() const { + [[nodiscard]] size_t size_shifted() const { return escaped_; } @@ -192,19 +192,19 @@ private: // matching //////////////// - bool match(const char* const curr, char delim) { + [[nodiscard]] bool match(const char* const curr, char delim) { return *curr == delim; }; - bool match(const char* const curr, const std::string& delim) { + [[nodiscard]] bool match(const char* const curr, const std::string& delim) { return std::strncmp(curr, delim.c_str(), delim.size()) == 0; }; - size_t delimiter_size(char) { + [[nodiscard]] size_t delimiter_size(char) { return 1; } - size_t delimiter_size(const std::string& delim) { + [[nodiscard]] size_t delimiter_size(const std::string& delim) { return delim.size(); } @@ -225,8 +225,8 @@ private: } template - std::tuple match_delimiter(line_ptr_type begin, - const Delim& delim) { + [[nodiscard]] std::tuple match_delimiter(line_ptr_type begin, + const Delim& delim) { line_ptr_type end = begin; trim_right_if_enabled(end); diff --git a/include/ss/type_traits.hpp b/include/ss/type_traits.hpp index f56ee94..0f8a776 100644 --- a/include/ss/type_traits.hpp +++ b/include/ss/type_traits.hpp @@ -366,12 +366,12 @@ constexpr bool is_instance_of_v = is_instance_of::value; //////////////// template -T to_object_impl(std::index_sequence, U&& data) { +[[nodiscard]] T to_object_impl(std::index_sequence, U&& data) { return {std::get(std::forward(data))...}; } template -T to_object(U&& data) { +[[nodiscard]] T to_object(U&& data) { using NoRefU = std::decay_t; if constexpr (is_instance_of_v) { return to_object_impl< diff --git a/ssp.hpp b/ssp.hpp index 6d6513a..52e313e 100644 --- a/ssp.hpp +++ b/ssp.hpp @@ -381,12 +381,12 @@ constexpr bool is_instance_of_v = is_instance_of::value; //////////////// template -T to_object_impl(std::index_sequence, U&& data) { +[[nodiscard]] T to_object_impl(std::index_sequence, U&& data) { return {std::get(std::forward(data))...}; } template -T to_object(U&& data) { +[[nodiscard]] T to_object(U&& data) { using NoRefU = std::decay_t; if constexpr (is_instance_of_v) { return to_object_impl< @@ -409,10 +409,10 @@ class exception : public std::exception { std::string msg_; public: - exception(std::string msg): msg_{std::move(msg)} { + exception(std::string msg) : msg_{std::move(msg)} { } - char const* what() const noexcept override { + [[nodiscard]] char const* what() const noexcept override { return msg_.c_str(); } }; @@ -505,7 +505,7 @@ template struct ax { private: template - bool ss_valid_impl(const T& x) const { + [[nodiscard]] bool ss_valid_impl(const T& x) const { if constexpr (sizeof...(Xs) != 0) { return x != X && ss_valid_impl(x); } @@ -513,11 +513,11 @@ private: } public: - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return ss_valid_impl(value); } - const char* error() const { + [[nodiscard]] const char* error() const { return "value excluded"; } }; @@ -530,7 +530,7 @@ template struct nx { private: template - bool ss_valid_impl(const T& x) const { + [[nodiscard]] bool ss_valid_impl(const T& x) const { if constexpr (sizeof...(Xs) != 0) { return x == X || ss_valid_impl(x); } @@ -538,11 +538,11 @@ private: } public: - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return ss_valid_impl(value); } - const char* error() const { + [[nodiscard]] const char* error() const { return "value excluded"; } }; @@ -556,28 +556,28 @@ public: template struct gt { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return value > N; } }; template struct gte { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return value >= N; } }; template struct lt { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return value < N; } }; template struct lte { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return value <= N; } }; @@ -588,7 +588,7 @@ struct lte { template struct ir { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return value >= Min && value <= Max; } }; @@ -599,7 +599,7 @@ struct ir { template struct oor { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return value < Min || value > Max; } }; @@ -610,11 +610,11 @@ struct oor { template struct ne { - bool ss_valid(const T& value) const { + [[nodiscard]] bool ss_valid(const T& value) const { return !value.empty(); } - const char* error() const { + [[nodiscard]] const char* error() const { return "empty field"; } }; @@ -648,7 +648,7 @@ void assert_throw_on_error_not_defined() { "'throw_on_error' is enabled"); } -inline void* strict_realloc(void* ptr, size_t size) { +[[nodiscard]] inline void* strict_realloc(void* ptr, size_t size) { ptr = std::realloc(ptr, size); if (!ptr) { throw std::bad_alloc{}; @@ -658,14 +658,16 @@ inline void* strict_realloc(void* ptr, size_t size) { } #if __unix__ -inline ssize_t get_line_file(char*& lineptr, size_t& n, FILE* file) { +[[nodiscard]] inline ssize_t get_line_file(char*& lineptr, size_t& n, + FILE* file) { return getline(&lineptr, &n, file); } #else using ssize_t = intptr_t; -inline ssize_t get_line_file(char*& lineptr, size_t& n, FILE* file) { +[[nodiscard]] inline ssize_t get_line_file(char*& lineptr, size_t& n, + FILE* file) { std::array buff; if (lineptr == nullptr || n < sizeof(buff)) { @@ -701,9 +703,10 @@ inline ssize_t get_line_file(char*& lineptr, size_t& n, FILE* file) { #endif -inline ssize_t get_line_buffer(char*& lineptr, size_t& n, - const char* const csv_data_buffer, size_t csv_data_size, - size_t& curr_char) { +[[nodiscard]] inline ssize_t get_line_buffer(char*& lineptr, size_t& n, + const char* const csv_data_buffer, + size_t csv_data_size, + size_t& curr_char) { if (curr_char >= csv_data_size) { return -1; } @@ -738,10 +741,10 @@ inline ssize_t get_line_buffer(char*& lineptr, size_t& n, return line_used; } -inline std::tuple get_line(char*& buffer, size_t& buffer_size, - FILE* file, - const char* const csv_data_buffer, - size_t csv_data_size, size_t& curr_char) { +[[nodiscard]] inline std::tuple get_line( + char*& buffer, size_t& buffer_size, FILE* file, + const char* const csv_data_buffer, size_t csv_data_size, + size_t& curr_char) { ssize_t ssize = 0; if (file) { ssize = get_line_file(buffer, buffer_size, file); @@ -1079,7 +1082,7 @@ private: public: using line_ptr_type = std::conditional_t; - bool valid() const { + [[nodiscard]] bool valid() const { if constexpr (string_error) { return error_.empty(); } else if constexpr (throw_on_error) { @@ -1089,12 +1092,12 @@ public: } } - const std::string& error_msg() const { + [[nodiscard]] const std::string& error_msg() const { assert_string_error_defined(); return error_; } - bool unterminated_quote() const { + [[nodiscard]] bool unterminated_quote() const { return unterminated_quote_; } @@ -1112,7 +1115,7 @@ private: //////////////// // number of characters the end of line is shifted backwards - size_t size_shifted() const { + [[nodiscard]] size_t size_shifted() const { return escaped_; } @@ -1243,19 +1246,19 @@ private: // matching //////////////// - bool match(const char* const curr, char delim) { + [[nodiscard]] bool match(const char* const curr, char delim) { return *curr == delim; }; - bool match(const char* const curr, const std::string& delim) { + [[nodiscard]] bool match(const char* const curr, const std::string& delim) { return std::strncmp(curr, delim.c_str(), delim.size()) == 0; }; - size_t delimiter_size(char) { + [[nodiscard]] size_t delimiter_size(char) { return 1; } - size_t delimiter_size(const std::string& delim) { + [[nodiscard]] size_t delimiter_size(const std::string& delim) { return delim.size(); } @@ -1276,8 +1279,8 @@ private: } template - std::tuple match_delimiter(line_ptr_type begin, - const Delim& delim) { + [[nodiscard]] std::tuple match_delimiter(line_ptr_type begin, + const Delim& delim) { line_ptr_type end = begin; trim_right_if_enabled(end); @@ -1545,8 +1548,8 @@ namespace ss { #ifndef SSP_DISABLE_FAST_FLOAT template -std::enable_if_t, std::optional> to_num( - const char* const begin, const char* const end) { +[[nodiscard]] std::enable_if_t, std::optional> +to_num(const char* const begin, const char* const end) { T ret; auto [ptr, ec] = fast_float::from_chars(begin, end, ret); @@ -1559,8 +1562,8 @@ std::enable_if_t, std::optional> to_num( #else template -std::enable_if_t, std::optional> to_num( - const char* const begin, const char* const end) { +[[nodiscard]] std::enable_if_t, std::optional> +to_num(const char* const begin, const char* const end) { static_assert(!std::is_same_v, "Conversion to long double is disabled"); @@ -1633,7 +1636,7 @@ using int8 = numeric_wrapper; using uint8 = numeric_wrapper; template -std::enable_if_t, std::optional> to_num( +[[nodiscard]] std::enable_if_t, std::optional> to_num( const char* const begin, const char* const end) { T ret; auto [ptr, ec] = std::from_chars(begin, end, ret); @@ -1645,8 +1648,9 @@ std::enable_if_t, std::optional> to_num( } template -std::enable_if_t, std::optional> to_num( - const char* const begin, const char* const end) { +[[nodiscard]] std::enable_if_t, + std::optional> +to_num(const char* const begin, const char* const end) { T ret; auto [ptr, ec] = std::from_chars(begin, end, ret.value); @@ -1668,11 +1672,12 @@ struct unsupported_type { } /* namespace errors */ template -std::enable_if_t && !std::is_floating_point_v && - !is_instance_of_v && - !is_instance_of_v && - !is_instance_of_v, - bool> +[[nodiscard]] std::enable_if_t && + !std::is_floating_point_v && + !is_instance_of_v && + !is_instance_of_v && + !is_instance_of_v, + bool> extract(const char*, const char*, T&) { static_assert(error::unsupported_type::value, "Conversion for given type is not defined, an " @@ -1680,9 +1685,10 @@ extract(const char*, const char*, T&) { } template -std::enable_if_t || std::is_floating_point_v || - is_instance_of_v, - bool> +[[nodiscard]] std::enable_if_t || + std::is_floating_point_v || + is_instance_of_v, + bool> extract(const char* begin, const char* end, T& value) { auto optional_value = to_num(begin, end); if (!optional_value) { @@ -1693,8 +1699,8 @@ extract(const char* begin, const char* end, T& value) { } template -std::enable_if_t, bool> extract( - const char* begin, const char* end, T& value) { +[[nodiscard]] std::enable_if_t, bool> +extract(const char* begin, const char* end, T& value) { typename T::value_type raw_value; if (extract(begin, end, raw_value)) { value = raw_value; @@ -1705,7 +1711,8 @@ std::enable_if_t, bool> extract( } template -bool extract_variant(const char* begin, const char* end, T& value) { +[[nodiscard]] bool extract_variant(const char* begin, const char* end, + T& value) { using IthType = std::variant_alternative_t>; IthType ithValue; if (extract(begin, end, ithValue)) { @@ -1718,7 +1725,7 @@ bool extract_variant(const char* begin, const char* end, T& value) { } template -std::enable_if_t, bool> extract( +[[nodiscard]] std::enable_if_t, bool> extract( const char* begin, const char* end, T& value) { return extract_variant(begin, end, value); } @@ -1728,7 +1735,8 @@ std::enable_if_t, bool> extract( //////////////// template <> -inline bool extract(const char* begin, const char* end, bool& value) { +[[nodiscard]] inline bool extract(const char* begin, const char* end, + bool& value) { if (end == begin + 1) { if (*begin == '1') { value = true; @@ -1755,20 +1763,22 @@ inline bool extract(const char* begin, const char* end, bool& value) { } template <> -inline bool extract(const char* begin, const char* end, char& value) { +[[nodiscard]] inline bool extract(const char* begin, const char* end, + char& value) { value = *begin; return (end == begin + 1); } template <> -inline bool extract(const char* begin, const char* end, std::string& value) { +[[nodiscard]] inline bool extract(const char* begin, const char* end, + std::string& value) { value = std::string{begin, end}; return true; } template <> -inline bool extract(const char* begin, const char* end, - std::string_view& value) { +[[nodiscard]] inline bool extract(const char* begin, const char* end, + std::string_view& value) { value = std::string_view{begin, static_cast(end - begin)}; return true; } @@ -1876,15 +1886,15 @@ public: // parses line with given delimiter, returns a 'T' object created with // extracted values of type 'Ts' template - T convert_object(line_ptr_type line, - const std::string& delim = default_delimiter) { + [[nodiscard]] T convert_object( + line_ptr_type line, const std::string& delim = default_delimiter) { return to_object(convert(line, delim)); } // parses line with given delimiter, returns tuple of objects with // extracted values of type 'Ts' template - no_void_validator_tup_t convert( + [[nodiscard]] no_void_validator_tup_t convert( line_ptr_type line, const std::string& delim = default_delimiter) { split(line, delim); if (splitter_.valid()) { @@ -1897,13 +1907,13 @@ public: // parses already split line, returns 'T' object with extracted values template - T convert_object(const split_data& elems) { + [[nodiscard]] T convert_object(const split_data& elems) { return to_object(convert(elems)); } // same as above, but uses cached split line template - T convert_object() { + [[nodiscard]] T convert_object() { return to_object(convert()); } @@ -1912,7 +1922,8 @@ public: // one argument is given which is a class which has a tied // method which returns a tuple, returns that type template - no_void_validator_tup_t convert(const split_data& elems) { + [[nodiscard]] no_void_validator_tup_t convert( + const split_data& elems) { if constexpr (sizeof...(Ts) == 0 && is_instance_of_v) { return convert_impl(elems, static_cast(nullptr)); } else if constexpr (tied_class_v) { @@ -1928,11 +1939,11 @@ public: // same as above, but uses cached split line template - no_void_validator_tup_t convert() { + [[nodiscard]] no_void_validator_tup_t convert() { return convert(splitter_.split_data_); } - bool valid() const { + [[nodiscard]] bool valid() const { if constexpr (string_error) { return error_.empty(); } else if constexpr (throw_on_error) { @@ -1942,12 +1953,12 @@ public: } } - const std::string& error_msg() const { + [[nodiscard]] const std::string& error_msg() const { assert_string_error_defined(); return error_; } - bool unterminated_quote() const { + [[nodiscard]] bool unterminated_quote() const { return splitter_.unterminated_quote(); } @@ -1973,7 +1984,7 @@ private: return splitter_.resplit(new_line, new_size, delim); } - size_t size_shifted() { + [[nodiscard]] size_t size_shifted() { return splitter_.size_shifted(); } @@ -1989,7 +2000,8 @@ private: } } - std::string error_sufix(const string_range msg, size_t pos) const { + [[nodiscard]] std::string error_sufix(const string_range msg, + size_t pos) const { constexpr static auto reserve_size = 32; std::string error; error.reserve(reserve_size); @@ -2117,7 +2129,8 @@ private: //////////////// template - no_void_validator_tup_t convert_impl(const split_data& elems) { + [[nodiscard]] no_void_validator_tup_t convert_impl( + const split_data& elems) { clear_error(); if (!splitter_.valid()) { @@ -2148,7 +2161,7 @@ private: } template - no_void_validator_tup_t> convert_impl( + [[nodiscard]] no_void_validator_tup_t> convert_impl( const split_data& elems, const std::tuple*) { return convert_impl(elems); } @@ -2157,11 +2170,11 @@ private: // column mapping //////////////// - bool columns_mapped() const { + [[nodiscard]] bool columns_mapped() const { return !column_mappings_.empty(); } - size_t column_position(size_t tuple_position) const { + [[nodiscard]] size_t column_position(size_t tuple_position) const { if (!columns_mapped()) { return tuple_position; } @@ -2192,7 +2205,7 @@ private: } if constexpr (std::is_same_v) { - extract(msg.first, msg.second, dst); + static_cast(extract(msg.first, msg.second, dst)); return; } @@ -2238,7 +2251,8 @@ private: } template - no_void_validator_tup_t extract_tuple(const split_data& elems) { + [[nodiscard]] no_void_validator_tup_t extract_tuple( + const split_data& elems) { static_assert(!all_of_v, "at least one parameter must be non void"); no_void_validator_tup_t ret{}; @@ -2327,7 +2341,7 @@ public: parser(const parser& other) = delete; parser& operator=(const parser& other) = delete; - bool valid() const { + [[nodiscard]] bool valid() const { if constexpr (string_error) { return error_.empty(); } else if constexpr (throw_on_error) { @@ -2337,12 +2351,12 @@ public: } } - const std::string& error_msg() const { + [[nodiscard]] const std::string& error_msg() const { assert_string_error_defined(); return error_; } - bool eof() const { + [[nodiscard]] bool eof() const { return eof_; } @@ -2351,21 +2365,21 @@ public: } template - T get_object() { + [[nodiscard]] T get_object() { return to_object(get_next()); } - size_t line() const { + [[nodiscard]] size_t line() const { return reader_.line_number_ > 0 ? reader_.line_number_ - 1 : reader_.line_number_; } - size_t position() const { + [[nodiscard]] size_t position() const { return reader_.chars_read_; } template - no_void_validator_tup_t get_next() { + [[nodiscard]] no_void_validator_tup_t get_next() { std::optional error; if (!eof_) { @@ -2416,12 +2430,12 @@ public: return value; } - std::string raw_header() const { + [[nodiscard]] std::string raw_header() const { assert_ignore_header_not_defined(); return raw_header_; } - std::vector header() { + [[nodiscard]] std::vector header() { assert_ignore_header_not_defined(); clear_error(); @@ -2440,7 +2454,7 @@ public: return split_header; } - bool field_exists(const std::string& field) { + [[nodiscard]] bool field_exists(const std::string& field) { assert_ignore_header_not_defined(); clear_error(); @@ -2525,11 +2539,11 @@ public: iterator& operator=(const iterator& other) = delete; iterator& operator=(iterator&& other) = delete; - value& operator*() { + [[nodiscard]] value& operator*() { return value_; } - value* operator->() { + [[nodiscard]] value* operator->() { return &value_; } @@ -2554,13 +2568,15 @@ public: return result; } - friend bool operator==(const iterator& lhs, const iterator& rhs) { + [[nodiscard]] friend bool operator==(const iterator& lhs, + const iterator& rhs) { return (lhs.parser_ == nullptr && rhs.parser_ == nullptr) || (lhs.parser_ == rhs.parser_ && &lhs.value_ == &rhs.value_); } - friend bool operator!=(const iterator& lhs, const iterator& rhs) { + [[nodiscard]] friend bool operator!=(const iterator& lhs, + const iterator& rhs) { return !(lhs == rhs); } @@ -2572,11 +2588,11 @@ public: iterable(parser* parser) : parser_{parser} { } - iterator begin() { + [[nodiscard]] iterator begin() { return ++iterator{parser_}; } - iterator end() { + [[nodiscard]] iterator end() { return iterator{}; } @@ -2585,12 +2601,12 @@ public: }; template - auto iterate() { + [[nodiscard]] auto iterate() { return iterable{this}; } template - auto iterate_object() { + [[nodiscard]] auto iterate_object() { return iterable{this}; } @@ -2628,7 +2644,7 @@ public: return composite_with(std::move(value)); } - std::tuple values() { + [[nodiscard]] std::tuple values() { return values_; } @@ -2651,7 +2667,7 @@ public: private: template - composite composite_with(T&& new_value) { + [[nodiscard]] composite composite_with(T&& new_value) { auto merged_values = std::tuple_cat(std::move(values_), std::tuple{parser_.valid() @@ -2681,7 +2697,7 @@ public: } template - no_void_validator_tup_t try_same() { + [[nodiscard]] no_void_validator_tup_t try_same() { parser_.clear_error(); auto value = parser_.reader_.converter_.template convert(); @@ -2702,8 +2718,8 @@ public: // tries to convert a line and returns a composite which is // able to try additional conversions in case of failure template - composite>> try_next( - Fun&& fun = none{}) { + [[nodiscard]] composite>> + try_next(Fun&& fun = none{}) { assert_throw_on_error_not_defined(); using Ret = no_void_validator_tup_t; return try_invoke_and_make_composite< @@ -2713,7 +2729,7 @@ public: // identical to try_next but returns composite with object instead of a // tuple template - composite> try_object(Fun&& fun = none{}) { + [[nodiscard]] composite> try_object(Fun&& fun = none{}) { assert_throw_on_error_not_defined(); return try_invoke_and_make_composite< std::optional>(get_object(), std::forward(fun)); @@ -2764,7 +2780,8 @@ private: } template - composite try_invoke_and_make_composite(T&& value, Fun&& fun) { + [[nodiscard]] composite try_invoke_and_make_composite(T&& value, + Fun&& fun) { if (valid()) { try_invoke(*value, std::forward(fun)); } @@ -2780,7 +2797,8 @@ private: "cannot use this method when 'ignore_header' is defined"); } - bool strict_split(header_splitter& splitter, std::string& header) { + [[nodiscard]] bool strict_split(header_splitter& splitter, + std::string& header) { if (header.empty()) { return false; } @@ -2827,7 +2845,7 @@ private: } } - std::optional header_index(const std::string& field) { + [[nodiscard]] std::optional header_index(const std::string& field) { auto it = std::find(header_.begin(), header_.end(), field); if (it == header_.end()) { @@ -3098,7 +3116,7 @@ private: reader& operator=(const reader& other) = delete; // read next line each time in order to set eof_ - bool read_next() { + [[nodiscard]] bool read_next() { next_line_converter_.clear_error(); size_t size = 0; while (size == 0) { @@ -3190,7 +3208,7 @@ private: std::swap(converter_, next_line_converter_); } - bool multiline_limit_reached(size_t& limit) { + [[nodiscard]] bool multiline_limit_reached(size_t& limit) { if constexpr (multiline::size > 0) { if (limit++ >= multiline::size) { next_line_converter_.handle_error_multiline_limit_reached(); @@ -3200,7 +3218,7 @@ private: return false; } - bool escaped_eol(size_t size) { + [[nodiscard]] bool escaped_eol(size_t size) { const char* curr = nullptr; for (curr = next_line_buffer_ + size - 1; curr >= next_line_buffer_ && @@ -3210,7 +3228,7 @@ private: return (next_line_buffer_ - curr + size) % 2 == 0; } - bool unterminated_quote() { + [[nodiscard]] bool unterminated_quote() { return next_line_converter_.unterminated_quote(); } @@ -3225,7 +3243,7 @@ private: } } - size_t remove_eol(char*& buffer, size_t ssize) { + [[nodiscard]] size_t remove_eol(char*& buffer, size_t ssize) { if (buffer[ssize - 1] != '\n') { crlf_ = false; return ssize; @@ -3255,8 +3273,9 @@ private: first_size += second_size; } - bool append_next_line_to_buffer(char*& buffer, size_t& line_size, - size_t buffer_size) { + [[nodiscard]] bool append_next_line_to_buffer(char*& buffer, + size_t& line_size, + size_t buffer_size) { undo_remove_eol(buffer, line_size, buffer_size); chars_read_ = curr_char_; @@ -3275,7 +3294,7 @@ private: return true; } - std::string get_buffer() { + [[nodiscard]] std::string get_buffer() { return std::string{next_line_buffer_, next_line_size_}; } diff --git a/test/test_converter.cpp b/test/test_converter.cpp index 659e78f..e4e0a8c 100644 --- a/test/test_converter.cpp +++ b/test/test_converter.cpp @@ -1,17 +1,17 @@ #include "test_helpers.hpp" -#include #include TEST_CASE("converter test split") { ss::converter c; for (const auto& [s, expected, delim] : // clang-format off - {std::make_tuple("a,b,c,d", std::vector{"a", "b", "c", "d"}, ","), - {"", {}, " "}, - {" x x x x | x ", {" x x x x ", " x "}, "|"}, - {"a::b::c::d", {"a", "b", "c", "d"}, "::"}, - {"x\t-\ty", {"x", "y"}, "\t-\t"}, - {"x", {"x"}, ","}} // clang-format on + {std::make_tuple("a,b,c,d", std::vector{"a", "b", "c", "d"}, ","), + {"", {}, " "}, + {" x x x x | x ", {" x x x x ", " x "}, "|"}, + {"a::b::c::d", {"a", "b", "c", "d"}, "::"}, + {"x\t-\ty", {"x", "y"}, "\t-\t"}, + {"x", {"x"}, ","}} + // clang-format on ) { auto split = c.split(s, delim); CHECK_EQ(split.size(), expected.size()); @@ -278,37 +278,38 @@ TEST_CASE_TEMPLATE("converter test valid conversions with exceptions", T, int, TEST_CASE_TEMPLATE("converter test invalid conversions", T, int, ss::uint8) { ss::converter c; - c.convert(""); + std::ignore = c.convert(""); REQUIRE_FALSE(c.valid()); - c.convert("1", ""); + std::ignore = c.convert("1", ""); REQUIRE_FALSE(c.valid()); - c.convert("10", ""); + std::ignore = c.convert("10", ""); REQUIRE_FALSE(c.valid()); - c.convert(""); + std::ignore = c.convert(""); REQUIRE_FALSE(c.valid()); - c.convert(",junk"); + std::ignore = c.convert(",junk"); REQUIRE_FALSE(c.valid()); - c.convert("junk,"); + std::ignore = c.convert("junk,"); REQUIRE_FALSE(c.valid()); - c.convert("x"); + std::ignore = c.convert("x"); REQUIRE_FALSE(c.valid()); - c.convert("x"); + std::ignore = c.convert("x"); REQUIRE_FALSE(c.valid()); - c.convert("x,junk"); + std::ignore = c.convert("x,junk"); REQUIRE_FALSE(c.valid()); - c.convert("junk,x"); + std::ignore = c.convert("junk,x"); REQUIRE_FALSE(c.valid()); - c.convert, double>("junk;.5.5;6", ";"); + std::ignore = + c.convert, double>("junk;.5.5;6", ";"); REQUIRE_FALSE(c.valid()); } @@ -316,34 +317,36 @@ TEST_CASE_TEMPLATE("converter test invalid conversions with exceptions", T, int, ss::uint8) { ss::converter c; - REQUIRE_EXCEPTION(c.convert("")); - REQUIRE_EXCEPTION(c.convert("1", "")); - REQUIRE_EXCEPTION(c.convert("10", "")); - REQUIRE_EXCEPTION(c.convert("")); - REQUIRE_EXCEPTION(c.convert(",junk")); - REQUIRE_EXCEPTION(c.convert("junk,")); - REQUIRE_EXCEPTION(c.convert("x")); - REQUIRE_EXCEPTION(c.convert("x")); - REQUIRE_EXCEPTION(c.convert("x,junk")); - REQUIRE_EXCEPTION(c.convert("junk,x")); + REQUIRE_EXCEPTION(std::ignore = c.convert("")); + REQUIRE_EXCEPTION(std::ignore = c.convert("1", "")); + REQUIRE_EXCEPTION(std::ignore = c.convert("10", "")); + REQUIRE_EXCEPTION(std::ignore = c.convert("")); + REQUIRE_EXCEPTION(std::ignore = c.convert(",junk")); + REQUIRE_EXCEPTION(std::ignore = c.convert("junk,")); + REQUIRE_EXCEPTION(std::ignore = c.convert("x")); + REQUIRE_EXCEPTION(std::ignore = c.convert("x")); + REQUIRE_EXCEPTION(std::ignore = c.convert("x,junk")); + REQUIRE_EXCEPTION(std::ignore = c.convert("junk,x")); REQUIRE_EXCEPTION( - c.convert, double>("junk;.5.5;6", ";")); + std::ignore = + c.convert, double>("junk;.5.5;6", + ";")); } TEST_CASE_TEMPLATE("converter test ss:ax restriction (all except)", T, int, ss::uint8) { ss::converter c; - c.convert>("0"); + std::ignore = c.convert>("0"); REQUIRE_FALSE(c.valid()); - c.convert>("1"); + std::ignore = c.convert>("1"); REQUIRE_FALSE(c.valid()); - c.convert>("junk,c,1"); + std::ignore = c.convert>("junk,c,1"); REQUIRE_FALSE(c.valid()); - c.convert, char>("1,c"); + std::ignore = c.convert, char>("1,c"); REQUIRE_FALSE(c.valid()); { T tup = c.convert>("3"); @@ -367,10 +370,11 @@ TEST_CASE_TEMPLATE( ss::uint8) { ss::converter c; - REQUIRE_EXCEPTION(c.convert>("0")); - REQUIRE_EXCEPTION(c.convert>("1")); - REQUIRE_EXCEPTION(c.convert>("junk,c,1")); - REQUIRE_EXCEPTION(c.convert, char>("1,c")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("0")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("1")); + REQUIRE_EXCEPTION( + std::ignore = c.convert>("junk,c,1")); + REQUIRE_EXCEPTION(std::ignore = c.convert, char>("1,c")); try { { @@ -393,13 +397,13 @@ TEST_CASE_TEMPLATE( TEST_CASE("converter test ss:nx restriction (none except)") { ss::converter c; - c.convert>("3"); + std::ignore = c.convert>("3"); REQUIRE_FALSE(c.valid()); - c.convert>("c,3"); + std::ignore = c.convert>("c,3"); REQUIRE_FALSE(c.valid()); - c.convert, char>("3,c"); + std::ignore = c.convert, char>("3,c"); REQUIRE_FALSE(c.valid()); { @@ -427,9 +431,10 @@ TEST_CASE("converter test ss:nx restriction (none except)") { TEST_CASE("converter test ss:nx restriction (none except) with exceptions") { ss::converter c; - REQUIRE_EXCEPTION(c.convert>("3")); - REQUIRE_EXCEPTION(c.convert>("c,3")); - REQUIRE_EXCEPTION(c.convert, char>("3,c")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("3")); + REQUIRE_EXCEPTION(std::ignore = + c.convert>("c,3")); + REQUIRE_EXCEPTION(std::ignore = c.convert, char>("3,c")); try { { @@ -461,13 +466,13 @@ TEST_CASE_TEMPLATE("converter test ss:ir restriction (in range)", T, int, ss::uint8) { ss::converter c; - c.convert>("3"); + std::ignore = c.convert>("3"); REQUIRE_FALSE(c.valid()); - c.convert>("c,3"); + std::ignore = c.convert>("c,3"); REQUIRE_FALSE(c.valid()); - c.convert, char>("3,c"); + std::ignore = c.convert, char>("3,c"); REQUIRE_FALSE(c.valid()); { @@ -497,9 +502,9 @@ TEST_CASE_TEMPLATE( ss::uint8) { ss::converter c; - REQUIRE_EXCEPTION(c.convert>("3")); - REQUIRE_EXCEPTION(c.convert>("c,3")); - REQUIRE_EXCEPTION(c.convert, char>("3,c")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("3")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("c,3")); + REQUIRE_EXCEPTION(std::ignore = c.convert, char>("3,c")); try { { @@ -530,16 +535,16 @@ TEST_CASE_TEMPLATE( TEST_CASE("converter test ss:oor restriction (out of range)") { ss::converter c; - c.convert>("3"); + std::ignore = c.convert>("3"); REQUIRE_FALSE(c.valid()); - c.convert>("2"); + std::ignore = c.convert>("2"); REQUIRE_FALSE(c.valid()); - c.convert, void>("c,1,junk"); + std::ignore = c.convert, void>("c,1,junk"); REQUIRE_FALSE(c.valid()); - c.convert, char>("1,c"); + std::ignore = c.convert, char>("1,c"); REQUIRE_FALSE(c.valid()); { @@ -564,10 +569,12 @@ TEST_CASE("converter test ss:oor restriction (out of range)") { TEST_CASE("converter test ss:oor restriction (out of range) with exceptions") { ss::converter c; - REQUIRE_EXCEPTION(c.convert>("3")); - REQUIRE_EXCEPTION(c.convert>("2")); - REQUIRE_EXCEPTION(c.convert, void>("c,1,junk")); - REQUIRE_EXCEPTION(c.convert, char>("1,c")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("3")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("2")); + REQUIRE_EXCEPTION( + std::ignore = c.convert, void>("c,1,junk")); + REQUIRE_EXCEPTION(std::ignore = + c.convert, char>("1,c")); try { { @@ -608,19 +615,19 @@ inline bool ss::extract(const char* begin, const char* end, TEST_CASE("converter test ss:ne restriction (not empty)") { ss::converter c; - c.convert>(""); + std::ignore = c.convert>(""); REQUIRE_FALSE(c.valid()); - c.convert>("3,"); + std::ignore = c.convert>("3,"); REQUIRE_FALSE(c.valid()); - c.convert, int>(",3"); + std::ignore = c.convert, int>(",3"); REQUIRE_FALSE(c.valid()); - c.convert, int>("junk,,3"); + std::ignore = c.convert, int>("junk,,3"); REQUIRE_FALSE(c.valid()); - c.convert>>(""); + std::ignore = c.convert>>(""); REQUIRE_FALSE(c.valid()); { @@ -643,11 +650,12 @@ TEST_CASE("converter test ss:ne restriction (not empty)") { TEST_CASE("converter test ss:ne restriction (not empty) with exceptions") { ss::converter c; - REQUIRE_EXCEPTION(c.convert>("")); - REQUIRE_EXCEPTION(c.convert>("3,")); - REQUIRE_EXCEPTION(c.convert, int>(",3")); - REQUIRE_EXCEPTION(c.convert, int>("junk,,3")); - REQUIRE_EXCEPTION(c.convert>>("")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("3,")); + REQUIRE_EXCEPTION(std::ignore = c.convert, int>(",3")); + REQUIRE_EXCEPTION(std::ignore = + c.convert, int>("junk,,3")); + REQUIRE_EXCEPTION(std::ignore = c.convert>>("")); try { { @@ -675,22 +683,22 @@ TEST_CASE( "converter test ss:lt ss::lte ss::gt ss::gte restriction (in range)") { ss::converter c; - c.convert>("3"); + std::ignore = c.convert>("3"); REQUIRE_FALSE(c.valid()); - c.convert>("3"); + std::ignore = c.convert>("3"); REQUIRE_FALSE(c.valid()); - c.convert>("3"); + std::ignore = c.convert>("3"); REQUIRE_FALSE(c.valid()); - c.convert>("3"); + std::ignore = c.convert>("3"); REQUIRE_FALSE(c.valid()); - c.convert>("3"); + std::ignore = c.convert>("3"); REQUIRE_FALSE(c.valid()); - c.convert>("3"); + std::ignore = c.convert>("3"); REQUIRE_FALSE(c.valid()); { @@ -734,12 +742,12 @@ TEST_CASE("converter test ss:lt ss::lte ss::gt ss::gte restriction (in range) " "with exception") { ss::converter c; - REQUIRE_EXCEPTION(c.convert>("3")); - REQUIRE_EXCEPTION(c.convert>("3")); - REQUIRE_EXCEPTION(c.convert>("3")); - REQUIRE_EXCEPTION(c.convert>("3")); - REQUIRE_EXCEPTION(c.convert>("3")); - REQUIRE_EXCEPTION(c.convert>("3")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("3")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("3")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("3")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("3")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("3")); + REQUIRE_EXCEPTION(std::ignore = c.convert>("3")); try { { @@ -784,14 +792,14 @@ TEST_CASE("converter test ss:lt ss::lte ss::gt ss::gte restriction (in range) " TEST_CASE("converter test error mode") { ss::converter c; - c.convert("junk"); + std::ignore = c.convert("junk"); CHECK_FALSE(c.valid()); CHECK_FALSE(c.error_msg().empty()); } TEST_CASE("converter test throw on error mode") { ss::converter c; - REQUIRE_EXCEPTION(c.convert("junk")); + REQUIRE_EXCEPTION(std::ignore = c.convert("junk")); } TEST_CASE("converter test converter with quotes spacing and escaping") { @@ -908,7 +916,7 @@ TEST_CASE("converter test invalid split conversions") { { // mismatched quote - c.convert( + std::ignore = c.convert( buff(R"( "just , some , "12.3","a" )")); CHECK_FALSE(c.valid()); CHECK_FALSE(c.unterminated_quote()); @@ -917,7 +925,7 @@ TEST_CASE("converter test invalid split conversions") { { // unterminated quote - c.convert( + std::ignore = c.convert( buff(R"( ju\,st , "so,me" , 12.34 , "str""ings)")); CHECK_FALSE(c.valid()); CHECK(c.unterminated_quote()); @@ -926,7 +934,7 @@ TEST_CASE("converter test invalid split conversions") { { // unterminated escape - c.convert( + std::ignore = c.convert( buff(R"(just,some,2,strings\)")); CHECK_FALSE(c.valid()); CHECK_FALSE(c.unterminated_quote()); @@ -935,7 +943,7 @@ TEST_CASE("converter test invalid split conversions") { { // unterminated escape while quoting - c.convert( + std::ignore = c.convert( buff(R"(just,some,2,"strings\)")); CHECK_FALSE(c.valid()); CHECK_FALSE(c.unterminated_quote()); @@ -944,7 +952,7 @@ TEST_CASE("converter test invalid split conversions") { { // unterminated escaped quote - c.convert( + std::ignore = c.convert( buff(R"(just,some,2,"strings\")")); CHECK_FALSE(c.valid()); CHECK(c.unterminated_quote()); @@ -958,27 +966,32 @@ TEST_CASE("converter test invalid split conversions with exceptions") { c; // mismatched quote - REQUIRE_EXCEPTION(c.convert( - buff(R"( "just , some , "12.3","a" )"))); + REQUIRE_EXCEPTION(std::ignore = + c.convert( + buff(R"( "just , some , "12.3","a" )"))); CHECK_FALSE(c.unterminated_quote()); // unterminated quote - REQUIRE_EXCEPTION(c.convert( - buff(R"( ju\,st , "so,me" , 12.34 , "str""ings)"))); + REQUIRE_EXCEPTION( + std::ignore = c.convert( + buff(R"( ju\,st , "so,me" , 12.34 , "str""ings)"))); CHECK(c.unterminated_quote()); // unterminated escape - REQUIRE_EXCEPTION(c.convert( - buff(R"(just,some,2,strings\)"))); + REQUIRE_EXCEPTION( + std::ignore = c.convert( + buff(R"(just,some,2,strings\)"))); CHECK_FALSE(c.unterminated_quote()); // unterminated escape while quoting - REQUIRE_EXCEPTION(c.convert( - buff(R"(just,some,2,"strings\)"))); + REQUIRE_EXCEPTION( + std::ignore = c.convert( + buff(R"(just,some,2,"strings\)"))); CHECK_FALSE(c.unterminated_quote()); // unterminated escaped quote - REQUIRE_EXCEPTION(c.convert( - buff(R"(just,some,2,"strings\")"))); + REQUIRE_EXCEPTION( + std::ignore = c.convert( + buff(R"(just,some,2,"strings\")"))); CHECK(c.unterminated_quote()); } diff --git a/test/test_extractions_without_fast_float.cpp b/test/test_extractions_without_fast_float.cpp index 2c9a984..7add461 100644 --- a/test/test_extractions_without_fast_float.cpp +++ b/test/test_extractions_without_fast_float.cpp @@ -1,5 +1,4 @@ #include "test_helpers.hpp" -#include #define SSP_DISABLE_FAST_FLOAT #include diff --git a/test/test_helpers.hpp b/test/test_helpers.hpp index a3ee69b..6841d25 100644 --- a/test/test_helpers.hpp +++ b/test/test_helpers.hpp @@ -212,6 +212,7 @@ template } }; + // Evade small string optimization out.reserve(sizeof(out) + 1); copy_if_whitespaces(); diff --git a/test/test_parser1.hpp b/test/test_parser1.hpp index 10f615f..c40bdc3 100644 --- a/test/test_parser1.hpp +++ b/test/test_parser1.hpp @@ -12,8 +12,9 @@ #include namespace { -[[maybe_unused]] void replace_all(std::string& s, const std::string& from, - const std::string& to) { +#ifdef _WIN32 +void replace_all(std::string& s, const std::string& from, + const std::string& to) { if (from.empty()) return; size_t start_pos = 0; while ((start_pos = s.find(from, start_pos)) != std::string::npos) { @@ -21,6 +22,7 @@ namespace { start_pos += to.length(); } } +#endif template void expect_error_on_command(ss::parser& p, @@ -56,7 +58,7 @@ struct X { double d; std::string s; - std::string to_string() const { + [[nodiscard]] std::string to_string() const { if (s == empty) { return ""; } @@ -67,14 +69,15 @@ struct X { .append(delim) .append(s); } - auto tied() const { + + [[nodiscard]] auto tied() const { return std::tie(i, d, s); } }; template -std::enable_if_t, bool> operator==(const T& lhs, - const T& rhs) { +[[nodiscard]] std::enable_if_t, bool> operator==( + const T& lhs, const T& rhs) { return lhs.tied() == rhs.tied(); } diff --git a/test/test_parser1_1.cpp b/test/test_parser1_1.cpp index 650393b..6338ee8 100644 --- a/test/test_parser1_1.cpp +++ b/test/test_parser1_1.cpp @@ -57,7 +57,7 @@ struct Y { .append(s3); } - auto tied() const { + [[nodiscard]] auto tied() const { return std::tie(s1, s2, s3); } }; @@ -115,7 +115,8 @@ TEST_CASE_TEMPLATE("test line method", T, ParserOptionCombinations) { CHECK_EQ(p.line(), expected_line); while (!p.eof()) { - auto _ = p.template get_next(); + std::ignore = + p.template get_next(); ++expected_line; CHECK_EQ(p.line(), expected_line); } diff --git a/test/test_parser1_2.cpp b/test/test_parser1_2.cpp index eaf9516..dffcf17 100644 --- a/test/test_parser1_2.cpp +++ b/test/test_parser1_2.cpp @@ -51,14 +51,16 @@ TEST_CASE_TEMPLATE("test moving of parsed composite values", T, // to compile is enough return; auto [p, _] = make_parser("", ""); - p.template try_next() - .template or_else( - [](auto&&) {}) - .template or_else([](auto&) {}) - .template or_else([](auto&&) {}) - .template or_object([](auto&&) {}) - .template or_else>( - [](auto&, auto&, auto&) {}); + std::ignore = + p.template try_next() + .template or_else( + [](auto&&) {}) + .template or_else([](auto&) {}) + .template or_else([](auto&&) {}) + .template or_object( + [](auto&&) {}) + .template or_else>( + [](auto&, auto&, auto&) {}); } TEST_CASE_TEMPLATE("parser test string error mode", BufferMode, std::true_type, @@ -73,7 +75,7 @@ TEST_CASE_TEMPLATE("parser test string error mode", BufferMode, std::true_type, auto [p, _] = make_parser(f.name, ","); REQUIRE_FALSE(p.eof()); - p.template get_next(); + std::ignore = p.template get_next(); CHECK_FALSE(p.valid()); CHECK_FALSE(p.error_msg().empty()); } @@ -92,7 +94,7 @@ TEST_CASE_TEMPLATE("parser throw on error mode", BufferMode, std::true_type, REQUIRE_FALSE(p.eof()); try { - p.template get_next(); + std::ignore = p.template get_next(); FAIL("Expected exception..."); } catch (const std::exception& e) { CHECK_FALSE(std::string{e.what()}.empty()); @@ -148,7 +150,8 @@ TEST_CASE_TEMPLATE("test quote multiline", T, ParserOptionCombinations) { make_parser>(f.name, ","); while (!p.eof()) { auto command = [&p_no_multiline = p_no_multiline] { - p_no_multiline.template get_next(); + std::ignore = + p_no_multiline.template get_next(); }; expect_error_on_command(p_no_multiline, command); } diff --git a/test/test_parser1_3.cpp b/test/test_parser1_3.cpp index e1f9b6e..69ddd8e 100644 --- a/test/test_parser1_3.cpp +++ b/test/test_parser1_3.cpp @@ -83,7 +83,7 @@ void test_unterminated_line(const std::vector& lines, size_t line = 0; while (!p.eof()) { auto command = [&p = p] { - p.template get_next(); + std::ignore = p.template get_next(); }; if (line == bad_line) { diff --git a/test/test_parser1_4.cpp b/test/test_parser1_4.cpp index baa55dc..ca13d2b 100644 --- a/test/test_parser1_4.cpp +++ b/test/test_parser1_4.cpp @@ -228,7 +228,7 @@ void test_invalid_fields(const std::vector& lines, auto [p, _] = make_parser(f.name, ","); auto command = [&p = p, &fields = fields] { p.use_fields(fields.at(0)); - p.template get_next(); + std::ignore = p.template get_next(); }; check_header(p); @@ -428,7 +428,7 @@ TEST_CASE_TEMPLATE("test invalid header", T, ParserOptionCombinations) { { auto [p, _] = make_parser>(f.name); - auto command = [&p = p] { p.header(); }; + auto command = [&p = p] { std::ignore = p.header(); }; expect_error_on_command(p, command); CHECK_EQ(p.raw_header(), "\"Int"); } @@ -437,7 +437,7 @@ TEST_CASE_TEMPLATE("test invalid header", T, ParserOptionCombinations) { auto [p, _] = make_parser, ss::multiline>( f.name); - auto command = [&p = p] { p.header(); }; + auto command = [&p = p] { std::ignore = p.header(); }; expect_error_on_command(p, command); CHECK_EQ(p.raw_header(), "\"Int"); } @@ -445,7 +445,7 @@ TEST_CASE_TEMPLATE("test invalid header", T, ParserOptionCombinations) { { auto [p, _] = make_parser, ss::escape<'\\'>, ss::multiline>(f.name); - auto command = [&p = p] { p.header(); }; + auto command = [&p = p] { std::ignore = p.header(); }; expect_error_on_command(p, command); CHECK_EQ(p.raw_header(), "\"Int"); } @@ -460,7 +460,7 @@ TEST_CASE_TEMPLATE("test invalid header", T, ParserOptionCombinations) { { auto [p, _] = make_parser>(f.name); - auto command = [&p = p] { p.header(); }; + auto command = [&p = p] { std::ignore = p.header(); }; expect_error_on_command(p, command); CHECK_EQ(p.raw_header(), "Int\\"); } @@ -468,7 +468,7 @@ TEST_CASE_TEMPLATE("test invalid header", T, ParserOptionCombinations) { { auto [p, _] = make_parser, ss::multiline>(f.name); - auto command = [&p = p] { p.header(); }; + auto command = [&p = p] { std::ignore = p.header(); }; expect_error_on_command(p, command); CHECK_EQ(p.raw_header(), "Int\\"); } @@ -476,7 +476,7 @@ TEST_CASE_TEMPLATE("test invalid header", T, ParserOptionCombinations) { { auto [p, _] = make_parser, ss::quote<'"'>, ss::multiline>(f.name); - auto command = [&p = p] { p.header(); }; + auto command = [&p = p] { std::ignore = p.header(); }; expect_error_on_command(p, command); CHECK_EQ(p.raw_header(), "Int\\"); } diff --git a/test/test_parser2.hpp b/test/test_parser2.hpp index 2fbb876..6e1b9d7 100644 --- a/test/test_parser2.hpp +++ b/test/test_parser2.hpp @@ -85,8 +85,8 @@ struct column { }; template -column make_column(const std::string& input_header, - const std::vector& input_fields) { +[[nodiscard]] column make_column(const std::string& input_header, + const std::vector& input_fields) { using setup = ss::setup; std::vector filtered_fields; @@ -127,8 +127,8 @@ column make_column(const std::string& input_header, } template -std::vector generate_csv_data(const std::vector& data, - const std::string& delim) { +[[nodiscard]] std::vector generate_csv_data( + const std::vector& data, const std::string& delim) { (void)delim; using setup = ss::setup; constexpr static auto escape = '\\'; diff --git a/test/test_parser2_1.cpp b/test/test_parser2_1.cpp index 55ec45a..71c3ae1 100644 --- a/test/test_parser2_1.cpp +++ b/test/test_parser2_1.cpp @@ -9,4 +9,3 @@ TEST_CASE("parser test various cases version 2 segment 1") { test_option_combinations3(); #endif } - diff --git a/test/test_parser2_2.cpp b/test/test_parser2_2.cpp index ec76aa9..b4721fb 100644 --- a/test/test_parser2_2.cpp +++ b/test/test_parser2_2.cpp @@ -10,4 +10,3 @@ TEST_CASE("parser test various cases version 2 segment 2") { test_option_combinations3(); #endif } - diff --git a/test/test_parser2_3.cpp b/test/test_parser2_3.cpp index aab905c..4b8266c 100644 --- a/test/test_parser2_3.cpp +++ b/test/test_parser2_3.cpp @@ -11,4 +11,3 @@ TEST_CASE("parser test various cases version 2 segment 3") { test_option_combinations3(); #endif } - diff --git a/test/test_parser2_4.cpp b/test/test_parser2_4.cpp index ea78aaf..65cc1cb 100644 --- a/test/test_parser2_4.cpp +++ b/test/test_parser2_4.cpp @@ -12,4 +12,3 @@ TEST_CASE("parser test various cases version 2 segment 4") { test_option_combinations3(); #endif } - diff --git a/test/test_parser2_5.cpp b/test/test_parser2_5.cpp index 3f345b0..dcb661a 100644 --- a/test/test_parser2_5.cpp +++ b/test/test_parser2_5.cpp @@ -13,4 +13,3 @@ TEST_CASE("parser test various cases version 2 segment 5") { test_option_combinations(); #endif } - diff --git a/test/test_parser2_6.cpp b/test/test_parser2_6.cpp index d6ec30f..c093143 100644 --- a/test/test_parser2_6.cpp +++ b/test/test_parser2_6.cpp @@ -8,4 +8,3 @@ TEST_CASE("parser test various cases version 2 segment 6") { test_option_combinations3(); } -