Fixed the unit tests a little bit

This commit is contained in:
James P. Howard, II
2020-09-29 21:15:35 -04:00
parent 5a929db2fd
commit 34dfef2801
5 changed files with 80 additions and 13 deletions

View File

@@ -4,12 +4,15 @@
cmake_minimum_required(VERSION 3.13.0 FATAL_ERROR)
find_package(spdlog)
create_test( NAME
unit-kami-agentid
SOURCES
unit-kami-agentid.cpp
PUBLIC_LINKED_TARGETS
kami::kami
spdlog::spdlog
${COVERAGE_LIBS}
COMMAND
unit-kami-agentid
@@ -22,6 +25,7 @@ create_test( NAME
unit-kami-agent.cpp
PUBLIC_LINKED_TARGETS
kami::kami
spdlog::spdlog
${COVERAGE_LIBS}
COMMAND
unit-kami-agent

View File

@@ -1,7 +1,34 @@
#include <kami/agent.hpp>
/*-
* TODO FILEHEADER
*/
int main() {
kami::Agent agent;
agent.step();
return 0;
#include <spdlog/spdlog.h>
#include <CLI/App.hpp>
#include <CLI/Config.hpp>
#include <CLI/Formatter.hpp>
#include <kami/agent.hpp>
#include <kami/config.hpp>
#include "spdlog/sinks/stdout_color_sinks.h"
using namespace kami;
using namespace std;
int main(int argc, char **argv) {
string ident = "unit-kami-agent";
CLI::App app{ident};
auto console = spdlog::stdout_color_st(ident);
bool debugFlag;
app.add_option("-d,--debug", debugFlag, "A help string");
CLI11_PARSE(app, argc, argv);
if (debugFlag == true)
console->set_level(spdlog::level::debug);
console->debug("Compiled with Kami/{}.{}.{}", KAMI_VERSION_MAJOR, KAMI_VERSION_MINOR, KAMI_VERSION_PATCH);
Agent testAgent;
console->debug("Successfully created Agent with ID {}", testAgent.getAgentID().toString());
}

View File

@@ -1,5 +1,34 @@
#include <kami/agent.hpp>
/*-
* TODO FILEHEADER
*/
int main(void) {
kami::AgentID agentid;
#include <spdlog/spdlog.h>
#include <CLI/App.hpp>
#include <CLI/Config.hpp>
#include <CLI/Formatter.hpp>
#include <kami/agent.hpp>
#include <kami/config.hpp>
#include "spdlog/sinks/stdout_color_sinks.h"
using namespace kami;
using namespace std;
int main(int argc, char **argv) {
string ident = "unit-kami-agentid";
CLI::App app{ident};
auto console = spdlog::stdout_color_st(ident);
bool debugFlag;
app.add_option("-d,--debug", debugFlag, "A help string");
CLI11_PARSE(app, argc, argv);
if (debugFlag == true)
console->set_level(spdlog::level::debug);
console->debug("Compiled with Kami/{}.{}.{}", KAMI_VERSION_MAJOR, KAMI_VERSION_MINOR, KAMI_VERSION_PATCH);
AgentID testAgentID;
console->debug("Successfully created AgentID with ID {}", testAgentID.toString());
}