Simplify format string parsing

This commit is contained in:
Victor Zverovich
2022-12-30 10:58:22 -08:00
parent ffb9b1d13c
commit a05ba44df8
5 changed files with 90 additions and 106 deletions

View File

@@ -489,13 +489,29 @@ TEST(core_test, has_sign) {
type::int128_type, type::float_type,
type::double_type, type::long_double_type};
for (auto t : types_with_sign) EXPECT_TRUE(fmt::detail::has_sign(t));
type types_without_sign[] = {type::uint_type, type::ulong_long_type,
type::uint128_type, type::bool_type,
type::char_type, type::string_type,
type::cstring_type, type::custom_type};
type types_without_sign[] = {
type::none_type, type::uint_type, type::ulong_long_type,
type::uint128_type, type::bool_type, type::char_type,
type::string_type, type::cstring_type, type::custom_type};
for (auto t : types_without_sign) EXPECT_FALSE(fmt::detail::has_sign(t));
}
TEST(core_test, has_precision) {
using fmt::detail::type;
type types_with_precision[] = {type::float_type, type::double_type,
type::long_double_type, type::string_type,
type::cstring_type};
for (auto t : types_with_precision)
EXPECT_TRUE(fmt::detail::has_precision(t));
type types_without_precision[] = {type::none_type, type::int_type,
type::uint_type, type::long_long_type,
type::ulong_long_type, type::int128_type,
type::uint128_type, type::bool_type,
type::char_type, type::custom_type};
for (auto t : types_without_precision)
EXPECT_FALSE(fmt::detail::has_precision(t));
}
#if FMT_USE_CONSTEXPR
enum class arg_id_result { none, empty, index, name };