ffi 1.2.1 → 1.3.0

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.

Files changed (67) hide show
  1. data/README.md +10 -5
  2. data/ext/ffi_c/ArrayType.c +6 -2
  3. data/ext/ffi_c/Buffer.c +3 -1
  4. data/ext/ffi_c/Call.c +12 -21
  5. data/ext/ffi_c/FunctionInfo.c +27 -2
  6. data/ext/ffi_c/MappedType.c +1 -2
  7. data/ext/ffi_c/MemoryPointer.c +35 -4
  8. data/ext/ffi_c/Pointer.c +5 -4
  9. data/ext/ffi_c/Struct.c +125 -8
  10. data/ext/ffi_c/StructByReference.c +33 -0
  11. data/ext/ffi_c/StructByValue.c +2 -2
  12. data/ext/ffi_c/StructLayout.c +135 -1
  13. data/ext/ffi_c/Type.c +1 -0
  14. data/ext/ffi_c/extconf.rb +1 -1
  15. data/ffi.gemspec +1 -1
  16. data/lib/ffi.rb +2 -1
  17. data/lib/ffi/library.rb +2 -0
  18. data/lib/ffi/managedstruct.rb +37 -37
  19. data/lib/ffi/struct.rb +74 -1
  20. data/lib/ffi/struct_layout_builder.rb +50 -1
  21. data/lib/ffi/tools/generator.rb +2 -0
  22. data/lib/ffi/tools/generator_task.rb +1 -0
  23. data/lib/ffi/tools/types_generator.rb +2 -0
  24. data/libtest/Benchmark.c +1 -15
  25. data/libtest/BoolTest.c +2 -16
  26. data/libtest/BufferTest.c +3 -17
  27. data/libtest/ClosureTest.c +1 -15
  28. data/libtest/EnumTest.c +1 -15
  29. data/libtest/FunctionTest.c +2 -16
  30. data/libtest/GlobalVariable.c +2 -16
  31. data/libtest/LastErrorTest.c +2 -16
  32. data/libtest/NumberTest.c +1 -15
  33. data/libtest/PointerTest.c +1 -15
  34. data/libtest/ReferenceTest.c +1 -15
  35. data/libtest/StringTest.c +1 -15
  36. data/libtest/StructTest.c +1 -15
  37. data/libtest/UnionTest.c +1 -15
  38. data/libtest/VariadicTest.c +2 -16
  39. data/spec/ffi/async_callback_spec.rb +3 -14
  40. data/spec/ffi/bool_spec.rb +7 -18
  41. data/spec/ffi/buffer_spec.rb +26 -37
  42. data/spec/ffi/callback_spec.rb +96 -107
  43. data/spec/ffi/custom_param_type.rb +2 -13
  44. data/spec/ffi/custom_type_spec.rb +1 -12
  45. data/spec/ffi/dup_spec.rb +7 -18
  46. data/spec/ffi/enum_spec.rb +128 -139
  47. data/spec/ffi/errno_spec.rb +2 -13
  48. data/spec/ffi/ffi_spec.rb +4 -15
  49. data/spec/ffi/function_spec.rb +6 -17
  50. data/spec/ffi/library_spec.rb +26 -26
  51. data/spec/ffi/long_double.rb +1 -12
  52. data/spec/ffi/managed_struct_spec.rb +3 -18
  53. data/spec/ffi/number_spec.rb +32 -43
  54. data/spec/ffi/pointer_spec.rb +7 -22
  55. data/spec/ffi/rbx/memory_pointer_spec.rb +17 -17
  56. data/spec/ffi/rbx/struct_spec.rb +2 -2
  57. data/spec/ffi/spec_helper.rb +10 -12
  58. data/spec/ffi/string_spec.rb +9 -20
  59. data/spec/ffi/strptr_spec.rb +2 -13
  60. data/spec/ffi/struct_callback_spec.rb +3 -14
  61. data/spec/ffi/struct_initialize_spec.rb +3 -14
  62. data/spec/ffi/struct_packed_spec.rb +7 -18
  63. data/spec/ffi/struct_spec.rb +93 -104
  64. data/spec/ffi/typedef_spec.rb +5 -16
  65. data/spec/ffi/union_spec.rb +4 -15
  66. data/spec/ffi/variadic_spec.rb +7 -18
  67. metadata +73 -58
