flap_test_group Program

Uses

  • program~~flap_test_group~~UsesGraph program~flap_test_group flap_test_group module~flap flap program~flap_test_group->module~flap module~tester tester program~flap_test_group->module~tester penf penf program~flap_test_group->penf module~flap_command_line_argument_t flap_command_line_argument_t module~flap->module~flap_command_line_argument_t module~flap_command_line_arguments_group_t flap_command_line_arguments_group_t module~flap->module~flap_command_line_arguments_group_t module~flap_command_line_interface_t flap_command_line_interface_t module~flap->module~flap_command_line_interface_t iso_fortran_env iso_fortran_env module~tester->iso_fortran_env module~flap_command_line_argument_t->penf module~face face module~flap_command_line_argument_t->module~face module~flap_object_t flap_object_t module~flap_command_line_argument_t->module~flap_object_t module~flap_utils_m flap_utils_m module~flap_command_line_argument_t->module~flap_utils_m module~flap_command_line_arguments_group_t->penf module~flap_command_line_arguments_group_t->module~flap_command_line_argument_t module~flap_command_line_arguments_group_t->module~face module~flap_command_line_arguments_group_t->module~flap_object_t module~flap_command_line_interface_t->penf module~flap_command_line_interface_t->module~flap_command_line_argument_t module~flap_command_line_interface_t->module~flap_command_line_arguments_group_t module~flap_command_line_interface_t->module~face module~flap_command_line_interface_t->module~flap_object_t module~flap_command_line_interface_t->module~flap_utils_m module~face->iso_fortran_env module~flap_object_t->penf module~flap_object_t->iso_fortran_env module~flap_utils_m->penf

A testing program for FLAP, Fortran command Line Arguments Parser for poor people

Compile

See compile instructions.

Usage Compile

See usage instructions.


Calls

