summaryrefslogtreecommitdiffstats
path: root/spec/spin_spec.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-10 09:31:26 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-10 09:31:26 +0200
commit6886fa096d832b0682eafe631922694653384994 (patch)
treeb224ac22372483404305eecbe99528ae2b1b94cf /spec/spin_spec.rb
parent274411458b30ba08a9e0adca0a0f5820e9a8648f (diff)
downloadedoors-ruby-6886fa096d832b0682eafe631922694653384994.zip
edoors-ruby-6886fa096d832b0682eafe631922694653384994.tar.gz
split specs
Diffstat (limited to 'spec/spin_spec.rb')
-rw-r--r--spec/spin_spec.rb77
1 files changed, 77 insertions, 0 deletions
diff --git a/spec/spin_spec.rb b/spec/spin_spec.rb
new file mode 100644
index 0000000..6fd8ccd
--- /dev/null
+++ b/spec/spin_spec.rb
@@ -0,0 +1,77 @@
+#! /usr/bin/env ruby
+# -*- coding: UTF-8 -*-
+#
+
+require 'spec_helper'
+#
+describe EvenDoors::Spin do
+ #
+ class MyP < EvenDoors::Particle; end
+ #
+ it "Particles pool" do
+ p0 = EvenDoors::Spin.require_p EvenDoors::Particle
+ p1 = EvenDoors::Spin.require_p EvenDoors::Particle
+ (p0===p1).should be_false
+ EvenDoors::Spin.release_p p0
+ p2 = EvenDoors::Spin.require_p EvenDoors::Particle
+ (p0===p2).should be_true
+ end
+ #
+ it "different Particles classes in pool" do
+ p0 = EvenDoors::Spin.require_p EvenDoors::Particle
+ p1 = EvenDoors::Spin.require_p EvenDoors::Particle
+ (p0===p1).should be_false
+ EvenDoors::Spin.release_p p0
+ p2 = EvenDoors::Spin.require_p MyP
+ p3 = EvenDoors::Spin.require_p MyP
+ (p2===p3).should be_false
+ EvenDoors::Spin.release_p p2
+ p4 = EvenDoors::Spin.require_p MyP
+ (p2===p4).should be_true
+ end
+ #
+ it "release of merged particles" do
+ p0 = EvenDoors::Spin.require_p EvenDoors::Particle
+ p1 = EvenDoors::Spin.require_p EvenDoors::Particle
+ (p0===p1).should be_false
+ p0.merge! p1
+ EvenDoors::Spin.release_p p0
+ p2 = EvenDoors::Spin.require_p EvenDoors::Particle
+ (p2===p0).should be_true
+ p3 = EvenDoors::Spin.require_p EvenDoors::Particle
+ (p3===p1).should be_true
+ end
+ #
+ it "send_p send_sys_p spin!" do
+ f = Fake.new
+ p0 = EvenDoors::Spin.require_p EvenDoors::Particle
+ p0.dst_routed! f
+ p1 = EvenDoors::Spin.require_p EvenDoors::Particle
+ p1.dst_routed! f
+ EvenDoors::Spin.send_p p0
+ EvenDoors::Spin.send_sys_p p1
+ EvenDoors::Spin.run = true
+ EvenDoors::Spin.spin!
+ f.p.should be p0
+ f.sp.should be p1
+ end
+ #
+ it "options" do
+ EvenDoors::Spin.debug_routing.should be false
+ spin = EvenDoors::Spin.new 'dom0', :debug_routing=>true
+ EvenDoors::Spin.debug_routing.should be true
+ spin.spin!
+ EvenDoors::Spin.debug_routing = false
+ EvenDoors::Spin.debug_routing.should be false
+ #
+ EvenDoors::Spin.debug_errors.should be false
+ spin = EvenDoors::Spin.new 'dom0', :debug_errors=>true
+ EvenDoors::Spin.debug_errors.should be true
+ spin.spin!
+ EvenDoors::Spin.debug_errors = false
+ EvenDoors::Spin.debug_errors.should be false
+ end
+ #
+end
+#
+#EOF