Sha256: b18355963a93a7ba0a8c4e2fd458d118a1f5b8490974b6a3111e20617fe86f88

Contents?: true

Size: 663 Bytes

Versions: 3

Compression:

Stored size: 663 Bytes

Contents

# frozen_string_literal: true

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

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

    def test_all
      puts "***** test_all #{@prg} *****"
      1.upto(999) do |i|
        break unless test(i)
      end
    end

    def test_one(n)
      puts "***** test_one #{@prg} *****"
      test(n)
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

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