Tests: remove #define COMMA
Those were workarounds to passing a comma to a macro, but there are ways around it. The simplest is to just use variadic macros; another, which has been applied to Q_DECLARE_METATYPE for a long time, is to define an alias to the thing you're trying to use. Change-Id: Ie4bb662dcb274440ab8bfffd17097fbf0c53eabc Reviewed-by: Marc Mutz <marc.mutz@qt.io>bb10
parent
c49bf9fe27
commit
395c9ac731
|
|
@ -14,7 +14,6 @@
|
|||
# define HAVE_FALLBACK_ENGINE
|
||||
#endif
|
||||
|
||||
#define COMMA ,
|
||||
#define QVERIFY_3TIMES(statement) \
|
||||
do {\
|
||||
if (!static_cast<bool>(statement))\
|
||||
|
|
@ -165,8 +164,8 @@ QT_WARNING_POP
|
|||
QRandomGenerator64 systemRng64 = *system64;
|
||||
systemRng64 = *system64;
|
||||
|
||||
static_assert(std::is_same<decltype(rng64.generate()) COMMA quint64>::value);
|
||||
static_assert(std::is_same<decltype(system64->generate()) COMMA quint64>::value);
|
||||
static_assert(std::is_same_v<decltype(rng64.generate()), quint64>);
|
||||
static_assert(std::is_same_v<decltype(system64->generate()), quint64>);
|
||||
}
|
||||
|
||||
void tst_QRandomGenerator::knownSequence()
|
||||
|
|
@ -895,18 +894,20 @@ void tst_QRandomGenerator::stdGenerateCanonical()
|
|||
{
|
||||
QFETCH(uint, control);
|
||||
RandomGenerator rng(control);
|
||||
auto generate_canonical = [&rng]() {
|
||||
return std::generate_canonical<qreal, 32>(rng);
|
||||
};
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
QVERIFY_3TIMES([&] {
|
||||
qreal value = std::generate_canonical<qreal COMMA 32>(rng);
|
||||
qreal value = generate_canonical();
|
||||
return value > 0 && value < 1 && value != RandomValueFP;
|
||||
}());
|
||||
}
|
||||
|
||||
// and should hopefully be different from repeated calls
|
||||
for (int i = 0; i < 4; ++i)
|
||||
QVERIFY_3TIMES(std::generate_canonical<qreal COMMA 32>(rng) !=
|
||||
std::generate_canonical<qreal COMMA 32>(rng));
|
||||
QVERIFY_3TIMES(generate_canonical() != generate_canonical());
|
||||
}
|
||||
|
||||
void tst_QRandomGenerator::stdUniformRealDistribution_data()
|
||||
|
|
|
|||
|
|
@ -3069,9 +3069,8 @@ class T2;
|
|||
|
||||
void tst_Collections::forwardDeclared()
|
||||
{
|
||||
#define COMMA ,
|
||||
#define TEST(type) do { \
|
||||
using C = type; \
|
||||
#define TEST(...) do { \
|
||||
using C = __VA_ARGS__; \
|
||||
C *x = nullptr; \
|
||||
C::iterator i; \
|
||||
C::const_iterator j; \
|
||||
|
|
@ -3080,16 +3079,15 @@ void tst_Collections::forwardDeclared()
|
|||
Q_UNUSED(j); \
|
||||
} while (false)
|
||||
|
||||
TEST(QHash<Key1 COMMA T1>);
|
||||
TEST(QMap<Key1 COMMA T1>);
|
||||
TEST(QMultiMap<Key1 COMMA T1>);
|
||||
TEST(QHash<Key1, T1>);
|
||||
TEST(QMap<Key1, T1>);
|
||||
TEST(QMultiMap<Key1, T1>);
|
||||
TEST(QList<T1>);
|
||||
TEST(QVector<T1>);
|
||||
TEST(QStack<T1>);
|
||||
TEST(QQueue<T1>);
|
||||
TEST(QSet<T1>);
|
||||
#undef TEST
|
||||
#undef COMMA
|
||||
|
||||
{
|
||||
using C = QPair<T1, T2>;
|
||||
|
|
|
|||
Loading…
Reference in New Issue