Improve handling of signed types

This commit is contained in:
Victor Zverovich
2022-12-30 10:31:39 -08:00
parent 32190859ec
commit ffb9b1d13c
6 changed files with 69 additions and 57 deletions
+14 -1
View File
@@ -483,6 +483,19 @@ TEST(arg_test, visit_invalid_arg) {
fmt::visit_format_arg(visitor, arg);
}
TEST(core_test, has_sign) {
using fmt::detail::type;
type types_with_sign[] = {type::int_type, type::long_long_type,
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};
for (auto t : types_without_sign) EXPECT_FALSE(fmt::detail::has_sign(t));
}
#if FMT_USE_CONSTEXPR
enum class arg_id_result { none, empty, index, name };
@@ -511,7 +524,7 @@ constexpr test_arg_id_handler parse_arg_id(const char (&s)[N]) {
return h;
}
TEST(format_test, constexpr_parse_arg_id) {
TEST(core_test, constexpr_parse_arg_id) {
static_assert(parse_arg_id(":").res == arg_id_result::empty, "");
static_assert(parse_arg_id("}").res == arg_id_result::empty, "");
static_assert(parse_arg_id("42:").res == arg_id_result::index, "");