new_unittest Function

public function new_unittest(name, test, should_fail) result(self)

Register a new unit test

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

Name of the test

procedure(test_interface) :: test

Entry point for the test

logical, intent(in), optional :: should_fail

Whether test is supposed to error or not

Return Value type(unittest_type)

Newly registered test


Source Code

function new_unittest(name, test, should_fail) result(self)

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

   !> Entry point for the test
   procedure(test_interface) :: test

   !> Whether test is supposed to error or not
   logical, intent(in), optional :: should_fail

   !> Newly registered test
   type(unittest_type) :: self

   self%name = name
   self%test => test
   if (present(should_fail)) self%should_fail = should_fail

end function new_unittest