summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-11 11:54:37 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-12 09:38:01 +0200
commit54d01433015c886ad188f456ed5b10b0184179ec (patch)
tree7d6d7f6cf77cee68b9c16fe9921da84e9d989c07 /test
parente0ec845f5818f006c65a639dd62b49205fd703ae (diff)
downloadedoors-ruby-54d01433015c886ad188f456ed5b10b0184179ec.zip
edoors-ruby-54d01433015c886ad188f456ed5b10b0184179ec.tar.gz
update test/test_evendoors.rb
Diffstat (limited to 'test')
-rw-r--r--test/test_evendoors.rb32
1 files changed, 15 insertions, 17 deletions
diff --git a/test/test_evendoors.rb b/test/test_evendoors.rb
index 60cd49d..21cbb9c 100644
--- a/test/test_evendoors.rb
+++ b/test/test_evendoors.rb
@@ -7,7 +7,7 @@ require 'evendoors'
class InputDoor < EvenDoors::Door
#
def start!
- puts " * start #{self.class.name} #{@path}" if EvenDoors::Spin.debug_routing
+ puts " * start #{self.class.name} #{@path}" if @spin.debug_routing
@lines = [ "#{name} says : hello", "world ( from #{path} )" ]
p = require_p EvenDoors::Particle
p.set_dst! EvenDoors::ACT_GET, path
@@ -15,11 +15,11 @@ class InputDoor < EvenDoors::Door
end
#
# def stop!
- # puts " * stop #{self.class.name} #{@path}" if EvenDoors::Spin.debug_routing
+ # puts " * stop #{self.class.name} #{@path}" if @spin.debug_routing
# end
#
def receive_p p
- puts " * #{self.class.name} receive_p : #{p.action}" if EvenDoors::Spin.debug_routing
+ puts " * #{self.class.name} receive_p : #{p.action}" if @spin.debug_routing
if p.action==EvenDoors::ACT_GET
p.reset!
p.set_data 'line', @lines.shift
@@ -43,7 +43,7 @@ end
class ConcatBoard < EvenDoors::Board
#
def receive_p p
- puts " * #{self.class.name} receive_p : #{p.action}" if EvenDoors::Spin.debug_routing
+ puts " * #{self.class.name} receive_p : #{p.action}" if @spin.debug_routing
if p.action==EvenDoors::ACT_ERROR
#
else
@@ -63,20 +63,20 @@ end
class OutputDoor < EvenDoors::Door
#
# def start!
- # puts " * start #{self.class.name} #{@path}" if EvenDoors::Spin.debug_routing
+ # puts " * start #{self.class.name} #{@path}" if @spin.debug_routing
# end
#
# def stop!
- # puts " * stop #{self.class.name} #{@path}" if EvenDoors::Spin.debug_routing
+ # puts " * stop #{self.class.name} #{@path}" if @spin.debug_routing
# end
#
def receive_p p
- if EvenDoors::Spin.debug_routing
+ if @spin.debug_routing
puts " * #{self.class.name} receive_p : #{@path} : DATA #{p.get_data('line')}"
else
puts p.get_data 'line'
end
- # we do nothing EvenDoors::Spin.process will detect it and release it
+ # we do nothing EvenDoors::Door#process_p will detect it and release it
end
#
end
@@ -84,20 +84,18 @@ end
spin = EvenDoors::Spin.new 'dom0', :debug_routing=>false, :debug_errors=>true
#
room0 = EvenDoors::Room.new 'room0', spin
-room1 = spin.add_spot EvenDoors::Room.new 'room1'
+room1 = EvenDoors::Room.new 'room1', spin
#
-input0 = room0.add_spot InputDoor.new 'input0'
-output0 = room0.add_spot OutputDoor.new 'output0'
+input0 = InputDoor.new 'input0', room0
+output0 = OutputDoor.new 'output0', room0
#
-input1 = InputDoor.new 'input1'
-output1 = OutputDoor.new 'output1'
-room1.add_spot input1
-room1.add_spot output1
-room1.add_spot ConcatBoard.new 'concat1'
+input1 = InputDoor.new 'input1', room1
+output1 = OutputDoor.new 'output1', room1
+concat1 = ConcatBoard.new 'concat1', room1
#
room0.add_link EvenDoors::Link.new('input0', 'output0', nil, nil, nil)
#
-p0 = EvenDoors::Spin.require_p EvenDoors::Particle
+p0 = spin.require_p EvenDoors::Particle
p0.set_data EvenDoors::LNK_SRC, 'input1'
p0.set_data EvenDoors::LNK_DSTS, 'concat1?follow,output1'
p0.set_data EvenDoors::LNK_FIELDS, 'f0,f2'