From: Tom Tromey Date: Fri, 8 May 2026 16:44:59 +0000 (-0600) Subject: Add test for Ada abs operator X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea27a7ae9048367bde15246b248f856803efc674;p=thirdparty%2Fbinutils-gdb.git Add test for Ada abs operator There were no tests in the tree for the Ada abs operator, meaning that ada_abs was never invoked during a test. This patch adds a new basic test for this. Note that operator overloading of 'abs' does seem to be tested. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34042 --- diff --git a/gdb/testsuite/gdb.ada/abs.exp b/gdb/testsuite/gdb.ada/abs.exp new file mode 100644 index 00000000000..5035604fa86 --- /dev/null +++ b/gdb/testsuite/gdb.ada/abs.exp @@ -0,0 +1,29 @@ +# Copyright 2026 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 . + +# Simple tests of the 'abs' operator. + +load_lib "ada.exp" + +require allow_ada_tests + +clean_restart + +gdb_test_no_output "set language ada" + +gdb_test "print abs -5" [quotemeta {@DECIMAL = 5}] +gdb_test "print abs 5" [quotemeta {@DECIMAL = 5}] +gdb_test "print abs(-5)" [quotemeta {@DECIMAL = 5}] +gdb_test "print abs(5)" [quotemeta {@DECIMAL = 5}]