File: bitwise.t

package info (click to toggle)
nqp 2016.12%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 7,960 kB
  • ctags: 3,884
  • sloc: java: 25,027; perl: 910; makefile: 12; sh: 2
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"