File: bitwise.t

package info (click to toggle)
nqp 2014.07-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 23,596 kB
  • ctags: 7,993
  • sloc: ansic: 22,689; java: 20,240; cpp: 4,956; asm: 3,976; perl: 950; python: 267; sh: 245; makefile: 14
file content (9 lines) | stat: -rwxr-xr-x 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"