]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add test for Ada abs operator
authorTom Tromey <tromey@adacore.com>
Fri, 8 May 2026 16:44:59 +0000 (10:44 -0600)
committerTom Tromey <tromey@adacore.com>
Thu, 21 May 2026 17:35:30 +0000 (11:35 -0600)
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

gdb/testsuite/gdb.ada/abs.exp [new file with mode: 0644]

diff --git a/gdb/testsuite/gdb.ada/abs.exp b/gdb/testsuite/gdb.ada/abs.exp
new file mode 100644 (file)
index 0000000..5035604
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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}]