]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/bitops.exp
Update copyright year range in all GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / bitops.exp
1 # Copyright 1998-2019 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 expressions with bitwise operators, and some
21 # logical operators
22 # Does not use a target program
23 #
24
25
26 #
27 # test running programs
28 #
29
30
31 gdb_exit
32 gdb_start
33 gdb_reinitialize_dir $srcdir/$subdir
34
35
36 gdb_test "print !1" ".\[0-9\]* = 0" "print value of !1"
37
38 gdb_test "print !0" ".\[0-9\]* = 1" "print value of !0"
39
40 gdb_test "print !100" ".\[0-9\]* = 0" "print value of !100"
41
42 gdb_test "print !1000" ".\[0-9\]* = 0" "print value of !1000"
43
44 gdb_test "print !10" ".\[0-9\]* = 0" "print value of !10"
45
46 gdb_test "print !2" ".\[0-9\]* = 0" "print value of !2 "
47
48 gdb_test "print 10 | 5" ".\[0-9\]* = 15" "print value of 10 | 5"
49
50 gdb_test "print 10 & 5" ".\[0-9\]* = 0" "print value of 10 & 5"
51
52 gdb_test "print 10 ^ 5" ".\[0-9\]* = 15" "print value of 10 ^ 5"
53
54 gdb_test "print -!0" ".\[0-9\]* = -1" "print value of -!0"
55
56 gdb_test "print ~-!0" ".\[0-9\]* = 0" "print value of ~-!0"
57
58 gdb_test "print 3 * 2 / 4.0 * 2.0" ".\[0-9\]* = 3" \
59 "print value of 3 * 2 / 4.0 * 2.0"
60
61 gdb_test "print 8 << 2 >> 4" ".\[0-9\]* = 2" \
62 "print value of 8 << 2 >> 4"
63
64 gdb_test "print -1 < 0 > 1" ".\[0-9\]* = 0" \
65 "print value of -1 < 0 > 1"
66
67 gdb_test "print 15 ^ 10 ^ 5 ^ 7" ".\[0-9\]* = 7" \
68 "print value of 15 ^ 10 ^ 5 ^ 7"
69
70 gdb_test "print 3.5 < 4.0" ".\[0-9\]* = 1" \
71 "print value of 3.5 < 4.0"
72
73 gdb_test "print 3.5 < -4.0" ".\[0-9\]* = 0" \
74 "print value of 3.5 < -4.0"
75
76 gdb_test "print 2 > -3" ".\[0-9\]* = 1" "print value of 2 > -3"
77
78 gdb_test "print -3>4" ".\[0-9\]* = 0" "print value of -3>4"
79
80 gdb_test "print (-3 > 4)" ".\[0-9\]* = 0" "print value of (-3 > 4)"
81
82 gdb_test "print 3>=2.5" ".\[0-9\]* = 1" "print value of 3>=2.5"
83
84 gdb_test "print 3>=4.5" ".\[0-9\]* = 0" "print value of 3>=4.5"
85
86 gdb_test "print 3==3.0" ".\[0-9\]* = 1" "print value of 3==3.0"
87
88 gdb_test "print 3==4.0" ".\[0-9\]* = 0" "print value of 3==4.0"
89
90 gdb_test "print 3!=3.0" ".\[0-9\]* = 0" "print value of 3!=3.0"
91
92 gdb_test "print 3!=5.0" ".\[0-9\]* = 1" "print value of 3!=5.0"
93
94 gdb_test "print 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" \
95 ".\[0-9\]* = 0" \
96 "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2"
97
98 gdb_test "print 1.0 || 0" ".\[0-9\]* = 1" \
99 "print value of 1.0 || 0"
100
101 gdb_test "print 0.0 || 1.0" ".\[0-9\]* = 1" \
102 "print value of 0.0 || 1.0"
103
104 gdb_test "print 0.0 || 0" ".\[0-9\]* = 0" \
105 "print value of 0.0 || 0"
106
107 gdb_test "print 0 || 1 && 0 | 0 ^ 0 == 8" ".\[0-9\]* = 0" \
108 "print value of 0 || 1 && 0 | 0 ^ 0 == 8"
109
110 gdb_test "print 0 == 8 > 128 >> 1 + 2 * 2" ".\[0-9\]* = 0" \
111 "print value of 0 == 8 > 128 >> 1 + 2 * 2"
112