mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-25 15:21:54 +00:00
Test IsConvertibleToInt with a C++11 enum
This commit is contained in:
parent
23b60f5735
commit
2adbfa4af7
@ -14,6 +14,14 @@ function(add_fmt_test name)
|
||||
add_test(NAME ${name} COMMAND ${name})
|
||||
endfunction()
|
||||
|
||||
check_cxx_source_compiles("
|
||||
enum C : char {A};
|
||||
int main() {}"
|
||||
HAVE_ENUM_BASE)
|
||||
if (HAVE_ENUM_BASE)
|
||||
add_definitions(-DFMT_USE_ENUM_BASE=1)
|
||||
endif ()
|
||||
|
||||
add_fmt_test(gtest-extra-test)
|
||||
add_fmt_test(format-test)
|
||||
add_fmt_test(format-impl-test CUSTOM_LINK)
|
||||
|
@ -837,3 +837,11 @@ TEST(UtilTest, IsConvertibleToInt) {
|
||||
EXPECT_TRUE(fmt::internal::IsConvertibleToInt<char>::value);
|
||||
EXPECT_FALSE(fmt::internal::IsConvertibleToInt<const char *>::value);
|
||||
}
|
||||
|
||||
#if FMT_USE_ENUM_BASE
|
||||
enum TestEnum : char {TestValue};
|
||||
TEST(UtilTest, IsEnumConvertibleToInt) {
|
||||
EXPECT_TRUE(fmt::internal::IsConvertibleToInt<TestEnum>::value);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user