diff --git a/CMakeLists.txt b/CMakeLists.txt index 60286c6..369dd8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,7 @@ if(NOT libmcfp_FOUND) GIT_TAG v1.2.4 ) -FetchContent_MakeAvailable(libmcfp) + FetchContent_MakeAvailable(libmcfp) endif() include(VersionString) @@ -101,8 +101,8 @@ if(BUILD_TESTING) GIT_TAG v3.5.2 # or a later release ) - FetchContent_MakeAvailable(Catch2) -endif() + FetchContent_MakeAvailable(Catch2) + endif() file(GLOB UNIT_TEST_RSRC LIST_DIRECTORIES true ${PROJECT_SOURCE_DIR}/rsrc/*) @@ -112,7 +112,7 @@ endif() ) add_executable(mrc-unit-test ${PROJECT_SOURCE_DIR}/src/mrc-unit-test.cpp ${CMAKE_BINARY_DIR}/mrc-unit-test-rsrc.obj) - target_link_libraries(mrc-unit-test Catch2::Catch2) + target_link_libraries(mrc-unit-test Catch2::Catch2WithMain) add_test(NAME unit-test COMMAND $ WORKING_DIRECTORY .) endif() diff --git a/src/mrc-unit-test.cpp b/src/mrc-unit-test.cpp index 71f2061..67cdc7f 100644 --- a/src/mrc-unit-test.cpp +++ b/src/mrc-unit-test.cpp @@ -1,5 +1,5 @@ #define CATCH_CONFIG_MAIN -#include +#include #include "mrsrc.h" @@ -18,7 +18,8 @@ TEST_CASE("test_1", "test_1") REQUIRE(r1.size() == 50); int r = std::memcmp(r1.data(), R"(This is the first line -And this is the second line)", r1.size()); +And this is the second line)", + r1.size()); REQUIRE(r == 0); } @@ -31,15 +32,15 @@ TEST_CASE("test_2", "test_2") REQUIRE(r2.data() != nullptr); REQUIRE(r2.size() == 102); -/* - const char16_t* t = u"\xfeffThis is the first line\ -And this is the second line"; - // t[0] = 0xfeff; + /* + const char16_t* t = u"\xfeffThis is the first line\ + And this is the second line"; + // t[0] = 0xfeff; - int r = std::memcmp(r2.data(), (char*)t, r2.size()); + int r = std::memcmp(r2.data(), (char*)t, r2.size()); - REQUIRE(r == 0); -*/ + REQUIRE(r == 0); + */ } TEST_CASE("test_3", "test_3") @@ -74,16 +75,16 @@ TEST_CASE("test_10", "test_10") REQUIRE(std::distance(r0.begin(), r0.end()) == 3); std::set found; - for (auto& r1: r0) + for (auto &r1 : r0) found.insert(r1.name()); - std::set kTest{"resource-1.txt", "resource-2.txt", "subdir"}; + std::set kTest{ "resource-1.txt", "resource-2.txt", "subdir" }; REQUIRE(found == kTest); if (found != kTest) { - for (auto& f: found) + for (auto &f : found) std::cout << f << std::endl; } } @@ -132,4 +133,3 @@ TEST_CASE("test_14", "test_14") REQUIRE((bool)ri == false); REQUIRE(ri.bad() == true); } -