[libc-commits] [libc] [libc] Unit test for isnan[f,l] (PR #98274)
Petr Hosek via libc-commits
libc-commits at lists.llvm.org
Sat Jul 13 21:35:24 PDT 2024
================
@@ -1,20 +1,16 @@
-//===-- Utility class to test the isnan macro [f|l] -------------*- C++ -*-===//
+//===-- Utility class to test isnan[f|l] ------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license nanormation.
+// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIBC_TEST_INCLUDE_MATH_ISNAN_H
-#define LLVM_LIBC_TEST_INCLUDE_MATH_ISNAN_H
-
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include "include/llvm-libc-macros/math-function-macros.h"
-
-template <typename T> class IsNanTest : public LIBC_NAMESPACE::testing::Test {
+template <typename T>
+class IsNanTest : public LIBC_NAMESPACE::testing::FPTest<T> {
DECLARE_SPECIAL_CONSTANTS(T)
----------------
petrhosek wrote:
When I do that I get the following error:
```
In file included from /usr/local/google/home/phosek/llvm/llvm-project/libc/test/src/math/isnan_test.cpp:9:
/usr/local/google/home/phosek/llvm/llvm-project/libc/test/src/math/IsNanTest.h:18:20: error: use of undeclared identifier 'zero'; did you mean 'erf'?
18 | EXPECT_EQ(func(zero), 0);
| ^~~~
| erf
/usr/local/google/home/phosek/llvm/llvm-project/libc/test/UnitTest/LibcTest.h:420:50: note: expanded from macro 'EXPECT_EQ'
420 | #define EXPECT_EQ(LHS, RHS) LIBC_TEST_BINOP_(EQ, LHS, RHS, )
| ^
/usr/local/google/home/phosek/llvm/llvm-project/libc/test/UnitTest/LibcTest.h:413:72: note: expanded from macro 'LIBC_TEST_BINOP_'
413 | LIBC_TEST_SCAFFOLDING_(test(LIBC_NAMESPACE::testing::TestCond::COND, LHS, \
| ^
/usr/local/google/home/phosek/llvm/llvm-project/libc/test/UnitTest/LibcTest.h:406:7: note: expanded from macro 'LIBC_TEST_SCAFFOLDING_'
406 | if (TEST) \
| ^
/usr/local/google/home/phosek/fuchsia/prebuilt/third_party/clang/linux-x64/bin/../include/c++/v1/math.h:456:20: note: 'erf' declared here
456 | using std::__math::erf;
| ^
In file included from /usr/local/google/home/phosek/llvm/llvm-project/libc/test/src/math/isnan_test.cpp:9:
/usr/local/google/home/phosek/llvm/llvm-project/libc/test/src/math/IsNanTest.h:19:20: error: use of undeclared identifier 'neg_zero'
19 | EXPECT_EQ(func(neg_zero), 0);
| ^
/usr/local/google/home/phosek/llvm/llvm-project/libc/test/src/math/IsNanTest.h:20:20: error: use of undeclared identifier 'inf'
20 | EXPECT_EQ(func(inf), 0);
| ^
/usr/local/google/home/phosek/llvm/llvm-project/libc/test/src/math/IsNanTest.h:21:20: error: use of undeclared identifier 'neg_inf'
21 | EXPECT_EQ(func(neg_inf), 0);
| ^
/usr/local/google/home/phosek/llvm/llvm-project/libc/test/src/math/IsNanTest.h:22:20: error: use of undeclared identifier 'aNaN'; did you mean 'atan'?
22 | EXPECT_NE(func(aNaN), 0);
| ^~~~
| atan
```
https://github.com/llvm/llvm-project/pull/98274
More information about the libc-commits
mailing list