|
| 1 | +//===-- Exhaustive test for fmodbf16 --------------------------------------===// |
| 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 | +#include "exhaustive_test.h" |
| 10 | +#include "src/__support/FPUtil/bfloat16.h" |
| 11 | +#include "src/math/fmodbf16.h" |
| 12 | +#include "utils/MPFRWrapper/MPFRUtils.h" |
| 13 | + |
| 14 | +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; |
| 15 | + |
| 16 | +using LlvmLibcFmodf16ExhaustiveTest = |
| 17 | + LlvmLibcBinaryOpExhaustiveMathTest<bfloat16, mpfr::Operation::Fmod, |
| 18 | + LIBC_NAMESPACE::fmodbf16>; |
| 19 | + |
| 20 | +// range: [0, inf] |
| 21 | +static constexpr uint16_t POS_START = 0x0000U; |
| 22 | +static constexpr uint16_t POS_STOP = 0x7f80U; |
| 23 | + |
| 24 | +// range: [-0, -inf] |
| 25 | +static constexpr uint16_t NEG_START = 0x8000U; |
| 26 | +static constexpr uint16_t NEG_STOP = 0xff80U; |
| 27 | + |
| 28 | +TEST_F(LlvmLibcFmodf16ExhaustiveTest, PostivePositiveRange) { |
| 29 | + test_full_range_all_roundings(POS_START, POS_STOP, POS_START, POS_STOP); |
| 30 | +} |
| 31 | + |
| 32 | +TEST_F(LlvmLibcFmodf16ExhaustiveTest, PostiveNegativeRange) { |
| 33 | + test_full_range_all_roundings(POS_START, POS_STOP, NEG_START, NEG_STOP); |
| 34 | +} |
| 35 | + |
| 36 | +TEST_F(LlvmLibcFmodf16ExhaustiveTest, NegativePositiveRange) { |
| 37 | + test_full_range_all_roundings(NEG_START, NEG_STOP, POS_START, POS_STOP); |
| 38 | +} |
| 39 | + |
| 40 | +TEST_F(LlvmLibcFmodf16ExhaustiveTest, NegativeNegativeRange) { |
| 41 | + test_full_range_all_roundings(NEG_START, NEG_STOP, POS_START, POS_STOP); |
| 42 | +} |
0 commit comments