Last active
June 18, 2018 02:29
-
-
Save c650/2f9dce2aeb8685b175c871709973ad69 to your computer and use it in GitHub Desktop.
A very crappy judging script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env ruby | |
# A very crappy judging script | |
if ARGV.length < 2 | |
puts "Usage: ./program.rb [executable] [data folder]" | |
exit | |
end | |
Dir.chdir(ARGV[1]) | |
Dir.glob("case*").sort.each do |testcase| | |
Dir.chdir("#{ARGV[1]}/#{testcase}") | |
infile = "#{ARGV[1]}/#{testcase}/#{Dir.glob("*.in").first}" | |
outfile = "#{ARGV[1]}/#{testcase}/#{Dir.glob("*.out").first}" | |
`#{ARGV[0]} < #{infile} > /tmp/judge_rb_output` | |
puts "Case: #{testcase}" | |
puts `diff -qw /tmp/judge_rb_output #{outfile}` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment