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