[libc-commits] [libc] [libc][math] implement `signbit` (PR #97791)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Tue Jul 9 23:11:31 PDT 2024


================
@@ -0,0 +1,59 @@
+//===-- Utility class to test the isfinite macro [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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_INCLUDE_MATH_ISFINITE_H
+#define LLVM_LIBC_TEST_INCLUDE_MATH_ISFINITE_H
+
+#include "test/UnitTest/FEnvSafeTest.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include "include/llvm-libc-macros/math-function-macros.h"
+
+#define PI 3.14159265358979323846
+
+template <typename T>
+class IsFiniteTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef bool (*IsFiniteFunc)(T);
+
+  void testSpecialNumbers(IsFiniteFunc func) {
+    EXPECT_EQ(isfinite(zero), 1);
----------------
petrhosek wrote:

You should be calling `func`, not `isfinite`, same for all other test cases.

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


More information about the libc-commits mailing list