1# Copyright 1998-2020 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# 27# test running programs 28# 29 30 31gdb_exit 32gdb_start 33gdb_reinitialize_dir $srcdir/$subdir 34 35 36gdb_test "print !1" ".\[0-9\]* = 0" "print value of !1" 37 38gdb_test "print !0" ".\[0-9\]* = 1" "print value of !0" 39 40gdb_test "print !100" ".\[0-9\]* = 0" "print value of !100" 41 42gdb_test "print !1000" ".\[0-9\]* = 0" "print value of !1000" 43 44gdb_test "print !10" ".\[0-9\]* = 0" "print value of !10" 45 46gdb_test "print !2" ".\[0-9\]* = 0" "print value of !2 " 47 48gdb_test "print 10 | 5" ".\[0-9\]* = 15" "print value of 10 | 5" 49 50gdb_test "print 10 & 5" ".\[0-9\]* = 0" "print value of 10 & 5" 51 52gdb_test "print 10 ^ 5" ".\[0-9\]* = 15" "print value of 10 ^ 5" 53 54gdb_test "print -!0" ".\[0-9\]* = -1" "print value of -!0" 55 56gdb_test "print ~-!0" ".\[0-9\]* = 0" "print value of ~-!0" 57 58gdb_test "print 3 * 2 / 4.0 * 2.0" ".\[0-9\]* = 3" \ 59 "print value of 3 * 2 / 4.0 * 2.0" 60 61gdb_test "print 8 << 2 >> 4" ".\[0-9\]* = 2" \ 62 "print value of 8 << 2 >> 4" 63 64gdb_test "print -1 < 0 > 1" ".\[0-9\]* = 0" \ 65 "print value of -1 < 0 > 1" 66 67gdb_test "print 15 ^ 10 ^ 5 ^ 7" ".\[0-9\]* = 7" \ 68 "print value of 15 ^ 10 ^ 5 ^ 7" 69 70gdb_test "print 3.5 < 4.0" ".\[0-9\]* = 1" \ 71 "print value of 3.5 < 4.0" 72 73gdb_test "print 3.5 < -4.0" ".\[0-9\]* = 0" \ 74 "print value of 3.5 < -4.0" 75 76gdb_test "print 2 > -3" ".\[0-9\]* = 1" "print value of 2 > -3" 77 78gdb_test "print -3>4" ".\[0-9\]* = 0" "print value of -3>4" 79 80gdb_test "print (-3 > 4)" ".\[0-9\]* = 0" "print value of (-3 > 4)" 81 82gdb_test "print 3>=2.5" ".\[0-9\]* = 1" "print value of 3>=2.5" 83 84gdb_test "print 3>=4.5" ".\[0-9\]* = 0" "print value of 3>=4.5" 85 86gdb_test "print 3==3.0" ".\[0-9\]* = 1" "print value of 3==3.0" 87 88gdb_test "print 3==4.0" ".\[0-9\]* = 0" "print value of 3==4.0" 89 90gdb_test "print 3!=3.0" ".\[0-9\]* = 0" "print value of 3!=3.0" 91 92gdb_test "print 3!=5.0" ".\[0-9\]* = 1" "print value of 3!=5.0" 93 94gdb_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 98gdb_test "print 1.0 || 0" ".\[0-9\]* = 1" \ 99 "print value of 1.0 || 0" 100 101gdb_test "print 0.0 || 1.0" ".\[0-9\]* = 1" \ 102 "print value of 0.0 || 1.0" 103 104gdb_test "print 0.0 || 0" ".\[0-9\]* = 0" \ 105 "print value of 0.0 || 0" 106 107gdb_test "print 0 || 1 && 0 | 0 ^ 0 == 8" ".\[0-9\]* = 0" \ 108 "print value of 0 || 1 && 0 | 0 ^ 0 == 8" 109 110gdb_test "print 0 == 8 > 128 >> 1 + 2 * 2" ".\[0-9\]* = 0" \ 111 "print value of 0 == 8 > 128 >> 1 + 2 * 2" 112 113