@@ -1,17 +1,6 @@
1
1
  #
2
2
  # This file is part of ruby-ffi.
3
- #
4
- # This code is free software: you can redistribute it and/or modify it under
5
- # the terms of the GNU Lesser General Public License version 3 only, as
6
- # published by the Free Software Foundation.
7
- #
8
- # This code is distributed in the hope that it will be useful, but WITHOUT
9
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
- # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11
- # version 3 for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public License
14
- # version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
3
+ # For licensing, see LICENSE.SPECS
15
4
  #
16
5
 
17
6
  require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
@@ -24,15 +13,15 @@ describe "FFI" do
24
13
  let(:suffix) { FFI::Platform::LIBSUFFIX }
25
14
 
26
15
  it "should add platform library extension if not present" do
27
- FFI.map_library_name("#{prefix}dummy").should eq "#{prefix}dummy.#{suffix}"
16
+ FFI.map_library_name("#{prefix}dummy").should == "#{prefix}dummy.#{suffix}"
28
17
  end
29
18
 
30
19
  it "should add platform library extension even if lib suffix is present in name" do
31
- FFI.map_library_name("#{prefix}dummy_with_#{suffix}").should eq "#{prefix}dummy_with_#{suffix}.#{suffix}"
20
+ FFI.map_library_name("#{prefix}dummy_with_#{suffix}").should == "#{prefix}dummy_with_#{suffix}.#{suffix}"
32
21
  end
33
22
 
34
23
  it "should return Platform::LIBC when called with 'c'" do
35
- FFI.map_library_name('c').should eq FFI::Library::LIBC
24
+ FFI.map_library_name('c').should == FFI::Library::LIBC
36
25
  end
37
26
 
38
27
  end
@@ -1,17 +1,6 @@
1
1
  #
2
2
  # This file is part of ruby-ffi.
3
- #
4
- # This code is free software: you can redistribute it and/or modify it under
5
- # the terms of the GNU Lesser General Public License version 3 only, as
6
- # published by the Free Software Foundation.
7
- #
8
- # This code is distributed in the hope that it will be useful, but WITHOUT
9
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
- # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11
- # version 3 for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public License
14
- # version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
3
+ # For licensing, see LICENSE.SPECS
15
4
  #
16
5
 
17
6
  require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
@@ -37,20 +26,20 @@ describe FFI::Function do
37
26
  end
38
27
  it 'can be used as callback from C passing to it a block' do
39
28
  function_add = FFI::Function.new(:int, [:int, :int]) { |a, b| a + b }
40
- LibTest.testFunctionAdd(10, 10, function_add).should eq 20
29
+ LibTest.testFunctionAdd(10, 10, function_add).should == 20
41
30
  end
42
31
  it 'can be used as callback from C passing to it a Proc object' do
43
32
  function_add = FFI::Function.new(:int, [:int, :int], Proc.new { |a, b| a + b })
44
- LibTest.testFunctionAdd(10, 10, function_add).should eq 20
33
+ LibTest.testFunctionAdd(10, 10, function_add).should == 20
45
34
  end
46
35
  it 'can be used to wrap an existing function pointer' do
47
- FFI::Function.new(:int, [:int, :int], @libtest.find_function('testAdd')).call(10, 10).should eq 20
36
+ FFI::Function.new(:int, [:int, :int], @libtest.find_function('testAdd')).call(10, 10).should == 20
48
37
  end
49
38
  it 'can be attached to a module' do
50
39
  module Foo; end
51
40
  fp = FFI::Function.new(:int, [:int, :int], @libtest.find_function('testAdd'))
52
41
  fp.attach(Foo, 'add')
53
- Foo.add(10, 10).should eq 20
42
+ Foo.add(10, 10).should == 20
54
43
  end
55
44
  it 'can be used to extend an object' do
56
45
  fp = FFI::Function.new(:int, [:int, :int], @libtest.find_function('testAdd'))
@@ -61,7 +50,7 @@ describe FFI::Function do
61
50
  end
62
51
  end
63
52
  fp.attach(foo.singleton_class, 'add')
64
- foo.add(10, 10).should eq 20
53
+ foo.add(10, 10).should == 20
65
54
  end
