is_real Program

program~~is_real~~UsesGraph program~is_real is_real iso_fortran_env iso_fortran_env iso_fortran_env->program~is_real module~penf_stringify~3 penf_stringify iso_fortran_env->module~penf_stringify~3 module~stringifor stringifor module~stringifor->program~is_real module~stringifor_string_t stringifor_string_t module~stringifor_string_t->module~stringifor module~penf~3 penf module~penf~3->module~stringifor module~penf~3->module~stringifor_string_t module~befor64 befor64 module~penf~3->module~befor64 module~befor64_pack_data_m~2 befor64_pack_data_m module~penf~3->module~befor64_pack_data_m~2 module~befor64->module~stringifor_string_t module~befor64_pack_data_m~2->module~befor64 module~penf_global_parameters_variables penf_global_parameters_variables module~penf_global_parameters_variables->module~penf~3 module~penf_b_size~4 penf_b_size module~penf_global_parameters_variables->module~penf_b_size~4 module~penf_global_parameters_variables->module~penf_stringify~3 module~penf_b_size~4->module~penf~3 module~penf_b_size~4->module~penf_stringify~3 module~penf_stringify~3->module~penf~3
Help


StringiFor is_real test.


Source Code


Variables

Type AttributesNameInitial
type(string) :: astring

A string.

logical :: test_passed(6)

List of passed tests.


Source Code

program is_real
!-----------------------------------------------------------------------------------------------------------------------------------
!< StringiFor `is_real` test.
!-----------------------------------------------------------------------------------------------------------------------------------
use, intrinsic :: iso_fortran_env, only : stdout => output_unit
use stringifor, only : string
!-----------------------------------------------------------------------------------------------------------------------------------

!-----------------------------------------------------------------------------------------------------------------------------------
implicit none
type(string) :: astring        !< A string.
logical      :: test_passed(6) !< List of passed tests.
!-----------------------------------------------------------------------------------------------------------------------------------

!-----------------------------------------------------------------------------------------------------------------------------------
test_passed = .false.

astring = '   -1212112.d0 '
test_passed(1) = astring%is_real().eqv..true.
write(stdout, "(A,L1)") '"'//astring//'" is real? ', astring%is_real()

astring = '   -1212112.d0'
test_passed(2) = astring%is_real(allow_spaces=.false.).eqv..false.
write(stdout, "(A,L1)") '"'//astring//'" is real (no spaces allowed)? ', astring%is_real(allow_spaces=.false.)

astring = '-1212112.d0   '
test_passed(3) = astring%is_real(allow_spaces=.false.).eqv..false.
write(stdout, "(A,L1)") '"'//astring//'" is real (no spaces allowed)? ', astring%is_real(allow_spaces=.false.)

astring = '+2.e20'
test_passed(4) = astring%is_real().eqv..true.
write(stdout, "(A,L1)") '"'//astring//'" is real? ', astring%is_real()

astring = ' -2.01E13 '
test_passed(5) = astring%is_real().eqv..true.
write(stdout, "(A,L1)") '"'//astring//'" is real? ', astring%is_real()

astring = ' -2.01 E13 '
test_passed(6) = astring%is_real().eqv..false.
write(stdout, "(A,L1)") '"'//astring//'" is real? ', astring%is_real()

write(stdout, "(A,L1)") new_line('a')//'Are all tests passed? ', all(test_passed)
stop
!-----------------------------------------------------------------------------------------------------------------------------------
endprogram is_real