]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.fortran/types.exp
Major revision to testsuites for cross-testing and DOS testing support.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.fortran / types.exp
CommitLineData
68622837
SS
1# Copyright (C) 1994 Free Software Foundation, Inc.
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
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
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.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
787f6220 15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
68622837
SS
16
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19
20# This file was adapted from Chill tests by Stan Shebs (shebs@cygnus.com).
21
22if $tracelevel then {
23 strace $tracelevel
24}
25
26set prms_id 0
27set bug_id 0
28
29# Set the current language to fortran. This counts as a test. If it
30# fails, then we skip the other tests.
31
32proc set_lang_fortran {} {
33 global prompt
787f6220
BM
34
35 if [gdb_test "set language fortran" ""] {
36 return 0;
68622837 37 }
68622837 38
787f6220
BM
39 if ![gdb_test "show language" ".* source language is \"fortran\".*"] {
40 return 1;
68622837 41 } else {
787f6220 42 return 0;
68622837
SS
43 }
44}
45
46proc test_integer_literal_types_accepted {} {
47 global prompt
68622837
SS
48
49 # Test various decimal values.
50
787f6220 51 gdb_test "pt 123" "type = int" # Should be integer*4 probably
68622837
SS
52}
53
54proc test_character_literal_types_accepted {} {
55 global prompt
68622837
SS
56
57 # Test various character values.
58
787f6220 59 gdb_test "pt 'a'" "type = character\\*1"
68622837
SS
60}
61
62proc test_integer_literal_types_rejected {} {
63 global prompt
68622837
SS
64
65 test_print_reject "pt _"
68622837
SS
66}
67
68proc test_logical_literal_types_accepted {} {
69 global prompt
68622837
SS
70
71 # Test the only possible values for a logical, TRUE and FALSE.
72
787f6220
BM
73 gdb_test "pt .TRUE." "type = logical\\*2"
74 gdb_test "pt .FALSE." "type = logical\\*2"
68622837
SS
75}
76
77proc test_float_literal_types_accepted {} {
78 global prompt
68622837
SS
79
80 # Test various floating point formats
81
787f6220
BM
82 gdb_test "pt .44" "type = real\\*8"
83 gdb_test "pt 44.0" "type = real\\*8"
84 gdb_test "pt 10D20" "type = real\\*8"
85 gdb_test "pt 10D20" "type = real\\*8"
86 gdb_test "pt 10d20" "type = real\\*8"
87 gdb_test "pt 10d20" "type = real\\*8"
88 gdb_test "pt 10E20" "type = real\\*8"
89 gdb_test "pt 10E20" "type = real\\*8"
90 gdb_test "pt 10e20" "type = real\\*8"
91 gdb_test "pt 10e20" "type = real\\*8"
68622837
SS
92}
93
94# Start with a fresh gdb.
95
96gdb_exit
97gdb_start
98gdb_reinitialize_dir $srcdir/$subdir
99
787f6220 100gdb_test "set print sevenbit-strings" ""
68622837
SS
101
102if [set_lang_fortran] then {
103 test_integer_literal_types_accepted
104 test_integer_literal_types_rejected
105 test_logical_literal_types_accepted
106 test_character_literal_types_accepted
107 test_float_literal_types_accepted
108} else {
787f6220 109 warning "$test_name tests suppressed." 0
68622837 110}