We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2216955 commit 834b6bfCopy full SHA for 834b6bf
spec/ffi/struct_spec.rb
@@ -129,6 +129,19 @@ class StringMember < FFI::Struct
129
expect(s[:string]).to be_nil
130
end
131
132
+ it "Struct#clear sets the memory to zero" do
133
+ klass = Class.new(FFI::Struct) do
134
+ layout :a, :int, :b, :long
135
+ end
136
+
137
+ s = klass.new
138
+ s[:a] = 1
139
+ s[:b] = 2
140
+ s.clear
141
+ expect(s[:a]).to eq(0)
142
+ expect(s[:b]).to eq(0)
143
144
145
it "Struct#layout works with :name, :type pairs" do
146
class PairLayout < FFI::Struct
147
layout :a, :int, :b, :long_long
0 commit comments