[libcxx-commits] [PATCH] D118238: [libcxx] [test] Simplify the handling of platform specific NAN formatting in put_long_double

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 14 08:35:06 PST 2022


Quuxplusone accepted this revision.
Quuxplusone added a comment.
This revision is now accepted and ready to land.

I suggest an alternative approach, but I see no reason to block over that, so might as well accept. Feel free to adopt the `IF_GLIBC` idea or not, I guess.



================
Comment at: libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp:10891
                                     std::string ex(str, iter.base());
-#if defined(TEST_HAS_GLIBC)
-                                    assert(ex == "+nan");
-#else
-                                    assert(ex == "nan");
-#endif
+                                    assert(ex == pnan_sign + "nan");
                                     assert(ios.width() == 0);
----------------
This is obscure enough I shouldn't really care, but wouldn't it be easier to understand the test if it was like
```
assert(ex == IF_GLIBC("+nan", "nan"));
~~~
assert(ex == IF_GLIBC("+nan*********************",
                      "nan**********************"));
```
and so on? (The `IF_GLIBC` macro would just be scoped to this one file.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118238/new/

https://reviews.llvm.org/D118238



More information about the libcxx-commits mailing list