Rewrite timestamp tests using doctest
Add doctest, migrate Autotools and CMake build to it
Adapt .gitignore
MODIFY
.gitignore
.gitignore
/builds/autoconf/
!/builds/autoconf/m4/m4_ax_pkg_check_modules.m4
/liblcf-*/
-/tests/*.log
-/tests/*.trs
-/time_stamp*
+/test_runner*
.deps/
.libs/
.dirstamp
@@ -20,7 +18,6 @@ configure
liblcf-*.tar.gz
libtool
stamp-h1
-test-suite.log
*.la
*.lo
@@ -57,5 +54,4 @@ Makefile
*.pc
# tests
-/tests/time_stamp*
-!/tests/time_stamp.cpp
+/tests/test_runner*

MODIFY
Makefile.am
Makefile.am
@@ -193,18 +193,22 @@ pkginclude_HEADERS = \
src/generated/rpg_trooppage.h \
src/generated/rpg_variable.h
-check_PROGRAMS = time_stamp
-TESTS = time_stamp
-time_stamp_SOURCES = tests/time_stamp.cpp
-time_stamp_CPPFLAGS = \
+check_PROGRAMS = test_runner
+test_runner_SOURCES = \
+ tests/time_stamp.cpp \
+ tests/test_main.cpp
+test_runner_CPPFLAGS = \
-I$(srcdir)/src \
-I$(srcdir)/src/generated
-time_stamp_CXXFLAGS = \
+test_runner_CXXFLAGS = \
-std=c++11 \
$(EXPAT_CXXFLAGS) \
$(ICU_CXXFLAGS)
-time_stamp_LDADD = \
+test_runner_LDADD = \
liblcf.la \
$(EXPAT_LIBS) \
$(ICU_LIBS)
-time_stamp_LDFLAGS = -no-install
+test_runner_LDFLAGS = -no-install
+
+check-local:
+ $(AM_V_at)./test_runner

MODIFY
builds/cmake/CMakeLists.txt
builds/cmake/CMakeLists.txt
@@ -83,22 +83,10 @@ install(FILES ${CMAKE_BINARY_DIR}/liblcf.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
# test
-enable_testing()
-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../src)
-function(CXX_TEST target libs)
- get_filename_component(name ${target} NAME_WE)
- add_executable(test_${name} ${target})
- target_link_libraries(test_${name} ${PROJECT_NAME} ${libs})
- add_test(
- NAME test_${name}
- WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
- COMMAND ${EXECUTABLE_OUTPUT_PATH}/test_${name})
- add_dependencies(test_${name} ${PROJECT_NAME})
-endfunction()
-
file(GLOB TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/*.cpp)
-foreach(i ${TEST_FILES})
- cxx_test(${i} ${ICU_LIBRARIES} ${EXPAT_LIBRARY})
-endforeach()
+add_executable(test_runner EXCLUDE_FROM_ALL ${TEST_FILES})
+target_link_libraries(test_runner ${PROJECT_NAME} ${ICU_LIBRARIES} ${EXPAT_LIBRARY})
+add_custom_target(check COMMAND ${EXECUTABLE_OUTPUT_PATH}/test_runner)
+add_dependencies(check test_runner)

ADD
tests/doctest.h
tests/doctest.h
Binary files /dev/null and b/tests/doctest.h differ

ADD
tests/test_main.cpp
+/*
+ * This file is part of liblcf. Copyright (c) 2017 liblcf authors.
+ * https://github.com/EasyRPG/liblcf - https://easyrpg.org
+ *
+ * liblcf is Free/Libre Open Source Software, released under the MIT License.
+ * For the full copyright and license information, please view the COPYING
+ * file that was distributed with this source code.
+ */
+
+#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
+#include "doctest.h"

Rewrite timestamp tests using doctest
Add doctest, migrate Autotools and CMake build to it
Adapt .gitignore