Sha256: 6e9e471ff1255ebf4109e11d0ed020ebee473087cc5cc098c85bb18e05f49ee5
Contents?: true
Size: 1.05 KB
Versions: 4
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true require "gir_ffi_test_helper" describe GirFFI::Boolean do it "has the same native size as an int" do _(FFI.type_size(GirFFI::Boolean)).must_equal FFI.type_size :int end describe ".from_native" do it "converts 0 to false" do _(GirFFI::Boolean.from_native(0, "whatever")).must_equal false end it "converts 1 to true" do _(GirFFI::Boolean.from_native(1, "whatever")).must_equal true end end describe ".to_native" do it "converts false to 0" do _(GirFFI::Boolean.to_native(false, "whatever")).must_equal 0 end it "converts true to 1" do _(GirFFI::Boolean.to_native(true, "whatever")).must_equal 1 end it "converts nil to 0" do _(GirFFI::Boolean.to_native(nil, "whatever")).must_equal 0 end it "converts truthy value to 1" do _(GirFFI::Boolean.to_native("i am truth!", "whatever")).must_equal 1 end end describe ".size" do it "returns the correct type size" do _(GirFFI::Boolean.size).must_equal FFI.type_size :int end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
gir_ffi-0.15.3 | test/gir_ffi/boolean_test.rb |
gir_ffi-0.15.2 | test/gir_ffi/boolean_test.rb |
gir_ffi-0.15.1 | test/gir_ffi/boolean_test.rb |
gir_ffi-0.15.0 | test/gir_ffi/boolean_test.rb |