Commit b846ca04 authored by Henderson, Shane's avatar Henderson, Shane
Browse files

Merge branch 'hotfix_PL_copyParam' into 'master'

Fix erroneous recursive copy

See merge request https://code.ornl.gov/futility/Futility/-/merge_requests/407
parents 9d292795 d33d14ef
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1512,7 +1512,7 @@ RECURSIVE SUBROUTINE copyParam(source,source_path,dest_path,dest,overwrite)
          dest_path//'" with source parameter "'//source_path//'"!')
    ELSE
      IF(source_node%dataType == PL_DATA_TYPE_TREE) THEN
        CALL source%get(source_path,iterator,SUBLISTS=.TRUE.)
        CALL source%get(source_path,iterator,SUBLISTS=.FALSE.)
        IF(iterator%isActive) THEN
          DO WHILE(iterator%isActive)
            CALL source%copyParam(source_path//'->'//CHAR(iterator%getCurrentName()), &
+13 −0
Original line number Diff line number Diff line
@@ -5089,6 +5089,7 @@ ENDSUBROUTINE clear_test_vars
!
!-------------------------------------------------------------------------------
SUBROUTINE testCopy()
  INTEGER(SIK) :: nError
  TYPE(ParamType) :: listA,listB

  CALL listA%add('A -> A1 -> A1A',1.0_SRK)
@@ -5145,6 +5146,18 @@ SUBROUTINE testCopy()
  ASSERT(listA%has('copy -> C -> C2'),'copied copy -> C -> C2')
  ASSERT_EQ(listA%getDataType('copy -> C -> C2'),PL_DATA_TYPE_SLK0,'copy overwrite')

  COMPONENT_TEST('Recursive copy no overwrite sublists bug')
  nError = eParams%getCounter(EXCEPTION_ERROR)
  CALL listA%clear()
  CALL listB%clear()
  CALL listA%add('L1a -> L2a -> L3a -> L4a -> L5a -> L6a', 'mode')
  CALL listA%add('L1a -> L2a -> L3a -> L4a -> L5a -> L6b', 'shufflehomog')
  CALL listA%add('L1a -> L2a -> L3a -> L4a -> L5a -> L6c', 'op date')
  CALL listA%add('L1a -> L2a -> L3a -> L4a -> L5a -> L6d -> L7a', 'source rod')
  CALL listB%add('L4b -> L5b -> L6b', 'other random params')
  CALL listA%copyParam('L1a -> L2a -> L3a -> L4a -> L5a', 'L4b -> L5a', listB)
  ASSERT_EQ(eParams%getCounter(EXCEPTION_ERROR), nError, 'no errors')

  CALL listA%clear()
  CALL listB%clear()