<commit_before># ~~~
# Elektra Test Suite
#
# This file is responsible for generating all tests
# regarding elektra's core.
#
# Backends and Bindings specific tests might be in
# their folders.
# ~~~

include (LibAddMacros)

if (CMAKE_VERSION VERSION_LESS 3.2)
	set (UPDATE_DISCONNECTED_IF_AVAILABLE "")
else ()
	set (UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1")
endif ()

include (DownloadProject.cmake)
download_project (
	PROJ googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG master ${UPDATE_DISCONNECTED_IF_AVAILABLE})

# Prevent GoogleTest from overriding our compiler/linker options when building with Visual Studio
set (gtest_force_shared_crt ON CACHE BOOL "" FORCE)

add_subdirectory (${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})

# When using CMake 2.8.11 or later, header path dependencies are automatically added to the gtest and gmock targets. For earlier CMake
# versions, we have to explicitly add the required directories to the header search path ourselves.
if (CMAKE_VERSION VERSION_LESS 2.8.11)
	include_directories ("${gtest_SOURCE_DIR}/include" "${gmock_SOURCE_DIR}/include")
endif ()

# don't call add_headers in a loop
add_headers (HDR_FILES)

macro (do_test source)
	include_directories ("${CMAKE_CURRENT_SOURCE_DIR}")
	set (SOURCES ${HDR_FILES} ${source}.c $<TARGET_OBJECTS:cframework>)
	add_headers (SOURCES)
	add_testheaders (SOURCES)
	add_executable (${source} ${SOURCES})
	add_dependencies (${source} kdberrors_generated)

	if (INSTALL_TESTING)
		install (TARGETS ${source} DESTINATION ${TARGET_TOOL_EXEC_FOLDER})
	endif (INSTALL_TESTING)

	target_link_elektra (${source})

	set_target_properties (${source} PROPERTIES COMPILE_DEFINITIONS HAVE_KDBCONFIG_H)
	set_target_properties (${source} PROPERTIES LINKER_LANGUAGE CXX)
	add_test (${source} "${CMAKE_BINARY_DIR}/bin/${source}" "${CMAKE_CURRENT_BINARY_DIR}")
	set_property (TEST ${source} PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib")
endmacro (do_test)

if (NOT CMAKE_VERSION VERSION_LESS 3.2)
	set (USES_TERMINAL USES_TERMINAL)
endif (NOT CMAKE_VERSION VERSION_LESS 3.2)

add_custom_target (run_all
		   COMMAND "${CMAKE_SOURCE_DIR}/scripts/run_all" "$<CONFIGURATION>"
		   WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
				     ${USES_TERMINAL})

add_custom_target (run_nokdbtests
		   COMMAND "${CMAKE_SOURCE_DIR}/scripts/run_nokdbtests" "$<CONFIGURATION>"
		   WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")

add_custom_target (run_memcheck
		   COMMAND "${CMAKE_SOURCE_DIR}/scripts/run_memcheck" "$<CONFIGURATION>"
		   WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")

include_directories (data)

add_subdirectory (cframework)
add_subdirectory (shell)
add_subdirectory (shell/shell_recorder)
add_subdirectory (abi)
add_subdirectory (ctest)
if (ENABLE_KDB_TESTING)
	add_subdirectory (kdb)
endif (ENABLE_KDB_TESTING)
<commit_msg>Build: Remove unused code for Google Test<commit_after># ~~~
# Elektra Test Suite
#
# This file is responsible for generating all tests
# regarding elektra's core.
#
# Backends and Bindings specific tests might be in
# their folders.
# ~~~

include (LibAddMacros)

if (CMAKE_VERSION VERSION_LESS 3.2)
	set (UPDATE_DISCONNECTED_IF_AVAILABLE "")
else ()
	set (UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1")
endif ()

include (DownloadProject.cmake)
download_project (
	PROJ googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG master ${UPDATE_DISCONNECTED_IF_AVAILABLE})

# Prevent GoogleTest from overriding our compiler/linker options when building with Visual Studio
set (gtest_force_shared_crt ON CACHE BOOL "" FORCE)

add_subdirectory (${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})


# don't call add_headers in a loop
add_headers (HDR_FILES)

macro (do_test source)
	include_directories ("${CMAKE_CURRENT_SOURCE_DIR}")
	set (SOURCES ${HDR_FILES} ${source}.c $<TARGET_OBJECTS:cframework>)
	add_headers (SOURCES)
	add_testheaders (SOURCES)
	add_executable (${source} ${SOURCES})
	add_dependencies (${source} kdberrors_generated)

	if (INSTALL_TESTING)
		install (TARGETS ${source} DESTINATION ${TARGET_TOOL_EXEC_FOLDER})
	endif (INSTALL_TESTING)

	target_link_elektra (${source})

	set_target_properties (${source} PROPERTIES COMPILE_DEFINITIONS HAVE_KDBCONFIG_H)
	set_target_properties (${source} PROPERTIES LINKER_LANGUAGE CXX)
	add_test (${source} "${CMAKE_BINARY_DIR}/bin/${source}" "${CMAKE_CURRENT_BINARY_DIR}")
	set_property (TEST ${source} PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib")
endmacro (do_test)

if (NOT CMAKE_VERSION VERSION_LESS 3.2)
	set (USES_TERMINAL USES_TERMINAL)
endif (NOT CMAKE_VERSION VERSION_LESS 3.2)

add_custom_target (run_all
		   COMMAND "${CMAKE_SOURCE_DIR}/scripts/run_all" "$<CONFIGURATION>"
		   WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
				     ${USES_TERMINAL})

add_custom_target (run_nokdbtests
		   COMMAND "${CMAKE_SOURCE_DIR}/scripts/run_nokdbtests" "$<CONFIGURATION>"
		   WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")

add_custom_target (run_memcheck
		   COMMAND "${CMAKE_SOURCE_DIR}/scripts/run_memcheck" "$<CONFIGURATION>"
		   WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")

include_directories (data)

add_subdirectory (cframework)
add_subdirectory (shell)
add_subdirectory (shell/shell_recorder)
add_subdirectory (abi)
add_subdirectory (ctest)
if (ENABLE_KDB_TESTING)
	add_subdirectory (kdb)
endif (ENABLE_KDB_TESTING)

{'fraction_non_alphanumeric': 0.1013764880952381, 'fraction_numerical': 0.004092261904761905, 'mean_word_length': 7.085714285714285, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3584705', 'n_tokens_mistral': 2014, 'n_tokens_neox': 1891, 'n_words': 418}