Commit | Line | Data |
---|---|---|
e2882c85 | 1 | # Copyright 1998-2018 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 | ||
c906108c SS |
26 | # |
27 | # test running programs | |
28 | # | |
c906108c SS |
29 | |
30 | ||
31 | gdb_exit | |
32 | gdb_start | |
33 | gdb_reinitialize_dir $srcdir/$subdir | |
34 | ||
35 | ||
6acb16a2 MS |
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" \ | |
2f70bcfb | 99 | "print value of 1.0 || 0" |
6acb16a2 MS |
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" | |
c906108c | 112 |