Skip to content

Commit

Permalink
added to piecharts, if you want to see blocks that had no errors but …
Browse files Browse the repository at this point in the history
…failed on plato check
  • Loading branch information
mcueno2 committed Sep 30, 2012
1 parent 206dd65 commit c5a3719
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 13 deletions.
4 changes: 3 additions & 1 deletion examiner/lib/data_acquisition/piecharts/piecharts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require( "./app_database")

LIMIT =40 # Modify this to set how many values are listed in under sexp, function and keyword lists
ERRORS = true # suppress errors
ERRORS = false # suppress errors

#=========================================================== MAIN METHOD ======================================#
puts "type help for commands, 'q' to quit"
Expand Down Expand Up @@ -52,6 +52,7 @@
data.crunch

#============================ Interactive portion of program =========================
print "enter command: "
line = gets.chomp.split(" ")
menu = line[0]
while !(menu == "q" || menu == "quit" || menu == "exit")
Expand Down Expand Up @@ -104,6 +105,7 @@
when 'blocks-success' then data.output_successful_blocks
when 'blocks-semantic' then data.output_semantic
when 'priority' then data.output_priority
when 'plato' then data.output_plato_only

end
print "enter command: "
Expand Down
18 changes: 15 additions & 3 deletions examiner/lib/data_acquisition/piecharts/stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def parse_rsbc(line)
type = array.delete_at(0)
value = array.join(" ")
validation.add_error(type.to_sym, value, @block-1)
elsif array[1] == "SUCCESS" then validation.success = true;
elsif array[1] == "SUCCESS" then validation.plato_success = true;
elsif array[1] == "BLOCK" then @block = array[2].to_i;
elsif array[1] == "NUM_BLOCKS" then validation.init_blocks(array[2].to_i);
elsif array[1] == "BLOCK_SEMANTICS" then validation.add_unknown_semantic(@block);
Expand Down Expand Up @@ -160,7 +160,7 @@ def crunch
unless validation.get_keyword.empty?
@keyword = @keyword + 1
validation.get_keyword.each do |sexp|
if @sexp_h.include? sexp then
if @keyword_h.include? sexp then
@keyword_h[sexp] = @keyword_h[sexp] + 1
else
@keyword_h[sexp] = 1
Expand Down Expand Up @@ -327,11 +327,11 @@ def output_stats()
print "Total association validations (Those that occur when a has_many is used): "; inspect_stat(@num_associations)
print "Total builtin validations: "; inspect_stat(@num_builtin)
print "Total unknown validations: "; inspect_stat(@num_unknown)
print "Total validations defined in gem: "; inspect_stat(@num_gem)
puts ""
puts "=========== Custom defined validations breakdown ==========="
print "Total validations defined as Validators: "; inspect_stat(@num_validator)
print "Total validations defined in model: "; inspect_stat(@num_model_defined)
print "Total validations defined in gem: "; inspect_stat(@num_gem)
puts ""
puts "=========== Breakdown of custom validator types ============="
puts "Number of successfully translated validators: " + @successful.to_s + " (" + (@successful * 100 / @num_custom).to_s + "%)"
Expand Down Expand Up @@ -440,4 +440,16 @@ def output_block_stats
puts ""
puts "To view validaions that contain the above enter either 'blocks-success' or 'blocks-semantic'"
end

def output_plato_only

puts "========== blocks with no translation problems but where plato fails ============="

@validations.values.each do |validation|
if validation.has_no_errors and !validation.successful? then
puts validation.id
end
end

end
end
27 changes: 18 additions & 9 deletions examiner/lib/data_acquisition/piecharts/validation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
class Validation
require 'set'

attr_accessor :success, :kifstring, :num_blocks, :id, :num_true, :semantics, :errors, :index, :blocks, :location
attr_accessor :plato_success, :kifstring, :num_blocks, :id, :num_true, :semantics, :errors, :index, :blocks, :location

def initialize(id)
@id = id
@errors = {:SEXP => [], :KEYWORD => [], :FUNCTION => [], :METHOD => [], :DATABASE => [], :UNKNOWN => []}
@success = false # Corresponds to if check_plato succeeded or not
@plato_success = false # Corresponds to if check_plato succeeded or not
@blocks = Array.new # where block[i] = the errors in that block (a Set) and i = the block number
@semantics = [] # entries correspond to the block that has the semantic error (adds nothing to :errors)
@successful_blocks = [] # entries correspond to the block that was succesfully translated end
Expand Down Expand Up @@ -83,11 +83,12 @@ def output_error_set
end

def print_errors
puts "SEXP: " + @errors[:SEXP].to_s.delete(",") + ", "
puts "KEYWORD: " + @errors[:KEYWORD].to_s.delete(",") + ", "
puts "FUNCTION: " + @errors[:FUNCTION].to_s.delete(",") + ", "
puts "METHOD: " + @errors[:METHOD].to_s.delete(",") + ", "
puts "DATABASE: " + @errors[:DATABASE].to_s.delete(",")
puts "SEXP: " + @errors[:SEXP].to_s.delete(",")
puts "KEYWORD: " + @errors[:KEYWORD].to_s.delete(",")
puts "FUNCTION: " + @errors[:FUNCTION].to_s.delete(",")
puts "METHOD: " + @errors[:METHOD].to_s.delete(",")
puts "DATABASE: " + @errors[:DATABASE].to_s.delete(",")
puts "UNKNOWN: " + @errors[:UNKNOWN].to_s.delete(",")
puts "Kifstring: " + @kifstring.to_s
end

Expand Down Expand Up @@ -115,9 +116,17 @@ def display_blocks

end

def successful?
def has_no_errors
if @errors[:SEXP].empty? and @errors[:KEYWORD].empty? and @errors[:FUNCTION].empty? and \
@errors[:METHOD].empty? and @errors[:DATABASE].empty? and @errors[:UNKNOWN].empty? and @success then
@errors[:METHOD].empty? and @errors[:DATABASE].empty? and @errors[:UNKNOWN].empty? then
true
else
false
end
end

def successful?
if has_no_errors and @plato_success then
true
else
false
Expand Down

0 comments on commit c5a3719

Please sign in to comment.