From 7deaaec0565d6cc6c58974ef78f5ba2039f06834 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 16 Dec 2024 15:02:50 -0800 Subject: [PATCH 1/3] Add testing for ESMF_LogInfo() method. --- .../Base/tests/ESMF_InfoUTest.F90 | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Infrastructure/Base/tests/ESMF_InfoUTest.F90 b/src/Infrastructure/Base/tests/ESMF_InfoUTest.F90 index 8659c62a0a..28fa923bc3 100644 --- a/src/Infrastructure/Base/tests/ESMF_InfoUTest.F90 +++ b/src/Infrastructure/Base/tests/ESMF_InfoUTest.F90 @@ -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" From 2bfd195f7b63841a928c09be425c2ec9a476d986 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 16 Dec 2024 15:26:53 -0800 Subject: [PATCH 2/3] Add testing for ESMF_UtilStringDiffMatch() method. --- .../Util/tests/ESMF_UtilUTest.F90 | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/Infrastructure/Util/tests/ESMF_UtilUTest.F90 b/src/Infrastructure/Util/tests/ESMF_UtilUTest.F90 index 8e1fcba2e9..b5d6a90c63 100644 --- a/src/Infrastructure/Util/tests/ESMF_UtilUTest.F90 +++ b/src/Infrastructure/Util/tests/ESMF_UtilUTest.F90 @@ -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, & @@ -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) !============================================================== From 8c9bd16e81c1bc6125091552b5d0ee220d894092 Mon Sep 17 00:00:00 2001 From: Gerhard Theurich Date: Mon, 16 Dec 2024 16:35:24 -0800 Subject: [PATCH 3/3] Change ESMF_UtilStringDiffMatch from BOP to BOPI. --- src/Infrastructure/Util/interface/ESMF_Util.F90 | 4 ++-- src/Infrastructure/Util/tests/ESMF_UtilUTest.F90 | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Infrastructure/Util/interface/ESMF_Util.F90 b/src/Infrastructure/Util/interface/ESMF_Util.F90 index 4daeda1801..f27468ff33 100644 --- a/src/Infrastructure/Util/interface/ESMF_Util.F90 +++ b/src/Infrastructure/Util/interface/ESMF_Util.F90 @@ -997,7 +997,7 @@ end function ESMF_UtilString2Real !----------------------------------------------------------------------------- -!BOP +!BOPI ! !IROUTINE: ESMF_UtilStringDiffMatch - Match differences between two strings ! !INTERFACE: function ESMF_UtilStringDiffMatch(string1, string2, minusStringList, & @@ -1031,7 +1031,7 @@ function ESMF_UtilStringDiffMatch(string1, string2, minusStringList, & ! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors. ! \end{description} ! -!EOP +!EOPI !----------------------------------------------------------------------------- ! local variables integer :: localrc diff --git a/src/Infrastructure/Util/tests/ESMF_UtilUTest.F90 b/src/Infrastructure/Util/tests/ESMF_UtilUTest.F90 index b5d6a90c63..718280c149 100644 --- a/src/Infrastructure/Util/tests/ESMF_UtilUTest.F90 +++ b/src/Infrastructure/Util/tests/ESMF_UtilUTest.F90 @@ -1004,6 +1004,9 @@ program ESMF_UtilUTest call ESMF_Test(abs (valueDouble - 789.0d0) < 0.000001d0, name, failMsg, result, ESMF_SRCLINE) !------------------------------------------------------------------------ +! Internal string utilities (NOT part of the external ESMF API) +!============================================================== + !------------------------------------------------------------------------ !EX_UTest write(name, *) "ESMF_UtilStringDiffMatch() - identical strings - Test" @@ -1055,9 +1058,6 @@ program ESMF_UtilUTest call ESMF_Test(matchFlag, name, failMsg, result, ESMF_SRCLINE) !------------------------------------------------------------------------ -! Internal string utilities (NOT part of the external ESMF API) -!============================================================== - !------------------------------------------------------------------------ !EX_UTest ! Test concatenating strings