test/ft_7_lose.rb in openwferu-0.9.4 vs test/ft_7_lose.rb in openwferu-0.9.5
- old
+ new
@@ -5,25 +5,27 @@
# John Mettraux at openwfe.org
#
# Mon Dec 25 14:27:48 JST 2006
#
+require 'openwfe/def'
require 'flowtestbase'
-class FlowTest7 < FlowTestBase
+class FlowTest7 < Test::Unit::TestCase
+ include FlowTestBase
#def setup
#end
#def teardown
#end
- def test_lose_0
#def xxxx_lose_0
- dotest(\
-'<process-definition name="'+test_name+'''" revision="0">
+ def test_lose_0
+ dotest(
+'<process-definition name="'+name_of_test+'''" revision="0">
<sequence>
<concurrence count="1">
<lose>
<sequence>
@@ -44,13 +46,11 @@
<print>ok 1</print>
<set variable="v0" value="true" />
</sequence>
</lose>
<sequence>
- <sleep for="252" />
- <!-- 250 or less is bad : the default scheduler precision
- is 1/4 of second -->
+ <sleep for="50" />
<print>ok 2</print>
</sequence>
</concurrence>
<print>v0 : ${v0}</print>
@@ -63,11 +63,11 @@
<concurrence count="1">
<lose>
<sequence>
<!--<sleep for="252" />-->
- <sleep for="350" />
+ <sleep for="400" />
<!-- more than the 250 ms precision -->
<print>ok 4</print>
<set variable="v1" value="true" />
</sequence>
</lose>
@@ -84,28 +84,28 @@
<print>done.</print>
</sequence>
</process-definition>''',
-"""ok 0
+ """ok 0
- - -
ok 1
ok 2
v0 : true
ok 3
- - -
ok 5
v1 :
done.""",
-3,
-true)
+ 1.1,
+ true)
end
- def test_lose_1
#def xxxx_lose_1
- dotest(\
-'<process-definition name="'+test_name+'''" revision="0">
+ def test_lose_1
+ dotest(
+'<process-definition name="'+name_of_test+'''" revision="0">
<sequence>
<concurrence
count="1"
>
<lose>
@@ -117,13 +117,49 @@
<print>b</print>
</concurrence>
<print>c</print>
</sequence>
</process-definition>''',
-"""b
+ """b
c""",
-0.1,
-true)
+ 0.1,
+ true)
+ end
+
+
+ #
+ # TEST 2
+
+ class TestDefinition2 < ProcessDefinition
+ def make
+ process_definition :name => "7_lose", :revision => "2" do
+ sequence do
+ _print "before"
+ concurrence :count => 1 do
+ lose do
+ sequence do
+ _sleep :for => 350
+ _print "ok 4"
+ end
+ end
+ sequence do
+ _print "ok 5"
+ end
+ end
+ _print "after"
+ end
+ end
+ end
+ end
+
+ #def xxxx_lose_2
+ def test_lose_2
+ dotest(
+ TestDefinition2,
+ """before
+ok 5
+after""",
+ 0.1)
end
end