class AtCoderFriends::TestRunner::Judge

run test cases for the specified program with judge input/output.

Attributes

data_dir[R]
result_dir[R]

Public Class Methods

new(ctx) click to toggle source
Calls superclass method AtCoderFriends::TestRunner::Base::new
# File lib/at_coder_friends/test_runner/judge.rb, line 9
def initialize(ctx)
  super(ctx)
  @data_dir = ctx.path_info.cases_dir
  @result_dir = ctx.path_info.cases_out_dir
end

Public Instance Methods

judge(id, detail = true) click to toggle source
# File lib/at_coder_friends/test_runner/judge.rb, line 29
def judge(id, detail = true)
  @detail = detail
  infile = "#{data_dir}/#{q}/in/#{id}"
  outfile = "#{result_dir}/#{q}/result/#{id}"
  expfile = "#{data_dir}/#{q}/out/#{id}"
  run_test(id, infile, outfile, expfile)
end
judge_all() click to toggle source
# File lib/at_coder_friends/test_runner/judge.rb, line 15
def judge_all
  puts "***** judge_all #{prg} (#{test_loc}) *****"
  results = Dir["#{data_dir}/#{q}/in/*"].sort.map do |infile|
    id = File.basename(infile)
    judge(id, false)
  end
  !results.empty? && results.all?
end
judge_one(id) click to toggle source
# File lib/at_coder_friends/test_runner/judge.rb, line 24
def judge_one(id)
  puts "***** judge_one #{prg} (#{test_loc}) *****"
  judge(id, true)
end