2009-10-05 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / widechar_IO_2.f90
blob6b13e4f93f1a21b67e8c1ac269591d553924b2c0
1 ! { dg-do run }
2 ! Wide chracter I/O test 2, formatted array write and read
3 ! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
4 program chkdata
5 integer, parameter :: k4=4
6 character(len=7, kind=k4), dimension(3) :: mychar
7 character(50) :: buffer
8 mychar(1) = k4_"abc1234"
9 mychar(2) = k4_"def5678"
10 mychar(3) = k4_"ghi9012"
11 buffer = ""
12 write(buffer,'(3(a))') mychar(2:3), mychar(1)
13 if (buffer /= "def5678ghi9012abc1234") call abort
14 write(buffer,'(3(a))') mychar
15 if (buffer /= "abc1234def5678ghi9012") call abort
16 mychar = ""
17 read(buffer,'(3(a))') mychar
18 if (any(mychar.ne.[ k4_"abc1234",k4_"def5678",k4_"ghi9012" ])) call abort
19 end program chkdata