2009-10-02 22:51:43 +04:00
|
|
|
message(STATUS "testname='${testname}'")
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
if(testname STREQUAL empty) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string()
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL bogus) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(BOGUS)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL random) # pass
|
2009-10-02 22:51:43 +04:00
|
|
|
string(RANDOM r)
|
|
|
|
message(STATUS "r='${r}'")
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL toupper_no_variable) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(TOUPPER)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL ascii_no_variable) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(ASCII)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL ascii_code_too_small) # fail
|
|
|
|
string(ASCII -1 bummer)
|
|
|
|
|
|
|
|
elseif(testname STREQUAL ascii_code_too_large) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(ASCII 288 bummer)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL configure_no_input) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(CONFIGURE)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL configure_no_variable) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(CONFIGURE "this is @testname@")
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL configure_escape_quotes) # pass
|
2009-10-02 22:51:43 +04:00
|
|
|
string(CONFIGURE "this is @testname@" v ESCAPE_QUOTES)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL configure_bogus) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(CONFIGURE "this is @testname@" v ESCAPE_QUOTES BOGUS)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_no_mode) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_match_not_enough_args) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX MATCH)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_matchall_not_enough_args) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX MATCHALL)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_replace_not_enough_args) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX REPLACE)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_bogus_mode) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX BOGUS)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_match_multiple_inputs) # pass
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX MATCH ".*" v input1 input2 input3 input4)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_match_bad_regex) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX MATCH "(.*" v input)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_match_empty_string) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX MATCH "x*" v "")
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_match_no_match) # pass
|
|
|
|
string(REGEX MATCH "xyz" v "abc")
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
|
|
|
elseif(testname STREQUAL regex_matchall_multiple_inputs) # pass
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX MATCHALL "input" v input1 input2 input3 input4)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_matchall_bad_regex) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX MATCHALL "(.*" v input)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_matchall_empty_string) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX MATCHALL "x*" v "")
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_replace_ends_with_backslash) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX REPLACE "input" "output\\" v input1 input2 input3 input4)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_replace_ends_with_escaped_backslash) # pass
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX REPLACE "input" "output\\\\" v input1 input2 input3 input4)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_replace_has_linefeed) # pass
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX REPLACE "input" "output\\n" v input1 input2 input3 input4)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_replace_has_bogus_escape) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX REPLACE "input" "output\\a" v input1 input2 input3 input4)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_replace_bad_regex) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX REPLACE "this (.*" "with that" v input)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_replace_empty_string) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX REPLACE "x*" "that" v "")
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL regex_replace_index_too_small) # fail
|
|
|
|
string(REGEX REPLACE "^this (.*)$" "with \\1 \\-1" v "this input")
|
|
|
|
|
|
|
|
elseif(testname STREQUAL regex_replace_index_too_large) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REGEX REPLACE "^this (.*)$" "with \\1 \\2" v "this input")
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL compare_no_mode) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(COMPARE)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL compare_bogus_mode) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(COMPARE BOGUS)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL compare_not_enough_args) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(COMPARE EQUAL)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL replace_not_enough_args) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REPLACE)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL replace_multiple_inputs) # pass
|
2009-10-02 22:51:43 +04:00
|
|
|
string(REPLACE "input" "output" v input1 input2 input3 input4)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL substring_not_enough_args) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(SUBSTRING)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL substring_begin_too_large) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(SUBSTRING "abcdefg" 25 100 v)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL substring_end_too_large) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(SUBSTRING "abcdefg" 1 100 v)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL substring_begin_less_than_zero) # fail
|
|
|
|
string(SUBSTRING "abcdefg" -2 4 v)
|
|
|
|
|
|
|
|
elseif(testname STREQUAL substring_end_less_than_begin) # fail
|
|
|
|
string(SUBSTRING "abcdefg" 6 3 v)
|
|
|
|
|
|
|
|
elseif(testname STREQUAL length_not_enough_args) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(LENGTH)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL strip_not_enough_args) # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
string(STRIP)
|
|
|
|
|
2009-10-03 20:01:10 +04:00
|
|
|
elseif(testname STREQUAL random_not_enough_args) # fail
|
|
|
|
string(RANDOM)
|
|
|
|
|
|
|
|
elseif(testname STREQUAL random_3_args) # fail
|
|
|
|
string(RANDOM LENGTH 9)
|
|
|
|
|
|
|
|
elseif(testname STREQUAL random_5_args) # fail
|
|
|
|
string(RANDOM LENGTH 9 ALPHABET "aceimnorsuvwxz")
|
|
|
|
|
|
|
|
elseif(testname STREQUAL random_with_length) # pass
|
|
|
|
string(RANDOM LENGTH 9 v)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
|
|
|
elseif(testname STREQUAL random_with_alphabet) # pass
|
|
|
|
string(RANDOM ALPHABET "aceimnorsuvwxz" v)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
|
|
|
elseif(testname STREQUAL random_bad_length) # fail
|
|
|
|
string(RANDOM LENGTH 0 v)
|
|
|
|
|
|
|
|
elseif(testname STREQUAL random_empty_alphabet) # pass
|
|
|
|
string(RANDOM ALPHABET "" v)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
|
|
|
elseif(testname STREQUAL random_with_length_and_alphabet) # pass
|
|
|
|
string(RANDOM LENGTH 9 ALPHABET "aceimnorsuvwxz" v)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
|
|
|
elseif(testname STREQUAL random_with_various_alphabets) # pass
|
|
|
|
# small alphabet
|
|
|
|
string(RANDOM LENGTH 32 ALPHABET "ACGT" v)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
|
|
|
# smaller alphabet
|
|
|
|
string(RANDOM LENGTH 32 ALPHABET "AB" v)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
|
|
|
# smallest alphabet
|
|
|
|
string(RANDOM LENGTH 32 ALPHABET "Z" v)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
|
|
|
# smallest length and alphabet
|
|
|
|
string(RANDOM LENGTH 1 ALPHABET "Q" v)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
|
|
|
# alphabet of many colors - use all the crazy keyboard characters
|
|
|
|
string(RANDOM LENGTH 78 ALPHABET "~`!@#$%^&*()_-+={}[]\\|:\\;'\",.<>/?" v)
|
|
|
|
message(STATUS "v='${v}'")
|
|
|
|
|
|
|
|
else() # fail
|
2009-10-02 22:51:43 +04:00
|
|
|
message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'")
|
|
|
|
|
|
|
|
endif()
|