1 # Copyright
1994-2021 Free Software Foundation
, Inc.
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
3 of the License
, or
6 #
(at your option
) any later version.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this
program.
If not
, see
<http
://www.gnu.org
/licenses
/>.
16 # This file was adapted from old Chill tests by Stan Shebs
19 load_lib
"fortran.exp"
21 if { [skip_fortran_tests
] } { continue }
23 proc test_integer_literal_types_accepted
{} {
26 # Test various decimal
values.
27 # Should be
integer*4 probably.
28 gdb_test
"pt 123" "type = int"
31 proc test_character_literal_types_accepted
{} {
34 # Test various character
values.
36 gdb_test
"pt 'a'" "type = character\\*1"
39 proc test_integer_literal_types_rejected
{} {
42 test_print_reject
"pt _"
45 proc test_logical_literal_types_accepted
{} {
48 # Test the only possible
values for a logical
, TRUE and FALSE
(and
49 # also true and false
).
51 gdb_test
"pt .TRUE." "type = logical\\*2"
52 gdb_test
"pt .FALSE." "type = logical\\*2"
53 gdb_test
"pt .true." "type = logical\\*2"
54 gdb_test
"pt .false." "type = logical\\*2"
57 proc test_float_literal_types_accepted
{} {
60 # Test various floating point formats
62 # this used to guess whether to look
for "real*4" or
63 #
"real*8" based on a target config variable, but noone
64 # maintained it properly.
66 gdb_test
"pt .44" "type = real\\*\[0-9\]+"
67 gdb_test
"pt 44.0" "type = real\\*\[0-9\]+"
68 gdb_test
"pt 10D20" "type = real\\*\[0-9\]+"
69 gdb_test
"pt 10d20" "type = real\\*\[0-9\]+"
70 gdb_test
"pt 10E20" "type = real\\*\[0-9\]+"
71 gdb_test
"pt 10e20" "type = real\\*\[0-9\]+"
74 # Test the the primitive Fortran types
, those that GDB should always
75 # know
, even
if the
program does not
define them
, are in fact
, known.
76 proc test_primitive_types_known
{} {
77 foreach type
{void character logical
*1 integer*2 integer*8 \
78 logical
*2 logical
*8 integer logical
*4 real \
80 gdb_test
"ptype $type" [string_to_regexp "type = $type"]
84 # Start with a fresh gdb.
88 gdb_reinitialize_dir $srcdir
/$subdir
90 gdb_test
"set print sevenbit-strings" ""
92 if [set_lang_fortran
] then {
93 test_primitive_types_known
94 test_integer_literal_types_accepted
95 test_integer_literal_types_rejected
96 test_logical_literal_types_accepted
97 test_character_literal_types_accepted
98 test_float_literal_types_accepted
100 warning
"$test_name tests suppressed." 0