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

Closes #1378. Convert many _ASSERT(.false.) to _FAIL() #1493

Merged
merged 2 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Change many instances of `_ASSERT(.false.,"msg")` to `_FAIL("msg")`

### Removed

### Deprecated
Expand Down
4 changes: 2 additions & 2 deletions Tests/ExtDataDriverGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ subroutine initialize_gc(gc, import_state, export_state, clock, rc)
call cap%parseTimes(rc=status)
_VERIFY(status)
if (allocated(cap%times) .and. cap%run_fbf ) then
_ASSERT(.false.,"can not run forwards and backwards with specific times")
_FAIL("can not run forwards and backwards with specific times")
end if

_RETURN(ESMF_SUCCESS)
Expand Down Expand Up @@ -743,7 +743,7 @@ subroutine MAPL_ClockInit ( cf, Clock, nsteps, rc)
call ESMF_CalendarSetDefault(ESMF_CALKIND_NOLEAP, RC=STATUS)
_VERIFY(STATUS)
else
_ASSERT(.false.,'needs informative message')
_FAIL('needs informative message')
endif

call ESMF_ConfigGetAttribute(cf, datetime, label='BEG_DATE:',rc=status)
Expand Down
2 changes: 1 addition & 1 deletion Tests/ExtDataRoot_GridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ subroutine CompareState(State1,State2,tol,rc)
enddo
end if
if (foundDiff(ii)) then
_ASSERT(.false.,'found difference when compare state')
_FAIL('found difference when compare state')
end if
enddo

Expand Down
30 changes: 15 additions & 15 deletions base/Base/Base_Base_implementation.F90
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ module subroutine MAPL_FieldAllocCommit(field, dims, location, typekind, &
gridToFieldMap=gridToFieldMap, &
rc = status)
case default
_ASSERT(.false., 'unsupported rank > 1')
_FAIL( 'unsupported rank > 1')
end select

else
Expand All @@ -197,7 +197,7 @@ module subroutine MAPL_FieldAllocCommit(field, dims, location, typekind, &
gridToFieldMap=gridToFieldMap, &
rc = status)
case default
_ASSERT(.false., 'unsupported rank > 1')
_FAIL( 'unsupported rank > 1')
end select

endif
Expand Down Expand Up @@ -290,7 +290,7 @@ module subroutine MAPL_FieldAllocCommit(field, dims, location, typekind, &
totalUWidth=haloWidth(1:griddedDims), &
rc = status)
case default
_ASSERT(.false., 'only up to 4D are supported')
_FAIL( 'only up to 4D are supported')
end select RankCase2d
else
select case (rank)
Expand Down Expand Up @@ -325,7 +325,7 @@ module subroutine MAPL_FieldAllocCommit(field, dims, location, typekind, &
totalUWidth=haloWidth(1:griddedDims), &
rc = status)
case default
_ASSERT(.false., 'only up to 4D are supported')
_FAIL( 'only up to 4D are supported')
end select
end if
_VERIFY(STATUS)
Expand Down Expand Up @@ -444,7 +444,7 @@ module subroutine MAPL_FieldAllocCommit(field, dims, location, typekind, &
datacopyFlag = ESMF_DATACOPY_REFERENCE, &
rc = status)
case default
_ASSERT(.false., 'only 2D and 3D are supported')
_FAIL( 'only 2D and 3D are supported')
end select

else
Expand Down Expand Up @@ -474,7 +474,7 @@ module subroutine MAPL_FieldAllocCommit(field, dims, location, typekind, &
datacopyFlag = ESMF_DATACOPY_REFERENCE, &
rc = status)
case default
_ASSERT(.false., 'only 2D and 3D are supported')
_FAIL( 'only 2D and 3D are supported')
end select

endif
Expand Down Expand Up @@ -1385,7 +1385,7 @@ module function MAPL_FieldCreateRename(FIELD, NAME, DoCopy, RC) RESULT(F)
rc = status)
_VERIFY(STATUS)
case default
_ASSERT(.false., 'only upto 4D are supported')
_FAIL( 'only upto 4D are supported')
end select
else if (tk == ESMF_TypeKind_R8) then
select case (fieldRank)
Expand Down Expand Up @@ -1422,10 +1422,10 @@ module function MAPL_FieldCreateRename(FIELD, NAME, DoCopy, RC) RESULT(F)
rc = status)
_VERIFY(STATUS)
case default
_ASSERT(.false., 'only 2D and 3D are supported')
_FAIL( 'only 2D and 3D are supported')
end select
else
_ASSERT(.false., 'unsupported typekind')
_FAIL( 'unsupported typekind')
endif

