nextcloud-desktop/test/testupdater.cpp
Jocelyn Turcotte f427955512 Simplify the build of auto tests
Remove all configure_files:
- Move all tests to cpp files
- Use the QTEST_MAIN macro instead of a generated main.cpp
- Include test*.moc in the cpp to let CMAKE_AUTOMOC call moc
- Pass info through add_definitions instead of generating oc_bin.h with them

This makes sure that build errors points to the original test source
file instead of the generated one in the build directory to be able to
jump and fix errors directly from the IDE's error pane.
2016-03-30 18:00:22 +02:00

34 lines
864 B
C++

/*
This software is in the public domain, furnished "as is", without technical
support, and with no warranty, express or implied, as to its usefulness for
any purpose.
*/
#include <QtTest>
#include "updater/updater.h"
#include "updater/ocupdater.h"
using namespace OCC;
class TestUpdater : public QObject
{
Q_OBJECT
private slots:
void testVersionToInt()
{
qint64 lowVersion = Updater::Helper::versionToInt(1,2,80,3000);
QCOMPARE(Updater::Helper::stringVersionToInt("1.2.80.3000"), lowVersion);
qint64 highVersion = Updater::Helper::versionToInt(99,2,80,3000);
qint64 currVersion = Updater::Helper::currentVersionToInt();
QVERIFY(currVersion > 0);
QVERIFY(currVersion > lowVersion);
QVERIFY(currVersion < highVersion);
}
};
QTEST_MAIN(TestUpdater)
#include "testupdater.moc"