28 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "hdr/stdint_proxy.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 15using LlvmLibcAcoshf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;16namespace mpfr = LIBC_NAMESPACE::testing::mpfr;17 18static constexpr uint16_t START = 0x3c00U;19static constexpr uint16_t STOP = 0x7c00;20 21TEST_F(LlvmLibcAcoshf16Test, PositiveRange) {22 for (uint16_t v = START; v <= STOP; ++v) {23 float16 x = FPBits(v).get_val();24 EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acosh, x,25 LIBC_NAMESPACE::acoshf16(x), 0.5);26 }27}28