diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2010-06-30 21:59:47 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2010-06-30 21:59:47 +0000 |
commit | 10b8e327d8c0d37b8a9f1997e33e4bf1a97bb39b (patch) | |
tree | 96787bf458cec93c63bfd37904388450ce32052a /rbutil/rbutilqt/test | |
parent | 35150b6dcb18089ba76a660e6b73caf1dad86579 (diff) |
FS#11439: Fix version comparison regression.
Improve string suffix handling by distinguishing between version number
separators (i.e. dots) and extended separators and additional version
characters. Corrects false update information displayed for 64bit binaries of
Rockbox Utility.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27201 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/test')
-rw-r--r-- | rbutil/rbutilqt/test/compareversion.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/rbutil/rbutilqt/test/compareversion.cpp b/rbutil/rbutilqt/test/compareversion.cpp index db1c62e5d5..80bddf733a 100644 --- a/rbutil/rbutilqt/test/compareversion.cpp +++ b/rbutil/rbutilqt/test/compareversion.cpp @@ -62,6 +62,12 @@ const struct testvector testdata[] = { "test-1.2.3.tar.gz", "program-1.2.3.1.tar.bz2", 1 }, { "program-1.2.3.zip", "program-1.2.3a.zip", 1 }, { "program-1.2.3.tar.bz2", "2.0.0", 1 }, + { "prog-1.2-64bit.tar.bz2", "prog-1.2.3.tar.bz2", 1 }, + { "prog-1.2-64bit.tar.bz2", "prog-1.2-64bit.tar.bz2", 0 }, + { "prog-1.2-64bit.tar.bz2", "prog-1.2.3-64bit.tar.bz2", 1 }, + { "prog-1.2a-64bit.tar.bz2","prog-1.2b-64bit.tar.bz2", 1 }, + { "prog-1.2-64bit.tar.bz2", "prog-1.2.3a-64bit.tar.bz2", 1 }, + { "prog-1.2a-64bit.tar.bz2","prog-1.2.3-64bit.tar.bz2", 1 }, }; @@ -72,8 +78,9 @@ void TestVersionCompare::testMain() QCOMPARE(Utils::compareVersionStrings(testdata[i].first, testdata[i].second), testdata[i].expected); // inverse test possible because function return values are symmetrical. - QCOMPARE(Utils::compareVersionStrings(testdata[i].second, - testdata[i].first), -testdata[i].expected); + if(testdata[i].expected != 0) + QCOMPARE(Utils::compareVersionStrings(testdata[i].second, + testdata[i].first), -testdata[i].expected); } } |