<commit_before>
SET(BASELINE ${OTB_DATA_ROOT}/Baseline/OTB/Images)
SET(BASELINE_FILES ${OTB_DATA_ROOT}/Baseline/OTB/Files)
SET(INPUTDATA ${OTB_DATA_ROOT}/Input)
SET(TEMP ${OTBTesting_BINARY_DIR}/Temporary)

SET(APPLICATIONSPATH ${OTB_BINARY_DIR}/bin)

if(WIN32)
  add_definitions(-DWIN32)
endif(WIN32)

set(OTB_WRAPPER_COMMAND_LINE_TESTS ${CXX_TEST_PATH}/otbWrapperCommandLineTests)

# ----------------Command Line Parser tests -----------------------------------
add_test(clTuWrapperCommandLineParserNew ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserNew
  )

add_test(clTvWrapperCommandLineParserTest_GetAtt ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest1
        "--key"
        "this is a line test to extract --key name1 name2"
  )

add_test(clTvWrapperCommandLineParserTest_IsAttExists_Wrong ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest3
        "--m"
        " TrainImagesClassifier test --il QB_1_ortho.tif --vd vd .shape "
  )
  
  
add_test(clTvWrapperCommandLineParserTest_IsAttExists ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest4
        "--m"
         " TrainImagesClassifier test --il QB_1_ortho.tif --vd vd .shape --m name"
  )
   
add_test(clTvWrapperCommandLineParserTest_IsAttExistsEnd ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest4
        "--m"
         " TrainImagesClassifier test --il QB_1_ortho.tif --vd vd .shape --m name"
  )
    
add_test(clTvWrapperCommandLineParserTest_IsAttExistsEndNoParam ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest4
        "--m"
        " TrainImagesClassifier test --il QB_1_ortho.tif --vd vd .shape test --m"
  )
   
add_test(clTvWrapperCommandLineParserTest_GetAttWithoutValue ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest1
        "--key"
        "--key"
  )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_GetAttWithoutValue PROPERTIES WILL_FAIL true)

add_test(clTvWrapperCommandLineParserTest_NoModule ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest2
        ""
  )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_NoModule PROPERTIES WILL_FAIL true)

add_test(clTvWrapperCommandLineParserTest_NonAlphaNumModuleName ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest2
        "-Re+scale ${APPLICATIONSPATH}"
  )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_NonAlphaNumModuleName PROPERTIES WILL_FAIL true)

add_test(clTvWrapperCommandLineParserTest_GoodModule ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest2
        "Rescale ${APPLICATIONSPATH}"
)

add_test(clTvWrapperCommandLineParserTest_WithKeyNoModule ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest2
        "${APPLICATIONSPATH}"
  )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_WithKeyNoModule PROPERTIES WILL_FAIL true)

add_test(clTvWrapperCommandLineParserTest_WithKeyNonAlphaNumModuleName ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest2
        "-Re+scale ${APPLICATIONSPATH}"
  )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_WithKeyNonAlphaNumModuleName PROPERTIES WILL_FAIL true)

add_test(clTvWrapperCommandLineParserTest_WithKeyGoodModule ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest2
        "Rescale ${APPLICATIONSPATH}"
)

add_test(clTvWrapperCommandLineParserTest_NoPath ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest2
        "Rescale"
)
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_NoPath PROPERTIES WILL_FAIL true)

add_test(clTvWrapperCommandLineParserTest_WrongPath ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest2
        "Rescale FakePath"
)
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_WrongPath PROPERTIES WILL_FAIL true)

add_test(clTvWrapperCommandLineParserTest_MultiplePathOneWrong ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest2
        "Rescale ${APPLICATIONSPATH} FakePath"
)
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_MultiplePathOneWrong PROPERTIES WILL_FAIL true)

add_test(clTvWrapperCommandLineParserTest_MultiplePath ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineParserTest2
        "Rescale ${APPLICATIONSPATH} ${APPLICATIONSPATH}"
)


# ----------------Command Laine Launcher tests -----------------------------------
add_test(clTuWrapperCommandLineLauncherNew ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineLauncherNew
  )

add_test(clTvWrapperCommandLineLauncherTest ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineLauncherTest
        "Rescale ${APPLICATIONSPATH} --in ${INPUTDATA}/poupees.tif --out ${TEMP}/clTvWrapperCommandLineLauncherTest.tif --outmin 15 --outmax 200"
  )

add_test(clTvWrapperCommandLineLauncherTest_Help ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineLauncherTest
        "Rescale ${APPLICATIONSPATH} --help"
  )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineLauncherTest_Help PROPERTIES WILL_FAIL true)

add_test(clTvWrapperCommandLineLauncherTest_Help2 ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineLauncherTest
        "Rescale ${APPLICATIONSPATH} --in ${INPUTDATA}/poupees.tif --out ${TEMP}/clTvWrapperCommandLineLauncherTest_Help2.tif --outmin 15 --outmax 200 --help"
  )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineLauncherTest_Help2 PROPERTIES WILL_FAIL true)

