Updated unit tests

-Added tests for functions
-Added error class and return from package manager functions
-Updated `compile.sh` script
This commit is contained in:
David Allen 2023-01-07 14:50:09 -06:00
parent d4b1ea90c6
commit 5ffce72fa5
7 changed files with 109 additions and 42 deletions

View file

@ -1,3 +1,4 @@
#include "package_manager.hpp"
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "log.hpp"
@ -7,20 +8,37 @@
#include <doctest.h>
TEST_SUITE("Test database functions"){
TEST_CASE("Confirm doctest unit testing"){
CHECK(true);
gdpm::log::print("Testing doctest");
TEST_CASE("Test cache database functions"){
gdpm::cache::create_package_database();
}
}
TEST_CASE("Test cache database functions"){
gdpm::cache::create_package_database();
TEST_SUITE("Package manager function"){
std::vector<std::string> packages{"ResolutionManagerPlugin","godot-hmac", "Godot"};
gdpm::config::context config = gdpm::config::make_context();
TEST_CASE("Test install packages"){
gdpm::package_manager::install_packages(packages, true);
}
TEST_CASE("Test searching packages"){
gdpm::package_manager::search_for_packages(packages, true);
}
TEST_CASE("Test remove packages"){
gdpm::package_manager::remove_packages(packages, true);
}
}
TEST_CASE("Test configuration functions"){
gdpm::config::context config;
gdpm::config::context config = gdpm::config::make_context();
config.path = gdpm::constants::TestPath + "/";
std::string json = gdpm::config::to_json(config);