Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / all-bin.exp
CommitLineData
88b9d363 1# Copyright 1998-2022 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
4c93b1db 32if [get_compiler_info] {
085dd6e6
JM
33 return -1
34}
35
5b362f04 36if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
a64d2530
TT
37 return -1
38}
c906108c
SS
39
40#
41# set it up at a breakpoint so we can play with the variable values
42#
43
44if ![runto_main] then {
45 perror "couldn't run to breakpoint"
46 continue
47}
48
49gdb_test "next" "return 0;" "continuing after dummy()"
50
6acb16a2
MS
51gdb_test "print v_int+v_char" " = 71" "print value of v_int+v_char"
52
53gdb_test "print v_int+v_short" " = 9" "print value of v_int+v_short"
54
55gdb_test "print v_int+v_signed_char" " = 72" \
56 "print value of v_int+v_signed_char"
57
58gdb_test "print v_int+v_unsigned_char" " = 73" \
59 "print value of v_int+v_unsigned_char"
60
61gdb_test "print v_int+v_signed_short" " = 10" \
62 "print value of v_int+v_signed_short"
63
64gdb_test "print v_int+v_unsigned_short" " = 11" \
65 "print value of v_int+v_unsigned_short"
66
67gdb_test "print v_int+v_signed_int" " = 13" \
68 "print value of v_int+v_signed_int"
69
70gdb_test "print v_int+v_unsigned_int" " = 14" \
71 "print value of v_int+v_unsigned_int"
72
73gdb_test "print v_int+v_long" " = 15" "print value of v_int+v_long"
74
75gdb_test "print v_int+v_signed_long" " = 16" \
76 "print value of v_int+v_signed_long"
77
78gdb_test "print v_int+v_unsigned_long" " = 17" \
79 "print value of v_int+v_unsigned_long"
80
81gdb_test "print v_int+v_float" " = 106.34343.*" \
82 "print value of v_int+v_float"
83
84gdb_test "print v_int+v_double" " = 206.565.*" \
85 "print value of v_int+v_double"
c906108c
SS
86
87
88#
89# test the relational operators with mixed types
90#
91
6acb16a2
MS
92gdb_test "print v_int <= v_char" " = 1" "print value of v_int<=v_char"
93
94gdb_test "print v_int <= v_short" " = $false" \
95 "print value of v_int<=v_short"
96
97gdb_test "print v_int <= v_signed_char" " = 1" \
98 "print value of v_int<=v_signed_char"
99
100gdb_test "print v_int <= v_unsigned_char" " = 1" \
101 "print value of v_int<=v_unsigned_char"
102
103gdb_test "print v_int <= v_signed_short" " = $false" \
104 "print value of v_int<=v_signed_short"
105
106gdb_test "print v_int <= v_unsigned_short" " = $false" \
107 "print value of v_int<=v_unsigned_short"
c906108c 108
6acb16a2
MS
109gdb_test "print v_int <= v_signed_int" " = $true" \
110 "print value of v_int<=v_signed_int"
c906108c 111
6acb16a2
MS
112gdb_test "print v_int <= v_unsigned_int" " = $true" \
113 "print value of v_int<=v_unsigned_int"
114
115gdb_test "print v_int <= v_long" " = $true" "print value of v_int<=v_long"
116
117gdb_test "print v_int <= v_signed_long" " = $true" \
118 "print value of v_int<=v_signed_long"
119
120gdb_test "print v_int <= v_unsigned_long" " = $true" \
121 "print value of v_int<=v_unsigned_long"
122
123gdb_test "print v_int <= v_float" " = $true" "print value of v_int<=v_float"
124
125gdb_test "print v_int <= v_double" " = $true" \
126 "print value of v_int<=v_double"
c906108c
SS
127
128#
129# test the logical operators with mixed types
130#
131
6acb16a2
MS
132gdb_test_no_output "set variable v_char=0" "set v_char=0"
133gdb_test_no_output "set variable v_double=0.0" "set v_double=0"
134gdb_test_no_output "set variable v_unsigned_long=0" "set v_unsigned_long=0"
135
136gdb_test "print v_int && v_char" " = $false" "print value of v_int&&v_char"
137
138gdb_test "print v_int && v_short" " = $true" "print value of v_int&&v_short"
139
140gdb_test "print v_int && v_signed_char" " = $true" \
141 "print value of v_int&&v_signed_char"
142
143gdb_test "print v_int && v_unsigned_char" " = $true" \
144 "print value of v_int&&v_unsigned_char"
145
146gdb_test "print v_int && v_signed_short" " = $true" \
147 "print value of v_int&&v_signed_short"
148
149gdb_test "print v_int && v_unsigned_short" " = $true" \
150 "print value of v_int&&v_unsigned_short"
151
152gdb_test "print v_int && v_signed_int" " = $true" \
153 "print value of v_int&&v_signed_int"
154
155gdb_test "print v_int && v_unsigned_int" " = $true" \
156 "print value of v_int&&v_unsigned_int"
157
158gdb_test "print v_int && v_long" " = $true" "print value of v_int&&v_long"
159
160gdb_test "print v_int && v_signed_long" " = $true" \
161 "print value of v_int&&v_signed_long"
162
163gdb_test "print v_int && v_unsigned_long" " = $false" \
164 "print value of v_int&&v_unsigned_long"
165
166gdb_test "print v_int && v_float" " = $true" "print value of v_int&&v_float"
167
168gdb_test "print v_int && v_double" " = $false" \
169 "print value of v_int&&v_double"
c906108c
SS
170
171
172
173
174
This page took 2.803143 seconds and 4 git commands to generate.