From ad872cc56f9d27be70ac5b3ba402611cd4096bf1 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Mon, 6 Aug 2018 03:11:21 +0700 Subject: [PATCH] common header for all unit tests --- samples/CMakeLists.txt | 2 +- untests/CMakeLists.txt | 3 ++- untests/sources/common.cpp | 7 +++++++ untests/sources/common.hpp | 11 +++++++++++ untests/sources/untests_base/_base.cpp | 5 +---- untests/sources/untests_base/_base.hpp | 9 +++++++++ untests/sources/untests_core/_core.cpp | 5 +---- untests/sources/untests_core/_core.hpp | 9 +++++++++ untests/sources/untests_math/_math.cpp | 5 +---- untests/sources/untests_math/_math.hpp | 9 +++++++++ untests/sources/untests_utils/_utils.cpp | 5 +---- untests/sources/untests_utils/_utils.hpp | 9 +++++++++ 12 files changed, 61 insertions(+), 18 deletions(-) create mode 100644 untests/sources/common.cpp create mode 100644 untests/sources/common.hpp create mode 100644 untests/sources/untests_base/_base.hpp create mode 100644 untests/sources/untests_core/_core.hpp create mode 100644 untests/sources/untests_math/_math.hpp create mode 100644 untests/sources/untests_utils/_utils.hpp diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index e5f3a05f..52f6f1d6 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -1,6 +1,6 @@ function(add_e2d_sample NAME) set(SAMPLE_NAME sample_${NAME}) - file(GLOB_RECURSE ${SAMPLE_NAME}_sources + file(GLOB ${SAMPLE_NAME}_sources sources/*.* sources/${SAMPLE_NAME}/*.*) set(SAMPLE_SOURCES ${${SAMPLE_NAME}_sources}) diff --git a/untests/CMakeLists.txt b/untests/CMakeLists.txt index ce2c2ff9..15778c68 100644 --- a/untests/CMakeLists.txt +++ b/untests/CMakeLists.txt @@ -1,6 +1,7 @@ function(add_e2d_tests NAME) set(TESTS_NAME untests_${NAME}) - file(GLOB_RECURSE ${TESTS_NAME}_sources + file(GLOB ${TESTS_NAME}_sources + sources/*.* sources/${TESTS_NAME}/*.*) set(TESTS_SOURCES ${${TESTS_NAME}_sources}) source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${TESTS_SOURCES}) diff --git a/untests/sources/common.cpp b/untests/sources/common.cpp new file mode 100644 index 00000000..f230c517 --- /dev/null +++ b/untests/sources/common.cpp @@ -0,0 +1,7 @@ +/******************************************************************************* + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018 Matvey Cherevko + ******************************************************************************/ + +#include "common.hpp" diff --git a/untests/sources/common.hpp b/untests/sources/common.hpp new file mode 100644 index 00000000..49d68bd4 --- /dev/null +++ b/untests/sources/common.hpp @@ -0,0 +1,11 @@ +/******************************************************************************* + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018 Matvey Cherevko + ******************************************************************************/ + +#pragma once + +#include "../catch/catch.hpp" +#include +using namespace e2d; diff --git a/untests/sources/untests_base/_base.cpp b/untests/sources/untests_base/_base.cpp index 9d353129..ac17a804 100644 --- a/untests/sources/untests_base/_base.cpp +++ b/untests/sources/untests_base/_base.cpp @@ -5,10 +5,7 @@ ******************************************************************************/ #define CATCH_CONFIG_MAIN -#include "../../catch/catch.hpp" - -#include -using namespace e2d; +#include "_base.hpp" TEST_CASE("base") { } diff --git a/untests/sources/untests_base/_base.hpp b/untests/sources/untests_base/_base.hpp new file mode 100644 index 00000000..2ac591f1 --- /dev/null +++ b/untests/sources/untests_base/_base.hpp @@ -0,0 +1,9 @@ +/******************************************************************************* + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018 Matvey Cherevko + ******************************************************************************/ + +#pragma once + +#include "../common.hpp" diff --git a/untests/sources/untests_core/_core.cpp b/untests/sources/untests_core/_core.cpp index 187b80e9..1565ca08 100644 --- a/untests/sources/untests_core/_core.cpp +++ b/untests/sources/untests_core/_core.cpp @@ -5,10 +5,7 @@ ******************************************************************************/ #define CATCH_CONFIG_MAIN -#include "../../catch/catch.hpp" - -#include -using namespace e2d; +#include "_core.hpp" TEST_CASE("core") { } diff --git a/untests/sources/untests_core/_core.hpp b/untests/sources/untests_core/_core.hpp new file mode 100644 index 00000000..2ac591f1 --- /dev/null +++ b/untests/sources/untests_core/_core.hpp @@ -0,0 +1,9 @@ +/******************************************************************************* + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018 Matvey Cherevko + ******************************************************************************/ + +#pragma once + +#include "../common.hpp" diff --git a/untests/sources/untests_math/_math.cpp b/untests/sources/untests_math/_math.cpp index efc4933a..5ebbb9e1 100644 --- a/untests/sources/untests_math/_math.cpp +++ b/untests/sources/untests_math/_math.cpp @@ -5,10 +5,7 @@ ******************************************************************************/ #define CATCH_CONFIG_MAIN -#include "../../catch/catch.hpp" - -#include -using namespace e2d; +#include "_math.hpp" TEST_CASE("math") { } diff --git a/untests/sources/untests_math/_math.hpp b/untests/sources/untests_math/_math.hpp new file mode 100644 index 00000000..2ac591f1 --- /dev/null +++ b/untests/sources/untests_math/_math.hpp @@ -0,0 +1,9 @@ +/******************************************************************************* + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018 Matvey Cherevko + ******************************************************************************/ + +#pragma once + +#include "../common.hpp" diff --git a/untests/sources/untests_utils/_utils.cpp b/untests/sources/untests_utils/_utils.cpp index 9d0b629e..b991aef8 100644 --- a/untests/sources/untests_utils/_utils.cpp +++ b/untests/sources/untests_utils/_utils.cpp @@ -5,10 +5,7 @@ ******************************************************************************/ #define CATCH_CONFIG_MAIN -#include "../../catch/catch.hpp" - -#include -using namespace e2d; +#include "_utils.hpp" TEST_CASE("utils") { } diff --git a/untests/sources/untests_utils/_utils.hpp b/untests/sources/untests_utils/_utils.hpp new file mode 100644 index 00000000..2ac591f1 --- /dev/null +++ b/untests/sources/untests_utils/_utils.hpp @@ -0,0 +1,9 @@ +/******************************************************************************* + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018 Matvey Cherevko + ******************************************************************************/ + +#pragma once + +#include "../common.hpp"