ffi 1.2.1-x86-mingw32 → 1.3.0-x86-mingw32

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 (69) 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/1.8/ffi_c.so +0 -0
  17. data/lib/1.9/ffi_c.so +0 -0
  18. data/lib/ffi.rb +2 -1
  19. data/lib/ffi/library.rb +2 -0
  20. data/lib/ffi/managedstruct.rb +37 -37
  21. data/lib/ffi/struct.rb +74 -1
  22. data/lib/ffi/struct_layout_builder.rb +50 -1
  23. data/lib/ffi/tools/generator.rb +2 -0
  24. data/lib/ffi/tools/generator_task.rb +1 -0
  25. data/lib/ffi/tools/types_generator.rb +2 -0
  26. data/libtest/Benchmark.c +1 -15
  27. data/libtest/BoolTest.c +2 -16
  28. data/libtest/BufferTest.c +3 -17
  29. data/libtest/ClosureTest.c +1 -15
  30. data/libtest/EnumTest.c +1 -15
  31. data/libtest/FunctionTest.c +2 -16
  32. data/libtest/GlobalVariable.c +2 -16
  33. data/libtest/LastErrorTest.c +2 -16
  34. data/libtest/NumberTest.c +1 -15
  35. data/libtest/PointerTest.c +1 -15
  36. data/libtest/ReferenceTest.c +1 -15
  37. data/libtest/StringTest.c +1 -15
  38. data/libtest/StructTest.c +1 -15
  39. data/libtest/UnionTest.c +1 -15
  40. data/libtest/VariadicTest.c +2 -16
  41. data/spec/ffi/async_callback_spec.rb +3 -14
  42. data/spec/ffi/bool_spec.rb +7 -18
  43. data/spec/ffi/buffer_spec.rb +26 -37
  44. data/spec/ffi/callback_spec.rb +96 -107
  45. data/spec/ffi/custom_param_type.rb +2 -13
  46. data/spec/ffi/custom_type_spec.rb +1 -12
  47. data/spec/ffi/dup_spec.rb +7 -18
  48. data/spec/ffi/enum_spec.rb +128 -139
  49. data/spec/ffi/errno_spec.rb +2 -13
  50. data/spec/ffi/ffi_spec.rb +4 -15
  51. data/spec/ffi/function_spec.rb +6 -17
  52. data/spec/ffi/library_spec.rb +26 -26
  53. data/spec/ffi/long_double.rb +1 -12
  54. data/spec/ffi/managed_struct_spec.rb +3 -18
  55. data/spec/ffi/number_spec.rb +32 -43
  56. data/spec/ffi/pointer_spec.rb +7 -22
  57. data/spec/ffi/rbx/memory_pointer_spec.rb +17 -17
  58. data/spec/ffi/rbx/struct_spec.rb +2 -2
  59. data/spec/ffi/spec_helper.rb +10 -12
  60. data/spec/ffi/string_spec.rb +9 -20
  61. data/spec/ffi/strptr_spec.rb +2 -13
  62. data/spec/ffi/struct_callback_spec.rb +3 -14
  63. data/spec/ffi/struct_initialize_spec.rb +3 -14
  64. data/spec/ffi/struct_packed_spec.rb +7 -18
  65. data/spec/ffi/struct_spec.rb +93 -104
  66. data/spec/ffi/typedef_spec.rb +5 -16
  67. data/spec/ffi/union_spec.rb +4 -15
  68. data/spec/ffi/variadic_spec.rb +7 -18
  69. metadata +4 -4
@@ -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
  require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
17
6
  require 'delegate'
@@ -40,7 +29,7 @@ describe "Pointer" do
40
29
  magic = 0x12345678
41
30
  memory.put_int32(0, magic)
42
31
  tp = ToPtrTest.new(memory)
43
- PointerTestLib.ptr_ret_int32_t(tp, 0).should eq magic
32
+ PointerTestLib.ptr_ret_int32_t(tp, 0).should == magic
44
33
  end
45
34
  class PointerDelegate < DelegateClass(FFI::Pointer)
46
35
  def initialize(ptr)
@@ -55,7 +44,7 @@ describe "Pointer" do
55
44
  magic = 0x12345678
56
45
  memory.put_int32(0, magic)
57
46
  ptr = PointerDelegate.new(memory)
58
- PointerTestLib.ptr_ret_int32_t(ptr, 0).should eq magic
47
+ PointerTestLib.ptr_ret_int32_t(ptr, 0).should == magic
59
48
  end
60
49
  it "Fixnum cannot be used as a Pointer argument" do
61
50
  lambda { PointerTestLib.ptr_ret_int32(0, 0) }.should raise_error
@@ -69,13 +58,13 @@ describe "Pointer" do
69
58
  it "#read_pointer" do
