Skip to content

Commit dec7767

Browse files
author
Andy Stokely
committed
Updated docs and name of test that tests non-adjacent duplicate insertion.
1 parent 2a5f9d6 commit dec7767

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/core_test/mpas_test_core_stream_list.F

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -227,20 +227,21 @@ subroutine mpas_test_remove_existing_streams(err)
227227
deallocate(removed2)
228228
deallocate(removed3)
229229
end subroutine mpas_test_remove_existing_streams
230-
231230
!**************************************************************************************
232-
! Subroutine mpas_test_insert_duplicate_at_begin_and_end
231+
! Subroutine mpas_test_insert_non_adjacent_duplicate
233232
!
234-
!> \brief Test inserting a duplicate stream at both the beginning and the end of the list.
233+
!> \brief Test inserting a non-adjacent duplicate of the first item added to the list.
235234
!>
236-
!> \details This subroutine tests the insertion of a duplicate stream at both the
237-
!> beginning and end of an MPAS stream list. It ensures that the correct
238-
!> error is returned when attempting to insert a duplicate stream.
235+
!> \details This subroutine verifies that inserting a duplicate of the first stream
236+
!> added to an MPAS stream list results in the correct duplicate error
237+
!> code when the duplicate is not inserted immediately after the original.
238+
!> It does so by inserting two unique streams into the list, then attempting
239+
!> to insert the first stream again. This confirms that duplicate detection
240+
!> works for non-adjacent duplicates in insertion order.
239241
!>
240242
!> \param err The error code that indicates the result of the test.
241-
!
242-
!--------------------------------------------------------------------------------------
243-
subroutine mpas_test_insert_duplicate_at_begin_and_end(err)
243+
!**************************************************************************************
244+
subroutine mpas_test_insert_non_adjacent_duplicate(err)
244245
integer, intent(out) :: err
245246
type(MPAS_stream_list_type), pointer :: list
246247
type(MPAS_stream_list_type), pointer :: s1, s2
@@ -270,7 +271,7 @@ subroutine mpas_test_insert_duplicate_at_begin_and_end(err)
270271
end if
271272
272273
call MPAS_stream_list_destroy(list)
273-
end subroutine mpas_test_insert_duplicate_at_begin_and_end
274+
end subroutine mpas_test_insert_non_adjacent_duplicate
274275
275276
!**************************************************************************************
276277
! Subroutine mpas_test_remove_from_empty_list
@@ -301,7 +302,6 @@ subroutine mpas_test_remove_from_empty_list(err)
301302
err = err + 1
302303
end if
303304
call MPAS_stream_list_destroy(list)
304-
deallocate(s1)
305305
end subroutine mpas_test_remove_from_empty_list
306306
307307
!**************************************************************************************
@@ -568,13 +568,13 @@ subroutine mpas_test_stream_list(err)
568568
call mpas_log_write(' mpas_test_remove_existing_streams: FAILURE')
569569
end if
570570

571-
! Test inserting a duplicate stream at both the beginning and the end of the list.
572-
call mpas_test_insert_duplicate_at_begin_and_end(test_err)
571+
! Test inserting a non-adjacent duplicate of the first stream added.
572+
call mpas_test_insert_non_adjacent_duplicate(test_err)
573573
if (test_err == 0) then
574-
call mpas_log_write(' mpas_test_insert_duplicate_at_begin_and_end: SUCCESS')
574+
call mpas_log_write(' mpas_test_insert_non_adjacent_duplicate: SUCCESS')
575575
else
576576
err = err + test_err
577-
call mpas_log_write(' mpas_test_insert_duplicate_at_begin_and_end: FAILURE')
577+
call mpas_log_write(' mpas_test_insert_non_adjacent_duplicate: FAILURE')
578578
end if
579579

580580
! Test attempting to remove a non-existent stream from an empty list, expect error.

0 commit comments

Comments
 (0)