ffi 1.0.10 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ffi might be problematic. Click here for more details.

@@ -23,7 +23,7 @@ describe "Custom type definitions" do
23
23
  typedef :uint, :fubar_t
24
24
  attach_function :ret_u32, [ :fubar_t ], :fubar_t
25
25
  end
26
- CustomTypedef.ret_u32(0x12345678).should == 0x12345678
26
+ CustomTypedef.ret_u32(0x12345678).should eq 0x12345678
27
27
  end
28
28
  it "variadic invoker with custom typedef" do
29
29
  module VariadicCustomTypedef
@@ -34,7 +34,7 @@ describe "Custom type definitions" do
34
34
  end
35
35
  buf = FFI::Buffer.new :uint, 10
36
36
  VariadicCustomTypedef.pack_varargs(buf, "i", :fubar_t, 0x12345678)
37
- buf.get_int64(0).should == 0x12345678
37
+ buf.get_int64(0).should eq 0x12345678
38
38
  end
39
39
  it "Callback with custom typedef parameter" do
40
40
  module CallbackCustomTypedef
@@ -46,7 +46,7 @@ describe "Custom type definitions" do
46
46
  end
47
47
  i = 0
48
48
  CallbackCustomTypedef.testCallbackU32rV(0xdeadbeef) { |v| i = v }
49
- i.should == 0xdeadbeef
49
+ i.should eq 0xdeadbeef
50
50
  end
51
51
  module StructCustomTypedef
52
52
  extend FFI::Library
@@ -59,7 +59,7 @@ describe "Custom type definitions" do
59
59
  it "Struct with custom typedef field" do
60
60
  s = StructCustomTypedef::S.new
61
61
  s[:a] = 0x12345678
62
- s.pointer.get_uint(0).should == 0x12345678
62
+ s.pointer.get_uint(0).should eq 0x12345678
63
63
  end
64
64
 
65
65
  it "attach_function after a typedef should not reject normal types" do
@@ -56,7 +56,7 @@ describe 'Union' do
56
56
  if k == 'f32' or k == 'f64'
57
57
  (@u[type[1]] - LibTest.send("union_align_#{k}", @u.to_ptr)).abs.should < 0.00001
58
58
  else
59
- @u[type[1]].should == LibTest.send("union_align_#{k}", @u.to_ptr)
59
+ @u[type[1]].should eq LibTest.send("union_align_#{k}", @u.to_ptr)
60
60
  end
61
61
  end
62
62
  end
@@ -66,11 +66,11 @@ describe 'Union' do
66
66
  if k == 'f32' or k == 'f64'
67
67
  (@u[type[1]] - type[2]).abs.should < 0.00001
68
68
  else
69
- @u[type[1]].should == type[2]
69
+ @u[type[1]].should eq type[2]
70
70
  end
71
71
  end
72
72
  end
73
73
  it 'should return a size equals to the size of the biggest field' do
74
- LibTest::TestUnion.size.should == LibTest.union_size
74
+ LibTest::TestUnion.size.should eq LibTest.union_size
75
75
  end
76
76
  end
@@ -25,30 +25,31 @@ describe "Function with variadic arguments" do
25
25
  it "call variadic with (:char (#{i})) argument" do
26
26
  buf = FFI::Buffer.new :long_long
27
27
  LibTest.pack_varargs(buf, "c", :char, i)
28
- buf.get_int64(0).should == i
28
+ buf.get_int64(0).should eq i
29
29
  end
30
30
  end
31
31
  [ 0, 0x7f, 0x80, 0xff ].each do |i|
32
32
  it "call variadic with (:uchar (#{i})) argument" do
33
33
  buf = FFI::Buffer.new :long_long
34
34
  LibTest.pack_varargs(buf, "C", :uchar, i)
35
- buf.get_int64(0).should == i
35
+ buf.get_int64(0).should eq i
36
36
  end
37
37
  end
38
38
  [ 0, 1.234567, 9.87654321 ].each do |v|
39
39
  it "call variadic with (:float (#{v})) argument" do
40
40
  buf = FFI::Buffer.new :long_long
41
41
  LibTest.pack_varargs(buf, "f", :float, v.to_f)
42
- buf.get_float64(0).should == v
42
+ buf.get_float64(0).should eq v
43
43
  end
44
44
  end
45
45
  [ 0, 1.234567, 9.87654321 ].each do |v|
46
46
  it "call variadic with (:double (#{v})) argument" do
47
47
  buf = FFI::Buffer.new :long_long
48
48
  LibTest.pack_varargs(buf, "f", :double, v.to_f)
49
- buf.get_float64(0).should == v
49
+ buf.get_float64(0).should eq v
50
50
  end
51
51
  end
52
+
52
53
  module Varargs
53
54
  PACK_VALUES = {
54
55
  'c' => [ 0x12 ],
@@ -68,14 +69,16 @@ describe "Function with variadic arguments" do
68
69
  'i' => :int, 'I' => :uint, 'j' => :long_long, 'J' => :ulong_long,
69
70
  'l' => :long, 'L' => :ulong, 'f' => :float, 'd' => :double
70
71
  }
71
- def self.verify(p, off, v)
72
- if v.kind_of?(Float)
73
- p.get_float64(off).should == v
74
- else
75
- p.get_int64(off).should == v
76
- end
72
+ end
73
+
74
+ def verify(p, off, v)
75
+ if v.kind_of?(Float)
76
+ p.get_float64(off).should eq v
77
+ else
78
+ p.get_int64(off).should eq v
77
79
  end
78
80
  end
81
+
79
82
  Varargs::PACK_VALUES.keys.each do |t1|
80
83
  Varargs::PACK_VALUES.keys.each do |t2|
81
84
  Varargs::PACK_VALUES.keys.each do |t3|
@@ -87,9 +90,9 @@ describe "Function with variadic arguments" do
87
90
  it "call(#{fmt}, #{params.join(',')})" do
88
91
  buf = FFI::Buffer.new :long_long, 3
89
92
  LibTest.pack_varargs(buf, fmt, *params)
90
- Varargs.verify(buf, 0, v1)
91
- Varargs.verify(buf, 8, v2)
92
- Varargs.verify(buf, 16, v3)
93
+ verify(buf, 0, v1)
94
+ verify(buf, 8, v2)
95
+ verify(buf, 16, v3)
93
96
  end
94
97
  end
95
98
  end
@@ -97,4 +100,4 @@ describe "Function with variadic arguments" do
97
100
  end
98
101
  end
99
102
  end
100
- end
103
+ end
@@ -1,5 +1,5 @@
1
1
 
2
- require 'rake/rdoctask'
2
+ require 'rdoc/task'
3
3
 
4
4
  namespace :doc do
5
5
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 10
10
- version: 1.0.10
9
+ - 11
10
+ version: 1.0.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Wayne Meissner
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-20 00:00:00 Z
18
+ date: 2011-11-13 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: |-