@@ -227,20 +227,21 @@ subroutine mpas_test_remove_existing_streams(err)
227
227
deallocate(removed2)
228
228
deallocate(removed3)
229
229
end subroutine mpas_test_remove_existing_streams
230
-
231
230
!**************************************************************************************
232
- ! Subroutine mpas_test_insert_duplicate_at_begin_and_end
231
+ ! Subroutine mpas_test_insert_non_adjacent_duplicate
233
232
!
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.
235
234
!>
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.
239
241
!>
240
242
!> \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)
244
245
integer, intent(out) :: err
245
246
type(MPAS_stream_list_type), pointer :: list
246
247
type(MPAS_stream_list_type), pointer :: s1, s2
@@ -270,7 +271,7 @@ subroutine mpas_test_insert_duplicate_at_begin_and_end(err)
270
271
end if
271
272
272
273
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
274
275
275
276
!**************************************************************************************
276
277
! Subroutine mpas_test_remove_from_empty_list
@@ -301,7 +302,6 @@ subroutine mpas_test_remove_from_empty_list(err)
301
302
err = err + 1
302
303
end if
303
304
call MPAS_stream_list_destroy(list)
304
- deallocate(s1)
305
305
end subroutine mpas_test_remove_from_empty_list
306
306
307
307
!**************************************************************************************
@@ -568,13 +568,13 @@ subroutine mpas_test_stream_list(err)
568
568
call mpas_log_write(' mpas_test_remove_existing_streams: FAILURE' )
569
569
end if
570
570
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)
573
573
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' )
575
575
else
576
576
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' )
578
578
end if
579
579
580
580
! Test attempting to remove a non- existent stream from an empty list, expect error.
0 commit comments