2019-06-22 13:31:32 +02:00
|
|
|
function(ASSERT_EQUAL)
|
2021-01-06 14:40:33 +01:00
|
|
|
if(NOT ARGC EQUAL 2)
|
2019-06-22 13:31:32 +02:00
|
|
|
message(FATAL_ERROR "assertion failed: invalid argument count: ${ARGC}")
|
|
|
|
|
endif()
|
|
|
|
|
|
2021-01-06 14:40:33 +01:00
|
|
|
if(NOT ${ARGV0} STREQUAL ${ARGV1})
|
2019-06-22 13:31:32 +02:00
|
|
|
message(FATAL_ERROR "assertion failed: '${ARGV0}' != '${ARGV1}'")
|
2019-10-10 20:13:10 +02:00
|
|
|
else()
|
|
|
|
|
message(STATUS "test passed: '${ARGV0}' == '${ARGV1}'")
|
2019-06-22 13:31:32 +02:00
|
|
|
endif()
|
|
|
|
|
endfunction()
|
2019-10-10 20:13:10 +02:00
|
|
|
|
2021-02-16 11:26:16 +01:00
|
|
|
function(ASSERT_NOT_EQUAL)
|
|
|
|
|
if(NOT ARGC EQUAL 2)
|
|
|
|
|
message(FATAL_ERROR "assertion failed: invalid argument count: ${ARGC}")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(${ARGV0} STREQUAL ${ARGV1})
|
|
|
|
|
message(FATAL_ERROR "assertion failed: '${ARGV0}' == '${ARGV1}'")
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "test passed: '${ARGV0}' != '${ARGV1}'")
|
|
|
|
|
endif()
|
|
|
|
|
endfunction()
|
|
|
|
|
|
2019-10-10 20:13:10 +02:00
|
|
|
function(ASSERT_EMPTY)
|
2021-01-06 14:40:33 +01:00
|
|
|
if(NOT ARGC EQUAL 0)
|
2019-10-10 20:13:10 +02:00
|
|
|
message(FATAL_ERROR "assertion failed: input ${ARGC} not empty: '${ARGV}'")
|
|
|
|
|
endif()
|
|
|
|
|
endfunction()
|
|
|
|
|
|
2021-01-20 13:15:18 +01:00
|
|
|
function(ASSERT_DEFINED KEY)
|
|
|
|
|
if(DEFINED ${KEY})
|
|
|
|
|
message(STATUS "test passed: '${KEY}' is defined")
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "assertion failed: '${KEY}' is not defiend")
|
|
|
|
|
endif()
|
|
|
|
|
endfunction()
|
|
|
|
|
|
2021-02-17 13:41:25 +02:00
|
|
|
function(ASSERT_NOT_DEFINED KEY)
|
|
|
|
|
if(DEFINED ${KEY})
|
|
|
|
|
message(FATAL_ERROR "assertion failed: '${KEY}' is defiend")
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "test passed: '${KEY}' is not defined")
|
|
|
|
|
endif()
|
|
|
|
|
endfunction()
|
|
|
|
|
|
2021-01-20 13:15:18 +01:00
|
|
|
function(ASSERT_TRUTHY KEY)
|
|
|
|
|
if(${${KEY}})
|
|
|
|
|
message(STATUS "test passed: '${KEY}' is set truthy")
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "assertion failed: value of '${KEY}' is not true (${${KEY}})")
|
|
|
|
|
endif()
|
|
|
|
|
endfunction()
|
|
|
|
|
|
2019-10-10 20:13:10 +02:00
|
|
|
function(ASSERTION_FAILED)
|
|
|
|
|
message(FATAL_ERROR "assertion failed: ${ARGN}")
|
|
|
|
|
endfunction()
|
2020-04-29 09:18:54 +02:00
|
|
|
|
|
|
|
|
function(ASSERT_EXISTS file)
|
2021-01-20 13:15:18 +01:00
|
|
|
if(EXISTS ${file})
|
|
|
|
|
message(STATUS "test passed: '${file}' exists")
|
|
|
|
|
else()
|
2020-04-29 09:18:54 +02:00
|
|
|
message(FATAL_ERROR "assertion failed: file ${file} does not exist")
|
|
|
|
|
endif()
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
|
function(ASSERT_NOT_EXISTS file)
|
2021-01-20 13:15:18 +01:00
|
|
|
if(NOT EXISTS ${file})
|
|
|
|
|
message(STATUS "test passed: '${file}' does not exist")
|
|
|
|
|
else()
|
2020-04-29 09:18:54 +02:00
|
|
|
message(FATAL_ERROR "assertion failed: file ${file} exists")
|
|
|
|
|
endif()
|
|
|
|
|
endfunction()
|