blob: 4737a30bde66ff74015f483ef91dc6f8ab7004cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
require_relative '../../../spec_helper'
describe :io_buffer_not, shared: true do
it "inverts every bit of the buffer" do
IO::Buffer.for(+"12345") do |buffer|
result = buffer.send(@method)
result.get_string.should == "\xCE\xCD\xCC\xCB\xCA".b
result.free
end
end
end
describe "IO::Buffer#~" do
it_behaves_like :io_buffer_not, :~
it "creates a new internal buffer of the same size" do
IO::Buffer.for(+"12345") do |buffer|
result = ~buffer
result.should_not.equal? buffer
result.should.internal?
result.size.should == buffer.size
result.free
end
end
end
describe "IO::Buffer#not!" do
it_behaves_like :io_buffer_not, :not!
it "modifies the buffer in place" do
IO::Buffer.for(+"12345") do |buffer|
result = buffer.not!
result.should.equal? buffer
result.should.external?
end
end
end
|