diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-06-28 12:19:31 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-06-28 12:19:31 +0200 |
commit | 2ad62fbf4cbe4d7173559a3d559c1923d54405ea (patch) | |
tree | 23bdac06e9dbbac123b9d962aab67978149dd8a0 /spec | |
parent | 30410001827906e4420fb14eca0bcdb61722396e (diff) | |
download | edoors-ruby-2ad62fbf4cbe4d7173559a3d559c1923d54405ea.zip edoors-ruby-2ad62fbf4cbe4d7173559a3d559c1923d54405ea.tar.gz |
specs: cover Board#keep! and Board#flush!
Diffstat (limited to 'spec')
-rw-r--r-- | spec/board_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/board_spec.rb b/spec/board_spec.rb index 7bed245..554ede0 100644 --- a/spec/board_spec.rb +++ b/spec/board_spec.rb @@ -81,6 +81,30 @@ describe Edoors::Board do b0.pass_through.should be true end # + it "keep! and flush!" do + b0 = Edoors::Board.new 'hell', @spin + def b0.receive_p p + keep! p + end + def b0.get k + @postponed[k] + end + p0 = Edoors::Particle.new + b0.process_p p0 + p1 = Edoors::Particle.new + p1.set_dst! Edoors::ACT_FOLLOW, b0 + b0.process_p p1 + p2 = Edoors::Particle.new + p2.set_dst! Edoors::ACT_FOLLOW, b0 + b0.process_p p2 + p3 = Edoors::Particle.new + p3.set_dst! Edoors::ACT_FOLLOW, b0 + b0.process_p p3 + (b0.get({}).merged_length+1).should == 4 + b0.flush! + b0.get({}).should be_nil + end + # it "board->json->board" do board = Edoors::Board.new 'hell', @spin p0 = Edoors::Particle.new |