add_test(clTvWrapperCommandLineLauncherTest_MissingManParam ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineLauncherTest
        "Rescale ${APPLICATIONSPATH}"
  )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineLauncherTest_MissingManParam PROPERTIES WILL_FAIL true)

add_test(clTvWrapperCommandLineLauncherTest_MissingDash ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineLauncherTest
        "Rescale ${APPLICATIONSPATH} -in image1"
  )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineLauncherTest_MissingDash PROPERTIES WILL_FAIL true)

add_test(clTvWrapperCommandLineLauncherTest_DoubleParam ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineLauncherTest
        "Rescale ${APPLICATIONSPATH} --in image1 --in image2"
  )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineLauncherTest_DoubleParam PROPERTIES WILL_FAIL true)

add_test(clTvWrapperCommandLineLauncherTest_WrongParam ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	otbWrapperCommandLineLauncherTest
        "Rescale ${APPLICATIONSPATH} --inn image"
  )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineLauncherTest_WrongParam PROPERTIES WILL_FAIL true)


# --------------------------------------------------------------------
# ----------------Source files CXX -----------------------------------
# --------------------------------------------------------------------
set(Wrapper_Command_Line_SRCS
otbWrapperCommandLineTests.cxx

otbWrapperCommandLineParserTests.cxx
otbWrapperCommandLineLauncherTests.cxx
)

include_directories(${CMAKE_SOURCE_DIR}/Code/Wrappers/CommandLine ${CMAKE_SOURCE_DIR}/Code/Core)
add_executable(otbWrapperCommandLineTests ${Wrapper_Command_Line_SRCS})
target_link_libraries(otbWrapperCommandLineTests OTBIO OTBCommon ITKIO ITKCommon OTBTesting OTBWrapperCommandLine)<commit_msg>TEST: use NAME/COMMAND add_test prototype to handle multi-config generators<commit_after>
SET(BASELINE ${OTB_DATA_ROOT}/Baseline/OTB/Images)
SET(BASELINE_FILES ${OTB_DATA_ROOT}/Baseline/OTB/Files)
SET(INPUTDATA ${OTB_DATA_ROOT}/Input)
SET(TEMP ${OTBTesting_BINARY_DIR}/Temporary)

SET(APPLICATIONSPATH ${OTB_BINARY_DIR}/bin)

if(WIN32)
  add_definitions(-DWIN32)
endif(WIN32)

set(OTB_WRAPPER_COMMAND_LINE_TESTS ${CXX_TEST_PATH}/otbWrapperCommandLineTests)

# ----------------Command Line Parser tests -----------------------------------
add_test(NAME clTuWrapperCommandLineParserNew
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserNew )
         
add_test(NAME clTvWrapperCommandLineParserTest_GetAtt
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest1
                 "--key"
                 "this is a line test to extract --key name1 name2" )

add_test(NAME clTvWrapperCommandLineParserTest_IsAttExists_Wrong
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest3
                    "--m"
                    " TrainImagesClassifier test --il QB_1_ortho.tif --vd vd .shape " )
  
  
add_test(NAME clTvWrapperCommandLineParserTest_IsAttExists
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest4
                 "--m"
                 " TrainImagesClassifier test --il QB_1_ortho.tif --vd vd .shape --m name")
   
add_test(NAME clTvWrapperCommandLineParserTest_IsAttExistsEnd
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest4
                 "--m"
                 " TrainImagesClassifier test --il QB_1_ortho.tif --vd vd .shape --m name")
    
add_test(NAME clTvWrapperCommandLineParserTest_IsAttExistsEndNoParam
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest4
                 "--m"
                 " TrainImagesClassifier test --il QB_1_ortho.tif --vd vd .shape test --m")
   
add_test(NAME clTvWrapperCommandLineParserTest_GetAttWithoutValue
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest1
                    "--key"
                    "--key" )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_GetAttWithoutValue PROPERTIES WILL_FAIL true)

add_test(NAME clTvWrapperCommandLineParserTest_NoModule
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest2
                 "")
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_NoModule PROPERTIES WILL_FAIL true)

add_test(NAME clTvWrapperCommandLineParserTest_NonAlphaNumModuleName
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	             otbWrapperCommandLineParserTest2
                 "-Re+scale"
                 $<TARGET_FILE_DIR:otbapp_Rescale> )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_NonAlphaNumModuleName PROPERTIES WILL_FAIL true)

add_test(NAME clTvWrapperCommandLineParserTest_GoodModule
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS}
	             otbWrapperCommandLineParserTest2
                 "Rescale"
                 $<TARGET_FILE_DIR:otbapp_Rescale> )

add_test(NAME clTvWrapperCommandLineParserTest_WithKeyNoModule
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest2
                 $<TARGET_FILE_DIR:otbapp_Rescale> )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_WithKeyNoModule PROPERTIES WILL_FAIL true)

add_test(NAME clTvWrapperCommandLineParserTest_WithKeyNonAlphaNumModuleName
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest2
                 "-Re+scale" $<TARGET_FILE_DIR:otbapp_Rescale> )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_WithKeyNonAlphaNumModuleName PROPERTIES WILL_FAIL true)

