<commit_before># Executables that use Sillymem can be added through the
# macro add_executable_silly(), which adds the necessary
# definitions and extra sources.
set(SILLY_SRC ../lib/sillymem.c)
macro(add_executable_silly _name)
	add_executable(${_name} ${ARGN} ${SILLY_SRC})
	set_target_properties (
		${_name}
		PROPERTIES COMPILE_DEFINITIONS USE_SILLYMEM
	)
endmacro()

add_executable_silly (
	lillydump.test
	lillydump.c
)
target_link_libraries (
	lillydump.test
	lillydapStatic
	${Quick-DER_STATIC_LIBRARIES}
)

if (NOT ${BUILD_SINGLE_THREADED})
	add_executable_silly (
		stampede.test
		stampede.c
	)

	#TODO# Really -pthread, literally?!?
	if(THREADS_HAVE_PTHREAD_ARG)
		target_compile_options(stampede.test "-pthread")
	endif()
	target_link_libraries (
		stampede.test
		lillydapStatic
		${Quick-DER_STATIC_LIBRARIES}
		${CMAKE_THREAD_LIBS_INIT}	-lpthread
	)
endif()

add_executable_silly (
	lillypass.test
	lillypass.c
)
target_link_libraries (
	lillypass.test
	lillydapStatic
	${Quick-DER_STATIC_LIBRARIES}
)

file (GLOB netpkgs ldap/*.bin)

#TODO# Test that output matches expectations
foreach (netpkg ${netpkgs})
	get_filename_component (netpkgname ${netpkg} NAME)
	add_test (
		NAME lillydump-netpkg-${netpkgname}
		COMMAND lillydump.test ${netpkg}
	)
endforeach()

#TODO# Test that all serials exist, in proper order, for each threadid
if (NOT ${BUILD_SINGLE_THREADED})
	# This is a test of lock-free concurrency, useless when single-threaded
	add_test (
		NAME stampede.test
		COMMAND stampede.test 250
	)
endif()

#TODO# Test that the output matches expectations
foreach (netpkg ${netpkgs})
	get_filename_component (netpkgname ${netpkg} NAME)
	foreach (level 0 1 2)  #TODO# 3 4
		add_test (
			NAME lillypass-level${level}-netpkg-${netpkgname}
			COMMAND lillypass.test ${level} ${netpkg}
		)
	endforeach()
endforeach()

# Not so much a test as a standalone test-helper
find_package(OpenLDAP)
if (OpenLDAP_FOUND)
	add_executable(ldap-mitm ldap-mitm.c)
	target_link_libraries(ldap-mitm ${OpenLDAP_LIBRARIES})
	target_include_directories(ldap-mitm PUBLIC ${OpenLDAP_INCLUDE_DIRS})
endif()<commit_msg>CMake: don't need OpenLDAP for the MITM example<commit_after># Executables that use Sillymem can be added through the
# macro add_executable_silly(), which adds the necessary
# definitions and extra sources.
set(SILLY_SRC ../lib/sillymem.c)
macro(add_executable_silly _name)
	add_executable(${_name} ${ARGN} ${SILLY_SRC})
	set_target_properties (
		${_name}
		PROPERTIES COMPILE_DEFINITIONS USE_SILLYMEM
	)
endmacro()

add_executable_silly (
	lillydump.test
	lillydump.c
)
target_link_libraries (
	lillydump.test
	lillydapStatic
	${Quick-DER_STATIC_LIBRARIES}
)

if (NOT ${BUILD_SINGLE_THREADED})
	add_executable_silly (
		stampede.test
		stampede.c
	)

	#TODO# Really -pthread, literally?!?
	if(THREADS_HAVE_PTHREAD_ARG)
		target_compile_options(stampede.test "-pthread")
	endif()
	target_link_libraries (
		stampede.test
		lillydapStatic
		${Quick-DER_STATIC_LIBRARIES}
		${CMAKE_THREAD_LIBS_INIT}	-lpthread
	)
endif()

add_executable_silly (
	lillypass.test
	lillypass.c
)
target_link_libraries (
	lillypass.test
	lillydapStatic
	${Quick-DER_STATIC_LIBRARIES}
)

file (GLOB netpkgs ldap/*.bin)

#TODO# Test that output matches expectations
foreach (netpkg ${netpkgs})
	get_filename_component (netpkgname ${netpkg} NAME)
	add_test (
		NAME lillydump-netpkg-${netpkgname}
		COMMAND lillydump.test ${netpkg}
	)
endforeach()

#TODO# Test that all serials exist, in proper order, for each threadid
if (NOT ${BUILD_SINGLE_THREADED})
	# This is a test of lock-free concurrency, useless when single-threaded
	add_test (
		NAME stampede.test
		COMMAND stampede.test 250
	)
endif()

#TODO# Test that the output matches expectations
foreach (netpkg ${netpkgs})
	get_filename_component (netpkgname ${netpkg} NAME)
	foreach (level 0 1 2)  #TODO# 3 4
		add_test (
			NAME lillypass-level${level}-netpkg-${netpkgname}
			COMMAND lillypass.test ${level} ${netpkg}
		)
	endforeach()
endforeach()

# Not so much a test as a standalone test-helper
add_executable(ldap-mitm ldap-mitm.c)
{'fraction_non_alphanumeric': 0.09894685280431055, 'fraction_numerical': 0.0039186872397746755, 'mean_word_length': 5.503184713375796, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '2535375', 'n_tokens_mistral': 1619, 'n_tokens_neox': 1530, 'n_words': 347}