summaryrefslogtreecommitdiff
path: root/backend/tests
diff options
context:
space:
mode:
Diffstat (limited to 'backend/tests')
-rw-r--r--backend/tests/definitions.cc98
-rw-r--r--backend/tests/dl-test.cc30
-rw-r--r--backend/tests/slackpkg-test.cc29
3 files changed, 10 insertions, 147 deletions
diff --git a/backend/tests/definitions.cc b/backend/tests/definitions.cc
deleted file mode 100644
index 37f6134..0000000
--- a/backend/tests/definitions.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
- */
-#include <cstdint>
-#include "pk-backend.h"
-#include <pk-backend-job.h>
-
-void *
-pk_backend_job_get_user_data (PkBackendJob *job)
-{
- return nullptr;
-}
-
-void
-pk_backend_job_set_user_data (PkBackendJob *job, void *user_data)
-{
-}
-
-void
-pk_backend_job_set_allow_cancel (PkBackendJob *job, bool allow_cancel)
-{
-}
-
-void
-pk_backend_job_package (PkBackendJob *job,
- PkInfoEnum info,
- const char *package_id,
- const char *summary)
-{
-}
-
-void
-pk_backend_job_set_status (PkBackendJob *job, PkStatusEnum status)
-{
-}
-
-void
-pk_backend_job_set_percentage (PkBackendJob *job, unsigned percentage)
-{
-}
-
-void
-pk_backend_job_error_code (PkBackendJob *job,
- PkErrorEnum error_code, const char *format, ...)
-{
-}
-
-void
-pk_backend_job_files (PkBackendJob *job,
- const char *package_id, char **files)
-{
-}
-
-void
-pk_backend_job_details (PkBackendJob *job,
- const char *package_id,
- const char *summary,
- const char *license,
- PkGroupEnum group,
- const char *description,
- const char *url,
- unsigned long size,
- std::uint64_t download_size)
-{
-}
-
-void
-pk_backend_job_update_detail (PkBackendJob *job,
- const char *package_id,
- char **updates,
- char **obsoletes,
- char **vendor_urls,
- char **bugzilla_urls,
- char **cve_urls,
- PkRestartEnum restart,
- const char *update_text,
- const char *changelog,
- PkUpdateStateEnum state,
- const char *issued,
- const char *updated)
-{
-}
-
-bool
-pk_backend_job_thread_create (PkBackendJob *job,
- PkBackendJobThreadFunc func,
- void *user_data,
- GDestroyNotify destroy_func)
-{
- return false;
-}
-
-bool pk_directory_remove_contents (const char *directory)
-{
- return true;
-}
diff --git a/backend/tests/dl-test.cc b/backend/tests/dl-test.cc
deleted file mode 100644
index d04b2b5..0000000
--- a/backend/tests/dl-test.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
- */
-#include "dl.h"
-
-using namespace slack;
-
-static void
-slack_test_dl_construct()
-{
- auto dl = new Dl ("some", "mirror", 1, nullptr, nullptr);
-
- g_assert_cmpstr (dl->get_name (), ==, "some");
- g_assert_cmpstr (dl->get_mirror (), ==, "mirror");
- g_assert_cmpuint (dl->get_order (), ==, 1);
- g_assert_false (dl->is_blacklisted ("pattern"));
-
- delete dl;
-}
-
-int main(int argc, char *argv[])
-{
- g_test_init(&argc, &argv, nullptr);
-
- g_test_add_func("/slack/dl/construct", slack_test_dl_construct);
-
- return g_test_run();
-}
diff --git a/backend/tests/slackpkg-test.cc b/backend/tests/slackpkg-test.cc
index bc2e227..89406af 100644
--- a/backend/tests/slackpkg-test.cc
+++ b/backend/tests/slackpkg-test.cc
@@ -3,28 +3,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
-#include "slackpkg.h"
+#define BOOST_TEST_MODULE slackpkg tests
-using namespace slack;
+#include <boost/test/unit_test.hpp>
+import katja.slackpkg;
-static void
-slack_test_slackpkg_construct()
+BOOST_AUTO_TEST_CASE(slack_test_slackpkg_construct)
{
- auto slackpkg = new Slackpkg ("some", "mirror", 1, nullptr, nullptr);
+ auto slackpkg = new Slackpkg("some", "mirror", 1, nullptr, nullptr);
- g_assert_cmpstr(slackpkg->get_name (), ==, "some");
- g_assert_cmpstr(slackpkg->get_mirror (), ==, "mirror");
- g_assert_cmpuint(slackpkg->get_order (), ==, 1);
- g_assert_false (slackpkg->is_blacklisted ("pattern"));
+ BOOST_TEST(strcmp(slackpkg->get_name(), "some") == 0);
+ BOOST_TEST(strcmp(slackpkg->get_mirror(), "mirror") == 0);
+ BOOST_TEST(slackpkg->get_order() == 1);
+ BOOST_TEST(!slackpkg->is_blacklisted("pattern"));
- delete slackpkg;
-}
-
-int main(int argc, char *argv[])
-{
- g_test_init(&argc, &argv, nullptr);
-
- g_test_add_func("/slack/slackpkg/construct", slack_test_slackpkg_construct);
-
- return g_test_run();
+ delete slackpkg;
}