66
55
  it 'can wrap a blocking function' do
67
56
  fp = FFI::Function.new(:void, [ :int ], @libtest.find_function('testBlocking'), :blocking => true)
@@ -1,17 +1,6 @@
1
1
  #
2
2
  # This file is part of ruby-ffi.
3
- #
4
- # This code is free software: you can redistribute it and/or modify it under
5
- # the terms of the GNU Lesser General Public License version 3 only, as
6
- # published by the Free Software Foundation.
7
- #
8
- # This code is distributed in the hope that it will be useful, but WITHOUT
9
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
- # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11
- # version 3 for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public License
14
- # version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
3
+ # For licensing, see LICENSE.SPECS
15
4
  #
16
5
 
17
6
  require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
@@ -21,7 +10,7 @@ describe "Library" do
21
10
  m = Module.new do
22
11
  extend FFI::Library
23
12
  end
24
- m.ffi_convention.should eq :default
13
+ m.ffi_convention.should == :default
25
14
  end
26
15
 
27
16
  it "should be settable" do
@@ -29,12 +18,23 @@ describe "Library" do
29
18
  extend FFI::Library
30
19
  end
31
20
 
32
- m.ffi_convention.should eq :default
21
+ m.ffi_convention.should == :default
33
22
  m.ffi_convention :stdcall
34
- m.ffi_convention.should eq :stdcall
23
+ m.ffi_convention.should == :stdcall
35
24
  end
36
25
  end
37
26
 
27
+ describe "ffi_lib" do
28
+ it "empty name list should raise error" do
29
+ lambda {
30
+ Module.new do |m|
31
+ m.extend FFI::Library
32
+ ffi_lib
33
+ end
34
+ }.should raise_error(LoadError)
35
+ end
36
+
37
+ end
38
38
  unless RbConfig::CONFIG['target_os'] =~ /mswin|mingw/
39
39
  it "attach_function with no library specified" do
40
40
  lambda {
@@ -50,7 +50,7 @@ describe "Library" do
50
50
  m.extend FFI::Library
51
51
  ffi_lib FFI::Library::CURRENT_PROCESS
52
52
  attach_function :getpid, [ ], :uint
53
- end.getpid.should eq Process.pid
53
+ end.getpid.should == Process.pid
54
54
  }.should_not raise_error
55
55
  end
56
56
  it "attach_function :getpid from [ 'c', 'libc.so.6'] " do
@@ -59,7 +59,7 @@ describe "Library" do
59
59
  m.extend FFI::Library
60
60
  ffi_lib [ 'c', 'libc.so.6' ]
61
61
  attach_function :getpid, [ ], :uint
62
- end.getpid.should eq Process.pid
62
+ end.getpid.should == Process.pid
63
63
  }.should_not raise_error
64
64
  end
65
65
  it "attach_function :getpid from [ 'libc.so.6', 'c' ] " do
@@ -68,7 +68,7 @@ describe "Library" do
68
68
  m.extend FFI::Library
69
69
  ffi_lib [ 'libc.so.6', 'c' ]
70
70
  attach_function :getpid, [ ], :uint
71
- end.getpid.should eq Process.pid
71
+ end.getpid.should == Process.pid
72
72
  }.should_not raise_error
73
73
  end
74
74
  it "attach_function :getpid from [ 'libfubar.so.0xdeadbeef', nil, 'c' ] " do
@@ -77,7 +77,7 @@ describe "Library" do
77
77
  m.extend FFI::Library
78
78
  ffi_lib [ 'libfubar.so.0xdeadbeef', nil, 'c' ]
79
79
  attach_function :getpid, [ ], :uint
80
- end.getpid.should eq Process.pid
80
+ end.getpid.should == Process.pid
81
81
  }.should_not raise_error
82
82
  end
83
83
  it "attach_function :getpid from [ 'libfubar.so.0xdeadbeef' ] " do
@@ -86,7 +86,7 @@ describe "Library" do
86
86
  m.extend FFI::Library
87
87
  ffi_lib 'libfubar.so.0xdeadbeef'
88
88
  attach_function :getpid, [ ], :uint
89
- end.getpid.should eq Process.pid
89
+ end.getpid.should == Process.pid
90
90
  }.should raise_error(LoadError)
