MultPar_SingleLine_U Subroutine

public subroutine MultPar_SingleLine_U()

Arguments

None

Source Code

    subroutine MultPar_SingleLine_U()
!--------------------------------------------------------------------
      character(len=12), parameter :: u_dataType_0 = 'u_UprAir'
      character(len=10) :: directions_expected(8) = (/  &
          'north     ', 'north east', 'east      ', 'south east', &
          'south     ', 'south west', 'west      ', 'north west'  &
      /)
      integer, parameter   :: nu_0 = 6
      real(ESMF_KIND_R4), dimension(nu_0), parameter :: sigU_0 = &
           (/ 2.0, 2.0, 2.2, 2.3, 2.7, 3.2 /)
      character(len=10) :: directions(8)
      character(len=2)  :: directions_tooshort(8)
 
      character(ESMF_MAXSTR) :: failMsg
      character(ESMF_MAXSTR) :: name
      integer :: result = 0

      rc = 0
 
!''''''''''''''''''''''''''''
     !------------------------------------------------------------------------
     !EX_UTest
     ! Config Find Label Test
     write(failMsg, *) "Did not return ESMF_SUCCESS"
     write(name, *) "Config Find Label Test"
     call ESMF_ConfigFindLabel( cf, 'u-wind_error:', rc=rc) ! identifies label
     call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)

!''''''''''''''''''''''''''''

      counter_total =counter_total + 1
      if (rc == ESMF_SUCCESS) then
         counter_success =counter_success + 1
      else
         print *,'ESMF_ConfigFindLabel failed, label = u-wind_error:, rc =', rc 
         return
      endif

!''''''''''''''''''''''''''''
     !------------------------------------------------------------------------
     !EX_UTest
     ! Config Get Attribute String Test
     write(failMsg, *) "Did not return ESMF_SUCCESS"
     write(name, *) "Config Get String Test"
     call ESMF_ConfigGetAttribute( cf, u_dataType, rc =rc )  ! first token   
     call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!''''''''''''''''''''''''''''

      counter_total =counter_total + 1
      if (rc /= ESMF_SUCCESS) then
         print *,'ESMF_ConfigGetAttribute(string) failed, rc =', rc
         return
      endif

      if(u_dataType ==  u_dataType_0) then
         counter_success =counter_success + 1
      else
         print *,'ESMF_ConfigGetAttribute(string) ERROR: got  =', &
                 u_dataType, ' should be ', u_dataType_0
         return
      endif

     !------------------------------------------------------------------------
     !EX_UTest
     ! Config Get Attribute String Verification Test
     write(failMsg, *) "Attribute String value is incorrect"
     write(name, *) "Verify Attribute String Value Test"
     call ESMF_Test((u_dataType.eq.u_dataType_0), name, failMsg, result, ESMF_SRCLINE)


!''''''''''''''''''''''''''''
     !------------------------------------------------------------------------
     !EX_UTest
     ! Config Get Attribute Int Test
     write(failMsg, *) "Did not return ESMF_SUCCESS"
     write(name, *) "Config Get Int Test"
     call ESMF_ConfigGetAttribute( cf, nu, rc = rc )            ! second token
     call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
!''''''''''''''''''''''''''''

      counter_total =counter_total + 1
      if (rc /= ESMF_SUCCESS) then
         print *,'ESMF_ConfigGetAttribute(int) failed, rc =', rc
         return
      endif

      if( nu == nu_0 ) then
         counter_success =counter_success + 1
      else
         print *,'ESMF_ConfigGetAttribute(int) ERROR: got  =', nu, &
              ' should be ', nu_0 
         return
      endif

     !------------------------------------------------------------------------
     !EX_UTest
     ! Config Get Attribute Int Verification Test
     write(failMsg, *) "Attribute Int value is incorrect"
     write(name, *) "Verify Attribute Int Value Test"
     call ESMF_Test((nu.eq.nu_0), name, failMsg, result, ESMF_SRCLINE)

!''''''''''''''''''''''''''''
     !------------------------------------------------------------------------
     !EX_UTest
     ! Config Get Attribute Floats Test
     write(failMsg, *) "Did not return ESMF_SUCCESS"
     write(name, *) "Config Get Floats Test"
     call ESMF_ConfigGetAttribute(cf, sigU, count=nu, rc=rc)     ! tokens 3 thru 8
     call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)


!''''''''''''''''''''''''''''

      counter_total =counter_total + 1
      if (rc /= ESMF_SUCCESS) then
         print *,'ESMF_ConfigGetAttribute(floats) failed, rc =', rc
         return
      endif

      if( any(sigU /= sigU_0) ) then
         print *,'ESMF_ConfigGetAttribute(floats) ERROR: got sigU =', &
                  sigU(1:nu), ' should be sigU =', sigU_0(1:nu) 
         return
      else
         counter_success =counter_success + 1
      endif

     !------------------------------------------------------------------------
     !EX_UTest
     ! Config Get Attribute Floats Verification Test
     write(failMsg, *) "Attribute Floats values are incorrect"
     write(name, *) "Verify Attribute Floats Values Test"
     call ESMF_Test((all(sigU.eq.sigU_0)), name, failMsg, result, ESMF_SRCLINE)

     ! Quoted strings

     !------------------------------------------------------------------------
     !EX_UTest
     ! Config Get Attribute Quoted String Test
     write(failMsg, *) "Did not return ESMF_SUCCESS"
     write(name, *) "Config Get Quoted String Array too short Test"
     call ESMF_ConfigGetAttribute( cf, directions_tooshort, label='directions:', rc =rc )  ! first token
     call ESMF_Test((rc /= ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)

     !------------------------------------------------------------------------
     !EX_UTest
     ! Config Get Attribute Quoted String Test
     write(failMsg, *) "Did not return ESMF_SUCCESS"
     write(name, *) "Config Get Quoted String Array too short default Test"
     call ESMF_ConfigGetAttribute( cf, directions, label='directions:',  &
         default='no direction', rc =rc )  ! first token
     call ESMF_Test((rc /= ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)

     !------------------------------------------------------------------------
     !EX_UTest
     ! Config Get Attribute Quoted String Test
     write(failMsg, *) "Did not return ESMF_SUCCESS"
     write(name, *) "Config Get Quoted String Array Test"
     call ESMF_ConfigGetAttribute( cf, directions, label='directions:', rc =rc )  ! first token
     call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)

     !------------------------------------------------------------------------
     !EX_UTest
     ! Config Get Attribute Quoted String Verification Test
     write(failMsg, *) "Attribute String value is incorrect"
     write(name, *) "Verify Attribute Quoted String Array Value Test"
     call ESMF_Test(all (directions == directions_expected), name, failMsg, result, ESMF_SRCLINE)

    end subroutine MultPar_SingleLine_U