Class: CI::Queue::Bisect
- Inherits:
-
Object
- Object
- CI::Queue::Bisect
- Defined in:
- lib/ci/queue/bisect.rb
Instance Method Summary collapse
- #candidates ⇒ Object
- #failed! ⇒ Object
- #failing_test ⇒ Object
-
#initialize(path, config) ⇒ Bisect
constructor
A new instance of Bisect.
- #populate(all_tests, random: nil) ⇒ Object
- #size ⇒ Object
- #succeeded! ⇒ Object
- #suspects_left ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(path, config) ⇒ Bisect
Returns a new instance of Bisect.
4 5 6 7 |
# File 'lib/ci/queue/bisect.rb', line 4 def initialize(path, config) @tests = ::File.readlines(path).map(&:strip).reject(&:empty?).take_while { |t| t != config.failing_test } @config = config end |
Instance Method Details
#candidates ⇒ Object
29 30 31 |
# File 'lib/ci/queue/bisect.rb', line 29 def candidates Static.new(first_half + [config.failing_test], config).populate(@all_tests) end |
#failed! ⇒ Object
33 34 35 |
# File 'lib/ci/queue/bisect.rb', line 33 def failed! @tests = first_half end |
#failing_test ⇒ Object
25 26 27 |
# File 'lib/ci/queue/bisect.rb', line 25 def failing_test Static.new([config.failing_test], config).populate(@all_tests) end |
#populate(all_tests, random: nil) ⇒ Object
13 14 15 |
# File 'lib/ci/queue/bisect.rb', line 13 def populate(all_tests, random: nil) @all_tests = all_tests end |
#size ⇒ Object
9 10 11 |
# File 'lib/ci/queue/bisect.rb', line 9 def size @tests.size end |
#succeeded! ⇒ Object
37 38 39 |
# File 'lib/ci/queue/bisect.rb', line 37 def succeeded! @tests = second_half end |
#suspects_left ⇒ Object
21 22 23 |
# File 'lib/ci/queue/bisect.rb', line 21 def suspects_left @tests.size end |
#to_a ⇒ Object
17 18 19 |
# File 'lib/ci/queue/bisect.rb', line 17 def to_a @tests + [config.failing_test] end |