mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-30 05:40:06 +00:00
Test EnableIf
This commit is contained in:
parent
0963fd0a4d
commit
62c483c940
@ -842,3 +842,19 @@ TEST(UtilTest, IsEnumConvertibleToInt) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool check_enable_if(
|
||||||
|
typename fmt::internal::EnableIf<sizeof(T) == sizeof(int), T>::type) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool check_enable_if(
|
||||||
|
typename fmt::internal::EnableIf<sizeof(T) != sizeof(int), T>::type) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(UtilTest, EnableIf) {
|
||||||
|
EXPECT_TRUE(check_enable_if<int>(42));
|
||||||
|
EXPECT_FALSE(check_enable_if<char>('a'));
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user