Sha256: 364a6eb57822678f28805600d214a200b430d8394b8f36a172ea2fbddcebb536
Contents?: true
Size: 1018 Bytes
Versions: 24
Compression:
Stored size: 1018 Bytes
Contents
module DeepTest class SimpleTestBlackboard attr_accessor :debug, :simulate_result_overdue_error def initialize @work_units = [] @test_results = [] @semaphore = Mutex.new end def take_result raise DeepTest::Server::ResultOverdueError if @simulate_result_overdue_error @semaphore.synchronize do log_and_return "take_result", @test_results.shift end end def take_work @semaphore.synchronize do log_and_return "take_work", @work_units.shift end end def write_result(result) @semaphore.synchronize do log_and_return "write_result", result @test_results.push result end end def write_work(work_unit) @semaphore.synchronize do log_and_return "write_work", work_unit @work_units.push work_unit end end def log_and_return(message, object) if debug && object puts "* #{message} #{object.inspect}" end object end end end
Version data entries
24 entries across 24 versions & 4 rubygems