
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
161 lines
4.2 KiB
Text
161 lines
4.2 KiB
Text
# Copyright 2019-2024 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# This file tests GDB's handling of some of the builtin logical and
|
|
# arithmetic dot operators in Fortran, for example `.AND.` and `.LE.`.
|
|
|
|
load_lib "fortran.exp"
|
|
|
|
require allow_fortran_tests
|
|
|
|
proc test_dot_operations {} {
|
|
|
|
foreach_with_prefix format { "uppercase" "lowercase" } {
|
|
if {$format == "uppercase"} {
|
|
set true ".TRUE."
|
|
set false ".FALSE."
|
|
set and ".AND."
|
|
set or ".OR."
|
|
set not ".NOT."
|
|
set eqv ".EQV."
|
|
set neqv ".NEQV."
|
|
set xor ".XOR."
|
|
set eq ".EQ."
|
|
set ne ".NE."
|
|
set le ".LE."
|
|
set ge ".GE."
|
|
set lt ".LT."
|
|
set gt ".GT."
|
|
} else {
|
|
set true ".true."
|
|
set false ".false."
|
|
set and ".and."
|
|
set or ".or."
|
|
set not ".not."
|
|
set eqv ".eqv."
|
|
set neqv ".neqv."
|
|
set xor ".xor."
|
|
set eq ".eq."
|
|
set ne ".ne."
|
|
set le ".le."
|
|
set ge ".ge."
|
|
set lt ".lt."
|
|
set gt ".gt."
|
|
}
|
|
|
|
# Logical AND
|
|
gdb_test "p $true $and $true" " = .TRUE."
|
|
gdb_test "p $true $and $false" " = .FALSE."
|
|
gdb_test "p $false $and $true" " = .FALSE."
|
|
gdb_test "p $false $and $false" " = .FALSE."
|
|
|
|
# Logical OR
|
|
gdb_test "p $true $or $true" " = .TRUE."
|
|
gdb_test "p $true $or $false" " = .TRUE."
|
|
gdb_test "p $false $or $true" " = .TRUE."
|
|
gdb_test "p $false $or $false" " = .FALSE."
|
|
|
|
# Logical NOT
|
|
gdb_test "p $not $true" " = .FALSE."
|
|
gdb_test "p $not $false" " = .TRUE."
|
|
|
|
# Logical EQV
|
|
gdb_test "p $true $eqv $true" " = .TRUE."
|
|
gdb_test "p $true $eqv $false" " = .FALSE."
|
|
gdb_test "p $false $eqv $true" " = .FALSE."
|
|
gdb_test "p $false $eqv $false" " = .TRUE."
|
|
|
|
# Logical NEQV
|
|
gdb_test "p $true $neqv $true" " = .FALSE."
|
|
gdb_test "p $true $neqv $false" " = .TRUE."
|
|
gdb_test "p $false $neqv $true" " = .TRUE."
|
|
gdb_test "p $false $neqv $false" " = .FALSE."
|
|
|
|
# And the legacy alias for NEQV, XOR
|
|
gdb_test "p $true $xor $true" " = .FALSE."
|
|
gdb_test "p $true $xor $false" " = .TRUE."
|
|
gdb_test "p $false $xor $true" " = .TRUE."
|
|
gdb_test "p $false $xor $false" " = .FALSE."
|
|
|
|
# Arithmetic EQ
|
|
gdb_test "p 5 $eq 4" " = .FALSE."
|
|
gdb_test "p 4 $eq 4" " = .TRUE."
|
|
|
|
# Arithmetic NE
|
|
gdb_test "p 5 $ne 4" " = .TRUE."
|
|
gdb_test "p 4 $ne 4" " = .FALSE."
|
|
|
|
# Arithmetic LE
|
|
gdb_test "p 5 $le 4" " = .FALSE."
|
|
gdb_test "p 4 $le 4" " = .TRUE."
|
|
gdb_test "p 3 $le 4" " = .TRUE."
|
|
|
|
# Arithmetic LT
|
|
gdb_test "p 5 $lt 4" " = .FALSE."
|
|
gdb_test "p 4 $lt 4" " = .FALSE."
|
|
gdb_test "p 3 $lt 4" " = .TRUE."
|
|
|
|
# Arithmetic GE
|
|
gdb_test "p 5 $ge 4" " = .TRUE."
|
|
gdb_test "p 4 $ge 4" " = .TRUE."
|
|
gdb_test "p 3 $ge 4" " = .FALSE."
|
|
|
|
# Arithmetic GT
|
|
gdb_test "p 5 $gt 4" " = .TRUE."
|
|
gdb_test "p 4 $gt 4" " = .FALSE."
|
|
gdb_test "p 3 $gt 4" " = .FALSE."
|
|
}
|
|
|
|
# Now test the symbol based comparison operators.
|
|
|
|
# Arithmetic EQ
|
|
gdb_test "p 5 == 4" " = .FALSE."
|
|
gdb_test "p 4 == 4" " = .TRUE."
|
|
|
|
# Arithmetic NE
|
|
gdb_test "p 5 /= 4" " = .TRUE."
|
|
gdb_test "p 4 /= 4" " = .FALSE."
|
|
|
|
# Arithmetic LE
|
|
gdb_test "p 5 <= 4" " = .FALSE."
|
|
gdb_test "p 4 <= 4" " = .TRUE."
|
|
gdb_test "p 3 <= 4" " = .TRUE."
|
|
|
|
# Arithmetic LT
|
|
gdb_test "p 5 < 4" " = .FALSE."
|
|
gdb_test "p 4 < 4" " = .FALSE."
|
|
gdb_test "p 3 < 4" " = .TRUE."
|
|
|
|
# Arithmetic GE
|
|
gdb_test "p 5 >= 4" " = .TRUE."
|
|
gdb_test "p 4 >= 4" " = .TRUE."
|
|
gdb_test "p 3 >= 4" " = .FALSE."
|
|
|
|
# Arithmetic GT
|
|
gdb_test "p 5 > 4" " = .TRUE."
|
|
gdb_test "p 4 > 4" " = .FALSE."
|
|
gdb_test "p 3 > 4" " = .FALSE."
|
|
}
|
|
|
|
# Start of test script.
|
|
|
|
clean_restart
|
|
|
|
if {[set_lang_fortran]} {
|
|
test_dot_operations
|
|
} else {
|
|
warning "$test_name tests suppressed." 0
|
|
}
|
|
|