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
 
17
6
  require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
@@ -44,4 +33,4 @@ describe "functions with custom parameter types" do
44
33
  end
45
34
 
46
35
  end
47
- end
36
+ 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"))
data/spec/ffi/dup_spec.rb CHANGED
@@ -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
 
@@ -24,7 +13,7 @@ describe "Pointer#dup" do
24
13
  p2 = p1.dup
25
14
  p1.put_string(0, "deadbeef")
26
15
 
27
- p2.get_string(0).should eq "test123"
16
+ p2.get_string(0).should == "test123"
28
17
  end
29
18
 
30
19
  it "sliced pointer can be cloned" do
@@ -33,8 +22,8 @@ describe "Pointer#dup" do
33
22
  p2 = p1[1].dup
34
23
 
35
24
  # first char will be excised
36
- p2.get_string(0).should eq "est123"
37
- p1.get_string(0).should eq "test123"
25
+ p2.get_string(0).should == "est123"
26
+ p1.get_string(0).should == "test123"
38
27
  end
39
28
 
40
29
  it "sliced pointer when cloned is independent" do
@@ -44,7 +33,7 @@ describe "Pointer#dup" do
44
33
 
45
34
  p1.put_string(0, "deadbeef")
46
35
  # first char will be excised
47
- p2.get_string(0).should eq "est123"
36
+ p2.get_string(0).should == "est123"
48
37
  end
49
38
  end
50
39
 
@@ -58,8 +47,8 @@ describe "Struct#dup" do
58
47
  s1[:i] = 0x12345
59
48
  s2 = s1.dup
60
49
  s1[:i] = 0x98765
61
- s2[:i].should eq 0x12345
62
- s1[:i].should eq 0x98765
50
+ s2[:i].should == 0x12345
51
+ s1[:i].should == 0x98765
63
52
  end
64
53
 
65
54
  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"))
@@ -49,180 +38,180 @@ end
49
38
 
50
39
  describe "A library with no enum defined" do
51
40
  it "returns nil when asked for an enum" do
52
- TestEnum0.enum_type(:foo).should eq nil
41
+ TestEnum0.enum_type(:foo).should == nil
53
42
  end
54
43
  end
55
44
 
56
45
  describe "An untagged enum" do
57
46
  it "constants can be used as function parameters and return value" do
58
- TestEnum1.test_untagged_enum(:c1).should eq 0
59
- TestEnum1.test_untagged_enum(:c2).should eq 1
60
- TestEnum1.test_untagged_enum(:c3).should eq 2
61
- TestEnum1.test_untagged_enum(:c4).should eq 3
62
- TestEnum1.test_untagged_enum(:c5).should eq 42
63
- TestEnum1.test_untagged_enum(:c6).should eq 43
64
- TestEnum1.test_untagged_enum(:c7).should eq 44
65
- TestEnum1.test_untagged_enum(:c8).should eq 45
66
- TestEnum1.test_untagged_enum(:c9).should eq 42
67
- TestEnum1.test_untagged_enum(:c10).should eq 43
68
- TestEnum1.test_untagged_enum(:c11).should eq 4242
69
- TestEnum1.test_untagged_enum(:c12).should eq 4243
70
- TestEnum1.test_untagged_enum(:c13).should eq 42
71
- TestEnum1.test_untagged_enum(:c14).should eq 4242
72
- TestEnum1.test_untagged_enum(:c15).should eq 424242
73
- TestEnum1.test_untagged_enum(:c16).should eq 42424242
47
+ TestEnum1.test_untagged_enum(:c1).should == 0
48
+ TestEnum1.test_untagged_enum(:c2).should == 1
49
+ TestEnum1.test_untagged_enum(:c3).should == 2
50
+ TestEnum1.test_untagged_enum(:c4).should == 3
51
+ TestEnum1.test_untagged_enum(:c5).should == 42
52
+ TestEnum1.test_untagged_enum(:c6).should == 43
53
+ TestEnum1.test_untagged_enum(:c7).should == 44
54
+ TestEnum1.test_untagged_enum(:c8).should == 45
55
+ TestEnum1.test_untagged_enum(:c9).should == 42
56
+ TestEnum1.test_untagged_enum(:c10).should == 43
57
+ TestEnum1.test_untagged_enum(:c11).should == 4242
58
+ TestEnum1.test_untagged_enum(:c12).should == 4243
59
+ TestEnum1.test_untagged_enum(:c13).should == 42
60
+ TestEnum1.test_untagged_enum(:c14).should == 4242
61
+ TestEnum1.test_untagged_enum(:c15).should == 424242
62
+ TestEnum1.test_untagged_enum(:c16).should == 42424242
74
63
  end
