program ESMF_StdCompMethodsUTest
!------------------------------------------------------------------------------
#include "ESMF_Macros.inc"
!==============================================================================
!BOP
! !PROGRAM: ESMF_VMComponentUTest - Unit test for VM/Component interaction
!
! !DESCRIPTION:
!
! The code in this file drives the F90 VM/Component test.
!
!-----------------------------------------------------------------------------
! !USES:
use ESMF_TestMod ! test methods
use ESMF
use ESMF_StdCompMethods_mod
implicit none
!------------------------------------------------------------------------------
! The following line turns the CVS identifier string into a printable variable.
character(*), parameter :: version = &
'$Id$'
!------------------------------------------------------------------------------
! cumulative result: count failures; no failures equals "all pass"
integer :: result = 0
! individual test failure message
character(ESMF_MAXSTR) :: failMsg
character(ESMF_MAXSTR) :: name
! local variables
integer:: i, j, rc
type(ESMF_VM):: vm
type(ESMF_GridComp):: gcomp
type(ESMF_CplComp):: cplcomp
!------------------------------------------------------------------------------
! 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
! 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)
if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)
! Get global VM and print info
call ESMF_VMGetGlobal(vm, rc=rc)
call ESMF_VMPrint(vm)
! - Gridded Component Tests -----------------------------------------------
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component Create() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
gcomp = ESMF_GridCompCreate(name='My gridded component', rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component SetVM() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_GridCompSetVM(gcomp, userRoutine=gcomp_setvm, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component SetServices() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_GridCompSetServices(gcomp, userRoutine=gcomp_register, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component Initialize() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_GridCompInitialize(gcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component Initialize() Test - with timeout"
write(failMsg, *) "Did return ESMF_SUCCESS"
call ESMF_GridCompInitialize(gcomp, timeout=10, rc=rc)
call ESMF_Test((rc.ne.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component Run() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_GridCompRun(gcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component Run() Test - with timeout"
write(failMsg, *) "Did return ESMF_SUCCESS"
call ESMF_GridCompRun(gcomp, timeout=10, rc=rc)
call ESMF_Test((rc.ne.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component Finalize() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_GridCompFinalize(gcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component Finalize() Test - with timeout"
write(failMsg, *) "Did return ESMF_SUCCESS"
call ESMF_GridCompFinalize(gcomp, timeout=10, rc=rc)
call ESMF_Test((rc.ne.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component WriteRestart() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_GridCompWriteRestart(gcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component WriteRestart() Test - with timeout"
write(failMsg, *) "Did return ESMF_SUCCESS"
call ESMF_GridCompWriteRestart(gcomp, timeout=10, rc=rc)
call ESMF_Test((rc.ne.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component ReadRestart() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_GridCompReadRestart(gcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component ReadRestart() Test - with timeout"
write(failMsg, *) "Did return ESMF_SUCCESS"
call ESMF_GridCompReadRestart(gcomp, timeout=10, rc=rc)
call ESMF_Test((rc.ne.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Gridded Component Destroy() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_GridCompDestroy(gcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
! - Coupler Component Tests w/ cplcomp_setvm1 -----------------------------
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component Create() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
cplcomp = ESMF_CplCompCreate(name='My coupler component', rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component SetVM() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompSetVM(cplcomp, userRoutine=cplcomp_setvm1, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component SetServices() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompSetServices(cplcomp, userRoutine=cplcomp_register, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component Initialize() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompInitialize(cplcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component Initialize() Test - with timeout"
write(failMsg, *) "Did return ESMF_SUCCESS"
call ESMF_CplCompInitialize(cplcomp, timeout=10, rc=rc)
call ESMF_Test((rc.ne.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component Run() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompRun(cplcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component Run() Test - with timeout"
write(failMsg, *) "Did return ESMF_SUCCESS"
call ESMF_CplCompRun(cplcomp, timeout=10, rc=rc)
call ESMF_Test((rc.ne.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component Finalize() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompFinalize(cplcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component Finalize() Test - with timeout"
write(failMsg, *) "Did return ESMF_SUCCESS"
call ESMF_CplCompFinalize(cplcomp, timeout=10, rc=rc)
call ESMF_Test((rc.ne.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component WriteRestart() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompWriteRestart(cplcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component WriteRestart() Test - with timeout"
write(failMsg, *) "Did return ESMF_SUCCESS"
call ESMF_CplCompWriteRestart(cplcomp, timeout=10, rc=rc)
call ESMF_Test((rc.ne.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component ReadRestart() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompReadRestart(cplcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component ReadRestart() Test - with timeout"
write(failMsg, *) "Did return ESMF_SUCCESS"
call ESMF_CplCompReadRestart(cplcomp, timeout=10, rc=rc)
call ESMF_Test((rc.ne.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component Destroy() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompDestroy(cplcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
! - Coupler Component Tests w/ cplcomp_setvm2 -----------------------------
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component Create() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
cplcomp = ESMF_CplCompCreate(name='My coupler component', rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component SetVM() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompSetVM(cplcomp, userRoutine=cplcomp_setvm2, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component SetServices() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompSetServices(cplcomp, userRoutine=cplcomp_register, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component Initialize() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompInitialize(cplcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component Run() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompRun(cplcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component Finalize() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompFinalize(cplcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component WriteRestart() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompWriteRestart(cplcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component ReadRestart() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompReadRestart(cplcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!----------------------------------------------------------------
!NEX_UTest
write(name, *) "Coupler Component Destroy() Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_CplCompDestroy(cplcomp, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
call ESMF_TestEnd(ESMF_SRCLINE)
continue
end program ESMF_StdCompMethodsUTest