summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-03-13 18:49:04 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2019-03-19 17:52:30 +0000
commit84aea6c091d020a37c2b452a6f56ca27b3b2c7cb (patch)
tree50f321ea52344cfd3831856aabf44089b4962094 /src/testlib
parent368eb2ecec7cc54ea987de00df7caa52a0d4503a (diff)
Add qFpClassify() to mirror std::fpclassify()
The rules of std don't permit us to add an overload for fpclassify(qfloat16), so we need our own equivalent that we *can* overload. Deploy it in the few places we use fpclassify(). Extended qnumeric's testing to cover qFpClassify(). Change-Id: Ie5a0a5cc24599d1571404c573d33c682b0d305a5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestcase.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index a010ea467b..d9f8dd7805 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@@ -2522,12 +2522,12 @@ bool QTest::compare_helper(bool success, const char *failureMsg,
template <typename T>
static bool floatingCompare(const T &t1, const T &t2)
{
- switch (std::fpclassify(t1))
+ switch (qFpClassify(t1))
{
case FP_INFINITE:
- return (t1 < 0) == (t2 < 0) && std::fpclassify(t2) == FP_INFINITE;
+ return (t1 < 0) == (t2 < 0) && qFpClassify(t2) == FP_INFINITE;
case FP_NAN:
- return std::fpclassify(t2) == FP_NAN;
+ return qFpClassify(t2) == FP_NAN;
default:
return qFuzzyCompare(t1, t2);
}
@@ -2631,7 +2631,7 @@ static void massageExponent(char *text)
template <> Q_TESTLIB_EXPORT char *QTest::toString<TYPE>(const TYPE &t) \
{ \
char *msg = new char[128]; \
- switch (std::fpclassify(t)) { \
+ switch (qFpClassify(t)) { \
case FP_INFINITE: \
qstrncpy(msg, (t < 0 ? "-inf" : "inf"), 128); \
break; \