Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions libc/test/src/math/smoke/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4639,7 +4639,7 @@ add_fp_unittest(
SRCS
asinhf_test.cpp
DEPENDS
libc.src.errno.errno
libc.hdr.errno_macros
libc.src.math.asinhf
libc.src.__support.FPUtil.fp_bits
)
Expand All @@ -4651,7 +4651,7 @@ add_fp_unittest(
SRCS
asinhf16_test.cpp
DEPENDS
libc.src.errno.errno
libc.hdr.errno_macros
libc.src.math.asinhf16
)

Expand All @@ -4663,8 +4663,8 @@ add_fp_unittest(
SRCS
asinpif16_test.cpp
DEPENDS
libc.hdr.errno_macros
libc.src.math.asinpif16
libc.src.errno.errno
)

add_fp_unittest(
Expand All @@ -4674,7 +4674,7 @@ add_fp_unittest(
SRCS
acoshf_test.cpp
DEPENDS
libc.src.errno.errno
libc.hdr.errno_macros
libc.src.math.acoshf
libc.src.__support.FPUtil.fp_bits
)
Expand All @@ -4686,7 +4686,7 @@ add_fp_unittest(
SRCS
acoshf16_test.cpp
DEPENDS
libc.src.errno.errno
libc.hdr.errno_macros
libc.src.math.acoshf16
libc.src.__support.FPUtil.cast
)
Expand All @@ -4698,7 +4698,7 @@ add_fp_unittest(
SRCS
asinf_test.cpp
DEPENDS
libc.src.errno.errno
libc.hdr.errno_macros
libc.src.math.asinf
libc.src.__support.FPUtil.fp_bits
)
Expand All @@ -4720,8 +4720,8 @@ add_fp_unittest(
SRCS
asinf16_test.cpp
DEPENDS
libc.src.errno.errno
libc.src.math.asinf16
libc.hdr.errno_macros
libc.src.math.asinf16
)

add_fp_unittest(
Expand All @@ -4731,7 +4731,7 @@ add_fp_unittest(
SRCS
acosf_test.cpp
DEPENDS
libc.src.errno.errno
libc.hdr.errno_macros
libc.src.math.acosf
libc.src.__support.FPUtil.fp_bits
)
Expand All @@ -4743,8 +4743,8 @@ add_fp_unittest(
SRCS
acos_test.cpp
DEPENDS
libc.hdr.errno_macros
libc.hdr.fenv_macros
libc.src.errno.errno
libc.src.math.acos
)

Expand All @@ -4755,8 +4755,8 @@ add_fp_unittest(
SRCS
acosf16_test.cpp
DEPENDS
libc.src.errno.errno
libc.src.math.acosf16
libc.hdr.errno_macros
libc.src.math.acosf16
)

add_fp_unittest(
Expand All @@ -4766,8 +4766,8 @@ add_fp_unittest(
SRCS
acospif16_test.cpp
DEPENDS
libc.src.errno.errno
libc.src.math.acospif16
libc.hdr.errno_macros
libc.src.math.acospif16
)

add_fp_unittest(
Expand Down
4 changes: 2 additions & 2 deletions libc/test/src/math/smoke/acos_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/libc_errno.h"
#include "src/math/acos.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -18,10 +18,10 @@ TEST_F(LlvmLibcAcosTest, SpecialNumbers) {
EXPECT_FP_EQ_WITH_EXCEPTION_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acos(sNaN),
FE_INVALID);
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acos(aNaN));
EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ(0x1.921fb54442d18p0, LIBC_NAMESPACE::acos(zero));
EXPECT_FP_EQ(0x1.921fb54442d18p0, LIBC_NAMESPACE::acos(neg_zero));

libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acos(inf),
FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
Expand Down
3 changes: 1 addition & 2 deletions libc/test/src/math/smoke/acosf16_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
//
//===----------------------------------------------------------------------===//

#include "src/__support/libc_errno.h"
#include "hdr/errno_macros.h"
#include "src/math/acosf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"

using LlvmLibcAcosf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;

TEST_F(LlvmLibcAcosf16Test, SpecialNumbers) {
libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::acosf16(aNaN));
EXPECT_MATH_ERRNO(0);

Expand Down
4 changes: 1 addition & 3 deletions libc/test/src/math/smoke/acosf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//

#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/libc_errno.h"
#include "src/math/acosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -18,8 +18,6 @@
using LlvmLibcAcosfTest = LIBC_NAMESPACE::testing::FPTest<float>;

TEST_F(LlvmLibcAcosfTest, SpecialNumbers) {
libc_errno = 0;

EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::acosf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);

Expand Down
3 changes: 1 addition & 2 deletions libc/test/src/math/smoke/acoshf16_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
//
//===----------------------------------------------------------------------===//

#include "hdr/errno_macros.h"
#include "src/__support/FPUtil/cast.h"
#include "src/__support/libc_errno.h"
#include "src/math/acoshf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"

using LlvmLibcAcoshf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;

TEST_F(LlvmLibcAcoshf16Test, SpecialNumbers) {
libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::acoshf16(aNaN));
EXPECT_MATH_ERRNO(0);

Expand Down
4 changes: 1 addition & 3 deletions libc/test/src/math/smoke/acoshf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//

#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/libc_errno.h"
#include "src/math/acoshf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -18,8 +18,6 @@
using LlvmLibcAcoshfTest = LIBC_NAMESPACE::testing::FPTest<float>;

TEST_F(LlvmLibcAcoshfTest, SpecialNumbers) {
libc_errno = 0;

EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::acoshf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);

Expand Down
3 changes: 1 addition & 2 deletions libc/test/src/math/smoke/acospif16_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
//
//===----------------------------------------------------------------------===//

#include "src/__support/libc_errno.h"
#include "hdr/errno_macros.h"
#include "src/math/acospif16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"

using LlvmLibcAcospif16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAcospif16Test, SpecialNumbers) {
libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::acospif16(aNaN));
EXPECT_MATH_ERRNO(0);

Expand Down
3 changes: 1 addition & 2 deletions libc/test/src/math/smoke/asinf16_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
//
//===----------------------------------------------------------------------===//

#include "src/__support/libc_errno.h"
#include "hdr/errno_macros.h"
#include "src/math/asinf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"

using LlvmLibcAsinf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;

TEST_F(LlvmLibcAsinf16Test, SpecialNumbers) {
libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::asinf16(aNaN));
EXPECT_MATH_ERRNO(0);

Expand Down
4 changes: 1 addition & 3 deletions libc/test/src/math/smoke/asinf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//

#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/libc_errno.h"
#include "src/math/asinf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -18,8 +18,6 @@
using LlvmLibcAsinfTest = LIBC_NAMESPACE::testing::FPTest<float>;

TEST_F(LlvmLibcAsinfTest, SpecialNumbers) {
libc_errno = 0;

EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::asinf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);

Expand Down
3 changes: 1 addition & 2 deletions libc/test/src/math/smoke/asinhf16_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//

#include "src/__support/libc_errno.h"
#include "hdr/errno_macros.h"
#include "src/math/asinhf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"

using LlvmLibcAsinhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;

TEST_F(LlvmLibcAsinhf16Test, SpecialNumbers) {
libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::asinhf16(aNaN));
EXPECT_MATH_ERRNO(0);

Expand Down
4 changes: 1 addition & 3 deletions libc/test/src/math/smoke/asinhf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//

#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/libc_errno.h"
#include "src/math/asinhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand All @@ -18,8 +18,6 @@
using LlvmLibcAsinhfTest = LIBC_NAMESPACE::testing::FPTest<float>;

TEST_F(LlvmLibcAsinhfTest, SpecialNumbers) {
libc_errno = 0;

EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::asinhf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);

Expand Down
10 changes: 2 additions & 8 deletions libc/test/src/math/smoke/asinpif16_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "src/__support/libc_errno.h"
#include "hdr/errno_macros.h"
#include "src/math/asinpif16.h"
#include "test/UnitTest/FPMatcher.h"

Expand All @@ -26,43 +26,37 @@ TEST_F(LlvmLibcAsinpif16Test, SpecialNumbers) {

EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(FPBits::signaling_nan().get_val()));
EXPECT_MATH_ERRNO(0);

// infinity inputs -> should return NaN
libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(), LIBC_NAMESPACE::asinpif16(inf));
EXPECT_MATH_ERRNO(EDOM);

libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
}

TEST_F(LlvmLibcAsinpif16Test, OutOfRange) {
// Test values > 1
libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(1.5f16));
EXPECT_MATH_ERRNO(EDOM);

libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(2.0f16));
EXPECT_MATH_ERRNO(EDOM);

// Test values < -1
libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(-1.5f16));
EXPECT_MATH_ERRNO(EDOM);

libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(-2.0f16));
EXPECT_MATH_ERRNO(EDOM);

// Test maximum normal value (should be > 1 for float16)
libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(FPBits::max_normal().get_val()));
EXPECT_MATH_ERRNO(EDOM);
Expand Down
Loading