<commit_before>INCLUDE(PythonEnvironment)
GET_PYTHON_ENV()

# working directory of tester should be binary dir so link data folders
IF (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/reference_results)
	IF (NOT EXISTS ${CMAKE_SOURCE_DIR}/data/testsuite/meta/)
		MESSAGE(FATAL_ERROR "Test suite for meta examples does not exist! Please initialise and/or update the data submodule.")
	ENDIF()
	CREATE_DATA_SYMLINK(${CMAKE_SOURCE_DIR}/data/testsuite/meta/ ${CMAKE_CURRENT_BINARY_DIR}/reference_results)
ENDIF()
IF (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/generated_results)
	IF (NOT EXISTS ${CMAKE_BINARY_DIR}/examples/meta/)
		#MESSAGE(FATAL_ERROR "Meta examples directory does not exist!")
	ENDIF()
	CREATE_DATA_SYMLINK(${CMAKE_BINARY_DIR}/examples/meta ${CMAKE_CURRENT_BINARY_DIR}/generated_results)
ENDIF()

# compile tester c++ binary
ADD_EXECUTABLE(meta_example_integration_tester ${CMAKE_CURRENT_SOURCE_DIR}/tester.cpp)
ADD_DEPENDENCIES(meta_example_integration_tester shogun::shogun)
TARGET_LINK_LIBRARIES(meta_example_integration_tester shogun::shogun ${SANITIZER_LIBRARY})
IF(SANITIZER_FLAGS)
    SET_TARGET_PROPERTIES(meta_example_integration_tester PROPERTIES COMPILE_FLAGS ${SANITIZER_FLAGS})
ENDIF()
# Add tester to the dependencies of modular interfaces to make sure
# nothing will infer with them being build single-threaded.
IF(SWIG_SINGLE_THREADED)
	FOREACH(SG_INTERFACE_TARGET ${SG_INTERFACE_TARGETS})
		ADD_DEPENDENCIES(${SG_INTERFACE_TARGET} meta_example_integration_tester)
	ENDFOREACH(SG_INTERFACE_TARGET ${SG_INTERFACE_TARGETS})
ENDIF(SWIG_SINGLE_THREADED)

# get list of meta examples that can be built and skip test if if cannot
INCLUDE(FindMetaExamples)
find_meta_examples()