70
59
  memory = FFI::MemoryPointer.new :pointer
71
60
  PointerTestLib.ptr_set_pointer(memory, 0, PointerTestLib.ptr_from_address(0xdeadbeef))
72
- memory.read_pointer.address.should eq 0xdeadbeef
61
+ memory.read_pointer.address.should == 0xdeadbeef
73
62
  end
74
63
 
75
64
  it "#write_pointer" do
76
65
  memory = FFI::MemoryPointer.new :pointer
77
66
  memory.write_pointer(PointerTestLib.ptr_from_address(0xdeadbeef))
78
- PointerTestLib.ptr_ret_pointer(memory, 0).address.should eq 0xdeadbeef
67
+ PointerTestLib.ptr_ret_pointer(memory, 0).address.should == 0xdeadbeef
79
68
  end
80
69
 
81
70
  it "#read_array_of_pointer" do
@@ -86,7 +75,7 @@ describe "Pointer" do
86
75
  end
87
76
  array = memory.read_array_of_pointer(values.size)
88
77
  values.each_with_index do |address, j|
89
- array[j].address.should eq address
78
+ array[j].address.should == address
90
79
  end
91
80
  end
92
81
 
@@ -129,11 +118,7 @@ describe "AutoPointer" do
129
118
  loop = 5
130
119
  while @@count < count && loop > 0
131
120
  loop -= 1
132
- if RUBY_PLATFORM =~ /java/
133
- java.lang.System.gc
134
- else
135
- GC.start
136
- end
121
+ TestLibrary.force_gc
137
122
  sleep 0.05 unless @@count == count
138
123
  end
139
124
  @@count = 0
@@ -12,8 +12,8 @@ end
12
12
  describe "MemoryPointer" do
13
13
  it "makes a pointer from a string" do
14
14
  m = FFI::MemoryPointer.from_string("FFI is Awesome")
15
- m.total.should eq 15
16
- m.type_size.should eq 1
15
+ m.total.should == 15
16
+ m.type_size.should == 1
17
17
  end
18
18
 
19
19
  it "does not make a pointer from non-strings" do
@@ -22,38 +22,38 @@ describe "MemoryPointer" do
22
22
 
23
23
  it "makes a pointer from a string with multibyte characters" do
24
24
  m = FFI::MemoryPointer.from_string("ぱんだ")
25
- m.total.should eq 10
26
- m.type_size.should eq 1
25
+ m.total.should == 10
26
+ m.type_size.should == 1
27
27
  end
28
28
 
29
29
  it "reads back a string" do
30
30
  m = FFI::MemoryPointer.from_string("FFI is Awesome")
31
- m.read_string.should eq "FFI is Awesome"
31
+ m.read_string.should == "FFI is Awesome"
32
32
  end
33
33
 
34
34
  it "makes a pointer for a certain number of bytes" do
35
35
  m = FFI::MemoryPointer.new(8)
36
36
  m.write_array_of_int([1,2])
37
- m.read_array_of_int(2).should eq [1,2]
37
+ m.read_array_of_int(2).should == [1,2]
38
38
  end
39
39
 
40
40
  it "allows access to an element of the pointer (as an array)" do
41
41
  m = FFI::MemoryPointer.new(:int, 2)
42
42
  m.write_array_of_int([1,2])
43
- m[0].read_int.should eq 1
44
- m[1].read_int.should eq 2
43
+ m[0].read_int.should == 1
44
+ m[1].read_int.should == 2
45
45
  end
46
46
 
47
47
  it "allows writing as an int" do
48
48
  m = FFI::MemoryPointer.new(:int)
49
49
  m.write_int(1)
50
- m.read_int.should eq 1
50
+ m.read_int.should == 1
51
51
  end
52
52
 
53
53
  it "allows writing as a long" do
54
54
  m = FFI::MemoryPointer.new(:long)
55
55
  m.write_long(10)
56
- m.read_long.should eq 10
56
+ m.read_long.should == 10
57
57
  end
58
58
 
59
59
  it "raises an error if you try putting a long into a pointer of size 1" do
@@ -76,40 +76,40 @@ describe "MemoryPointer" do
76
76
  it "makes a pointer for a certain type" do
77
77
  m = FFI::MemoryPointer.new(:int)
78
78
  m.write_int(10)
79
- m.read_int.should eq 10
79
+ m.read_int.should == 10
80
80
  end
81
81
 
82
82
  it "makes a memory pointer for a number of a certain type" do
83
83
  m = FFI::MemoryPointer.new(:int, 2)
84
84
  m.write_array_of_int([1,2])
85
- m.read_array_of_int(2).should eq [1,2]
85
+ m.read_array_of_int(2).should == [1,2]
86
86
  end
87
87
 
88
88
  it "makes a pointer for an object responding to #size" do
