test_convert_double Subroutine

public subroutine test_convert_double()

Arguments

None

Calls

proc~~test_convert_double~~CallsGraph proc~test_convert_double test_convert_double assertequal assertequal proc~test_convert_double->assertequal finalize_udunits_system finalize_udunits_system proc~test_convert_double->finalize_udunits_system initialize_udunits_system initialize_udunits_system proc~test_convert_double->initialize_udunits_system none~convert~13 Converter%convert proc~test_convert_double->none~convert~13 proc~get_converter get_converter proc~test_convert_double->proc~get_converter interface~cv_convert_doubles cv_convert_doubles none~convert~13->interface~cv_convert_doubles none~get_cptr CptrWrapper%get_cptr none~convert~13->none~get_cptr none~is_free CptrWrapper%is_free proc~get_converter->none~is_free

Source Code

   subroutine test_convert_double()
      real(c_double), parameter :: FROM = 1.0
      real(c_double), parameter :: EXPECTED = 1000.0
      real(c_double) :: actual
      type(Converter) :: conv
      integer(ut_status) :: status
      character(len=*), parameter :: FROM_STRING = KM
      character(len=*), parameter :: TO_STRING = M

      call initialize_udunits_system(rc=status)
      @assertEqual(UT_SUCCESS, status, 'Failed to initialize')
      call get_converter(conv, FROM_STRING, TO_STRING, rc=status)
      @assertEqual(UT_SUCCESS, status, 'Failed to get converter')
      actual = conv%convert(FROM)
      @assertEqual(actual, EXPECTED, 'Actual does not equal expected.')
      call conv%free()
      call finalize_udunits_system()

   end subroutine test_convert_double