From 3df16d40d193412e7dd1d59a8fedc13f390b3206 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Mon, 3 Feb 2014 01:48:38 +0400 Subject: [PATCH] Add basic tests For now the only thing checked is that header files compile by themselves, e.g. includes and forward declarations in them are complete and they do not require extra includes --- CMakeLists.txt | 3 ++- tests/CMakeLists.txt | 17 +++++++++++++++++ tests/hdr_exception.cc | 5 +++++ tests/hdr_point.cc | 5 +++++ tests/hdr_rect.cc | 5 +++++ tests/hdr_renderer.cc | 5 +++++ tests/hdr_sdl.cc | 5 +++++ tests/hdr_sdl2pp.cc | 5 +++++ tests/hdr_texture.cc | 5 +++++ tests/hdr_window.cc | 5 +++++ 10 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tests/CMakeLists.txt create mode 100644 tests/hdr_exception.cc create mode 100644 tests/hdr_point.cc create mode 100644 tests/hdr_rect.cc create mode 100644 tests/hdr_renderer.cc create mode 100644 tests/hdr_sdl.cc create mode 100644 tests/hdr_sdl2pp.cc create mode 100644 tests/hdr_texture.cc create mode 100644 tests/hdr_window.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 666e0f0..838cb66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,8 +35,9 @@ IF(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) ADD_LIBRARY(SDL2pp SHARED ${LIBRARY_SOURCES}) TARGET_LINK_LIBRARIES(SDL2pp ${SDL2_LIBRARY}) - # demos + # demos and tests ADD_SUBDIRECTORY(demos) + ADD_SUBDIRECTORY(tests) ELSE(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) MESSAGE(STATUS "libSDL2pp bundled build") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..65ace6b --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,17 @@ +# header tests: these just include specific headers to check if +# they are compilable (e.g., includes and forward declarations are +# complete and do not require extra includes) +SET(HEADER_TESTS + hdr_exception + hdr_point + hdr_rect + hdr_renderer + hdr_sdl + hdr_sdl2pp + hdr_texture + hdr_window +) + +FOREACH(TEST ${HEADER_TESTS}) + ADD_EXECUTABLE(${TEST} ${TEST}.cc) +ENDFOREACH(TEST ${TESTS}) diff --git a/tests/hdr_exception.cc b/tests/hdr_exception.cc new file mode 100644 index 0000000..8b21093 --- /dev/null +++ b/tests/hdr_exception.cc @@ -0,0 +1,5 @@ +#include + +int main() { + return 0; +} diff --git a/tests/hdr_point.cc b/tests/hdr_point.cc new file mode 100644 index 0000000..462bd14 --- /dev/null +++ b/tests/hdr_point.cc @@ -0,0 +1,5 @@ +#include + +int main() { + return 0; +} diff --git a/tests/hdr_rect.cc b/tests/hdr_rect.cc new file mode 100644 index 0000000..5e45731 --- /dev/null +++ b/tests/hdr_rect.cc @@ -0,0 +1,5 @@ +#include + +int main() { + return 0; +} diff --git a/tests/hdr_renderer.cc b/tests/hdr_renderer.cc new file mode 100644 index 0000000..8ace592 --- /dev/null +++ b/tests/hdr_renderer.cc @@ -0,0 +1,5 @@ +#include + +int main() { + return 0; +} diff --git a/tests/hdr_sdl.cc b/tests/hdr_sdl.cc new file mode 100644 index 0000000..7b4f35d --- /dev/null +++ b/tests/hdr_sdl.cc @@ -0,0 +1,5 @@ +#include + +int main() { + return 0; +} diff --git a/tests/hdr_sdl2pp.cc b/tests/hdr_sdl2pp.cc new file mode 100644 index 0000000..07e8341 --- /dev/null +++ b/tests/hdr_sdl2pp.cc @@ -0,0 +1,5 @@ +#include + +int main() { + return 0; +} diff --git a/tests/hdr_texture.cc b/tests/hdr_texture.cc new file mode 100644 index 0000000..a5b1573 --- /dev/null +++ b/tests/hdr_texture.cc @@ -0,0 +1,5 @@ +#include + +int main() { + return 0; +} diff --git a/tests/hdr_window.cc b/tests/hdr_window.cc new file mode 100644 index 0000000..cda49ba --- /dev/null +++ b/tests/hdr_window.cc @@ -0,0 +1,5 @@ +#include + +int main() { + return 0; +}