check_arrayRoutines Subroutine

subroutine check_arrayRoutines(res)

Arguments

Type IntentOptional AttributesName
logical, intent(inout) :: res

Calls

proc~~check_arrayroutines~~CallsGraph proc~check_arrayroutines check_arrayRoutines proc~logicaltorealarray logicalToRealArray proc~check_arrayroutines->proc~logicaltorealarray proc~realtologicalarray realToLogicalArray proc~check_arrayroutines->proc~realtologicalarray proc~checkresult checkResult proc~check_arrayroutines->proc~checkresult

Called by

proc~~check_arrayroutines~~CalledByGraph proc~check_arrayroutines check_arrayRoutines program~tem_logical_opertor_test tem_logical_opertor_test program~tem_logical_opertor_test->proc~check_arrayroutines

Contents

Source Code


Source Code

  subroutine check_arrayRoutines(res)
    logical, intent(inout) :: res
    real(kind=rk) :: logicalAsReals(5)

    logicalAsReals = logicalToRealArray(                      &
      & value = (/ .true., .true., .true., .true., .true. /), &
      & n     = 5                                             )
    res = res .and. all(                                                  &
      & pack( array = realToLogicalArray( value = logicalAsReals, n = 5), &
      &       mask  = (/ .true., .true., .true., .true., .true. /)      ) )
    call checkResult( res, 'Test array with all true failed' )


    logicalAsReals = logicalToRealArray(                      &
      & value = (/ .false., .true., .false., .true., .false. /), &
      & n     = 5                                             )
    res = res .and. all(                                                  &
      & pack( array = realToLogicalArray( value = logicalAsReals, n = 5), &
      &       mask  = (/ .false., .true., .false., .true., .false. /)   ) )
    call checkResult( res, 'Test mixed array for true failed' )
    res = res .and. .not. any(                                            &
      & pack( array = realToLogicalArray( value = logicalAsReals, n = 5), &
      &       mask  = (/ .true., .false., .true., .false., .true. /)    ) )
    call checkResult( res, 'Test mixed array for false failed' )

    logicalAsReals = logicalToRealArray(                           &
      & value = (/ .false., .false., .false., .false., .false. /), &
      & n     = 5                                                  )
    res = res .and. .not. any(                                            &
      & pack( array = realToLogicalArray( value = logicalAsReals, n = 5), &
      &       mask  = (/ .true., .true., .true., .true., .true. /)      ) )
    call checkResult( res, 'Test array with all false failed' )

  end subroutine check_arrayRoutines