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

@ -8,6 +8,12 @@ namespace gdpm{
error(int code = 0, const std::string& message = ""):
m_code(code), m_message(message)
{}
void set_code(int code) { m_code = code; }
void set_message(const std::string& message) { m_message = message; }
int get_code() const { return m_code; }
std::string get_message() const { return m_message; }
private:
int m_code;

View file

@ -75,7 +75,7 @@ namespace gdpm::log
);
}
template <typename S, typename...Args>
template <typename S = std::string, typename...Args>
static constexpr void println(const S& format, Args&&...args){
vlog(
fmt::format("{}\n", format),
@ -84,4 +84,9 @@ namespace gdpm::log
);
}
template <typename>
static constexpr void println(const std::string& format = ""){
println(format);
}
}

View file

@ -61,10 +61,10 @@ namespace gdpm::package_manager{
GDPM_DLL_EXPORT int initialize(int argc, char **argv);
GDPM_DLL_EXPORT int execute();
GDPM_DLL_EXPORT void finalize();
GDPM_DLL_EXPORT void install_packages(const std::vector<std::string>& package_titles);
GDPM_DLL_EXPORT void remove_packages(const std::vector<std::string>& package_titles);
GDPM_DLL_EXPORT void update_packages(const std::vector<std::string>& package_titles);
GDPM_DLL_EXPORT void search_for_packages(const std::vector<std::string>& package_titles);
GDPM_DLL_EXPORT error install_packages(const std::vector<std::string>& package_titles, bool skip_prompt = false);
GDPM_DLL_EXPORT error remove_packages(const std::vector<std::string>& package_titles, bool skip_prompt = false);
GDPM_DLL_EXPORT error update_packages(const std::vector<std::string>& package_titles, bool skip_prompt = false);
GDPM_DLL_EXPORT error search_for_packages(const std::vector<std::string>& package_titles, bool skip_prompt = false);
GDPM_DLL_EXPORT void list_information(const std::vector<std::string>& opts);
GDPM_DLL_EXPORT void clean_temporary(const std::vector<std::string>& package_titles);
GDPM_DLL_EXPORT void link_packages(const std::vector<std::string>& package_titles, const std::vector<std::string>& paths);