Class: See5::GritbotOutputParser

Inherits:
Object
  • Object
show all
Defined in:
lib/see5/gritbot_output_parser.rb

Overview

Read Gritbot output and return an array of hashes representing the anomalies

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fname) ⇒ GritbotOutputParser

Returns a new instance of GritbotOutputParser.



12
13
14
15
16
17
# File 'lib/see5/gritbot_output_parser.rb', line 12

def initialize(fname)
  @file = File.open(fname)
  @anomalies = []

  parse_file
end

Instance Attribute Details

#anomaliesObject (readonly)

Returns the value of attribute anomalies.



6
7
8
# File 'lib/see5/gritbot_output_parser.rb', line 6

def anomalies
  @anomalies
end

Class Method Details

.parse_file(fname) ⇒ Object



8
9
10
# File 'lib/see5/gritbot_output_parser.rb', line 8

def self.parse_file(fname)
  new(fname).anomalies
end

Instance Method Details

#parse_fileObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/see5/gritbot_output_parser.rb', line 19

def parse_file
  discard_header

  while (line = lines.next)
    if line.start_with?(/\s*while checking/)
      # TODO record excluded cases
    elsif line.start_with?(/(:?test |data )?case /)
      @anomalies << parse_anomaly(line)
    elsif line.start_with?("Time:")
      break
    end
  end
end