Please enable JavaScript to use RhodeCode Enterprise
#!/usr/bin/ruby
problem_home = ENV['PROBLEM_HOME']
require "#{problem_home}/script/test_dsl.rb"
if ARGV.length < 2
puts "Usage: check <language> <test-number> [<output-file>]"
exit(0)
end
language = ARGV[0]
test_num = ARGV[1].to_i
if ARGV.length >= 3
output_file_name = ARGV[2]
else
output_file_name = "output.txt"
end
load "#{problem_home}/test_cases/all_tests.cfg"
problem = Problem.get_instance
output_file = File.new(output_file_name, "r")
answer_file = File.new("#{problem_home}/test_cases/#{test_num}/answer-#{test_num}.txt")
result_file = File.new("check_result", "w")
output_file_content = output_file.read
answer_file_content = answer_file.read
report_correct = lambda {
result_file.write "Correct\n"
result_file.write problem.get_score(test_num)
result_file.write "\n"
result_file.close
exit(0)
}
report_wrong = lambda {
result_file.write "Incorrect\n"
result_file.write "0\n"
result_file.close
exit(0)
}
##################
# Your code here #
##################
report_correct.call
Site-wide shortcuts
/
Use quick search box
g h
Goto home page
g g
Goto my private gists page
g G
Goto my public gists page
n r
New repository page
n g
New gist page
Repositories
g s
Goto summary page
g c
Goto changelog page
g f
Goto files page
g F
Goto files page with file search activated
g p
Goto pull requests page
g o
Goto repository settings
g O
Goto repository permissions settings