program~~flap_test_group~~CallsGraph program~flap_test_group flap_test_group none~assert_equal tester::tester_t%assert_equal program~flap_test_group->none~assert_equal proc~fake_call flap_test_group::fake_call program~flap_test_group->proc~fake_call proc~init~2 tester::tester_t%init program~flap_test_group->proc~init~2 proc~assert_equal_c32 tester::tester_t%assert_equal_c32 none~assert_equal->proc~assert_equal_c32 proc~assert_equal_c32_1 tester::tester_t%assert_equal_c32_1 none~assert_equal->proc~assert_equal_c32_1 proc~assert_equal_c64 tester::tester_t%assert_equal_c64 none~assert_equal->proc~assert_equal_c64 proc~assert_equal_c64_1 tester::tester_t%assert_equal_c64_1 none~assert_equal->proc~assert_equal_c64_1 proc~assert_equal_i16 tester::tester_t%assert_equal_i16 none~assert_equal->proc~assert_equal_i16 proc~assert_equal_i16_1 tester::tester_t%assert_equal_i16_1 none~assert_equal->proc~assert_equal_i16_1 proc~assert_equal_i32 tester::tester_t%assert_equal_i32 none~assert_equal->proc~assert_equal_i32 proc~assert_equal_i32_1 tester::tester_t%assert_equal_i32_1 none~assert_equal->proc~assert_equal_i32_1 proc~assert_equal_i64 tester::tester_t%assert_equal_i64 none~assert_equal->proc~assert_equal_i64 proc~assert_equal_i64_1 tester::tester_t%assert_equal_i64_1 none~assert_equal->proc~assert_equal_i64_1 proc~assert_equal_i8 tester::tester_t%assert_equal_i8 none~assert_equal->proc~assert_equal_i8 proc~assert_equal_i8_1 tester::tester_t%assert_equal_i8_1 none~assert_equal->proc~assert_equal_i8_1 proc~assert_equal_l tester::tester_t%assert_equal_l none~assert_equal->proc~assert_equal_l proc~assert_equal_l_1 tester::tester_t%assert_equal_l_1 none~assert_equal->proc~assert_equal_l_1 proc~assert_equal_r32 tester::tester_t%assert_equal_r32 none~assert_equal->proc~assert_equal_r32 proc~assert_equal_r32_1 tester::tester_t%assert_equal_r32_1 none~assert_equal->proc~assert_equal_r32_1 proc~assert_equal_r64 tester::tester_t%assert_equal_r64 none~assert_equal->proc~assert_equal_r64 proc~assert_equal_r64_1 tester::tester_t%assert_equal_r64_1 none~assert_equal->proc~assert_equal_r64_1 none~get~2 flap_command_line_interface_t::command_line_interface%get proc~fake_call->none~get~2 proc~add_group flap_command_line_interface_t::command_line_interface%add_group proc~fake_call->proc~add_group proc~add~2 flap_command_line_interface_t::command_line_interface%add proc~fake_call->proc~add~2 proc~init flap_command_line_interface_t::command_line_interface%init proc~fake_call->proc~init proc~parse~2 flap_command_line_interface_t::command_line_interface%parse proc~fake_call->proc~parse~2 proc~get_cla_list~2 flap_command_line_interface_t::command_line_interface%get_cla_list none~get~2->proc~get_cla_list~2 proc~get_cla~2 flap_command_line_interface_t::command_line_interface%get_cla none~get~2->proc~get_cla~2 proc~assign_object flap_object_t::object%assign_object proc~add_group->proc~assign_object proc~is_defined_group flap_command_line_interface_t::command_line_interface%is_defined_group proc~add_group->proc~is_defined_group proc~set_examples flap_object_t::object%set_examples proc~add_group->proc~set_examples proc~add~2->proc~add_group proc~add flap_command_line_arguments_group_t::command_line_arguments_group%add proc~add~2->proc~add proc~add~2->proc~assign_object proc~check~2 flap_command_line_argument_t::command_line_argument%check proc~add~2->proc~check~2 proc~add~2->proc~is_defined_group proc~upper_case flap_utils_m::upper_case proc~add~2->proc~upper_case proc~init->proc~assign_object proc~init->proc~set_examples proc~parse~2->proc~add~2 none~get_args flap_command_line_interface_t::command_line_interface%get_args proc~parse~2->none~get_args proc~check_m_exclusive~2 flap_command_line_interface_t::command_line_interface%check_m_exclusive proc~parse~2->proc~check_m_exclusive~2 proc~check~3 flap_command_line_interface_t::command_line_interface%check proc~parse~2->proc~check~3 proc~is_defined~2 flap_command_line_interface_t::command_line_interface%is_defined proc~parse~2->proc~is_defined~2 proc~is_required_passed flap_command_line_arguments_group_t::command_line_arguments_group%is_required_passed proc~parse~2->proc~is_required_passed proc~parse flap_command_line_arguments_group_t::command_line_arguments_group%parse proc~parse~2->proc~parse proc~print_version flap_object_t::object%print_version proc~parse~2->proc~print_version proc~sanitize_defaults flap_command_line_arguments_group_t::command_line_arguments_group%sanitize_defaults proc~parse~2->proc~sanitize_defaults proc~save_usage_to_markdown flap_command_line_interface_t::command_line_interface%save_usage_to_markdown proc~parse~2->proc~save_usage_to_markdown proc~usage~3 flap_command_line_interface_t::command_line_interface%usage proc~parse~2->proc~usage~3 proc~get_args_from_invocation flap_command_line_interface_t::command_line_interface%get_args_from_invocation none~get_args->proc~get_args_from_invocation proc~get_args_from_string flap_command_line_interface_t::command_line_interface%get_args_from_string none~get_args->proc~get_args_from_string proc~check flap_command_line_arguments_group_t::command_line_arguments_group%check proc~add->proc~check proc~check_m_exclusive~2->proc~is_defined_group proc~raise_error_m_exclude flap_command_line_arguments_group_t::command_line_arguments_group%raise_error_m_exclude proc~check_m_exclusive~2->proc~raise_error_m_exclude proc~check_action_consistency flap_command_line_argument_t::command_line_argument%check_action_consistency proc~check~2->proc~check_action_consistency proc~check_envvar_consistency flap_command_line_argument_t::command_line_argument%check_envvar_consistency proc~check~2->proc~check_envvar_consistency proc~check_m_exclude_consistency flap_command_line_argument_t::command_line_argument%check_m_exclude_consistency proc~check~2->proc~check_m_exclude_consistency proc~check_named_consistency flap_command_line_argument_t::command_line_argument%check_named_consistency proc~check~2->proc~check_named_consistency proc~check_optional_consistency flap_command_line_argument_t::command_line_argument%check_optional_consistency proc~check~2->proc~check_optional_consistency proc~check_positional_consistency flap_command_line_argument_t::command_line_argument%check_positional_consistency proc~check~2->proc~check_positional_consistency proc~check~3->proc~is_defined_group proc~check~3->proc~check proc~get_cla_list~2->proc~parse~2 proc~get_cla_list~2->proc~is_defined_group none~get flap_command_line_argument_t::command_line_argument%get proc~get_cla_list~2->none~get proc~errored~3 flap_command_line_interface_t::command_line_interface%errored proc~get_cla_list~2->proc~errored~3 proc~get_cla~2->proc~parse~2 proc~get_cla~2->proc~is_defined_group proc~get_cla~2->none~get proc~get_cla~2->proc~errored~3 proc~is_defined~2->proc~is_defined_group proc~is_defined flap_command_line_arguments_group_t::command_line_arguments_group%is_defined proc~is_defined~2->proc~is_defined proc~is_required_passed~2 flap_command_line_argument_t::command_line_argument%is_required_passed proc~is_required_passed->proc~is_required_passed~2 proc~usage flap_command_line_arguments_group_t::command_line_arguments_group%usage proc~is_required_passed->proc~usage proc~parse->proc~add proc~parse->proc~assign_object proc~parse->proc~sanitize_defaults cton cton proc~parse->cton proc~check_m_exclusive flap_command_line_arguments_group_t::command_line_arguments_group%check_m_exclusive proc~parse->proc~check_m_exclusive proc~parse->proc~is_defined proc~raise_error_duplicated_clas flap_command_line_argument_t::command_line_argument%raise_error_duplicated_clas proc~parse->proc~raise_error_duplicated_clas proc~raise_error_nargs_insufficient flap_command_line_argument_t::command_line_argument%raise_error_nargs_insufficient proc~parse->proc~raise_error_nargs_insufficient proc~raise_error_switch_unknown flap_command_line_argument_t::command_line_argument%raise_error_switch_unknown proc~parse->proc~raise_error_switch_unknown proc~raise_error_value_missing flap_command_line_argument_t::command_line_argument%raise_error_value_missing proc~parse->proc~raise_error_value_missing proc~sanitize_defaults~2 flap_command_line_argument_t::command_line_argument%sanitize_defaults proc~sanitize_defaults->proc~sanitize_defaults~2 proc~save_usage_to_markdown->proc~usage~3 proc~signature~3 flap_command_line_interface_t::command_line_interface%signature proc~save_usage_to_markdown->proc~signature~3 strz strz proc~save_usage_to_markdown->strz proc~usage~3->proc~signature~3 proc~usage~3->proc~usage proc~get_cla flap_command_line_argument_t::command_line_argument%get_cla none~get->proc~get_cla proc~get_cla_list flap_command_line_argument_t::command_line_argument%get_cla_list none~get->proc~get_cla_list proc~check->proc~is_defined proc~errored flap_command_line_arguments_group_t::command_line_arguments_group%errored proc~check->proc~errored proc~errored~2 flap_command_line_argument_t::command_line_argument%errored proc~check_action_consistency->proc~errored~2 proc~check_envvar_consistency->proc~errored~2 proc~check_m_exclude_consistency->proc~errored~2 proc~is_passed flap_command_line_arguments_group_t::command_line_arguments_group%is_passed proc~check_m_exclusive->proc~is_passed proc~raise_error_m_exclude~2 flap_command_line_argument_t::command_line_argument%raise_error_m_exclude proc~check_m_exclusive->proc~raise_error_m_exclude~2 proc~check_named_consistency->proc~errored~2 proc~check_optional_consistency->proc~errored~2 proc~check_positional_consistency->proc~errored~2 interface~colorize face::colorize proc~errored~3->interface~colorize proc~print_error_message flap_object_t::object%print_error_message proc~errored~3->proc~print_error_message proc~get_clasg_indexes flap_command_line_interface_t::command_line_interface%get_clasg_indexes proc~get_args_from_invocation->proc~get_clasg_indexes proc~get_args_from_string->proc~get_clasg_indexes proc~tokenize flap_utils_m::tokenize proc~get_args_from_string->proc~tokenize proc~is_required_passed~2->proc~errored~2 proc~raise_error_duplicated_clas->proc~errored~2 proc~raise_error_m_exclude->proc~errored proc~raise_error_nargs_insufficient->proc~errored~2 proc~raise_error_switch_unknown->proc~errored~2 proc~raise_error_value_missing->proc~errored~2 proc~replace_all flap_utils_m::replace_all proc~sanitize_defaults~2->proc~replace_all proc~unique flap_utils_m::unique proc~sanitize_defaults~2->proc~unique proc~wstrip flap_utils_m::wstrip proc~sanitize_defaults~2->proc~wstrip proc~signature flap_command_line_arguments_group_t::command_line_arguments_group%signature proc~signature~3->proc~signature proc~usage->proc~signature proc~usage~2 flap_command_line_argument_t::command_line_argument%usage proc~usage->proc~usage~2 proc~colorize_default face::colorize_default interface~colorize->proc~colorize_default proc~errored->interface~colorize proc~errored->proc~print_error_message str str proc~errored->str proc~errored~2->interface~colorize proc~errored~2->proc~print_error_message proc~errored~2->str proc~get_cla->proc~is_required_passed~2 proc~get_cla->proc~errored~2 proc~check_choices flap_command_line_argument_t::command_line_argument%check_choices proc~get_cla->proc~check_choices proc~get_cla_from_buffer flap_command_line_argument_t::command_line_argument%get_cla_from_buffer proc~get_cla->proc~get_cla_from_buffer proc~get_cla_list->proc~is_required_passed~2 proc~get_cla_list->proc~errored~2 proc~get_cla_list->proc~tokenize proc~get_cla_list_from_buffer flap_command_line_argument_t::command_line_argument%get_cla_list_from_buffer proc~get_cla_list->proc~get_cla_list_from_buffer proc~get_clasg_indexes->proc~is_defined_group proc~raise_error_m_exclude~2->proc~errored~2 proc~replace_all->proc~wstrip proc~replace flap_utils_m::replace proc~replace_all->proc~replace proc~signature~2 flap_command_line_argument_t::command_line_argument%signature proc~signature->proc~signature~2 proc~usage~2->cton proc~usage~2->interface~colorize proc~usage~2->proc~replace_all proc~usage~2->str proc~check_choices->cton proc~check_choices->proc~errored~2 proc~check_choices->proc~tokenize proc~check_choices->str proc~color_index face::color_index proc~colorize_default->proc~color_index proc~style_index face::style_index proc~colorize_default->proc~style_index proc~upper face::upper proc~colorize_default->proc~upper proc~get_cla_from_buffer->cton proc~get_cla_from_buffer->proc~errored~2 proc~get_cla_list_from_buffer->cton proc~get_cla_list_from_buffer->proc~errored~2 proc~get_cla_list_from_buffer->proc~tokenize proc~get_cla_list_from_buffer->proc~check_choices proc~signature~2->cton proc~signature~2->str proc~has_choices flap_command_line_argument_t::command_line_argument%has_choices proc~signature~2->proc~has_choices

