subroutine test_unipar()
use M_orderpack__unipar, only : unipar
implicit none
integer,allocatable :: xdont(:)
integer,allocatable :: irngt(:)
integer :: nord
call unit_check_start('unipar', '-library orderpack') ! start tests
!
xdont=[10,5,7,1,4,5,6,8,9,10,1]
nord=5
if(allocated(irngt))deallocate(irngt)
allocate(irngt(nord))
!
call unipar(xdont,irngt,nord)
call unit_check('unipar',nord.eq.5,'number of unique values found',nord,5)
call unit_check('unipar',all(irngt(1:nord) .eq. [11,5,2,7,3]) ,'returned indices')
call unit_check('unipar',all(xdont(irngt(1:nord)) .eq.[1,4,5,6,7]) ,'returned values')
call unit_check_done('unipar',msg='test completed')
end subroutine test_unipar