configure_file("${PROJECT_SOURCE_DIR}/mfront/tests/behaviours/references/PolyCrystalsAngles.txt"
    PolyCrystalsAngles.txt @ONLY)
configure_file("${PROJECT_SOURCE_DIR}/mfront/tests/behaviours/references/PolyCrystalsAngles-30.txt"
    PolyCrystalsAngles-30.txt @ONLY)

macro(test_uanderson test_arg)
  set(_NO_XML_OUTPUT )
  set(_WILL_FAIL )
  foreach(_ARG ${ARGN})
    if ( ${_ARG} MATCHES NO_XML_OUTPUT )
      set ( _NO_XML_OUTPUT ON)
    elseif ( ${_ARG} MATCHES WILL_FAIL)
      set ( _WILL_FAIL ON)
    else()
      message(FATAL_ERROR "test_uanderson: unsupported option '${_ARG}'")
    endif()
  endforeach(_ARG ${ARGN})
  if(CMAKE_CONFIGURATION_TYPES)
    foreach(conf ${CMAKE_CONFIGURATION_TYPES})
      set(file "uanderson${test_arg}-${conf}.mtest")
      get_property(MFrontCastemBehavioursBuildPath TARGET MFrontCastemBehaviours PROPERTY LOCATION_${conf})
      get_property(MFrontMaterialPropertiesCastemBuildPath TARGET MFrontMaterialProperties-castem PROPERTY LOCATION_${conf})
      configure_file(uanderson${test_arg}.mtest.in
	${file} @ONLY)
      if(_NO_XML_OUTPUT)
	add_test(NAME uanderson${test_arg}_${conf}_mtest
	  COMMAND mtest --verbose=level0 --xml-output=false --result-file-output=false ${file}
	  CONFIGURATIONS ${conf})
      else(_NO_XML_OUTPUT)
	add_test(NAME uanderson${test_arg}_${conf}_mtest
	  COMMAND mtest --verbose=level0 --xml-output=true --result-file-output=false ${file}
	  CONFIGURATIONS ${conf})
      endif(_NO_XML_OUTPUT)
      if(_WILL_FAIL)
	set_tests_properties(uanderson${test_arg}_${conf}_mtest
	  PROPERTIES WILL_FAIL true)
      endif(_WILL_FAIL)
      if((CMAKE_HOST_WIN32) AND (NOT MSYS))
        set_property(TEST uanderson${test_arg}_${conf}_mtest
          PROPERTY DEPENDS "MFrontCastemBehaviours MFrontMaterialProperties-castem mtest"
	  PROPERTY ENVIRONMENT "PATH=$<TARGET_FILE_DIR:TFELMTest>\;$<TARGET_FILE_DIR:TFELMFront>\;$<TARGET_FILE_DIR:MFrontLogStream>\;$<TARGET_FILE_DIR:TFELMaterial>\;$<TARGET_FILE_DIR:TFELNUMODIS>\;$<TARGET_FILE_DIR:TFELMathParser>\;$<TARGET_FILE_DIR:TFELGlossary>\;$<TARGET_FILE_DIR:TFELSystem>\;$<TARGET_FILE_DIR:TFELUtilities>\;$<TARGET_FILE_DIR:TFELException>\;$<TARGET_FILE_DIR:TFELTests>\;$<TARGET_FILE_DIR:TFELConfig>\;$<TARGET_FILE_DIR:TFELUnicodeSupport>\;$ENV{PATH}")
      elseif((CMAKE_HOST_WIN32) AND (NOT MSYS))
        set_property(TEST uanderson${test_arg}_${conf}_mtest
          PROPERTY DEPENDS "MFrontCastemBehaviours MFrontMaterialProperties-castem mtest")
      endif((CMAKE_HOST_WIN32) AND (NOT MSYS))
      if(TFEL_APPEND_SUFFIX)
	install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${file}
	  DESTINATION "share/doc/mfront-${TFEL_SUFFIX}/tests/behaviours/uanderson"
	  CONFIGURATIONS ${conf}
	  COMPONENT mtest)
      else(TFEL_APPEND_SUFFIX)
	install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${file}
	  DESTINATION "share/doc/mfront/tests/behaviours/uanderson"
	  CONFIGURATIONS ${conf}
	  COMPONENT mtest)
      endif(TFEL_APPEND_SUFFIX)
    endforeach(conf ${CMAKE_CONFIGURATION_TYPES})
  else(CMAKE_CONFIGURATION_TYPES)
    get_property(MFrontCastemBehavioursBuildPath TARGET MFrontCastemBehaviours PROPERTY LOCATION_${conf})
    get_property(MFrontMaterialPropertiesCastemBuildPath TARGET MFrontMaterialProperties-castem PROPERTY LOCATION_${conf})
    configure_file(uanderson${test_arg}.mtest.in
      uanderson${test_arg}.mtest @ONLY)
    if(_NO_XML_OUTPUT)
      add_test(NAME uanderson${test_arg}_mtest
	COMMAND mtest --verbose=level0 --xml-output=false --result-file-output=false uanderson${test_arg}.mtest)
    else(_NO_XML_OUTPUT)
      add_test(NAME uanderson${test_arg}_mtest
	COMMAND mtest --verbose=level0 --xml-output=true --result-file-output=false uanderson${test_arg}.mtest)
    endif(_NO_XML_OUTPUT)
    if(_WILL_FAIL)
      set_tests_properties(uanderson${test_arg}_mtest
	PROPERTIES WILL_FAIL true)
    endif(_WILL_FAIL)
    set_property(TEST uanderson${test_arg}_mtest
      PROPERTY DEPENDS "MFrontCastemBehaviours MFrontMaterialProperties-castem mtest")
    if(TFEL_APPEND_SUFFIX)
      install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uanderson${test_arg}.mtest
	DESTINATION "share/doc/mfront-${TFEL_SUFFIX}/tests/behaviours/uanderson"
	COMPONENT mtest)
    else(TFEL_APPEND_SUFFIX)
      install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uanderson${test_arg}.mtest
	DESTINATION "share/doc/mfront/tests/behaviours/uanderson"
	COMPONENT mtest)
    endif(TFEL_APPEND_SUFFIX)
  endif(CMAKE_CONFIGURATION_TYPES)