89
89
  m = FFI::MemoryPointer.new(Struct.new(:size).new(8))
90
90
  m.write_array_of_int([1,2])
91
- m.read_array_of_int(2).should eq [1,2]
91
+ m.read_array_of_int(2).should == [1,2]
92
92
  end
93
93
 
94
94
  it "makes a pointer for a number of an object responding to #size" do
95
95
  m = FFI::MemoryPointer.new(Struct.new(:size).new(4), 2)
96
96
  m.write_array_of_int([1,2])
97
- m.read_array_of_int(2).should eq [1,2]
97
+ m.read_array_of_int(2).should == [1,2]
98
98
  end
99
99
  it "MemoryPointer#address returns correct value" do
100
100
  m = FFI::MemoryPointer.new(:long_long)
101
101
  magic = 0x12345678
102
102
  m.write_long(magic)
103
- m.read_pointer.address.should eq magic
103
+ m.read_pointer.address.should == magic
104
104
  end
105
105
  it "MemoryPointer#null? returns true for zero value" do
106
106
  m = FFI::MemoryPointer.new(:long_long)
107
107
  m.write_long(0)
108
- m.read_pointer.null?.should eq true
108
+ m.read_pointer.null?.should == true
109
109
  end
110
110
  it "MemoryPointer#null? returns false for non-zero value" do
111
111
  m = FFI::MemoryPointer.new(:long_long)
112
112
  m.write_long(0x12345678)
113
- m.read_pointer.null?.should eq false
113
+ m.read_pointer.null?.should == false
114
114
  end
115
115
  end
@@ -8,6 +8,6 @@ describe FFI::Struct do
8
8
  it "allows setting fields" do
9
9
  t = Timeval.new
10
10
  t[:tv_sec] = 12
11
- t[:tv_sec].should eq 12
11
+ t[:tv_sec].should == 12
12
12
  end
13
- end
13
+ 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
  require 'rubygems'
17
6
  require 'rbconfig'
@@ -28,6 +17,15 @@ require "ffi"
28
17
 
29
18
  module TestLibrary
30
19
  PATH = "build/libtest.#{FFI::Platform::LIBSUFFIX}"
20
+ def self.force_gc
21
+ if RUBY_PLATFORM =~ /java/
22
+ java.lang.System.gc
23
+ elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
24
+ GC.run(true)
25
+ else
26
+ GC.start
27
+ end
28
+ end
31
29
  end
32
30
  module LibTest
33
31
  extend FFI::Library
@@ -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"))
@@ -29,7 +18,7 @@ describe "String tests" do
29
18
  mp = FFI::MemoryPointer.new 1024
30
19
  mp.put_string(0, "test\0")
31
20
  str = mp.get_string(0)
32
- str.tainted?.should eq true
21
+ str.tainted?.should == true
33
22
  end
34
23
  it "String returned by a method is tainted" do
35
24
  mp = FFI::MemoryPointer.new :pointer
@@ -37,8 +26,8 @@ describe "String tests" do
37
26
  sp.put_string(0, "test")
38
27
  mp.put_pointer(0, sp)
39
28
  str = StrLibTest.ptr_ret_pointer(mp, 0)
40
- str.should eq "test"
41
- str.tainted?.should eq true
29
+ str.should == "test"
30
+ str.tainted?.should == true
42
31
  end
43
32
  it "Poison null byte raises error" do
44
33
  s = "123\0abc"
@@ -49,7 +38,7 @@ describe "String tests" do
49
38
  str = "test"
50
39
  str.taint
51
40
  begin
52
- LibTest.string_equals(str, str).should eq false
41
+ LibTest.string_equals(str, str).should == false
53
42
  rescue SecurityError
54
43
  end
55
44
  end if false
@@ -57,7 +46,7 @@ describe "String tests" do
57
46
  StrLibTest.string_dummy(nil)
58
47
  end
59
48
  it "return nil for NULL char*" do
60
- StrLibTest.string_null.should eq nil
49
+ StrLibTest.string_null.should == nil
61
50
  end
62
51
  it "reads an array of strings until encountering a NULL pointer" do
63
52
  strings = ["foo", "bar", "baz", "testing", "ffi"]
@@ -69,7 +58,7 @@ describe "String tests" do
69
58
  end
70
59
  ary.insert(3, nil)
71
60
  ptrary.write_array_of_pointer(ary)
72
- ptrary.get_array_of_string(0).should eq ["foo", "bar", "baz"]
61
+ ptrary.get_array_of_string(0).should == ["foo", "bar", "baz"]
73
62
  end
74
63
  it "reads an array of strings of the size specified, substituting nil when a pointer is NULL" do
75
64
  strings = ["foo", "bar", "baz", "testing", "ffi"]
@@ -81,7 +70,7 @@ describe "String tests" do
81
70
  end
