@@ -6,7 +6,9 @@ program test_ascii
66 whitespace, letters, is_alphanum, is_alpha, is_lower, is_upper, &
77 is_digit, is_octal_digit, is_hex_digit, is_white, is_blank, &
88 is_control, is_punctuation, is_graphical, is_printable, is_ascii, &
9- to_lower, to_upper, to_title, reverse, LF, TAB, NUL, DEL
9+ to_lower, to_upper, to_title, reverse, LF, TAB, NUL, DEL, &
10+ char_value
11+ use stdlib_kinds, only : int8, int16, int32, int64
1012
1113 implicit none
1214
@@ -73,6 +75,8 @@ program test_ascii
7375 call test_to_title_string
7476 call test_reverse_string
7577
78+ call test_char_value
79+
7680contains
7781
7882 subroutine test_is_alphanum_short
@@ -613,4 +617,47 @@ subroutine test_reverse_string
613617 call check(trim (adjustl (dlc)) == " desrever" )
614618 end subroutine test_reverse_string
615619
620+ subroutine test_char_value
621+ character (len= 128 ) :: flc
622+
623+ write (flc, ' (g0)' ) 1026192
624+ call check(char_value(1026192 ) == trim (flc))
625+
626+ write (flc, ' (g0)' ) - 124784
627+ call check(char_value(- 124784 ) == trim (flc))
628+
629+ write (flc, ' (g0)' ) 1_int8
630+ call check(char_value(1_int8 ) == trim (flc))
631+
632+ write (flc, ' (g0)' ) - 3_int8
633+ call check(char_value(- 3_int8 ) == trim (flc))
634+
635+ write (flc, ' (g0)' ) 80_int16
636+ call check(char_value(80_int16 ) == trim (flc))
637+
638+ write (flc, ' (g0)' ) 8924890_int32
639+ call check(char_value(8924890_int32 ) == trim (flc))
640+
641+ write (flc, ' (g0)' ) - 2378401_int32
642+ call check(char_value(- 2378401_int32 ) == trim (flc))
643+
644+ write (flc, ' (g0)' ) - 921092378401_int64
645+ call check(char_value(- 921092378401_int64 ) == trim (flc))
646+
647+ write (flc, ' (g0)' ) 1272835771_int64
648+ call check(char_value(1272835771_int64 ) == trim (flc))
649+
650+ write (flc, ' (g0)' ) .true.
651+ call check(char_value(.true. ) == trim (flc))
652+
653+ write (flc, ' (g0)' ) .false.
654+ call check(char_value(.false. ) == trim (flc))
655+
656+ write (flc, ' (g0)' ) .true. _int8
657+ call check(char_value(.true. _int8) == trim (flc))
658+
659+ write (flc, ' (g0)' ) .false. _int64
660+ call check(char_value(.false. _int64) == trim (flc))
661+ end subroutine test_char_value
662+
616663end program test_ascii
0 commit comments