# Compare test output against a reference output.

FUNCTION(TEST_AGAINST_REFERENCE TEST_NAME TEST_TIMEOUT)

SET(COMPARISON_SCRIPT ${CMAKE_SOURCE_DIR}/verify_test_output.sh)
SET(TEST_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME})
SET(TEST_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/ini/test_${TEST_NAME}.ini)
SET(TEST_OUTPUT_REF ${CMAKE_CURRENT_SOURCE_DIR}/ref/${TEST_NAME}.ref-out)

ADD_TEST(${TEST_NAME} ${COMPARISON_SCRIPT} ${TEST_OUTPUT_REF} ${TEST_EXECUTABLE} -f ${TEST_INPUT} --no-wall-time)
SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES TIMEOUT ${TEST_TIMEOUT})

ENDFUNCTION()