82
71
  ary.insert(2, nil)
83
72
  ptrary.write_array_of_pointer(ary)
84
- ptrary.get_array_of_string(0, 4).should eq ["foo", "bar", nil, "baz"]
73
+ ptrary.get_array_of_string(0, 4).should == ["foo", "bar", nil, "baz"]
85
74
  end
86
75
  it "reads an array of strings, taking a memory offset parameter" do
87
76
  strings = ["foo", "bar", "baz", "testing", "ffi"]
@@ -92,7 +81,7 @@ describe "String tests" do
92
81
  a << f
93
82
  end
94
83
  ptrary.write_array_of_pointer(ary)
95
- ptrary.get_array_of_string(2 * FFI.type_size(:pointer), 3).should eq ["baz", "testing", "ffi"]
84
+ ptrary.get_array_of_string(2 * FFI.type_size(:pointer), 3).should == ["baz", "testing", "ffi"]
96
85
  end
97
86
  it "raises an IndexError when trying to read an array of strings out of bounds" do
98
87
  strings = ["foo", "bar", "baz", "testing", "ffi"]
@@ -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"))
@@ -51,7 +40,7 @@ describe "functions returning :strptr" do
51
40
 
52
41
  it "should return the correct value" do
53
42
  result = StrPtr.strdup("test")
54
- result[0].should eq "test"
43
+ result[0].should == "test"
55
44
  end
56
45
 
57
46
  it "should return non-NULL pointer" do
@@ -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"))
@@ -53,7 +42,7 @@ describe FFI::Struct, ' with inline callback functions' do
53
42
  ts = CallbackMember2::TestStruct.new
54
43
  ts[:add] = StructCallbacks.method(:add)
55
44
 
56
- CallbackMember2.struct_call_add_cb(ts, 1, 2).should eq 3
45
+ CallbackMember2.struct_call_add_cb(ts, 1, 2).should == 3
57
46
  end
58
47
 
59
48
  it 'should return callable object from []' do
@@ -74,7 +63,7 @@ describe FFI::Struct, ' with inline callback functions' do
74
63
  s[:add] = add
75
64
  fn = s[:add]
76
65
  fn.respond_to?(:call).should be_true
77
- fn.call(1, 2).should eq 3
66
+ fn.call(1, 2).should == 3
78
67
  end
79
68
  end
80
69
 
@@ -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"))
@@ -26,7 +15,7 @@ describe FFI::Struct, ' with an initialize function' do
26
15
  self.magic = 42
27
16
  end
28
17
  end
29
- StructWithInitialize.new.magic.should eq 42
18
+ StructWithInitialize.new.magic.should == 42
30
19
  end
31
20
  end
32
21
 
@@ -41,6 +30,6 @@ describe FFI::ManagedStruct, ' with an initialize function' do
41
30
  end
42
31
  def self.release;end
43
32
  end
44
- ManagedStructWithInitialize.new.magic.should eq 42
33
+ ManagedStructWithInitialize.new.magic.should == 42
45
34
  end
46
35
  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"))
@@ -21,42 +10,42 @@ describe FFI::Struct do
21
10
  Class.new(FFI::Struct) do
22
11
  packed
23
12
  layout :c, :char, :i, :int
24
- end.size.should eq 5
13
+ end.size.should == 5
25
14
  end
26
15
 
27
16
  it "packed :char followed by :int should have alignment of 1" do
28
17
  Class.new(FFI::Struct) do
29
18
  packed
30
19
  layout :c, :char, :i, :int
31
- end.alignment.should eq 1
20
+ end.alignment.should == 1
32
21
  end
33
22
 
34
23
  it "packed(2) :char followed by :int should have size of 6" do
35
24
  Class.new(FFI::Struct) do
36
25
  packed 2
37
26
  layout :c, :char, :i, :int
38
- end.size.should eq 6
27
+ end.size.should == 6
39
28
  end
40
29
 
41
30
  it "packed(2) :char followed by :int should have alignment of 2" do
42
31
  Class.new(FFI::Struct) do
43
32
  packed 2
44
33
  layout :c, :char, :i, :int
45
- end.alignment.should eq 2
34
+ end.alignment.should == 2
46
35
  end
47
36
 
48
37
  it "packed :short followed by int should have size of 6" do
49
38
  Class.new(FFI::Struct) do
50
39
  packed
51
40
  layout :s, :short, :i, :int
52
- end.size.should eq 6
41
+ end.size.should == 6
53
42
  end
54
43
 
55
44
  it "packed :short followed by int should have alignment of 1" do
56
45
  Class.new(FFI::Struct) do
57
46
  packed
58
47
  layout :s, :short, :i, :int
59
- end.alignment.should eq 1
48
+ end.alignment.should == 1
60
49
  end
61
50
 
62
51
  end