MATH.cmake 413 B

123456789101112
  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. math_test("100 * 10" 1000)
  8. math_test("100 * 10" 1000 OUTPUT_FORMAT DECIMAL)
  9. math_test("100 * 0xA" 1000 OUTPUT_FORMAT DECIMAL)
  10. math_test("100 * 0xA" 0x3e8 OUTPUT_FORMAT HEXADECIMAL)