set (SRCS lmltest.cpp)
add_executable(lmltest ${SRCS})
set(LML_LIBRARIES lml ${LIBXML2_LIBRARIES})
target_link_libraries(lmltest ${LML_LIBRARIES})
add_dependencies(lmltest lml)

# Testing
# TODO build one big lml file with every tests in it, use -o and check that output is identical to input
# TODO compare output csv with a static output csv (that it should produce)
add_test(lmltestRun ${CAMITK_BIN_DIR}/lmltest)
add_test(lmlTestCubeIn ${CAMITK_BIN_DIR}/lmltest -i ${CMAKE_CURRENT_SOURCE_DIR}/cube.lml)
# set_tests_properties(lmlTestCubeIn PROPERTIES PASS_REGULAR_EXPRESSION "<?xml version="1.0" encoding="UTF-8"?>
# <!-- physical model load file -->
# <loads xmlns='http://www-timc.imag.fr/load'
#        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
# <load xsi:type="Translation">
#         <appliedTo>0-3</appliedTo>
#         <valueEvent date="0" value="14"/>
#         <direction x="0" y="1" z="0"/>
#         <unit>nm</unit>
# </load>
# 
# <load xsi:type="Force">
#         <appliedTo>4</appliedTo>
#         <valueEvent date="0" value="50"/>
#         <valueEvent date="0.5" value="0"/>
#         <direction x="1" y="0" z="1"/>
#         <unit>kN</unit>
# </load>
# 
# <load xsi:type="Force">
#         <appliedTo>6</appliedTo>
#         <valueEvent date="0.5" value="50"/>
#         <direction x="-1" y="0" z="-1"/>
#         <unit>kN</unit>
# </load>
# 
# </loads>")
add_test(lmlTestCubeOut ${CAMITK_BIN_DIR}/lmltest -i ${CMAKE_CURRENT_SOURCE_DIR}/cube.lml -o lmltestcubeout.lml)
add_test(lmlTestCubeCSV ${CAMITK_BIN_DIR}/lmltest -i ${CMAKE_CURRENT_SOURCE_DIR}/cube.lml -plot lmltestcubeout.csv)
add_test(lmlTestShouldFail ${CAMITK_BIN_DIR}/lmltest -error)
set_tests_properties(lmltestRun lmlTestCubeIn lmlTestCubeOut lmlTestCubeCSV lmlTestShouldFail PROPERTIES LABELS lml)
