feat(tests): update catch to version 3
This commit is contained in:
1 parent
acb04c2360
commit
a2262ca3a7
5 files changed
+33
-31
No files matched your search
+3
-2
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -22,7 +22,7 @@
|
||||
* \brief CalypFrame general tests
|
||||
*/
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include "CalypFrame.h"
|
||||
|
||||
|
||||
@@ -23,4 +23,4 @@
|
||||
*/
|
||||
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
@@ -22,7 +22,7 @@
|
||||
* \brief CalypStream general tests
|
||||
*/
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
#include <catch2/catch_all.hpp>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <variant>
|
||||
@@ -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 );
|
||||
|
||||
|
||||
Reference in new issue
Block a user