Skip to content

Commit cc54be4

Browse files
committed
Add link to readme; add few expectations to the tests
1 parent 9ed9e98 commit cc54be4

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Collection classes that were originally part of the (deprecated) `thread_safe` g
6767

6868
* [Array](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Array.html) A thread-safe subclass of Ruby's standard [Array](http://ruby-doc.org/core-2.2.0/Array.html).
6969
* [Hash](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Hash.html) A thread-safe subclass of Ruby's standard [Hash](http://ruby-doc.org/core-2.2.0/Hash.html).
70+
* [Set](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Set.html) A thread-safe subclass of Ruby's standard [Set](http://ruby-doc.org/stdlib-2.4.0/libdoc/set/rdoc/Set.html).
7071
* [Map](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Map.html) A hash-like object that should have much better performance characteristics, especially under high concurrency, than `Concurrent::Hash`.
7172
* [Tuple](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Tuple.html) A fixed size array with volatile (synchronized, thread safe) getters/setters.
7273

spec/concurrent/array_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module Concurrent
1313
end
1414
end
1515
end.map(&:join)
16+
expect(ary).to be_empty
1617
end
1718

1819
describe '#slice' do

spec/concurrent/hash_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ module Concurrent
77
Thread.new do
88
1000.times do |j|
99
hsh[i * 1000 + j] = i
10-
hsh[i * 1000 + j]
11-
hsh.delete(i * 1000 + j)
10+
expect(hsh[i * 1000 + j]).to eq(i)
11+
expect(hsh.delete(i * 1000 + j)).to eq(i)
1212
end
1313
end
1414
end.map(&:join)
15+
expect(hsh).to be_empty
1516
end
1617
end
1718
end

spec/concurrent/set_spec.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
require 'set'
1+
require 'set'
22
module Concurrent
3-
describe Set do
3+
RSpec.describe Set do
44
let!(:set) { described_class.new }
55

66
it 'concurrency' do
77
(1..THREADS).map do |i|
88
Thread.new do
9-
1000.times do |j|
10-
set << i
11-
set.empty?
12-
set.delete(i)
13-
end
9+
1000.times do
10+
v = i
11+
set << v
12+
expect(set).not_to be_empty
13+
set.delete(v)
14+
end
1415
end
1516
end.map(&:join)
17+
expect(set).to be_empty
1618
end
1719
end
18-
end
20+
end

0 commit comments

Comments
 (0)