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,21 +1,7 @@
1
1
  /*
2
- * Copyright (c) 2009 Wayne Meissner. All rights reserved.
3
- *
4
- * All rights reserved.
2
+ * Copyright (c) 2007 Wayne Meissner. All rights reserved.
5
3
  *
6
- * This file is part of ruby-ffi.
7
- *
8
- * This code is free software: you can redistribute it and/or modify it under
9
- * the terms of the GNU Lesser General Public License version 3 only, as
10
- * published by the Free Software Foundation.
11
- *
12
- * This code is distributed in the hope that it will be useful, but WITHOUT
13
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15
- * version 3 for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public License
18
- * version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
4
+ * For licensing, see LICENSE.SPECS
19
5
  */
20
6
 
21
7
  #ifdef _WIN32
@@ -1,21 +1,7 @@
1
1
  /*
2
- * Copyright (c) 2009 Wayne Meissner. All rights reserved.
3
- *
4
- * All rights reserved.
2
+ * Copyright (c) 2007 Wayne Meissner. All rights reserved.
5
3
  *
6
- * This file is part of ruby-ffi.
7
- *
8
- * This code is free software: you can redistribute it and/or modify it under
9
- * the terms of the GNU Lesser General Public License version 3 only, as
10
- * published by the Free Software Foundation.
11
- *
12
- * This code is distributed in the hope that it will be useful, but WITHOUT
13
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15
- * version 3 for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public License
18
- * version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
4
+ * For licensing, see LICENSE.SPECS
19
5
  */
20
6
 
21
7
  #include <sys/types.h>
@@ -1,21 +1,7 @@
1
1
  /*
2
- * Copyright (c) 2008 Wayne Meissner. All rights reserved.
3
- *
4
- * All rights reserved.
2
+ * Copyright (c) 2007 Wayne Meissner. All rights reserved.
5
3
  *
6
- * This file is part of ruby-ffi.
7
- *
8
- * This code is free software: you can redistribute it and/or modify it under
9
- * the terms of the GNU Lesser General Public License version 3 only, as
10
- * published by the Free Software Foundation.
11
- *
12
- * This code is distributed in the hope that it will be useful, but WITHOUT
13
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15
- * version 3 for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public License
18
- * version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
4
+ * For licensing, see LICENSE.SPECS
19
5
  */
20
6
 
21
7
  #if defined(_WIN32) || defined(__WIN32__)
data/libtest/NumberTest.c CHANGED
@@ -1,21 +1,7 @@
1
1
  /*
2
2
  * Copyright (c) 2007 Wayne Meissner. All rights reserved.
3
- *
4
- * All rights reserved.
5
3
  *
6
- * This file is part of ruby-ffi.
7
- *
8
- * This code is free software: you can redistribute it and/or modify it under
9
- * the terms of the GNU Lesser General Public License version 3 only, as
10
- * published by the Free Software Foundation.
11
- *
12
- * This code is distributed in the hope that it will be useful, but WITHOUT
13
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15
- * version 3 for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public License
18
- * version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
4
+ * For licensing, see LICENSE.SPECS
19
5
  */
20
6
 
21
7
  #include <sys/types.h>
@@ -1,21 +1,7 @@
1
1
  /*
2
2
  * Copyright (c) 2007 Wayne Meissner. All rights reserved.
3
- *
4
- * All rights reserved.
5
3
  *
6
- * This file is part of ruby-ffi.
7
- *
8
- * This code is free software: you can redistribute it and/or modify it under
9
- * the terms of the GNU Lesser General Public License version 3 only, as
10
- * published by the Free Software Foundation.
11
- *
12
- * This code is distributed in the hope that it will be useful, but WITHOUT
13
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15
- * version 3 for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public License
18
- * version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
4
+ * For licensing, see LICENSE.SPECS
19
5
  */
20
6
 
21
7
  #include <sys/types.h>
@@ -1,21 +1,7 @@
1
1
  /*
2
2
  * Copyright (c) 2007 Wayne Meissner. All rights reserved.
3
- *
4
- * All rights reserved.
5
3
  *
6
- * This file is part of ruby-ffi.
7
- *
8
- * This code is free software: you can redistribute it and/or modify it under
9
- * the terms of the GNU Lesser General Public License version 3 only, as
10
- * published by the Free Software Foundation.
11
- *
12
- * This code is distributed in the hope that it will be useful, but WITHOUT
13
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15
- * version 3 for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public License
18
- * version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
4
+ * For licensing, see LICENSE.SPECS
19
5
  */
