Sha256: fbe243ad1e9b6b65e6f8272c329d8487c9991a7c7ef5db2266430ad3ef114d87

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

$LOAD_PATH.unshift File.expand_path('../..', File.dirname(__FILE__))

require 'roby/test/common'
require 'roby/test/tasks/simple_task'
require 'roby/relations/conflicts'
require 'flexmock'

class TC_Conflicts < Test::Unit::TestCase
    include Roby::Test

    def test_model_relations
	m1, m2 = (1..2).map do
	    Class.new(SimpleTask)
	end

	m1.conflicts_with m2
	assert(!m1.conflicts_with?(m1))
	assert(m1.conflicts_with?(m2))
	assert(m2.conflicts_with?(m1))

	# Create two tasks ...
	plan.discover(t1 = m1.new)
	plan.discover(t2 = m2.new)
	assert !t1.child_object?(t2, Roby::TaskStructure::Conflicts)
	assert !t2.child_object?(t1, Roby::TaskStructure::Conflicts)

	# Start t1 ...
	t1.start!
	assert !t1.child_object?(t2, Roby::TaskStructure::Conflicts)
	assert t2.child_object?(t1, Roby::TaskStructure::Conflicts)

	# And now, start the conflicting task. The default decision control
	# should postpone start until t1 is stopped
	t2.start!
	assert(!t2.running?)
	assert t1.event(:stop).child_object?(t2.event(:start), Roby::EventStructure::Signal)
	t1.stop!
	assert(!t1.running?)
	assert(t2.running?)
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roby-0.7.2 test/relations/test_conflicts.rb
roby-0.7.1 test/relations/test_conflicts.rb
roby-0.7 test/relations/test_conflicts.rb
roby-0.7.3 test/relations/test_conflicts.rb