Sha256: 209c26589393f2cc886863a722f8ae39b700bb4e9de8d869644b1a5a0248caed

Contents?: true

Size: 780 Bytes

Versions: 8

Compression:

Stored size: 780 Bytes

Contents

require 'gir_ffi_test_helper'

describe GirFFI::ArgHelper do
  describe ".cast_from_pointer" do
    it "handles class types" do
      klass = Class.new
      mock(klass).wrap(:pointer_value) { :wrapped_value }
      GirFFI::ArgHelper.cast_from_pointer(klass, :pointer_value).must_equal :wrapped_value
    end

    it "handles negative :gint8" do
      ptr = FFI::Pointer.new(-127)
      GirFFI::ArgHelper.cast_from_pointer(:gint8, ptr).must_equal(-127)
    end

    it "handles positive :gint8" do
      ptr = FFI::Pointer.new(128)
      GirFFI::ArgHelper.cast_from_pointer(:gint8, ptr).must_equal(128)
    end

    it "handles :guint32" do
      ptr = FFI::Pointer.new(0xffffffff)
      GirFFI::ArgHelper.cast_from_pointer(:guint32, ptr).must_equal(0xffffffff)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gir_ffi-0.7.7 test/gir_ffi/arg_helper_test.rb
gir_ffi-0.7.6 test/gir_ffi/arg_helper_test.rb
gir_ffi-0.7.5 test/gir_ffi/arg_helper_test.rb
gir_ffi-0.7.4 test/gir_ffi/arg_helper_test.rb
gir_ffi-0.7.3 test/gir_ffi/arg_helper_test.rb
gir_ffi-0.7.2 test/gir_ffi/arg_helper_test.rb
gir_ffi-0.7.1 test/gir_ffi/arg_helper_test.rb
gir_ffi-0.7.0 test/gir_ffi/arg_helper_test.rb