| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
// test numeric_limits |
| 10 |
|
| 11 |
// tinyness_before |
| 12 |
|
| 13 |
#include <limits> |
| 14 |
|
| 15 |
#include "test_macros.h" |
| 16 |
|
| 17 |
template <class T, bool expected> |
| 18 |
void |
| 19 |
test() |
| 20 |
{ |
| 21 |
static_assert(std::numeric_limits<T>::tinyness_before == expected, "tinyness_before test 1"); |
| 22 |
static_assert(std::numeric_limits<const T>::tinyness_before == expected, "tinyness_before test 2"); |
| 23 |
static_assert(std::numeric_limits<volatile T>::tinyness_before == expected, "tinyness_before test 3"); |
| 24 |
static_assert(std::numeric_limits<const volatile T>::tinyness_before == expected, "tinyness_before test 4"); |
| 25 |
} |
| 26 |
|
| 27 |
int main(int, char**) |
| 28 |
{ |
| 29 |
test<bool, false>(); |
| 30 |
test<char, false>(); |
| 31 |
test<signed char, false>(); |
| 32 |
test<unsigned char, false>(); |
| 33 |
test<wchar_t, false>(); |
| 34 |
#if TEST_STD_VER > 17 && defined(__cpp_char8_t) |
| 35 |
test<char8_t, false>(); |
| 36 |
#endif |
| 37 |
test<char16_t, false>(); |
| 38 |
test<char32_t, false>(); |
| 39 |
test<short, false>(); |
| 40 |
test<unsigned short, false>(); |
| 41 |
test<int, false>(); |
| 42 |
test<unsigned int, false>(); |
| 43 |
test<long, false>(); |
| 44 |
test<unsigned long, false>(); |
| 45 |
test<long long, false>(); |
| 46 |
test<unsigned long long, false>(); |
| 47 |
#ifndef TEST_HAS_NO_INT128 |
| 48 |
test<__int128_t, false>(); |
| 49 |
test<__uint128_t, false>(); |
| 50 |
#endif |
| 51 |
#if (defined(__arm__) || defined(__aarch64__)) |
| 52 |
test<float, true>(); |
| 53 |
test<double, true>(); |
| 54 |
test<long double, true>(); |
| 55 |
#else |
| 56 |
test<float, false>(); |
| 57 |
test<double, false>(); |
| 58 |
test<long double, false>(); |
| 59 |
#endif |
| 60 |
|
| 61 |
return 0; |
| 62 |
} |