test_send_terminate Subroutine

public subroutine test_send_terminate(this)

Arguments

Type IntentOptional Attributes Name
class(MpiTestMethod), intent(inout) :: this

Calls

proc~~test_send_terminate~2~~CallsGraph proc~test_send_terminate~2 test_send_terminate assertequal assertequal proc~test_send_terminate~2->assertequal get_type_id get_type_id proc~test_send_terminate~2->get_type_id getmpicommunicator getmpicommunicator proc~test_send_terminate~2->getmpicommunicator getprocessrank getprocessrank proc~test_send_terminate~2->getprocessrank none~receive~3 MpiSocket%receive proc~test_send_terminate~2->none~receive~3 none~send~4 MpiSocket%send proc~test_send_terminate~2->none~send~4 mpi_get_count mpi_get_count none~receive~3->mpi_get_count mpi_probe mpi_probe none~receive~3->mpi_probe mpi_recv mpi_recv none~receive~3->mpi_recv none~decode ProtocolParser%decode none~receive~3->none~decode proc~mapl_return MAPL_Return none~receive~3->proc~mapl_return mpi_send mpi_send none~send~4->mpi_send none~encode ProtocolParser%encode none~send~4->none~encode none~send~4->proc~mapl_return deserialize deserialize none~decode->deserialize none~at~170 IntegerMessageMap%at none~decode->none~at~170 none~encode->get_type_id get_length get_length none~encode->get_length serialize serialize none~encode->serialize at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception none~find~45 IntegerMessageMap%find none~at~170->none~find~45

Source Code

   subroutine test_send_terminate(this)
      class (MpiTestMethod), intent(inout) :: this

      integer :: comm
      type (MpiSocket) :: s
      class (AbstractMessage), allocatable :: message
      type (ProtocolParser), target :: parser

      comm = this%getMpiCommunicator()
      parser = ProtocolParser()

      select case (this%getProcessRank())
      case (0) ! server
         s = MpiSocket(comm, 1, parser)
         allocate(message, source=s%receive())
         @assertEqual(TERMINATE_ID, message%get_type_id())
      case (1) ! client
         s = MpiSocket(comm, 0, parser)
         call s%send(TerminateMessage())
      end select

   end subroutine test_send_terminate