deallocate(gridToFieldMap)
Expand Down Expand Up @@ -1560,7 +1560,7 @@ module function MAPL_FieldCreateNewgrid(FIELD, GRID, LM, NEWNAME, RC) RESULT(F)
DIMS = MAPL_DimsHorzVert
end if
else
_ASSERT(.false., 'rank > 4 not supported')
_FAIL( 'rank > 4 not supported')
end if

deallocate(gridToFieldMap)
Expand Down Expand Up @@ -1660,7 +1660,7 @@ module function MAPL_FieldCreateR4(FIELD, RC) RESULT(F)
rc = status)
_VERIFY(STATUS)
case default
_ASSERT(.false., 'only 2D and 3D are supported')
_FAIL( 'only 2D and 3D are supported')
end select

deallocate(gridToFieldMap)
Expand Down Expand Up @@ -1762,7 +1762,7 @@ module subroutine MAPL_FieldCopy(from, to, RC)
_VERIFY(STATUS)
var_3d = vr8_3d
case default
_ASSERT(.false., 'unsupported fieldRank (> 3)')
_FAIL( 'unsupported fieldRank (> 3)')
end select

_RETURN(ESMF_SUCCESS)
Expand Down Expand Up @@ -2701,7 +2701,7 @@ module subroutine MAPL_FieldDestroy(Field,RC)
deallocate(VR8_3d,stat=status)
_VERIFY(STATUS)
else
_ASSERT(.false., 'unsupported typekind+rank')
_FAIL( 'unsupported typekind+rank')
end if
call ESMF_FieldDestroy(Field,rc=status)
_VERIFY(STATUS)
Expand Down Expand Up @@ -3088,7 +3088,7 @@ module subroutine MAPL_GetHorzIJIndex(npts,II,JJ,lon,lat,lonR8,latR8,Grid, rc)
staggerloc=ESMF_STAGGERLOC_CENTER, fArrayPtr = lats, rc=status)
_VERIFY(STATUS)
else
_ASSERT(.false.,'if not isCubed, localSearch must be .true.')
_FAIL('if not isCubed, localSearch must be .true.')
end if
allocate(lons_1d(im),stat=status)
_VERIFY(STATUS)
Expand Down Expand Up @@ -3645,7 +3645,7 @@ module subroutine MAPL_FieldSplit(field, fields, aliasName, rc)
end do
end if
else if (tk == ESMF_TYPEKIND_R8) then
_ASSERT(.false., "R8 overload not implemented yet")
_FAIL( "R8 overload not implemented yet")
end if

deallocate(gridToFieldMap)
Expand Down
4 changes: 2 additions & 2 deletions base/BinIO.F90
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ subroutine MAPL_StateVarRead(UNIT, STATE, NAME, arrdes, bootstrapable, RC)
_VERIFY(STATUS)

!ALT else
!ALT _ASSERT(.false.,'failed mapl_statevarread')
!ALT _FAIL('failed mapl_statevarread')

end if

Expand Down Expand Up @@ -739,7 +739,7 @@ subroutine MAPL_FieldRead(UNIT,FIELD, ARRDES, HomePE, ignoreEOF, RC)
call MAPL_VarRead(unit, grid, vr8_4d, rc=status)
end if
else
_ASSERT(.false., "ERROR: unsupported RANK")
_FAIL( "ERROR: unsupported RANK")
endif
_VERIFY(STATUS)

Expand Down
4 changes: 2 additions & 2 deletions base/ESMFL_Mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3735,7 +3735,7 @@ subroutine Bundle2State (BUN, STA, rc)
_VERIFY(STATUS)
dst_pr83d = src_pr83d
case default
_ASSERT(.false., 'unsupported rank (>= 4)')
_FAIL( 'unsupported rank (>= 4)')
end select
end if
end if
Expand Down Expand Up @@ -3936,7 +3936,7 @@ SUBROUTINE ESMFL_HALO_R4_2D(GRID, INPUT, RC)

if (.not.found) then
print *, "Error: need bigger MAX_HALOTYPES value"
_ASSERT(.false., 'no unused slot for halo types')
_FAIL( 'no unused slot for halo types')
end if

call ESMF_GridGet(GRID, distGrid=distGrid, dimCount=dimCount, RC=STATUS)
Expand Down
6 changes: 3 additions & 3 deletions base/FileIOShared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ subroutine alloc_(A,type,im,jm,rc)
_ASSERT(present(jm), 'jm not present for 2d')
allocate(A%I4_2(IM,JM))
case default
_ASSERT(.false., 'unsupported tkr')
_FAIL( 'unsupported tkr')
end select

