File: testbit.rb

package info (click to toggle)
libnarray-ruby 0.5.9p7-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 432 kB
  • ctags: 517
  • sloc: ansic: 4,412; ruby: 1,281; python: 91; makefile: 5
file content (27 lines) | stat: -rw-r--r-- 331 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require "narray"

a = NArray.byte(10).indgen!

def test a, str
  print str," #=>\n"
  p eval(str)
end

test a, "a"
test a, "a & 1"
test a, "a & 2"
test a, "a & -1"

test a, "a | 1"
test a, "a | 2"
test a, "a | -1"

test a, "a ^ 1"
test a, "a ^ 2"
test a, "a ^ -1"

test a, "~a"

a = NArray.int(10).indgen!
test a, "a"
test a, "~a"