Fix test failures introduced by PR #113697 (#116941)
[llvm-project.git] / libc / test / include / IsInfTest.h
blob7993a49c15fefa08b62fa4f89f56b53077c2e0b8
1 //===-- Utility class to test the isinf macro [f|l] -------------*- C++ -*-===//
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_TEST_INCLUDE_MATH_ISINF_H
10 #define LLVM_LIBC_TEST_INCLUDE_MATH_ISINF_H
12 #include "test/UnitTest/FPMatcher.h"
13 #include "test/UnitTest/Test.h"
15 #include "include/llvm-libc-macros/math-function-macros.h"
17 template <typename T> class IsInfTest : public LIBC_NAMESPACE::testing::Test {
19 DECLARE_SPECIAL_CONSTANTS(T)
21 public:
22 typedef int (*IsInfFunc)(T);
24 void testSpecialNumbers(IsInfFunc func) {
25 EXPECT_EQ(func(zero), 0);
26 EXPECT_EQ(func(neg_zero), 0);
27 EXPECT_EQ(func(inf), 1);
28 EXPECT_EQ(func(neg_inf), 1);
32 #define LIST_ISINF_TESTS(T, func) \
33 using LlvmLibcIsInfTest = IsInfTest<T>; \
34 TEST_F(LlvmLibcIsInfTest, SpecialNumbers) { \
35 auto isinf_func = [](T x) { return func(x); }; \
36 testSpecialNumbers(isinf_func); \
39 #endif // LLVM_LIBC_TEST_INCLUDE_MATH_ISINF_H