Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.base / all-bin.exp
blobb60768c5d334ac26e2c83cae7b06662ae2bbca94
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
20 # tests for arithmetic, logical and relational operators
21 # with mixed types
22
27 # test running programs
30 standard_testfile all-types.c
32 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
33     return -1
37 # set it up at a breakpoint so we can play with the variable values
40 if {![runto_main]} {
41     return
44 # These are used as expected result values.
45 set false 0
46 set true 1
48 gdb_test "next" "return 0;" "continuing after dummy()"
50 gdb_test "print v_int+v_char" " = 71" "print value of v_int+v_char"
52 gdb_test "print v_int+v_short" " = 9" "print value of v_int+v_short"
54 gdb_test "print v_int+v_signed_char" " = 72" \
55     "print value of v_int+v_signed_char"
57 gdb_test "print v_int+v_unsigned_char" " = 73" \
58     "print value of v_int+v_unsigned_char"
60 gdb_test "print v_int+v_signed_short" " = 10" \
61     "print value of v_int+v_signed_short"
63 gdb_test "print v_int+v_unsigned_short" " = 11" \
64     "print value of v_int+v_unsigned_short"
66 gdb_test "print v_int+v_signed_int" " = 13" \
67     "print value of v_int+v_signed_int"
69 gdb_test "print v_int+v_unsigned_int" " = 14" \
70     "print value of v_int+v_unsigned_int"
72 gdb_test "print v_int+v_long" " = 15" "print value of v_int+v_long"
74 gdb_test "print v_int+v_signed_long" " = 16" \
75     "print value of v_int+v_signed_long"
77 gdb_test "print v_int+v_unsigned_long" " = 17" \
78     "print value of v_int+v_unsigned_long"
80 gdb_test "print v_int+v_float" " = 106.34343.*" \
81     "print value of v_int+v_float"
83 gdb_test "print v_int+v_double" " = 206.565.*" \
84     "print value of v_int+v_double"
88 # test the relational operators with mixed types
91 gdb_test "print v_int <= v_char" " = 1" "print value of v_int<=v_char"
93 gdb_test "print v_int <= v_short" " = $false" \
94     "print value of v_int<=v_short"
96 gdb_test "print v_int <= v_signed_char" " = 1" \
97     "print value of v_int<=v_signed_char"
99 gdb_test "print v_int <= v_unsigned_char" " = 1" \
100     "print value of v_int<=v_unsigned_char"
102 gdb_test "print v_int <= v_signed_short" " = $false" \
103     "print value of v_int<=v_signed_short"
105 gdb_test "print v_int <= v_unsigned_short" " = $false" \
106     "print value of v_int<=v_unsigned_short"
108 gdb_test "print v_int <= v_signed_int" " = $true" \
109     "print value of v_int<=v_signed_int"
111 gdb_test "print v_int <= v_unsigned_int" " = $true" \
112     "print value of v_int<=v_unsigned_int"
114 gdb_test "print v_int <= v_long" " = $true" "print value of v_int<=v_long"
116 gdb_test "print v_int <= v_signed_long" " = $true" \
117     "print value of v_int<=v_signed_long"
119 gdb_test "print v_int <= v_unsigned_long" " = $true" \
120     "print value of v_int<=v_unsigned_long"
122 gdb_test "print v_int <= v_float" " = $true" "print value of v_int<=v_float"
124 gdb_test "print v_int <= v_double" " = $true" \
125     "print value of v_int<=v_double"
128 # test the logical operators with mixed types
131 gdb_test_no_output "set variable v_char=0" "set v_char=0"
132 gdb_test_no_output "set variable v_double=0.0" "set v_double=0"
133 gdb_test_no_output "set variable v_unsigned_long=0" "set v_unsigned_long=0"
135 gdb_test "print v_int && v_char" " = $false" "print value of v_int&&v_char"
137 gdb_test "print v_int && v_short" " = $true" "print value of v_int&&v_short"
139 gdb_test "print v_int && v_signed_char" " = $true" \
140     "print value of v_int&&v_signed_char"
142 gdb_test "print v_int && v_unsigned_char" " = $true" \
143     "print value of v_int&&v_unsigned_char"
145 gdb_test "print v_int && v_signed_short" " = $true" \
146     "print value of v_int&&v_signed_short"
148 gdb_test "print v_int && v_unsigned_short" " = $true" \
149     "print value of v_int&&v_unsigned_short"
151 gdb_test "print v_int && v_signed_int" " = $true" \
152     "print value of v_int&&v_signed_int"
154 gdb_test "print v_int && v_unsigned_int" " = $true" \
155     "print value of v_int&&v_unsigned_int"
157 gdb_test "print v_int && v_long" " = $true" "print value of v_int&&v_long"
159 gdb_test "print v_int && v_signed_long" " = $true" \
160     "print value of v_int&&v_signed_long"
162 gdb_test "print v_int && v_unsigned_long" " = $false" \
163     "print value of v_int&&v_unsigned_long"
165 gdb_test "print v_int && v_float" " = $true" "print value of v_int&&v_float"
167 gdb_test "print v_int && v_double" " = $false" \
168     "print value of v_int&&v_double"