75
64
  end
76
65
 
77
66
  describe "A tagged typedef enum" do
78
67
  it "is accessible through its tag" do
79
- TestEnum3.enum_type(:enum_type1).should_not eq nil
80
- TestEnum3.enum_type(:enum_type2).should_not eq nil
81
- TestEnum3.enum_type(:enum_type3).should_not eq nil
82
- TestEnum3.enum_type(:enum_type4).should_not eq nil
68
+ TestEnum3.enum_type(:enum_type1).should_not == nil
69
+ TestEnum3.enum_type(:enum_type2).should_not == nil
70
+ TestEnum3.enum_type(:enum_type3).should_not == nil
71
+ TestEnum3.enum_type(:enum_type4).should_not == nil
83
72
  end
84
73
  it "contains enum constants" do
85
- TestEnum3.enum_type(:enum_type1).symbols.length.should eq 4
86
- TestEnum3.enum_type(:enum_type2).symbols.length.should eq 4
87
- TestEnum3.enum_type(:enum_type3).symbols.length.should eq 4
88
- TestEnum3.enum_type(:enum_type4).symbols.length.should eq 4
74
+ TestEnum3.enum_type(:enum_type1).symbols.length.should == 4
75
+ TestEnum3.enum_type(:enum_type2).symbols.length.should == 4
76
+ TestEnum3.enum_type(:enum_type3).symbols.length.should == 4
77
+ TestEnum3.enum_type(:enum_type4).symbols.length.should == 4
89
78
  end
90
79
  it "constants can be used as function parameters and return value" do
91
- TestEnum3.test_tagged_typedef_enum1(:c1).should eq :c1
92
- TestEnum3.test_tagged_typedef_enum1(:c2).should eq :c2
93
- TestEnum3.test_tagged_typedef_enum1(:c3).should eq :c3
94
- TestEnum3.test_tagged_typedef_enum1(:c4).should eq :c4
95
- TestEnum3.test_tagged_typedef_enum2(:c5).should eq :c5
96
- TestEnum3.test_tagged_typedef_enum2(:c6).should eq :c6
97
- TestEnum3.test_tagged_typedef_enum2(:c7).should eq :c7
98
- TestEnum3.test_tagged_typedef_enum2(:c8).should eq :c8
99
- TestEnum3.test_tagged_typedef_enum3(:c9).should eq :c9
100
- TestEnum3.test_tagged_typedef_enum3(:c10).should eq :c10
101
- TestEnum3.test_tagged_typedef_enum3(:c11).should eq :c11
102
- TestEnum3.test_tagged_typedef_enum3(:c12).should eq :c12
103
- TestEnum3.test_tagged_typedef_enum4(:c13).should eq :c13
104
- TestEnum3.test_tagged_typedef_enum4(:c14).should eq :c14
105
- TestEnum3.test_tagged_typedef_enum4(:c15).should eq :c15
106
- TestEnum3.test_tagged_typedef_enum4(:c16).should eq :c16
80
+ TestEnum3.test_tagged_typedef_enum1(:c1).should == :c1
81
+ TestEnum3.test_tagged_typedef_enum1(:c2).should == :c2
82
+ TestEnum3.test_tagged_typedef_enum1(:c3).should == :c3
83
+ TestEnum3.test_tagged_typedef_enum1(:c4).should == :c4
84
+ TestEnum3.test_tagged_typedef_enum2(:c5).should == :c5
85
+ TestEnum3.test_tagged_typedef_enum2(:c6).should == :c6
86
+ TestEnum3.test_tagged_typedef_enum2(:c7).should == :c7
87
+ TestEnum3.test_tagged_typedef_enum2(:c8).should == :c8
88
+ TestEnum3.test_tagged_typedef_enum3(:c9).should == :c9
89
+ TestEnum3.test_tagged_typedef_enum3(:c10).should == :c10
90
+ TestEnum3.test_tagged_typedef_enum3(:c11).should == :c11
91
+ TestEnum3.test_tagged_typedef_enum3(:c12).should == :c12
92
+ TestEnum3.test_tagged_typedef_enum4(:c13).should == :c13
93
+ TestEnum3.test_tagged_typedef_enum4(:c14).should == :c14
94
+ TestEnum3.test_tagged_typedef_enum4(:c15).should == :c15
95
+ TestEnum3.test_tagged_typedef_enum4(:c16).should == :c16
107
96
  end
