Sha256: fff2d9cdac016eb14b132d96a0cdaa14ef9e52b0d27aab853e30b90ca693fcbc

Contents?: true

Size: 415 Bytes

Versions: 6

Compression:

Stored size: 415 Bytes

Contents

require 'thread/pipe'

describe Thread::Pipe do
	it 'handles passing properly' do
		p = Thread |-> d { d * 2 } |-> d { d * 4 }

		p << 2
		p << 4

		expect(p.deq).to eq(16)
		expect(p.deq).to eq(32)
	end

	it 'empty works properly' do
		p = Thread |-> d { sleep 0.02; d * 2 } |-> d { d * 4 }

		expect(p.empty?).to be(true)
		p.enq 42
		expect(p.empty?).to be(false)
		p.deq
		expect(p.empty?).to be(true)
	end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
thread-0.2.2 spec/thread/pipe_spec.rb
thread-0.2.1 spec/thread/pipe_spec.rb
seekingalpha_thread-1.0.1 spec/thread/pipe_spec.rb
thread-0.2.0 spec/thread/pipe_spec.rb
thread-0.1.7 spec/thread/pipe_spec.rb
thread-0.1.6 spec/thread/pipe_spec.rb