aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample/spaceship.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2025-12-02 11:01:19 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2025-12-03 15:25:46 +0100
commit39c74e4317c1f4b34a2d0d66a721b44a5adc652f (patch)
tree5db77d05e47a74723fb8e944a012352cb8decf11 /sources/shiboken6/tests/libsample/spaceship.cpp
parent57d79452870c5d6358fcb519a58f76ca9b4edc61 (diff)
shiboken6: Split out the spaceship operator tests
On this occasion, add a test for a free operator<=>() behind guards. Task-number: PYSIDE-3245 Change-Id: Ife8f17add0a8f1c3bd1194a5dfabce4f97c78006 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/tests/libsample/spaceship.cpp')
-rw-r--r--sources/shiboken6/tests/libsample/spaceship.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libsample/spaceship.cpp b/sources/shiboken6/tests/libsample/spaceship.cpp
new file mode 100644
index 000000000..b30f2f30f
--- /dev/null
+++ b/sources/shiboken6/tests/libsample/spaceship.cpp
@@ -0,0 +1,27 @@
+// Copyright (C) 2025 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#include "spaceship.h"
+
+SpaceshipComparisonTester::SpaceshipComparisonTester(int v) noexcept
+ : m_value(v)
+{
+}
+
+FreeSpaceshipComparisonTester::FreeSpaceshipComparisonTester(int v) noexcept
+ : m_value(v)
+{
+}
+
+int FreeSpaceshipComparisonTester::value() const
+{
+ return m_value;
+}
+
+#if __cplusplus >= 202002 || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002)
+std::strong_ordering operator<=>(FreeSpaceshipComparisonTester lhs,
+ FreeSpaceshipComparisonTester rhs)
+{
+ return lhs.value() <=> rhs.value();
+}
+#endif // C++ 20