Sha256: 7cfafe5b3c67fa4dbe6a4b6b1e03269dde03b65dfdda74389cb6a3bd3a72e246

Contents?: true

Size: 1.74 KB

Versions: 2

Compression:

Stored size: 1.74 KB

Contents

#
# Testing OpenWFEru
#
# John Mettraux at openwfe.org
#

require 'flowtestbase'
require 'openwfe/def'

include OpenWFE



class FlowTest39 < Test::Unit::TestCase
    include FlowTestBase

    #def setup
    #end

    #def teardown
    #end


    #
    # Test 0
    #

    class TestReserve39a0 < ProcessDefinition
        reserve :mutex => :toto do
            _print "ok"
        end
    end

    def test_0
        dotest(TestReserve39a0, "ok", true)
    end


    #
    # Test 1
    #

    class TestReserve39a1 < ProcessDefinition
        sequence do
            reserve :mutex => :toto do
                _print "${r:'${toto}' != ''}"
            end
            _print "${r:'${toto}' == ''}"
            _print "over."
        end
    end

    def test_1
        dotest(TestReserve39a1, "true\ntrue\nover.", true)
    end


    #
    # Test 2
    #

    class TestReserve39a2 < ProcessDefinition
        #
        # doesn't prove it enough though...
        #
        concurrence do
            reserve :mutex => :toto do
                sequence do
                    test_alpha
                    test_bravo
                end
            end
            reserve :mutex => :toto do
                sequence do
                    test_charly
                    test_delta
                end
            end
        end
    end

    def test_2

        dotest(
            TestReserve39a2, 
            [
"""
test-charly
test-delta
test-alpha
test-bravo
""".strip, 
"""
test-alpha
test-bravo
test-charly
test-delta
""".strip, 
            ],
            true)
    end


    #
    # Test 3
    #

    class TestReserve39a3 < ProcessDefinition
        reserve :mutex => :toto do
        end
    end

    def test_3
        dotest(TestReserve39a3, "", true)
    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
openwferu-0.9.8 test/ft_39_reserve.rb
openwferu-0.9.9 test/ft_39_reserve.rb