20
6
 
21
7
  #include <stdint.h>
data/libtest/StringTest.c CHANGED
@@ -1,21 +1,7 @@
1
1
  /*
2
2
  * Copyright (c) 2007 Wayne Meissner. All rights reserved.
3
- *
4
- * All rights reserved.
5
3
  *
6
- * This file is part of ruby-ffi.
7
- *
8
- * This code is free software: you can redistribute it and/or modify it under
9
- * the terms of the GNU Lesser General Public License version 3 only, as
10
- * published by the Free Software Foundation.
11
- *
12
- * This code is distributed in the hope that it will be useful, but WITHOUT
13
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15
- * version 3 for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public License
18
- * version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
4
+ * For licensing, see LICENSE.SPECS
19
5
  */
20
6
 
21
7
  #include <string.h>
data/libtest/StructTest.c CHANGED
@@ -1,21 +1,7 @@
1
1
  /*
2
2
  * Copyright (c) 2007 Wayne Meissner. All rights reserved.
3
3
  *
4
- * All rights reserved.
5
- *
6
- * This file is part of ruby-ffi.
7
- *
8
- * This code is free software: you can redistribute it and/or modify it under
9
- * the terms of the GNU Lesser General Public License version 3 only, as
10
- * published by the Free Software Foundation.
11
- *
12
- * This code is distributed in the hope that it will be useful, but WITHOUT
13
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15
- * version 3 for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public License
18
- * version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
4
+ * For licensing, see LICENSE.SPECS
19
5
  */
20
6
 
21
7
  #include <stdio.h>
data/libtest/UnionTest.c CHANGED
@@ -1,21 +1,7 @@
1
1
  /*
2
2
  * Copyright (c) 2007 Wayne Meissner. All rights reserved.
3
- *
4
- * All rights reserved.
5
3
  *
6
- * This file is part of ruby-ffi.
7
- *
8
- * This code is free software: you can redistribute it and/or modify it under
9
- * the terms of the GNU Lesser General Public License version 3 only, as
10
- * published by the Free Software Foundation.
11
- *
12
- * This code is distributed in the hope that it will be useful, but WITHOUT
13
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15
- * version 3 for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public License
18
- * version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
4
+ * For licensing, see LICENSE.SPECS
19
5
  */
20
6
 
21
7
  #include <stdio.h>
@@ -1,21 +1,7 @@
1
1
  /*
2
- * Copyright (c) 2008 Wayne Meissner. All rights reserved.
2
+ * Copyright (c) 2007 Wayne Meissner. All rights reserved.
3
3
  *
4
- * All rights reserved.
5
- *
6
- * This file is part of ruby-ffi.
7
- *
8
- * This code is free software: you can redistribute it and/or modify it under
9
- * the terms of the GNU Lesser General Public License version 3 only, as
10
- * published by the Free Software Foundation.
11
- *
12
- * This code is distributed in the hope that it will be useful, but WITHOUT
13
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15
- * version 3 for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public License
18
- * version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
4
+ * For licensing, see LICENSE.SPECS
19
5
  */
20
6
 
21
7
  #include <sys/types.h>
@@ -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"))
@@ -32,7 +21,7 @@ describe "async callback" do
32
21
  cb = Proc.new {|i| v = i; called = true }
33
22
  LibTest.testAsyncCallback(cb, 0x7fffffff)
34
23
  called.should be_true
35
- v.should eq 0x7fffffff
24
+ v.should == 0x7fffffff
36
25
  end
37
26
 
38
27
  it "called a second time" do
@@ -41,6 +30,6 @@ describe "async callback" do
41
30
  cb = Proc.new {|i| v = i; called = true }
42
31
  LibTest.testAsyncCallback(cb, 0x7fffffff)
43
32
  called.should be_true
