Skip to content

Commit

Permalink
main and sub process recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
jmettraux committed Jun 14, 2009
1 parent 276a7f5 commit 52e14ac
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
[ ] wi.params ?
[ ] wi#to_h #from_h

[ ] self rec for [main] process
[o] self rec for [main] process

[ ] fexp : clean up attributes ??

Expand Down
7 changes: 7 additions & 0 deletions lib/ruote/exp/flowexpression.rb
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,13 @@ def lookup_variable (var, prefix=nil)
#else # engine level
end

if var == (attribute('name') || attribute_text)
#
# allowing main process recursion
#
return [ @fei.expid, tree ]
end

nil
end

Expand Down
31 changes: 23 additions & 8 deletions test/functional/ft_11_recursion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
class FtRecursionTest < Test::Unit::TestCase
include FunctionalBase

def test_main_recursion

flunk
end

class CountingParticipant
include Ruote::EngineContext
include Ruote::LocalParticipant
Expand Down Expand Up @@ -47,6 +42,26 @@ def cancel (fei)
end
end

def test_main_recursion

pdef = Ruote.process_definition :name => 'def0' do
sequence do
alpha
def0
end
end

alpha = @engine.register_participant :alpha, CountingParticipant

#noisy

assert_trace(pdef, %w[ 1 2 3 4 5 6 ])

alpha.wfids[1..-1].each_with_index { |wfid, i|
assert_match /.*\_#{i}$/, wfid
}
end

def test_sub_recursion

pdef = Ruote.process_definition do
Expand All @@ -59,15 +74,15 @@ def test_sub_recursion
sub0
end

wfids = []

alpha = @engine.register_participant :alpha, CountingParticipant

#noisy

assert_trace(pdef, %w[ 1 2 3 4 5 6 ], :ignore_remaining_expressions => true)

alpha.wfids.each_with_index { |wfid, i| assert_match /.*\_#{i}$/, wfid }
alpha.wfids.each_with_index { |wfid, i|
assert_match /.*\_#{i}$/, wfid
}
end
end

0 comments on commit 52e14ac

Please sign in to comment.