|
@@ -7,17 +7,22 @@ module KGrader |
|
|
|
|
|
|
|
|
def testcase(options) |
|
|
def testcase(options) |
|
|
puts " running test: #{File.basename $0} ".center MAX_COLS, '=' |
|
|
puts " running test: #{File.basename $0} ".center MAX_COLS, '=' |
|
|
|
|
|
|
|
|
begin |
|
|
begin |
|
|
Timeout::timeout options[:alarm] { yield } |
|
|
Timeout::timeout options[:alarm] { yield } |
|
|
rescue Timeout::Error |
|
|
rescue Timeout::Error |
|
|
comment "timeout" |
|
|
comment "timeout" |
|
|
grade 0 |
|
|
grade 0 |
|
|
end |
|
|
end |
|
|
puts " done ".center MAX_COLS, '-' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
puts "no grade received?" |
|
|
|
|
|
comment "autograde error (no grade reported); please contact staff" |
|
|
|
|
|
grade 0 |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def grade(score) |
|
|
def grade(score) |
|
|
IO.new(3).write score |
|
|
IO.new(3).write score |
|
|
|
|
|
puts " done ".center MAX_COLS, '-' |
|
|
exit |
|
|
exit |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|