test_copy Subroutine

subroutine test_copy()

Arguments

None

Variables

Type Visibility Attributes Name Initial
real, public, allocatable :: from(:)
real, public, allocatable :: to(:)

Source Code

subroutine test_copy()
real,allocatable :: from(:), to(:)
   call unit_check_start('copy',msg='')

   from=[1.0,2.0,3.0,4.0,5.0]
   to=[-1.0,-1.0,-1.0,-1.0,-1.0,-1.0]

   call copy(from,3,to)
   call unit_check('copy',all(to==[1.00,2.00,3.00,-1.00,-1.00,-1.00]),'simple')

   call copy([10.0,20.0,30.0],3,to(3:5))
   call unit_check('copy',all(to==[1.00,2.00,10.00,20.00,30.00,-1.00]),'subvector')

   call unit_check_done('copy',msg='')
end subroutine test_copy