Sha256: 4bcbaf46de0f2e981d56ae6dc763e71098acc6326731bcdadcab74fb7feba2a8

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 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(ctx)
      super(ctx)
      @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

1 entries across 1 versions & 1 rubygems

Version Path
at_coder_friends-0.5.0 lib/at_coder_friends/sample_test_runner.rb