Add filter complete results to manage
This commit is contained in:
parent
4de5cb4c6c
commit
edb957d22e
@ -40,7 +40,7 @@ if (CODE_COVERAGE)
|
||||
enable_testing()
|
||||
include(CodeCoverage)
|
||||
MESSAGE("Code coverage enabled")
|
||||
set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -O0")
|
||||
set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -O0 -g")
|
||||
SET(GCC_COVERAGE_LINK_FLAGS " ${GCC_COVERAGE_LINK_FLAGS} -lgcov --coverage")
|
||||
endif (CODE_COVERAGE)
|
||||
|
||||
@ -73,8 +73,7 @@ file(GLOB Platform_SOURCES CONFIGURE_DEPENDS ${BayesNet_SOURCE_DIR}/src/Platform
|
||||
|
||||
if (ENABLE_TESTING)
|
||||
MESSAGE("Testing enabled")
|
||||
add_git_submodule("lib/catch2")
|
||||
|
||||
add_git_submodule("lib/catch2")
|
||||
include(CTest)
|
||||
add_subdirectory(tests)
|
||||
endif (ENABLE_TESTING)
|
||||
|
2
Makefile
2
Makefile
@ -40,7 +40,7 @@ debug: ## Build a debug version of the project
|
||||
@if [ -d ./build ]; then rm -rf ./build; fi
|
||||
@mkdir build;
|
||||
cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -D ENABLE_TESTING=ON -D CODE_COVERAGE=ON; \
|
||||
cmake --build build -j 32;
|
||||
cmake --build build -t main -t BayesNetSample -t manage -t list unit_tests -j 32;
|
||||
@echo ">>> Done";
|
||||
|
||||
release: ## Build a Release version of the project
|
||||
|
@ -23,6 +23,7 @@ namespace platform {
|
||||
title = data["title"];
|
||||
duration = data["duration"];
|
||||
model = data["model"];
|
||||
complete = data["results"].size() > 1;
|
||||
}
|
||||
json Result::load() const
|
||||
{
|
||||
@ -41,7 +42,7 @@ namespace platform {
|
||||
if (filename.find(".json") != string::npos && filename.find("results_") == 0) {
|
||||
auto result = Result(path, filename);
|
||||
bool addResult = true;
|
||||
if (model != "any" && result.getModel() != model || scoreName != "any" && scoreName != result.getScoreName())
|
||||
if (model != "any" && result.getModel() != model || scoreName != "any" && scoreName != result.getScoreName() || complete && !result.isComplete())
|
||||
addResult = false;
|
||||
if (addResult)
|
||||
files.push_back(result);
|
||||
@ -55,6 +56,8 @@ namespace platform {
|
||||
oss << setw(12) << left << model << " ";
|
||||
oss << setw(11) << left << scoreName << " ";
|
||||
oss << right << setw(11) << setprecision(7) << fixed << score << " ";
|
||||
auto completeString = isComplete() ? "C" : "P";
|
||||
oss << setw(1) << " " << completeString << " ";
|
||||
oss << setw(9) << setprecision(3) << fixed << duration << " ";
|
||||
oss << setw(50) << left << title << " ";
|
||||
return oss.str();
|
||||
@ -64,8 +67,8 @@ namespace platform {
|
||||
cout << Colors::GREEN() << "Results found: " << files.size() << endl;
|
||||
cout << "-------------------" << endl;
|
||||
auto i = 0;
|
||||
cout << " # Date Model Score Name Score Duration Title" << endl;
|
||||
cout << "=== ========== ============ =========== =========== ========= =============================================================" << endl;
|
||||
cout << " # Date Model Score Name Score C/P Duration Title" << endl;
|
||||
cout << "=== ========== ============ =========== =========== === ========= =============================================================" << endl;
|
||||
bool odd = true;
|
||||
for (const auto& result : files) {
|
||||
auto color = odd ? Colors::BLUE() : Colors::CYAN();
|
||||
|
@ -20,6 +20,7 @@ namespace platform {
|
||||
double getDuration() const { return duration; };
|
||||
string getModel() const { return model; };
|
||||
string getScoreName() const { return scoreName; };
|
||||
bool isComplete() const { return complete; };
|
||||
private:
|
||||
string path;
|
||||
string filename;
|
||||
@ -29,16 +30,18 @@ namespace platform {
|
||||
double duration;
|
||||
string model;
|
||||
string scoreName;
|
||||
bool complete;
|
||||
};
|
||||
class Results {
|
||||
public:
|
||||
Results(const string& path, const int max, const string& model, const string& score) : path(path), max(max), model(model), scoreName(score) { load(); };
|
||||
Results(const string& path, const int max, const string& model, const string& score, bool complete) : path(path), max(max), model(model), scoreName(score), complete(complete) { load(); };
|
||||
void manage();
|
||||
private:
|
||||
string path;
|
||||
int max;
|
||||
string model;
|
||||
string scoreName;
|
||||
bool complete;
|
||||
vector<Result> files;
|
||||
void load(); // Loads the list of results
|
||||
void show() const;
|
||||
|
@ -12,6 +12,7 @@ argparse::ArgumentParser manageArguments(int argc, char** argv)
|
||||
program.add_argument("-n", "--number").default_value(0).help("Number of results to show (0 = all)").scan<'i', int>();
|
||||
program.add_argument("-m", "--model").default_value("any").help("Filter results of the selected model)");
|
||||
program.add_argument("-s", "--score").default_value("any").help("Filter results of the score name supplied");
|
||||
program.add_argument("--complete").help("Show only results with all datasets").default_value(false).implicit_value(true);
|
||||
try {
|
||||
program.parse_args(argc, argv);
|
||||
auto number = program.get<int>("number");
|
||||
@ -20,6 +21,7 @@ argparse::ArgumentParser manageArguments(int argc, char** argv)
|
||||
}
|
||||
auto model = program.get<string>("model");
|
||||
auto score = program.get<string>("score");
|
||||
auto complete = program.get<bool>("complete");
|
||||
}
|
||||
catch (const exception& err) {
|
||||
cerr << err.what() << endl;
|
||||
@ -35,7 +37,8 @@ int main(int argc, char** argv)
|
||||
auto number = program.get<int>("number");
|
||||
auto model = program.get<string>("model");
|
||||
auto score = program.get<string>("score");
|
||||
auto results = platform::Results(platform::Paths::results(), number, model, score);
|
||||
auto complete = program.get<bool>("complete");
|
||||
auto results = platform::Results(platform::Paths::results(), number, model, score, complete);
|
||||
results.manage();
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user