denorm_min.pass.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
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 17template <class T> 18void 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 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 test<float>(__FLT_DENORM_MIN__); 47 test<double>(__DBL_DENORM_MIN__); 48 test<long double>(__LDBL_DENORM_MIN__); 49} 50