Sha256: 5238f450c920d50bb608daa6913d1a6997d1036677acdefe78330367a4017e8f

Contents?: true

Size: 1.65 KB

Versions: 24

Compression:

Stored size: 1.65 KB

Contents

require File.dirname(__FILE__) + "/../../test_helper"

unit_tests do
  test "runner adds specified number of work units to blackboard" do
    blackboard = DeepTest::SimpleTestBlackboard.new
    runner = DeepTest::Distributed::ThroughputRunner.new(
      DeepTest::Options.new({}),
      5,
      blackboard
    )

    worker = ThreadWorker.new(blackboard, 5)
    Timeout.timeout(5) do
      runner.process_work_units
    end
    worker.wait_until_done
  end

  test "runner yields all results from blackboard" do
    blackboard = DeepTest::SimpleTestBlackboard.new
    count = 0
    runner = DeepTest::Distributed::ThroughputRunner.new(
      DeepTest::Options.new({}),
      2,
      blackboard
    ) do |result|
      assert_equal :null_work_unit_result, result
      count += 1
    end

    worker = ThreadWorker.new(blackboard, 2)
    Timeout.timeout(5) do
      runner.process_work_units
    end
    worker.wait_until_done

    assert_equal 2, count
  end

  test "statistics are available after run" do
    blackboard = DeepTest::SimpleTestBlackboard.new
    runner = DeepTest::Distributed::ThroughputRunner.new(
      DeepTest::Options.new({}),
      2,
      blackboard
    )

    worker = ThreadWorker.new(blackboard, 2)
    count = 0
    Timeout.timeout(5) do
      runner.process_work_units
    end
    worker.wait_until_done

    assert_kind_of DeepTest::Distributed::ThroughputStatistics,
                   runner.statistics
  end

  test "runner returns true" do
    runner = DeepTest::Distributed::ThroughputRunner.new(
      DeepTest::Options.new({}),
      0,
      DeepTest::SimpleTestBlackboard.new 
    )

    assert_equal true, runner.process_work_units
  end
end

Version data entries

24 entries across 24 versions & 4 rubygems

Version Path
jason-o-matic-deep_test-1.2.2.1 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.10 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.11 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.12 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.13 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.14 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.2 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.3 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.4 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.5 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.6 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.7 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.8 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.9 test/deep_test/distributed/throughput_runner_test.rb
jperkins-deep_test-1.2.2 test/deep_test/distributed/throughput_runner_test.rb
jason-o-matic-deep_test-1.2.2.15 test/deep_test/distributed/throughput_runner_test.rb
jstorimer-deep-test-1.4.0 test/deep_test/distributed/throughput_runner_test.rb
jstorimer-deep-test-1.3.0 test/deep_test/distributed/throughput_runner_test.rb
jstorimer-deep-test-1.2.0 test/deep_test/distributed/throughput_runner_test.rb
jstorimer-deep-test-1.1.0 test/deep_test/distributed/throughput_runner_test.rb