Class: AtCoderFriends::JudgeTestRunner
- Inherits:
-
TestRunner
- Object
- TestRunner
- AtCoderFriends::JudgeTestRunner
- Includes:
- PathUtil
- Defined in:
- lib/at_coder_friends/judge_test_runner.rb
Overview
run test cases for the specified program with actual input/output.
Constant Summary
Constants included from PathUtil
PathUtil::CASES_DIR, PathUtil::SMP_DIR
Instance Method Summary collapse
-
#initialize(path, config) ⇒ JudgeTestRunner
constructor
A new instance of JudgeTestRunner.
- #judge(id) ⇒ Object
- #judge_all ⇒ Object
- #judge_one(id) ⇒ Object
Methods included from PathUtil
cases_dir, contest_name, smp_dir, split_prg_path
Methods inherited from TestRunner
#local_test, #remote_test, #run_test, #test_cmd, #test_loc, #test_mtd, #which_os
Constructor Details
#initialize(path, config) ⇒ JudgeTestRunner
Returns a new instance of JudgeTestRunner.
8 9 10 11 12 |
# File 'lib/at_coder_friends/judge_test_runner.rb', line 8 def initialize(path, config) super(path, config) @cases_dir = cases_dir(@dir) @smp_dir = smp_dir(@dir) end |
Instance Method Details
#judge(id) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/at_coder_friends/judge_test_runner.rb', line 27 def judge(id) infile = "#{@cases_dir}/#{@q}/in/#{id}.txt" outfile = "#{@smp_dir}/#{@q}_#{id}.out" expfile = "#{@cases_dir}/#{@q}/out/#{id}.txt" run_test(id, infile, outfile, expfile) end |
#judge_all ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/at_coder_friends/judge_test_runner.rb', line 14 def judge_all puts "***** judge_all #{@prg} *****" Dir["#{@cases_dir}/#{@q}/in/*.txt"].sort.each do |infile| id = File.basename(infile, '.txt') judge(id) end end |
#judge_one(id) ⇒ Object
22 23 24 25 |
# File 'lib/at_coder_friends/judge_test_runner.rb', line 22 def judge_one(id) puts "***** judge_one #{@prg} *****" judge(id) end |