a%allocated=type
Expand Down Expand Up @@ -254,7 +254,7 @@ subroutine dealloc_(A,RC)
nullify(A%i4_2)
end if
case default
_ASSERT(.false., 'unsupported tkr')
_FAIL( 'unsupported tkr')
end select
a%allocated=not_allocated
end if
Expand Down Expand Up @@ -367,7 +367,7 @@ subroutine MAPL_TileMaskGet(grid, mask, rc)
enddo

#ifdef NEW
_ASSERT(.false., 'unsupported code block') !ALT this section is questionable
_FAIL( 'unsupported code block') !ALT this section is questionable
do I = 0,nDEs-1
de = I
I1 = AL(1,I)
Expand Down
22 changes: 11 additions & 11 deletions base/FileMetadataUtilities.F90
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function get_var_attr_real32(this,var_name,attr_name,rc) result(attr_real32)
tmp = attr_val
attr_real32 = tmp(1)
class default
_ASSERT(.false.,'unsupport subclass for units')
_FAIL('unsupport subclass for units')
end select

_RETURN(_SUCCESS)
Expand Down Expand Up @@ -155,7 +155,7 @@ function get_var_attr_real64(this,var_name,attr_name,rc) result(attr_real64)
tmp = attr_val
attr_real64 = tmp(1)
class default
_ASSERT(.false.,'unsupport subclass for units')
_FAIL('unsupport subclass for units')
end select

_RETURN(_SUCCESS)
Expand Down Expand Up @@ -184,7 +184,7 @@ function get_var_attr_int32(this,var_name,attr_name,rc) result(attr_int32)
tmp = attr_val
attr_int32 = tmp(1)
class default
_ASSERT(.false.,'unsupport subclass for units')
_FAIL('unsupport subclass for units')
end select

_RETURN(_SUCCESS)
Expand Down Expand Up @@ -213,7 +213,7 @@ function get_var_attr_int64(this,var_name,attr_name,rc) result(attr_int64)
tmp = attr_val
attr_int64 = tmp(1)
class default
_ASSERT(.false.,'unsupport subclass for units')
_FAIL('unsupport subclass for units')
end select

_RETURN(_SUCCESS)
Expand All @@ -240,7 +240,7 @@ function get_var_attr_string(this,var_name,attr_name,rc) result(attr_string)
type is(character(*))
attr_string = attr_val
class default
_ASSERT(.false.,'unsupport subclass for units')
_FAIL('unsupport subclass for units')
end select

_RETURN(_SUCCESS)
Expand Down Expand Up @@ -356,7 +356,7 @@ subroutine get_time_info(this,startTime,startyear,startmonth,startday,starthour,
endif
endif
class default
_ASSERT(.false.,"Time unit must be character")
_FAIL("Time unit must be character")
end select
call ESMF_TimeSet(unmodStartTime,yy=year,mm=month,dd=day,h=hour,m=min,s=sec,rc=status)
_VERIFY(status)
Expand All @@ -377,7 +377,7 @@ subroutine get_time_info(this,startTime,startyear,startmonth,startday,starthour,
type is (integer(kind=INT32))
tr_r64=ptr
class default
_ASSERT(.false.,"unsupported time variable type")
_FAIL("unsupported time variable type")
end select
do i=1,tsize
select case (trim(tUnits))
Expand All @@ -398,7 +398,7 @@ subroutine get_time_info(this,startTime,startyear,startmonth,startday,starthour,
_VERIFY(status)
tvec(i)=unmodStartTime+tint
case default
_ASSERT(.false.,"unsupported time unit")
_FAIL("unsupported time unit")
end select
enddo

Expand Down Expand Up @@ -458,7 +458,7 @@ function get_variable_attribute(this,var_name,attr_name,rc) result(units)
type is (character(*))
units => vunits
class default
_ASSERT(.false.,'units must be string')
_FAIL('units must be string')
end select
else
units => null()
Expand Down Expand Up @@ -497,7 +497,7 @@ subroutine get_coordinate_info(this,coordinate_name,coordSize,coordUnits,coords,
type is (character(*))
coordUnits = trim(coordUnitPtr)
class default
_ASSERT(.false.,'units must be string')
_FAIL('units must be string')
end select
end if

Expand All @@ -514,7 +514,7 @@ subroutine get_coordinate_info(this,coordinate_name,coordSize,coordUnits,coords,
type is (integer(kind=INT32))
coords=ptr
class default
_ASSERT(.false.,"unsupported coordel variable type")
_FAIL("unsupported coordel variable type")
end select
end if
_RETURN(_SUCCESS)
Expand Down
Loading