re PR libfortran/35863 ([F2003] Implement ENCODING="UTF-8")

2008-06-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/35863
	* gfortran.dg/widechar_IO_1.f90: New test.
	* gfortran.dg/widechar_IO_2.f90: New test.
	* gfortran.dg/widechar_IO_3.f90: New test.
	* gfortran.dg/widechar_IO_4.f90: New test.

From-SVN: r136766
This commit is contained in:
Jerry DeLisle 2008-06-13 20:35:12 +00:00
parent 8a22191467
commit c0d81bd8ec
5 changed files with 88 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2008-06-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/35863
* gfortran.dg/widechar_IO_1.f90: New test.
* gfortran.dg/widechar_IO_2.f90: New test.
* gfortran.dg/widechar_IO_3.f90: New test.
* gfortran.dg/widechar_IO_4.f90: New test.
2008-06-13 Tobias Burnus <burnus@net-b.de>
PR fortran/36476

View File

@ -0,0 +1,20 @@
! { dg-do run }
! Wide chracter I/O test 1, formatted and mixed kind
! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program test1
integer, parameter :: k4 = 4
character(len=10,kind=4) :: wide
character(len=10,kind=1) :: thin
character(kind=1,len=25) :: buffer
wide=k4_"Goodbye!"
thin="Hello!"
write(buffer, '(a)') wide
if (buffer /= "Goodbye!") call abort
open(10, form="formatted", access="stream", status="scratch")
write(10, '(a)') thin
rewind(10)
read(10, '(a)') wide
if (wide /= k4_"Hello!") call abort
write(buffer,*) thin, ">",wide,"<"
if (buffer /= " Hello! >Hello! <") call abort
end program test1

View File

@ -0,0 +1,19 @@
! { dg-do run }
! Wide chracter I/O test 2, formatted array write and read
! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program chkdata
integer, parameter :: k4=4
character(len=7, kind=k4), dimension(3) :: mychar
character(50) :: buffer
mychar(1) = k4_"abc1234"
mychar(2) = k4_"def5678"
mychar(3) = k4_"ghi9012"
buffer = ""
write(buffer,'(3(a))') mychar(2:3), mychar(1)
if (buffer /= "def5678ghi9012abc1234") call abort
write(buffer,'(3(a))') mychar
if (buffer /= "abc1234def5678ghi9012") call abort
mychar = ""
read(buffer,'(3(a))') mychar
if (any(mychar.ne.[ k4_"abc1234",k4_"def5678",k4_"ghi9012" ])) call abort
end program chkdata

View File

@ -0,0 +1,23 @@
! { dg-do run }
! Wide chracter I/O test 3, unformatted arrays
! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program test1
integer, parameter :: k4 = 4
character(len=10,kind=4) :: wide
character(len=10,kind=4), dimension(5,7) :: widearray
wide = k4_"abcdefg"
widearray = k4_"1234abcd"
open(10, form="unformatted", status="scratch")
write(10) wide
rewind(10)
wide = "wrong"
read(10) wide
if (wide /= k4_"abcdefg") call abort
rewind(10)
write(10) widearray(2:4,3:7)
widearray(2:4,3:7)=""
rewind(10)
read(10) widearray(2:4,3:7)
close(10)
if (any(widearray.ne.k4_"1234abcd")) call abort
end program test1

View File

@ -0,0 +1,18 @@
! { dg-do run }
! { dg-options -fbackslash }
! Wide chracter I/O test 4, formatted ISO-8859-1 characters in string
! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
! Compile with -fbackslash
integer, parameter :: k4 = 4
character(kind=1,len=15) :: buffer
character(kind=1, len=1) :: c1, c2
character(kind=4,len=20) :: str = k4_'X\xF8öABC' ! ISO-8859-1 encoded string
buffer = ""
write(buffer,'(3a)')':',trim(str),':'
if (buffer.ne.':X\xF8öABC: ') call abort
str = ""
read(buffer,'(3a)') c1,str(1:6),c2
if (c1.ne.':') call abort
if (str.ne.k4_'X\xF8öAB') call abort
if (c2.ne.'C') call abort
end