Various spelling fixes.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / all-bin.exp
CommitLineData
7b6bb8da
JB
1# Copyright 1998, 1999, 2007, 2008, 2009, 2010, 2011
2# Free Software Foundation, Inc.
c906108c
SS
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
e22f8b7c 6# the Free Software Foundation; either version 3 of the License, or
c906108c 7# (at your option) any later version.
e22f8b7c 8#
c906108c
SS
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
e22f8b7c 13#
c906108c 14# You should have received a copy of the GNU General Public License
e22f8b7c 15# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c 16
c906108c
SS
17# This file was written by Elena Zannoni (ezannoni@cygnus.com)
18
19# This file is part of the gdb testsuite
20#
21# tests for arithmetic, logical and relational operators
22# with mixed types
23#
24
25
26
27if $tracelevel then {
28 strace $tracelevel
29 }
30
31#
32# test running programs
33#
c906108c
SS
34
35set testfile "all-types"
36set srcfile ${testfile}.c
37set binfile ${objdir}/${subdir}/${testfile}
38
fc91c6c2 39if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
b60f0898
JB
40 untested all-bin.exp
41 return -1
c906108c
SS
42 }
43
085dd6e6
JM
44if [get_compiler_info ${binfile}] {
45 return -1
46}
47
c906108c
SS
48gdb_exit
49gdb_start
50gdb_reinitialize_dir $srcdir/$subdir
51gdb_load ${binfile}
52
53
54#
55# set it up at a breakpoint so we can play with the variable values
56#
57
58if ![runto_main] then {
59 perror "couldn't run to breakpoint"
60 continue
61}
62
63gdb_test "next" "return 0;" "continuing after dummy()"
64
6acb16a2
MS
65gdb_test "print v_int+v_char" " = 71" "print value of v_int+v_char"
66
67gdb_test "print v_int+v_short" " = 9" "print value of v_int+v_short"
68
69gdb_test "print v_int+v_signed_char" " = 72" \
70 "print value of v_int+v_signed_char"
71
72gdb_test "print v_int+v_unsigned_char" " = 73" \
73 "print value of v_int+v_unsigned_char"
74
75gdb_test "print v_int+v_signed_short" " = 10" \
76 "print value of v_int+v_signed_short"
77
78gdb_test "print v_int+v_unsigned_short" " = 11" \
79 "print value of v_int+v_unsigned_short"
80
81gdb_test "print v_int+v_signed_int" " = 13" \
82 "print value of v_int+v_signed_int"
83
84gdb_test "print v_int+v_unsigned_int" " = 14" \
85 "print value of v_int+v_unsigned_int"
86
87gdb_test "print v_int+v_long" " = 15" "print value of v_int+v_long"
88
89gdb_test "print v_int+v_signed_long" " = 16" \
90 "print value of v_int+v_signed_long"
91
92gdb_test "print v_int+v_unsigned_long" " = 17" \
93 "print value of v_int+v_unsigned_long"
94
95gdb_test "print v_int+v_float" " = 106.34343.*" \
96 "print value of v_int+v_float"
97
98gdb_test "print v_int+v_double" " = 206.565.*" \
99 "print value of v_int+v_double"
c906108c
SS
100
101
102#
103# test the relational operators with mixed types
104#
105
6acb16a2
MS
106gdb_test "print v_int <= v_char" " = 1" "print value of v_int<=v_char"
107
108gdb_test "print v_int <= v_short" " = $false" \
109 "print value of v_int<=v_short"
110
111gdb_test "print v_int <= v_signed_char" " = 1" \
112 "print value of v_int<=v_signed_char"
113
114gdb_test "print v_int <= v_unsigned_char" " = 1" \
115 "print value of v_int<=v_unsigned_char"
116
117gdb_test "print v_int <= v_signed_short" " = $false" \
118 "print value of v_int<=v_signed_short"
119
120gdb_test "print v_int <= v_unsigned_short" " = $false" \
121 "print value of v_int<=v_unsigned_short"
c906108c 122
6acb16a2
MS
123gdb_test "print v_int <= v_signed_int" " = $true" \
124 "print value of v_int<=v_signed_int"
c906108c 125
6acb16a2
MS
126gdb_test "print v_int <= v_unsigned_int" " = $true" \
127 "print value of v_int<=v_unsigned_int"
128
129gdb_test "print v_int <= v_long" " = $true" "print value of v_int<=v_long"
130
131gdb_test "print v_int <= v_signed_long" " = $true" \
132 "print value of v_int<=v_signed_long"
133
134gdb_test "print v_int <= v_unsigned_long" " = $true" \
135 "print value of v_int<=v_unsigned_long"
136
137gdb_test "print v_int <= v_float" " = $true" "print value of v_int<=v_float"
138
139gdb_test "print v_int <= v_double" " = $true" \
140 "print value of v_int<=v_double"
c906108c
SS
141
142#
143# test the logical operators with mixed types
144#
145
6acb16a2
MS
146gdb_test_no_output "set variable v_char=0" "set v_char=0"
147gdb_test_no_output "set variable v_double=0.0" "set v_double=0"
148gdb_test_no_output "set variable v_unsigned_long=0" "set v_unsigned_long=0"
149
150gdb_test "print v_int && v_char" " = $false" "print value of v_int&&v_char"
151
152gdb_test "print v_int && v_short" " = $true" "print value of v_int&&v_short"
153
154gdb_test "print v_int && v_signed_char" " = $true" \
155 "print value of v_int&&v_signed_char"
156
157gdb_test "print v_int && v_unsigned_char" " = $true" \
158 "print value of v_int&&v_unsigned_char"
159
160gdb_test "print v_int && v_signed_short" " = $true" \
161 "print value of v_int&&v_signed_short"
162
163gdb_test "print v_int && v_unsigned_short" " = $true" \
164 "print value of v_int&&v_unsigned_short"
165
166gdb_test "print v_int && v_signed_int" " = $true" \
167 "print value of v_int&&v_signed_int"
168
169gdb_test "print v_int && v_unsigned_int" " = $true" \
170 "print value of v_int&&v_unsigned_int"
171
172gdb_test "print v_int && v_long" " = $true" "print value of v_int&&v_long"
173
174gdb_test "print v_int && v_signed_long" " = $true" \
175 "print value of v_int&&v_signed_long"
176
177gdb_test "print v_int && v_unsigned_long" " = $false" \
178 "print value of v_int&&v_unsigned_long"
179
180gdb_test "print v_int && v_float" " = $true" "print value of v_int&&v_float"
181
182gdb_test "print v_int && v_double" " = $false" \
183 "print value of v_int&&v_double"
c906108c
SS
184
185
186
187
188
This page took 1.118271 seconds and 4 git commands to generate.