diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-28 16:41:49 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-06-03 15:14:42 +0200 |
commit | e4079eca49adce16e31dac2a18d49d7a55817891 (patch) | |
tree | 1dfb960ec1115b1f552afe8a013058542389505e /src/testlib | |
parent | f32a6cfb6b6236533508901f114ab57396da8ff3 (diff) | |
parent | ec6dc5f78453048c4f0604655a34c6c20c79d819 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Take 5.
Change-Id: Ifb2d20e95ba824e45e667fba6c2ba45389991cc3
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qtestcase.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index db44b3860a..cad29b5326 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -2539,7 +2539,8 @@ static bool floatingCompare(const T &t1, const T &t2) bool QTest::qCompare(qfloat16 const &t1, qfloat16 const &t2, const char *actual, const char *expected, const char *file, int line) { - return compare_helper(qFuzzyCompare(t1, t2), "Compared qfloat16s are not the same (fuzzy compare)", + return compare_helper(floatingCompare(t1, t2), + "Compared qfloat16s are not the same (fuzzy compare)", toString(t1), toString(t2), actual, expected, file, line); } @@ -2646,16 +2647,10 @@ template <> Q_TESTLIB_EXPORT char *QTest::toString<TYPE>(const TYPE &t) \ return msg; \ } +TO_STRING_FLOAT(qfloat16, %.3g) TO_STRING_FLOAT(float, %g) TO_STRING_FLOAT(double, %.12g) -template <> Q_TESTLIB_EXPORT char *QTest::toString<qfloat16>(const qfloat16 &t) -{ - char *msg = new char[16]; - qsnprintf(msg, 16, "%.3g", static_cast<float>(t)); - return msg; -} - template <> Q_TESTLIB_EXPORT char *QTest::toString<char>(const char &t) { unsigned char c = static_cast<unsigned char>(t); |