StringiFor lower_equal_than test.
| Type | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|
| type(string) | :: | astring | A string. |
|||
| type(string) | :: | anotherstring | A string. |
|||
| character(len=:), | allocatable | :: | acharacter | A character. |
||
| logical | :: | test_passed(9) | List of passed tests. |
program lower_equal_than
!-----------------------------------------------------------------------------------------------------------------------------------
!< StringiFor `lower_equal_than` test.
!-----------------------------------------------------------------------------------------------------------------------------------
use, intrinsic :: iso_fortran_env, only : stdout => output_unit
use stringifor, only : string
!-----------------------------------------------------------------------------------------------------------------------------------
!-----------------------------------------------------------------------------------------------------------------------------------
implicit none
type(string) :: astring !< A string.
type(string) :: anotherstring !< A string.
character(len=:), allocatable :: acharacter !< A character.
logical :: test_passed(9) !< List of passed tests.
!-----------------------------------------------------------------------------------------------------------------------------------
!-----------------------------------------------------------------------------------------------------------------------------------
test_passed = .false.
astring = 'one'
anotherstring = 'ONE'
acharacter = 'ONE'
test_passed(1) = ((astring<=anotherstring).eqv..false.)
write(stdout, "(A,L1)") 'Test "'//astring//'<='//anotherstring//'", test passed? ', test_passed(1)
test_passed(2) = ((astring<=acharacter).eqv..false.)
write(stdout, "(A,L1)") 'Test "'//astring//'<='//acharacter//'", test passed? ', test_passed(2)
test_passed(3) = ((acharacter<=astring).eqv..true.)
write(stdout, "(A,L1)") 'Test "'//acharacter//'<='//astring//'", test passed? ', test_passed(3)
astring = 'ONE'
anotherstring = 'one'
acharacter = 'one'
test_passed(4) = ((astring<=anotherstring).eqv..true.)
write(stdout, "(A,L1)") 'Test "'//astring//'<='//anotherstring//'", test passed? ', test_passed(4)
test_passed(5) = ((astring<=acharacter).eqv..true.)
write(stdout, "(A,L1)") 'Test "'//astring//'<='//acharacter//'", test passed? ', test_passed(5)
test_passed(6) = ((acharacter<=astring).eqv..false.)
write(stdout, "(A,L1)") 'Test "'//acharacter//'<='//astring//'", test passed? ', test_passed(6)
astring = 'ONE'
anotherstring = 'ONE'
acharacter = 'ONE'
test_passed(7) = ((astring<=anotherstring).eqv..true.)
write(stdout, "(A,L1)") 'Test "'//astring//'<='//anotherstring//'", test passed? ', test_passed(7)
test_passed(8) = ((astring<=acharacter).eqv..true.)
write(stdout, "(A,L1)") 'Test "'//astring//'<='//acharacter//'", test passed? ', test_passed(8)
test_passed(9) = ((acharacter<=astring).eqv..true.)
write(stdout, "(A,L1)") 'Test "'//acharacter//'<='//astring//'", test passed? ', test_passed(9)
write(stdout, "(A,L1)") new_line('a')//'Are all tests passed? ', all(test_passed)
stop
!-----------------------------------------------------------------------------------------------------------------------------------
endprogram lower_equal_than