From bc7258006c0021c366eb986698a79f2e1807fc8f Mon Sep 17 00:00:00 2001 From: Jonny Paton Date: Mon, 20 Aug 2018 08:51:42 +0100 Subject: [PATCH] Restructure test source folders --- test/CMakeLists.txt | 23 +++++++++++-------- test/src/CatchMain.cpp | 2 ++ test/src/{ => Graphics}/Rect.cpp | 4 +--- test/src/{ => System}/Vector2.cpp | 4 +--- test/src/{ => System}/Vector3.cpp | 2 +- .../{Graphics.cpp => GraphicsUtil.cpp} | 0 .../{Graphics.hpp => GraphicsUtil.hpp} | 2 +- .../{System.cpp => SystemUtil.cpp} | 0 .../{System.hpp => SystemUtil.hpp} | 0 .../{Window.cpp => WindowUtil.cpp} | 0 .../{Window.hpp => WindowUtil.hpp} | 2 +- test/src/Window.cpp | 10 -------- 12 files changed, 20 insertions(+), 29 deletions(-) create mode 100644 test/src/CatchMain.cpp rename test/src/{ => Graphics}/Rect.cpp (98%) rename test/src/{ => System}/Vector2.cpp (98%) rename test/src/{ => System}/Vector3.cpp (99%) rename test/src/TestUtilities/{Graphics.cpp => GraphicsUtil.cpp} (100%) rename test/src/TestUtilities/{Graphics.hpp => GraphicsUtil.hpp} (95%) rename test/src/TestUtilities/{System.cpp => SystemUtil.cpp} (100%) rename test/src/TestUtilities/{System.hpp => SystemUtil.hpp} (100%) rename test/src/TestUtilities/{Window.cpp => WindowUtil.cpp} (100%) rename test/src/TestUtilities/{Window.hpp => WindowUtil.hpp} (97%) delete mode 100644 test/src/Window.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 73712d36d..beb4b2045 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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) diff --git a/test/src/CatchMain.cpp b/test/src/CatchMain.cpp new file mode 100644 index 000000000..fd9339d75 --- /dev/null +++ b/test/src/CatchMain.cpp @@ -0,0 +1,2 @@ +#define CATCH_CONFIG_MAIN +#include \ No newline at end of file diff --git a/test/src/Rect.cpp b/test/src/Graphics/Rect.cpp similarity index 98% rename from test/src/Rect.cpp rename to test/src/Graphics/Rect.cpp index e35aa3973..e67fd91e5 100644 --- a/test/src/Rect.cpp +++ b/test/src/Graphics/Rect.cpp @@ -1,8 +1,6 @@ -#define CATCH_CONFIG_MAIN - #include #include -#include "TestUtilities/Graphics.hpp" +#include "GraphicsUtil.hpp" TEST_CASE("sf::Rect class template", "[graphics]") { diff --git a/test/src/Vector2.cpp b/test/src/System/Vector2.cpp similarity index 98% rename from test/src/Vector2.cpp rename to test/src/System/Vector2.cpp index 175ebee22..bb3b28ea7 100644 --- a/test/src/Vector2.cpp +++ b/test/src/System/Vector2.cpp @@ -1,7 +1,5 @@ -#define CATCH_CONFIG_MAIN - #include -#include "TestUtilities/System.hpp" +#include "SystemUtil.hpp" // Use sf::Vector2i for tests. Test coverage is given, as there are no template specializations. diff --git a/test/src/Vector3.cpp b/test/src/System/Vector3.cpp similarity index 99% rename from test/src/Vector3.cpp rename to test/src/System/Vector3.cpp index cf80fb1d0..948a0ff7c 100644 --- a/test/src/Vector3.cpp +++ b/test/src/System/Vector3.cpp @@ -1,5 +1,5 @@ #include -#include "TestUtilities/System.hpp" +#include "SystemUtil.hpp" // Use sf::Vector3i for tests. Test coverage is given, as there are no template specializations. diff --git a/test/src/TestUtilities/Graphics.cpp b/test/src/TestUtilities/GraphicsUtil.cpp similarity index 100% rename from test/src/TestUtilities/Graphics.cpp rename to test/src/TestUtilities/GraphicsUtil.cpp diff --git a/test/src/TestUtilities/Graphics.hpp b/test/src/TestUtilities/GraphicsUtil.hpp similarity index 95% rename from test/src/TestUtilities/Graphics.hpp rename to test/src/TestUtilities/GraphicsUtil.hpp index a251bc566..2a792e4cc 100644 --- a/test/src/TestUtilities/Graphics.hpp +++ b/test/src/TestUtilities/GraphicsUtil.hpp @@ -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 diff --git a/test/src/TestUtilities/System.cpp b/test/src/TestUtilities/SystemUtil.cpp similarity index 100% rename from test/src/TestUtilities/System.cpp rename to test/src/TestUtilities/SystemUtil.cpp diff --git a/test/src/TestUtilities/System.hpp b/test/src/TestUtilities/SystemUtil.hpp similarity index 100% rename from test/src/TestUtilities/System.hpp rename to test/src/TestUtilities/SystemUtil.hpp diff --git a/test/src/TestUtilities/Window.cpp b/test/src/TestUtilities/WindowUtil.cpp similarity index 100% rename from test/src/TestUtilities/Window.cpp rename to test/src/TestUtilities/WindowUtil.cpp diff --git a/test/src/TestUtilities/Window.hpp b/test/src/TestUtilities/WindowUtil.hpp similarity index 97% rename from test/src/TestUtilities/Window.hpp rename to test/src/TestUtilities/WindowUtil.hpp index 3ddc158f9..b0a9f21df 100644 --- a/test/src/TestUtilities/Window.hpp +++ b/test/src/TestUtilities/WindowUtil.hpp @@ -6,7 +6,7 @@ #ifndef SFML_TESTUTILITIES_WINDOW_HPP #define SFML_TESTUTILITIES_WINDOW_HPP -#include "System.hpp" +#include "SystemUtil.hpp" #include diff --git a/test/src/Window.cpp b/test/src/Window.cpp deleted file mode 100644 index e5733626d..000000000 --- a/test/src/Window.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#define CATCH_CONFIG_MAIN - -#include -#include -#include "TestUtilities/Window.hpp" - -TEST_CASE("Window unit test exists", "[window]") -{ - CHECK(TRUE); -}