1 # Copyright 2021 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/>.
18 if { [skip_ada_tests] } { return -1 }
20 standard_ada_testfile opcall
22 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
26 clean_restart ${testfile}
28 set bp_location [gdb_get_line_number "STOP" ${testdir}/opcall.adb]
29 runto "opcall.adb:$bp_location"
31 gdb_test "print p" " = \\(x => 4, y => 5\\)"
33 proc test_with_menu {command result} {
36 set rxcmd [string_to_regexp $command]
44 -re "Multiple matches for \[^\r\n\]*\r\n" {
47 -re "^\\\[(\[0-9\]+)\\\] twovecs\\.*\[^\r\n\]*\r\n" {
48 set num $expect_out(1,string)
51 -re "^\\\[\[0-9\]+\\\] \[^\r\n\]*\r\n" {
52 # Any other match, we don't want.
64 # The number we just sent, ignore.
67 -re "\\\$\[0-9\]+ = (\[^\r\n\]+)\r\n" {
68 if {[regexp $result $expect_out(1,string)]} {
75 fail "$command (timeout)"
80 test_with_menu "print p + p" "\\(x => 8, y => 10\\)"
81 test_with_menu "print p - p" "\\(x => 0, y => 0\\)"
82 test_with_menu "print p * p" "\\(x => 16, y => 25\\)"
83 test_with_menu "print p / p" "\\(x => 1, y => 1\\)"
85 # See the code to understand the weird numbers here.
86 test_with_menu "print p mod p" "\\(x => 17, y => 18\\)"
87 test_with_menu "print p rem p" "\\(x => 38, y => 39\\)"
88 test_with_menu "print p ** p" "\\(x => 84, y => 105\\)"
90 test_with_menu "print p < p" "false"
91 test_with_menu "print p < p2" "true"
92 test_with_menu "print p <= p" "true"
93 test_with_menu "print p <= p2" "true"
94 test_with_menu "print p > p" "false"
95 test_with_menu "print p2 > p" "true"
96 test_with_menu "print p >= p" "true"
97 test_with_menu "print p2 >= p" "true"
98 test_with_menu "print p = p" "true"
99 test_with_menu "print p = p2" "false"
100 test_with_menu "print p /= p" "false"
101 test_with_menu "print p /= p2" "true"
103 test_with_menu "print p and p2" "\\(x => 4, y => 4\\)"
104 test_with_menu "print p or p2" "\\(x => 12, y => 13\\)"
105 test_with_menu "print p xor p2" "\\(x => 8, y => 9\\)"
107 # See the code to understand the weird numbers here.
108 test_with_menu "print p & p" "\\(x => 44, y => 55\\)"
110 test_with_menu "print -p" "\\(x => 65532, y => 65531\\)"
111 test_with_menu "print abs(-p)" "\\(x => 65532, y => 65531\\)"
112 test_with_menu "print not(p)" "\\(x => 65531, y => 65530\\)"
114 # See the code to understand the weird numbers here.
115 test_with_menu "print +(p)" "\\(x => 5, y => 4\\)"