1 | //===-- Unittests for acoshf16 --------------------------------------------===// |
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 "src/__support/libc_errno.h" |
10 | #include "src/math/acoshf16.h" |
11 | #include "test/UnitTest/FPMatcher.h" |
12 | #include "test/UnitTest/Test.h" |
13 | #include "utils/MPFRWrapper/MPFRUtils.h" |
14 | #include <stdint.h> |
15 | |
16 | using LlvmLibcAcoshf16Test = LIBC_NAMESPACE::testing::FPTest<float16>; |
17 | namespace mpfr = LIBC_NAMESPACE::testing::mpfr; |
18 | |
19 | static constexpr uint16_t START = 0x3c00U; |
20 | static constexpr uint16_t STOP = 0x7c00; |
21 | |
22 | TEST_F(LlvmLibcAcoshf16Test, PositiveRange) { |
23 | for (uint16_t v = START; v <= STOP; ++v) { |
24 | float16 x = FPBits(v).get_val(); |
25 | EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acosh, x, |
26 | LIBC_NAMESPACE::acoshf16(x), 0.5); |
27 | } |
28 | } |
29 | |