Skip to content

Commit

Permalink
Add spec for Pointer#write_array_of_type
Browse files Browse the repository at this point in the history
  • Loading branch information
ytaka committed Jun 9, 2018
1 parent ac3eb0f commit dee0d86
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion spec/ffi/pointer_spec.rb
Expand Up @@ -94,7 +94,16 @@ def to_ptr
expect(array[j].address).to eq(address)
end
end


it "#write_array_of_type" do
values = [10, 227, 32]
memory = FFI::MemoryPointer.new :pointer, values.size
memory.write_array_of_type(FFI::TYPE_UINT8, :put_int8, values)
array = memory.read_array_of_type(FFI::TYPE_UINT8, :read_uint8, values.size)
values.each_with_index do |val, j|
expect(array[j]).to eq(val)
end
end
end

describe 'NULL' do
Expand Down

0 comments on commit dee0d86

Please sign in to comment.