summaryrefslogtreecommitdiffstats
path: root/spec/eina_hash_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/eina_hash_spec.rb')
-rw-r--r--spec/eina_hash_spec.rb93
1 files changed, 47 insertions, 46 deletions
diff --git a/spec/eina_hash_spec.rb b/spec/eina_hash_spec.rb
index 8473fd7..0376b08 100644
--- a/spec/eina_hash_spec.rb
+++ b/spec/eina_hash_spec.rb
@@ -1,20 +1,21 @@
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
+require 'efl'
require 'efl/eina_hash'
#
describe Efl::EinaHash do
#
before(:all) {
REinaHash = Efl::EinaHash::REinaHash
- Efl::Eina.init.should eql 1
+ Efl::Eina.init.should == 1
@d0 = FFI::MemoryPointer.from_string "D0"
@d1 = FFI::MemoryPointer.from_string "D1"
@d2 = FFI::MemoryPointer.from_string "D2"
@d3 = FFI::MemoryPointer.from_string "D3"
}
after(:all) {
- Efl::Eina.shutdown.should eql 0
+ Efl::Eina.shutdown.should == 0
}
#
it "should append prepend and fetch" do
@@ -23,16 +24,16 @@ describe Efl::EinaHash do
h.add 'k1', @d1
h['k3']=@d3
h['k0']=@d0
- h['k0'].read_string.should eql "D0"
- h['k1'].read_string.should eql "D1"
- h['k2'].read_string.should eql "D2"
- h['k3'].read_string.should eql "D3"
+ h['k0'].read_string.should == "D0"
+ h['k1'].read_string.should == "D1"
+ h['k2'].read_string.should == "D2"
+ h['k3'].read_string.should == "D3"
cpt=0
h.each { |k,v|
cpt+=1
v.read_string.empty?.should be_false
}
- cpt.should eql 4
+ cpt.should == 4
end
#
it "should be able to convert into ruby Hash from NULL pointer" do
@@ -63,28 +64,28 @@ describe Efl::EinaHash do
h.add 'k1', d1
h['k3']=d3
h["k0"]=d0
- h["k0"].read_string.should eql "D0"
- h['k1'].read_string.should eql "D1"
- h['k2'].read_string.should eql "D2"
- h['k3'].read_string.should eql "D3"
+ h["k0"].read_string.should == "D0"
+ h['k1'].read_string.should == "D1"
+ h['k2'].read_string.should == "D2"
+ h['k3'].read_string.should == "D3"
cpt=0
h.each { |k,v|
cpt+=1
v.read_string.empty?.should be_false
true
}
- cpt.should eql 4
+ cpt.should == 4
rh = Hash.from_eina_hash h
- rh.length.should eql 4
+ rh.length.should == 4
rh2 = {}
rh.each { |k,v|
rh2[k.read_string]=v.read_string
true
}
- rh2['k0'].should eql 'D0'
- rh2['k1'].should eql 'D1'
- rh2['k2'].should eql 'D2'
- rh2['k3'].should eql 'D3'
+ rh2['k0'].should == 'D0'
+ rh2['k1'].should == 'D1'
+ rh2['k2'].should == 'D2'
+ rh2['k3'].should == 'D3'
end
#
it "should be able to convert into ruby Hash from non empty REinaHash pointer" do
@@ -97,12 +98,12 @@ describe Efl::EinaHash do
h.add 'k1', d1
h['k3']=d3
h['k0']=d0
- h['k0'].read_string.should eql "D0"
- h['k1'].read_string.should eql "D1"
- h['k2'].read_string.should eql "D2"
- h['k3'].read_string.should eql "D3"
+ h['k0'].read_string.should == "D0"
+ h['k1'].read_string.should == "D1"
+ h['k2'].read_string.should == "D2"
+ h['k3'].read_string.should == "D3"
rh = Hash.from_eina_hash h.to_ptr
- rh.length.should eql 4
+ rh.length.should == 4
end
#
it "should be able to convert into ruby Hash from non empty REinaHash pointer, with key from string" do
@@ -115,16 +116,16 @@ describe Efl::EinaHash do
h.add 'k1', d1
h['k3']=d3
h['k0']=d0
- h['k0'].read_string.should eql "D0"
- h['k1'].read_string.should eql "D1"
- h['k2'].read_string.should eql "D2"
- h['k3'].read_string.should eql "D3"
+ h['k0'].read_string.should == "D0"
+ h['k1'].read_string.should == "D1"
+ h['k2'].read_string.should == "D2"
+ h['k3'].read_string.should == "D3"
rh = h.to_h_conv
- rh.length.should eql 4
- rh['k0'].read_string.should eql "D0"
- rh['k1'].read_string.should eql "D1"
- rh['k2'].read_string.should eql "D2"
- rh['k3'].read_string.should eql "D3"
+ rh.length.should == 4
+ rh['k0'].read_string.should == "D0"
+ rh['k1'].read_string.should == "D1"
+ rh['k2'].read_string.should == "D2"
+ rh['k3'].read_string.should == "D3"
end
#
it "should be able to convert into ruby Hash from non empty REinaHash pointer, with key from string block" do
@@ -137,18 +138,18 @@ describe Efl::EinaHash do
h.add 'k1', d1
h['k3']=d3
h['k0']=d0
- h['k0'].read_string.should eql "D0"
- h['k1'].read_string.should eql "D1"
- h['k2'].read_string.should eql "D2"
- h['k3'].read_string.should eql "D3"
+ h['k0'].read_string.should == "D0"
+ h['k1'].read_string.should == "D1"
+ h['k2'].read_string.should == "D2"
+ h['k3'].read_string.should == "D3"
cpt=0
rh = h.to_h_conv { |k| cpt+=1; k.read_string }
- cpt.should eql 4
- rh.length.should eql 4
- rh['k0'].read_string.should eql "D0"
- rh['k1'].read_string.should eql "D1"
- rh['k2'].read_string.should eql "D2"
- rh['k3'].read_string.should eql "D3"
+ cpt.should == 4
+ rh.length.should == 4
+ rh['k0'].read_string.should == "D0"
+ rh['k1'].read_string.should == "D1"
+ rh['k2'].read_string.should == "D2"
+ rh['k3'].read_string.should == "D3"
end
#
it "should be able to build from ruby Hash" do
@@ -166,15 +167,15 @@ describe Efl::EinaHash do
rh[k2]=d2
rh[k3]=d3
h = REinaHash.new rh
- h[k0].read_string.should eql "D0"
- h[k1].read_string.should eql "D1"
- h[k2].read_string.should eql "D2"
- h[k3].read_string.should eql "D3"
+ h[k0].read_string.should == "D0"
+ h[k1].read_string.should == "D1"
+ h[k2].read_string.should == "D2"
+ h[k3].read_string.should == "D3"
end
#
it "alternate constructor should work" do
cstr_cnt = 0
h = REinaHash.new { cstr_cnt+=1; Efl::EinaHash.eina_hash_string_superfast_new FFI::Pointer::NULL }
- cstr_cnt.should eql 1
+ cstr_cnt.should == 1
end
end