| 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 |
// float_round_style |
| 12 |
|
| 13 |
#include <limits> |
| 14 |
|
| 15 |
#include "test_macros.h" |
| 16 |
|
| 17 |
typedef char one; |
| 18 |
struct two {one _[2];}; |
| 19 |
|
| 20 |
one test(std::float_round_style); |
| 21 |
two test(int); |
| 22 |
|
| 23 |
int main(int, char**) |
| 24 |
{ |
| 25 |
static_assert(std::round_indeterminate == -1, |
| 26 |
"std::round_indeterminate == -1"); |
| 27 |
static_assert(std::round_toward_zero == 0, |
| 28 |
"std::round_toward_zero == 0"); |
| 29 |
static_assert(std::round_to_nearest == 1, |
| 30 |
"std::round_to_nearest == 1"); |
| 31 |
static_assert(std::round_toward_infinity == 2, |
| 32 |
"std::round_toward_infinity == 2"); |
| 33 |
static_assert(std::round_toward_neg_infinity == 3, |
| 34 |
"std::round_toward_neg_infinity == 3"); |
| 35 |
static_assert(sizeof(test(std::round_to_nearest)) == 1, |
| 36 |
"sizeof(test(std::round_to_nearest)) == 1"); |
| 37 |
static_assert(sizeof(test(1)) == 2, |
| 38 |
"sizeof(test(1)) == 2"); |
| 39 |
|
| 40 |
return 0; |
| 41 |
} |