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