is_modulo.pass.cpp (1696B)
1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // test numeric_limits 11 12 // is_modulo 13 14 #include <limits> 15 16 #include "test_macros.h" 17 18 template <class T, bool expected> 19 void 20 test() 21 { 22 static_assert(std::numeric_limits<T>::is_modulo == expected, "is_modulo test 1"); 23 static_assert(std::numeric_limits<const T>::is_modulo == expected, "is_modulo test 2"); 24 static_assert(std::numeric_limits<volatile T>::is_modulo == expected, "is_modulo test 3"); 25 static_assert(std::numeric_limits<const volatile T>::is_modulo == expected, "is_modulo test 4"); 26 } 27 28 int main() 29 { 30 test<bool, false>(); 31 // test<char, false>(); // don't know 32 test<signed char, false>(); 33 test<unsigned char, true>(); 34 // test<wchar_t, false>(); // don't know 35 #if TEST_STD_VER > 17 && defined(__cpp_char8_t) 36 test<char8_t, true>(); 37 #endif 38 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS 39 test<char16_t, true>(); 40 test<char32_t, true>(); 41 #endif // _LIBCPP_HAS_NO_UNICODE_CHARS 42 test<short, false>(); 43 test<unsigned short, true>(); 44 test<int, false>(); 45 test<unsigned int, true>(); 46 test<long, false>(); 47 test<unsigned long, true>(); 48 test<long long, false>(); 49 test<unsigned long long, true>(); 50 #ifndef _LIBCPP_HAS_NO_INT128 51 test<__int128_t, false>(); 52 test<__uint128_t, true>(); 53 #endif 54 test<float, false>(); 55 test<double, false>(); 56 test<long double, false>(); 57 }