Allow QtTest's QCOMPARE to work with mixed q(u)int32 and q(u)int64

Change-Id: I491edcae84c149775cf3640626ccff8cbf0d69fe
Reviewed-by: Jon Severinsson <jon@severinsson.net>
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
Jon Severinsson 2012-10-26 08:41:27 +02:00 committed by The Qt Project
parent c21ed8ca1f
commit 34a3f2cd44
2 changed files with 66 additions and 0 deletions

View File

@ -232,6 +232,48 @@ inline bool qCompare(QFlags<T> const &t1, int const &t2, const char *actual, con
return qCompare(int(t1), t2, actual, expected, file, line);
}
template<>
inline bool qCompare(qint64 const &t1, qint32 const &t2, const char *actual,
const char *expected, const char *file, int line)
{
return qCompare(t1, static_cast<qint64>(t2), actual, expected, file, line);
}
template<>
inline bool qCompare(qint64 const &t1, quint32 const &t2, const char *actual,
const char *expected, const char *file, int line)
{
return qCompare(t1, static_cast<qint64>(t2), actual, expected, file, line);
}
template<>
inline bool qCompare(quint64 const &t1, quint32 const &t2, const char *actual,
const char *expected, const char *file, int line)
{
return qCompare(t1, static_cast<quint64>(t2), actual, expected, file, line);
}
template<>
inline bool qCompare(qint32 const &t1, qint64 const &t2, const char *actual,
const char *expected, const char *file, int line)
{
return qCompare(static_cast<qint64>(t1), t2, actual, expected, file, line);
}
template<>
inline bool qCompare(quint32 const &t1, qint64 const &t2, const char *actual,
const char *expected, const char *file, int line)
{
return qCompare(static_cast<qint64>(t1), t2, actual, expected, file, line);
}
template<>
inline bool qCompare(quint32 const &t1, quint64 const &t2, const char *actual,
const char *expected, const char *file, int line)
{
return qCompare(static_cast<quint64>(t1), t2, actual, expected, file, line);
}
}
QT_END_NAMESPACE

View File

@ -2696,6 +2696,30 @@ bool QTest::compare_string_helper(const char *t1, const char *t2, const char *ac
\internal
*/
/*! \fn bool QTest::qCompare(qint64 const &t1, qint32 const &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
/*! \fn bool QTest::qCompare(qint64 const &t1, quint32 const &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
/*! \fn bool QTest::qCompare(quint64 const &t1, quint32 const &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
/*! \fn bool QTest::qCompare(qint32 const &t1, qint64 const &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
/*! \fn bool QTest::qCompare(quint32 const &t1, qint64 const &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
/*! \fn bool QTest::qCompare(quint32 const &t1, quint64 const &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
/*! \fn bool QTest::qCompare(bool const &t1, int const &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/