From b75c82f6456edbc00646da15531cfb63f8957817 Mon Sep 17 00:00:00 2001 From: Karsten Heimrich Date: Tue, 7 Apr 2020 12:34:24 +0200 Subject: Resolve Qt6 TODO items, replace Median and BlockSizeManager * Replaces the, only internaly used, implementation of template class Median with a fixed size none templated version. * Replaces BlockSizeManager with an updated BlockSizeManager V2, but keeping the original name. * adapt the auto-test to take the fixed size array into account Change-Id: If76cb944676c4a06a7566ad0bc37ded25b81c70c Reviewed-by: Sona Kurazyan --- .../qtconcurrentmedian/tst_qtconcurrentmedian.cpp | 42 ++++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'tests/auto/concurrent/qtconcurrentmedian') diff --git a/tests/auto/concurrent/qtconcurrentmedian/tst_qtconcurrentmedian.cpp b/tests/auto/concurrent/qtconcurrentmedian/tst_qtconcurrentmedian.cpp index f5ae80dca5..22e555d2db 100644 --- a/tests/auto/concurrent/qtconcurrentmedian/tst_qtconcurrentmedian.cpp +++ b/tests/auto/concurrent/qtconcurrentmedian/tst_qtconcurrentmedian.cpp @@ -39,33 +39,45 @@ private slots: void tst_QtConcurrentMedian::median_data() { - QTest::addColumn >("values"); - QTest::addColumn("expectedMedian"); + QTest::addColumn >("values"); + QTest::addColumn("expectedMedian"); QTest::newRow("size=1") - << (QList() << 1) - << 1; + << (QList() << 1.0) + << 0.0; // six 0.0 in front of the actual value QTest::newRow("size=2") - << (QList() << 3 << 2) - << 3; + << (QList() << 3.0 << 2.0) + << 0.0; // five 0.0 in front of the actual value QTest::newRow("size=3") - << (QList() << 3 << 1 << 2) - << 2; + << (QList() << 3.0 << 1.0 << 2.0) + << 0.0; // four 0.0 in front of the actual value - QTest::newRow("gcc bug 58800 (nth_element)") - << (QList() << 207089 << 202585 << 180067 << 157549 << 211592 << 216096 << 207089) - << 207089; + QTest::newRow("size=4") + << (QList() << 3.0 << 1.0 << 2.0 << 4.0) + << 1.0; // three 0.0 in front of the first actual value, pick 1.0 + + QTest::newRow("size=5") + << (QList() << 3.0 << 1.0 << 2.0 << 3.0 << 1.0) + << 1.0; // two 0.0 in front of the first actual value, pick 1.0 + + QTest::newRow("size=6") + << (QList() << 3.0 << 1.0 << 2.0 << 3.0 << 1.0 << 2.0) + << 2.0; // one 0.0 in front of the first actual value, pick 2.0 + + QTest::newRow("size=7") + << QList { 207089.0, 202585.0, 180067.0, 157549.0, 211592.0, 216096.0, 207089.0 } + << 207089.0; } void tst_QtConcurrentMedian::median() { - QFETCH(QList , values); - QFETCH(int, expectedMedian); + QFETCH(QList , values); + QFETCH(double, expectedMedian); - QtConcurrent::Median m(values.size()); - foreach (int value, values) + QtConcurrent::Median m; + foreach (double value, values) m.addValue(value); QCOMPARE(m.median(), expectedMedian); } -- cgit v1.2.3