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
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
|
|
|
|
|
function(ASSERTION_FAILED)
|
|
|
|
|
message(FATAL_ERROR "assertion failed: ${ARGN}")
|
|
|
|
|
endfunction()
|
2020-04-29 09:18:54 +02:00
|
|
|
|
|
|
|
|
function(ASSERT_EXISTS file)
|
2021-01-06 14:40:33 +01:00
|
|
|
if(NOT EXISTS ${file})
|
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-06 14:40:33 +01:00
|
|
|
if(EXISTS ${file})
|
2020-04-29 09:18:54 +02:00
|
|
|
message(FATAL_ERROR "assertion failed: file ${file} exists")
|
|
|
|
|
endif()
|
|
|
|
|
endfunction()
|