test_write_read_trivial Subroutine

public subroutine test_write_read_trivial()

Arguments

None

Calls

proc~~test_write_read_trivial~~CallsGraph proc~test_write_read_trivial test_write_read_trivial assertequal assertequal proc~test_write_read_trivial->assertequal asserttrue asserttrue proc~test_write_read_trivial->asserttrue none~add_dimension FileMetadata%add_dimension proc~test_write_read_trivial->none~add_dimension none~create~2 NetCDF4_FileFormatter%create proc~test_write_read_trivial->none~create~2 insert insert none~add_dimension->insert proc~mapl_return MAPL_Return none~add_dimension->proc~mapl_return nf90_create nf90_create none~create~2->nf90_create none~create~2->proc~mapl_return proc~mapl_verify MAPL_Verify none~create~2->proc~mapl_verify proc~mapl_return->insert at at proc~mapl_return->at proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Source Code

   subroutine test_write_read_trivial()
      type (NetCDF4_FileFormatter) :: formatter
      type (FileMetadata) :: cf_expected
      type (FileMetadata) :: cf_found
      integer :: status

      call cf_expected%add_dimension('x',1)

      call formatter%create('test.nc', rc=status)
      @assertEqual(NF90_NOERR, status)
      call formatter%write(cf_expected, rc=status)
      @assertEqual(0, NF90_NOERR)
      call formatter%close(rc=status)
      @assertEqual(0, NF90_NOERR)

      call formatter%open('test.nc', mode=NF90_NOWRITE, rc=status)
      @assertEqual(0, NF90_NOERR)
      cf_found = formatter%read(rc=status)
      call formatter%close(rc=status)
      @assertEqual(0, NF90_NOERR)

      @assertTrue(cf_expected == cf_found)

   end subroutine test_write_read_trivial