Sha256: 9d8785c0705231fbcc5b2493e8041852efb9896f378bf75a5b3c444a8192bc56

Contents?: true

Size: 825 Bytes

Versions: 3

Compression:

Stored size: 825 Bytes

Contents

# frozen_string_literal: true

module AtCoderFriends
  # run test cases for the specified program with actual input/output.
  class JudgeTestRunner < TestRunner
    include PathUtil

    def initialize(path)
      super(path)
      @cases_dir = cases_dir(@dir)
      @smp_dir = smp_dir(@dir)
    end

    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

    def judge_one(id)
      puts "***** judge_one #{@prg} *****"
      judge(id)
    end

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
at_coder_friends-0.3.3 lib/at_coder_friends/judge_test_runner.rb
at_coder_friends-0.3.2 lib/at_coder_friends/judge_test_runner.rb
at_coder_friends-0.3.1 lib/at_coder_friends/judge_test_runner.rb