Description:
fixed judge craching when some test case is not present git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@367 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r67:b65f81409564 - - 1 file changed: 8 inserted, 6 deleted

@@ -92,54 +92,56
92 def Problem.set_instance(prob)
92 def Problem.set_instance(prob)
93 @instance = prob
93 @instance = prob
94 end
94 end
95
95
96 def Problem.get_instance
96 def Problem.get_instance
97 return @instance
97 return @instance
98 end
98 end
99
99
100 def well_formed?
100 def well_formed?
101 # Check if run 1 to run @runs.length are present.
101 # Check if run 1 to run @runs.length are present.
102 (1..(@runs.length-1)).each do |i|
102 (1..(@runs.length-1)).each do |i|
103 if @runs[i] == nil
103 if @runs[i] == nil
104 puts "run #{i} is not present"
104 puts "run #{i} is not present"
105 return false
105 return false
106 end
106 end
107 end
107 end
108
108
109 # Check if all tests are in one and only one run.
109 # Check if all tests are in one and only one run.
110 test_present = []
110 test_present = []
111 (1..(@num_tests)).each do |i|
111 (1..(@num_tests)).each do |i|
112 test_present[i] = false
112 test_present[i] = false
113 end
113 end
114 (1..(@runs.length-1)).each do |j|
114 (1..(@runs.length-1)).each do |j|
115 run = @runs[j]
115 run = @runs[j]
116 - run.tests.each do |t|
116 + if run.tests!=nil
117 - if test_present[t] == false
117 + run.tests.each do |t|
118 - test_present[t] = true
118 + if test_present[t] == false
119 - else
119 + test_present[t] = true
120 - puts "test #{t} is present in more than one run"
120 + else
121 - return false
121 + puts "test #{t} is present in more than one run"
122 + return false
123 + end
122 end
124 end
123 end
125 end
124 end
126 end
125 (1..(@num_tests)).each do |i|
127 (1..(@num_tests)).each do |i|
126 if test_present[i] == false
128 if test_present[i] == false
127 puts "test #{i} is not present"
129 puts "test #{i} is not present"
128 return false
130 return false
129 end
131 end
130 end
132 end
131
133
132 # Check if we can find the score, mem limit, and time limit for all tests.
134 # Check if we can find the score, mem limit, and time limit for all tests.
133 (1..(@num_tests)).each do |i|
135 (1..(@num_tests)).each do |i|
134 begin
136 begin
135 get_score i
137 get_score i
136 rescue
138 rescue
137 puts "cannot get score for test #{i}"
139 puts "cannot get score for test #{i}"
138 return false
140 return false
139 end
141 end
140
142
141 begin
143 begin
142 get_mem_limit i
144 get_mem_limit i
143 rescue
145 rescue
144 puts "cannot get mem limit for test #{i}"
146 puts "cannot get mem limit for test #{i}"
145 return false
147 return false
You need to be logged in to leave comments. Login now