xref: /llvm-project/libc/test/src/math/exhaustive/coshf_test.cpp (revision b6bc9d72f65a5086f310f321e969d96e9a559e75)
1fcb9d7e2SKirill Okhotnikov //===-- Exhaustive test for coshf -----------------------------------------===//
2fcb9d7e2SKirill Okhotnikov //
3fcb9d7e2SKirill Okhotnikov // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4fcb9d7e2SKirill Okhotnikov // See https://llvm.org/LICENSE.txt for license information.
5fcb9d7e2SKirill Okhotnikov // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6fcb9d7e2SKirill Okhotnikov //
7fcb9d7e2SKirill Okhotnikov //===----------------------------------------------------------------------===//
8fcb9d7e2SKirill Okhotnikov 
9fcb9d7e2SKirill Okhotnikov #include "exhaustive_test.h"
10fcb9d7e2SKirill Okhotnikov #include "src/math/coshf.h"
11fcb9d7e2SKirill Okhotnikov #include "utils/MPFRWrapper/MPFRUtils.h"
12fcb9d7e2SKirill Okhotnikov 
13*b6bc9d72SGuillaume Chatelet namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
14fcb9d7e2SKirill Okhotnikov 
159532074aSTue Ly using LlvmLibcCoshfExhaustiveTest =
169532074aSTue Ly     LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Cosh,
17*b6bc9d72SGuillaume Chatelet                                       LIBC_NAMESPACE::coshf>;
18fcb9d7e2SKirill Okhotnikov 
199532074aSTue Ly // Range: [0, Inf];
20fcb9d7e2SKirill Okhotnikov static constexpr uint32_t POS_START = 0x0000'0000U;
219532074aSTue Ly static constexpr uint32_t POS_STOP = 0x7f80'0000U;
22fcb9d7e2SKirill Okhotnikov 
TEST_F(LlvmLibcCoshfExhaustiveTest,PostiveRange)239532074aSTue Ly TEST_F(LlvmLibcCoshfExhaustiveTest, PostiveRange) {
249532074aSTue Ly   test_full_range_all_roundings(POS_START, POS_STOP);
25fcb9d7e2SKirill Okhotnikov }
26fcb9d7e2SKirill Okhotnikov 
279532074aSTue Ly // Range: [-Inf, 0];
289532074aSTue Ly static constexpr uint32_t NEG_START = 0xb000'0000U;
299532074aSTue Ly static constexpr uint32_t NEG_STOP = 0xff80'0000U;
30fcb9d7e2SKirill Okhotnikov 
TEST_F(LlvmLibcCoshfExhaustiveTest,NegativeRange)319532074aSTue Ly TEST_F(LlvmLibcCoshfExhaustiveTest, NegativeRange) {
329532074aSTue Ly   test_full_range_all_roundings(NEG_START, NEG_STOP);
33fcb9d7e2SKirill Okhotnikov }
34