From e0d627995a10822cc37b19e11af53337359e07f4 Mon Sep 17 00:00:00 2001 From: kazk Date: Sat, 23 Nov 2019 19:29:25 -0800 Subject: [PATCH 01/12] Add changes for Codewars See https://github.com/Codewars/codewars-runner-cli/pull/174 and https://github.com/Codewars/codewars-runner-cli/pull/210 --- igloo/CodewarsTestListener.h | 44 +++++++++++++++++++ igloo/core/contextregistry.h | 23 ++++++---- igloo/core/outputters/testresultsoutput.h | 10 +++++ igloo/core/testlistener.h | 4 +- igloo/core/testlisteneraggregator.h | 4 +- .../minimalprogresstestlistener.h | 2 +- tests/fakes/fake_test_listener.h | 2 +- 7 files changed, 74 insertions(+), 15 deletions(-) create mode 100644 igloo/CodewarsTestListener.h diff --git a/igloo/CodewarsTestListener.h b/igloo/CodewarsTestListener.h new file mode 100644 index 0000000..e06f101 --- /dev/null +++ b/igloo/CodewarsTestListener.h @@ -0,0 +1,44 @@ +#if !defined(IGLOO_CODEWARS_TEST_LISTENER) +#define IGLOO_CODEWARS_TEST_LISTENER + +#include + +namespace igloo { + +class CodewarsTestListener: public TestListener { +public: + virtual void TestRunStarting() {} + virtual void TestRunEnded(const TestResults&) {} + virtual void ContextRunStarting(const ContextBase& ctx) { + std::cout << "\n" << ctx.Name() << std::endl; + } + virtual void ContextRunEnded(const ContextBase&) { + std::cout << "\n" << std::endl; + } + virtual void SpecRunStarting(const ContextBase& ctx, const std::string& specName) { + std::cout << "\n" << specName << std::endl; + } + virtual void SpecSucceeded(const ContextBase&, const std::string& specName) { + std::cout << "\n" << "Test Passed" << std::endl << "\n" << std::endl; + } + virtual void SpecFailed(const ContextBase&, const std::string& specName, const FailedTestResult& result) { + std::cout << "\n" << format(result.GetErrorMessage()) << std::endl << "\n" << std::endl; + } + +private: + std::string format(const std::string &str) { + std::string new_line = "\n"; + std::string line_feed = "<:LF:>"; + std::string new_string = str; + size_t start_pos = 0; + while ((start_pos = new_string.find(new_line, start_pos)) != std::string::npos) { + new_string.replace(start_pos, new_line.length(), line_feed); + start_pos += line_feed.length(); + } + return new_string; + } +}; + +} + +#endif diff --git a/igloo/core/contextregistry.h b/igloo/core/contextregistry.h index c1fb1ed..6c40b22 100644 --- a/igloo/core/contextregistry.h +++ b/igloo/core/contextregistry.h @@ -37,12 +37,12 @@ namespace igloo { struct SpecInfo { SpecPtr spec_ptr; + std::string name; bool skip; bool only; }; - typedef std::pair NamedSpec; - typedef std::map Specs; + typedef std::list Specs; public: // @@ -55,8 +55,9 @@ namespace igloo { SpecInfo spec_info; spec_info.spec_ptr = spec; spec_info.skip = skip; + spec_info.name = name; spec_info.only = only; - GetSpecs().insert(std::make_pair(name, spec_info)); + GetSpecs().push_back(spec_info); } static void ClearRegisteredSpecs() @@ -88,8 +89,8 @@ namespace igloo { typename Specs::const_iterator it; for (it = specs.begin(); it != specs.end(); it++) { - const std::string& specName = (*it).first; - SpecInfo spec_info = (*it).second; + SpecInfo spec_info = *it; + const std::string& specName = spec_info.name; ContextToCreate context; context.SetName(contextName); @@ -104,7 +105,11 @@ namespace igloo { } else { - testListener.SpecFailed(context, specName); + for(auto& result:results.FailedTests()) { + if(result.GetSpecName() == specName) { + testListener.SpecFailed(context, specName, result); + } + } } } } @@ -174,14 +179,14 @@ namespace igloo { return specs; } - static bool is_spec_not_marked_as_only(const NamedSpec& spec) + static bool is_spec_not_marked_as_only(const SpecInfo& spec) { return !is_spec_marked_as_only(spec); } - static bool is_spec_marked_as_only(const NamedSpec& spec) + static bool is_spec_marked_as_only(const SpecInfo& spec) { - return spec.second.only; + return spec.only; } static void GetSpecsMarkedAsOnly(Specs& specs) diff --git a/igloo/core/outputters/testresultsoutput.h b/igloo/core/outputters/testresultsoutput.h index 3996ecb..b66a47e 100644 --- a/igloo/core/outputters/testresultsoutput.h +++ b/igloo/core/outputters/testresultsoutput.h @@ -20,6 +20,16 @@ namespace igloo { private: TestResultsOutput& operator=(const TestResultsOutput&) { return *this; } }; + + class NullTestResultsOutput : public TestResultsOutput + { + public: + NullTestResultsOutput(std::ostream& outstream = std::cout) : TestResultsOutput(outstream) {} + + void PrintResult(const TestResults&) const + { + } + }; } #endif diff --git a/igloo/core/testlistener.h b/igloo/core/testlistener.h index 5b65c77..3baef63 100644 --- a/igloo/core/testlistener.h +++ b/igloo/core/testlistener.h @@ -20,7 +20,7 @@ namespace igloo { virtual void ContextRunEnded(const ContextBase& context) = 0; virtual void SpecRunStarting(const ContextBase& context, const std::string& specName) = 0; virtual void SpecSucceeded(const ContextBase& context, const std::string& specName) = 0; - virtual void SpecFailed(const ContextBase& context, const std::string& specName) = 0; + virtual void SpecFailed(const ContextBase& context, const std::string& specName, const FailedTestResult& result) = 0; }; class NullTestListener : public TestListener @@ -32,7 +32,7 @@ namespace igloo { virtual void ContextRunEnded(const ContextBase&) {} virtual void SpecRunStarting(const ContextBase&, const std::string&) {} virtual void SpecSucceeded(const ContextBase&, const std::string&) {} - virtual void SpecFailed(const ContextBase&, const std::string&) {} + virtual void SpecFailed(const ContextBase&, const std::string&, const FailedTestResult&) {} }; } diff --git a/igloo/core/testlisteneraggregator.h b/igloo/core/testlisteneraggregator.h index c90f74f..c4da622 100644 --- a/igloo/core/testlisteneraggregator.h +++ b/igloo/core/testlisteneraggregator.h @@ -64,11 +64,11 @@ namespace igloo { } } - void SpecFailed(const ContextBase& context, const std::string& specName) + void SpecFailed(const ContextBase& context, const std::string& specName, const FailedTestResult& result) { for(TestListeners::const_iterator it = listeners_.begin(); it != listeners_.end(); it++) { - (*it)->SpecFailed(context, specName); + (*it)->SpecFailed(context, specName, result); } } diff --git a/igloo/core/testlisteners/minimalprogresstestlistener.h b/igloo/core/testlisteners/minimalprogresstestlistener.h index 467c197..b955eab 100644 --- a/igloo/core/testlisteners/minimalprogresstestlistener.h +++ b/igloo/core/testlisteners/minimalprogresstestlistener.h @@ -26,7 +26,7 @@ namespace igloo { std::cout << "."; } - virtual void SpecFailed(const ContextBase& , const std::string& ) + virtual void SpecFailed(const ContextBase& , const std::string&, const FailedTestResult& ) { std::cout << "F"; } diff --git a/tests/fakes/fake_test_listener.h b/tests/fakes/fake_test_listener.h index fd4a882..74b196b 100644 --- a/tests/fakes/fake_test_listener.h +++ b/tests/fakes/fake_test_listener.h @@ -54,7 +54,7 @@ namespace igloo { namespace fakes { callLog += stm.str(); } - void SpecFailed(const ContextBase& context, const std::string& name) + void SpecFailed(const ContextBase& context, const std::string& name, const FailedTestResult&) { std::stringstream stm; stm << "SpecFailed called for context '" << context.Name() << "' and spec '" << name << "'" << std::endl; From 81fbfb31c8c76c3ed8f225db398e6f04c0c00691 Mon Sep 17 00:00:00 2001 From: kazk Date: Sat, 23 Nov 2019 19:48:58 -0800 Subject: [PATCH 02/12] Replace std::auto_ptr with std::unique_ptr --- igloo/core/contextprovider.h | 4 ++-- igloo/core/testrunner.h | 12 ++++++------ tests/coloredconsoletestresultsoutput_tests.cpp | 4 ++-- tests/defaulttestresultsoutput_tests.cpp | 4 ++-- tests/running_subsets_of_tests.cpp | 4 ++-- tests/testlistener_tests.cpp | 4 ++-- tests/visualstudiotestresultsoutput_tests.cpp | 4 ++-- tests/xunittestresultsoutput_tests.cpp | 4 ++-- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/igloo/core/contextprovider.h b/igloo/core/contextprovider.h index 9161e55..621af9f 100644 --- a/igloo/core/contextprovider.h +++ b/igloo/core/contextprovider.h @@ -87,7 +87,7 @@ namespace igloo { { if(m_outerContext.get() == 0) { - m_outerContext = std::auto_ptr(CreateIglooContext()); + m_outerContext = std::unique_ptr(CreateIglooContext()); } return *(m_outerContext.get()); } @@ -111,7 +111,7 @@ namespace igloo { return new ContextType(); } - std::auto_ptr m_outerContext; + std::unique_ptr m_outerContext; }; // diff --git a/igloo/core/testrunner.h b/igloo/core/testrunner.h index a99e134..12de11f 100644 --- a/igloo/core/testrunner.h +++ b/igloo/core/testrunner.h @@ -44,25 +44,25 @@ namespace igloo { return 0; } - std::auto_ptr output; + std::unique_ptr output; if(c::has_option("output", opt)) { std::string val = c::option_value("output", opt); if(val == "vs") { - output = std::auto_ptr(new VisualStudioResultsOutput()); + output = std::unique_ptr(new VisualStudioResultsOutput()); } else if(val == "color") { - output = std::auto_ptr(new ColoredConsoleTestResultsOutput()); + output = std::unique_ptr(new ColoredConsoleTestResultsOutput()); } else if(val == "xunit") { - output = std::auto_ptr(new XUnitResultsOutput()); + output = std::unique_ptr(new XUnitResultsOutput()); } else if(val == "default") { - output = std::auto_ptr(new DefaultTestResultsOutput()); + output = std::unique_ptr(new DefaultTestResultsOutput()); } else { @@ -72,7 +72,7 @@ namespace igloo { } else { - output = std::auto_ptr(new DefaultTestResultsOutput()); + output = std::unique_ptr(new DefaultTestResultsOutput()); } diff --git a/tests/coloredconsoletestresultsoutput_tests.cpp b/tests/coloredconsoletestresultsoutput_tests.cpp index faa08a6..783132a 100644 --- a/tests/coloredconsoletestresultsoutput_tests.cpp +++ b/tests/coloredconsoletestresultsoutput_tests.cpp @@ -10,13 +10,13 @@ using namespace igloo; Context(ColoredConsoleTestResultsOutput_EmptyTestRun) { - std::auto_ptr output; + std::unique_ptr output; std::stringstream resulting_stream; TestResults results; void SetUp() { - output = std::auto_ptr(new ColoredConsoleTestResultsOutput(resulting_stream)); + output = std::unique_ptr(new ColoredConsoleTestResultsOutput(resulting_stream)); } Spec(OutputsASummaryLineWithNoTests) diff --git a/tests/defaulttestresultsoutput_tests.cpp b/tests/defaulttestresultsoutput_tests.cpp index 0b81037..7e11b16 100644 --- a/tests/defaulttestresultsoutput_tests.cpp +++ b/tests/defaulttestresultsoutput_tests.cpp @@ -11,13 +11,13 @@ using namespace igloo; Context(DefaultTestResultsOutput_EmptyTestRun) { - std::auto_ptr output; + std::unique_ptr output; std::stringstream resulting_stream; TestResults results; void SetUp() { - output = std::auto_ptr(new DefaultTestResultsOutput(resulting_stream)); + output = std::unique_ptr(new DefaultTestResultsOutput(resulting_stream)); } Spec(OutputsASummaryLineWithNoTests) diff --git a/tests/running_subsets_of_tests.cpp b/tests/running_subsets_of_tests.cpp index d9ab3ed..7e61de9 100644 --- a/tests/running_subsets_of_tests.cpp +++ b/tests/running_subsets_of_tests.cpp @@ -22,7 +22,7 @@ Context(TestRunner_) { contextRunner_Only.MarkAsOnly(); contextRunner_Skip.MarkAsSkip(); - runner = std::auto_ptr(new TestRunner(nullOutput)); + runner = std::unique_ptr(new TestRunner(nullOutput)); } Context(no_only_specified) @@ -78,7 +78,7 @@ Context(TestRunner_) fakes::FakeContextRunner contextRunner; fakes::FakeContextRunner contextRunner_Only; fakes::FakeContextRunner contextRunner_Skip; - std::auto_ptr runner; + std::unique_ptr runner; fakes::NullTestResultsOutput nullOutput; TestRunner::ContextRunners contextRunners; }; diff --git a/tests/testlistener_tests.cpp b/tests/testlistener_tests.cpp index f151d8f..175cc28 100644 --- a/tests/testlistener_tests.cpp +++ b/tests/testlistener_tests.cpp @@ -14,7 +14,7 @@ using namespace igloo; Context(registering_a_test_listener) { fakes::NullTestResultsOutput nullOutput; - std::auto_ptr runner; + std::unique_ptr runner; TestRunner::ContextRunners contextRunners; fakes::FakeTestListener listener; fakes::FakeContextRunner contextRunner; @@ -23,7 +23,7 @@ Context(registering_a_test_listener) void SetUp() { - runner = std::auto_ptr(new TestRunner(nullOutput)); + runner = std::unique_ptr(new TestRunner(nullOutput)); runner->AddListener(&listener); contextRunners.push_back(&contextRunner); diff --git a/tests/visualstudiotestresultsoutput_tests.cpp b/tests/visualstudiotestresultsoutput_tests.cpp index 753f4ce..b41a647 100644 --- a/tests/visualstudiotestresultsoutput_tests.cpp +++ b/tests/visualstudiotestresultsoutput_tests.cpp @@ -11,13 +11,13 @@ using namespace igloo; Context(VisualStudioResultsOutput_EmptyTestRun) { - std::auto_ptr output; + std::unique_ptr output; std::stringstream resulting_stream; TestResults results; void SetUp() { - output = std::auto_ptr(new VisualStudioResultsOutput(resulting_stream)); + output = std::unique_ptr(new VisualStudioResultsOutput(resulting_stream)); } Spec(it_should_display_a_summary_line_with_no_tests_run) diff --git a/tests/xunittestresultsoutput_tests.cpp b/tests/xunittestresultsoutput_tests.cpp index f153c34..42611e0 100644 --- a/tests/xunittestresultsoutput_tests.cpp +++ b/tests/xunittestresultsoutput_tests.cpp @@ -11,13 +11,13 @@ using namespace igloo; Context(XUnitResultsOutput_EmptyTestRun) { - std::auto_ptr output; + std::unique_ptr output; std::stringstream resulting_stream; TestResults results; void SetUp() { - output = std::auto_ptr(new XUnitResultsOutput(resulting_stream)); + output = std::unique_ptr(new XUnitResultsOutput(resulting_stream)); } Spec(xml_output_should_content_testsuite_tag_with_tests_attr_set_to_0) From b1441c3256b94200e473c219372dce63d373db24 Mon Sep 17 00:00:00 2001 From: kazk Date: Sun, 24 Nov 2019 00:27:56 -0800 Subject: [PATCH 03/12] Fix deprecated-copy --- tests/bdd_tests.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/bdd_tests.cpp b/tests/bdd_tests.cpp index 4720aed..957f821 100644 --- a/tests/bdd_tests.cpp +++ b/tests/bdd_tests.cpp @@ -24,9 +24,6 @@ namespace igloo_example { Player(const char* name) : name_(name) {} const std::string name_; - - private: - Player& operator=(const Player&) { return *this; } }; inline bool operator==(const Player& lhs, const Player& rhs) From abac06d6df21065acc16fccf5fefd10493c3580a Mon Sep 17 00:00:00 2001 From: kazk Date: Sun, 24 Nov 2019 01:37:42 -0800 Subject: [PATCH 04/12] Update snowhouse to v3.1.1 Use `headers-only` branch. --- CMakeLists.txt | 11 +---------- igloo/external/snowhouse | 2 +- igloo/igloo_framework.h | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94888ac..b60b528 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,20 +23,11 @@ set_target_properties(igloo-tests PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "test set_target_properties(igloo-tests PROPERTIES COTIRE_ADD_UNIT_BUILD FALSE) # cotire(igloo-tests) -set(cfg "C++" CACHE STRING "Configuration for snowhouse") -add_subdirectory(igloo/external/snowhouse) - add_custom_command(TARGET igloo-tests POST_BUILD COMMAND igloo-tests WORKING_DIRECTORY ./bin) -add_custom_command(TARGET snowhouse-tests - POST_BUILD - COMMAND snowhouse-tests - WORKING_DIRECTORY ./bin) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/igloo DESTINATION include/ - FILES_MATCHING PATTERN "*.h" - PATTERN "igloo/external/snowhouse/example" EXCLUDE) + FILES_MATCHING PATTERN "*.h") diff --git a/igloo/external/snowhouse b/igloo/external/snowhouse index 34d4b6d..65a8e85 160000 --- a/igloo/external/snowhouse +++ b/igloo/external/snowhouse @@ -1 +1 @@ -Subproject commit 34d4b6df949356bcc0814f976f015ebee6ced9b3 +Subproject commit 65a8e85056cb8390710a3476f99b45812a7d77c5 diff --git a/igloo/igloo_framework.h b/igloo/igloo_framework.h index cc38ddc..777d993 100644 --- a/igloo/igloo_framework.h +++ b/igloo/igloo_framework.h @@ -19,7 +19,7 @@ #include #include -#include +#include namespace igloo { using namespace snowhouse; From e2c48a24755801fcba5669bc64bfac56e0ca9fae Mon Sep 17 00:00:00 2001 From: error256 Date: Sun, 20 Dec 2020 19:51:24 +0300 Subject: [PATCH 05/12] Fix duplicate entries in output --- igloo/core/contextregistry.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/igloo/core/contextregistry.h b/igloo/core/contextregistry.h index 6c40b22..92d8876 100644 --- a/igloo/core/contextregistry.h +++ b/igloo/core/contextregistry.h @@ -106,7 +106,7 @@ namespace igloo { else { for(auto& result:results.FailedTests()) { - if(result.GetSpecName() == specName) { + if(result.GetContextName() == contextName && result.GetSpecName() == specName) { testListener.SpecFailed(context, specName, result); } } From c4a8761bd1d9bf5c7908f91844f9100bae068e38 Mon Sep 17 00:00:00 2001 From: kazk Date: Fri, 24 Jul 2020 19:26:50 -0700 Subject: [PATCH 06/12] Update snowhouse to v5.0.0 - https://github.com/banditcpp/snowhouse/releases/tag/v4.0.0 - Improved display of booleans and strings - https://github.com/banditcpp/snowhouse/releases/tag/v5.0.0 --- igloo/core/testresultfactory.h | 2 +- igloo/external/snowhouse | 2 +- tests/igloo_self_test.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/igloo/core/testresultfactory.h b/igloo/core/testresultfactory.h index 624a11b..e2245c3 100644 --- a/igloo/core/testresultfactory.h +++ b/igloo/core/testresultfactory.h @@ -18,7 +18,7 @@ namespace igloo { FailedTestResult CreateFromException(const snowhouse::AssertionException& exception) const { - return FailedTestResult(m_contextName, m_specName, exception.GetMessage(), exception.GetFilename(), exception.GetLineNumber()); + return FailedTestResult(m_contextName, m_specName, exception.what(), exception.file(), exception.line()); } SucceededTestResult CreateSuccessful() const diff --git a/igloo/external/snowhouse b/igloo/external/snowhouse index 65a8e85..89ac7cd 160000 --- a/igloo/external/snowhouse +++ b/igloo/external/snowhouse @@ -1 +1 @@ -Subproject commit 65a8e85056cb8390710a3476f99b45812a7d77c5 +Subproject commit 89ac7cd0baf2c411671a3169b9364acb1e5cddfd diff --git a/tests/igloo_self_test.h b/tests/igloo_self_test.h index 8cc49b1..621626d 100644 --- a/tests/igloo_self_test.h +++ b/tests/igloo_self_test.h @@ -17,7 +17,7 @@ } \ catch(const AssertionException& exception_from_igloo_assertion) \ { \ - IGLOO_INTERNAL_expected_error = exception_from_igloo_assertion.GetMessage(); \ + IGLOO_INTERNAL_expected_error = exception_from_igloo_assertion.what(); \ } \ Assert::That(IGLOO_INTERNAL_expected_error, Is().Containing(expected_error_text)); From 3d445b8a53b5953e64dca648a5fcbc37436f8d76 Mon Sep 17 00:00:00 2001 From: kazk Date: Mon, 26 Apr 2021 00:41:23 -0700 Subject: [PATCH 07/12] Update snowhouse to add extra message https://github.com/codewars/snowhouse/pull/3 --- .gitmodules | 2 +- igloo/external/snowhouse | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 1a0d606..412ef74 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,4 @@ url = https://github.com/sakra/cotire.git [submodule "igloo/external/snowhouse"] path = igloo/external/snowhouse - url = https://github.com/joakimkarlsson/snowhouse.git + url = https://github.com/codewars/snowhouse.git diff --git a/igloo/external/snowhouse b/igloo/external/snowhouse index 89ac7cd..cc6e9ff 160000 --- a/igloo/external/snowhouse +++ b/igloo/external/snowhouse @@ -1 +1 @@ -Subproject commit 89ac7cd0baf2c411671a3169b9364acb1e5cddfd +Subproject commit cc6e9ff9f16a7c5166a3c5a9ee1f351c79cfdec9 From b32cde1c451993dd0f6a40e2bf36582c41292fdf Mon Sep 17 00:00:00 2001 From: kazk Date: Fri, 15 Jul 2022 18:35:16 -0700 Subject: [PATCH 08/12] Add CI --- .github/workflows/ci.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7fddd5a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +name: CI + +on: + push: + branches: + - codewars + pull_request: + +jobs: + check: + # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md + # CMake 3.23.2 + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: 'true' + - name: Build + run: | + mkdir -p ./build + cd ./build + cmake .. + make From 32d3db8b1a4623c4110245f759115e241630785a Mon Sep 17 00:00:00 2001 From: kazk Date: Fri, 15 Jul 2022 19:00:18 -0700 Subject: [PATCH 09/12] Build with both GCC and Clang --- .github/workflows/ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fddd5a..b8a8765 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,11 +11,21 @@ jobs: # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md # CMake 3.23.2 runs-on: ubuntu-20.04 + name: Build with ${{ matrix.compiler.name }} + strategy: + fail-fast: false + matrix: + compiler: + - { name: GCC, CC: gcc, CXX: g++ } + - { name: Clang, CC: clang, CXX: clang++ } steps: - uses: actions/checkout@v3 with: submodules: 'true' - name: Build + env: + CC: ${{ matrix.compiler.CC }} + CXX: ${{ matrix.compiler.CXX }} run: | mkdir -p ./build cd ./build From 7197a6e8e41ce872f04413c42dd2e88f117582f7 Mon Sep 17 00:00:00 2001 From: kazk Date: Fri, 15 Jul 2022 19:14:47 -0700 Subject: [PATCH 10/12] Add virtual destructor to `TestResultsOutput` --- igloo/core/outputters/testresultsoutput.h | 1 + 1 file changed, 1 insertion(+) diff --git a/igloo/core/outputters/testresultsoutput.h b/igloo/core/outputters/testresultsoutput.h index b66a47e..63b9d36 100644 --- a/igloo/core/outputters/testresultsoutput.h +++ b/igloo/core/outputters/testresultsoutput.h @@ -16,6 +16,7 @@ namespace igloo { public: TestResultsOutput(std::ostream& outstream = std::cout) : output(outstream) {} virtual void PrintResult(const TestResults& results) const = 0; + virtual ~TestResultsOutput() = default; private: TestResultsOutput& operator=(const TestResultsOutput&) { return *this; } From 253d1deaf919d5921fddc08fa5806a7540d82398 Mon Sep 17 00:00:00 2001 From: kazk Date: Fri, 15 Jul 2022 21:56:34 -0700 Subject: [PATCH 11/12] Fix `overloaded-virtual` --- tests/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/main.cpp b/tests/main.cpp index 41a64b1..9dc8e1b 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -40,7 +40,8 @@ class ProgressWritingTestListener : public TestListener { std::cout << "Spec succeeded for " << context.Name() << " and spec " << specName << std::endl; } - void SpecFailed(const ContextBase& context, const std::string& specName) + + void SpecFailed(const ContextBase& context, const std::string& specName, const FailedTestResult&) { std::cout << "Spec failed for " << context.Name() << " and spec " << specName << std::endl; } From b5f39499ca9fb78b23ca9675cbe5bdc9436f25f9 Mon Sep 17 00:00:00 2001 From: adzy2k6 Date: Fri, 29 Apr 2022 14:18:28 +0100 Subject: [PATCH 12/12] Updated to use more modern CMake features --- CMakeLists.txt | 15 ++++++--------- cmake/cotire | 1 - 2 files changed, 6 insertions(+), 10 deletions(-) delete mode 160000 cmake/cotire diff --git a/CMakeLists.txt b/CMakeLists.txt index b60b528..8a8dc50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,7 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.22) project(igloo) -set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/cotire/CMake") -include(cotire) - -include_directories("${PROJECT_SOURCE_DIR}") - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ./bin) if (MSVC) @@ -16,12 +11,14 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfatal-errors -Wall -W -Werror -Wfloat-equal -Wundef -Wendif-labels -Wshadow -pedantic-errors") endif() +# Define the library +add_library(igloo INTERFACE) +target_include_directories(igloo INTERFACE "${PROJECT_SOURCE_DIR}") +# Test Code FILE(GLOB IglooTestSourceFiles tests/*.cpp tests/**/*.cpp) add_executable(igloo-tests ${IglooTestSourceFiles}) -set_target_properties(igloo-tests PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "tests/igloo_self_test.h") -set_target_properties(igloo-tests PROPERTIES COTIRE_ADD_UNIT_BUILD FALSE) -# cotire(igloo-tests) +target_include_directories(igloo-tests PRIVATE "${PROJECT_SOURCE_DIR}") add_custom_command(TARGET igloo-tests POST_BUILD diff --git a/cmake/cotire b/cmake/cotire deleted file mode 160000 index 03f64d3..0000000 --- a/cmake/cotire +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 03f64d36a04b3ba2d83f61c87a8097851933be98