summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qhash/tst_qhash.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools/qhash/tst_qhash.cpp')
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index af1c7aed15..ddb72a3c32 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -64,6 +64,7 @@ private slots:
void rehash_isnt_quadratic();
void dont_need_default_constructor();
void qhash();
+ void fp_qhash_of_zero_is_zero();
void qmultihash_specific();
void compare();
@@ -1043,6 +1044,20 @@ void tst_QHash::qhash()
}
}
+void tst_QHash::fp_qhash_of_zero_is_zero()
+{
+ QCOMPARE(qHash(-0.0f), 0U);
+ QCOMPARE(qHash( 0.0f), 0U);
+
+ QCOMPARE(qHash(-0.0 ), 0U);
+ QCOMPARE(qHash( 0.0 ), 0U);
+
+#ifndef Q_OS_DARWIN
+ QCOMPARE(qHash(-0.0L), 0U);
+ QCOMPARE(qHash( 0.0L), 0U);
+#endif
+}
+
void tst_QHash::qmultihash_specific()
{
QMultiHash<int, int> hash1;