summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2019-03-21 13:14:53 +0200
committerKatja Marttila <katja.marttila@qt.io>2019-03-25 05:41:56 +0000
commit2767210585916bc5b9c94701ad736ca07eb6d067 (patch)
tree6c83287d3d86abaf406358458c649d8b1397b9fd /tests
parent407b19ff904244e287d62c7d02ca2a0779fc7b09 (diff)
Fix update with long version numbers
Update fails if version number is longer than 32bit int. Fixed so that the value is converted to 64bit int instead so the int overflow will not happen. Change-Id: If7ab57e89b155793e9fab3ba5dad9c734adc2234 Fixes: QTIFW-1310 Reviewed-by: Konstantin Podsvirov <konstantin@podsvirov.pro> Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/installer/compareversion/tst_compareversion.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/auto/installer/compareversion/tst_compareversion.cpp b/tests/auto/installer/compareversion/tst_compareversion.cpp
index 24ebe9ba6..a33d25b28 100644
--- a/tests/auto/installer/compareversion/tst_compareversion.cpp
+++ b/tests/auto/installer/compareversion/tst_compareversion.cpp
@@ -47,7 +47,11 @@ void tst_CompareVersion::compareVersion()
QCOMPARE(KDUpdater::compareVersion("2.1", "2.0"), +1);
QCOMPARE(KDUpdater::compareVersion("2.0", "2.0"), 0);
QCOMPARE(KDUpdater::compareVersion("2.1", "2.1"), 0);
-
+ QCOMPARE(KDUpdater::compareVersion("2.1", "2.1-201903190747"), -1);
+ QCOMPARE(KDUpdater::compareVersion("2.1-201903190747", "2.1"), +1);
+ QCOMPARE(KDUpdater::compareVersion("2.1-201903190747", "2.1-201903190747"), 0);
+ QCOMPARE(KDUpdater::compareVersion("2.1-0", "2.1-201903190747"), -1);
+ QCOMPARE(KDUpdater::compareVersion("2.1-201903190747", "2.1-0"), +1);
QCOMPARE(KDUpdater::compareVersion("2.0.12.4", "2.1.10.4"), -1);
}