diff options
| author | Claudius Holeksa <mail@keldu.de> | 2023-05-09 17:58:30 +0200 |
|---|---|---|
| committer | Claudius Holeksa <mail@keldu.de> | 2023-05-09 17:58:30 +0200 |
| commit | 2e8ee05aee8c03aaf1f991b8403a6980eeb1f4fc (patch) | |
| tree | 14aabbe752f00f218eb3a01df2e1f155fde3e409 /src/keltest/test.cpp | |
| parent | a178b64a681dc0a381835ab567853c132753902f (diff) | |
| download | mini-test-2e8ee05aee8c03aaf1f991b8403a6980eeb1f4fc.tar.gz | |
Fixed build and install issues. Confirmed install and build on nix
Diffstat (limited to 'src/keltest/test.cpp')
| -rw-r--r-- | src/keltest/test.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/keltest/test.cpp b/src/keltest/test.cpp index 1178b20..d8c5886 100644 --- a/src/keltest/test.cpp +++ b/src/keltest/test.cpp @@ -3,6 +3,7 @@ #include <chrono> #include <iostream> #include <string_view> +#include <variant> namespace keltest { @@ -12,7 +13,7 @@ constexpr bool always_false = false; test_case* test_case_head = nullptr; test_case** test_case_tail = &test_case_head; -test_case::test_case(std::string file_, uint32_t line_, std::string& description_): +test_case::test_case(std::string file_, uint32_t line_, std::string description_): file{std::move(file_)}, line{line_}, description{std::move(description_)}, @@ -87,8 +88,8 @@ public: size_t failed_count = 0; for(test_case* test = test_case_head; test != nullptr; test = test->next){ - std::string name = test->fil + std::string{":"} + std::to_string(test->line) + std::string{":"} + test->description; - write(colour::blue, "[ TEST ] ", name); + std::string name = test->file + std::string{":"} + std::to_string(test->line) + std::string{":"} + test->description; + write(colour::blue{}, "[ TEST ] ", name); bool failed = true; std::string fail_message; @@ -110,17 +111,17 @@ public: std::string message = name + std::string{" ("} + std::to_string(runtime_duration.count()) + std::string{" µs) "}; if( failed ){ - write(colour::red, "[ FAIL ] ", message + std::string{" "} + fail_message); + write(colour::red{}, "[ FAIL ] ", message + std::string{" "} + fail_message); ++failed_count; }else{ - write(colour::green, "[ PASS ] ", message); + write(colour::green{}, "[ PASS ] ", message); ++passed_count; } } - if( passed_count > 0 ) write(colour::green, std::to_string(passed_count) + std::string{" test(s) passed"}, ""); + if( passed_count > 0 ) write(colour::green{}, std::to_string(passed_count) + std::string{" test(s) passed"}, ""); - if( failed_count > 0 ) write(colour::red, std::to_string(failed_count) + std::string{" test(s) failed"}, ""); + if( failed_count > 0 ) write(colour::red{}, std::to_string(failed_count) + std::string{" test(s) failed"}, ""); return failed_count > 0 ? -1 : 0; } |