Variables

Type Attributes Name Initial
type(tester_t) :: crash_test_dummy

Tests handler.

logical :: switch_value_domain

Switch sentinel.

logical :: switch_value_grid

Switch sentinel.

logical :: switch_value_spectrum

Switch sentinel.


Subroutines

subroutine fake_call(args, spectrum, domain, grid)

Wrapper for fake calls.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: args

Fake arguments.

logical, intent(out) :: spectrum

Spectrum value.

logical, intent(out) :: domain

Domain value.

logical, intent(out) :: grid

Grid value.

Source Code

program flap_test_group
!< A testing program for FLAP, Fortran command Line Arguments Parser for poor people
!<
!<### Compile
!< See [compile instructions](https://github.com/szaghi/FLAP/wiki/Download-compile).
!<
!<###Usage Compile
!< See [usage instructions](https://github.com/szaghi/FLAP/wiki/Testing-Programs).

use flap, only : command_line_interface
use penf
use tester

implicit none
type(tester_t)               :: crash_test_dummy      !< Tests handler.
logical                      :: switch_value_domain   !< Switch sentinel.
logical                      :: switch_value_grid     !< Switch sentinel.
logical                      :: switch_value_spectrum !< Switch sentinel.

call crash_test_dummy%init

call fake_call(args='', spectrum=switch_value_spectrum, domain=switch_value_domain, grid=switch_value_grid)
print*, 'test_group'
print*, 'spectrum = ', switch_value_spectrum
print*, 'domain   = ', switch_value_domain
print*, 'grid     = ', switch_value_grid
call crash_test_dummy%assert_equal(switch_value_spectrum, .false.)
call crash_test_dummy%assert_equal(switch_value_domain, .false.)
call crash_test_dummy%assert_equal(switch_value_grid , .false.)

call fake_call(args='new -s', spectrum=switch_value_spectrum, domain=switch_value_domain, grid=switch_value_grid)
print*, 'test_group new -s'
print*, 'spectrum = ', switch_value_spectrum
print*, 'domain   = ', switch_value_domain
print*, 'grid     = ', switch_value_grid
call crash_test_dummy%assert_equal(switch_value_spectrum, .true.)
call crash_test_dummy%assert_equal(switch_value_domain, .false.)
call crash_test_dummy%assert_equal(switch_value_grid , .false.)

call fake_call(args='new -d', spectrum=switch_value_spectrum, domain=switch_value_domain, grid=switch_value_grid)
print*, 'test_group new -d'
print*, 'spectrum = ', switch_value_spectrum
print*, 'domain   = ', switch_value_domain
print*, 'grid     = ', switch_value_grid
call crash_test_dummy%assert_equal(switch_value_spectrum, .false.)
call crash_test_dummy%assert_equal(switch_value_domain, .true.)
call crash_test_dummy%assert_equal(switch_value_grid , .false.)

call fake_call(args='new -g', spectrum=switch_value_spectrum, domain=switch_value_domain, grid=switch_value_grid)
print*, 'test_group new -g'
print*, 'spectrum = ', switch_value_spectrum
print*, 'domain   = ', switch_value_domain
print*, 'grid     = ', switch_value_grid
call crash_test_dummy%assert_equal(switch_value_spectrum, .false.)
call crash_test_dummy%assert_equal(switch_value_domain, .false.)
call crash_test_dummy%assert_equal(switch_value_grid , .true.)

call crash_test_dummy%print
contains
  subroutine fake_call(args, spectrum, domain, grid)
  !---------------------------------------------------------------------------------------------------------------------------------
  !< Wrapper for fake calls.
  !---------------------------------------------------------------------------------------------------------------------------------
  character(*), intent(in)     :: args     !< Fake arguments.
  logical,      intent(out)    :: spectrum !< Spectrum value.
  logical,      intent(out)    :: domain   !< Domain value.
  logical,      intent(out)    :: grid     !< Grid value.
  type(command_line_interface) :: cli      !< Command Line Interface (CLI).
  integer(I4P)                 :: error    !< Error trapping flag.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  call cli%init
  call cli%add_group(group='new', description='create new instance')
  call cli%add(group='new', switch='--spectrum', switch_ab='-s',            &
               help='Create new spectrum', required=.false., def='.false.', &
               act='store_true', error=error)
  if (error/=0) stop
  call cli%add(group='new', switch='--domain', switch_ab='-d',            &
               help='Create new domain', required=.false., def='.false.', &
               act='store_true', error=error)
  if (error/=0) stop
  call cli%add(group='new', switch='--grid', switch_ab='-g',            &
               help='Create new grid', required=.false., def='.false.', &
               act='store_true', error=error)
  if (error/=0) stop
  call cli%parse(args=args, error=error)
  if (error/=0) stop
  call cli%get(group='new', switch='--spectrum', val=spectrum, error=error)
  if (error/=0) stop
  call cli%get(group='new', switch='--domain', val=domain, error=error)
  if (error/=0) stop
  call cli%get(group='new', switch='--grid', val=grid, error=error)
  if (error/=0) stop
  !---------------------------------------------------------------------------------------------------------------------------------
  endsubroutine fake_call
endprogram flap_test_group