program ESMF_ArraySMMFromFileUTest
!==============================================================================
!BOP
! !PROGRAM: ESMF_ArraySMMFromFileUTest - Tests ArraySMMFromFile()
!
! !DESCRIPTION:
!
!-----------------------------------------------------------------------------
! !USES:
use ESMF_TestMod ! test methods
use ESMF
use ESMF_ArraySMMFromFileUTestMod
implicit none
!------------------------------------------------------------------------------
! The following line turns the CVS identifier string into a printable variable.
character(*), parameter :: version = &
'$Id$'
!------------------------------------------------------------------------------
!-------------------------------------------------------------------------
!=========================================================================
character(ESMF_MAXSTR) :: failMsg
character(ESMF_MAXSTR) :: name
character(len=*), parameter :: srcFile = 'data/T42_grid.nc'
character(len=*), parameter :: dstFile = 'data/T42_grid.nc'
character(len=*), parameter :: weightFile = 'test_smm_from_file_weights.nc'
integer :: rc
integer :: result = 0
!-------------------------------------------------------------------------------
! The unit tests are divided into Sanity and Exhaustive. The Sanity tests are
! always run. When the environment variable, EXHAUSTIVE, is set to ON then
! the EXHAUSTIVE and sanity tests both run. If the EXHAUSTIVE variable is set
! to OFF, then only the sanity unit tests.
! Special strings (Non-exhaustive and exhaustive) have been
! added to allow a script to count the number and types of unit tests.
!-------------------------------------------------------------------------------
!------------------------------------------------------------------------
call ESMF_TestStart(ESMF_SRCLINE, rc=rc) ! calls ESMF_Initialize() internally
if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)
!------------------------------------------------------------------------
!------------------------------------------------------------------------
!NEX_UTest
write(name, *) "ESMF_ArraySMMFromFile Unit Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
#ifdef ESMF_NETCDF
call test_smm_from_file(srcFile, dstFile, weightFile, &
ESMF_RWGCHECKMETHOD_ARRAY, rc)
#else
rc = ESMF_SUCCESS
#endif
call ESMF_Test((rc .eq. ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
! Must abort to prevent possible hanging due to communications.
if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)
!------------------------------------------------------------------------
!------------------------------------------------------------------------
!NEX_UTest
write(name, *) "ESMF_FieldSMMFromFile Unit Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
#ifdef ESMF_NETCDF
call test_smm_from_file(srcFile, dstFile, weightFile, &
ESMF_RWGCHECKMETHOD_ARRAY, rc)
#else
rc = ESMF_SUCCESS
#endif
call ESMF_Test((rc .eq. ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
! Must abort to prevent possible hanging due to communications.
if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)
!------------------------------------------------------------------------
call ESMF_TestEnd(ESMF_SRCLINE) ! calls ESMF_Finalize() internally
end program ESMF_ArraySMMFromFileUTest