Sha256: f20a949c5fcf9daac56f888b26543535cb5070bf9a8c7579e03f5e549a77eae8

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 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, config)
      super(path, config)
      @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

1 entries across 1 versions & 1 rubygems

Version Path
at_coder_friends-0.4.0 lib/at_coder_friends/judge_test_runner.rb