diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2021-07-23 21:26:35 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2021-07-27 14:58:41 +0200 |
commit | 8e0c2d7d22141ea391f99a85a6f6557a07a4eb52 (patch) | |
tree | bebe08098d5442367ffe12fce99b8c2868714fac /tests/auto/corelib/global | |
parent | 18113e22e92a7b8d759fd0f9c9d696ee7e97a849 (diff) |
Fix various -Wdeprecated-enum-float-conversions around the code
In two cases, it was as easy as replacing an unnamed enum's values
with constexpr variables. In the case of QSimplex, I opted for
qToUnderlying(), as the enum made sense on its own.
Change-Id: Ifcf5be14bd2f35e50adabdbd7ecdb2e83f6bf5b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/corelib/global')
-rw-r--r-- | tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp index 20f4c9ffa0..30e170b65d 100644 --- a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp +++ b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp @@ -750,18 +750,16 @@ void tst_QRandomGenerator::qualityReal() return; RandomGenerator rng(control); - enum { - SampleSize = 16000, + constexpr int SampleSize = 16000; - // Expected value: sample size times proportion of the range: - PerfectOctile = SampleSize / 8, - PerfectHalf = SampleSize / 2, + // Expected value: sample size times proportion of the range: + constexpr int PerfectOctile = SampleSize / 8; + constexpr int PerfectHalf = SampleSize / 2; - // Variance is (1 - proportion of range) * expected; sqrt() for standard deviations. - // Should usually be within twice that and almost never outside four times: - RangeHalf = 252, // floor(4 * sqrt((1 - 0.5) * PerfectHalf)) - RangeOctile = 167 // floor(4 * sqrt((1 - 0.125) * PerfectOctile)) - }; + // Variance is (1 - proportion of range) * expected; sqrt() for standard deviations. + // Should usually be within twice that and almost never outside four times: + constexpr int RangeHalf = 252; // floor(4 * sqrt((1 - 0.5) * PerfectHalf)) + constexpr int RangeOctile = 167; // floor(4 * sqrt((1 - 0.125) * PerfectOctile)) double data[SampleSize]; std::generate(std::begin(data), std::end(data), [&rng] { return rng.generateDouble(); }); |