summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/global
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-03-20 12:33:02 +0100
committerMarc Mutz <marc.mutz@qt.io>2023-06-12 13:11:26 +0000
commitb209f943d2611fa4ac2dd9c64b1a014182b59a3d (patch)
tree744bb5708a5a52438aef7cba1ffb96d5c3a051eb /tests/auto/corelib/global
parente86e2752845ede635840851198c334f550fafb8f (diff)
Replace {add,sub,mul}_overload with q{Add,Sub,Mul}Overload
These APIs started out as private APIs in qnumeric_p.h, but have since been made pseudo-public in qnumeric.h. The qnumeric_p.h versions just forward to the qnumeric.h ones, so just use the latter. This is in preparation of removing the {add,sub,mul}_overflow versions, which, despite being defined in the unnamed namespace, don't sport the q prefix, so potentially clash with global symbols. The change is a simple textual search and replace, manually excluding qnumeric_p.h. Picking to 6.5 to avoid cherry-pick conflicts going forward. Pick-to: 6.6 6.5 Change-Id: Ic0f7c92f7c47923317109e8a9dc06fa66bdff2c2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/corelib/global')
-rw-r--r--tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
index 03acf5c074..2fffedf492 100644
--- a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
+++ b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
@@ -434,33 +434,33 @@ template <typename Int> static void addOverflow_template()
#define ADD_COMPARE_NONOVF(v1, v2, expected) \
do { \
- QCOMPARE(add_overflow(Int(v1), Int(v2), &r), false); \
+ QCOMPARE(qAddOverflow(Int(v1), Int(v2), &r), false); \
QCOMPARE(r, Int(expected)); \
- QCOMPARE(add_overflow(Int(v1), (std::integral_constant<Int, Int(v2)>()), &r), false); \
+ QCOMPARE(qAddOverflow(Int(v1), (std::integral_constant<Int, Int(v2)>()), &r), false); \
QCOMPARE(r, Int(expected)); \
- QCOMPARE(add_overflow<v2>(Int(v1), &r), false); \
+ QCOMPARE(qAddOverflow<v2>(Int(v1), &r), false); \
QCOMPARE(r, Int(expected)); \
} while (false)
#define ADD_COMPARE_OVF(v1, v2) \
do { \
- QCOMPARE(add_overflow(Int(v1), Int(v2), &r), true); \
- QCOMPARE(add_overflow(Int(v1), (std::integral_constant<Int, Int(v2)>()), &r), true); \
- QCOMPARE(add_overflow<v2>(Int(v1), &r), true); \
+ QCOMPARE(qAddOverflow(Int(v1), Int(v2), &r), true); \
+ QCOMPARE(qAddOverflow(Int(v1), (std::integral_constant<Int, Int(v2)>()), &r), true); \
+ QCOMPARE(qAddOverflow<v2>(Int(v1), &r), true); \
} while (false)
#define SUB_COMPARE_NONOVF(v1, v2, expected) \
do { \
- QCOMPARE(sub_overflow(Int(v1), Int(v2), &r), false); \
+ QCOMPARE(qSubOverflow(Int(v1), Int(v2), &r), false); \
QCOMPARE(r, Int(expected)); \
- QCOMPARE(sub_overflow(Int(v1), (std::integral_constant<Int, Int(v2)>()), &r), false); \
+ QCOMPARE(qSubOverflow(Int(v1), (std::integral_constant<Int, Int(v2)>()), &r), false); \
QCOMPARE(r, Int(expected)); \
- QCOMPARE(sub_overflow<v2>(Int(v1), &r), false); \
+ QCOMPARE(qSubOverflow<v2>(Int(v1), &r), false); \
QCOMPARE(r, Int(expected)); \
} while (false)
#define SUB_COMPARE_OVF(v1, v2) \
do { \
- QCOMPARE(sub_overflow(Int(v1), Int(v2), &r), true); \
- QCOMPARE(sub_overflow(Int(v1), (std::integral_constant<Int, Int(v2)>()), &r), true); \
- QCOMPARE(sub_overflow<v2>(Int(v1), &r), true); \
+ QCOMPARE(qSubOverflow(Int(v1), Int(v2), &r), true); \
+ QCOMPARE(qSubOverflow(Int(v1), (std::integral_constant<Int, Int(v2)>()), &r), true); \
+ QCOMPARE(qSubOverflow<v2>(Int(v1), &r), true); \
} while (false)
// basic values
@@ -611,18 +611,18 @@ template <typename Int> static void mulOverflow_template()
#define MUL_COMPARE_NONOVF(v1, v2, expected) \
do { \
- QCOMPARE(mul_overflow(Int(v1), Int(v2), &r), false); \
+ QCOMPARE(qMulOverflow(Int(v1), Int(v2), &r), false); \
QCOMPARE(r, Int(expected)); \
- QCOMPARE(mul_overflow(Int(v1), (std::integral_constant<Int, v2>()), &r), false); \
+ QCOMPARE(qMulOverflow(Int(v1), (std::integral_constant<Int, v2>()), &r), false); \
QCOMPARE(r, Int(expected)); \
- QCOMPARE(mul_overflow<v2>(Int(v1), &r), false); \
+ QCOMPARE(qMulOverflow<v2>(Int(v1), &r), false); \
QCOMPARE(r, Int(expected)); \
} while (false);
#define MUL_COMPARE_OVF(v1, v2) \
do { \
- QCOMPARE(mul_overflow(Int(v1), Int(v2), &r), true); \
- QCOMPARE(mul_overflow(Int(v1), (std::integral_constant<Int, v2>()), &r), true); \
- QCOMPARE(mul_overflow<v2>(Int(v1), &r), true); \
+ QCOMPARE(qMulOverflow(Int(v1), Int(v2), &r), true); \
+ QCOMPARE(qMulOverflow(Int(v1), (std::integral_constant<Int, v2>()), &r), true); \
+ QCOMPARE(qMulOverflow<v2>(Int(v1), &r), true); \
} while (false);
// basic multiplications
@@ -723,28 +723,28 @@ void tst_QNumeric::signedOverflow()
const int maxInt = std::numeric_limits<int>::max();
int r;
- QCOMPARE(add_overflow(minInt + 1, int(-1), &r), false);
- QCOMPARE(add_overflow(minInt, int(-1), &r), true);
- QCOMPARE(add_overflow(minInt, minInt, &r), true);
- QCOMPARE(add_overflow(maxInt - 1, int(1), &r), false);
- QCOMPARE(add_overflow(maxInt, int(1), &r), true);
- QCOMPARE(add_overflow(maxInt, maxInt, &r), true);
-
- QCOMPARE(sub_overflow(minInt + 1, int(1), &r), false);
- QCOMPARE(sub_overflow(minInt, int(1), &r), true);
- QCOMPARE(sub_overflow(minInt, maxInt, &r), true);
- QCOMPARE(sub_overflow(maxInt - 1, int(-1), &r), false);
- QCOMPARE(sub_overflow(maxInt, int(-1), &r), true);
- QCOMPARE(sub_overflow(maxInt, minInt, &r), true);
-
- QCOMPARE(mul_overflow(minInt, int(1), &r), false);
- QCOMPARE(mul_overflow(minInt, int(-1), &r), true);
- QCOMPARE(mul_overflow(minInt, int(2), &r), true);
- QCOMPARE(mul_overflow(minInt, minInt, &r), true);
- QCOMPARE(mul_overflow(maxInt, int(1), &r), false);
- QCOMPARE(mul_overflow(maxInt, int(-1), &r), false);
- QCOMPARE(mul_overflow(maxInt, int(2), &r), true);
- QCOMPARE(mul_overflow(maxInt, maxInt, &r), true);
+ QCOMPARE(qAddOverflow(minInt + 1, int(-1), &r), false);
+ QCOMPARE(qAddOverflow(minInt, int(-1), &r), true);
+ QCOMPARE(qAddOverflow(minInt, minInt, &r), true);
+ QCOMPARE(qAddOverflow(maxInt - 1, int(1), &r), false);
+ QCOMPARE(qAddOverflow(maxInt, int(1), &r), true);
+ QCOMPARE(qAddOverflow(maxInt, maxInt, &r), true);
+
+ QCOMPARE(qSubOverflow(minInt + 1, int(1), &r), false);
+ QCOMPARE(qSubOverflow(minInt, int(1), &r), true);
+ QCOMPARE(qSubOverflow(minInt, maxInt, &r), true);
+ QCOMPARE(qSubOverflow(maxInt - 1, int(-1), &r), false);
+ QCOMPARE(qSubOverflow(maxInt, int(-1), &r), true);
+ QCOMPARE(qSubOverflow(maxInt, minInt, &r), true);
+
+ QCOMPARE(qMulOverflow(minInt, int(1), &r), false);
+ QCOMPARE(qMulOverflow(minInt, int(-1), &r), true);
+ QCOMPARE(qMulOverflow(minInt, int(2), &r), true);
+ QCOMPARE(qMulOverflow(minInt, minInt, &r), true);
+ QCOMPARE(qMulOverflow(maxInt, int(1), &r), false);
+ QCOMPARE(qMulOverflow(maxInt, int(-1), &r), false);
+ QCOMPARE(qMulOverflow(maxInt, int(2), &r), true);
+ QCOMPARE(qMulOverflow(maxInt, maxInt, &r), true);
}
QTEST_APPLESS_MAIN(tst_QNumeric)