gdb/testsuite/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / bitops.exp
CommitLineData
4c38e0a4 1# Copyright 1998, 1999, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
c906108c
SS
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
c906108c 6# (at your option) any later version.
e22f8b7c 7#
c906108c
SS
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.
e22f8b7c 12#
c906108c 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c 15
c906108c
SS
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
26if $tracelevel then {
27 strace $tracelevel
28 }
29
30#
31# test running programs
32#
c906108c
SS
33
34
35gdb_exit
36gdb_start
37gdb_reinitialize_dir $srcdir/$subdir
38
39
6acb16a2
MS
40gdb_test "print !1" ".\[0-9\]* = 0" "print value of !1"
41
42gdb_test "print !0" ".\[0-9\]* = 1" "print value of !0"
43
44gdb_test "print !100" ".\[0-9\]* = 0" "print value of !100"
45
46gdb_test "print !1000" ".\[0-9\]* = 0" "print value of !1000"
47
48gdb_test "print !10" ".\[0-9\]* = 0" "print value of !10"
49
50gdb_test "print !2" ".\[0-9\]* = 0" "print value of !2 "
51
52gdb_test "print 10 | 5" ".\[0-9\]* = 15" "print value of 10 | 5"
53
54gdb_test "print 10 & 5" ".\[0-9\]* = 0" "print value of 10 & 5"
55
56gdb_test "print 10 ^ 5" ".\[0-9\]* = 15" "print value of 10 ^ 5"
57
58gdb_test "print -!0" ".\[0-9\]* = -1" "print value of -!0"
59
60gdb_test "print ~-!0" ".\[0-9\]* = 0" "print value of ~-!0"
61
62gdb_test "print 3 * 2 / 4.0 * 2.0" ".\[0-9\]* = 3" \
63 "print value of 3 * 2 / 4.0 * 2.0"
64
65gdb_test "print 8 << 2 >> 4" ".\[0-9\]* = 2" \
66 "print value of 8 << 2 >> 4"
67
68gdb_test "print -1 < 0 > 1" ".\[0-9\]* = 0" \
69 "print value of -1 < 0 > 1"
70
71gdb_test "print 15 ^ 10 ^ 5 ^ 7" ".\[0-9\]* = 7" \
72 "print value of 15 ^ 10 ^ 5 ^ 7"
73
74gdb_test "print 3.5 < 4.0" ".\[0-9\]* = 1" \
75 "print value of 3.5 < 4.0"
76
77gdb_test "print 3.5 < -4.0" ".\[0-9\]* = 0" \
78 "print value of 3.5 < -4.0"
79
80gdb_test "print 2 > -3" ".\[0-9\]* = 1" "print value of 2 > -3"
81
82gdb_test "print -3>4" ".\[0-9\]* = 0" "print value of -3>4"
83
84gdb_test "print (-3 > 4)" ".\[0-9\]* = 0" "print value of (-3 > 4)"
85
86gdb_test "print 3>=2.5" ".\[0-9\]* = 1" "print value of 3>=2.5"
87
88gdb_test "print 3>=4.5" ".\[0-9\]* = 0" "print value of 3>=4.5"
89
90gdb_test "print 3==3.0" ".\[0-9\]* = 1" "print value of 3==3.0"
91
92gdb_test "print 3==4.0" ".\[0-9\]* = 0" "print value of 3==4.0"
93
94gdb_test "print 3!=3.0" ".\[0-9\]* = 0" "print value of 3!=3.0"
95
96gdb_test "print 3!=5.0" ".\[0-9\]* = 1" "print value of 3!=5.0"
97
98gdb_test "print 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" \
99 ".\[0-9\]* = 0" \
100 "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2"
101
102gdb_test "print 1.0 || 0" ".\[0-9\]* = 1" \
2f70bcfb 103 "print value of 1.0 || 0"
6acb16a2
MS
104
105gdb_test "print 0.0 || 1.0" ".\[0-9\]* = 1" \
106 "print value of 0.0 || 1.0"
107
108gdb_test "print 0.0 || 0" ".\[0-9\]* = 0" \
109 "print value of 0.0 || 0"
110
111gdb_test "print 0 || 1 && 0 | 0 ^ 0 == 8" ".\[0-9\]* = 0" \
112 "print value of 0 || 1 && 0 | 0 ^ 0 == 8"
113
114gdb_test "print 0 == 8 > 128 >> 1 + 2 * 2" ".\[0-9\]* = 0" \
115 "print value of 0 == 8 > 128 >> 1 + 2 * 2"
c906108c 116
This page took 1.01313 seconds and 4 git commands to generate.