Class: AtCoderFriends::SampleTestRunner
- Inherits:
-
TestRunner
- Object
- TestRunner
- AtCoderFriends::SampleTestRunner
- Includes:
- PathUtil
- Defined in:
- lib/at_coder_friends/sample_test_runner.rb
Overview
run test cases for the specified program with sample input/output.
Constant Summary
Constants included from PathUtil
PathUtil::CASES_DIR, PathUtil::SMP_DIR
Instance Method Summary collapse
-
#initialize(path, config) ⇒ SampleTestRunner
constructor
A new instance of SampleTestRunner.
- #test(n) ⇒ Object
- #test_all ⇒ Object
- #test_one(n) ⇒ 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) ⇒ SampleTestRunner
Returns a new instance of SampleTestRunner.
8 9 10 11 |
# File 'lib/at_coder_friends/sample_test_runner.rb', line 8 def initialize(path, config) super(path, config) @smp_dir = smp_dir(@dir) end |
Instance Method Details
#test(n) ⇒ Object
25 26 27 28 29 |
# File 'lib/at_coder_friends/sample_test_runner.rb', line 25 def test(n) id = format('%<q>s_%<n>03d', q: @q, n: n) files = %w[in out exp].map { |ext| "#{@smp_dir}/#{id}.#{ext}" } run_test(id, *files) end |
#test_all ⇒ Object
13 14 15 16 17 18 |
# File 'lib/at_coder_friends/sample_test_runner.rb', line 13 def test_all puts "***** test_all #{@prg} *****" 1.upto(999) do |i| break unless test(i) end end |
#test_one(n) ⇒ Object
20 21 22 23 |
# File 'lib/at_coder_friends/sample_test_runner.rb', line 20 def test_one(n) puts "***** test_one #{@prg} *****" test(n) end |