min_exponent10.pass.cpp (1691B)
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 // min_exponent10 13 14 #include <limits> 15 #include <cfloat> 16 17 #include "test_macros.h" 18 19 template <class T, int expected> 20 void 21 test() 22 { 23 static_assert(std::numeric_limits<T>::min_exponent10 == expected, "min_exponent10 test 1"); 24 static_assert(std::numeric_limits<const T>::min_exponent10 == expected, "min_exponent10 test 2"); 25 static_assert(std::numeric_limits<volatile T>::min_exponent10 == expected, "min_exponent10 test 3"); 26 static_assert(std::numeric_limits<const volatile T>::min_exponent10 == expected, "min_exponent10 test 4"); 27 } 28 29 int main() 30 { 31 test<bool, 0>(); 32 test<char, 0>(); 33 test<signed char, 0>(); 34 test<unsigned char, 0>(); 35 test<wchar_t, 0>(); 36 #if TEST_STD_VER > 17 && defined(__cpp_char8_t) 37 test<char8_t, 0>(); 38 #endif 39 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS 40 test<char16_t, 0>(); 41 test<char32_t, 0>(); 42 #endif // _LIBCPP_HAS_NO_UNICODE_CHARS 43 test<short, 0>(); 44 test<unsigned short, 0>(); 45 test<int, 0>(); 46 test<unsigned int, 0>(); 47 test<long, 0>(); 48 test<unsigned long, 0>(); 49 test<long long, 0>(); 50 test<unsigned long long, 0>(); 51 #ifndef _LIBCPP_HAS_NO_INT128 52 test<__int128_t, 0>(); 53 test<__uint128_t, 0>(); 54 #endif 55 test<float, FLT_MIN_10_EXP>(); 56 test<double, DBL_MIN_10_EXP>(); 57 test<long double, LDBL_MIN_10_EXP>(); 58 }