]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - 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
1 # Copyright 1998-2023 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 standard_testfile all-types.c
31
32 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
33 return -1
34 }
35
36 #
37 # set it up at a breakpoint so we can play with the variable values
38 #
39
40 if {![runto_main]} {
41 return
42 }
43
44 # These are used as expected result values.
45 set false 0
46 set true 1
47
48 gdb_test "next" "return 0;" "continuing after dummy()"
49
50 gdb_test "print v_int+v_char" " = 71" "print value of v_int+v_char"
51
52 gdb_test "print v_int+v_short" " = 9" "print value of v_int+v_short"
53
54 gdb_test "print v_int+v_signed_char" " = 72" \
55 "print value of v_int+v_signed_char"
56
57 gdb_test "print v_int+v_unsigned_char" " = 73" \
58 "print value of v_int+v_unsigned_char"
59
60 gdb_test "print v_int+v_signed_short" " = 10" \
61 "print value of v_int+v_signed_short"
62
63 gdb_test "print v_int+v_unsigned_short" " = 11" \
64 "print value of v_int+v_unsigned_short"
65
66 gdb_test "print v_int+v_signed_int" " = 13" \
67 "print value of v_int+v_signed_int"
68
69 gdb_test "print v_int+v_unsigned_int" " = 14" \
70 "print value of v_int+v_unsigned_int"
71
72 gdb_test "print v_int+v_long" " = 15" "print value of v_int+v_long"
73
74 gdb_test "print v_int+v_signed_long" " = 16" \
75 "print value of v_int+v_signed_long"
76
77 gdb_test "print v_int+v_unsigned_long" " = 17" \
78 "print value of v_int+v_unsigned_long"
79
80 gdb_test "print v_int+v_float" " = 106.34343.*" \
81 "print value of v_int+v_float"
82
83 gdb_test "print v_int+v_double" " = 206.565.*" \
84 "print value of v_int+v_double"
85
86
87 #
88 # test the relational operators with mixed types
89 #
90
91 gdb_test "print v_int <= v_char" " = 1" "print value of v_int<=v_char"
92
93 gdb_test "print v_int <= v_short" " = $false" \
94 "print value of v_int<=v_short"
95
96 gdb_test "print v_int <= v_signed_char" " = 1" \
97 "print value of v_int<=v_signed_char"
98
99 gdb_test "print v_int <= v_unsigned_char" " = 1" \
100 "print value of v_int<=v_unsigned_char"
101
102 gdb_test "print v_int <= v_signed_short" " = $false" \
103 "print value of v_int<=v_signed_short"
104
105 gdb_test "print v_int <= v_unsigned_short" " = $false" \
106 "print value of v_int<=v_unsigned_short"
107
108 gdb_test "print v_int <= v_signed_int" " = $true" \
109 "print value of v_int<=v_signed_int"
110
111 gdb_test "print v_int <= v_unsigned_int" " = $true" \
112 "print value of v_int<=v_unsigned_int"
113
114 gdb_test "print v_int <= v_long" " = $true" "print value of v_int<=v_long"
115
116 gdb_test "print v_int <= v_signed_long" " = $true" \
117 "print value of v_int<=v_signed_long"
118
119 gdb_test "print v_int <= v_unsigned_long" " = $true" \
120 "print value of v_int<=v_unsigned_long"
121
122 gdb_test "print v_int <= v_float" " = $true" "print value of v_int<=v_float"
123
124 gdb_test "print v_int <= v_double" " = $true" \
125 "print value of v_int<=v_double"
126
127 #
128 # test the logical operators with mixed types
129 #
130
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"
134
135 gdb_test "print v_int && v_char" " = $false" "print value of v_int&&v_char"
136
137 gdb_test "print v_int && v_short" " = $true" "print value of v_int&&v_short"
138
139 gdb_test "print v_int && v_signed_char" " = $true" \
140 "print value of v_int&&v_signed_char"
141
142 gdb_test "print v_int && v_unsigned_char" " = $true" \
143 "print value of v_int&&v_unsigned_char"
144
145 gdb_test "print v_int && v_signed_short" " = $true" \
146 "print value of v_int&&v_signed_short"
147
148 gdb_test "print v_int && v_unsigned_short" " = $true" \
149 "print value of v_int&&v_unsigned_short"
150
151 gdb_test "print v_int && v_signed_int" " = $true" \
152 "print value of v_int&&v_signed_int"
153
154 gdb_test "print v_int && v_unsigned_int" " = $true" \
155 "print value of v_int&&v_unsigned_int"
156
157 gdb_test "print v_int && v_long" " = $true" "print value of v_int&&v_long"
158
159 gdb_test "print v_int && v_signed_long" " = $true" \
160 "print value of v_int&&v_signed_long"
161
162 gdb_test "print v_int && v_unsigned_long" " = $false" \
163 "print value of v_int&&v_unsigned_long"
164
165 gdb_test "print v_int && v_float" " = $true" "print value of v_int&&v_float"
166
167 gdb_test "print v_int && v_double" " = $false" \
168 "print value of v_int&&v_double"
169
170
171
172
173