2009-10-05 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / widechar_select_1.f90
blob64315af0b71e75d9724cc140763f5128b76c6c97
1 ! { dg-do run }
2 ! { dg-options "-fbackslash" }
4 call testme(test("foo"), test4(4_"foo"), 1)
5 call testme(test(""), test4(4_""), 1)
6 call testme(test("gee"), test4(4_"gee"), 4)
7 call testme(test("bar"), test4(4_"bar"), 1)
8 call testme(test("magi"), test4(4_"magi"), 4)
9 call testme(test("magic"), test4(4_"magic"), 2)
10 call testme(test("magic "), test4(4_"magic "), 2)
11 call testme(test("magica"), test4(4_"magica"), 4)
12 call testme(test("freeze"), test4(4_"freeze"), 3)
13 call testme(test("freeze "), test4(4_"freeze "), 3)
14 call testme(test("frugal"), test4(4_"frugal"), 3)
15 call testme(test("frugal "), test4(4_"frugal "), 3)
16 call testme(test("frugal \x01"), test4(4_"frugal \x01"), 3)
17 call testme(test("frugal \xFF"), test4(4_"frugal \xFF"), 4)
19 contains
20 integer function test(s)
21 character(len=*) :: s
23 select case (s)
24 case ("":"foo")
25 test = 1
26 case ("magic")
27 test = 2
28 case ("freeze":"frugal")
29 test = 3
30 case default
31 test = 4
32 end select
33 end function test
35 integer function test4(s)
36 character(kind=4,len=*) :: s
38 select case (s)
39 case (4_"":4_"foo")
40 test4 = 1
41 case (4_"magic")
42 test4 = 2
43 case (4_"freeze":4_"frugal")
44 test4 = 3
45 case default
46 test4 = 4
47 end select
48 end function test4
50 subroutine testme(x,y,z)
51 integer :: x, y, z
52 if (x /= y) call abort
53 if (x /= z) call abort
54 end subroutine testme
55 end