test/raw_prog_test.rb in openwferu-0.9.5 vs test/raw_prog_test.rb in openwferu-0.9.6

- old
+ new

@@ -182,10 +182,11 @@ assert \ TestDefinition3.do_make.to_code_s == CODE_DEF3, "to_code_s() not working properly (3)" end + # # TEST 4 # class TestDefinition4 < OpenWFE::ProcessDefinition @@ -215,9 +216,213 @@ #puts TestDefinition4.do_make.to_code_s assert \ TestDefinition4.do_make.to_code_s == CODE_DEF4, "to_code_s() not working properly (4)" + end + + + # + # TEST 4b + # + + class TestDefinition4b < OpenWFE::ProcessDefinition + def make + sequence do + [ :b, :b, :b ].each do |p| + participant p + end + end + end + end + + CODE_DEF4b = """ +process_definition :name => 'TestDefinition4b', :revision => '0' do + sequence do + participant do + 'b' + end + participant do + 'b' + end + participant do + 'b' + end + end +end""".strip + + def test_prog_4b + + #puts + #puts TestDefinition4.do_make.to_s + #puts + #puts TestDefinition4b.do_make.to_code_s + + assert \ + TestDefinition4b.do_make.to_code_s == CODE_DEF4b, + "to_code_s() not working properly (4b)" + end + + + # + # TEST 5 + # + + class TestDefinition5 < OpenWFE::ProcessDefinition + def make + sequence do + participant :ref => :toto + sub0 + end + process_definition :name => "sub0" do + nada + end + end + end + + CODE_DEF5 = """ +process_definition :name => 'Test', :revision => '5' do + sequence do + participant :ref => 'toto' + sub0 + end + process_definition :name => 'sub0' do + nada + end +end""".strip + + def test_prog_5 + + #puts + #puts TestDefinition5.do_make.to_s + #puts + #puts TestDefinition5.do_make.to_code_s + + assert \ + TestDefinition5.do_make.to_code_s == CODE_DEF5, + "to_code_s() not working properly (5)" + end + + + # + # TEST 6 + # + + class TestDefinition60 < OpenWFE::ProcessDefinition + def make + sequence do + participant :ref => :toto + nada + end + end + end + + CODE_DEF6 = """ +process_definition :name => 'Test', :revision => '60' do + sequence do + participant :ref => 'toto' + nada + end +end""".strip + + def test_prog_6 + + #puts + #puts TestDefinition60.do_make.to_s + #puts + #puts TestDefinition60.do_make.to_code_s + + assert \ + TestDefinition60.do_make.to_code_s == CODE_DEF6, + "to_code_s() not working properly (6)" + end + + + # + # TEST 7 + # + + class TestDefinitionSeven < OpenWFE::ProcessDefinition + def make + participant :ref => :toto + end + end + + CODE_DEF7 = """ +process_definition :name => 'TestDefinitionSeven', :revision => '0' do + participant :ref => 'toto' +end""".strip + + def test_prog_7 + + #puts + #puts TestDefinition7.do_make.to_s + #puts + #puts TestDefinition7.do_make.to_code_s + + assert \ + TestDefinitionSeven.do_make.to_code_s == CODE_DEF7, + "to_code_s() not working properly (7)" + end + + # + # TEST 8 + # + + def do_test(class_name, pdef) + result = eval """ + class #{class_name} < OpenWFE::ProcessDefinition + def make + participant 'nada' + end + end + #{class_name}.do_make + """ + assert_equal result.attributes['name'], pdef[0] + assert_equal result.attributes['revision'], pdef[1] + end + + def test_process_names + do_test("MyProcessDefinition_10", ["MyProcess", "10"]) + do_test("MyProcessDefinition10", ["MyProcess", "10"]) + do_test("MyProcessDefinition1_0", ["MyProcess", "1.0"]) + do_test("MyProcessThing_1_0", ["MyProcessThing", "1.0"]) + end + + + # + # TEST 9 + # + + class TestDefinition9 < OpenWFE::ProcessDefinition + def make + description "this is my process" + sequence do + participant :ref => :toto + end + end + end + + CODE_DEF9 = """ +process_definition :name => 'Test', :revision => '60' do + description 'this is my process' + sequence do + participant :ref => 'toto' + nada + end +end""".strip + + def xxxx_prog_9 + #def test_prog_9 + + #puts + #puts TestDefinition60.do_make.to_s + puts + puts TestDefinition9.do_make.to_code_s + + assert \ + TestDefinition9.do_make.to_code_s == CODE_DEF9, + "to_code_s() not working properly (9)" end end