Sha256: dc30a4478cf695303f957565efb20776d2f02708887a6948c82e9105bc90ab7e

Contents?: true

Size: 789 Bytes

Versions: 9

Compression:

Stored size: 789 Bytes

Contents

require 'gir_ffi_test_helper'

describe GLib::Boolean do
  it "has the same native size as an int" do
    FFI.type_size(GLib::Boolean).must_equal FFI.type_size :int
  end

  describe ".from_native" do
    it "converts 0 to false" do
      GLib::Boolean.from_native(0, "whatever").must_equal false
    end

    it "converts 1 to true" do
      GLib::Boolean.from_native(1, "whatever").must_equal true
    end
  end

  describe ".to_native" do
    it "converts false to 0" do
      GLib::Boolean.to_native(false, "whatever").must_equal 0
    end

    it "converts true to 1" do
      GLib::Boolean.to_native(true, "whatever").must_equal 1
    end
  end

  describe ".size" do
    it "returns the correct type size" do
      GLib::Boolean.size.must_equal FFI.type_size :int
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gir_ffi-0.7.7 test/gir_ffi-base/glib/boolean_test.rb
gir_ffi-0.7.6 test/gir_ffi-base/glib/boolean_test.rb
gir_ffi-0.7.5 test/gir_ffi-base/glib/boolean_test.rb
gir_ffi-0.7.4 test/gir_ffi-base/glib/boolean_test.rb
gir_ffi-0.7.3 test/gir_ffi-base/glib/boolean_test.rb
gir_ffi-0.7.2 test/gir_ffi-base/glib/boolean_test.rb
gir_ffi-0.7.1 test/gir_ffi-base/glib/boolean_test.rb
gir_ffi-0.7.0 test/gir_ffi-base/glib/boolean_test.rb
gir_ffi-0.6.7 test/gir_ffi-base/glib/boolean_test.rb