• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- Unittests for cosf16 ----------------------------------------------===//
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/errno/libc_errno.h"
10 #include "src/math/cosf16.h"
11 #include "test/UnitTest/FPMatcher.h"
12 #include "test/UnitTest/Test.h"
13 
14 using LlvmLibcCosf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
15 
TEST_F(LlvmLibcCosf16Test,SpecialNumbers)16 TEST_F(LlvmLibcCosf16Test, SpecialNumbers) {
17   LIBC_NAMESPACE::libc_errno = 0;
18 
19   EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf16(aNaN));
20   EXPECT_MATH_ERRNO(0);
21 
22   EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::cosf16(zero));
23   EXPECT_MATH_ERRNO(0);
24 
25   EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::cosf16(neg_zero));
26   EXPECT_MATH_ERRNO(0);
27 
28   EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf16(inf));
29   EXPECT_MATH_ERRNO(EDOM);
30 
31   EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf16(neg_inf));
32   EXPECT_MATH_ERRNO(EDOM);
33 }
34