diff options
Diffstat (limited to 'Tests/RunCMake/math/MATH.cmake')
-rw-r--r-- | Tests/RunCMake/math/MATH.cmake | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Tests/RunCMake/math/MATH.cmake b/Tests/RunCMake/math/MATH.cmake new file mode 100644 index 000000000..a5f50cd90 --- /dev/null +++ b/Tests/RunCMake/math/MATH.cmake @@ -0,0 +1,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) |