diff --git a/CMakeLists.txt b/CMakeLists.txt index a65ad95..d9e64da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,7 +143,7 @@ IF(BUILD_TESTS) FETCHCONTENT_DECLARE( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v2.13.1 + GIT_TAG v3.3.2 ) SET_PACKAGE_PROPERTIES( @@ -161,8 +161,9 @@ IF(BUILD_TESTS) ) FETCHCONTENT_MAKEAVAILABLE(googletest Catch2) - INCLUDE(${CMAKE_BINARY_DIR}/deps/catch2-src/contrib/Catch.cmake) + LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/deps/catch2-src/extras) INCLUDE(CTest) + INCLUDE(Catch) ENABLE_TESTING() SET(CALYP_TEST_DATA_DIR diff --git a/lib/catch2/CMakeLists.txt b/lib/catch2/CMakeLists.txt index de2a779..ee9fe11 100644 --- a/lib/catch2/CMakeLists.txt +++ b/lib/catch2/CMakeLists.txt @@ -14,5 +14,5 @@ SET(Calyp_Lib_Catch2_Tests_SRCS ADD_DEFINITIONS(-DCALYP_TEST_DATA_DIR=\"${CALYP_TEST_DATA_DIR}\") ADD_EXECUTABLE(CalypLibCatch2Tests ${Calyp_Lib_Catch2_Tests_SRCS}) -TARGET_LINK_LIBRARIES(CalypLibCatch2Tests ${PROJECT_LIBRARY} Catch2::Catch2) +TARGET_LINK_LIBRARIES(CalypLibCatch2Tests ${PROJECT_LIBRARY} Catch2::Catch2WithMain) CATCH_DISCOVER_TESTS(CalypLibCatch2Tests) diff --git a/lib/catch2/CalypFrameTests.cpp b/lib/catch2/CalypFrameTests.cpp index f3b26f7..228d10c 100644 --- a/lib/catch2/CalypFrameTests.cpp +++ b/lib/catch2/CalypFrameTests.cpp @@ -22,7 +22,7 @@ * \brief CalypFrame general tests */ -#include +#include #include "CalypFrame.h" diff --git a/lib/catch2/CalypLibTests.cpp b/lib/catch2/CalypLibTests.cpp index 7bff40f..2893178 100644 --- a/lib/catch2/CalypLibTests.cpp +++ b/lib/catch2/CalypLibTests.cpp @@ -23,4 +23,4 @@ */ #define CATCH_CONFIG_MAIN -#include +#include diff --git a/lib/catch2/CalypStreamTests.cpp b/lib/catch2/CalypStreamTests.cpp index 32bc5b9..3024223 100644 --- a/lib/catch2/CalypStreamTests.cpp +++ b/lib/catch2/CalypStreamTests.cpp @@ -22,7 +22,7 @@ * \brief CalypStream general tests */ -#include +#include #include #include #include @@ -51,7 +51,8 @@ TEST_CASE( "Can open a YUV 420p file", "CalypStream" ) REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) ); CalypStream test_stream; - auto result = test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); + auto result = + test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); REQUIRE( result ); @@ -76,11 +77,8 @@ TEST_CASE( "Can open a YUV file", "CalypStream" ) constexpr auto KEndianness{ CLP_INVALID_ENDIANESS }; auto common_checks = []( auto& stream ) { - return stream.getWidth() == kWidth && - stream.getHeight() == kHeight && - stream.getBitsPerPixel() == kBitsPel && - stream.getFormatName() == "YUV" && - stream.getCodecName() == "Raw Video" && + return stream.getWidth() == kWidth && stream.getHeight() == kHeight && stream.getBitsPerPixel() == kBitsPel && + stream.getFormatName() == "YUV" && stream.getCodecName() == "Raw Video" && stream.getEndianess() == CLP_BIG_ENDIAN; }; SECTION( "YUV420p" ) @@ -90,7 +88,8 @@ TEST_CASE( "Can open a YUV file", "CalypStream" ) REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) ); CalypStream test_stream; - auto result = test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); + auto result = + test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); REQUIRE( result ); CHECK( common_checks( test_stream ) ); const auto* frame = test_stream.getCurrFrame(); @@ -106,7 +105,8 @@ TEST_CASE( "Can open a YUV file", "CalypStream" ) REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) ); CalypStream test_stream; - auto result = test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); + auto result = + test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); REQUIRE( result ); CHECK( common_checks( test_stream ) ); const auto* frame = test_stream.getCurrFrame(); @@ -122,7 +122,8 @@ TEST_CASE( "Can open a YUV file", "CalypStream" ) REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) ); CalypStream test_stream; - auto result = test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); + auto result = + test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); REQUIRE( result ); CHECK( common_checks( test_stream ) ); const auto* frame = test_stream.getCurrFrame(); @@ -138,7 +139,8 @@ TEST_CASE( "Can open a YUV file", "CalypStream" ) REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) ); CalypStream test_stream; - auto result = test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); + auto result = + test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); REQUIRE( result ); CHECK( common_checks( test_stream ) ); const auto* frame = test_stream.getCurrFrame(); @@ -157,11 +159,8 @@ TEST_CASE( "Can open a RGB file", "CalypStream" ) constexpr auto KEndianness{ CLP_INVALID_ENDIANESS }; auto common_checks = []( auto& stream ) { - return stream.getWidth() == kWidth && - stream.getHeight() == kHeight && - stream.getBitsPerPixel() == kBitsPel && - stream.getFormatName() == "YUV" && - stream.getCodecName() == "Raw Video" && + return stream.getWidth() == kWidth && stream.getHeight() == kHeight && stream.getBitsPerPixel() == kBitsPel && + stream.getFormatName() == "YUV" && stream.getCodecName() == "Raw Video" && stream.getEndianess() == CLP_BIG_ENDIAN; }; SECTION( "RGB24" ) @@ -170,7 +169,8 @@ TEST_CASE( "Can open a RGB file", "CalypStream" ) const auto kFilename = getFileTestFilename( "Foreman_352x288_rgb24.yuv" ); REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) ); CalypStream test_stream; - auto result = test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); + auto result = + test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); REQUIRE( result ); CHECK( common_checks( test_stream ) ); const auto* frame = test_stream.getCurrFrame(); @@ -187,7 +187,8 @@ TEST_CASE( "Can open a RGB file", "CalypStream" ) const auto kFilename = getFileTestFilename( "Foreman_352x288_bgr24.yuv" ); REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) ); CalypStream test_stream; - auto result = test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); + auto result = + test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); REQUIRE( result ); CHECK( common_checks( test_stream ) ); const auto* frame = test_stream.getCurrFrame(); @@ -205,18 +206,16 @@ TEST_CASE( "Can open a GRAY file", "CalypStream" ) constexpr auto KEndianness{ CLP_INVALID_ENDIANESS }; auto common_checks = []( auto& stream ) { - return stream.getWidth() == kWidth && - stream.getHeight() == kHeight && - stream.getBitsPerPixel() == kBitsPel && - stream.getFormatName() == "YUV" && - stream.getCodecName() == "Raw Video" && + return stream.getWidth() == kWidth && stream.getHeight() == kHeight && stream.getBitsPerPixel() == kBitsPel && + stream.getFormatName() == "YUV" && stream.getCodecName() == "Raw Video" && stream.getEndianess() == CLP_BIG_ENDIAN; }; constexpr auto kInputFormat{ ClpPixelFormats::Gray }; const auto kFilename = getFileTestFilename( "Foreman_352x288_gray.yuv" ); REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) ); CalypStream test_stream; - auto result = test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); + auto result = + test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, kStreamType ); REQUIRE( result ); CHECK( common_checks( test_stream ) ); const auto* frame = test_stream.getCurrFrame(); @@ -245,7 +244,8 @@ TEST_CASE( "Can open .batatas file as RAW video", "CalypStream" ) bool result{ false }; try { - result = test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, force_raw, kStreamType ); + result = test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, force_raw, + kStreamType ); } catch( ... ) { @@ -260,7 +260,8 @@ TEST_CASE( "Can open .batatas file as RAW video", "CalypStream" ) force_raw = true; CalypStream test_stream; - auto result = test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, force_raw, kStreamType ); + auto result = test_stream.open( kFilename, kWidth, kHeight, kInputFormat, kBitsPel, KEndianness, kFrameRate, + force_raw, kStreamType ); REQUIRE( result );