91
91
  end
92
92
  end
@@ -103,10 +103,10 @@ describe "Library" do
103
103
  def gvar_test(name, type, val)
104
104
  lib = gvar_lib(name, type)
105
105
  lib.set(val)
106
- lib.gvar.should eq val
106
+ lib.gvar.should == val
107
107
  lib.set(0)
108
108
  lib.gvar = val
109
- lib.get.should eq val
109
+ lib.get.should == val
110
110
  end
111
111
  [ 0, 127, -128, -1 ].each do |i|
112
112
  it ":char variable" do
@@ -175,10 +175,10 @@ describe "Library" do
175
175
  lib = gvar_lib("pointer", :pointer)
176
176
  val = FFI::MemoryPointer.new :long
177
177
  lib.set(val)
178
- lib.gvar.should eq val
178
+ lib.gvar.should == val
179
179
  lib.set(nil)
180
180
  lib.gvar = val
181
- lib.get.should eq val
181
+ lib.get.should == val
182
182
  end
183
183
 
184
184
  [ 0, 0x7fffffff, -0x80000000, -1 ].each do |i|
@@ -198,11 +198,11 @@ describe "Library" do
198
198
  val = GlobalStruct.new
199
199
  val[:data] = i
200
200
  lib.set(val)
201
- lib.gvar[:data].should eq i
201
+ lib.gvar[:data].should == i
202
202
  val[:data] = 0
203
203
  lib.gvar[:data] = i
204
204
  val = GlobalStruct.new(lib.get)
205
- val[:data].should eq i
205
+ val[:data].should == i
206
206
  end
207
207
  end
208
208
  end
@@ -1,17 +1,6 @@
1
1
  #
2
2
  # This file is part of ruby-ffi.
3
- #
4
- # This code is free software: you can redistribute it and/or modify it under
5
- # the terms of the GNU Lesser General Public License version 3 only, as
6
- # published by the Free Software Foundation.
7
- #
8
- # This code is distributed in the hope that it will be useful, but WITHOUT
9
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
- # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11
- # version 3 for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public License
14
- # version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
3
+ # For licensing, see LICENSE.SPECS
15
4
  #
16
5
 
17
6
  require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
@@ -1,17 +1,6 @@
1
1
  #
2
2
  # This file is part of ruby-ffi.
3
- #
4
- # This code is free software: you can redistribute it and/or modify it under
5
- # the terms of the GNU Lesser General Public License version 3 only, as
6
- # published by the Free Software Foundation.
7
- #
8
- # This code is distributed in the hope that it will be useful, but WITHOUT
9
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
- # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11
- # version 3 for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public License
14
- # version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
3
+ # For licensing, see LICENSE.SPECS
15
4
  #
16
5
 
17
6
  require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
@@ -36,7 +25,7 @@ describe "Managed Struct" do
36
25
  end
37
26
  end
38
27
 
39
- WhatClassAmI.new(ManagedStructTestLib.ptr_from_address(0x12345678)).class.should eq WhatClassAmI
28
+ WhatClassAmI.new(ManagedStructTestLib.ptr_from_address(0x12345678)).class.should == WhatClassAmI
40
29
  end
41
30
 
42
31
  it "should release memory properly" do
@@ -50,11 +39,7 @@ describe "Managed Struct" do
50
39
  loop = 5
51
40
  while loop > 0 && @@count < count
52
41
  loop -= 1
53
- if RUBY_PLATFORM =~ /java/
54
- java.lang.System.gc
55
- else
56
- GC.start
57
- end
42
+ TestLibrary.force_gc
58
43
  sleep 0.05 if @@count < count
59
44
  end
60
45
  end
@@ -1,17 +1,6 @@
1
1
  #
2
2
  # This file is part of ruby-ffi.
3
- #
4
- # This code is free software: you can redistribute it and/or modify it under
5
- # the terms of the GNU Lesser General Public License version 3 only, as
6
- # published by the Free Software Foundation.
7
- #
8
- # This code is distributed in the hope that it will be useful, but WITHOUT
9
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
- # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11
- # version 3 for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public License
14
- # version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
3
+ # For licensing, see LICENSE.SPECS
15
4
  #
