test_sort Subroutine

subroutine test_sort()

Arguments

None

Variables

Type Visibility Attributes Name Initial
real, public :: aa(isz)
real, public :: bb(isz)
integer, public :: i
integer, public :: ibad
integer, public, parameter :: isz = 20

Source Code

subroutine test_sort()
integer,parameter            :: isz=20
real                         :: aa(isz)
real                         :: bb(isz)
integer                      :: i
integer                      :: ibad
   ibad=0
   call unit_check_start('sort',msg='')
   call random_seed()
   CALL RANDOM_NUMBER(aa)
   aa=aa*450000.0
   bb=real([(i,i=1,isz)])
   call sort(aa,isz,bb)
   do i=1,isz-1
      if(bb(i).gt.bb(i+1))then
         write(*,*)'Error in sorting reals small to large ',i,bb(i),bb(i+1)
         ibad=ibad+1
      endif
   enddo
   call unit_check('sort', ibad.eq.0, 'checking',100)
   call unit_check_done('sort',msg='')
end subroutine test_sort