Skip to content

Commit

Permalink
Upgrade Catch2 to v3, use individual headers
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterTh committed Mar 7, 2022
1 parent abbcfca commit 9a6f19d
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 21 deletions.
4 changes: 1 addition & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19.0")
cmake_policy(SET CMP0110 NEW) # don't spam about add_test names..
endif()

include("${PROJECT_SOURCE_DIR}/vendor/Catch2/contrib/ParseAndAddCatchTests.cmake")
include("${PROJECT_SOURCE_DIR}/vendor/Catch2/extras/ParseAndAddCatchTests.cmake")

# Add includes to library so they show up in IDEs
file(GLOB_RECURSE TEST_INCLUDES *.h)
Expand All @@ -28,8 +28,6 @@ target_link_libraries(

set_property(TARGET unit_test_suite PROPERTY CXX_STANDARD 17)

add_definitions("-DCATCH_CONFIG_ENABLE_BENCHMARKING")

add_celerity_to_target(TARGET unit_test_suite SOURCES unit_test_suite_celerity.cc)

foreach(TEST_TARGET ${TEST_TARGETS})
Expand Down
3 changes: 2 additions & 1 deletion test/benchmarks.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/benchmark/catch_benchmark.hpp>
#include <catch2/catch_test_macros.hpp>

#include "intrusive_graph.h"

Expand Down
4 changes: 2 additions & 2 deletions test/graph_compaction_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <set>
#include <unordered_set>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include <celerity.h>

Expand Down Expand Up @@ -304,7 +304,7 @@ namespace detail {
}

for(auto cid : initial_last_writer_ids) {
INFO("initial last writer with id " << cid << " has been deleted")
INFO("initial last writer with id " << cid << " has been deleted");
CHECK_FALSE(ctx.get_command_graph().has(cid));
}

Expand Down
2 changes: 1 addition & 1 deletion test/graph_generation_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <set>
#include <unordered_set>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include <celerity.h>

Expand Down
2 changes: 1 addition & 1 deletion test/intrusive_graph_tests.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "unit_test_suite_celerity.h"

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include "intrusive_graph.h"

Expand Down
2 changes: 1 addition & 1 deletion test/runtime_deprecation_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <memory>
#include <random>

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include <celerity.h>

Expand Down
4 changes: 2 additions & 2 deletions test/runtime_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <pthread.h>
#endif

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include <celerity.h>

Expand Down Expand Up @@ -179,7 +179,7 @@ namespace detail {

// Attempting to merge region maps with incompatible extents should throw
const region_map<size_t> rm_incompat(cl::sycl::range<3>(128, 64, 30));
REQUIRE_THROWS_WITH(rm1.merge(rm_incompat), Catch::Equals("Incompatible region map"));
REQUIRE_THROWS_WITH(rm1.merge(rm_incompat), Catch::Matchers::Equals("Incompatible region map"));
}

TEST_CASE("range mapper results are clamped to buffer range", "[range-mapper]") {
Expand Down
2 changes: 1 addition & 1 deletion test/system/distr_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <algorithm>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <mpi.h>
#include <spdlog/sinks/ostream_sink.h>

Expand Down
4 changes: 2 additions & 2 deletions test/task_graph_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "types.h"
#include "unit_test_suite_celerity.h"

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include <celerity.h>
#include <iterator>
Expand Down Expand Up @@ -488,7 +488,7 @@ namespace detail {
}
}

INFO("initial last writer with id " << initial_last_writer_id << " has been deleted")
INFO("initial last writer with id " << initial_last_writer_id << " has been deleted");
CHECK_FALSE(tm.has_task(initial_last_writer_id));

auto buf = mbf.create_buffer(cl::sycl::range<1>(1), true);
Expand Down
2 changes: 1 addition & 1 deletion test/test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <map>
#include <ostream>

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include <celerity.h>
#include <memory>
Expand Down
12 changes: 7 additions & 5 deletions test/unit_test_suite.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "unit_test_suite.h"

#define CATCH_CONFIG_RUNNER
#include <catch2/catch.hpp>
#include <catch2/catch_session.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/reporters/catch_reporter_event_listener.hpp>
#include <catch2/reporters/catch_reporter_registrars.hpp>

bool print_graphs = false;

Expand All @@ -11,7 +13,7 @@ bool print_graphs = false;
int main(int argc, char* argv[]) {
Catch::Session session;

using namespace Catch::clara;
using namespace Catch::Clara;
const auto cli = session.cli() | Opt(print_graphs)["--print-graphs"]("print graphs (GraphViz)");

session.cli(cli);
Expand All @@ -22,8 +24,8 @@ int main(int argc, char* argv[]) {
return session.run();
}

struct GlobalSetupAndTeardown : Catch::TestEventListenerBase {
using TestEventListenerBase::TestEventListenerBase;
struct GlobalSetupAndTeardown : Catch::EventListenerBase {
using EventListenerBase::EventListenerBase;
void testRunStarting(const Catch::TestRunInfo&) override { detail::test_run_started_callback(); }
void testCaseEnded(const Catch::TestCaseStats&) override { detail::test_case_ended_callback(); }
void testRunEnded(const Catch::TestRunStats&) override { detail::test_run_ended_callback(); }
Expand Down
2 changes: 1 addition & 1 deletion vendor/Catch2
Submodule Catch2 updated 581 files

0 comments on commit 9a6f19d

Please sign in to comment.