Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 3/3] Add test for Ada abs operator
Date: Fri, 08 May 2026 11:34:18 -0600	[thread overview]
Message-ID: <20260508-ada-unop-atr-v1-3-6951c4566b82@adacore.com> (raw)
In-Reply-To: <20260508-ada-unop-atr-v1-0-6951c4566b82@adacore.com>

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 | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

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 <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}]

-- 
2.54.0


  parent reply	other threads:[~2026-05-08 17:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 17:34 [PATCH 0/3] Improve Ada test coverage Tom Tromey
2026-05-08 17:34 ` [PATCH 1/3] Combine ada_unop_atr and ada_unop_atr_operation::evaluate Tom Tromey
2026-05-08 17:34 ` [PATCH 2/3] Test attributes with array types Tom Tromey
2026-05-08 17:34 ` Tom Tromey [this message]
2026-05-21 17:31 ` [PATCH 0/3] Improve Ada test coverage Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260508-ada-unop-atr-v1-3-6951c4566b82@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox