slen Program

program~~slen~~UsesGraph program~slen slen iso_fortran_env iso_fortran_env iso_fortran_env->program~slen module~penf_stringify~3 penf_stringify iso_fortran_env->module~penf_stringify~3 module~stringifor stringifor module~stringifor->program~slen 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 slen test.


Source Code


Variables

Type AttributesNameInitial
type(string) :: astring

A string.

logical :: test_passed(4)

List of passed tests.


Source Code

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

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

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

astring = 'Hello World!   '

write(stdout, "(A)") 'Original: "'//astring//'"'

test_passed(1) = astring%len()==len('Hello World!   ')
write(stdout, "(A,I2,A,L1)") 'Slen: ', astring%len(), ' is correct? ', test_passed(1)

test_passed(2) = astring%len_trim()==len_trim('Hello World!   ')
write(stdout, "(A,I2,A,L1)") 'Slen_trim: ', astring%len_trim(), ' is correct? ', test_passed(2)

test_passed(3) = len(astring)==len('Hello World!   ')
write(stdout, "(A,I2,A,L1)") 'Len: ', len(astring), ' is correct? ', test_passed(3)

test_passed(4) = len_trim(astring)==len_trim('Hello World!   ')
write(stdout, "(A,I2,A,L1)") 'Len_trim: ', len_trim(astring), ' is correct? ', test_passed(4)

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