You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cmake/Tests/RunCMake/list/TRANSFORM-TOUPPER.cmake

49 lines
1.9 KiB

set(mylist alpha bravo charlie delta)
list(TRANSFORM mylist TOUPPER OUTPUT_VARIABLE output)
if (NOT output STREQUAL "ALPHA;BRAVO;CHARLIE;DELTA")
message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"ALPHA;BRAVO;CHARLIE;DELTA\"")
endif()
unset(output)
list(TRANSFORM mylist TOUPPER AT 1 3 OUTPUT_VARIABLE output)
if (NOT output STREQUAL "alpha;BRAVO;charlie;DELTA")
message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"alpha;BRAVO;charlie;DELTA\"")
endif()
unset(output)
list(TRANSFORM mylist TOUPPER AT 1 -2 OUTPUT_VARIABLE output)
if (NOT output STREQUAL "alpha;BRAVO;CHARLIE;delta")
message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"alpha;BRAVO;CHARLIE;delta\"")
endif()
unset(output)
list(TRANSFORM mylist TOUPPER FOR 1 2 OUTPUT_VARIABLE output)
if (NOT output STREQUAL "alpha;BRAVO;CHARLIE;delta")
message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"alpha;BRAVO;CHARLIE;delta\"")
endif()
unset(output)
list(TRANSFORM mylist TOUPPER FOR 1 -1 OUTPUT_VARIABLE output)
if (NOT output STREQUAL "alpha;BRAVO;CHARLIE;DELTA")
message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"alpha;BRAVO;CHARLIE;DELTA\"")
endif()
unset(output)
list(TRANSFORM mylist TOUPPER FOR 0 -1 2 OUTPUT_VARIABLE output)
if (NOT output STREQUAL "ALPHA;bravo;CHARLIE;delta")
message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"ALPHA;bravo;CHARLIE;delta\"")
endif()
unset(output)
list(TRANSFORM mylist TOUPPER REGEX "(r|t)a" OUTPUT_VARIABLE output)
if (NOT output STREQUAL "alpha;BRAVO;charlie;DELTA")
message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${output}\", expected is \"alpha;BRAVO;charlie;DELTA\"")
endif()
unset(output)
list(TRANSFORM mylist TOUPPER REGEX "(r|t)a")
if (NOT mylist STREQUAL "alpha;BRAVO;charlie;DELTA")
message (FATAL_ERROR "TRANSFORM(TOUPPER) is \"${mylist}\", expected is \"alpha;BRAVO;charlie;DELTA\"")
endif()