108
97
 
109
98
  it "integers can be used instead of constants" do
110
- TestEnum3.test_tagged_typedef_enum1(0).should eq :c1
111
- TestEnum3.test_tagged_typedef_enum1(1).should eq :c2
112
- TestEnum3.test_tagged_typedef_enum1(2).should eq :c3
113
- TestEnum3.test_tagged_typedef_enum1(3).should eq :c4
114
- TestEnum3.test_tagged_typedef_enum2(42).should eq :c5
115
- TestEnum3.test_tagged_typedef_enum2(43).should eq :c6
116
- TestEnum3.test_tagged_typedef_enum2(44).should eq :c7
117
- TestEnum3.test_tagged_typedef_enum2(45).should eq :c8
118
- TestEnum3.test_tagged_typedef_enum3(42).should eq :c9
119
- TestEnum3.test_tagged_typedef_enum3(43).should eq :c10
120
- TestEnum3.test_tagged_typedef_enum3(4242).should eq :c11
121
- TestEnum3.test_tagged_typedef_enum3(4243).should eq :c12
122
- TestEnum3.test_tagged_typedef_enum4(42).should eq :c13
123
- TestEnum3.test_tagged_typedef_enum4(4242).should eq :c14
124
- TestEnum3.test_tagged_typedef_enum4(424242).should eq :c15
125
- TestEnum3.test_tagged_typedef_enum4(42424242).should eq :c16
99
+ TestEnum3.test_tagged_typedef_enum1(0).should == :c1
100
+ TestEnum3.test_tagged_typedef_enum1(1).should == :c2
101
+ TestEnum3.test_tagged_typedef_enum1(2).should == :c3
102
+ TestEnum3.test_tagged_typedef_enum1(3).should == :c4
103
+ TestEnum3.test_tagged_typedef_enum2(42).should == :c5
104
+ TestEnum3.test_tagged_typedef_enum2(43).should == :c6
105
+ TestEnum3.test_tagged_typedef_enum2(44).should == :c7
106
+ TestEnum3.test_tagged_typedef_enum2(45).should == :c8
107
+ TestEnum3.test_tagged_typedef_enum3(42).should == :c9
108
+ TestEnum3.test_tagged_typedef_enum3(43).should == :c10
109
+ TestEnum3.test_tagged_typedef_enum3(4242).should == :c11
110
+ TestEnum3.test_tagged_typedef_enum3(4243).should == :c12
111
+ TestEnum3.test_tagged_typedef_enum4(42).should == :c13
112
+ TestEnum3.test_tagged_typedef_enum4(4242).should == :c14
113
+ TestEnum3.test_tagged_typedef_enum4(424242).should == :c15
114
+ TestEnum3.test_tagged_typedef_enum4(42424242).should == :c16
126
115
  end
127
116
  end
128
117
 
129
118
  describe "All enums" do
130
119
  it "have autonumbered constants when defined with names only" do
