StringTest.cmake.in 4.26 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
set(MD5-BadArg1-RESULT 1)
set(MD5-BadArg1-STDERR "string MD5 requires an output variable")
set(MD5-BadArg2-RESULT 1)
set(MD5-BadArg2-STDERR "string MD5 requires an output variable and an input string")
set(MD5-BadArg4-RESULT 1)
set(MD5-BadArg4-STDERR "string MD5 requires an output variable and an input string")
set(MD5-Works-RESULT 0)
set(MD5-Works-STDERR "10d20ddb981a6202b84aa1ce1cb7fce3")
set(SHA1-Works-RESULT 0)
set(SHA1-Works-STDERR "83f093e04289b21a9415f408ad50be8b57ad2f34")
set(SHA224-Works-RESULT 0)
set(SHA224-Works-STDERR "e995a7789922c4ef9279d94e763c8375934180a51baa7147bc48edf7")
set(SHA256-Works-RESULT 0)
set(SHA256-Works-STDERR "d1c5915d8b71150726a1eef75a29ec6bea8fd1bef6b7299ef8048760b0402025")
set(SHA384-Works-RESULT 0)
set(SHA384-Works-STDERR "1de9560b4e030e02051ea408200ffc55d70c97ac64ebf822461a5c786f495c36df43259b14483bc8d364f0106f4971ee")
set(SHA512-Works-RESULT 0)
set(SHA512-Works-STDERR "3982a1b4e651768bec70ab1fb97045cb7a659f4ba7203d501c52ab2e803071f9d5fd272022df15f27727fc67f8cd022e710e29010b2a9c0b467c111e2f6abf51")
19 20 21 22 23 24 25 26
set(SHA3_224-Works-RESULT 0)
set(SHA3_224-Works-STDERR "4272868085f4f25080681a7712509fd12e16dcda79bd356836dd2100")
set(SHA3_256-Works-RESULT 0)
set(SHA3_256-Works-STDERR "be0df472b6bd474417a166d12f2774f2ef5095e86f0a88ef4c78c703800cfc8a")
set(SHA3_384-Works-RESULT 0)
set(SHA3_384-Works-STDERR "935a17cc708443c1369549483656a4521af03a52e4f3b314566272017ccae03a2c5db838f6d4c156b1dc5c366182481b")
set(SHA3_512-Works-RESULT 0)
set(SHA3_512-Works-STDERR "471a85ed537e8f77f31412a089f22d836054ffa179599f87a5d7568927d8fa236b6793ded8a387d1de92398c967177bcc6361672a722bf736cb0f63a0956d5cf")
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
set(TIMESTAMP-BadArg1-RESULT 1)
set(TIMESTAMP-BadArg1-STDERR "string sub-command TIMESTAMP requires at least one argument")
set(TIMESTAMP-BadArg2-RESULT 1)
set(TIMESTAMP-BadArg2-STDERR "string TIMESTAMP sub-command does not recognize option UTF")
set(TIMESTAMP-BadArg3-RESULT 1)
set(TIMESTAMP-BadArg3-STDERR "string sub-command TIMESTAMP takes at most three arguments")
set(TIMESTAMP-DefaultFormatLocal-RESULT 0)
set(TIMESTAMP-DefaultFormatLocal-STDERR "~[0-9]*-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-6][0-9]~")
set(TIMESTAMP-DefaultFormatUTC-RESULT 0)
set(TIMESTAMP-DefaultFormatUTC-STDERR "~[0-9]*-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-6][0-9]Z~")
set(TIMESTAMP-CustomFormatLocal-RESULT 0)
set(TIMESTAMP-CustomFormatLocal-STDERR "~([0-5][0-9])|60~")
set(TIMESTAMP-CustomFormatUTC-RESULT 0)
set(TIMESTAMP-CustomFormatUTC-STDERR "~([0-5][0-9])|60~")
set(TIMESTAMP-UnknownSpecifier-RESULT 0)
set(TIMESTAMP-UnknownSpecifier-STDERR "~%g~")
set(TIMESTAMP-IncompleteSpecifier-RESULT 0)
set(TIMESTAMP-IncompleteSpecifier-STDERR "~foobar%~")
set(TIMESTAMP-AllSpecifiers-RESULT 0)
set(TIMESTAMP-AllSpecifiers-STDERR "~[0-9]+(;[0-9]+)*~")
47 48
set(TIMESTAMP-MonthWeekNames-RESULT 0)
set(TIMESTAMP-MonthWeekNames-STDERR "~[^%]+;[^%]+~")
49
set(TIMESTAMP-UnixTime-RESULT 0)
50
set(TIMESTAMP-UnixTime-STDERR "~[0-9]+~")
51 52 53 54 55 56 57 58 59 60 61 62

include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
check_cmake_test(String
  MD5-BadArg1
  MD5-BadArg2
  MD5-BadArg4
  MD5-Works
  SHA1-Works
  SHA224-Works
  SHA256-Works
  SHA384-Works
  SHA512-Works
63 64 65 66
  SHA3_224-Works
  SHA3_256-Works
  SHA3_384-Works
  SHA3_512-Works
67 68 69 70 71 72 73 74 75 76
  TIMESTAMP-BadArg1
  TIMESTAMP-BadArg2
  TIMESTAMP-BadArg3
  TIMESTAMP-DefaultFormatLocal
  TIMESTAMP-DefaultFormatUTC
  TIMESTAMP-CustomFormatLocal
  TIMESTAMP-CustomFormatUTC
  TIMESTAMP-UnknownSpecifier
  TIMESTAMP-IncompleteSpecifier
  TIMESTAMP-AllSpecifiers
77
  TIMESTAMP-MonthWeekNames
78
  TIMESTAMP-UnixTime
79 80
  )

81 82 83
# Execute each test listed in StringTestScript.cmake:
#
set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/StringTestScript.cmake")
84
set(number_of_tests_expected 74)
85 86 87 88

include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake")
execute_all_script_tests(${scriptname} number_of_tests_executed)

89 90
string(TIMESTAMP timestamp "[%Y-%m-%d %H:%M:%S] UTC %s" UTC)

91 92 93
# And verify that number_of_tests_executed is at least as many as we know
# about as of this writing...
#
94
message(STATUS "timestamp='${timestamp}'")
95 96 97 98
message(STATUS "scriptname='${scriptname}'")
message(STATUS "number_of_tests_executed='${number_of_tests_executed}'")
message(STATUS "number_of_tests_expected='${number_of_tests_expected}'")

99
if(NOT number_of_tests_executed EQUAL number_of_tests_expected)
100 101
  message(FATAL_ERROR "error: some test cases were skipped")
endif()