Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/test coverage #337

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/Infrastructure/Base/tests/ESMF_InfoUTest.F90
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,29 @@ program ESMF_InfoUTest
if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)
!----------------------------------------------------------------------------

!----------------------------------------------------------------------------
!NEX_UTest
write(name, *) "ESMF_InfoLog"
write(failMsg, *) "Did not return success."

rc = ESMF_FAILURE

info6 = ESMF_InfoCreate(rc=rc)
if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)

call ESMF_InfoSet(info6, "/i/am/nested", 111, rc=rc)
if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)

call ESMF_InfoSet(info6, "top-level", 222, rc=rc)
if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)

call ESMF_InfoLog(info6, prefix="info6: ", rc=rc)
call ESMF_Test((rc == ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)

call ESMF_InfoDestroy(info6, rc=rc)
if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)
!----------------------------------------------------------------------------

!----------------------------------------------------------------------------
!NEX_UTest
write(name, *) "ESMF_InfoRemove Child From Parent"
Expand Down
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
Loading