[libc-commits] [libc] [libc] Add inf/nan tests for strfrom*() functions (PR #86663)

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Wed Mar 27 07:44:49 PDT 2024


================
@@ -68,11 +69,27 @@ class StrfromTest : public LIBC_NAMESPACE::testing::Test {
     written = func(buff, 37, "A simple string with no conversions.", 1.0);
     ASSERT_STREQ_LEN(written, buff, "A simple string with no conversions.");
 
-    written =
-        func(buff, 37,
-             "%A simple string with one conversion, should overwrite.", 1.0);
-    ASSERT_STREQ_LEN(written, buff, is_long_double ? "0X8P-3" : "0X1P+0");
-
+    if (is_long_double) {
+      // 64-bit long double values require checking as they will give
+      // a different result
+#if defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
----------------
gchatelet wrote:

`long double` can be 64, 80 or 128 bits so technically we'd need the following cases:
 - `LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64`
 - `LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80`
 - `LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128`

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


More information about the libc-commits mailing list