44
- v.should eq 0x7fffffff
33
+ v.should == 0x7fffffff
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"))
@@ -25,14 +14,14 @@ describe "Function with primitive boolean arguments and return values" do
25
14
  attach_function :bool_reverse_val, [ :bool ], :bool
26
15
  end
27
16
  it "bools" do
28
- LibTest.bool_return_true.should eq true
29
- LibTest.bool_return_false.should eq false
17
+ LibTest.bool_return_true.should == true
18
+ LibTest.bool_return_false.should == false
30
19
 
31
- LibTest.bool_return_val(true).should eq true
32
- LibTest.bool_return_val(false).should eq false
20
+ LibTest.bool_return_val(true).should == true
21
+ LibTest.bool_return_val(false).should == false
33
22
 
34
- LibTest.bool_reverse_val(true).should eq false
35
- LibTest.bool_reverse_val(false).should eq true
23
+ LibTest.bool_reverse_val(true).should == false
24
+ LibTest.bool_reverse_val(false).should == true
36
25
  end
37
26
  it "raise error on invalid types" do
38
27
  lambda { LibTest.bool_return_val(nil) }.should raise_error(::TypeError)
@@ -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"))
@@ -23,13 +12,13 @@ describe "Buffer#total" do
23
12
  :long_long => 8, :ulong_long => 8, :float => 4, :double => 8
24
13
  }.each_pair do |t, s|
25
14
  it "Buffer.alloc_in(#{t}, #{i}).total == #{i * s}" do
26
- FFI::Buffer.alloc_in(t, i).total.should eq i * s
15
+ FFI::Buffer.alloc_in(t, i).total.should == i * s
27
16
  end
28
17
  it "Buffer.alloc_out(#{t}, #{i}).total == #{i * s}" do
29
- FFI::Buffer.alloc_out(t, i).total.should eq i * s
18
+ FFI::Buffer.alloc_out(t, i).total.should == i * s
30
19
  end
31
20
  it "Buffer.alloc_inout(#{t}, #{i}).total == #{i * s}" do
32
- FFI::Buffer.alloc_inout(t, i).total.should eq i * s
21
+ FFI::Buffer.alloc_inout(t, i).total.should == i * s
33
22
  end
34
23
  end
35
24
  end
@@ -40,7 +29,7 @@ describe "Buffer#put_char" do
40
29
  (0..127).each do |i|
41
30
  (0..bufsize-1).each do |offset|
42
31
  it "put_char(#{offset}, #{i}).get_char(#{offset}) == #{i}" do
43
- FFI::Buffer.alloc_in(bufsize).put_char(offset, i).get_char(offset).should eq i
32
+ FFI::Buffer.alloc_in(bufsize).put_char(offset, i).get_char(offset).should == i
44
33
  end
45
34
  end
46
35
  end
@@ -50,7 +39,7 @@ describe "Buffer#put_uchar" do
50
39
  (0..255).each do |i|
51
40
  (0..bufsize-1).each do |offset|
52
41
  it "Buffer.put_uchar(#{offset}, #{i}).get_uchar(#{offset}) == #{i}" do
53
- FFI::Buffer.alloc_in(bufsize).put_uchar(offset, i).get_uchar(offset).should eq i
42
+ FFI::Buffer.alloc_in(bufsize).put_uchar(offset, i).get_uchar(offset).should == i
54
43
  end
55
44
  end
56
45
  end
@@ -60,7 +49,7 @@ describe "Buffer#put_short" do
60
49
  [0, 1, 128, 32767].each do |i|
61
50
  (0..bufsize-2).each do |offset|
62
51
  it "put_short(#{offset}, #{i}).get_short(#{offset}) == #{i}" do
63
- FFI::Buffer.alloc_in(bufsize).put_short(offset, i).get_short(offset).should eq i
52
+ FFI::Buffer.alloc_in(bufsize).put_short(offset, i).get_short(offset).should == i
64
53
  end
65
54
  end
66
55
  end
@@ -70,7 +59,7 @@ describe "Buffer#put_ushort" do
70
59
  [ 0, 1, 128, 32767, 65535, 0xfee1, 0xdead, 0xbeef, 0xcafe ].each do |i|
71
60
  (0..bufsize-2).each do |offset|
72
61
  it "put_ushort(#{offset}, #{i}).get_ushort(#{offset}) == #{i}" do
