From 9f8d89895d78d04d8da1b2c79e891f831a0641b9 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Mon, 22 May 2017 20:08:28 +0100 Subject: [PATCH] Make a new test project for full-page testing. --- CMakeLists.txt | 1 + test/simulation/CMakeLists.txt | 27 +++++++++++++++++++ test/simulation/check.cpp | 19 +++++++++++++ .../test_index_response.cpp | 3 +++ test/unit/CMakeLists.txt | 1 - 5 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 test/simulation/CMakeLists.txt create mode 100644 test/simulation/check.cpp rename test/{unit => simulation}/test_index_response.cpp (97%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fa5650..0741f60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,4 +29,5 @@ install(DIRECTORY html/website/ DESTINATION html) if (BUILD_TESTING) add_subdirectory(test/unit) + add_subdirectory(test/simulation) endif() diff --git a/test/simulation/CMakeLists.txt b/test/simulation/CMakeLists.txt new file mode 100644 index 0000000..4d1a053 --- /dev/null +++ b/test/simulation/CMakeLists.txt @@ -0,0 +1,27 @@ +project(tawashi_simulation CXX) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wpedantic -Wconversion -Werror") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_DEBUG} -Wall -Wpedantic -Wconversion -Werror") + +add_executable(${PROJECT_NAME} + check.cpp + test_index_response.cpp +) + +target_include_directories(${PROJECT_NAME} + PRIVATE ${TAWASHI_SOURCE_ROOT}/lib/Catch/single_include + PRIVATE ${TAWASHI_GEN_INCLUDE_DIR} +) +target_link_libraries(${PROJECT_NAME} + PRIVATE tawashi_implem + PRIVATE duckhandy +) + +add_test( + NAME TawashiSimulationTest + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PROJECT_NAME} +) diff --git a/test/simulation/check.cpp b/test/simulation/check.cpp new file mode 100644 index 0000000..2925a6b --- /dev/null +++ b/test/simulation/check.cpp @@ -0,0 +1,19 @@ +/* Copyright 2017, Michele Santullo + * This file is part of "tawashi". + * + * "tawashi" is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * "tawashi" is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with "tawashi". If not, see . + */ + +#define CATCH_CONFIG_MAIN +#include "catch.hpp" diff --git a/test/unit/test_index_response.cpp b/test/simulation/test_index_response.cpp similarity index 97% rename from test/unit/test_index_response.cpp rename to test/simulation/test_index_response.cpp index f6e9675..2188830 100644 --- a/test/unit/test_index_response.cpp +++ b/test/simulation/test_index_response.cpp @@ -24,6 +24,7 @@ #include #include #include +#include namespace { const char g_mustache_html[] = @@ -74,6 +75,8 @@ namespace tawashi { TEST_CASE ("Index response", "[index][response]") { using curry::SafeStackObject; + auto statuslog = spdlog::stdout_logger_st("statuslog"); + const char* const env_raw[] = { "AUTH_TYPE=", "CONTENT_TYPE=", diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 4ba495a..e2c2800 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -12,7 +12,6 @@ add_executable(${PROJECT_NAME} check.cpp test_ini_file.cpp test_settings_bag.cpp - test_index_response.cpp test_invalid_utf8_post.cpp ../data/UTF-8-test.txt.c test_invalid_utf8_get.cpp