Skip to content

Commit

Permalink
Merge pull request #1 from billsacks/zerothtstep
Browse files Browse the repository at this point in the history
Fix unit tests for nstep starting at 1 instead of 0
  • Loading branch information
olyson authored Jul 26, 2023
2 parents b8be204 + 7f38c07 commit 55184f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
8 changes: 1 addition & 7 deletions src/unit_test_shr/unittestTimeManagerMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,6 @@ subroutine unittest_timemgr_set_nstep(nstep)
! !DESCRIPTION:
! Set the time step number
!
!KO
! Comment not needed now?
!KO
! Note that the starting time step number is 0, so calling this with nstep = 1
! advances the time step beyond the starting time step.
!
! !USES:
use clm_time_manager, only : advance_timestep
!
Expand All @@ -195,7 +189,7 @@ subroutine unittest_timemgr_set_nstep(nstep)
character(len=*), parameter :: subname = 'unittest_timemgr_set_nstep'
!-----------------------------------------------------------------------

do n = 1, nstep
do n = 2, nstep
call advance_timestep()
end do

Expand Down
8 changes: 4 additions & 4 deletions src/utils/test/clm_time_manager_test/test_clm_time_manager.pf
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,16 @@ contains
end subroutine getPrevYearfrac_leapYearAtYearBoundary_returnsCorrectValue

@Test
subroutine getNstep_step0(this)
subroutine getNstep_step1(this)
class(TestTimeManager), intent(inout) :: this
integer :: nstep

call unittest_timemgr_setup(dtime=dtime)

nstep = get_nstep()

@assertEqual(0, nstep)
end subroutine getNstep_step0
@assertEqual(1, nstep)
end subroutine getNstep_step1

@Test
subroutine getNstep_step3(this)
Expand Down Expand Up @@ -378,7 +378,7 @@ contains

call unittest_timemgr_setup(dtime=dtime)

call set_nstep(1)
call set_nstep(2)

is_first = is_first_step()

Expand Down

0 comments on commit 55184f4

Please sign in to comment.