Debian Codegraph @

Tests/RunCMake/math/MATH.cmake

raw
1 macro(math_test expression expected)
2 math(EXPR evaluated ${expression} ${ARGN})
3 if (NOT evaluated STREQUAL ${expected})
4 message(FATAL_ERROR "wrong math result: ${evaluated} != ${expected}")
5 endif ()
6 endmacro()
7
8
9 math_test("100 * 10" 1000)
10 math_test("100 * 10" 1000 OUTPUT_FORMAT DECIMAL)
11 math_test("100 * 0xA" 1000 OUTPUT_FORMAT DECIMAL)
12 math_test("100 * 0xA" 0x3e8 OUTPUT_FORMAT HEXADECIMAL)