test_serialize Subroutine

public subroutine test_serialize()

Arguments

None

Calls

proc~~test_serialize~4~~CallsGraph proc~test_serialize~4 test_serialize assertfalse assertfalse proc~test_serialize~4->assertfalse asserttrue asserttrue proc~test_serialize~4->asserttrue none~add_attribute~2 Variable%add_attribute proc~test_serialize~4->none~add_attribute~2 none~add_dimension FileMetadata%add_dimension proc~test_serialize~4->none~add_dimension none~add_variable FileMetadata%add_variable proc~test_serialize~4->none~add_variable none~get_order FileMetadata%get_order proc~test_serialize~4->none~get_order none~serialize~25 FileMetadata%serialize proc~test_serialize~4->none~serialize~25 none~set_order FileMetadata%set_order proc~test_serialize~4->none~set_order proc~filemetadata_deserialize FileMetadata_deserialize proc~test_serialize~4->proc~filemetadata_deserialize push_back push_back proc~test_serialize~4->push_back

Source Code

   subroutine test_serialize()
     type (FileMetadata) :: cf1, cf2
     type (Variable) :: v1, v2
     integer,allocatable :: buffer(:)
     type (StringVector) s1, s2
     call cf1%add_dimension('x', 10)
     call cf1%add_dimension('y', 20)
     call cf1%add_dimension('z', 30) 

     v1 = Variable(type=pFIO_INT32, dimensions='x')

     v2 = Variable(type=pFIO_REAL32, dimensions='y')
     call v2%add_attribute('flag', .false.)

     call cf1%add_variable('v1',v1)
     call cf1%add_variable('v2',v2)
     call cf1%add_attribute('flag', .true.)
 
     call s1%push_back('v2')
     call s1%push_back('v1')
     call cf1%set_order(s1)

     call cf1%serialize(buffer)
     call FileMetaData_deserialize(buffer, cf2)

     s2 = cf2%get_order()

     @assertTrue(cf1 == cf2 )
     @assertTrue(s1 == s2 )

     call cf1%add_dimension('w', 10) 

     @assertFalse(cf1 == cf2 )

   end subroutine test_serialize