You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
413 B
13 lines
413 B
6 years ago
|
macro(math_test expression expected)
|
||
|
math(EXPR evaluated ${expression} ${ARGN})
|
||
|
if (NOT evaluated STREQUAL ${expected})
|
||
|
message(FATAL_ERROR "wrong math result: ${evaluated} != ${expected}")
|
||
|
endif ()
|
||
|
endmacro()
|
||
|
|
||
|
|
||
|
math_test("100 * 10" 1000)
|
||
|
math_test("100 * 10" 1000 OUTPUT_FORMAT DECIMAL)
|
||
|
math_test("100 * 0xA" 1000 OUTPUT_FORMAT DECIMAL)
|
||
|
math_test("100 * 0xA" 0x3e8 OUTPUT_FORMAT HEXADECIMAL)
|