16
5
 
17
6
  require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
@@ -37,95 +26,95 @@ describe "Function with primitive integer arguments" do
37
26
  attach_function :get_double, [ ], :double
38
27
  end
39
28
  it "int8.size" do
40
- FFI::TYPE_INT8.size.should eq 1
29
+ FFI::TYPE_INT8.size.should == 1
41
30
  end
42
31
  it "uint8.size" do
43
- FFI::TYPE_UINT8.size.should eq 1
32
+ FFI::TYPE_UINT8.size.should == 1
44
33
  end
45
34
  it "int16.size" do
46
- FFI::TYPE_INT16.size.should eq 2
35
+ FFI::TYPE_INT16.size.should == 2
47
36
  end
48
37
  it "uint16.size" do
49
- FFI::TYPE_UINT16.size.should eq 2
38
+ FFI::TYPE_UINT16.size.should == 2
50
39
  end
51
40
  it "int32.size" do
52
- FFI::TYPE_INT32.size.should eq 4
41
+ FFI::TYPE_INT32.size.should == 4
53
42
  end
54
43
  it "uint32.size" do
55
- FFI::TYPE_UINT32.size.should eq 4
44
+ FFI::TYPE_UINT32.size.should == 4
56
45
  end
57
46
  it "int64.size" do
58
- FFI::TYPE_INT64.size.should eq 8
47
+ FFI::TYPE_INT64.size.should == 8
59
48
  end
60
49
  it "uint64.size" do
61
- FFI::TYPE_UINT64.size.should eq 8
50
+ FFI::TYPE_UINT64.size.should == 8
62
51
  end
63
52
  it "float.size" do
64
- FFI::TYPE_FLOAT32.size.should eq 4
53
+ FFI::TYPE_FLOAT32.size.should == 4
65
54
  end
66
55
  it "double.size" do
67
- FFI::TYPE_FLOAT64.size.should eq 8
56
+ FFI::TYPE_FLOAT64.size.should == 8
68
57
  end
69
58
  [ 0, 127, -128, -1 ].each do |i|
70
59
  it ":char call(:char (#{i}))" do
71
- LibTest.ret_s8(i).should eq i
60
+ LibTest.ret_s8(i).should == i
72
61
  end
73
62
  end
74
63
  [ 0, 0x7f, 0x80, 0xff ].each do |i|
75
64
  it ":uchar call(:uchar (#{i}))" do
76
- LibTest.ret_u8(i).should eq i
65
+ LibTest.ret_u8(i).should == i
77
66
  end
78
67
  end
79
68
  [ 0, 0x7fff, -0x8000, -1 ].each do |i|
80
69
  it ":short call(:short (#{i}))" do
81
- LibTest.ret_s16(i).should eq i
70
+ LibTest.ret_s16(i).should == i
82
71
  end
83
72
  end
84
73
  [ 0, 0x7fff, 0x8000, 0xffff ].each do |i|
85
74
  it ":ushort call(:ushort (#{i}))" do
86
- LibTest.ret_u16(i).should eq i
75
+ LibTest.ret_u16(i).should == i
87
76
  end
88
77
  end
89
78
  [ 0, 0x7fffffff, -0x80000000, -1 ].each do |i|
90
79
  it ":int call(:int (#{i}))" do
91
- LibTest.ret_s32(i).should eq i
80
+ LibTest.ret_s32(i).should == i
92
81
  end
93
82
  end
94
83
  [ 0, 0x7fffffff, 0x80000000, 0xffffffff ].each do |i|
95
84
  it ":uint call(:uint (#{i}))" do
96
- LibTest.ret_u32(i).should eq i
85
+ LibTest.ret_u32(i).should == i
97
86
  end
98
87
  end
99
88
  [ 0, 0x7fffffffffffffff, -0x8000000000000000, -1 ].each do |i|
100
89
  it ":long_long call(:long_long (#{i}))" do
101
- LibTest.ret_s64(i).should eq i
90
+ LibTest.ret_s64(i).should == i
102
91
  end
103
92
  end
104
93
  [ 0, 0x7fffffffffffffff, 0x8000000000000000, 0xffffffffffffffff ].each do |i|
105
94
  it ":ulong_long call(:ulong_long (#{i}))" do