131
- TestEnum1.enum_value(:c1).should eq 0
132
- TestEnum1.enum_value(:c2).should eq 1
133
- TestEnum1.enum_value(:c3).should eq 2
134
- TestEnum1.enum_value(:c4).should eq 3
135
-
136
- TestEnum3.enum_value(:c1).should eq 0
137
- TestEnum3.enum_value(:c2).should eq 1
138
- TestEnum3.enum_value(:c3).should eq 2
139
- TestEnum3.enum_value(:c4).should eq 3
120
+ TestEnum1.enum_value(:c1).should == 0
121
+ TestEnum1.enum_value(:c2).should == 1
122
+ TestEnum1.enum_value(:c3).should == 2
123
+ TestEnum1.enum_value(:c4).should == 3
124
+
125
+ TestEnum3.enum_value(:c1).should == 0
126
+ TestEnum3.enum_value(:c2).should == 1
127
+ TestEnum3.enum_value(:c3).should == 2
128
+ TestEnum3.enum_value(:c4).should == 3
140
129
  end
141
130
  it "can have an explicit first constant and autonumbered subsequent constants" do
142
- TestEnum1.enum_value(:c5).should eq 42
143
- TestEnum1.enum_value(:c6).should eq 43
144
- TestEnum1.enum_value(:c7).should eq 44
145
- TestEnum1.enum_value(:c8).should eq 45
146
-
147
- TestEnum3.enum_value(:c5).should eq 42
148
- TestEnum3.enum_value(:c6).should eq 43
149
- TestEnum3.enum_value(:c7).should eq 44
150
- TestEnum3.enum_value(:c8).should eq 45
131
+ TestEnum1.enum_value(:c5).should == 42
132
+ TestEnum1.enum_value(:c6).should == 43
133
+ TestEnum1.enum_value(:c7).should == 44
134
+ TestEnum1.enum_value(:c8).should == 45
135
+
136
+ TestEnum3.enum_value(:c5).should == 42
137
+ TestEnum3.enum_value(:c6).should == 43
138
+ TestEnum3.enum_value(:c7).should == 44
139
+ TestEnum3.enum_value(:c8).should == 45
151
140
  end
152
141
  it "can have a mix of explicit and autonumbered constants" do
153
- TestEnum1.enum_value(:c9).should eq 42
154
- TestEnum1.enum_value(:c10).should eq 43
155
- TestEnum1.enum_value(:c11).should eq 4242
156
- TestEnum1.enum_value(:c12).should eq 4243
157
-
158
- TestEnum3.enum_value(:c9).should eq 42
159
- TestEnum3.enum_value(:c10).should eq 43
160
- TestEnum3.enum_value(:c11).should eq 4242
161
- TestEnum3.enum_value(:c12).should eq 4243
142
+ TestEnum1.enum_value(:c9).should == 42
143
+ TestEnum1.enum_value(:c10).should == 43
144
+ TestEnum1.enum_value(:c11).should == 4242
145
+ TestEnum1.enum_value(:c12).should == 4243
146
+
147
+ TestEnum3.enum_value(:c9).should == 42
148
+ TestEnum3.enum_value(:c10).should == 43
149
+ TestEnum3.enum_value(:c11).should == 4242
150
+ TestEnum3.enum_value(:c12).should == 4243
162
151
  end
163
152
  it "can have all its constants explicitely valued" do
164
- TestEnum1.enum_value(:c13).should eq 42
165
- TestEnum1.enum_value(:c14).should eq 4242
166
- TestEnum1.enum_value(:c15).should eq 424242
167
- TestEnum1.enum_value(:c16).should eq 42424242
153
+ TestEnum1.enum_value(:c13).should == 42
154
+ TestEnum1.enum_value(:c14).should == 4242
155
+ TestEnum1.enum_value(:c15).should == 424242
156
+ TestEnum1.enum_value(:c16).should == 42424242
168
157
 
169
- TestEnum3.enum_value(:c13).should eq 42
170
- TestEnum3.enum_value(:c14).should eq 4242
171
- TestEnum3.enum_value(:c15).should eq 424242
172
- TestEnum3.enum_value(:c16).should eq 42424242
158
+ TestEnum3.enum_value(:c13).should == 42
159
+ TestEnum3.enum_value(:c14).should == 4242
160
+ TestEnum3.enum_value(:c15).should == 424242
161
+ TestEnum3.enum_value(:c16).should == 42424242
173
162
  end
