File: bitwise.t

package info (click to toggle)
nqp 2024.09%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,972 kB
  • sloc: java: 28,087; perl: 3,479; ansic: 451; makefile: 202; javascript: 68; sh: 1
file content (9 lines) | stat: -rw-r--r-- 523 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
puts "1..8"
puts "#{(not true)? 'nok' : 'ok'} 1 - loose unary 'not'"
puts "#{(!true)? 'nok' : 'ok'} 2 - tight unary not '!'"
puts "#{37&41 == 33? 'ok' : 'nok'} 3 - infix bit-and '&'"
puts "#{138 << 2 == 552? 'ok' : 'nok'} 4 - infix bitshift left '<<'"
puts "#{138 >> 2 == 34? 'ok' : 'nok'} 5 - infix bitshift right '>>'"
puts "#{138 ^ 107 == 225? 'ok' : 'nok'} 6 - infix xor '^'"
puts "#{138 | 107 == 235? 'ok' : 'nok'} 7 - infix or '|'"
puts "#{(!2==false and not 2==1+3 and 3==2+1)? 'ok': 'nok'} 8 - precedence"