106
- LibTest.ret_u64(i).should eq i
95
+ LibTest.ret_u64(i).should == i
107
96
  end
108
97
  end
109
98
  if FFI::Platform::LONG_SIZE == 32
110
99
  [ 0, 0x7fffffff, -0x80000000, -1 ].each do |i|
111
100
  it ":long call(:long (#{i}))" do
112
- LibTest.ret_long(i).should eq i
101
+ LibTest.ret_long(i).should == i
113
102
  end
114
103
  end
115
104
  [ 0, 0x7fffffff, 0x80000000, 0xffffffff ].each do |i|
116
105
  it ":ulong call(:ulong (#{i}))" do
117
- LibTest.ret_ulong(i).should eq i
106
+ LibTest.ret_ulong(i).should == i
118
107
  end
119
108
  end
120
109
  else
121
110
  [ 0, 0x7fffffffffffffff, -0x8000000000000000, -1 ].each do |i|
122
111
  it ":long call(:long (#{i}))" do
123
- LibTest.ret_long(i).should eq i
112
+ LibTest.ret_long(i).should == i
124
113
  end
125
114
  end
126
115
  [ 0, 0x7fffffffffffffff, 0x8000000000000000, 0xffffffffffffffff ].each do |i|
127
116
  it ":ulong call(:ulong (#{i}))" do
128
- LibTest.ret_ulong(i).should eq i
117
+ LibTest.ret_ulong(i).should == i
129
118
  end
130
119
  end
131
120
  [ 0.0, 0.1, 1.1, 1.23 ].each do |f|
@@ -145,32 +134,32 @@ end
145
134
  describe "Integer parameter range checking" do
146
135
  [ 128, -129 ].each do |i|
147
136
  it ":char call(:char (#{i}))" do
148
- lambda { LibTest.ret_int8_t(i).should eq i }.should raise_error
137
+ lambda { LibTest.ret_int8_t(i).should == i }.should raise_error
149
138
  end
150
139
  end
151
140
  [ -1, 256 ].each do |i|
152
141
  it ":uchar call(:uchar (#{i}))" do
153
- lambda { LibTest.ret_u_int8_t(i).should eq i }.should raise_error
142
+ lambda { LibTest.ret_u_int8_t(i).should == i }.should raise_error
154
143
  end
155
144
  end
156
145
  [ 0x8000, -0x8001 ].each do |i|
157
146
  it ":short call(:short (#{i}))" do
158
- lambda { LibTest.ret_int16_t(i).should eq i }.should raise_error
147
+ lambda { LibTest.ret_int16_t(i).should == i }.should raise_error
159
148
  end
160
149
  end
161
150
  [ -1, 0x10000 ].each do |i|
162
151
  it ":ushort call(:ushort (#{i}))" do
163
- lambda { LibTest.ret_u_int16_t(i).should eq i }.should raise_error
152
+ lambda { LibTest.ret_u_int16_t(i).should == i }.should raise_error
164
153
  end
165
154
  end
166
155
  [ 0x80000000, -0x80000001 ].each do |i|
167
156
  it ":int call(:int (#{i}))" do
168
- lambda { LibTest.ret_int32_t(i).should eq i }.should raise_error
157
+ lambda { LibTest.ret_int32_t(i).should == i }.should raise_error
169
158
  end
170
159
  end
171
160
  [ -1, 0x100000000 ].each do |i|
172
161
  it ":ushort call(:ushort (#{i}))" do
173
- lambda { LibTest.ret_u_int32_t(i).should eq i }.should raise_error
162
+ lambda { LibTest.ret_u_int32_t(i).should == i }.should raise_error
174
163
  end
175
164
  end
176
165
  end
@@ -217,11 +206,11 @@ describe "Three different size Integer arguments" do
217
206
 
218
207
  def verify(p, off, t, v)
219
208
  if t == 'f32'
220
- p.get_float32(off).should eq v
209
+ p.get_float32(off).should == v
221
210
  elsif t == 'f64'
222
- p.get_float64(off).should eq v
211
+ p.get_float64(off).should == v
223
212
  else
224
- p.get_int64(off).should eq v
213
+ p.get_int64(off).should == v
225
214
  end
226
215
  end
227
216