From 0280200a82a22c517173403f8ea5a082358b8643 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sat, 8 May 2021 23:03:10 +0100 Subject: [PATCH] Add cmake with catch tests --- CMakeLists.txt | 2 +- lib/catch2/CMakeLists.txt | 10 ++++----- lib/catch2/CalypFrameTests.cpp | 39 ++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 786af05..5373926 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # CMakeLists for calyp # -CMAKE_MINIMUM_REQUIRED(VERSION 3.2.0) +CMAKE_MINIMUM_REQUIRED(VERSION 3.5.0) # #################################################################################################################################################### # Project Definition diff --git a/lib/catch2/CMakeLists.txt b/lib/catch2/CMakeLists.txt index 8a9a98e..191841f 100644 --- a/lib/catch2/CMakeLists.txt +++ b/lib/catch2/CMakeLists.txt @@ -2,11 +2,11 @@ # CMakeLists for Calyp lis tests using catch2 # -#ADD_DEFINITIONS(-DCALYP_TEST_DATA_DIR=\"${CALYP_TEST_DATA_DIR}\") +# ADD_DEFINITIONS(-DCALYP_TEST_DATA_DIR=\"${CALYP_TEST_DATA_DIR}\") -SET(Calyp_Lib_Catch2_Tests_SRCS - CalypFrameTests.cpp -) +SET(Calyp_Lib_Catch2_Tests_SRCS CalypFrameTests.cpp) ADD_EXECUTABLE(CalypLibCatch2Tests ${Calyp_Lib_Catch2_Tests_SRCS}) -TARGET_LINK_LIBRARIES(CalypLibCatch2Tests PRIVATE Catch2::Catch2) \ No newline at end of file +TARGET_LINK_LIBRARIES(CalypLibCatch2Tests ${PROJECT_LIBRARY} Catch2::Catch2) + +INCLUDE(CTest) diff --git a/lib/catch2/CalypFrameTests.cpp b/lib/catch2/CalypFrameTests.cpp index e69de29..dfc8ca4 100644 --- a/lib/catch2/CalypFrameTests.cpp +++ b/lib/catch2/CalypFrameTests.cpp @@ -0,0 +1,39 @@ +/* This file is a part of plaYUVer project + * Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) + * Luis Lucas (luisfrlucas@gmail.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + * \file CalypFrameTests.cpp + * \brief CalypFrame general tests + */ + +#define CATCH_CONFIG_MAIN +#include + +#include "CalypFrame.h" + +TEST_CASE( "create a 256x128 frame in YUV420 format", "CalypFrame" ) +{ + // Constructor: CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel = 8 ); + CalypFrame testFrame( 256, 128, CLP_YUV420P, 8 ); + + REQUIRE( testFrame.getWidth() == 256 ); + REQUIRE( testFrame.getHeight() == 128 ); + REQUIRE( testFrame.getPelFormat() == CLP_YUV420P ); + REQUIRE( testFrame.getBitsPel() == 8 ); +}