endmacro(test_uanderson)

test_uanderson(generalizedmaxwell)
test_uanderson(ddif2)
test_uanderson(ddif2-2)
test_uanderson(ddif2-3)
test_uanderson(ddif2-4)
test_uanderson(lorentz)
test_uanderson(lorentz2)
test_uanderson(mazars)
test_uanderson(mazars2)
test_uanderson(druckerprager)
test_uanderson(druckerprager2)
test_uanderson(norton)
test_uanderson(norton2)
test_uanderson(nortonrk2)
test_uanderson(nortonrk3)
test_uanderson(nortonrk4)
test_uanderson(implicitnorton)
test_uanderson(implicitnorton2)
test_uanderson(implicitnorton3)
test_uanderson(implicitnorton-planestress)
test_uanderson(implicitnorton-planestress2)
test_uanderson(implicitnorton-levenbergmarquardt)
test_uanderson(implicitnorton4-planestress)
test_uanderson(implicitorthotropiccreep2-planestress)
test_uanderson(stressrelaxation)
test_uanderson(norton-euler)
test_uanderson(norton-rk2)
test_uanderson(norton-rk4)
test_uanderson(orthotropiccreep)
test_uanderson(orthotropiccreep-rk42)
test_uanderson(orthotropiccreep-rkCastem)
test_uanderson(strainhardeningcreep)
test_uanderson(plasticity)
test_uanderson(plasisocin)
test_uanderson(viscoplasisocin)
test_uanderson(chaboche)
test_uanderson(chaboche2)
test_uanderson(viscochaboche)
test_uanderson(monocrystal)
test_uanderson(monocrystal-2)
test_uanderson(implicitmonocrystal)
test_uanderson(implicitmonocrystal-2)
test_uanderson(monocrystal_dd_cfc)
test_uanderson(monocrystal_dd_cfc_numericaljacobian)
test_uanderson(monocrystal_dd_cfc_irradiation)
test_uanderson(monocrystal_dd_cc)
test_uanderson(monocrystal_dd_cc_numericaljacobian)
test_uanderson(monocrystal_dd_cc_irradiation)
test_uanderson(monocrystal_dd_cc_irradiation_numericaljacobian)
test_uanderson(polycrystals)
test_uanderson(polycrystals_dd_cc)
test_uanderson(polycrystals_dd_cfc)
test_uanderson(hayhurst)
test_uanderson(implicithayhurst)
test_uanderson(gurson)
test_uanderson(gursontvergaardneedlemanplasticflow)
test_uanderson(gursontvergaardneedlemanviscoplasticflow)
test_uanderson(ellipticcreep)
test_uanderson(burger)
test_uanderson(ageingburger)
test_uanderson(tvergaard)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-sig11-1D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-sig22-1D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-sig33-1D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-sig11-2D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-sig22-2D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-sig33-2D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-sig11-3D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-sig22-3D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-sig33-3D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-1-1D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-2-1D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-3-1D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-1-2D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-2-2D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-3-2D)
test_uanderson(saintvenantkirchhoffelasticity-shear-1-2D)
test_uanderson(saintvenantkirchhoffelasticity-shear-2-2D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-1-3D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-2-3D)
test_uanderson(saintvenantkirchhoffelasticity-uniaxialloading-3-3D)
test_uanderson(saintvenantkirchhoffelasticity-shear-1-3D)
test_uanderson(saintvenantkirchhoffelasticity-shear-2-3D)
test_uanderson(saintvenantkirchhoffelasticity-shear-3-3D)
test_uanderson(saintvenantkirchhoffelasticity-shear-4-3D)
test_uanderson(saintvenantkirchhoffelasticity-shear-5-3D)
test_uanderson(saintvenantkirchhoffelasticity-shear-6-3D)
test_uanderson(elasticity_frst-uniaxialloading-1-1D)
test_uanderson(elasticity_frst-uniaxialloading-2-1D)
test_uanderson(elasticity_frst-uniaxialloading-3-1D)
test_uanderson(elasticity_frst-uniaxialloading-1-2D)
test_uanderson(elasticity_frst-uniaxialloading-2-2D)
test_uanderson(elasticity_frst-uniaxialloading-3-2D)
test_uanderson(elasticity_frst-shear-1-2D)
test_uanderson(elasticity_frst-shear-2-2D)
test_uanderson(elasticity_frst-uniaxialloading-1-3D)
test_uanderson(elasticity_frst-uniaxialloading-2-3D)
test_uanderson(elasticity_frst-uniaxialloading-3-3D)
test_uanderson(elasticity_frst-shear-1-3D)
test_uanderson(elasticity_frst-shear-2-3D)
test_uanderson(elasticity_frst-shear-3-3D)
test_uanderson(elasticity_frst-shear-4-3D)
test_uanderson(elasticity_frst-shear-5-3D)
test_uanderson(elasticity_frst-shear-6-3D)
test_uanderson(finiterotationsmallstrainelasticity-uniaxialloading-1-1D)
test_uanderson(finiterotationsmallstrainelasticity-uniaxialloading-2-1D)
test_uanderson(finiterotationsmallstrainelasticity-uniaxialloading-3-1D)
test_uanderson(finiterotationsmallstrainelasticity-uniaxialloading-1-2D)
test_uanderson(finiterotationsmallstrainelasticity-uniaxialloading-2-2D)
test_uanderson(finiterotationsmallstrainelasticity-uniaxialloading-3-2D)
test_uanderson(finiterotationsmallstrainelasticity-shear-1-2D)
test_uanderson(finiterotationsmallstrainelasticity-shear-2-2D)
test_uanderson(finiterotationsmallstrainelasticity-uniaxialloading-1-3D)
test_uanderson(finiterotationsmallstrainelasticity-uniaxialloading-2-3D)
test_uanderson(finiterotationsmallstrainelasticity-uniaxialloading-3-3D)
test_uanderson(finiterotationsmallstrainelasticity-shear-1-3D)
test_uanderson(finiterotationsmallstrainelasticity-shear-2-3D)
test_uanderson(finiterotationsmallstrainelasticity-shear-3-3D)
test_uanderson(finiterotationsmallstrainelasticity-shear-4-3D)
test_uanderson(finiterotationsmallstrainelasticity-shear-5-3D)
test_uanderson(finiterotationsmallstrainelasticity-shear-6-3D)
test_uanderson(finiterotationsmallstrainelasticity2-uniaxialloading-1-1D)
test_uanderson(finiterotationsmallstrainelasticity2-uniaxialloading-2-1D)
test_uanderson(finiterotationsmallstrainelasticity2-uniaxialloading-3-1D)
test_uanderson(finiterotationsmallstrainelasticity2-uniaxialloading-1-2D)
test_uanderson(finiterotationsmallstrainelasticity2-uniaxialloading-2-2D)
test_uanderson(finiterotationsmallstrainelasticity2-uniaxialloading-3-2D)
test_uanderson(finiterotationsmallstrainelasticity2-shear-1-2D)
test_uanderson(finiterotationsmallstrainelasticity2-shear-2-2D)
test_uanderson(finiterotationsmallstrainelasticity2-uniaxialloading-1-3D)
test_uanderson(finiterotationsmallstrainelasticity2-uniaxialloading-2-3D)
test_uanderson(finiterotationsmallstrainelasticity2-uniaxialloading-3-3D)
test_uanderson(finiterotationsmallstrainelasticity2-shear-1-3D)
test_uanderson(finiterotationsmallstrainelasticity2-shear-2-3D)
test_uanderson(finiterotationsmallstrainelasticity2-shear-3-3D)
test_uanderson(finiterotationsmallstrainelasticity2-shear-4-3D)
test_uanderson(finiterotationsmallstrainelasticity2-shear-5-3D)
test_uanderson(finiterotationsmallstrainelasticity2-shear-6-3D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity-uniaxialloading-1-1D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity-uniaxialloading-1-2D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity-uniaxialloading-1-3D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity-uniaxialloading-2-1D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity-uniaxialloading-2-2D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity-uniaxialloading-2-3D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity-uniaxialloading-3-1D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity-uniaxialloading-3-2D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity-uniaxialloading-3-3D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity-uniaxialloading-1-planestress)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity-uniaxialloading-3-planestress)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity2-uniaxialloading-1-1D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity2-uniaxialloading-1-2D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity2-uniaxialloading-1-3D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity2-uniaxialloading-2-1D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity2-uniaxialloading-2-2D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity2-uniaxialloading-2-3D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity2-uniaxialloading-3-1D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity2-uniaxialloading-3-2D)
test_uanderson(mieheapellambrechtlogarithmicstrainelasticity2-uniaxialloading-3-3D)
test_uanderson(elasticity_log1D-uniaxialloading-1-1D)
test_uanderson(elasticity_log1D-uniaxialloading-2-1D)
test_uanderson(elasticity_log1D-uniaxialloading-3-1D)
test_uanderson(norton_log1D-uniaxialloading-1-1D)
test_uanderson(norton_log1D-uniaxialloading-2-1D)
test_uanderson(norton_log1D-uniaxialloading-3-1D)
test_uanderson(elasticity_LogarithmicStrain1DWrapper-uniaxialloading-1-1D)
test_uanderson(elasticity_LogarithmicStrain1DWrapper-uniaxialloading-2-1D)
test_uanderson(elasticity_LogarithmicStrain1DWrapper-uniaxialloading-3-1D)
test_uanderson(elasticity_LogarithmicStrain1DWrapper-thermalstrain)
test_uanderson(elasticity_LogarithmicStrain1DWrapper-thermalstrain2)
test_uanderson(norton_LogarithmicStrain1DWrapper-uniaxialloading-1-1D)
test_uanderson(norton_LogarithmicStrain1DWrapper-uniaxialloading-2-1D)
test_uanderson(norton_LogarithmicStrain1DWrapper-uniaxialloading-3-1D)
test_uanderson(elasticity_malls-uniaxialloading-1-1D)
test_uanderson(elasticity_malls-uniaxialloading-1-2D)
test_uanderson(elasticity_malls-uniaxialloading-1-3D)
test_uanderson(elasticity_malls-uniaxialloading-2-1D)
test_uanderson(elasticity_malls-uniaxialloading-2-2D)
test_uanderson(elasticity_malls-uniaxialloading-2-3D)
test_uanderson(elasticity_malls-uniaxialloading-3-1D)
test_uanderson(elasticity_malls-uniaxialloading-3-2D)
test_uanderson(elasticity_malls-uniaxialloading-3-3D)
test_uanderson(mieheapellambrechtlogarithmicstrainnortoncreep-uniaxialloading-1-1D)
test_uanderson(mieheapellambrechtlogarithmicstrainnortoncreep-uniaxialloading-2-1D)
test_uanderson(mieheapellambrechtlogarithmicstrainnortoncreep-uniaxialloading-3-1D)
test_uanderson(mieheapellambrechtlogarithmicstrainnortoncreep-uniaxialloading-1-2D)
test_uanderson(mieheapellambrechtlogarithmicstrainnortoncreep-uniaxialloading-2-2D)
test_uanderson(mieheapellambrechtlogarithmicstrainnortoncreep-uniaxialloading-3-2D)
test_uanderson(mieheapellambrechtlogarithmicstrainnortoncreep-uniaxialloading-1-3D)
test_uanderson(mieheapellambrechtlogarithmicstrainnortoncreep-uniaxialloading-2-3D)
test_uanderson(mieheapellambrechtlogarithmicstrainnortoncreep-uniaxialloading-3-3D)
test_uanderson(incompressiblemooneyrivlinbehaviour)
test_uanderson(incompressibleplanestressgornetdesmoratbehavioursheartesting)
test_uanderson(incompressibleplanestressgornetdesmoratbehaviouruniaxialtesting)
test_uanderson(compressibleneohookeanbehaviour)
test_uanderson(incompressibleplanestressmooneyrivlinbehaviouruniaxialtesting)
test_uanderson(incompressibleplanestressgornetdesmoratbehaviourbiaxialtesting)
test_uanderson(implicitsimomieheelastoplasticity)
test_uanderson(T91-satohtest)
test_uanderson(T91-viscositytest)
test_uanderson(finitestrainsinglecrystal-001)
test_uanderson(finitestrainsinglecrystal-012)
test_uanderson(finitestrainsinglecrystal-012-2)
test_uanderson(finitestrainsinglecrystal-159)
test_uanderson(finitestrainsinglecrystal_numericaljacobian-001)
test_uanderson(finitestrainsinglecrystal_numericaljacobian-012)
test_uanderson(finitestrainsinglecrystal_numericaljacobian-012-2)
test_uanderson(finitestrainsinglecrystal_numericaljacobian-159)
test_uanderson(finitestrainsinglecrystal2-001)
test_uanderson(anistropiclemaitreviscoplasticbehaviour)
test_uanderson(tssf)

