From 3bf43ef62a4e47ae239364ce72b603befcd11fe2 Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Mon, 24 Apr 2023 02:13:10 -0700 Subject: [PATCH] Configures for bazel build and test. --- .gitignore | 4 + WORKSPACE | 16 ++ sbf-cpp/Abilities_test.cpp | 8 + sbf-cpp/Archetypes_test.cpp | 8 + sbf-cpp/Attributes_test.cpp | 9 + sbf-cpp/BUILD | 306 ++++++++++++++++++++++++++++++++++ sbf-cpp/Backgrounds_test.cpp | 9 + sbf-cpp/Character_test.cpp | 11 ++ sbf-cpp/Clans_test.cpp | 9 + sbf-cpp/Colors_test.cpp | 13 +- sbf-cpp/Derangements_test.cpp | 9 + sbf-cpp/Disciplines_test.cpp | 9 + sbf-cpp/Freebies_test.cpp | 9 + sbf-cpp/Genders_test.cpp | 9 + sbf-cpp/Menus_test.cpp | 9 + sbf-cpp/Random.cpp | 2 +- sbf-cpp/Random_test.cpp | 9 + sbf-cpp/Ranks_test.cpp | 9 + sbf-cpp/Utils.cpp | 4 +- sbf-cpp/Utils_test.cpp | 9 + sbf-cpp/Virtues_test.cpp | 9 + sbf-cpp/main_test.cpp | 12 +- sbf-cpp/sbf_test.cpp | 9 + sbf-cpp/test.cpp | 37 +++- sbf-cpp/test.h | 5 + 25 files changed, 531 insertions(+), 12 deletions(-) create mode 100644 WORKSPACE create mode 100644 sbf-cpp/BUILD diff --git a/.gitignore b/.gitignore index a506c38..3a90252 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +/bazel-bin +/bazel-out +/bazel-sbf2000 +/bazel-testlogs /dos/qb45 /dos/qbasic11 /tmp diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..ac3961e --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,16 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +# Hedron's Compile Commands Extractor for Bazel +# https://github.com/hedronvision/bazel-compile-commands-extractor +# To update config run `bazel run @hedron_compile_commands//:refresh_all` +http_archive( + name = "hedron_compile_commands", + sha256 = "99bc3106eb6ce5ffab3c31de8501d4d628de5f1acd74b8b563a876bd39a2e32f", + # Replace the commit hash in both places (below) with the latest, rather than using the stale one here. + strip_prefix = "bazel-compile-commands-extractor-b33a4b05c2287372c8e932c55ff4d3a37e6761ed", + url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/b33a4b05c2287372c8e932c55ff4d3a37e6761ed.tar.gz", +) + +load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup") + +hedron_compile_commands_setup() diff --git a/sbf-cpp/Abilities_test.cpp b/sbf-cpp/Abilities_test.cpp index 84f0d7e..b723866 100644 --- a/sbf-cpp/Abilities_test.cpp +++ b/sbf-cpp/Abilities_test.cpp @@ -50,6 +50,14 @@ TestResults main_test_Abilities(int argc, char* argv[]) { return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Abilities(argc, argv); + + PrintResults(cout, results); + + return results.failed() + results.errors(); +} + namespace Test::Abilities { TestResults test_AbilityType_operator_extract() { return execute_suite(make_test_suite( diff --git a/sbf-cpp/Archetypes_test.cpp b/sbf-cpp/Archetypes_test.cpp index a3c167e..7f80d69 100644 --- a/sbf-cpp/Archetypes_test.cpp +++ b/sbf-cpp/Archetypes_test.cpp @@ -24,6 +24,14 @@ TestResults main_test_Archetypes(int argc, char* argv[]) { return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Archetypes(argc, argv); + + PrintResults(cout, results); + + return results.failed() + results.errors(); +} + namespace Test::Archetypes { TestResults test_GetArchetypeLabel() { return execute_suite(make_test_suite( diff --git a/sbf-cpp/Attributes_test.cpp b/sbf-cpp/Attributes_test.cpp index 514701b..e8682bd 100644 --- a/sbf-cpp/Attributes_test.cpp +++ b/sbf-cpp/Attributes_test.cpp @@ -1,5 +1,6 @@ #include "Attributes.h" +#include #include #include #include @@ -53,6 +54,14 @@ TestResults main_test_Attributes(int argc, char* argv[]) { return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Attributes(argc, argv); + + PrintResults(cout, results); + + return results.failed() + results.errors(); +} + namespace Test::Attributes { TestResults test_GetAttributeGroupLabel() { return execute_suite( diff --git a/sbf-cpp/BUILD b/sbf-cpp/BUILD new file mode 100644 index 0000000..ee79c23 --- /dev/null +++ b/sbf-cpp/BUILD @@ -0,0 +1,306 @@ +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") + +cc_library( + name = "tinytest", + srcs = ["test.cpp"], + hdrs = ["test.h"], +) + +cc_library( + name = "abilities", + srcs = ["Abilities.cpp"], + hdrs = ["Abilities.h"], +) + +cc_test( + name = "abilities_test", + srcs = ["Abilities_test.cpp"], + deps = [ + ":abilities", + ":tinytest", + ], +) + +cc_library( + name = "archetypes", + srcs = ["Archetypes.cpp"], + hdrs = ["Archetypes.h"], +) + +cc_test( + name = "archetypes_test", + srcs = ["Archetypes_test.cpp"], + deps = [ + ":archetypes", + ":tinytest", + ], +) + +cc_library( + name = "attributes", + srcs = ["Attributes.cpp"], + hdrs = ["Attributes.h"], +) + +cc_test( + name = "attributes_test", + srcs = ["Attributes_test.cpp"], + deps = [ + ":attributes", + ":tinytest", + ], +) + +cc_library( + name = "backgrounds", + srcs = ["Backgrounds.cpp"], + hdrs = ["Backgrounds.h"], +) + +cc_test( + name = "backgrounds_test", + srcs = ["Backgrounds_test.cpp"], + deps = [ + ":backgrounds", + ":tinytest", + ], +) + +cc_library( + name = "character", + srcs = ["Character.cpp"], + hdrs = ["Character.h"], + deps = [ + ":abilities", + ":attributes", + ":backgrounds", + ":clans", + ":colors", + ":derangements", + ":disciplines", + ":ranks", + ":virtues", + ], +) + +cc_test( + name = "character_test", + srcs = ["Character_test.cpp"], + deps = [ + ":character", + ":tinytest", + ], +) + +cc_library( + name = "clans", + srcs = ["Clans.cpp"], + hdrs = ["Clans.h"], +) + +cc_test( + name = "clans_test", + srcs = ["Clans_test.cpp"], + deps = [ + ":clans", + ":tinytest", + ], +) + +cc_library( + name = "colors", + srcs = ["Colors.cpp"], + hdrs = ["Colors.h"], +) + +cc_test( + name = "colors_test", + srcs = ["Colors_test.cpp"], + deps = [ + ":colors", + ":tinytest", + ], +) + +cc_library( + name = "derangements", + srcs = ["Derangements.cpp"], + hdrs = ["Derangements.h"], + deps = [":colors"], +) + +cc_test( + name = "derangements_test", + srcs = ["Derangements_test.cpp"], + deps = [ + ":derangements", + ":tinytest", + ], +) + +cc_library( + name = "disciplines", + srcs = ["Disciplines.cpp"], + hdrs = ["Disciplines.h"], +) + +cc_test( + name = "disciplines_test", + srcs = ["Disciplines_test.cpp"], + deps = [ + ":disciplines", + ":tinytest", + ], +) + +cc_library( + name = "freebies", + srcs = ["Freebies.cpp"], + hdrs = ["Freebies.h"], +) + +cc_test( + name = "freebies_test", + srcs = ["Freebies_test.cpp"], + deps = [ + ":freebies", + ":tinytest", + ], +) + +cc_library( + name = "genders", + srcs = ["Genders.cpp"], + hdrs = ["Genders.h"], +) + +cc_test( + name = "genders_test", + srcs = ["Genders_test.cpp"], + deps = [ + ":genders", + ":tinytest", + ], +) + +# cc_library( +# name = "main", +# srcs = ["main.cpp"], +# hdrs = ["main.h"], +# ) + +# cc_test( +# name = "main_test", +# srcs = ["main_test.cpp"], +# deps = [ +# ":main", +# ":tinytest", +# ], +# ) + +cc_library( + name = "menus", + srcs = ["Menus.cpp"], + hdrs = ["Menus.h"], + deps = [ + ":colors", + ":random", + ":utils", + ], +) + +cc_test( + name = "menus_test", + srcs = ["Menus_test.cpp"], + deps = [ + ":menus", + ":tinytest", + ], +) + +cc_library( + name = "random", + srcs = ["Random.cpp"], + hdrs = ["Random.h"], +) + +cc_test( + name = "random_test", + srcs = ["Random_test.cpp"], + deps = [ + ":random", + ":tinytest", + ], +) + +cc_library( + name = "ranks", + srcs = ["Ranks.cpp"], + hdrs = ["Ranks.h"], +) + +cc_test( + name = "ranks_test", + srcs = ["Ranks_test.cpp"], + deps = [ + ":ranks", + ":tinytest", + ], +) + +cc_binary( + name = "sbf", + srcs = [ + "sbf.cpp", + "sbf.h", + ], + deps = [ + ":abilities", + ":archetypes", + ":attributes", + ":backgrounds", + ":character", + ":clans", + ":genders", + ":menus", + ], +) + +# cc_test( +# name = "sbf_test", +# srcs = ["sbf_test.cpp"], +# deps = [ +# ":sbf", +# ":tinytest", +# ], +# ) + +cc_library( + name = "utils", + srcs = ["Utils.cpp"], + hdrs = ["Utils.h"], +) + +cc_test( + name = "utils_test", + srcs = ["Utils_test.cpp"], + deps = [ + ":tinytest", + ":utils", + ], +) + +cc_library( + name = "virtues", + srcs = ["Virtues.cpp"], + hdrs = ["Virtues.h"], +) + +cc_test( + name = "virtues_test", + srcs = ["Virtues_test.cpp"], + deps = [ + ":tinytest", + ":virtues", + ], +) diff --git a/sbf-cpp/Backgrounds_test.cpp b/sbf-cpp/Backgrounds_test.cpp index 396cf09..c2e15c9 100644 --- a/sbf-cpp/Backgrounds_test.cpp +++ b/sbf-cpp/Backgrounds_test.cpp @@ -1,5 +1,6 @@ #include "Backgrounds.h" +#include #include #include #include @@ -27,6 +28,14 @@ TestResults main_test_Backgrounds(int argc, char* argv[]) { return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Backgrounds(argc, argv); + + PrintResults(cout, results); + + return results.failed() + results.errors(); +} + namespace Test::Backgrounds { TestResults test_GetBackgroundLabel() { return execute_suite(make_test_suite( diff --git a/sbf-cpp/Character_test.cpp b/sbf-cpp/Character_test.cpp index 790a183..5843d2e 100644 --- a/sbf-cpp/Character_test.cpp +++ b/sbf-cpp/Character_test.cpp @@ -1,11 +1,22 @@ #include "Character.h" +#include + #include "test.h" using namespace SBF; using namespace Test; +using namespace std; TestResults main_test_Character(int argc, char* argv[]) { TestResults results; + PrintResults(cout, results); + return results; } + +int main(int argc, char* argv[]) { + TestResults results = main_test_Character(argc, argv); + + return results.failed() + results.errors(); +} diff --git a/sbf-cpp/Clans_test.cpp b/sbf-cpp/Clans_test.cpp index ab51a9e..32e75b7 100644 --- a/sbf-cpp/Clans_test.cpp +++ b/sbf-cpp/Clans_test.cpp @@ -1,5 +1,6 @@ #include "Clans.h" +#include #include #include #include @@ -24,9 +25,17 @@ TestResults main_test_Clans(int argc, char* argv[]) { results += test_GetClanLabel(); results += test_FillClanLabels(); + PrintResults(cout, results); + return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Clans(argc, argv); + + return results.failed() + results.errors(); +} + namespace Test::Clans { TestResults test_GetClanLabel() { return execute_suite(make_test_suite( diff --git a/sbf-cpp/Colors_test.cpp b/sbf-cpp/Colors_test.cpp index 84f6530..28cb857 100644 --- a/sbf-cpp/Colors_test.cpp +++ b/sbf-cpp/Colors_test.cpp @@ -1,5 +1,6 @@ #include "Colors.h" +#include #include #include #include @@ -51,6 +52,14 @@ TestResults main_test_Colors(int argc, char* argv[]) { return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Colors(argc, argv); + + PrintResults(cout, results); + + return results.failed() + results.errors(); +} + namespace Test::Colors { TestResults test_FillColors() { return execute_suite(make_test_suite( @@ -351,12 +360,12 @@ TestResults test_Colors() { TestResults test_TrueColorForeground() { // TODO: test_TrueColorForeground(); - return TestResults().fail("// TODO: test_TrueColorForeground"); + return TestResults().skip("// TODO: test_TrueColorForeground"); } TestResults test_TrueColorBackground() { // TODO: test_TrueColorBackground(); - return TestResults().fail("// TODO: test_TrueColorBackground"); + return TestResults().skip("// TODO: test_TrueColorBackground"); } string escape_string(const string& text, const string& pattern, const string& replace) { diff --git a/sbf-cpp/Derangements_test.cpp b/sbf-cpp/Derangements_test.cpp index 9a17eb0..25cee2f 100644 --- a/sbf-cpp/Derangements_test.cpp +++ b/sbf-cpp/Derangements_test.cpp @@ -1,5 +1,6 @@ #include "Derangements.h" +#include #include #include #include @@ -30,9 +31,17 @@ TestResults main_test_Derangements(int argc, char* argv[]) { results += test_GetDerangement(); results += test_FillDerangements(); + PrintResults(cout, results); + return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Derangements(argc, argv); + + return results.failed() + results.errors(); +} + namespace Test::Derangements { TestResults test_GetDerangement() { return execute_suite(make_test_suite( diff --git a/sbf-cpp/Disciplines_test.cpp b/sbf-cpp/Disciplines_test.cpp index 97b8b28..2349f6b 100644 --- a/sbf-cpp/Disciplines_test.cpp +++ b/sbf-cpp/Disciplines_test.cpp @@ -1,5 +1,6 @@ #include "Disciplines.h" +#include #include #include #include @@ -24,9 +25,17 @@ TestResults main_test_Disciplines(int argc, char* argv[]) { results += test_GetDisciplineLabel(); results += test_FillDisciplineLabels(); + PrintResults(cout, results); + return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Disciplines(argc, argv); + + return results.failed() + results.errors(); +} + namespace Test::Disciplines { TestResults test_GetDisciplineLabel() { return execute_suite(make_test_suite( diff --git a/sbf-cpp/Freebies_test.cpp b/sbf-cpp/Freebies_test.cpp index 87bcf6d..058d771 100644 --- a/sbf-cpp/Freebies_test.cpp +++ b/sbf-cpp/Freebies_test.cpp @@ -1,5 +1,6 @@ #include "Freebies.h" +#include #include #include #include @@ -30,9 +31,17 @@ TestResults main_test_Freebies(int argc, char* argv[]) { results += test_GetFreebie(); results += test_FillFreebies(); + PrintResults(cout, results); + return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Freebies(argc, argv); + + return results.failed() + results.errors(); +} + namespace Test::Freebies { TestResults test_FreebieType_operator_extract() { auto fnToTest = [](const FreebieType& freebie) -> string { diff --git a/sbf-cpp/Genders_test.cpp b/sbf-cpp/Genders_test.cpp index 7198d89..67fd05f 100644 --- a/sbf-cpp/Genders_test.cpp +++ b/sbf-cpp/Genders_test.cpp @@ -1,5 +1,6 @@ #include "Genders.h" +#include #include #include #include @@ -24,9 +25,17 @@ TestResults main_test_Genders(int argc, char* argv[]) { results += test_GetGenderLabel(); results += test_FillGenderLabels(); + PrintResults(cout, results); + return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Genders(argc, argv); + + return results.failed() + results.errors(); +} + namespace Test::Genders { TestResults test_GetGenderLabel() { return execute_suite(make_test_suite( diff --git a/sbf-cpp/Menus_test.cpp b/sbf-cpp/Menus_test.cpp index 1c80965..88f9165 100644 --- a/sbf-cpp/Menus_test.cpp +++ b/sbf-cpp/Menus_test.cpp @@ -1,5 +1,6 @@ #include "Menus.h" +#include #include #include #include @@ -51,9 +52,17 @@ TestResults main_test_Menus(int argc, char* argv[]) { results += test_GetTitleWithoutValue(); results += test_PrintWithMaybeColor(); + PrintResults(cout, results); + return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Menus(argc, argv); + + return results.failed() + results.errors(); +} + namespace Test::Menus { TestResults test_MenuItem_constructor() { return TestResults().skip("// TODO: test_MenuItem_constructor"); diff --git a/sbf-cpp/Random.cpp b/sbf-cpp/Random.cpp index bb9e339..cd482c6 100644 --- a/sbf-cpp/Random.cpp +++ b/sbf-cpp/Random.cpp @@ -1,4 +1,4 @@ -#include +#include "Random.h" #include diff --git a/sbf-cpp/Random_test.cpp b/sbf-cpp/Random_test.cpp index 771db1f..113bb08 100644 --- a/sbf-cpp/Random_test.cpp +++ b/sbf-cpp/Random_test.cpp @@ -1,5 +1,6 @@ #include "Random.h" +#include #include #include #include @@ -22,9 +23,17 @@ TestResults main_test_Random(int argc, char* argv[]) { results += test_something(); + PrintResults(cout, results); + return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Random(argc, argv); + + return results.failed() + results.errors(); +} + namespace Test::Random { TestResults test_something() { return TestResults().skip("SBF::Random::*"); diff --git a/sbf-cpp/Ranks_test.cpp b/sbf-cpp/Ranks_test.cpp index ac98609..78a5607 100644 --- a/sbf-cpp/Ranks_test.cpp +++ b/sbf-cpp/Ranks_test.cpp @@ -1,5 +1,6 @@ #include "Ranks.h" +#include #include #include #include @@ -30,9 +31,17 @@ TestResults main_test_Ranks(int argc, char* argv[]) { results += test_GetRank(); results += test_FillRanks(); + PrintResults(cout, results); + return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Ranks(argc, argv); + + return results.failed() + results.errors(); +} + namespace Test::Ranks { TestResults test_GetRank() { return execute_suite(make_test_suite( diff --git a/sbf-cpp/Utils.cpp b/sbf-cpp/Utils.cpp index 9091459..94da1c3 100644 --- a/sbf-cpp/Utils.cpp +++ b/sbf-cpp/Utils.cpp @@ -7,15 +7,13 @@ #include #include -#include "test.h" - using namespace SBF; -using namespace Test; namespace SBF { namespace { using std::string; using std::to_string; +using std::vector; } // End namespace vector word_wrap(const string& text, const size_t max_width) { diff --git a/sbf-cpp/Utils_test.cpp b/sbf-cpp/Utils_test.cpp index 0449978..acf73c9 100644 --- a/sbf-cpp/Utils_test.cpp +++ b/sbf-cpp/Utils_test.cpp @@ -1,5 +1,6 @@ #include "Utils.h" +#include #include #include #include @@ -41,9 +42,17 @@ TestResults main_test_Utils(int argc, char* argv[]) { results += test_string_dollar(); results += test_word_wrap(); + PrintResults(cout, results); + return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Utils(argc, argv); + + return results.failed() + results.errors(); +} + namespace Test::Utils { TestResults test_get_index_of() { string long_text = diff --git a/sbf-cpp/Virtues_test.cpp b/sbf-cpp/Virtues_test.cpp index b9a9845..e991659 100644 --- a/sbf-cpp/Virtues_test.cpp +++ b/sbf-cpp/Virtues_test.cpp @@ -1,5 +1,6 @@ #include "Virtues.h" +#include #include #include #include @@ -23,9 +24,17 @@ TestResults main_test_Virtues(int argc, char* argv[]) { results += test_GetVirtueLabel(); results += test_FillVirtueLabels(); + PrintResults(cout, results); + return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Virtues(argc, argv); + + return results.failed() + results.errors(); +} + namespace Test::Virtues { TestResults test_GetVirtueLabel() { return execute_suite(make_test_suite( diff --git a/sbf-cpp/main_test.cpp b/sbf-cpp/main_test.cpp index 2134e92..82d6f9c 100644 --- a/sbf-cpp/main_test.cpp +++ b/sbf-cpp/main_test.cpp @@ -1,10 +1,10 @@ -#include "Menus.h" - +#include #include #include #include #include +#include "Menus.h" #include "test.h" using namespace SBF; @@ -20,4 +20,12 @@ TestResults main_test_Menus(int argc, char* argv[]) { return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_Menus(argc, argv); + + PrintResults(cout, results); + + return results.failed() + results.errors(); +} + namespace Test::Menus {} // namespace Test::Menus diff --git a/sbf-cpp/sbf_test.cpp b/sbf-cpp/sbf_test.cpp index 694e907..f04683b 100644 --- a/sbf-cpp/sbf_test.cpp +++ b/sbf-cpp/sbf_test.cpp @@ -1,5 +1,6 @@ #include "sbf.h" +#include #include #include #include @@ -20,4 +21,12 @@ TestResults main_test_sbf(int argc, char* argv[]) { return results; } +int main(int argc, char* argv[]) { + TestResults results = main_test_sbf(argc, argv); + + PrintResults(cout, results); + + return results.failed() + results.errors(); +} + namespace Test::sbf {} // namespace Test::sbf diff --git a/sbf-cpp/test.cpp b/sbf-cpp/test.cpp index 23a4c46..59ef6d2 100644 --- a/sbf-cpp/test.cpp +++ b/sbf-cpp/test.cpp @@ -7,13 +7,13 @@ #include #include -// using namespace std; +namespace Test { +namespace { +using std::endl; using std::string; using std::vector; +} // End namespace -// using namespace Test; - -namespace Test { // Test lifecycle // suiteSetupFn(); - This is called to allocate any suite level resources. This is called once when the suite begins. // These functions may be called in parallel but execution will not proceed past this block until they have all @@ -247,4 +247,33 @@ TestResults& TestResults::operator+=(const TestResults& other) { total_ += other.total_; return *this; } + +void PrintResults(std::ostream& os, TestResults results) { + auto skip_messages = results.skip_messages(); + if (skip_messages.size() > 0) { + os << "Skipped:" << endl; + for_each(skip_messages.begin(), skip_messages.end(), [&os](const string& message) { + os << "🚧Skipped: " << message << endl; + }); + } + auto failure_messages = results.failure_messages(); + if (failure_messages.size() > 0) { + os << "Failures:" << endl; + for_each(failure_messages.begin(), failure_messages.end(), [&os](const string& message) { + os << "❌FAILED: " << message << endl; + }); + } + auto error_messages = results.error_messages(); + if (error_messages.size() > 0) { + os << "Errors:" << endl; + for_each(error_messages.begin(), error_messages.end(), [&os](const string& message) { + os << "🔥ERROR: " << message << endl; + }); + } + os << "Total tests: " << results.total() << endl; + os << "Passed: " << results.passed() << " ✅" << endl; + os << "Failed: " << results.failed() << " ❌" << endl; + os << "Skipped: " << results.skipped() << " 🚧" << endl; + os << "Errors: " << results.errors() << " 🔥" << endl; +} } // End namespace Test diff --git a/sbf-cpp/test.h b/sbf-cpp/test.h index 8f599e1..626514e 100644 --- a/sbf-cpp/test.h +++ b/sbf-cpp/test.h @@ -486,6 +486,11 @@ MaybeTestConfigureFunction coalesce(MaybeTestConfigureFunction first, MaybeTestC return second; } } + +/// @brief Writes a friendly version of results to the provided stream. +/// @param os The stream to write to. +/// @param results The TestResults to write. +void PrintResults(std::ostream& os, TestResults results); } // End namespace Test // TODO: define operator<< for std::tuple.