<commit_before># pv_add_test([ONLY_MPI | NO_MPI] [MAX_MPI_COPIES] [FLAGS] [BASE_NAME])
#
# All arguments are optional
#
# Add a test case for the OpenPV library. This creates the binary and adds
# test tests. Multiple test cases are added by default.
# --------------------------------------------------------------------------------
# Example CMakeLists.txt files for a PVSystemTest:
#
# Most files will have a single line:
#
#   pv_add_test()
# 
#   This will add a test with a base name based on the test's directory name. The params file
#   will be named input/directory_name.params
#
#   This test will use 1,2, and 4 MPI copies
#
# No params files:
#
#   pv_add_test(NO_PARAMS)
#
# Alternate param files:
#
#   pv_add_test(PARAMS test_kernel test_kernel_normalizepost test_kernel_normalizepost_shrunken)
#
# No params files, no MPI:
#
#   pv_add_test(NO_PARAMS NO_MPI)
#
# Append special flags to the command line
#
#   pv_add_test(FLAGS "-c checkpoints/Checkpoint06 --testall")
#
# Specify the number of MPI copies, only test MPI, and special flags
#
#   pv_add_test(MIN_MPI_COPIES 4 MPI_ONLY FLAGS "-batchwidth 4")
#
# --------------------------------------------------------------------------------
# Options:
#
# MPI_ONLY and NO_MPI are mutually exclusive. Both arguments are options.
# By default, one non-MPI test case is created, and two MPI test cases are created, for
# 2 and 4 copies
#
# MIN_MPI_COPIES - minimum number of MPI copies. Default is 2
#
# MAX_MPI_COPIES - maximum number of MPI copies. Test cases are incremented by powers of two,
#  First case is 2, next is 4, and so on, until MAX_MPI_COPIES is reached. Default is 4
#
# FLAGS - by default, the flags are "-t ${PV_SYSTEM_TEST_THREADS}" or
#  "-t ${PV_SYSTEM_TEST_THREADS} -shuffle ${PV_SYSTEM_TEST_SHUFFLE}".
#  Setting FLAGS appends to this
#
# BASE_NAME - by default, this is the last component of the path ${CMAKE_CURRENT_SOURCE_DIR}.
#  Set BASE_NAME to override
#
# PARAMS - by default, this is set to BASE_NAME and a params file of name input/BASE_NAME.params
#   is searched for. If multiple params files are specified, then a separate set of tests
#   will be run for each of the params files
#
# NO_PARAMS - if set, then no params files will be used for this test. Setting PARAMS and
#   NO_PARAMS will result in an error
#

function(pv_add_test_error TEST_NAME MESSAGE)
    message(ERROR "Cannot add OpenPV test ${TEST_NAME}. ${MESSAGE}")
endfunction()

