Sha256: 04df5bee1d8c212445a5d32a70c6c7ce1f02821b24b3e7ffcae675e795606448
Contents?: true
Size: 911 Bytes
Versions: 5
Compression:
Stored size: 911 Bytes
Contents
# encoding: UTF-8 require 'spec_helper' module ICU describe UCharPointer do it 'allocates enough memory for 16-bit characters' do UCharPointer.new(5).size.should == 10 end it 'builds a buffer from a string' do ptr = UCharPointer.from_string('abc') ptr.should be_a UCharPointer ptr.size.should == 6 ptr.read_array_of_uint16(3).should == [0x61, 0x62, 0x63] end it 'takes an optional capacity' do ptr = UCharPointer.from_string('abc', 5) ptr.size.should == 10 end describe 'converting to string' do let(:ptr) { UCharPointer.new(3).write_array_of_uint16 [0x78, 0x0, 0x79] } it 'returns the the entire buffer by default' do ptr.string.should == "x\0y" end it 'returns strings of the specified length' do ptr.string(0).should == "" ptr.string(2).should == "x\0" end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
ffi-icu-0.2.0 | spec/uchar_spec.rb |
ffi-icu-0.1.10 | spec/uchar_spec.rb |
ffi-icu-0.1.9 | spec/uchar_spec.rb |
ffi-icu-0.1.8 | spec/uchar_spec.rb |
ffi-icu-0.1.7 | spec/uchar_spec.rb |