]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/all-bin.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / all-bin.exp
CommitLineData
213516ef 1# Copyright 1998-2023 Free Software Foundation, Inc.
c906108c
SS
2
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
c906108c 6# (at your option) any later version.
e22f8b7c 7#
c906108c
SS
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.
e22f8b7c 12#
c906108c 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c 15
c906108c
SS
16# This file was written by Elena Zannoni (ezannoni@cygnus.com)
17
18# This file is part of the gdb testsuite
19#
20# tests for arithmetic, logical and relational operators
21# with mixed types
22#
23
24
25
c906108c
SS
26#
27# test running programs
28#
c906108c 29
a64d2530 30standard_testfile all-types.c
c906108c 31
5b362f04 32if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
a64d2530
TT
33 return -1
34}
c906108c
SS
35
36#
37# set it up at a breakpoint so we can play with the variable values
38#
39
65a33d75 40if {![runto_main]} {
cdd42066 41 return
c906108c
SS
42}
43
80c0a3bf
AB
44# These are used as expected result values.
45set false 0
46set true 1
47
c906108c
SS
48gdb_test "next" "return 0;" "continuing after dummy()"
49
6acb16a2
MS
50gdb_test "print v_int+v_char" " = 71" "print value of v_int+v_char"
51
52gdb_test "print v_int+v_short" " = 9" "print value of v_int+v_short"
53
54gdb_test "print v_int+v_signed_char" " = 72" \
55 "print value of v_int+v_signed_char"
56
57gdb_test "print v_int+v_unsigned_char" " = 73" \
58 "print value of v_int+v_unsigned_char"
59
60gdb_test "print v_int+v_signed_short" " = 10" \
61 "print value of v_int+v_signed_short"
62
63gdb_test "print v_int+v_unsigned_short" " = 11" \
64 "print value of v_int+v_unsigned_short"
65
66gdb_test "print v_int+v_signed_int" " = 13" \
67 "print value of v_int+v_signed_int"
68
69gdb_test "print v_int+v_unsigned_int" " = 14" \
70 "print value of v_int+v_unsigned_int"
71
72gdb_test "print v_int+v_long" " = 15" "print value of v_int+v_long"
73
74gdb_test "print v_int+v_signed_long" " = 16" \
75 "print value of v_int+v_signed_long"
76
77gdb_test "print v_int+v_unsigned_long" " = 17" \
78 "print value of v_int+v_unsigned_long"
79
80gdb_test "print v_int+v_float" " = 106.34343.*" \
81 "print value of v_int+v_float"
82
83gdb_test "print v_int+v_double" " = 206.565.*" \
84 "print value of v_int+v_double"
c906108c
SS
85
86
87#
88# test the relational operators with mixed types
89#
90
6acb16a2
MS
91gdb_test "print v_int <= v_char" " = 1" "print value of v_int<=v_char"
92
93gdb_test "print v_int <= v_short" " = $false" \
94 "print value of v_int<=v_short"
95
96gdb_test "print v_int <= v_signed_char" " = 1" \
97 "print value of v_int<=v_signed_char"
98
99gdb_test "print v_int <= v_unsigned_char" " = 1" \
100 "print value of v_int<=v_unsigned_char"
101
102gdb_test "print v_int <= v_signed_short" " = $false" \
103 "print value of v_int<=v_signed_short"
104
105gdb_test "print v_int <= v_unsigned_short" " = $false" \
106 "print value of v_int<=v_unsigned_short"
c906108c 107
6acb16a2
MS
108gdb_test "print v_int <= v_signed_int" " = $true" \
109 "print value of v_int<=v_signed_int"
c906108c 110
6acb16a2
MS
111gdb_test "print v_int <= v_unsigned_int" " = $true" \
112 "print value of v_int<=v_unsigned_int"
113
114gdb_test "print v_int <= v_long" " = $true" "print value of v_int<=v_long"
115
116gdb_test "print v_int <= v_signed_long" " = $true" \
117 "print value of v_int<=v_signed_long"
118
119gdb_test "print v_int <= v_unsigned_long" " = $true" \
120 "print value of v_int<=v_unsigned_long"
121
122gdb_test "print v_int <= v_float" " = $true" "print value of v_int<=v_float"
123
124gdb_test "print v_int <= v_double" " = $true" \
125 "print value of v_int<=v_double"
c906108c
SS
126
127#
128# test the logical operators with mixed types
129#
130
6acb16a2
MS
131gdb_test_no_output "set variable v_char=0" "set v_char=0"
132gdb_test_no_output "set variable v_double=0.0" "set v_double=0"
133gdb_test_no_output "set variable v_unsigned_long=0" "set v_unsigned_long=0"
134
135gdb_test "print v_int && v_char" " = $false" "print value of v_int&&v_char"
136
137gdb_test "print v_int && v_short" " = $true" "print value of v_int&&v_short"
138
139gdb_test "print v_int && v_signed_char" " = $true" \
140 "print value of v_int&&v_signed_char"
141
142gdb_test "print v_int && v_unsigned_char" " = $true" \
143 "print value of v_int&&v_unsigned_char"
144
145gdb_test "print v_int && v_signed_short" " = $true" \
146 "print value of v_int&&v_signed_short"
147
148gdb_test "print v_int && v_unsigned_short" " = $true" \
149 "print value of v_int&&v_unsigned_short"
150
151gdb_test "print v_int && v_signed_int" " = $true" \
152 "print value of v_int&&v_signed_int"
153
154gdb_test "print v_int && v_unsigned_int" " = $true" \
155 "print value of v_int&&v_unsigned_int"
156
157gdb_test "print v_int && v_long" " = $true" "print value of v_int&&v_long"
158
159gdb_test "print v_int && v_signed_long" " = $true" \
160 "print value of v_int&&v_signed_long"
161
162gdb_test "print v_int && v_unsigned_long" " = $false" \
163 "print value of v_int&&v_unsigned_long"
164
165gdb_test "print v_int && v_float" " = $true" "print value of v_int&&v_float"
166
167gdb_test "print v_int && v_double" " = $false" \
168 "print value of v_int&&v_double"
c906108c
SS
169
170
171
172
173