summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/math/MATH.cmake
blob: a5f50cd9037c67fc5af4a9cda7e6da05dde18b06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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)