Skip to content

Commit

Permalink
Add testing for ESMF_UtilStringDiffMatch() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
theurich committed Dec 16, 2024
1 parent 7deaaec commit 2bfd195
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/Infrastructure/Util/tests/ESMF_UtilUTest.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ program ESMF_UtilUTest
integer :: nargs
character(ESMF_MAXPATHLEN) :: program_path
integer :: argindex
logical :: matchFlag

real(ESMF_KIND_R8) :: random_values(50) = (/ &
0.997560, 0.566825, 0.965915, 0.747928, 0.367391, &
Expand Down Expand Up @@ -1003,6 +1004,57 @@ program ESMF_UtilUTest
call ESMF_Test(abs (valueDouble - 789.0d0) < 0.000001d0, name, failMsg, result, ESMF_SRCLINE)
!------------------------------------------------------------------------

!------------------------------------------------------------------------
!EX_UTest
write(name, *) "ESMF_UtilStringDiffMatch() - identical strings - Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
matchFlag = ESMF_UtilStringDiffMatch( &
string1="A simple test string", string2="A simple test string", &
minusStringList=[""], plusStringList=[""], rc=rc)
call ESMF_Test((rc == ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!------------------------------------------------------------------------

!------------------------------------------------------------------------
!EX_UTest
write(name, *) "ESMF_UtilStringDiffMatch() - identical strings - match Test"
write(failMsg, *) "Did not return correct match flag"
call ESMF_Test(matchFlag, name, failMsg, result, ESMF_SRCLINE)
!------------------------------------------------------------------------

!------------------------------------------------------------------------
!EX_UTest
write(name, *) "ESMF_UtilStringDiffMatch() - different strings - Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
matchFlag = ESMF_UtilStringDiffMatch( &
string1="A simple test string", string2="A xyzzyx test string", &
minusStringList=[""], plusStringList=[""], rc=rc)
call ESMF_Test((rc == ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!------------------------------------------------------------------------

!------------------------------------------------------------------------
!EX_UTest
write(name, *) "ESMF_UtilStringDiffMatch() - different strings - match Test"
write(failMsg, *) "Did not return correct match flag"
call ESMF_Test(.not.matchFlag, name, failMsg, result, ESMF_SRCLINE)
!------------------------------------------------------------------------

!------------------------------------------------------------------------
!EX_UTest
write(name, *) "ESMF_UtilStringDiffMatch() - different strings minus/plus - Test"
write(failMsg, *) "Did not return ESMF_SUCCESS"
matchFlag = ESMF_UtilStringDiffMatch( &
string1="A simple test string", string2="A xyzzyx test string", &
minusStringList=["simple"], plusStringList=["xyzzyx"], rc=rc)
call ESMF_Test((rc == ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!------------------------------------------------------------------------

!------------------------------------------------------------------------
!EX_UTest
write(name, *) "ESMF_UtilStringDiffMatch() - different strings minus/plus - match Test"
write(failMsg, *) "Did not return correct match flag"
call ESMF_Test(matchFlag, name, failMsg, result, ESMF_SRCLINE)
!------------------------------------------------------------------------

! Internal string utilities (NOT part of the external ESMF API)
!==============================================================

Expand Down

0 comments on commit 2bfd195

Please sign in to comment.