From ec1775f9ae0abcadb58235984627140a2dbc01d3 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 16 Mar 2021 16:30:54 +0100 Subject: [PATCH] Add skeleton for C++ API tests --- CMakeLists.txt | 1 + api/sixtyfps-cpp/CMakeLists.txt | 13 +++++++++++++ api/sixtyfps-cpp/tests/tests.cpp | 22 ++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 api/sixtyfps-cpp/tests/tests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index a928559e7..911c4c620 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ cmake_minimum_required(VERSION 3.16) project(SixtyFPS LANGUAGES CXX) +include(CTest) add_subdirectory(api/sixtyfps-cpp/) add_subdirectory(examples/printerdemo/cpp/) diff --git a/api/sixtyfps-cpp/CMakeLists.txt b/api/sixtyfps-cpp/CMakeLists.txt index 8d21022db..d2b369dc0 100644 --- a/api/sixtyfps-cpp/CMakeLists.txt +++ b/api/sixtyfps-cpp/CMakeLists.txt @@ -125,3 +125,16 @@ set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_LIST_DIR}/README.md") set(CPACK_STRIP_FILES ON) include(CPack) +if(BUILD_TESTING) + FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v2.13.1 + ) + + FetchContent_MakeAvailable(Catch2) + + add_executable(api_tests tests/tests.cpp) + target_link_libraries(api_tests PRIVATE Catch2::Catch2) + add_test(api_tests api_tests) +endif() diff --git a/api/sixtyfps-cpp/tests/tests.cpp b/api/sixtyfps-cpp/tests/tests.cpp new file mode 100644 index 000000000..cd1cea64b --- /dev/null +++ b/api/sixtyfps-cpp/tests/tests.cpp @@ -0,0 +1,22 @@ +/* LICENSE BEGIN + This file is part of the SixtyFPS Project -- https://sixtyfps.io + Copyright (c) 2020 Olivier Goffart + Copyright (c) 2020 Simon Hausmann + + SPDX-License-Identifier: GPL-3.0-only + This file is also available under commercial licensing terms. + Please contact info@sixtyfps.io for more information. +LICENSE END */ + +#define CATCH_CONFIG_MAIN +#include "catch2/catch.hpp" + +SCENARIO("SixtyFPS can be shipped") +{ + GIVEN("a boolean") + { + bool okay = true; + + REQUIRE(okay); + } +} \ No newline at end of file