Sha256: f4ca4ef0f65e21bc3b4bb358a7ef5ad2b1c671ef14f6e449f17b7c963d105fbb

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 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(ctx)
      super(ctx)
      @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.5.0 lib/at_coder_friends/judge_test_runner.rb