summaryrefslogtreecommitdiffstats
path: root/spec/spin_spec.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-06-10 11:11:28 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-06-10 11:11:28 +0200
commit6553912a6dff9b2c8bd3f06cb5f10488eef2c18c (patch)
tree804cbb720c993afd5453ea4a8086b264e22382fe /spec/spin_spec.rb
parent74d45762846ea7e6ac09f65fb31672b822f7a349 (diff)
downloadedoors-ruby-6553912a6dff9b2c8bd3f06cb5f10488eef2c18c.zip
edoors-ruby-6553912a6dff9b2c8bd3f06cb5f10488eef2c18c.tar.gz
project iotas->edoors-ruby, module Iotas->Edoors
Diffstat (limited to 'spec/spin_spec.rb')
-rw-r--r--spec/spin_spec.rb86
1 files changed, 43 insertions, 43 deletions
diff --git a/spec/spin_spec.rb b/spec/spin_spec.rb
index 69266e5..93ddf27 100644
--- a/spec/spin_spec.rb
+++ b/spec/spin_spec.rb
@@ -4,24 +4,24 @@
require 'spec_helper'
#
-describe Iotas::Spin do
+describe Edoors::Spin do
#
- class MyP < Iotas::Particle; end
+ class MyP < Edoors::Particle; end
#
it "Particles pool" do
- spin = Iotas::Spin.new 'dom0'
- p0 = spin.require_p Iotas::Particle
- p1 = spin.require_p Iotas::Particle
+ spin = Edoors::Spin.new 'dom0'
+ p0 = spin.require_p Edoors::Particle
+ p1 = spin.require_p Edoors::Particle
(p0===p1).should be_false
spin.release_p p0
- p2 = spin.require_p Iotas::Particle
+ p2 = spin.require_p Edoors::Particle
(p0===p2).should be_true
end
#
it "different Particles classes in pool" do
- spin = Iotas::Spin.new 'dom0'
- p0 = spin.require_p Iotas::Particle
- p1 = spin.require_p Iotas::Particle
+ spin = Edoors::Spin.new 'dom0'
+ p0 = spin.require_p Edoors::Particle
+ p1 = spin.require_p Edoors::Particle
(p0===p1).should be_false
spin.release_p p0
p2 = spin.require_p MyP
@@ -33,36 +33,36 @@ describe Iotas::Spin do
end
#
it "release of merged particles" do
- spin = Iotas::Spin.new 'dom0'
- p0 = spin.require_p Iotas::Particle
- p1 = spin.require_p Iotas::Particle
+ spin = Edoors::Spin.new 'dom0'
+ p0 = spin.require_p Edoors::Particle
+ p1 = spin.require_p Edoors::Particle
(p0===p1).should be_false
p0.merge! p1
spin.release_p p0
- p2 = spin.require_p Iotas::Particle
+ p2 = spin.require_p Edoors::Particle
(p2===p0).should be_true
- p3 = spin.require_p Iotas::Particle
+ p3 = spin.require_p Edoors::Particle
(p3===p1).should be_true
end
#
it "clear!" do
- spin = Iotas::Spin.new 'dom0'
- p0 = spin.require_p Iotas::Particle
- p1 = spin.require_p Iotas::Particle
+ spin = Edoors::Spin.new 'dom0'
+ p0 = spin.require_p Edoors::Particle
+ p1 = spin.require_p Edoors::Particle
spin.send_p p0
spin.release_p p1
spin.clear!
- p2 = spin.require_p Iotas::Particle
+ p2 = spin.require_p Edoors::Particle
(p2==p0).should be_false
(p2==p1).should be_false
end
#
it "post_p post_sys_p spin!" do
- spin = Iotas::Spin.new 'dom0'
+ spin = Edoors::Spin.new 'dom0'
f = Fake.new 'fake', spin
- p0 = spin.require_p Iotas::Particle
+ p0 = spin.require_p Edoors::Particle
p0.dst_routed! f
- p1 = spin.require_p Iotas::Particle
+ p1 = spin.require_p Edoors::Particle
p1.dst_routed! f
spin.post_p p0
spin.post_sys_p p1
@@ -74,52 +74,52 @@ describe Iotas::Spin do
end
#
it "process_sys" do
- spin = Iotas::Spin.new 'dom0'
- p0 = spin.require_p Iotas::Particle
+ spin = Edoors::Spin.new 'dom0'
+ p0 = spin.require_p Edoors::Particle
p0.add_dst 'unknown'
spin.send_sys_p p0
spin.spin!
- p1 = spin.require_p Iotas::Particle
+ p1 = spin.require_p Edoors::Particle
p0.should be p0
end
#
it "option debug" do
- spin = Iotas::Spin.new 'dom0'
+ spin = Edoors::Spin.new 'dom0'
spin.debug_routing.should be false
spin.debug_errors.should be false
- spin = Iotas::Spin.new 'dom0', :debug_routing=>true, :debug_errors=>true
+ spin = Edoors::Spin.new 'dom0', :debug_routing=>true, :debug_errors=>true
spin.debug_routing.should be true
spin.debug_errors.should be true
end
#
it "spin->json->spin" do
- spin = Iotas::Spin.new 'dom0', :debug_routing=>true
- r0 = Iotas::Room.new 'r0', spin
- r1 = Iotas::Room.new 'r1', r0
- r2 = Iotas::Room.new 'r2', r1
- r3 = Iotas::Room.new 'r3', r1
- r4 = Iotas::Room.new 'r4', r3
- d0 = Iotas::Door.new 'd0', r1
- d1 = Iotas::Door.new 'd1', r1
- d2 = Iotas::Door.new 'd2', r2
- p0 = spin.require_p Iotas::Particle
- p1 = spin.require_p Iotas::Particle
- p2 = spin.require_p Iotas::Particle
+ spin = Edoors::Spin.new 'dom0', :debug_routing=>true
+ r0 = Edoors::Room.new 'r0', spin
+ r1 = Edoors::Room.new 'r1', r0
+ r2 = Edoors::Room.new 'r2', r1
+ r3 = Edoors::Room.new 'r3', r1
+ r4 = Edoors::Room.new 'r4', r3
+ d0 = Edoors::Door.new 'd0', r1
+ d1 = Edoors::Door.new 'd1', r1
+ d2 = Edoors::Door.new 'd2', r2
+ p0 = spin.require_p Edoors::Particle
+ p1 = spin.require_p Edoors::Particle
+ p2 = spin.require_p Edoors::Particle
spin.post_p p0
spin.post_p p1
spin.post_sys_p p2
json = JSON.generate spin
- dom0 = Iotas::Spin.json_create( JSON.load( json ) )
+ dom0 = Edoors::Spin.json_create( JSON.load( json ) )
json.should eql JSON.generate(dom0)
end
#
it "hibernate! resume!" do
- spin = Iotas::Spin.new 'dom0'
- p0 = spin.require_p Iotas::Particle
- p0.add_dst Iotas::SYS_ACT_HIBERNATE
+ spin = Edoors::Spin.new 'dom0'
+ p0 = spin.require_p Edoors::Particle
+ p0.add_dst Edoors::SYS_ACT_HIBERNATE
spin.send_sys_p p0
spin.spin!
- dom0 = Iotas::Spin.resume! spin.hibernate_path
+ dom0 = Edoors::Spin.resume! spin.hibernate_path
dom0.name.should eql spin.name
File.unlink dom0.hibernate_path
end