summaryrefslogtreecommitdiffstats
path: root/spec/eina_list_spec.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-04-28 15:09:41 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-04-28 15:09:41 +0200
commit19324a30a17c6ea0b3d77d34160841ef90ce3ed1 (patch)
treea795d324e7822e433dcd66a4057f69d4ecc20d86 /spec/eina_list_spec.rb
parent0035feb9b4f29f06ffd430b763534f40604af4a9 (diff)
downloadffi-efl-19324a30a17c6ea0b3d77d34160841ef90ce3ed1.zip
ffi-efl-19324a30a17c6ea0b3d77d34160841ef90ce3ed1.tar.gz
set hierarchy n lib and spec directories
Diffstat (limited to 'spec/eina_list_spec.rb')
-rw-r--r--spec/eina_list_spec.rb100
1 files changed, 0 insertions, 100 deletions
diff --git a/spec/eina_list_spec.rb b/spec/eina_list_spec.rb
deleted file mode 100644
index 5dba1de..0000000
--- a/spec/eina_list_spec.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-#! /usr/bin/env ruby
-# -*- coding: UTF-8 -*-
-#
-require 'efl/eina_list'
-#
-describe Efl::Eina::EinaList do
- #
- before(:all) {
- EinaList = Efl::Eina::EinaList
- Efl::Eina.init.should eql 1
- }
- after(:all) {
- Efl::Eina.shutdown.should eql 0
- }
- #
- it "should append prepend and fetch" do
- l = EinaList.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
- 0.upto 3 do |i|
- l.nth(i).read_string.should eql "D#{i}"
- end
- l.each { |p| p.read_string.empty?.should be_false }
- l.free
- end
- #
- it "should be able to convert into ruby Array from NULL pointer" do
- ary = Array.from_eina_list ::FFI::Pointer::NULL
- ary.empty?.should be_true
- ary.is_a?(Array).should be_true
- end
- #
- it "should be able to convert into ruby Array from empty EinaList" do
- ary = Array.from_eina_list EinaList.new
- ary.empty?.should be_true
- ary.is_a?(Array).should be_true
- end
- #
- it "should be able to convert into ruby Array from empty EinaList pointer" do
- ary = Array.from_eina_list EinaList.new.ptr
- ary.empty?.should be_true
- ary.is_a?(Array).should be_true
- end
- #
- it "should be able to convert into ruby Array from non empty EinaList" do
- l = EinaList.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
- ary = Array.from_eina_list l
- ary.length.should eql 4
- 0.upto 3 do |i|
- ary[i].read_string.should eql "D#{i}"
- end
- l.free
- end
- #
- it "should be able to convert into ruby Array from non empty EinaList pointer" do
- l = EinaList.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
- ary = Array.from_eina_list l.ptr
- ary.length.should eql 4
- 0.upto 3 do |i|
- ary[i].read_string.should eql "D#{i}"
- end
- l.free
- end
- #
- it "should be able to build from ruby Array" do
- a = []
- a << ::FFI::MemoryPointer.from_string("D0")
- a << ::FFI::MemoryPointer.from_string("D1")
- a << ::FFI::MemoryPointer.from_string("D2")
- a << ::FFI::MemoryPointer.from_string("D3")
- l = EinaList.new a
- 0.upto 3 do |i|
- l.nth(i).read_string.should eql "D#{i}"
- end
- l.free
- end
- #
-end