[PATCH] D53763: [libc++] [test] Fix logic error in <compare> tests; enable for MSVC previews
Casey Carter via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 26 07:46:21 PDT 2018
CaseyCarter created this revision.
CaseyCarter added reviewers: EricWF, mclow.lists.
Fairly straightforward: these tests were written without an implementation of `<=>`, and they're incorrectly testing that `0 <=> foo` has the behavior that is required for `foo <=> 0`.
https://reviews.llvm.org/D53763
Files:
test/std/language.support/cmp/cmp.partialord/partialord.pass.cpp
test/std/language.support/cmp/cmp.strongord/strongord.pass.cpp
test/std/language.support/cmp/cmp.weakord/weakord.pass.cpp
test/support/test_macros.h
Index: test/support/test_macros.h
===================================================================
--- test/support/test_macros.h
+++ test/support/test_macros.h
@@ -203,8 +203,9 @@
// FIXME: Fix this feature check when either (A) a compiler provides a complete
// implementation, or (b) a feature check macro is specified
+#if !defined(_MSC_VER) || defined(__clang__) || _MSC_VER < 1920 || _MSVC_LANG <= 201703L
#define TEST_HAS_NO_SPACESHIP_OPERATOR
-
+#endif
#if TEST_STD_VER < 11
#define ASSERT_NOEXCEPT(...)
Index: test/std/language.support/cmp/cmp.weakord/weakord.pass.cpp
===================================================================
--- test/std/language.support/cmp/cmp.weakord/weakord.pass.cpp
+++ test/std/language.support/cmp/cmp.weakord/weakord.pass.cpp
@@ -142,7 +142,7 @@
};
for (auto TC : SpaceshipTestCases)
{
- std::weak_ordering Res = (0 <=> TC.Value);
+ std::weak_ordering Res = (TC.Value <=> 0);
switch (TC.Expect) {
case ER_Equiv:
assert(Res == 0);
Index: test/std/language.support/cmp/cmp.strongord/strongord.pass.cpp
===================================================================
--- test/std/language.support/cmp/cmp.strongord/strongord.pass.cpp
+++ test/std/language.support/cmp/cmp.strongord/strongord.pass.cpp
@@ -185,7 +185,7 @@
};
for (auto TC : SpaceshipTestCases)
{
- std::strong_ordering Res = (0 <=> TC.Value);
+ std::strong_ordering Res = (TC.Value <=> 0);
switch (TC.Expect) {
case ER_Equiv:
assert(Res == 0);
Index: test/std/language.support/cmp/cmp.partialord/partialord.pass.cpp
===================================================================
--- test/std/language.support/cmp/cmp.partialord/partialord.pass.cpp
+++ test/std/language.support/cmp/cmp.partialord/partialord.pass.cpp
@@ -130,7 +130,7 @@
};
for (auto TC : SpaceshipTestCases)
{
- std::partial_ordering Res = (0 <=> TC.Value);
+ std::partial_ordering Res = (TC.Value <=> 0);
switch (TC.Expect) {
case ER_Equiv:
assert(Res == 0);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53763.171304.patch
Type: text/x-patch
Size: 2052 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181026/7fccb71b/attachment.bin>
More information about the cfe-commits
mailing list