1 # Copyright
1998-2023 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
/>.
16 # This file was written by Elena Zannoni
(ezannoni@cygnus.com
)
18 # This file is part of the gdb testsuite
21 # test of evaluation of conditional expressions
, with constants and
22 # variables. Using the print and the whatis command
23 # written with the only purpose in mind to cover the holes in the
26 # source file
"int-type.c"
30 # Check to see
if we have an executable to test.
If not
, then either we
31 # haven
't tried to compile one, or the compilation failed for some reason.
32 # In either case, just notify the user and skip the tests in this file.
34 standard_testfile int-type.c
36 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
37 untested "failed to compile"
42 clean_restart ${binfile}
49 gdb_test "print (2 ? 3 : 4)" "\[0-9\]* = 3" \
50 "print value of cond expr (const true)"
52 gdb_test "print (0 ? 3 : 4)" "\[0-9\]* = 4" \
53 "print value of cond expr (const false)"
55 gdb_test_no_output "set variable x=14" "set variable x=14"
56 gdb_test_no_output "set variable y=2" "set variable y=2"
57 gdb_test_no_output "set variable z=3" "set variable z=3"
59 gdb_test "print (x ? y : z)" "\[0-9\]* = 2" \
60 "print value of cond expr (var true)"
62 gdb_test_no_output "set variable x=0" "set variable x=0"
64 gdb_test "print (x ? y : z)" "\[0-9\]* = 3" \
65 "print value of cond expr (var false)"
67 gdb_test "whatis (0 ? 3 : 4)" "type = int" \
68 "print whatis of cond expr"