1 | //===-- Unittests for acosf -----------------------------------------------===// |
---|---|
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 "hdr/math_macros.h" |
10 | #include "src/__support/FPUtil/FPBits.h" |
11 | #include "src/errno/libc_errno.h" |
12 | #include "src/math/acosf.h" |
13 | #include "test/UnitTest/FPMatcher.h" |
14 | #include "test/UnitTest/Test.h" |
15 | |
16 | #include <errno.h> |
17 | #include <stdint.h> |
18 | |
19 | using LlvmLibcAcosfTest = LIBC_NAMESPACE::testing::FPTest<float>; |
20 | |
21 | TEST_F(LlvmLibcAcosfTest, SpecialNumbers) { |
22 | LIBC_NAMESPACE::libc_errno = 0; |
23 | |
24 | EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(aNaN)); |
25 | EXPECT_MATH_ERRNO(0); |
26 | |
27 | EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(inf)); |
28 | EXPECT_MATH_ERRNO(EDOM); |
29 | |
30 | EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(neg_inf)); |
31 | EXPECT_MATH_ERRNO(EDOM); |
32 | |
33 | EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::acosf(1.0f)); |
34 | EXPECT_MATH_ERRNO(0); |
35 | |
36 | EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(2.0f)); |
37 | EXPECT_MATH_ERRNO(EDOM); |
38 | |
39 | EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(-2.0f)); |
40 | EXPECT_MATH_ERRNO(EDOM); |
41 | } |
42 |