Sha256: a5e39a1ed65c71d24ab13c8f8d6f32ebb40caaf0cad1f17ce3410d74479fbd57

Contents?: true

Size: 1.56 KB

Versions: 55

Compression:

Stored size: 1.56 KB

Contents

require "spec_helper"
require "bunny/concurrent/synchronized_sorted_set"

unless ENV["CI"]
  describe Bunny::Concurrent::SynchronizedSortedSet do
    50.times do |i|
      it "provides the same API as SortedSet for key operations (take #{i})" do
        s = described_class.new
        s.length.should == 0

        s << 1
        s.length.should == 1
        s << 1
        s.length.should == 1
        s << 2
        s.length.should == 2
        s << 3
        s.length.should == 3
        s << 4
        s.length.should == 4
        s << 4
        s << 4
        s << 4
        s.length.should == 4
        s << 5
        s.length.should == 5
        s << 5
        s << 5
        s << 5
        s.length.should == 5
        s << 6
        s.length.should == 6
        s << 7
        s.length.should == 7
        s << 8
        s.length.should == 8
        s.delete 8
        s.length.should == 7
        s.delete_if { |i| i == 1 }
        s.length.should == 6
      end
      it "synchronizes common operations needed by Bunny (take #{i})" do
        s = described_class.new
        s.length.should == 0

        10.times do
          Thread.new do
            s << 1
            s << 1
            s << 2
            s << 3
            s << 4
            s << 4
            s << 4
            s << 4
            s << 5
            s << 5
            s << 5
            s << 5
            s << 6
            s << 7
            s << 8
            s.delete 8
            s.delete_if { |i| i == 1 }
          end
        end
        sleep 0.5

        s.length.should == 6
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
bunny-1.7.1 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.7.0 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.6.3 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.6.2 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.6.1 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.6.0 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.5.1 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.6.0.rc2 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.6.0.rc1 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.6.0.pre1 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.5.0 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.5.0.pre2 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.5.0.pre1 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.4.1 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.4.0 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.3.1 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.3.0 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.2.2 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.2.1 spec/unit/concurrent/synchronized_sorted_set_spec.rb
bunny-1.2.0 spec/unit/concurrent/synchronized_sorted_set_spec.rb