1 # Copyright
2019-2023 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 tests GDB
's handling of some of the builtin logical and
17 # arithmetic dot operators in Fortran, for example `.AND.` and `.LE.`.
19 load_lib "fortran.exp"
21 require allow_fortran_tests
23 proc test_dot_operations {} {
25 foreach_with_prefix format { "uppercase" "lowercase" } {
26 if {$format == "uppercase"} {
59 gdb_test "p $true $and $true" " = .TRUE."
60 gdb_test "p $true $and $false" " = .FALSE."
61 gdb_test "p $false $and $true" " = .FALSE."
62 gdb_test "p $false $and $false" " = .FALSE."
65 gdb_test "p $true $or $true" " = .TRUE."
66 gdb_test "p $true $or $false" " = .TRUE."
67 gdb_test "p $false $or $true" " = .TRUE."
68 gdb_test "p $false $or $false" " = .FALSE."
71 gdb_test "p $not $true" " = .FALSE."
72 gdb_test "p $not $false" " = .TRUE."
75 gdb_test "p $true $eqv $true" " = .TRUE."
76 gdb_test "p $true $eqv $false" " = .FALSE."
77 gdb_test "p $false $eqv $true" " = .FALSE."
78 gdb_test "p $false $eqv $false" " = .TRUE."
81 gdb_test "p $true $neqv $true" " = .FALSE."
82 gdb_test "p $true $neqv $false" " = .TRUE."
83 gdb_test "p $false $neqv $true" " = .TRUE."
84 gdb_test "p $false $neqv $false" " = .FALSE."
86 # And the legacy alias for NEQV, XOR
87 gdb_test "p $true $xor $true" " = .FALSE."
88 gdb_test "p $true $xor $false" " = .TRUE."
89 gdb_test "p $false $xor $true" " = .TRUE."
90 gdb_test "p $false $xor $false" " = .FALSE."
93 gdb_test "p 5 $eq 4" " = .FALSE."
94 gdb_test "p 4 $eq 4" " = .TRUE."
97 gdb_test "p 5 $ne 4" " = .TRUE."
98 gdb_test "p 4 $ne 4" " = .FALSE."
101 gdb_test "p 5 $le 4" " = .FALSE."
102 gdb_test "p 4 $le 4" " = .TRUE."
103 gdb_test "p 3 $le 4" " = .TRUE."
106 gdb_test "p 5 $lt 4" " = .FALSE."
107 gdb_test "p 4 $lt 4" " = .FALSE."
108 gdb_test "p 3 $lt 4" " = .TRUE."
111 gdb_test "p 5 $ge 4" " = .TRUE."
112 gdb_test "p 4 $ge 4" " = .TRUE."
113 gdb_test "p 3 $ge 4" " = .FALSE."
116 gdb_test "p 5 $gt 4" " = .TRUE."
117 gdb_test "p 4 $gt 4" " = .FALSE."
118 gdb_test "p 3 $gt 4" " = .FALSE."
121 # Now test the symbol based comparison operators.
124 gdb_test "p 5 == 4" " = .FALSE."
125 gdb_test "p 4 == 4" " = .TRUE."
128 gdb_test "p 5 /= 4" " = .TRUE."
129 gdb_test "p 4 /= 4" " = .FALSE."
132 gdb_test "p 5 <= 4" " = .FALSE."
133 gdb_test "p 4 <= 4" " = .TRUE."
134 gdb_test "p 3 <= 4" " = .TRUE."
137 gdb_test "p 5 < 4" " = .FALSE."
138 gdb_test "p 4 < 4" " = .FALSE."
139 gdb_test "p 3 < 4" " = .TRUE."
142 gdb_test "p 5 >= 4" " = .TRUE."
143 gdb_test "p 4 >= 4" " = .TRUE."
144 gdb_test "p 3 >= 4" " = .FALSE."
147 gdb_test "p 5 > 4" " = .TRUE."
148 gdb_test "p 4 > 4" " = .FALSE."
149 gdb_test "p 3 > 4" " = .FALSE."
152 # Start of test script.
156 if {[set_lang_fortran]} {
159 warning "$test_name tests suppressed." 0