• Main Page
  • Classes
  • Files
  • File List

VersionCheckerTests.cpp

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2012 Bolton Software Ltd.
00004  * Copyright (C) 2012 Nick Bolton
00005  * 
00006  * This package is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * found in the file COPYING that should have accompanied this file.
00009  * 
00010  * This package is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #include "VersionCheckerTests.h"
00020 #include "VersionChecker.cpp"
00021 #include "../../gui/tmp/debug/moc_VersionChecker.cpp"
00022 
00023 #include <QtTest/QTest>
00024 
00025 void VersionCheckerTests::compareVersions()
00026 {
00027     VersionChecker versionChecker;
00028 
00029     // compare majors
00030     QCOMPARE(versionChecker.compareVersions("1.0.0", "2.0.0"), 1);
00031     QCOMPARE(versionChecker.compareVersions("2.0.0", "1.0.0"), -1);
00032     QCOMPARE(versionChecker.compareVersions("1.0.0", "1.0.0"), 0);
00033     QCOMPARE(versionChecker.compareVersions("1.4.8", "2.4.7"), 1);
00034     QCOMPARE(versionChecker.compareVersions("2.4.7", "1.4.8"), -1);
00035 
00036     // compare minors
00037     QCOMPARE(versionChecker.compareVersions("1.3.0", "1.4.0"), 1);
00038     QCOMPARE(versionChecker.compareVersions("1.4.0", "1.3.0"), -1);
00039     QCOMPARE(versionChecker.compareVersions("1.4.0", "1.4.0"), 0);
00040     QCOMPARE(versionChecker.compareVersions("1.3.8", "1.4.7"), 1);
00041     QCOMPARE(versionChecker.compareVersions("1.4.7", "1.3.8"), -1);
00042 
00043     // compare revs
00044     QCOMPARE(versionChecker.compareVersions("1.4.7", "1.4.8"), 1);
00045     QCOMPARE(versionChecker.compareVersions("1.4.8", "1.4.7"), -1);
00046     QCOMPARE(versionChecker.compareVersions("1.4.7", "1.4.7"), 0);
00047 }

Generated on Thu May 23 2013 00:00:04 for Synergy by  doxygen 1.7.1