* gdb.base/help.exp: Remove testing of individual command help text,
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / all-bin.exp
1 # Copyright 1998-1999, 2007-2012 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
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.
12 #
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/>.
15
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
26 #
27 # test running programs
28 #
29
30 set testfile "all-types"
31 set srcfile ${testfile}.c
32 set binfile ${objdir}/${subdir}/${testfile}
33
34 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
35 untested all-bin.exp
36 return -1
37 }
38
39 if [get_compiler_info] {
40 return -1
41 }
42
43 gdb_exit
44 gdb_start
45 gdb_reinitialize_dir $srcdir/$subdir
46 gdb_load ${binfile}
47
48
49 #
50 # set it up at a breakpoint so we can play with the variable values
51 #
52
53 if ![runto_main] then {
54 perror "couldn't run to breakpoint"
55 continue
56 }
57
58 gdb_test "next" "return 0;" "continuing after dummy()"
59
60 gdb_test "print v_int+v_char" " = 71" "print value of v_int+v_char"
61
62 gdb_test "print v_int+v_short" " = 9" "print value of v_int+v_short"
63
64 gdb_test "print v_int+v_signed_char" " = 72" \
65 "print value of v_int+v_signed_char"
66
67 gdb_test "print v_int+v_unsigned_char" " = 73" \
68 "print value of v_int+v_unsigned_char"
69
70 gdb_test "print v_int+v_signed_short" " = 10" \
71 "print value of v_int+v_signed_short"
72
73 gdb_test "print v_int+v_unsigned_short" " = 11" \
74 "print value of v_int+v_unsigned_short"
75
76 gdb_test "print v_int+v_signed_int" " = 13" \
77 "print value of v_int+v_signed_int"
78
79 gdb_test "print v_int+v_unsigned_int" " = 14" \
80 "print value of v_int+v_unsigned_int"
81
82 gdb_test "print v_int+v_long" " = 15" "print value of v_int+v_long"
83
84 gdb_test "print v_int+v_signed_long" " = 16" \
85 "print value of v_int+v_signed_long"
86
87 gdb_test "print v_int+v_unsigned_long" " = 17" \
88 "print value of v_int+v_unsigned_long"
89
90 gdb_test "print v_int+v_float" " = 106.34343.*" \
91 "print value of v_int+v_float"
92
93 gdb_test "print v_int+v_double" " = 206.565.*" \
94 "print value of v_int+v_double"
95
96
97 #
98 # test the relational operators with mixed types
99 #
100
101 gdb_test "print v_int <= v_char" " = 1" "print value of v_int<=v_char"
102
103 gdb_test "print v_int <= v_short" " = $false" \
104 "print value of v_int<=v_short"
105
106 gdb_test "print v_int <= v_signed_char" " = 1" \
107 "print value of v_int<=v_signed_char"
108
109 gdb_test "print v_int <= v_unsigned_char" " = 1" \
110 "print value of v_int<=v_unsigned_char"
111
112 gdb_test "print v_int <= v_signed_short" " = $false" \
113 "print value of v_int<=v_signed_short"
114
115 gdb_test "print v_int <= v_unsigned_short" " = $false" \
116 "print value of v_int<=v_unsigned_short"
117
118 gdb_test "print v_int <= v_signed_int" " = $true" \
119 "print value of v_int<=v_signed_int"
120
121 gdb_test "print v_int <= v_unsigned_int" " = $true" \
122 "print value of v_int<=v_unsigned_int"
123
124 gdb_test "print v_int <= v_long" " = $true" "print value of v_int<=v_long"
125
126 gdb_test "print v_int <= v_signed_long" " = $true" \
127 "print value of v_int<=v_signed_long"
128
129 gdb_test "print v_int <= v_unsigned_long" " = $true" \
130 "print value of v_int<=v_unsigned_long"
131
132 gdb_test "print v_int <= v_float" " = $true" "print value of v_int<=v_float"
133
134 gdb_test "print v_int <= v_double" " = $true" \
135 "print value of v_int<=v_double"
136
137 #
138 # test the logical operators with mixed types
139 #
140
141 gdb_test_no_output "set variable v_char=0" "set v_char=0"
142 gdb_test_no_output "set variable v_double=0.0" "set v_double=0"
143 gdb_test_no_output "set variable v_unsigned_long=0" "set v_unsigned_long=0"
144
145 gdb_test "print v_int && v_char" " = $false" "print value of v_int&&v_char"
146
147 gdb_test "print v_int && v_short" " = $true" "print value of v_int&&v_short"
148
149 gdb_test "print v_int && v_signed_char" " = $true" \
150 "print value of v_int&&v_signed_char"
151
152 gdb_test "print v_int && v_unsigned_char" " = $true" \
153 "print value of v_int&&v_unsigned_char"
154
155 gdb_test "print v_int && v_signed_short" " = $true" \
156 "print value of v_int&&v_signed_short"
157
158 gdb_test "print v_int && v_unsigned_short" " = $true" \
159 "print value of v_int&&v_unsigned_short"
160
161 gdb_test "print v_int && v_signed_int" " = $true" \
162 "print value of v_int&&v_signed_int"
163
164 gdb_test "print v_int && v_unsigned_int" " = $true" \
165 "print value of v_int&&v_unsigned_int"
166
167 gdb_test "print v_int && v_long" " = $true" "print value of v_int&&v_long"
168
169 gdb_test "print v_int && v_signed_long" " = $true" \
170 "print value of v_int&&v_signed_long"
171
172 gdb_test "print v_int && v_unsigned_long" " = $false" \
173 "print value of v_int&&v_unsigned_long"
174
175 gdb_test "print v_int && v_float" " = $true" "print value of v_int&&v_float"
176
177 gdb_test "print v_int && v_double" " = $false" \
178 "print value of v_int&&v_double"
179
180
181
182
183
This page took 0.033349 seconds and 4 git commands to generate.