]>
Commit | Line | Data |
---|---|---|
7b6bb8da | 1 | # Copyright 1994, 1995, 1997, 1998, 2007, 2008, 2009, 2010, 2011 |
0fb0cc75 | 2 | # Free Software Foundation, Inc. |
c906108c SS |
3 | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
c906108c SS |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
e22f8b7c | 13 | # |
c906108c | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 16 | |
b304d130 AC |
17 | # This file was adapted from old Chill tests by Stan Shebs |
18 | # (shebs@cygnus.com). | |
c906108c SS |
19 | |
20 | if $tracelevel then { | |
21 | strace $tracelevel | |
22 | } | |
23 | ||
f1208f9e | 24 | load_lib "fortran.exp" |
c906108c | 25 | |
f1208f9e | 26 | if { [skip_fortran_tests] } { continue } |
c906108c SS |
27 | |
28 | proc test_integer_literal_types_accepted {} { | |
29 | global gdb_prompt | |
30 | ||
31 | # Test various decimal values. | |
32 | # Should be integer*4 probably. | |
33 | gdb_test "pt 123" "type = int" | |
34 | } | |
35 | ||
36 | proc test_character_literal_types_accepted {} { | |
37 | global gdb_prompt | |
38 | ||
39 | # Test various character values. | |
40 | ||
41 | gdb_test "pt 'a'" "type = character\\*1" | |
42 | } | |
43 | ||
44 | proc test_integer_literal_types_rejected {} { | |
45 | global gdb_prompt | |
46 | ||
47 | test_print_reject "pt _" | |
48 | } | |
49 | ||
50 | proc test_logical_literal_types_accepted {} { | |
51 | global gdb_prompt | |
52 | ||
53 | # Test the only possible values for a logical, TRUE and FALSE. | |
54 | ||
55 | gdb_test "pt .TRUE." "type = logical\\*2" | |
56 | gdb_test "pt .FALSE." "type = logical\\*2" | |
57 | } | |
58 | ||
59 | proc test_float_literal_types_accepted {} { | |
60 | global gdb_prompt | |
61 | ||
62 | # Test various floating point formats | |
63 | ||
64 | # this used to guess whether to look for "real*4" or | |
65 | # "real*8" based on a target config variable, but noone | |
66 | # maintained it properly. | |
67 | ||
68 | gdb_test "pt .44" "type = real\\*\[0-9\]+" | |
69 | gdb_test "pt 44.0" "type = real\\*\[0-9\]+" | |
70 | gdb_test "pt 10D20" "type = real\\*\[0-9\]+" | |
71 | gdb_test "pt 10D20" "type = real\\*\[0-9\]+" | |
72 | gdb_test "pt 10d20" "type = real\\*\[0-9\]+" | |
73 | gdb_test "pt 10d20" "type = real\\*\[0-9\]+" | |
74 | gdb_test "pt 10E20" "type = real\\*\[0-9\]+" | |
75 | gdb_test "pt 10E20" "type = real\\*\[0-9\]+" | |
76 | gdb_test "pt 10e20" "type = real\\*\[0-9\]+" | |
77 | gdb_test "pt 10e20" "type = real\\*\[0-9\]+" | |
78 | } | |
79 | ||
80 | # Start with a fresh gdb. | |
81 | ||
82 | gdb_exit | |
83 | gdb_start | |
84 | gdb_reinitialize_dir $srcdir/$subdir | |
85 | ||
86 | gdb_test "set print sevenbit-strings" "" | |
87 | ||
88 | if [set_lang_fortran] then { | |
89 | test_integer_literal_types_accepted | |
90 | test_integer_literal_types_rejected | |
91 | test_logical_literal_types_accepted | |
92 | test_character_literal_types_accepted | |
93 | test_float_literal_types_accepted | |
94 | } else { | |
95 | warning "$test_name tests suppressed." 0 | |
96 | } |