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 // denorm_min() 13 14 #include <limits> 15 #include <cassert> 16 17 template <class T> 18 void test(T expected)19test(T expected) 20 { 21 assert(std::numeric_limits<T>::denorm_min() == expected); 22 assert(std::numeric_limits<const T>::denorm_min() == expected); 23 assert(std::numeric_limits<volatile T>::denorm_min() == expected); 24 assert(std::numeric_limits<const volatile T>::denorm_min() == expected); 25 } 26 main()27int main() 28 { 29 test<bool>(false); 30 test<char>(0); 31 test<signed char>(0); 32 test<unsigned char>(0); 33 test<wchar_t>(0); 34 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS 35 test<char16_t>(0); 36 test<char32_t>(0); 37 #endif // _LIBCPP_HAS_NO_UNICODE_CHARS 38 test<short>(0); 39 test<unsigned short>(0); 40 test<int>(0); 41 test<unsigned int>(0); 42 test<long>(0); 43 test<unsigned long>(0); 44 test<long long>(0); 45 test<unsigned long long>(0); 46 #ifndef _LIBCPP_HAS_NO_INT128 47 test<__int128_t>(0); 48 test<__uint128_t>(0); 49 #endif 50 test<float>(__FLT_DENORM_MIN__); 51 test<double>(__DBL_DENORM_MIN__); 52 test<long double>(__LDBL_DENORM_MIN__); 53 } 54