1
1
program test_ascii
2
2
3
3
use stdlib_experimental_error, only: assert
4
- use stdlib_experimental_ascii
4
+ use stdlib_experimental_ascii, only: lowercase, uppercase, digits, &
5
+ octal_digits, fullhex_digits, hex_digits, lowerhex_digits, &
6
+ whitespace, letters, is_alphanum, is_alpha, is_lower, is_upper, &
7
+ is_digit, is_octal_digit, is_hex_digit, is_white, is_blank, &
8
+ is_control, is_punctuation, is_graphical, is_printable, is_ascii, &
9
+ to_lower, to_upper, LF, TAB, NUL, DEL
5
10
6
11
write (* ,* ) " Lowercase letters: " , lowercase
7
12
write (* ,* ) " Uppercase letters: " , uppercase
@@ -35,6 +40,9 @@ program test_ascii
35
40
call test_is_white_short
36
41
call test_is_white_long
37
42
43
+ call test_is_blank_short
44
+ call test_is_blank_long
45
+
38
46
call test_is_control_short
39
47
call test_is_control_long
40
48
@@ -260,6 +268,32 @@ subroutine test_is_white_long
260
268
end do
261
269
end subroutine
262
270
271
+ subroutine test_is_blank_short
272
+ write (* ,* ) " test_is_blank_short"
273
+ call assert(is_blank(' ' ))
274
+ call assert(is_blank(TAB))
275
+ call assert(.not. is_blank(' 1' ))
276
+ call assert(.not. is_blank(' a' ))
277
+ call assert(.not. is_blank(' #' ))
278
+ end subroutine
279
+
280
+ subroutine test_is_blank_long
281
+ integer :: i
282
+ character (len= :), allocatable :: clist
283
+ write (* ,* ) " test_is_blank_long"
284
+ do i = 1 , len (whitespace)
285
+ if (whitespace(i:i) == ' ' .or. whitespace(i:i) == TAB) then
286
+ call assert(is_blank(whitespace(i:i)))
287
+ else
288
+ call assert(.not. is_blank(whitespace(i:i)))
289
+ end if
290
+ end do
291
+ clist = digits// letters
292
+ do i = 1 , len (clist)
293
+ call assert(.not. is_blank(clist(i:i)))
294
+ end do
295
+ end subroutine
296
+
263
297
subroutine test_is_control_short
264
298
write (* ,* ) " test_is_control_short"
265
299
! write(*,*) is_control('\0')
@@ -283,7 +317,7 @@ subroutine test_is_control_long
283
317
do i = 0 , 31
284
318
call assert(is_control(achar (i)))
285
319
end do
286
- call assert(is_control(del ))
320
+ call assert(is_control(DEL ))
287
321
288
322
clist = digits// letters// ' '
289
323
do i = 1 , len (clist)
0 commit comments