73
- FFI::Buffer.alloc_in(bufsize).put_ushort(offset, i).get_ushort(offset).should eq i
62
+ FFI::Buffer.alloc_in(bufsize).put_ushort(offset, i).get_ushort(offset).should == i
74
63
  end
75
64
  end
76
65
  end
@@ -80,7 +69,7 @@ describe "Buffer#put_int" do
80
69
  [0, 1, 128, 32767, 0x7ffffff ].each do |i|
81
70
  (0..bufsize-4).each do |offset|
82
71
  it "put_int(#{offset}, #{i}).get_int(#{offset}) == #{i}" do
83
- FFI::Buffer.alloc_in(bufsize).put_int(offset, i).get_int(offset).should eq i
72
+ FFI::Buffer.alloc_in(bufsize).put_int(offset, i).get_int(offset).should == i
84
73
  end
85
74
  end
86
75
  end
@@ -90,7 +79,7 @@ describe "Buffer#put_uint" do
90
79
  [ 0, 1, 128, 32767, 65535, 0xfee1dead, 0xcafebabe, 0xffffffff ].each do |i|
91
80
  (0..bufsize-4).each do |offset|
92
81
  it "put_uint(#{offset}, #{i}).get_uint(#{offset}) == #{i}" do
93
- FFI::Buffer.alloc_in(bufsize).put_uint(offset, i).get_uint(offset).should eq i
82
+ FFI::Buffer.alloc_in(bufsize).put_uint(offset, i).get_uint(offset).should == i
94
83
  end
95
84
  end
96
85
  end
@@ -100,7 +89,7 @@ describe "Buffer#put_long" do
100
89
  [0, 1, 128, 32767, 0x7ffffff ].each do |i|
101
90
  (0..bufsize-FFI::Type::LONG.size).each do |offset|
102
91
  it "put_long(#{offset}, #{i}).get_long(#{offset}) == #{i}" do
103
- FFI::Buffer.alloc_in(bufsize).put_long(offset, i).get_long(offset).should eq i
92
+ FFI::Buffer.alloc_in(bufsize).put_long(offset, i).get_long(offset).should == i
104
93
  end
105
94
  end
106
95
  end
@@ -110,7 +99,7 @@ describe "Buffer#put_ulong" do
110
99
  [ 0, 1, 128, 32767, 65535, 0xfee1dead, 0xcafebabe, 0xffffffff ].each do |i|
111
100
  (0..bufsize-FFI::Type::LONG.size).each do |offset|
112
101
  it "put_ulong(#{offset}, #{i}).get_ulong(#{offset}) == #{i}" do
113
- FFI::Buffer.alloc_in(bufsize).put_ulong(offset, i).get_ulong(offset).should eq i
102
+ FFI::Buffer.alloc_in(bufsize).put_ulong(offset, i).get_ulong(offset).should == i
114
103
  end
115
104
  end
116
105
  end
@@ -120,7 +109,7 @@ describe "Buffer#put_long_long" do
120
109
  [0, 1, 128, 32767, 0x7ffffffffffffff ].each do |i|
121
110
  (0..bufsize-8).each do |offset|
122
111
  it "put_long_long(#{offset}, #{i}).get_long_long(#{offset}) == #{i}" do
123
- FFI::Buffer.alloc_in(bufsize).put_long_long(offset, i).get_long_long(offset).should eq i
112
+ FFI::Buffer.alloc_in(bufsize).put_long_long(offset, i).get_long_long(offset).should == i
124
113
  end
125
114
  end
126
115
  end
@@ -130,7 +119,7 @@ describe "Buffer#put_ulong_long" do
130
119
  [ 0, 1, 128, 32767, 65535, 0xdeadcafebabe, 0x7fffffffffffffff ].each do |i|
131
120
  (0..bufsize-8).each do |offset|
132
121
  it "put_ulong_long(#{offset}, #{i}).get_ulong_long(#{offset}) == #{i}" do
133
- FFI::Buffer.alloc_in(bufsize).put_ulong_long(offset, i).get_ulong_long(offset).should eq i
122
+ FFI::Buffer.alloc_in(bufsize).put_ulong_long(offset, i).get_ulong_long(offset).should == i
134
123
  end
