summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2016-04-06 23:09:30 +0200
committerPetr Mrázek <peterix@gmail.com>2016-04-30 23:59:23 +0200
commit00e5968bd28ab1df33b3a39dbac8cda99aa2a0d2 (patch)
treec930ca4f0edae9bb2bbd1a9ce2fddb2ca5a7bf32 /tests
parent5ae3b2c11416eb897a08b0d9531843d0357332f8 (diff)
downloadMultiMC-00e5968bd28ab1df33b3a39dbac8cda99aa2a0d2.tar
MultiMC-00e5968bd28ab1df33b3a39dbac8cda99aa2a0d2.tar.gz
MultiMC-00e5968bd28ab1df33b3a39dbac8cda99aa2a0d2.tar.lz
MultiMC-00e5968bd28ab1df33b3a39dbac8cda99aa2a0d2.tar.xz
MultiMC-00e5968bd28ab1df33b3a39dbac8cda99aa2a0d2.zip
NOISSUE Add a skeleton of the wonko system
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt4
-rw-r--r--tests/tst_BaseWonkoEntityLocalLoadTask.cpp15
-rw-r--r--tests/tst_BaseWonkoEntityRemoteLoadTask.cpp15
-rw-r--r--tests/tst_WonkoIndex.cpp50
-rw-r--r--tests/tst_WonkoVersionList.cpp15
5 files changed, 99 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 67a7a45e..409462a2 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -37,6 +37,10 @@ add_unit_test(GZip tst_GZip.cpp)
add_unit_test(JavaVersion tst_JavaVersion.cpp)
add_unit_test(ParseUtils tst_ParseUtils.cpp)
add_unit_test(MojangVersionFormat tst_MojangVersionFormat.cpp)
+add_unit_test(BaseWonkoEntityLocalLoadTask tst_BaseWonkoEntityLocalLoadTask.cpp)
+add_unit_test(BaseWonkoEntityRemoteLoadTask tst_BaseWonkoEntityRemoteLoadTask.cpp)
+add_unit_test(WonkoVersionList tst_WonkoVersionList.cpp)
+add_unit_test(WonkoIndex tst_WonkoIndex.cpp)
# Tests END #
diff --git a/tests/tst_BaseWonkoEntityLocalLoadTask.cpp b/tests/tst_BaseWonkoEntityLocalLoadTask.cpp
new file mode 100644
index 00000000..74da222a
--- /dev/null
+++ b/tests/tst_BaseWonkoEntityLocalLoadTask.cpp
@@ -0,0 +1,15 @@
+#include <QTest>
+#include "TestUtil.h"
+
+#include "wonko/tasks/BaseWonkoEntityLocalLoadTask.h"
+
+class BaseWonkoEntityLocalLoadTaskTest : public QObject
+{
+ Q_OBJECT
+private
+slots:
+};
+
+QTEST_GUILESS_MAIN(BaseWonkoEntityLocalLoadTaskTest)
+
+#include "tst_BaseWonkoEntityLocalLoadTask.moc"
diff --git a/tests/tst_BaseWonkoEntityRemoteLoadTask.cpp b/tests/tst_BaseWonkoEntityRemoteLoadTask.cpp
new file mode 100644
index 00000000..3a12e04e
--- /dev/null
+++ b/tests/tst_BaseWonkoEntityRemoteLoadTask.cpp
@@ -0,0 +1,15 @@
+#include <QTest>
+#include "TestUtil.h"
+
+#include "wonko/tasks/BaseWonkoEntityRemoteLoadTask.h"
+
+class BaseWonkoEntityRemoteLoadTaskTest : public QObject
+{
+ Q_OBJECT
+private
+slots:
+};
+
+QTEST_GUILESS_MAIN(BaseWonkoEntityRemoteLoadTaskTest)
+
+#include "tst_BaseWonkoEntityRemoteLoadTask.moc"
diff --git a/tests/tst_WonkoIndex.cpp b/tests/tst_WonkoIndex.cpp
new file mode 100644
index 00000000..076c806b
--- /dev/null
+++ b/tests/tst_WonkoIndex.cpp
@@ -0,0 +1,50 @@
+#include <QTest>
+#include "TestUtil.h"
+
+#include "wonko/WonkoIndex.h"
+#include "wonko/WonkoVersionList.h"
+#include "Env.h"
+
+class WonkoIndexTest : public QObject
+{
+ Q_OBJECT
+private
+slots:
+ void test_isProvidedByEnv()
+ {
+ QVERIFY(ENV.wonkoIndex() != nullptr);
+ QCOMPARE(ENV.wonkoIndex(), ENV.wonkoIndex());
+ }
+
+ void test_providesTasks()
+ {
+ QVERIFY(ENV.wonkoIndex()->localUpdateTask() != nullptr);
+ QVERIFY(ENV.wonkoIndex()->remoteUpdateTask() != nullptr);
+ }
+
+ void test_hasUid_and_getList()
+ {
+ WonkoIndex windex({std::make_shared<WonkoVersionList>("list1"), std::make_shared<WonkoVersionList>("list2"), std::make_shared<WonkoVersionList>("list3")});
+ QVERIFY(windex.hasUid("list1"));
+ QVERIFY(!windex.hasUid("asdf"));
+ QVERIFY(windex.getList("list2") != nullptr);
+ QCOMPARE(windex.getList("list2")->uid(), QString("list2"));
+ QVERIFY(windex.getList("adsf") == nullptr);
+ }
+
+ void test_merge()
+ {
+ WonkoIndex windex({std::make_shared<WonkoVersionList>("list1"), std::make_shared<WonkoVersionList>("list2"), std::make_shared<WonkoVersionList>("list3")});
+ QCOMPARE(windex.lists().size(), 3);
+ windex.merge(std::shared_ptr<WonkoIndex>(new WonkoIndex({std::make_shared<WonkoVersionList>("list1"), std::make_shared<WonkoVersionList>("list2"), std::make_shared<WonkoVersionList>("list3")})));
+ QCOMPARE(windex.lists().size(), 3);
+ windex.merge(std::shared_ptr<WonkoIndex>(new WonkoIndex({std::make_shared<WonkoVersionList>("list4"), std::make_shared<WonkoVersionList>("list2"), std::make_shared<WonkoVersionList>("list5")})));
+ QCOMPARE(windex.lists().size(), 5);
+ windex.merge(std::shared_ptr<WonkoIndex>(new WonkoIndex({std::make_shared<WonkoVersionList>("list6")})));
+ QCOMPARE(windex.lists().size(), 6);
+ }
+};
+
+QTEST_GUILESS_MAIN(WonkoIndexTest)
+
+#include "tst_WonkoIndex.moc"
diff --git a/tests/tst_WonkoVersionList.cpp b/tests/tst_WonkoVersionList.cpp
new file mode 100644
index 00000000..7cb21df7
--- /dev/null
+++ b/tests/tst_WonkoVersionList.cpp
@@ -0,0 +1,15 @@
+#include <QTest>
+#include "TestUtil.h"
+
+#include "wonko/WonkoVersionList.h"
+
+class WonkoVersionListTest : public QObject
+{
+ Q_OBJECT
+private
+slots:
+};
+
+QTEST_GUILESS_MAIN(WonkoVersionListTest)
+
+#include "tst_WonkoVersionList.moc"