-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestings.cmake
45 lines (39 loc) · 1.43 KB
/
Testings.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
include_guard(GLOBAL)
include(Colors)
function(ASSERT_NOT_EQUAL)
if(NOT ARGC EQUAL 2)
message(FATAL_ERROR "${BoldRed}Assertion failed : Invalid argument count: ${ARGC}.${Reset}")
endif()
if(NOT ${ARGV0} STREQUAL ${ARGV1})
message(FATAL_ERROR "${BoldRed}Assertion failed : '${ARGV0}' != '${ARGV1}'.${Reset}")
else()
message(STATUS "${BoldGreen}Test passed: '${ARGV0}' == '${ARGV1}'.${Reset}")
endif()
endfunction()
function(ASSERT_EQUAL)
if(NOT ARGC EQUAL 2)
message(FATAL_ERROR "${BoldRed}Assertion failed : Invalid argument count: ${ARGC}.${Reset}")
endif()
if(${ARGV0} STREQUAL ${ARGV1})
message(FATAL_ERROR "${BoldRed}Assertion failed : '${ARGV0}' == '${ARGV1}'.${Reset}")
else()
message(STATUS "${BoldGreen}Test passed: '${ARGV0}' != '${ARGV1}'.${Reset}")
endif()
endfunction()
function(ASSERT_FAILED)
message(FATAL_ERROR "${BoldRed}Assertion failed : ${ARGN}.${Reset}")
endfunction()
function(ASSERT_FILE_NOT_EXISTS FILE)
if(NOT EXISTS ${FILE})
message(FATAL_ERROR "${BoldRed}Assertion failed : File ${FILE} does not exist.${Reset}")
else()
message(STATUS "${BoldGreen}Test passed: File ${FILE} exists.${Reset}")
endif()
endfunction()
function(ASSERT_FILE_EXISTS FILE)
if(EXISTS ${FILE})
message(FATAL_ERROR "${BoldRed}Assertion failed : File ${FILE} exists.${Reset}")
else()
message(STATUS "${BoldGreen}Test passed: File ${FILE} does not exist.${Reset}")
endif()
endfunction()