Restructure test source folders

This commit is contained in:
Jonny Paton 2018-08-20 08:51:42 +01:00 committed by Lukas Dürrenberger
parent d3a072fb63
commit bc7258006c
12 changed files with 20 additions and 29 deletions

View File

@ -5,13 +5,15 @@ set(SRCROOT "${PROJECT_SOURCE_DIR}/test/src")
include_directories("${PROJECT_SOURCE_DIR}/include")
include_directories("${PROJECT_SOURCE_DIR}/extlibs/headers")
include_directories("${SRCROOT}/TestUtilities")
# System is always built
SET(SYSTEM_SRC
"${SRCROOT}/Vector2.cpp"
"${SRCROOT}/Vector3.cpp"
"${SRCROOT}/TestUtilities/System.hpp"
"${SRCROOT}/TestUtilities/System.cpp"
"${SRCROOT}/CatchMain.cpp"
"${SRCROOT}/System/Vector2.cpp"
"${SRCROOT}/System/Vector3.cpp"
"${SRCROOT}/TestUtilities/SystemUtil.hpp"
"${SRCROOT}/TestUtilities/SystemUtil.cpp"
)
add_executable(systemtest ${SYSTEM_SRC})
target_link_libraries(systemtest sfml-system)
@ -19,9 +21,9 @@ catch_discover_tests(systemtest)
if(SFML_BUILD_WINDOW)
SET(WINDOW_SRC
"${SRCROOT}/Window.cpp"
"${SRCROOT}/TestUtilities/Window.hpp"
"${SRCROOT}/TestUtilities/Window.cpp"
"${SRCROOT}/CatchMain.cpp"
"${SRCROOT}/TestUtilities/WindowUtil.hpp"
"${SRCROOT}/TestUtilities/WindowUtil.cpp"
)
add_executable(windowtest ${WINDOW_SRC})
target_link_libraries(windowtest sfml-window)
@ -30,9 +32,10 @@ endif()
if(SFML_BUILD_GRAPHICS)
SET(GRAPHICS_SRC
"${SRCROOT}/Rect.cpp"
"${SRCROOT}/TestUtilities/Graphics.hpp"
"${SRCROOT}/TestUtilities/Graphics.cpp"
"${SRCROOT}/CatchMain.cpp"
"${SRCROOT}/Graphics/Rect.cpp"
"${SRCROOT}/TestUtilities/GraphicsUtil.hpp"
"${SRCROOT}/TestUtilities/GraphicsUtil.cpp"
)
add_executable(graphicstest ${GRAPHICS_SRC})
target_link_libraries(graphicstest sfml-graphics)

2
test/src/CatchMain.cpp Normal file
View File

@ -0,0 +1,2 @@
#define CATCH_CONFIG_MAIN
#include <catch.hpp>

View File

@ -1,8 +1,6 @@
#define CATCH_CONFIG_MAIN
#include <SFML/Graphics/Rect.hpp>
#include <SFML/System/Vector2.hpp>
#include "TestUtilities/Graphics.hpp"
#include "GraphicsUtil.hpp"
TEST_CASE("sf::Rect class template", "[graphics]")
{

View File

@ -1,7 +1,5 @@
#define CATCH_CONFIG_MAIN
#include <SFML/System/Vector2.hpp>
#include "TestUtilities/System.hpp"
#include "SystemUtil.hpp"
// Use sf::Vector2i for tests. Test coverage is given, as there are no template specializations.

View File

@ -1,5 +1,5 @@
#include <SFML/System/Vector3.hpp>
#include "TestUtilities/System.hpp"
#include "SystemUtil.hpp"
// Use sf::Vector3i for tests. Test coverage is given, as there are no template specializations.

View File

@ -6,7 +6,7 @@
#ifndef SFML_TESTUTILITIES_GRAPHICS_HPP
#define SFML_TESTUTILITIES_GRAPHICS_HPP
#include "Window.hpp"
#include "WindowUtil.hpp"
// Forward declarations for non-template types
namespace sf

View File

@ -6,7 +6,7 @@
#ifndef SFML_TESTUTILITIES_WINDOW_HPP
#define SFML_TESTUTILITIES_WINDOW_HPP
#include "System.hpp"
#include "SystemUtil.hpp"
#include <SFML/Graphics/Rect.hpp>

View File

@ -1,10 +0,0 @@
#define CATCH_CONFIG_MAIN
#include <SFML/Graphics/Rect.hpp>
#include <SFML/System/Vector2.hpp>
#include "TestUtilities/Window.hpp"
TEST_CASE("Window unit test exists", "[window]")
{
CHECK(TRUE);
}