Skip to content

Commit 665f356

Browse files
committed
Update in-place operations and cardinality methods to use macros
* Add a few more tests. * Increase version to `v0.5.0`. * Update `README` to specify `shard.yml` as the installation method.
1 parent 2b42636 commit 665f356

File tree

5 files changed

+145
-220
lines changed

5 files changed

+145
-220
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ The original motivation for `sparsebitset` comes from a need to store custom ind
2828

2929
### Installation
3030

31-
Add this line to your application's `Projectfile`:
31+
Add this line to your application's `shard.yml`:
3232

33-
```crystal
34-
deps do
35-
github "js-ojus/sparsebitset.cr"
36-
end
33+
```yaml
34+
dependencies:
35+
sparsebitset:
36+
github: js-ojus/sparsebitset.cr
37+
version: ">= 0.5.0"
3738
```
3839
3940
### Usage

shard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sparsebitset
2-
version: 0.4.1
2+
version: 0.5.0
33

44
authors:
55
- JONNALAGADDA Srinivas <js@ojuslabs.com>

spec/sparsebitset_spec.cr

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,40 @@ describe SparseBitSet do
715715
end
716716
ary.should eq([1_u64, 10_u64, 100_u64, 1000_u64])
717717
end
718+
719+
it "should answer a full symmetric_difference" do
720+
s = BitSet.new()
721+
s.set(1_u64)
722+
t = BitSet.new()
723+
t.set(10_u64)
724+
t.set(100_u64)
725+
t.set(1000_u64)
726+
s.symmetric_difference!(t)
727+
728+
ary = [] of UInt64
729+
i = s.each
730+
while (el = i.next) != Iterator::Stop::INSTANCE
731+
ary << el as UInt64
732+
end
733+
ary.should eq([1_u64, 10_u64, 100_u64, 1000_u64])
734+
end
735+
736+
it "should answer a full symmetric_difference" do
737+
s = BitSet.new()
738+
s.set(10_u64)
739+
s.set(100_u64)
740+
s.set(1000_u64)
741+
t = BitSet.new()
742+
t.set(1_u64)
743+
s.symmetric_difference!(t)
744+
745+
ary = [] of UInt64
746+
i = s.each
747+
while (el = i.next) != Iterator::Stop::INSTANCE
748+
ary << el as UInt64
749+
end
750+
ary.should eq([1_u64, 10_u64, 100_u64, 1000_u64])
751+
end
718752
end
719753

720754
describe "complement" do

0 commit comments

Comments
 (0)