|
4 | 4 | #include <map> |
5 | 5 | #include <string> |
6 | 6 | #include <vector> |
7 | | - |
8 | 7 | #include "GradingOptions.hpp" |
9 | 8 | #include "GraderLogger.hpp" |
10 | 9 | #include "TestCaseGrader.hpp" |
@@ -78,7 +77,7 @@ class Grader { |
78 | 77 | private: |
79 | 78 | map<int, double> getSubtaskPoints(const GradingOptions& options) { |
80 | 79 | map<int, double> subtaskPointsByIds; |
81 | | - for (int id = 1; id <= options.subtaskPoints().size(); id++) { |
| 80 | + for (unsigned id = 1; id <= options.subtaskPoints().size(); id++) { |
82 | 81 | subtaskPointsByIds[id] = options.subtaskPoints()[id - 1]; |
83 | 82 | } |
84 | 83 | if (subtaskPointsByIds.empty()) { |
@@ -107,21 +106,29 @@ class Grader { |
107 | 106 | .build(); |
108 | 107 | gradeTestCase(testCase, options, verdictsBySubtaskId); |
109 | 108 | } else { |
| 109 | + bool skipping = 0; |
110 | 110 | for (const TestCase& testCase : testGroup.testCases()) { |
111 | | - gradeTestCase(testCase, options, verdictsBySubtaskId); |
| 111 | + TestCaseVerdict verdict = gradeTestCase(testCase, options, verdictsBySubtaskId, skipping); |
| 112 | + if(verdict.verdict().code() != "OK" && verdict.verdict().code() != "AC") { |
| 113 | + // comment this code if you dont want to skip |
| 114 | + skipping = 1; |
| 115 | + } |
112 | 116 | } |
113 | 117 | } |
114 | 118 | } |
115 | 119 |
|
116 | | - void gradeTestCase( |
| 120 | + TestCaseVerdict gradeTestCase( |
117 | 121 | const TestCase& testCase, |
118 | 122 | const GradingOptions& options, |
119 | | - map<int, vector<TestCaseVerdict>>& verdictsBySubtaskId) { |
120 | | - |
121 | | - TestCaseVerdict verdict = testCaseGrader_->grade(testCase, options); |
| 123 | + map<int, vector<TestCaseVerdict>>& verdictsBySubtaskId, |
| 124 | + bool skipTestCase = 0) { |
| 125 | + TestCaseVerdict verdict; |
| 126 | + if(skipTestCase) verdict = TestCaseVerdict(Verdict::skip()); |
| 127 | + else verdict = testCaseGrader_->grade(testCase, options); |
122 | 128 | for (int subtaskId : testCase.subtaskIds()) { |
123 | 129 | verdictsBySubtaskId[subtaskId].push_back(verdict); |
124 | 130 | } |
| 131 | + return verdict; |
125 | 132 | } |
126 | 133 | }; |
127 | 134 |
|
|
0 commit comments