diff --git a/Testing/Code/Wrappers/CommandLine/CMakeLists.txt b/Testing/Code/Wrappers/CommandLine/CMakeLists.txt index 67315564d2ea32bb0f4109e30ee7f86f45dbb472..89d288f8d2f9917330d52c1fd5cd1e4c53364a73 100644 --- a/Testing/Code/Wrappers/CommandLine/CMakeLists.txt +++ b/Testing/Code/Wrappers/CommandLine/CMakeLists.txt @@ -23,6 +23,31 @@ add_test(clTvWrapperCommandLineParserTest_GetAtt ${OTB_WRAPPER_COMMAND_LINE_TEST "this is a line test to extract --key name1 name2" ) +add_test(clTvWrapperCommandLineParserTest_IsAttExists_Wrong ${OTB_WRAPPER_COMMAND_LINE_TESTS} + otbWrapperCommandLineParserTest3 + "--m" + " TrainImagesClassifier --il QB_1_ortho.tif --vd vd .shape --modulePath test" + ) + + +add_test(clTvWrapperCommandLineParserTest_IsAttExists ${OTB_WRAPPER_COMMAND_LINE_TESTS} + otbWrapperCommandLineParserTest4 + "--m" + " TrainImagesClassifier --il QB_1_ortho.tif --vd vd .shape --m name --modulePath test" + ) + +add_test(clTvWrapperCommandLineParserTest_IsAttExistsEnd ${OTB_WRAPPER_COMMAND_LINE_TESTS} + otbWrapperCommandLineParserTest4 + "--m" + " TrainImagesClassifier --il QB_1_ortho.tif --vd vd .shape --modulePath test --m name" + ) + +add_test(clTvWrapperCommandLineParserTest_IsAttExistsEndNoParam ${OTB_WRAPPER_COMMAND_LINE_TESTS} + otbWrapperCommandLineParserTest4 + "--m" + " TrainImagesClassifier --il QB_1_ortho.tif --vd vd .shape --modulePath test --m" + ) + add_test(clTvWrapperCommandLineParserTest_GetAttWithoutValue ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest1 "--key" diff --git a/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineParserTests.cxx b/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineParserTests.cxx index 441c9d13658d130d8b4d344eb5e6c21916c74a30..4b5a15850a74700e1f98e29dff5a490d6bf2af09 100644 --- a/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineParserTests.cxx +++ b/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineParserTests.cxx @@ -114,5 +114,26 @@ int otbWrapperCommandLineParserTest2(int argc, char* argv[]) return CheckReturn(res); } +int otbWrapperCommandLineParserTest3(int argc, char* argv[]) +{ + ParserType::Pointer parser = ParserType::New(); + + if (parser->IsAttributExists(argv[1], argv[2])) + { + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} +int otbWrapperCommandLineParserTest4(int argc, char* argv[]) +{ + ParserType::Pointer parser = ParserType::New(); + + if (parser->IsAttributExists(argv[1], argv[2])) + { + return EXIT_SUCCESS; + } + return EXIT_FAILURE; +} + diff --git a/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineTests.cxx b/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineTests.cxx index c00478d5daadf062ea8ec13f1b49063c96e3012c..f107b149d43e48aae0b6977e4aeadf396d7748dd 100644 --- a/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineTests.cxx +++ b/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineTests.cxx @@ -27,6 +27,8 @@ void RegisterTests() REGISTER_TEST(otbWrapperCommandLineParserNew); REGISTER_TEST(otbWrapperCommandLineParserTest1); REGISTER_TEST(otbWrapperCommandLineParserTest2); + REGISTER_TEST(otbWrapperCommandLineParserTest3); + REGISTER_TEST(otbWrapperCommandLineParserTest4); REGISTER_TEST(otbWrapperCommandLineLauncherNew); REGISTER_TEST(otbWrapperCommandLineLauncherTest); }