ewah-bitset 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/extconf.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'mkmf'
2
+
3
+ $CC = "g++"
4
+ $CFLAGS += "-Iheaders -Wall -Wextra -Weffc++ -Wconversion -Wshadow -Wcast-align -Wwrite-strings -Wstrict-overflow=5 -Wpointer-arith -Winit-self"
5
+ $LIBS << " -lstdc++"
6
+
7
+ create_makefile('ewahbitset')
@@ -0,0 +1,102 @@
1
+ require 'lib/ewahbitset'
2
+
3
+ describe "An EwahBitset" do
4
+ before(:each) do
5
+ @bitset = EwahBitset.new
6
+ end
7
+
8
+ it "should set bits" do
9
+ positions = []
10
+ 0.upto(10) do |i|
11
+ @bitset.set(i * 10)
12
+ positions << i * 10
13
+ end
14
+
15
+ bPositions = []
16
+ @bitset.each do |pos|
17
+ bPositions << pos
18
+ end
19
+
20
+ positions.should == bPositions
21
+ @bitset.size_in_bits.should == 101
22
+ end
23
+
24
+ it "should reset" do
25
+ 0.upto(10) do |i|
26
+ @bitset.set(i * 10)
27
+ end
28
+
29
+ @bitset.size_in_bits.should == 101
30
+ @bitset.reset
31
+ @bitset.size_in_bits.should == 0
32
+ end
33
+
34
+ it "should compare" do
35
+ other = EwahBitset.new
36
+
37
+ 0.upto(10) do |i|
38
+ @bitset.set(i * 10)
39
+ other.set(i * 10)
40
+ end
41
+
42
+ @bitset.should == other
43
+ end
44
+
45
+ it "should perform a logical or" do
46
+ other = EwahBitset.new
47
+
48
+ positions = []
49
+ 0.upto(5) do |i|
50
+ @bitset.set(i * 10)
51
+ positions << i * 10
52
+ end
53
+
54
+ 6.upto(10) do |i|
55
+ other.set(i * 10)
56
+ positions << i * 10
57
+ end
58
+
59
+ newbits = @bitset.logical_or(other)
60
+
61
+ bPositions = []
62
+ newbits.each do |pos|
63
+ bPositions << pos
64
+ end
65
+
66
+ positions.should == bPositions
67
+ end
68
+
69
+ it "should perform a logical and operation" do
70
+ other = EwahBitset.new
71
+
72
+ positions = []
73
+ 0.upto(5) do |i|
74
+ @bitset.set(i * 10)
75
+ positions << i * 10
76
+ end
77
+
78
+ 5.upto(10) do |i|
79
+ other.set(i * 10)
80
+ positions << i * 10
81
+ end
82
+
83
+ newbits = @bitset.logical_and(other)
84
+
85
+ bPositions = []
86
+ newbits.each do |pos|
87
+ bPositions << pos
88
+ end
89
+
90
+ (positions & bPositions).should == [50]
91
+ end
92
+
93
+ it "should serialize and deserialize" do
94
+ 0.upto(10) do |i|
95
+ @bitset.set(i * 10)
96
+ end
97
+
98
+ newbits = EwahBitset.new.deserialize(@bitset.serialize)
99
+
100
+ @bitset.should == newbits
101
+ end
102
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format progress
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ewah-bitset
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Josh Ferguson
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-04-21 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description: A wrapper around Lemire's EWAHBoolArray from https://github.com/lemire/EWAHBoolArray
22
+ email: josh@besquared.net
23
+ executables: []
24
+
25
+ extensions:
26
+ - ext/extconf.rb
27
+ extra_rdoc_files:
28
+ - CHANGELOG
29
+ - LICENSE
30
+ - README.md
31
+ - ext/boolarray.h
32
+ - ext/ewah-bitset.cpp
33
+ - ext/ewah.h
34
+ - ext/extconf.rb
35
+ files:
36
+ - CHANGELOG
37
+ - LICENSE
38
+ - Manifest
39
+ - README.md
40
+ - Rakefile
41
+ - ext/boolarray.h
42
+ - ext/ewah-bitset.cpp
43
+ - ext/ewah.h
44
+ - ext/extconf.rb
45
+ - spec/ewah_bitset_spec.rb
46
+ - spec/spec.opts
47
+ - ewah-bitset.gemspec
48
+ homepage: http://www.github.com/yammer/ewah-bitset/
49
+ licenses: []
50
+
51
+ post_install_message:
52
+ rdoc_options:
53
+ - --line-numbers
54
+ - --inline-source
55
+ - --title
56
+ - Ewah-bitset
57
+ - --main
58
+ - README.md
59
+ require_paths:
60
+ - lib
61
+ - ext
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 3
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 11
77
+ segments:
78
+ - 1
79
+ - 2
80
+ version: "1.2"
81
+ requirements: []
82
+
83
+ rubyforge_project: ewah-bitset
84
+ rubygems_version: 1.8.15
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: A wrapper around Lemire's EWAHBoolArray from https://github.com/lemire/EWAHBoolArray
88
+ test_files: []
89
+