Skip to content

Commit cd461a0

Browse files
committed
catch2
1 parent 999288f commit cd461a0

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ if(NOT libmcfp_FOUND)
7272
GIT_TAG v1.2.4
7373
)
7474

75-
FetchContent_MakeAvailable(libmcfp)
75+
FetchContent_MakeAvailable(libmcfp)
7676
endif()
7777

7878
include(VersionString)
@@ -101,8 +101,8 @@ if(BUILD_TESTING)
101101
GIT_TAG v3.5.2 # or a later release
102102
)
103103

104-
FetchContent_MakeAvailable(Catch2)
105-
endif()
104+
FetchContent_MakeAvailable(Catch2)
105+
endif()
106106

107107
file(GLOB UNIT_TEST_RSRC LIST_DIRECTORIES true ${PROJECT_SOURCE_DIR}/rsrc/*)
108108

@@ -112,7 +112,7 @@ endif()
112112
)
113113

114114
add_executable(mrc-unit-test ${PROJECT_SOURCE_DIR}/src/mrc-unit-test.cpp ${CMAKE_BINARY_DIR}/mrc-unit-test-rsrc.obj)
115-
target_link_libraries(mrc-unit-test Catch2::Catch2)
115+
target_link_libraries(mrc-unit-test Catch2::Catch2WithMain)
116116

117117
add_test(NAME unit-test COMMAND $<TARGET_FILE:mrc-unit-test> WORKING_DIRECTORY .)
118118
endif()

src/mrc-unit-test.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define CATCH_CONFIG_MAIN
2-
#include <catch2/catch.hpp>
2+
#include <catch2/catch_all.hpp>
33

44
#include "mrsrc.h"
55

@@ -18,7 +18,8 @@ TEST_CASE("test_1", "test_1")
1818
REQUIRE(r1.size() == 50);
1919

2020
int r = std::memcmp(r1.data(), R"(This is the first line
21-
And this is the second line)", r1.size());
21+
And this is the second line)",
22+
r1.size());
2223

2324
REQUIRE(r == 0);
2425
}
@@ -31,15 +32,15 @@ TEST_CASE("test_2", "test_2")
3132

3233
REQUIRE(r2.data() != nullptr);
3334
REQUIRE(r2.size() == 102);
34-
/*
35-
const char16_t* t = u"\xfeffThis is the first line\
36-
And this is the second line";
37-
// t[0] = 0xfeff;
35+
/*
36+
const char16_t* t = u"\xfeffThis is the first line\
37+
And this is the second line";
38+
// t[0] = 0xfeff;
3839
39-
int r = std::memcmp(r2.data(), (char*)t, r2.size());
40+
int r = std::memcmp(r2.data(), (char*)t, r2.size());
4041
41-
REQUIRE(r == 0);
42-
*/
42+
REQUIRE(r == 0);
43+
*/
4344
}
4445

4546
TEST_CASE("test_3", "test_3")
@@ -74,16 +75,16 @@ TEST_CASE("test_10", "test_10")
7475
REQUIRE(std::distance(r0.begin(), r0.end()) == 3);
7576

7677
std::set<std::string> found;
77-
for (auto& r1: r0)
78+
for (auto &r1 : r0)
7879
found.insert(r1.name());
7980

80-
std::set<std::string> kTest{"resource-1.txt", "resource-2.txt", "subdir"};
81+
std::set<std::string> kTest{ "resource-1.txt", "resource-2.txt", "subdir" };
8182

8283
REQUIRE(found == kTest);
8384

8485
if (found != kTest)
8586
{
86-
for (auto& f: found)
87+
for (auto &f : found)
8788
std::cout << f << std::endl;
8889
}
8990
}
@@ -132,4 +133,3 @@ TEST_CASE("test_14", "test_14")
132133
REQUIRE((bool)ri == false);
133134
REQUIRE(ri.bad() == true);
134135
}
135-

0 commit comments

Comments
 (0)