174
163
  it "return the constant corresponding to a specific value" do
175
164
  enum = TestEnum3.enum_type(:enum_type1)
176
- enum[0].should eq :c1
177
- enum[1].should eq :c2
178
- enum[2].should eq :c3
179
- enum[3].should eq :c4
165
+ enum[0].should == :c1
166
+ enum[1].should == :c2
167
+ enum[2].should == :c3
168
+ enum[3].should == :c4
180
169
 
181
170
  enum = TestEnum3.enum_type(:enum_type2)
182
- enum[42].should eq :c5
183
- enum[43].should eq :c6
184
- enum[44].should eq :c7
185
- enum[45].should eq :c8
171
+ enum[42].should == :c5
172
+ enum[43].should == :c6
173
+ enum[44].should == :c7
174
+ enum[45].should == :c8
186
175
 
187
176
  enum = TestEnum3.enum_type(:enum_type3)
188
- enum[42].should eq :c9
189
- enum[43].should eq :c10
190
- enum[4242].should eq :c11
191
- enum[4243].should eq :c12
177
+ enum[42].should == :c9
178
+ enum[43].should == :c10
179
+ enum[4242].should == :c11
180
+ enum[4243].should == :c12
192
181
 
193
182
  enum = TestEnum3.enum_type(:enum_type4)
194
- enum[42].should eq :c13
195
- enum[4242].should eq :c14
196
- enum[424242].should eq :c15
197
- enum[42424242].should eq :c16
183
+ enum[42].should == :c13
184
+ enum[4242].should == :c14
185
+ enum[424242].should == :c15
186
+ enum[42424242].should == :c16
198
187
  end
199
188
  it "return nil for values that don't have a symbol" do
200
189
  enum = TestEnum3.enum_type(:enum_type1)
201
- enum[-1].should eq nil
202
- enum[4].should eq nil
190
+ enum[-1].should == nil
191
+ enum[4].should == nil
203
192
 
204
193
  enum = TestEnum3.enum_type(:enum_type2)
205
- enum[0].should eq nil
206
- enum[41].should eq nil
207
- enum[46].should eq nil
194
+ enum[0].should == nil
195
+ enum[41].should == nil
196
+ enum[46].should == nil
208
197
 
209
198
  enum = TestEnum3.enum_type(:enum_type3)
210
- enum[0].should eq nil
211
- enum[41].should eq nil
212
- enum[44].should eq nil
213
- enum[4241].should eq nil
214
- enum[4244].should eq nil
199
+ enum[0].should == nil
200
+ enum[41].should == nil
201
+ enum[44].should == nil
202
+ enum[4241].should == nil
203
+ enum[4244].should == nil
215
204
 
216
205
  enum = TestEnum3.enum_type(:enum_type4)
217
- enum[0].should eq nil
218
- enum[41].should eq nil
219
- enum[43].should eq nil
220
- enum[4241].should eq nil
221
- enum[4243].should eq nil
222
- enum[424241].should eq nil
223
- enum[424243].should eq nil
224
- enum[42424241].should eq nil
225
- enum[42424243].should eq nil
206
+ enum[0].should == nil
207
+ enum[41].should == nil
208
+ enum[43].should == nil
209
+ enum[4241].should == nil
210
+ enum[4243].should == nil
211
+ enum[424241].should == nil
212
+ enum[424243].should == nil
213
+ enum[42424241].should == nil
214
+ enum[42424243].should == nil
226
215
  end
227
216
 
228
217
  it "duplicate enum keys rejected" 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"))
@@ -24,6 +13,6 @@ describe "FFI.errno" do
24
13
  it "FFI.errno contains errno from last function" do
25
14
  LibTest.setLastError(0)
26
15
  LibTest.setLastError(0x12345678)
27
- FFI.errno.should eq 0x12345678
16
+ FFI.errno.should == 0x12345678
28
17
  end
29
18
  end