1 # Copyright 1998, 1999, 2007, 2008, 2009, 2010, 2011
2 # Free Software Foundation, Inc.
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
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
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.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # This file was written by Elena Zannoni (ezannoni@cygnus.com)
19 # This file is part of the gdb testsuite
21 # tests expressions with bitwise operators, and some
23 # Does not use a target program
32 # test running programs
38 gdb_reinitialize_dir $srcdir/$subdir
41 gdb_test "print !1" ".\[0-9\]* = 0" "print value of !1"
43 gdb_test "print !0" ".\[0-9\]* = 1" "print value of !0"
45 gdb_test "print !100" ".\[0-9\]* = 0" "print value of !100"
47 gdb_test "print !1000" ".\[0-9\]* = 0" "print value of !1000"
49 gdb_test "print !10" ".\[0-9\]* = 0" "print value of !10"
51 gdb_test "print !2" ".\[0-9\]* = 0" "print value of !2 "
53 gdb_test "print 10 | 5" ".\[0-9\]* = 15" "print value of 10 | 5"
55 gdb_test "print 10 & 5" ".\[0-9\]* = 0" "print value of 10 & 5"
57 gdb_test "print 10 ^ 5" ".\[0-9\]* = 15" "print value of 10 ^ 5"
59 gdb_test "print -!0" ".\[0-9\]* = -1" "print value of -!0"
61 gdb_test "print ~-!0" ".\[0-9\]* = 0" "print value of ~-!0"
63 gdb_test "print 3 * 2 / 4.0 * 2.0" ".\[0-9\]* = 3" \
64 "print value of 3 * 2 / 4.0 * 2.0"
66 gdb_test "print 8 << 2 >> 4" ".\[0-9\]* = 2" \
67 "print value of 8 << 2 >> 4"
69 gdb_test "print -1 < 0 > 1" ".\[0-9\]* = 0" \
70 "print value of -1 < 0 > 1"
72 gdb_test "print 15 ^ 10 ^ 5 ^ 7" ".\[0-9\]* = 7" \
73 "print value of 15 ^ 10 ^ 5 ^ 7"
75 gdb_test "print 3.5 < 4.0" ".\[0-9\]* = 1" \
76 "print value of 3.5 < 4.0"
78 gdb_test "print 3.5 < -4.0" ".\[0-9\]* = 0" \
79 "print value of 3.5 < -4.0"
81 gdb_test "print 2 > -3" ".\[0-9\]* = 1" "print value of 2 > -3"
83 gdb_test "print -3>4" ".\[0-9\]* = 0" "print value of -3>4"
85 gdb_test "print (-3 > 4)" ".\[0-9\]* = 0" "print value of (-3 > 4)"
87 gdb_test "print 3>=2.5" ".\[0-9\]* = 1" "print value of 3>=2.5"
89 gdb_test "print 3>=4.5" ".\[0-9\]* = 0" "print value of 3>=4.5"
91 gdb_test "print 3==3.0" ".\[0-9\]* = 1" "print value of 3==3.0"
93 gdb_test "print 3==4.0" ".\[0-9\]* = 0" "print value of 3==4.0"
95 gdb_test "print 3!=3.0" ".\[0-9\]* = 0" "print value of 3!=3.0"
97 gdb_test "print 3!=5.0" ".\[0-9\]* = 1" "print value of 3!=5.0"
99 gdb_test "print 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" \
101 "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2"
103 gdb_test "print 1.0 || 0" ".\[0-9\]* = 1" \
104 "print value of 1.0 || 0"
106 gdb_test "print 0.0 || 1.0" ".\[0-9\]* = 1" \
107 "print value of 0.0 || 1.0"
109 gdb_test "print 0.0 || 0" ".\[0-9\]* = 0" \
110 "print value of 0.0 || 0"
112 gdb_test "print 0 || 1 && 0 | 0 ^ 0 == 8" ".\[0-9\]* = 0" \
113 "print value of 0 || 1 && 0 | 0 ^ 0 == 8"
115 gdb_test "print 0 == 8 > 128 >> 1 + 2 * 2" ".\[0-9\]* = 0" \
116 "print value of 0 == 8 > 128 >> 1 + 2 * 2"