Description:
[grader] fixed bug #6 and #9
git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@139 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r37:effd16a52c43 - - 5 files changed: 13 inserted, 3 deleted
@@ -39,14 +39,16 | |||||
|
39 | # :long |
|
39 | # :long |
|
40 | attr_accessor :comment_report_style |
|
40 | attr_accessor :comment_report_style |
|
41 |
|
41 | ||
|
42 | def report_comment(comment) |
|
42 | def report_comment(comment) |
|
43 | case comment_report_style |
|
43 | case comment_report_style |
|
44 | when :short |
|
44 | when :short |
|
45 | - if comment.chomp =~ /^P+$/ # all P's |
|
45 | + if comment.chomp =~ /^[\[\]P]+$/ # all P's |
|
46 | 'passed' |
|
46 | 'passed' |
|
|
47 | + elsif comment.chomp =~ /[Cc]ompil.*[Ee]rror/ | ||
|
|
48 | + 'compilation error' | ||
|
47 | else |
|
49 | else |
|
48 | 'failed' |
|
50 | 'failed' |
|
49 | end |
|
51 | end |
|
50 |
|
52 | ||
|
51 | when :full |
|
53 | when :full |
|
52 | comment.chomp |
|
54 | comment.chomp |
@@ -84,13 +84,13 | |||||
|
84 | if FileTest.exist?("#{test_result_dir}/a.out") |
|
84 | if FileTest.exist?("#{test_result_dir}/a.out") |
|
85 | return {:points => 0, |
|
85 | return {:points => 0, |
|
86 | :comment => 'error during grading', |
|
86 | :comment => 'error during grading', |
|
87 | :cmp_msg => cmp_msg} |
|
87 | :cmp_msg => cmp_msg} |
|
88 | else |
|
88 | else |
|
89 | return {:points => 0, |
|
89 | return {:points => 0, |
|
90 |
- :comment => 'compil |
|
90 | + :comment => 'compilation error', |
|
91 | :cmp_msg => cmp_msg} |
|
91 | :cmp_msg => cmp_msg} |
|
92 | end |
|
92 | end |
|
93 | end |
|
93 | end |
|
94 | end |
|
94 | end |
|
95 |
|
95 | ||
|
96 | def save_result(submission,result) |
|
96 | def save_result(submission,result) |
@@ -100,12 +100,14 | |||||
|
100 | submission.points = points |
|
100 | submission.points = points |
|
101 | comment = @config.report_comment(result[:comment]) |
|
101 | comment = @config.report_comment(result[:comment]) |
|
102 | if problem == nil |
|
102 | if problem == nil |
|
103 | submission.grader_comment = 'PASSED: ' + comment + '(problem is nil)' |
|
103 | submission.grader_comment = 'PASSED: ' + comment + '(problem is nil)' |
|
104 | elsif points == problem.full_score |
|
104 | elsif points == problem.full_score |
|
105 | submission.grader_comment = 'PASSED: ' + comment |
|
105 | submission.grader_comment = 'PASSED: ' + comment |
|
|
106 | + elsif result[:comment].chomp =~ /^[\[\]P]+$/ | ||
|
|
107 | + submission.grader_comment = 'PASSED: ' + comment + '(inconsistent score)' | ||
|
106 | else |
|
108 | else |
|
107 | submission.grader_comment = 'FAILED: ' + comment |
|
109 | submission.grader_comment = 'FAILED: ' + comment |
|
108 | end |
|
110 | end |
|
109 | submission.compiler_message = result[:cmp_msg] or '' |
|
111 | submission.compiler_message = result[:cmp_msg] or '' |
|
110 | submission.save |
|
112 | submission.save |
|
111 | end |
|
113 | end |
@@ -1,6 +1,9 | |||||
|
|
1 | + /* | ||
|
|
2 | + LANG: C | ||
|
|
3 | + */ | ||
|
1 | #include <stdio.h> |
|
4 | #include <stdio.h> |
|
2 |
|
5 | ||
|
3 | int main() |
|
6 | int main() |
|
4 | { |
|
7 | { |
|
5 | int a, |
|
8 | int a, |
|
6 | scanf("%d %d",&a,&b); |
|
9 | scanf("%d %d",&a,&b); |
@@ -1,6 +1,9 | |||||
|
|
1 | + /* | ||
|
|
2 | + LANG: C | ||
|
|
3 | + */ | ||
|
1 | #include <stdio.h> |
|
4 | #include <stdio.h> |
|
2 |
|
5 | ||
|
3 | int main() |
|
6 | int main() |
|
4 | { |
|
7 | { |
|
5 | int a,b; |
|
8 | int a,b; |
|
6 | scanf("%d %d",&a,&b); |
|
9 | scanf("%d %d",&a,&b); |
@@ -30,13 +30,13 | |||||
|
30 |
|
30 | ||
|
31 | it "should produce error message when submission cannot compile" do |
|
31 | it "should produce error message when submission cannot compile" do |
|
32 | grader_should(:grade => "test1_compile_error.c", |
|
32 | grader_should(:grade => "test1_compile_error.c", |
|
33 | :on => @problem_test_normal, |
|
33 | :on => @problem_test_normal, |
|
34 | :and_report => { |
|
34 | :and_report => { |
|
35 | :score => 0, |
|
35 | :score => 0, |
|
36 |
- :comment => 'FAILED: compil |
|
36 | + :comment => 'FAILED: compilation error', |
|
37 | :compiler_message => /[Ee]rror/}) |
|
37 | :compiler_message => /[Ee]rror/}) |
|
38 | end |
|
38 | end |
|
39 |
|
39 | ||
|
40 | it "should produce timeout error when submission runs forever" do |
|
40 | it "should produce timeout error when submission runs forever" do |
|
41 | @problem_test_timeout = stub(Problem, |
|
41 | @problem_test_timeout = stub(Problem, |
|
42 | :id => 1, :name => 'test_timeout', |
|
42 | :id => 1, :name => 'test_timeout', |
You need to be logged in to leave comments.
Login now