From 94f511d4d9f711ea4e2560af263d5880cb594bb0 Mon Sep 17 00:00:00 2001 From: Daniel Rosen Date: Thu, 5 Sep 2024 18:18:39 -0400 Subject: [PATCH] Fix ESMF_ArrayCreateGetUTest (#288) * fill array with huge - localpet * fail if every element in array matches --- .../Array/tests/ESMF_ArrayCreateGetUTest.F90 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Infrastructure/Array/tests/ESMF_ArrayCreateGetUTest.F90 b/src/Infrastructure/Array/tests/ESMF_ArrayCreateGetUTest.F90 index c8a3151485..02e365d1ab 100644 --- a/src/Infrastructure/Array/tests/ESMF_ArrayCreateGetUTest.F90 +++ b/src/Infrastructure/Array/tests/ESMF_ArrayCreateGetUTest.F90 @@ -62,6 +62,7 @@ program ESMF_ArrayCreateGetUTest type(ESMF_Array):: array, arrayAlias, arrayDup, arrayUnInit type(ESMF_DELayout):: delayout type(ESMF_DistGrid):: distgrid + real(ESMF_KIND_R8) :: hugeR8 real(ESMF_KIND_R8) :: diffR8 real(ESMF_KIND_R4) :: diffR4 real(ESMF_KIND_R8) :: farray1D(10) @@ -369,7 +370,8 @@ program ESMF_ArrayCreateGetUTest !NEX_UTest_Multi_Proc_Only write(name, *) "ArrayCreate from Copy (ALLOC), 2D ESMF_TYPEKIND_R8 Test" write(failMsg, *) "Did not return ESMF_SUCCESS" - farrayPtr2D = real(localPet+10, ESMF_KIND_R8) ! fill with data to check + hugeR8 = huge(0.0_ESMF_KIND_R8) + farrayPtr2D = real(hugeR8-localPet, ESMF_KIND_R8) ! fill with data to check arrayDup = ESMF_ArrayCreate(array, datacopyflag=ESMF_DATACOPY_ALLOC, rc=rc) call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE) @@ -398,14 +400,14 @@ program ESMF_ArrayCreateGetUTest !NEX_UTest_Multi_Proc_Only write(name, *) "Verify Array vs Array Copy (ALLOC) no data copy" write(failMsg, *) "Unexpected data copy" - dataCorrect = .true. + dataCorrect = .false. do j=lbound(farrayPtr2D,2), ubound(farrayPtr2D,2) do i=lbound(farrayPtr2D,1), ubound(farrayPtr2D,1) write (msg,*) "farrayPtr2D(",i,",",j,")=", farrayPtr2D(i,j), & " farrayPtr2DCpy(",i,",",j,")=", farrayPtr2DCpy(i,j) call ESMF_LogWrite(msg, ESMF_LOGMSG_INFO, rc=rc) if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT) - if (abs(farrayPtr2D(i,j)-farrayPtr2DCpy(i,j)) < 1.d-10) dataCorrect=.false. + if (abs(farrayPtr2D(i,j)-farrayPtr2DCpy(i,j)) >= 1.d-10) dataCorrect=.true. enddo enddo call ESMF_Test((dataCorrect), name, failMsg, result, ESMF_SRCLINE)