FILE(GLOB META_INTEGRATION_REFERENCES ${CMAKE_CURRENT_BINARY_DIR}/reference_results/*/*.dat)
FOREACH(REFERENCE_FILE ${META_INTEGRATION_REFERENCES})
	# assume a structure <target_language>/<category>/result.dat
	get_filename_component(NAME ${REFERENCE_FILE} NAME_WE)
	IF(${CMAKE_VERSION} VERSION_LESS 2.8.12)
	    get_filename_component(FULL_DIR ${REFERENCE_FILE} PATH)
	ELSE()
	    # only supported from >2.8.11
	    get_filename_component(FULL_DIR ${REFERENCE_FILE} DIRECTORY)
	ENDIF()
	get_filename_component(REL_DIR ${FULL_DIR} NAME)
	set(NAME_WITH_DIR "${REL_DIR}-${NAME}")

	list(FIND META_EXAMPLES ${CMAKE_SOURCE_DIR}/examples/meta/src/${REL_DIR}/${NAME}.sg LISTING_INDEX)
	# continue keyword is not available in older cmake versions (not documented!!!)
	# so use if-then-else
	IF(${LISTING_INDEX} EQUAL -1)
		MESSAGE(WARNING "Skipping integration test for meta example ${REL_DIR}/${NAME}.sg")
	ELSE()
	    IF (NOT ${DISABLE_META_CPP} AND NOT ${DISABLE_META_INTEGRATION_TESTS})
            AddMetaIntegrationTest(cpp 1)
        ENDIF()
		IF (NOT ${DISABLE_META_INTEGRATION_TESTS})
			AddMetaIntegrationTest(python INTERFACE_PYTHON)
			AddMetaIntegrationTest(java INTERFACE_JAVA)
			#AddMetaIntegrationTest(r INTERFACE_R) # currently we have the r meta examples disabled, so no generated results that can be tested
			AddMetaIntegrationTest(octave INTERFACE_OCTAVE)
			AddMetaIntegrationTest(csharp INTERFACE_CSHARP)
			#AddMetaIntegrationTest(ruby INTERFACE_RUBY) # disabled due to potential swig bug, see https://github.com/shogun-toolbox/shogun/issues/4177
			AddMetaIntegrationTest(scala INTERFACE_SCALA)
			#AddMetaIntegrationTest(lua INTERFACE_LUA) # currently doesn't have meta examples
		ENDIF()
	ENDIF()
ENDFOREACH()
<commit_msg>ignore string_features integration test for csharp and drop some old cmake functionality<commit_after>INCLUDE(PythonEnvironment)
GET_PYTHON_ENV()

# working directory of tester should be binary dir so link data folders
IF (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/reference_results)
	IF (NOT EXISTS ${CMAKE_SOURCE_DIR}/data/testsuite/meta/)
		MESSAGE(FATAL_ERROR "Test suite for meta examples does not exist! Please initialise and/or update the data submodule.")
	ENDIF()
	CREATE_DATA_SYMLINK(${CMAKE_SOURCE_DIR}/data/testsuite/meta/ ${CMAKE_CURRENT_BINARY_DIR}/reference_results)
ENDIF()
IF (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/generated_results)
	IF (NOT EXISTS ${CMAKE_BINARY_DIR}/examples/meta/)
		#MESSAGE(FATAL_ERROR "Meta examples directory does not exist!")
	ENDIF()
	CREATE_DATA_SYMLINK(${CMAKE_BINARY_DIR}/examples/meta ${CMAKE_CURRENT_BINARY_DIR}/generated_results)
ENDIF()

# compile tester c++ binary
ADD_EXECUTABLE(meta_example_integration_tester ${CMAKE_CURRENT_SOURCE_DIR}/tester.cpp)
ADD_DEPENDENCIES(meta_example_integration_tester shogun::shogun)
TARGET_LINK_LIBRARIES(meta_example_integration_tester shogun::shogun ${SANITIZER_LIBRARY})
IF(SANITIZER_FLAGS)
    SET_TARGET_PROPERTIES(meta_example_integration_tester PROPERTIES COMPILE_FLAGS ${SANITIZER_FLAGS})
ENDIF()
# Add tester to the dependencies of modular interfaces to make sure
# nothing will infer with them being build single-threaded.
IF(SWIG_SINGLE_THREADED)
	FOREACH(SG_INTERFACE_TARGET ${SG_INTERFACE_TARGETS})
		ADD_DEPENDENCIES(${SG_INTERFACE_TARGET} meta_example_integration_tester)
	ENDFOREACH(SG_INTERFACE_TARGET ${SG_INTERFACE_TARGETS})
ENDIF(SWIG_SINGLE_THREADED)

# get list of meta examples that can be built and skip test if if cannot
INCLUDE(FindMetaExamples)
find_meta_examples()

FILE(GLOB META_INTEGRATION_REFERENCES ${CMAKE_CURRENT_BINARY_DIR}/reference_results/*/*.dat)
FOREACH(REFERENCE_FILE ${META_INTEGRATION_REFERENCES})
	# assume a structure <target_language>/<category>/result.dat
	get_filename_component(NAME ${REFERENCE_FILE} NAME_WE)
	get_filename_component(FULL_DIR ${REFERENCE_FILE} DIRECTORY)
	get_filename_component(REL_DIR ${FULL_DIR} NAME)
	set(NAME_WITH_DIR "${REL_DIR}-${NAME}")

	list(FIND META_EXAMPLES ${CMAKE_SOURCE_DIR}/examples/meta/src/${REL_DIR}/${NAME}.sg LISTING_INDEX)
	# continue keyword is not available in older cmake versions (not documented!!!)
	# so use if-then-else
	IF(${LISTING_INDEX} EQUAL -1)
		MESSAGE(WARNING "Skipping integration test for meta example ${REL_DIR}/${NAME}.sg")
	ELSE()
	    IF (NOT ${DISABLE_META_CPP} AND NOT ${DISABLE_META_INTEGRATION_TESTS})
            AddMetaIntegrationTest(cpp 1)
        ENDIF()
		IF (NOT ${DISABLE_META_INTEGRATION_TESTS})
			AddMetaIntegrationTest(python INTERFACE_PYTHON)
			AddMetaIntegrationTest(java INTERFACE_JAVA)
			#AddMetaIntegrationTest(r INTERFACE_R) # currently we have the r meta examples disabled, so no generated results that can be tested
			AddMetaIntegrationTest(octave INTERFACE_OCTAVE)
			# TODO: remove once string features typemap is fixed
			IF (NOT ${NAME} STREQUAL "string_features")
				AddMetaIntegrationTest(csharp INTERFACE_CSHARP)
			ENDIF()
			#AddMetaIntegrationTest(ruby INTERFACE_RUBY) # disabled due to potential swig bug, see https://github.com/shogun-toolbox/shogun/issues/4177
			AddMetaIntegrationTest(scala INTERFACE_SCALA)
			#AddMetaIntegrationTest(lua INTERFACE_LUA) # currently doesn't have meta examples
		ENDIF()
	ENDIF()
ENDFOREACH()

{'fraction_non_alphanumeric': 0.08943325119582549, 'fraction_numerical': 0.0028989708653428033, 'mean_word_length': 7.263473053892215, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '632189', 'n_tokens_mistral': 2505, 'n_tokens_neox': 2310, 'n_words': 503}