Upstream version 8.36.169.0
[platform/framework/web/crosswalk.git] / src / third_party / libc++ / trunk / test / language.support / support.limits / limits / numeric.limits.members / has_denorm.pass.cpp
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 // has_denorm
13
14 #include <limits>
15
16 template <class T, std::float_denorm_style expected>
17 void
18 test()
19 {
20     static_assert(std::numeric_limits<T>::has_denorm == expected, "has_denorm test 1");
21     static_assert(std::numeric_limits<const T>::has_denorm == expected, "has_denorm test 2");
22     static_assert(std::numeric_limits<volatile T>::has_denorm == expected, "has_denorm test 3");
23     static_assert(std::numeric_limits<const volatile T>::has_denorm == expected, "has_denorm test 4");
24 }
25
26 int main()
27 {
28     test<bool, std::denorm_absent>();
29     test<char, std::denorm_absent>();
30     test<signed char, std::denorm_absent>();
31     test<unsigned char, std::denorm_absent>();
32     test<wchar_t, std::denorm_absent>();
33 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
34     test<char16_t, std::denorm_absent>();
35     test<char32_t, std::denorm_absent>();
36 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
37     test<short, std::denorm_absent>();
38     test<unsigned short, std::denorm_absent>();
39     test<int, std::denorm_absent>();
40     test<unsigned int, std::denorm_absent>();
41     test<long, std::denorm_absent>();
42     test<unsigned long, std::denorm_absent>();
43     test<long long, std::denorm_absent>();
44     test<unsigned long long, std::denorm_absent>();
45 #ifndef _LIBCPP_HAS_NO_INT128
46     test<__int128_t, std::denorm_absent>();
47     test<__uint128_t, std::denorm_absent>();
48 #endif
49     test<float, std::denorm_present>();
50     test<double, std::denorm_present>();
51     test<long double, std::denorm_present>();
52 }