run copyright.sh for 2011.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / bitops.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 expressions with bitwise operators, and some
22# logical operators
23# Does not use a target program
24#
25
26
27if $tracelevel then {
28 strace $tracelevel
29 }
30
31#
32# test running programs
33#
c906108c
SS
34
35
36gdb_exit
37gdb_start
38gdb_reinitialize_dir $srcdir/$subdir
39
40
6acb16a2
MS
41gdb_test "print !1" ".\[0-9\]* = 0" "print value of !1"
42
43gdb_test "print !0" ".\[0-9\]* = 1" "print value of !0"
44
45gdb_test "print !100" ".\[0-9\]* = 0" "print value of !100"
46
47gdb_test "print !1000" ".\[0-9\]* = 0" "print value of !1000"
48
49gdb_test "print !10" ".\[0-9\]* = 0" "print value of !10"
50
51gdb_test "print !2" ".\[0-9\]* = 0" "print value of !2 "
52
53gdb_test "print 10 | 5" ".\[0-9\]* = 15" "print value of 10 | 5"
54
55gdb_test "print 10 & 5" ".\[0-9\]* = 0" "print value of 10 & 5"
56
57gdb_test "print 10 ^ 5" ".\[0-9\]* = 15" "print value of 10 ^ 5"
58
59gdb_test "print -!0" ".\[0-9\]* = -1" "print value of -!0"
60
61gdb_test "print ~-!0" ".\[0-9\]* = 0" "print value of ~-!0"
62
63gdb_test "print 3 * 2 / 4.0 * 2.0" ".\[0-9\]* = 3" \
64 "print value of 3 * 2 / 4.0 * 2.0"
65
66gdb_test "print 8 << 2 >> 4" ".\[0-9\]* = 2" \
67 "print value of 8 << 2 >> 4"
68
69gdb_test "print -1 < 0 > 1" ".\[0-9\]* = 0" \
70 "print value of -1 < 0 > 1"
71
72gdb_test "print 15 ^ 10 ^ 5 ^ 7" ".\[0-9\]* = 7" \
73 "print value of 15 ^ 10 ^ 5 ^ 7"
74
75gdb_test "print 3.5 < 4.0" ".\[0-9\]* = 1" \
76 "print value of 3.5 < 4.0"
77
78gdb_test "print 3.5 < -4.0" ".\[0-9\]* = 0" \
79 "print value of 3.5 < -4.0"
80
81gdb_test "print 2 > -3" ".\[0-9\]* = 1" "print value of 2 > -3"
82
83gdb_test "print -3>4" ".\[0-9\]* = 0" "print value of -3>4"
84
85gdb_test "print (-3 > 4)" ".\[0-9\]* = 0" "print value of (-3 > 4)"
86
87gdb_test "print 3>=2.5" ".\[0-9\]* = 1" "print value of 3>=2.5"
88
89gdb_test "print 3>=4.5" ".\[0-9\]* = 0" "print value of 3>=4.5"
90
91gdb_test "print 3==3.0" ".\[0-9\]* = 1" "print value of 3==3.0"
92
93gdb_test "print 3==4.0" ".\[0-9\]* = 0" "print value of 3==4.0"
94
95gdb_test "print 3!=3.0" ".\[0-9\]* = 0" "print value of 3!=3.0"
96
97gdb_test "print 3!=5.0" ".\[0-9\]* = 1" "print value of 3!=5.0"
98
99gdb_test "print 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" \
100 ".\[0-9\]* = 0" \
101 "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2"
102
103gdb_test "print 1.0 || 0" ".\[0-9\]* = 1" \
2f70bcfb 104 "print value of 1.0 || 0"
6acb16a2
MS
105
106gdb_test "print 0.0 || 1.0" ".\[0-9\]* = 1" \
107 "print value of 0.0 || 1.0"
108
109gdb_test "print 0.0 || 0" ".\[0-9\]* = 0" \
110 "print value of 0.0 || 0"
111
112gdb_test "print 0 || 1 && 0 | 0 ^ 0 == 8" ".\[0-9\]* = 0" \
113 "print value of 0 || 1 && 0 | 0 ^ 0 == 8"
114
115gdb_test "print 0 == 8 > 128 >> 1 + 2 * 2" ".\[0-9\]* = 0" \
116 "print value of 0 == 8 > 128 >> 1 + 2 * 2"
c906108c 117
This page took 1.01103 seconds and 4 git commands to generate.