run_selected Subroutine

public subroutine run_selected(collect, name, unit, stat)

Driver for selective testing

Arguments

Type IntentOptional Attributes Name
procedure(collect_interface) :: collect

Collect tests

character(len=*), intent(in) :: name

Name of the selected test

integer, intent(in) :: unit

Unit for IO

integer, intent(inout) :: stat

Number of failed tests


Source Code

subroutine run_selected(collect, name, unit, stat)

   !> Collect tests
   procedure(collect_interface) :: collect

   !> Name of the selected test
   character(len=*), intent(in) :: name

   !> Unit for IO
   integer, intent(in) :: unit

   !> Number of failed tests
   integer, intent(inout) :: stat

   type(unittest_type), allocatable :: testsuite(:)
   integer :: ii

   call collect(testsuite)

   ii = select_test(testsuite, name)

   if (ii > 0 .and. ii <= size(testsuite)) then
      call run_unittest(testsuite(ii), unit, stat)
   else
      write(unit, fmt) "Available tests:"
      do ii = 1, size(testsuite)
         write(unit, fmt) "-", testsuite(ii)%name
      end do
      stat = -huge(ii)
   end if

end subroutine run_selected