StringiFor decode test.
| Type | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|
| type(string) | :: | astring | A string. |
|||
| logical | :: | test_passed(1) | List of passed tests. |
program decode
!-----------------------------------------------------------------------------------------------------------------------------------
!< StringiFor `decode` test.
!-----------------------------------------------------------------------------------------------------------------------------------
use, intrinsic :: iso_fortran_env, only : stdout => output_unit
use stringifor, only : CK, string
!-----------------------------------------------------------------------------------------------------------------------------------
!-----------------------------------------------------------------------------------------------------------------------------------
implicit none
type(string) :: astring !< A string.
logical :: test_passed(1) !< List of passed tests.
!-----------------------------------------------------------------------------------------------------------------------------------
!-----------------------------------------------------------------------------------------------------------------------------------
test_passed = .false.
astring = 'SG93IGFyZSB5b3U/'
test_passed(1) = astring%decode(codec='base64')//''==CK_'How are you?'
write(stdout, "(A)") 'BASE64: "'//astring//'"'
write(stdout, "(A,L1)") 'Decoded: "'//astring%decode(codec='base64')//'", is correct? ', test_passed(1)
write(stdout, "(A,L1)") new_line('a')//'Are all tests passed? ', all(test_passed)
stop
!-----------------------------------------------------------------------------------------------------------------------------------
endprogram decode