OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [select_char_1.f90] - Blame information for rev 749

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
integer function char_select (s)
2
  character(len=*), intent(in) :: s
3
 
4
  select case(s)
5
    case ("foo")
6
      char_select = 1
7
    case ("bar", "gee")
8
      char_select = 2
9
    case ("111", "999")
10
      char_select = 3
11
    case ("1024", "1900")
12
      char_select = 4
13
    case ("12", "17890")
14
      char_select = 5
15
    case default
16
      char_select = -1
17
  end select
18
end function char_select
19
 
20
integer function char_select2 (s)
21
  character(len=*), intent(in) :: s
22
 
23
  char_select2 = -1
24
  select case(s)
25
    case ("foo")
26
      char_select2 = 1
27
    case ("bar", "gee")
28
      char_select2 = 2
29
    case ("111", "999")
30
      char_select2 = 3
31
    case ("1024", "1900")
32
      char_select2 = 4
33
    case ("12", "17890")
34
      char_select2 = 5
35
  end select
36
end function char_select2
37
 
38
 
39
program test
40
  interface
41
    integer function char_select (s)
42
      character(len=*), intent(in) :: s
43
    end function char_select
44
    integer function char_select2 (s)
45
      character(len=*), intent(in) :: s
46
    end function char_select2
47
  end interface
48
 
49
  if (char_select("foo") /= 1) call abort
50
  if (char_select("foo ") /= 1) call abort
51
  if (char_select("foo2 ") /= -1) call abort
52
  if (char_select("bar") /= 2) call abort
53
  if (char_select("gee") /= 2) call abort
54
  if (char_select("000") /= -1) call abort
55
  if (char_select("101") /= -1) call abort
56
  if (char_select("109") /= -1) call abort
57
  if (char_select("111") /= 3) call abort
58
  if (char_select("254") /= -1) call abort
59
  if (char_select("999") /= 3) call abort
60
  if (char_select("9989") /= -1) call abort
61
  if (char_select("1882") /= -1) call abort
62
 
63
  if (char_select2("foo") /= 1) call abort
64
  if (char_select2("foo ") /= 1) call abort
65
  if (char_select2("foo2 ") /= -1) call abort
66
  if (char_select2("bar") /= 2) call abort
67
  if (char_select2("gee") /= 2) call abort
68
  if (char_select2("000") /= -1) call abort
69
  if (char_select2("101") /= -1) call abort
70
  if (char_select2("109") /= -1) call abort
71
  if (char_select2("111") /= 3) call abort
72
  if (char_select2("254") /= -1) call abort
73
  if (char_select2("999") /= 3) call abort
74
  if (char_select2("9989") /= -1) call abort
75
  if (char_select2("1882") /= -1) call abort
76
end program test

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.