test_serialize Subroutine

public subroutine test_serialize()

Arguments

None

Calls

proc~~test_serialize~2~~CallsGraph proc~test_serialize~2 test_serialize asserttrue asserttrue proc~test_serialize~2->asserttrue none~is_empty UnlimitedEntity%is_empty proc~test_serialize~2->none~is_empty none~serialize~18 UnlimitedEntity%serialize proc~test_serialize~2->none~serialize~18 proc~unlimitedentity_deserialize UnlimitedEntity_deserialize proc~test_serialize~2->proc~unlimitedentity_deserialize none~get_value UnlimitedEntity%get_value none~is_empty->none~get_value proc~mapl_return MAPL_Return none~is_empty->proc~mapl_return interface~mapl_assert MAPL_Assert none~serialize~18->interface~mapl_assert interface~serialize_buffer_length serialize_buffer_length none~serialize~18->interface~serialize_buffer_length interface~serialize_intrinsic serialize_intrinsic none~serialize~18->interface~serialize_intrinsic none~get_rank UnlimitedEntity%get_rank none~serialize~18->none~get_rank none~serialize~18->proc~mapl_return interface~deserialize_intrinsic deserialize_intrinsic proc~unlimitedentity_deserialize->interface~deserialize_intrinsic proc~unlimitedentity_deserialize->interface~mapl_assert proc~unlimitedentity_deserialize->interface~serialize_buffer_length proc~unlimitedentity_deserialize->none~get_rank none~set~93 UnlimitedEntity%set proc~unlimitedentity_deserialize->none~set~93 proc~unlimitedentity_deserialize->proc~mapl_return proc~mapl_verify MAPL_Verify proc~unlimitedentity_deserialize->proc~mapl_verify none~get_rank->proc~mapl_return none~get_shape UnlimitedEntity%get_shape none~get_rank->none~get_shape none~get_value->proc~mapl_return none~set~93->proc~mapl_return 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 proc~mapl_verify->proc~mapl_throw_exception none~get_shape->proc~mapl_return

Source Code

   subroutine test_serialize()
      type (UnlimitedEntity) :: a,b
      integer,allocatable :: buffer(:)

      real, dimension(2*3*4*5) :: array
      real, dimension(2*3,4*5) :: a2d
      real, dimension(2*3,4,5) :: a3d
      real, dimension(2,3,4,5) :: a4d
      integer :: i


      call a%serialize(buffer)
      call UnlimitedEntity_deserialize(buffer,b)
      @assertTrue(b%is_empty())
      deallocate(buffer)
      
      a = UnlimitedEntity('')
      call a%serialize(buffer)
      call UnlimitedEntity_deserialize(buffer,b)
      @assertTrue(b%is_empty())
      deallocate(buffer)

      do i = 1, 2*3*4*5
         array(i) = i*1.0
      enddo  

      a = UnlimitedEntity(10)
      call a%serialize(buffer)
      call UnlimitedEntity_deserialize(buffer,b)
      @assertTrue(a==b)
      deallocate(buffer)

      a = UnlimitedEntity([10,20,30])
      call a%serialize(buffer)
      call UnlimitedEntity_deserialize(buffer,b)
      @assertTrue(a==b)
      deallocate(buffer)

      a = UnlimitedEntity([.true.,.false.])
      call a%serialize(buffer)
      call UnlimitedEntity_deserialize(buffer,b)
      @assertTrue(a==b)
      deallocate(buffer)

      a = UnlimitedEntity('abcd')
      call a%serialize(buffer)
      call UnlimitedEntity_deserialize(buffer,b)
      @assertTrue(a==b)
      deallocate(buffer)

      a = UnlimitedEntity('abcdefgh')
      call a%serialize(buffer)
      call UnlimitedEntity_deserialize(buffer,b)
      @assertTrue(a==b)
      deallocate(buffer)

      a2d = reshape(array,(/2*3,4*5/))
      a = UnlimitedEntity(a2d)
      call a%serialize(buffer)
      call UnlimitedEntity_deserialize(buffer,b)
      @assertTrue(a==b)
      deallocate(buffer)

      a3d = reshape(array,(/2*3,4,5/))
      a = UnlimitedEntity(a3d)
      call a%serialize(buffer)
      call UnlimitedEntity_deserialize(buffer,b)
      @assertTrue(a==b)
      deallocate(buffer)

      a4d = reshape(array,(/2,3,4,5/))
      a = UnlimitedEntity(a4d)
      call a%serialize(buffer)
      call UnlimitedEntity_deserialize(buffer,b)
      @assertTrue(a==b)
      deallocate(buffer)

   end subroutine test_serialize