camitk_application(NO_GUI
		   CEP_NAME CEP_MODELING
                   NEEDS_XSD
                   NEEDS_XERCESC
                   NEEDS_CEP_LIBRARIES pml pmlschema
                   DESCRIPTION "Provides a command line integration test tool for the pml library"
)

#----------
# Testing
#----------
# TODO build one pml file with every tests in it, use it and check that inputFilename-output-pmltest.pml is identical to inputFilename.pml
camitk_init_test(${APPLICATION_TARGET_NAME})
# should pass because pmltest run with no arguments shows usage and exit success
camitk_add_test(PROJECT_NAME ${APPLICATION_TARGET_NAME} TEST_SUFFIX "-")

# should pass because invoking pmltest with a faulty arguments results in printing
# an "Argument error" message (and exit failure)
camitk_add_test(EXECUTABLE_ARGS "-error" 
                PASS_REGULAR_EXPRESSION "Argument errors: "
                PROJECT_NAME ${APPLICATION_TARGET_NAME} TEST_SUFFIX "-")

# should pass because reading a file and writing it back should not modify it (input == output)
if(NOT WIN32)#this test fails on windows7 VM due to missing tweek for -debug
    camitk_add_test(EXECUTABLE_ARGS "-i ${CMAKE_CURRENT_SOURCE_DIR}/cube1.pml"
                    PASS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cube1.pml 
                    PROJECT_NAME ${APPLICATION_TARGET_NAME} TEST_SUFFIX "-")
                    
    camitk_add_test(EXECUTABLE_ARGS "-i ${CMAKE_CURRENT_SOURCE_DIR}/cube2.pml"
                    PASS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cube2.pml 
                    PROJECT_NAME ${APPLICATION_TARGET_NAME} TEST_SUFFIX "-")

    camitk_add_test(EXECUTABLE_ARGS "-i ${CMAKE_CURRENT_SOURCE_DIR}/cube3.pml"
                    PASS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cube3.pml 
                    PROJECT_NAME ${APPLICATION_TARGET_NAME} TEST_SUFFIX "-")

    camitk_add_test(EXECUTABLE_ARGS "-i ${CMAKE_CURRENT_SOURCE_DIR}/cube4.pml"
                    PASS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cube4.pml 
                    PROJECT_NAME ${APPLICATION_TARGET_NAME} TEST_SUFFIX "-")
    
    camitk_add_test(EXECUTABLE_ARGS "-i ${CMAKE_CURRENT_SOURCE_DIR}/customProperty-example.pml"
                    PASS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/customProperty-example.pml 
                    PROJECT_NAME ${APPLICATION_TARGET_NAME} TEST_SUFFIX "-")
                    
    camitk_add_test(EXECUTABLE_ARGS "-i ${CMAKE_CURRENT_SOURCE_DIR}/diaph.pml"
                    PASS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/diaph.pml 
                    PROJECT_NAME ${APPLICATION_TARGET_NAME} TEST_SUFFIX "-")
                    
    camitk_add_test(EXECUTABLE_ARGS "-i ${CMAKE_CURRENT_SOURCE_DIR}/human-trunk.pml"
                    PASS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/human-trunk.pml 
                    PROJECT_NAME ${APPLICATION_TARGET_NAME} TEST_SUFFIX "-")
                    
    camitk_add_test(EXECUTABLE_ARGS "-i ${CMAKE_CURRENT_SOURCE_DIR}/icosahedron.pml"
                    PASS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/icosahedron.pml 
                    PROJECT_NAME ${APPLICATION_TARGET_NAME} TEST_SUFFIX "-")
                                    
    camitk_add_test(EXECUTABLE_ARGS "-i ${CMAKE_CURRENT_SOURCE_DIR}/visage.pml"
                    PASS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/visage.pml 
                    PROJECT_NAME ${APPLICATION_TARGET_NAME} TEST_SUFFIX "-")

endif()
