[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:23:36 PDT 2024


================
@@ -0,0 +1,53 @@
+//===-- 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 information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "test/UnitTest/FEnvSafeTest.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+template <typename T>
+class IsNanTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
----------------
petrhosek wrote:

I tried that but I'm getting 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:26:5: error: no matching function for call to 'test'
   26 |     EXPECT_EQ(func(sNaN), 1);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/google/home/phosek/llvm/llvm-project/libc/test/UnitTest/LibcTest.h:420:29: 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:26: 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/llvm/llvm-project/libc/test/UnitTest/LibcTest.h:99:6: note: candidate function template not viable: requires 7 arguments, but 6 were provided
   99 | bool test(RunContext *Ctx, TestCond Cond, ValType LHS, ValType RHS,
      |      ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  100 |           const char *LHSStr, const char *RHSStr, Location Loc);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 errors generated.
```
Do you know what's the issue?

https://github.com/llvm/llvm-project/pull/98274


More information about the libc-commits mailing list