macro(pv_add_test)
  cmake_parse_arguments(PARSED_ARGS "MPI_ONLY;NO_MPI;NO_PARAMS" "MIN_MPI_COPIES;MAX_MPI_COPIES;FLAGS;BASE_NAME" "PARAMS;SRCFILES" ${ARGN})

  set(ERROR_STATE OFF)

  get_filename_component(BASE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
  if(PARSED_ARGS_BASE_NAME)
    set(BASE_NAME ${PARSED_ARGS_BASE_NAME})
  endif()

  if (PARSED_ARGS_MPI_ONLY AND PARSED_ARGS_NO_MPI)
    pv_add_test_error(${BASE_NAME} "ONLY_MPI and NO_MPI are both set. These options are mutually exclusive.")
    set(ERROR_STATE ON)
  endif()

  set(MIN_MPI_COPIES 2)<commit_msg>Hotfix: Updates documentation for pv_add_test()<commit_after># pv_add_test([PARAMS | NO_PARAMS] [MPI_ONLY | NO_MPI] [MIN_MPI_COPIES] [MAX_MPI_COPIES] [FLAGS] [BASE_NAME] [SRCFILES])
#
# All arguments except SRCFILES are optional.
# SRCFILES and PARAMS each take one or more string arguments.
# MIN_MPI_COPIES and MAX_MPI_COPIES each take one numerical argument.
# FLAGS and BASE_NAME each take one string argument.
#
# Add a test case for the OpenPV library. This creates the binary and adds
# test tests. Multiple test cases are added by default.
# --------------------------------------------------------------------------------
# Example CMakeLists.txt files for a PVSystemTest:
#
# Most files will have a single line:
#
#   pv_add_test(SRCFILES main.cpp file1.cpp file2.cpp file1.hpp file2.hpp)
# 
#   This will add a test with a base name based on the test's directory name. The params file
#   will be named input/directory_name.params
#
#   This test will use 1,2, and 4 MPI copies
#
# No params files:
#
#   pv_add_test(NO_PARAMS SRCFILES main.cpp)
#
# Alternate param files:
#
#   pv_add_test(PARAMS test_kernel test_kernel_normalizepost test_kernel_normalizepost_shrunken SRCFILES main.cpp)
#
# No params files, no MPI:
#
#   pv_add_test(NO_PARAMS NO_MPI SRCFILES main.cpp)
#
# Append special flags to the command line
#
#   pv_add_test(FLAGS "-c checkpoints/Checkpoint06 --testall" SRCFILES main.cpp)
#
# Specify the number of MPI copies, only test MPI, and special flags
#
#   pv_add_test(MIN_MPI_COPIES 4 MPI_ONLY FLAGS "-batchwidth 4" SRCFILES main.cpp)
#
# --------------------------------------------------------------------------------
# Options:
#
# PARAMS - by default, this is set to BASE_NAME and a params file of name input/BASE_NAME.params
#   is searched for. If multiple params files are specified, then a separate set of tests
#   will be run for each of the params files
#
# NO_PARAMS - if set, then no params files will be used for this test. Setting PARAMS and
#   NO_PARAMS will result in an error
#
# MPI_ONLY and NO_MPI are mutually exclusive. Both arguments are options.
# By default, one non-MPI test case is created, and two MPI test cases are created, for
# 2 and 4 copies
#
# MIN_MPI_COPIES - minimum number of MPI copies. Default is 2
#
# MAX_MPI_COPIES - maximum number of MPI copies. Test cases are incremented by powers of two,
#  First case is 2, next is 4, and so on, until MAX_MPI_COPIES is reached. Default is 4
#
# FLAGS - by default, the flags are "-t ${PV_SYSTEM_TEST_THREADS}" or
#  "-t ${PV_SYSTEM_TEST_THREADS} -shuffle ${PV_SYSTEM_TEST_SHUFFLE}".
#  Setting FLAGS appends to this
#
# BASE_NAME - by default, this is the last component of the path ${CMAKE_CURRENT_SOURCE_DIR}.
#  Set BASE_NAME to override
#
# SRCFILES - The list source files for the executable that this test runs. There must be
#  at least one source file. This list of files will be passed to pv_add_executable().

function(pv_add_test_error TEST_NAME MESSAGE)
    message(ERROR "Cannot add OpenPV test ${TEST_NAME}. ${MESSAGE}")
endfunction()

macro(pv_add_test)
  cmake_parse_arguments(PARSED_ARGS "MPI_ONLY;NO_MPI;NO_PARAMS" "MIN_MPI_COPIES;MAX_MPI_COPIES;FLAGS;BASE_NAME" "PARAMS;SRCFILES" ${ARGN})

  set(ERROR_STATE OFF)

  get_filename_component(BASE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
  if(PARSED_ARGS_BASE_NAME)
    set(BASE_NAME ${PARSED_ARGS_BASE_NAME})
  endif()

  if (PARSED_ARGS_MPI_ONLY AND PARSED_ARGS_NO_MPI)
    pv_add_test_error(${BASE_NAME} "MPI_ONLY and NO_MPI are both set. These options are mutually exclusive.")
    set(ERROR_STATE ON)
  endif()

  set(MIN_MPI_COPIES 2)
{'fraction_non_alphanumeric': 0.12409529553679131, 'fraction_numerical': 0.0048250904704463205, 'mean_word_length': 3.571330117160579, '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': '5591472', 'n_tokens_mistral': 2299, 'n_tokens_neox': 2183, 'n_words': 757}