add_test(NAME clTvWrapperCommandLineParserTest_WithKeyGoodModule 
	     COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest2
                 "Rescale"  $<TARGET_FILE_DIR:otbapp_Rescale>)
add_test(NAME clTvWrapperCommandLineParserTest_NoPath
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest2
                 "Rescale" )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_NoPath PROPERTIES WILL_FAIL true)

add_test(NAME clTvWrapperCommandLineParserTest_WrongPath
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest2
                 "Rescale" "FakePath")
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_WrongPath PROPERTIES WILL_FAIL true)

add_test(NAME clTvWrapperCommandLineParserTest_MultiplePathOneWrong
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest2
                 "Rescale" $<TARGET_FILE_DIR:otbapp_Rescale> "FakePath")
SET_TESTS_PROPERTIES(clTvWrapperCommandLineParserTest_MultiplePathOneWrong PROPERTIES WILL_FAIL true)

add_test(NAME clTvWrapperCommandLineParserTest_MultiplePath
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest2
                 "Rescale" $<TARGET_FILE_DIR:otbapp_Rescale> $<TARGET_FILE_DIR:otbapp_Rescale>)


# ----------------Command Laine Launcher tests -----------------------------------
add_test(NAME clTuWrapperCommandLineLauncherNew
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineLauncherNew )

add_test(NAME clTvWrapperCommandLineLauncherTest
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineLauncherTest
                 "Rescale" $<TARGET_FILE_DIR:otbapp_Rescale>
                 --in ${INPUTDATA}/poupees.tif
                 --out ${TEMP}/clTvWrapperCommandLineLauncherTest.tif
                 --outmin 15
                 --outmax 200 )

add_test(NAME clTvWrapperCommandLineLauncherTest_Help
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineLauncherTest
                 "Rescale" $<TARGET_FILE_DIR:otbapp_Rescale> "--help")
SET_TESTS_PROPERTIES(clTvWrapperCommandLineLauncherTest_Help PROPERTIES WILL_FAIL true)

add_test(NAME clTvWrapperCommandLineLauncherTest_Help2
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineLauncherTest
                 "Rescale" $<TARGET_FILE_DIR:otbapp_Rescale>
                 --in ${INPUTDATA}/poupees.tif
                 --out ${TEMP}/clTvWrapperCommandLineLauncherTest_Help2.tif
                 --outmin 15
                 --outmax 200
                 --help)
SET_TESTS_PROPERTIES(clTvWrapperCommandLineLauncherTest_Help2 PROPERTIES WILL_FAIL true)

add_test(NAME clTvWrapperCommandLineLauncherTest_MissingManParam
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineLauncherTest
                 "Rescale" $<TARGET_FILE_DIR:otbapp_Rescale> )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineLauncherTest_MissingManParam PROPERTIES WILL_FAIL true)

add_test(NAME clTvWrapperCommandLineLauncherTest_MissingDash
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineLauncherTest
                 "Rescale" $<TARGET_FILE_DIR:otbapp_Rescale> -in image1)
SET_TESTS_PROPERTIES(clTvWrapperCommandLineLauncherTest_MissingDash PROPERTIES WILL_FAIL true)

add_test(NAME clTvWrapperCommandLineLauncherTest_DoubleParam
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineLauncherTest
                 "Rescale" $<TARGET_FILE_DIR:otbapp_Rescale> --in image1 --in image2 )
SET_TESTS_PROPERTIES(clTvWrapperCommandLineLauncherTest_DoubleParam PROPERTIES WILL_FAIL true)

add_test(NAME clTvWrapperCommandLineLauncherTest_WrongParam
         COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineLauncherTest
                 "Rescale" $<TARGET_FILE_DIR:otbapp_Rescale> --inn image)
SET_TESTS_PROPERTIES(clTvWrapperCommandLineLauncherTest_WrongParam PROPERTIES WILL_FAIL true)


# --------------------------------------------------------------------
# ----------------Source files CXX -----------------------------------
# --------------------------------------------------------------------
set(Wrapper_Command_Line_SRCS
otbWrapperCommandLineTests.cxx

otbWrapperCommandLineParserTests.cxx
otbWrapperCommandLineLauncherTests.cxx
)

include_directories(${CMAKE_SOURCE_DIR}/Code/Wrappers/CommandLine ${CMAKE_SOURCE_DIR}/Code/Core)
add_executable(otbWrapperCommandLineTests ${Wrapper_Command_Line_SRCS})
target_link_libraries(otbWrapperCommandLineTests OTBIO OTBCommon ITKIO ITKCommon OTBTesting OTBWrapperCommandLine)
{'fraction_non_alphanumeric': 0.09458064516129032, 'fraction_numerical': 0.00567741935483871, 'mean_word_length': 4.485138004246284, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '1782494', 'n_tokens_mistral': 5114, 'n_tokens_neox': 4961, 'n_words': 621}