2 ! Program to test character array constructors.
4 subroutine test1 (n, t, u)
6 character(len=n) :: s(2)
10 ! A variable array constructor.
12 ! An array constructor as part of an expression.
13 if (any (s .ne. (/"Hell", "Worl"/))) call abort
19 ! A constant array constructor
20 s = (/"Hello", "World"/)
21 if ((s(1) .ne. "Hello") .or. (s(2) .ne. "World")) call abort
29 ! A large array constructor
30 s = (/'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', &
31 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'/)
36 ! Assignment with dependency
37 s = (/(s(27-i), i=1, 26)/)
41 if (t .ne. "zyxwvutsrqponmlkjihgfedcba") call abort
45 call test1 (4, "Hello", "World")