135
124
  end
136
125
  end
@@ -141,21 +130,21 @@ describe "Reading/Writing binary strings" do
141
130
  buf = FFI::Buffer.new 1024
142
131
  buf.put_bytes(0, str);
143
132
  s2 = buf.get_bytes(0, 11);
144
- s2.should eq str
133
+ s2.should == str
145
134
  end
146
135
  it "Buffer#put_bytes with index and length" do
147
136
  str = "hello\0world"
148
137
  buf = FFI::Buffer.new 1024
149
138
  buf.put_bytes(0, str, 5, 6);
150
139
  s2 = buf.get_bytes(0, 6);
151
- s2.should eq str[5..-1]
140
+ s2.should == str[5..-1]
152
141
  end
153
142
  it "Buffer#put_bytes with only index" do
154
143
  str = "hello\0world"
155
144
  buf = FFI::Buffer.new 1024
156
145
  buf.put_bytes(0, str, 5);
157
146
  s2 = buf.get_bytes(0, 6);
158
- s2.should eq str[5..-1]
147
+ s2.should == str[5..-1]
159
148
  end
160
149
  it "Buffer#put_bytes with index > str.length" do
161
150
  str = "hello\0world"
@@ -178,21 +167,21 @@ describe "Reading/Writing binary strings" do
178
167
  buf = FFI::Buffer.new 1024
179
168
  buf.write_bytes(str)
180
169
  s2 = buf.get_bytes(0, 11)
181
- s2.should eq str
170
+ s2.should == str
182
171
  end
183
172
  it "Buffer#write_bytes with index and length" do
184
173
  str = "hello\0world"
185
174
  buf = FFI::Buffer.new 1024
186
175
  buf.write_bytes(str, 5, 6)
187
176
  s2 = buf.get_bytes(0, 6)
188
- s2.should eq str[5..-1]
177
+ s2.should == str[5..-1]
189
178
  end
190
179
  it "Buffer#write_bytes with only index" do
191
180
  str = "hello\0world"
192
181
  buf = FFI::Buffer.new 1024
193
182
  buf.write_bytes(str, 5)
194
183
  s2 = buf.get_bytes(0, 6)
195
- s2.should eq str[5..-1]
184
+ s2.should == str[5..-1]
196
185
  end
197
186
  it "Buffer#write_bytes with index > str.length" do
198
187
  str = "hello\0world"
@@ -216,21 +205,21 @@ describe "Reading/Writing ascii strings" do
216
205
  buf = FFI::Buffer.new 1024
217
206
  buf.put_string(0, str);
218
207
  s2 = buf.get_bytes(0, 11);
219
- s2.should eq str
208
+ s2.should == str
220
209
  end
221
210
  it "Buffer#get_string with string containing zero byte" do
222
211
  str = "hello\0world"
223
212
  buf = FFI::Buffer.new 1024
224
213
  buf.put_bytes(0, str);
225
214
  s2 = buf.get_string(0, 11);
226
- s2.should eq "hello"
215
+ s2.should == "hello"
227
216
  end
228
217
  it "Buffer#put_string without length should NUL terminate" do
229
218
  str = "hello"
230
219
  buf = FFI::Buffer.new 1024
231
220
  buf.put_string(0, str);
232
221
  s2 = buf.get_bytes(0, 6);
233
- s2.should eq "hello\0"
222
+ s2.should == "hello\0"
234
223
  end
235
224
  end
236
225
  describe "Buffer#put_pointer" do
@@ -240,13 +229,13 @@ describe "Buffer#put_pointer" do
240
229
  buf = FFI::Buffer.alloc_inout 8
241
230
  p2 = buf.put_pointer(0, p).get_pointer(0)
242
231
  p2.should_not be_nil
243
- p2.should eq p
244
- p2.get_uint(0).should eq 0xdeadbeef
232
+ p2.should == p
233
+ p2.get_uint(0).should == 0xdeadbeef
245
234
  end
246
235
  end
247
236
  describe "Buffer#size" do
248
237
  it "should return size" do
249
238
  buf = FFI::Buffer.new 14
250
- buf.size.should eq 14
239
+ buf.size.should == 14
251
240
  end
252
241
  end