diff options
author | saturneric <[email protected]> | 2023-12-13 10:01:06 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-12-13 10:01:06 +0000 |
commit | 42264ed0d7a3c91fbe9f307984964ffc9e5fe65c (patch) | |
tree | a3ddecbd6ad723e42d68cc2c5aed7a88c4e242a3 /src/cmd.cpp | |
parent | feat: move test to src and add submodule googletest (diff) | |
download | GpgFrontend-42264ed0d7a3c91fbe9f307984964ffc9e5fe65c.tar.gz GpgFrontend-42264ed0d7a3c91fbe9f307984964ffc9e5fe65c.zip |
refactor: improve the structure of main,core and test module
Diffstat (limited to 'src/cmd.cpp')
-rw-r--r-- | src/cmd.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/cmd.cpp b/src/cmd.cpp index f0d748e0..5c554f32 100644 --- a/src/cmd.cpp +++ b/src/cmd.cpp @@ -36,10 +36,13 @@ // GpgFrontend #include "GpgFrontendBuildInfo.h" -#include "type.h" +#include "GpgFrontendContext.h" +#include "test/GpgFrontendTest.h" namespace po = boost::program_options; +namespace GpgFrontend { + auto PrintVersion() -> int { std::cout << PROJECT_NAME << " " << "v" << VERSION_MAJOR << "." << VERSION_MINOR << "." @@ -79,4 +82,19 @@ auto ParseLogLevel(const po::variables_map& vm) -> spdlog::level::level_enum { return spdlog::level::info; } -auto RunTest(int argc, char** argv) {}
\ No newline at end of file +auto RunTest(const GFCxtWPtr& p_ctx) -> int { + GpgFrontend::GFCxtSPtr ctx = p_ctx.lock(); + if (ctx == nullptr) { + SPDLOG_ERROR("cannot get gpgfrontend context for test running"); + return -1; + } + + GpgFrontend::Test::GpgFrontendContext test_init_args; + test_init_args.argc = ctx->argc; + test_init_args.argv = ctx->argv; + test_init_args.log_level = ctx->log_level; + + return GpgFrontend::Test::ExecuteAllTestCase(test_init_args); +} + +} // namespace GpgFrontend
\ No newline at end of file |