diff options
author | Petr Mrázek <peterix@gmail.com> | 2017-03-11 01:39:45 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2017-04-07 00:20:01 +0200 |
commit | ab868df50eb6f9f3958bdc0a7ab9199dcdf46b3c (patch) | |
tree | 0dfb9713e99f5d89d75e05e2ceb4b1378a2aa6b3 /api/logic/meta/Index_test.cpp | |
parent | 1fbe03f982f130bf675b7f94dd9c06aee62da54f (diff) | |
download | MultiMC-ab868df50eb6f9f3958bdc0a7ab9199dcdf46b3c.tar MultiMC-ab868df50eb6f9f3958bdc0a7ab9199dcdf46b3c.tar.gz MultiMC-ab868df50eb6f9f3958bdc0a7ab9199dcdf46b3c.tar.lz MultiMC-ab868df50eb6f9f3958bdc0a7ab9199dcdf46b3c.tar.xz MultiMC-ab868df50eb6f9f3958bdc0a7ab9199dcdf46b3c.zip |
NOISSUE Wonko is the new Meta
And then Wonko was the Meta.
Diffstat (limited to 'api/logic/meta/Index_test.cpp')
-rw-r--r-- | api/logic/meta/Index_test.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/api/logic/meta/Index_test.cpp b/api/logic/meta/Index_test.cpp new file mode 100644 index 00000000..d26700ca --- /dev/null +++ b/api/logic/meta/Index_test.cpp @@ -0,0 +1,50 @@ +#include <QTest> +#include "TestUtil.h" + +#include "meta/Index.h" +#include "meta/VersionList.h" +#include "Env.h" + +class IndexTest : public QObject +{ + Q_OBJECT +private +slots: + void test_isProvidedByEnv() + { + QVERIFY(ENV.metadataIndex()); + QCOMPARE(ENV.metadataIndex(), ENV.metadataIndex()); + } + + void test_providesTasks() + { + QVERIFY(ENV.metadataIndex()->localUpdateTask() != nullptr); + QVERIFY(ENV.metadataIndex()->remoteUpdateTask() != nullptr); + } + + void test_hasUid_and_getList() + { + Meta::Index windex({std::make_shared<Meta::VersionList>("list1"), std::make_shared<Meta::VersionList>("list2"), std::make_shared<Meta::VersionList>("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() + { + Meta::Index windex({std::make_shared<Meta::VersionList>("list1"), std::make_shared<Meta::VersionList>("list2"), std::make_shared<Meta::VersionList>("list3")}); + QCOMPARE(windex.lists().size(), 3); + windex.merge(std::shared_ptr<Meta::Index>(new Meta::Index({std::make_shared<Meta::VersionList>("list1"), std::make_shared<Meta::VersionList>("list2"), std::make_shared<Meta::VersionList>("list3")}))); + QCOMPARE(windex.lists().size(), 3); + windex.merge(std::shared_ptr<Meta::Index>(new Meta::Index({std::make_shared<Meta::VersionList>("list4"), std::make_shared<Meta::VersionList>("list2"), std::make_shared<Meta::VersionList>("list5")}))); + QCOMPARE(windex.lists().size(), 5); + windex.merge(std::shared_ptr<Meta::Index>(new Meta::Index({std::make_shared<Meta::VersionList>("list6")}))); + QCOMPARE(windex.lists().size(), 6); + } +}; + +QTEST_GUILESS_MAIN(IndexTest) + +#include "Index_test.moc" |