Sha256: 8c2f21818dee8aefa0d0bc7d20d0be0fcd7632d5f7ff0f54c378c9cf68f9c748

Contents?: true

Size: 613 Bytes

Versions: 57

Compression:

Stored size: 613 Bytes

Contents

require "spec_helper"
require "bunny/concurrent/atomic_fixnum"

describe Bunny::Concurrent::AtomicFixnum do
  it "allows retrieving the current value" do
    af = described_class.new(0)

    af.get.should == 0
    af.should == 0
  end

  it "can be updated" do
    af = described_class.new(0)

    af.get.should == 0
    Thread.new do
      af.set(10)
    end
    sleep 0.6
    af.get.should == 10
  end

  it "can be incremented" do
    af = described_class.new(0)

    af.get.should == 0
    10.times do
      Thread.new do
        af.increment
      end
    end
    sleep 0.6
    af.get.should == 10
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

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