Files
CPM.cmake/cmake/testing.cmake
Lars Melchior 1ebbac6332 Apply clang-format and cmake-format and add style check workflow (#171)
* apply clang-format and cmake-format and add style check workflow

* add declare package definition

* add additional public methods and rename internals

* change development verison tag to 1.0.0

* rename internal method

* rename public method

* rename test var

* update copyright and fix comment

* typo

* run fix-format

* fix test function names
2021-01-06 14:40:33 +01:00

34 lines
874 B
CMake

function(ASSERT_EQUAL)
if(NOT ARGC EQUAL 2)
message(FATAL_ERROR "assertion failed: invalid argument count: ${ARGC}")
endif()
if(NOT ${ARGV0} STREQUAL ${ARGV1})
message(FATAL_ERROR "assertion failed: '${ARGV0}' != '${ARGV1}'")
else()
message(STATUS "test passed: '${ARGV0}' == '${ARGV1}'")
endif()
endfunction()
function(ASSERT_EMPTY)
if(NOT ARGC EQUAL 0)
message(FATAL_ERROR "assertion failed: input ${ARGC} not empty: '${ARGV}'")
endif()
endfunction()
function(ASSERTION_FAILED)
message(FATAL_ERROR "assertion failed: ${ARGN}")
endfunction()
function(ASSERT_EXISTS file)
if(NOT EXISTS ${file})
message(FATAL_ERROR "assertion failed: file ${file} does not exist")
endif()
endfunction()
function(ASSERT_NOT_EXISTS file)
if(EXISTS ${file})
message(FATAL_ERROR "assertion failed: file ${file} exists")
endif()
endfunction()