diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-03 22:49:23 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-03 22:49:23 +0200 |
commit | 6ce6c87d5151f5bb60fc26409a22c8005dc46660 (patch) | |
tree | e8fff020b147cb0e85bcf72b1d70b75760bd52c2 /spec/eina_list_spec.rb | |
parent | 5b0c3cb9366a9928d6f069946a743ad3b818f61a (diff) | |
download | ffi-efl-6ce6c87d5151f5bb60fc26409a22c8005dc46660.zip ffi-efl-6ce6c87d5151f5bb60fc26409a22c8005dc46660.tar.gz |
REinaList : simple spec for Enumerable
Diffstat (limited to 'spec/eina_list_spec.rb')
-rw-r--r-- | spec/eina_list_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/eina_list_spec.rb b/spec/eina_list_spec.rb index 96ac7bd..d19a372 100644 --- a/spec/eina_list_spec.rb +++ b/spec/eina_list_spec.rb @@ -92,4 +92,20 @@ describe Efl::EinaList do l.free end # + it "Enumerable should work" do + l = REinaList.new + d1 = ::FFI::MemoryPointer.from_string "D0" + d2 = ::FFI::MemoryPointer.from_string "D1" + d3 = ::FFI::MemoryPointer.from_string "D2" + d4 = ::FFI::MemoryPointer.from_string "D3" + l.append d3 + l.prepend d2 + l << d4 + l.unshift d1 + r = 0 + l.each do |e| r+=1; end + r.should == 4 + r = l.inject(0) do |s,e| s+=1; s; end + r.should == 4 + end end |