Description:
[grader] small tweak on one test case
git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@168 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
r44:a07593cb07c4 - - 1 file changed: 1 inserted, 1 deleted
@@ -143,97 +143,97 | |||||
|
143 | end |
|
143 | end |
|
144 |
|
144 | ||
|
145 | protected |
|
145 | protected |
|
146 |
|
146 | ||
|
147 | def create_normal_submission_mock_from_file(source_fname) |
|
147 | def create_normal_submission_mock_from_file(source_fname) |
|
148 | create_submission_from_file(1, @user_user1, @problem_test_normal, source_fname) |
|
148 | create_submission_from_file(1, @user_user1, @problem_test_normal, source_fname) |
|
149 | end |
|
149 | end |
|
150 |
|
150 | ||
|
151 | end |
|
151 | end |
|
152 |
|
152 | ||
|
153 | describe "A grader engine, when grading test requests" do |
|
153 | describe "A grader engine, when grading test requests" do |
|
154 |
|
154 | ||
|
155 | include GraderEngineHelperMethods |
|
155 | include GraderEngineHelperMethods |
|
156 |
|
156 | ||
|
157 | before(:each) do |
|
157 | before(:each) do |
|
158 | @config = Grader::Configuration.get_instance |
|
158 | @config = Grader::Configuration.get_instance |
|
159 | @engine = Grader::Engine.new(Grader::TestRequestRoomMaker.new, |
|
159 | @engine = Grader::Engine.new(Grader::TestRequestRoomMaker.new, |
|
160 | Grader::TestRequestReporter.new) |
|
160 | Grader::TestRequestReporter.new) |
|
161 | init_sandbox |
|
161 | init_sandbox |
|
162 | end |
|
162 | end |
|
163 |
|
163 | ||
|
164 | it "should report error if there is no problem template" do |
|
164 | it "should report error if there is no problem template" do |
|
165 | problem = stub(Problem, |
|
165 | problem = stub(Problem, |
|
166 | :id => 1, :name => 'nothing') |
|
166 | :id => 1, :name => 'nothing') |
|
167 | grader_should(:grade => 'test1_correct.c', |
|
167 | grader_should(:grade => 'test1_correct.c', |
|
168 | :on => problem, |
|
168 | :on => problem, |
|
169 | :with => 'in1.txt', |
|
169 | :with => 'in1.txt', |
|
170 | :and_report => { |
|
170 | :and_report => { |
|
171 | :graded_at= => nil, |
|
171 | :graded_at= => nil, |
|
172 | :compiler_message= => '', |
|
172 | :compiler_message= => '', |
|
173 | :grader_comment= => '', |
|
173 | :grader_comment= => '', |
|
174 | :running_stat= => /template not found/, |
|
174 | :running_stat= => /template not found/, |
|
175 | :running_time= => nil, |
|
175 | :running_time= => nil, |
|
176 | :exit_status= => nil, |
|
176 | :exit_status= => nil, |
|
177 | :memory_usage= => nil, |
|
177 | :memory_usage= => nil, |
|
178 | :save => nil}) |
|
178 | :save => nil}) |
|
179 | end |
|
179 | end |
|
180 |
|
180 | ||
|
181 | it "should run test request and produce output file" do |
|
181 | it "should run test request and produce output file" do |
|
182 | problem = stub(Problem, |
|
182 | problem = stub(Problem, |
|
183 | :id => 1, :name => 'test_normal') |
|
183 | :id => 1, :name => 'test_normal') |
|
184 | grader_should(:grade => 'test1_correct.c', |
|
184 | grader_should(:grade => 'test1_correct.c', |
|
185 | :on => problem, |
|
185 | :on => problem, |
|
186 | :with => 'in1.txt', |
|
186 | :with => 'in1.txt', |
|
187 | :and_report => { |
|
187 | :and_report => { |
|
188 | :graded_at= => nil, |
|
188 | :graded_at= => nil, |
|
189 | :compiler_message= => '', |
|
189 | :compiler_message= => '', |
|
190 | :grader_comment= => '', |
|
190 | :grader_comment= => '', |
|
191 | - :running_stat= => /0.0 sec./, |
|
191 | + :running_stat= => /0.0\d* sec./, |
|
192 | :output_file_name= => lambda { |fname| |
|
192 | :output_file_name= => lambda { |fname| |
|
193 | File.exists?(fname).should be_true |
|
193 | File.exists?(fname).should be_true |
|
194 | }, |
|
194 | }, |
|
195 | :running_time= => nil, |
|
195 | :running_time= => nil, |
|
196 | :exit_status= => nil, |
|
196 | :exit_status= => nil, |
|
197 | :memory_usage= => nil, |
|
197 | :memory_usage= => nil, |
|
198 | :save => nil}) |
|
198 | :save => nil}) |
|
199 | end |
|
199 | end |
|
200 |
|
200 | ||
|
201 | it "should clean up problem directory after running test request" do |
|
201 | it "should clean up problem directory after running test request" do |
|
202 | problem = stub(Problem, |
|
202 | problem = stub(Problem, |
|
203 | :id => 1, :name => 'test_normal') |
|
203 | :id => 1, :name => 'test_normal') |
|
204 | grader_should(:grade => 'test1_correct.c', |
|
204 | grader_should(:grade => 'test1_correct.c', |
|
205 | :on => problem, |
|
205 | :on => problem, |
|
206 | :with => 'in1.txt', |
|
206 | :with => 'in1.txt', |
|
207 | :and_report => { |
|
207 | :and_report => { |
|
208 | :graded_at= => nil, |
|
208 | :graded_at= => nil, |
|
209 | :compiler_message= => '', |
|
209 | :compiler_message= => '', |
|
210 | :grader_comment= => '', |
|
210 | :grader_comment= => '', |
|
211 | :running_stat= => nil, |
|
211 | :running_stat= => nil, |
|
212 | :output_file_name= => nil, |
|
212 | :output_file_name= => nil, |
|
213 | :running_time= => nil, |
|
213 | :running_time= => nil, |
|
214 | :exit_status= => nil, |
|
214 | :exit_status= => nil, |
|
215 | :memory_usage= => nil, |
|
215 | :memory_usage= => nil, |
|
216 | :save => nil}) |
|
216 | :save => nil}) |
|
217 | File.exists?(@config.user_result_dir + "/test_request/test_normal/test_cases/1/input-1.txt").should be_false |
|
217 | File.exists?(@config.user_result_dir + "/test_request/test_normal/test_cases/1/input-1.txt").should be_false |
|
218 | end |
|
218 | end |
|
219 |
|
219 | ||
|
220 | it "should compile test request with error and report compilation error" do |
|
220 | it "should compile test request with error and report compilation error" do |
|
221 | problem = stub(Problem, |
|
221 | problem = stub(Problem, |
|
222 | :id => 1, :name => 'test_normal') |
|
222 | :id => 1, :name => 'test_normal') |
|
223 | grader_should(:grade => 'test1_compile_error.c', |
|
223 | grader_should(:grade => 'test1_compile_error.c', |
|
224 | :on => problem, |
|
224 | :on => problem, |
|
225 | :with => 'in1.txt', |
|
225 | :with => 'in1.txt', |
|
226 | :and_report => { |
|
226 | :and_report => { |
|
227 | :graded_at= => nil, |
|
227 | :graded_at= => nil, |
|
228 | :compiler_message= => /.+/, |
|
228 | :compiler_message= => /.+/, |
|
229 | :grader_comment= => /[Cc]ompil.*error/, |
|
229 | :grader_comment= => /[Cc]ompil.*error/, |
|
230 | :running_stat= => '', |
|
230 | :running_stat= => '', |
|
231 | :save => nil}) |
|
231 | :save => nil}) |
|
232 | end |
|
232 | end |
|
233 |
|
233 | ||
|
234 | it "should report exit status" do |
|
234 | it "should report exit status" do |
|
235 | problem = stub(Problem, |
|
235 | problem = stub(Problem, |
|
236 | :id => 1, :name => 'test_normal') |
|
236 | :id => 1, :name => 'test_normal') |
|
237 | grader_should(:grade => 'add_nonzero_exit_status.c', |
|
237 | grader_should(:grade => 'add_nonzero_exit_status.c', |
|
238 | :on => problem, |
|
238 | :on => problem, |
|
239 | :with => 'in1.txt', |
|
239 | :with => 'in1.txt', |
You need to be logged in to leave comments.
Login now