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