Skip to content

Commit

Permalink
grader: show SKIPPED for subtasks without submitted files in OO problems
Browse files Browse the repository at this point in the history
  • Loading branch information
fushar committed Aug 26, 2024
1 parent 0b29a7a commit 528dad7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ public AggregationResult aggregate(List<TestCaseVerdict> testCaseVerdicts, doubl

testCasePoints.add(points);
}
if (aggregatedVerdict == Verdict.SKIPPED) {
aggregatedVerdict = Verdict.OK;
}

return new AggregationResult.Builder()
.subtaskVerdict(SubtaskVerdict.of(aggregatedVerdict, aggregatedPoints))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ public SubtaskVerdict aggregate(List<SubtaskVerdict> subtaskVerdicts) {

aggregatedPoints += subtaskVerdict.getPoints();
}

// This case can only logically happen for subtasks in an output-only problem,
// where the SKIPPED verdicts are due to unsubmitted output files.
if (aggregatedVerdict == Verdict.SKIPPED) {
aggregatedVerdict = Verdict.OK;
}

return SubtaskVerdict.of(aggregatedVerdict, aggregatedPoints);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void aggregate_zero_points_with_accepted_and_skipped() {
new TestCaseVerdict.Builder().verdict(Verdict.SKIPPED).build());

AggregationResult result = aggregator.aggregate(testCaseVerdicts, 70.0);
assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.OK, 0.0));
assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.SKIPPED, 0.0));
assertThat(result.getTestCasePoints()).containsExactly("*", "*", "?");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static org.assertj.core.api.Assertions.assertThat;

import com.google.common.collect.ImmutableList;
import java.util.List;
import judgels.gabriel.api.SubtaskVerdict;
import judgels.gabriel.api.Verdict;
Expand All @@ -19,12 +18,21 @@ void before() {

@Test
void aggregate() {
List<SubtaskVerdict> subtaskVerdicts = ImmutableList.of(
List<SubtaskVerdict> subtaskVerdicts = List.of(
new SubtaskVerdict.Builder().verdict(Verdict.ACCEPTED).points(10).build(),
new SubtaskVerdict.Builder().verdict(Verdict.TIME_LIMIT_EXCEEDED).points(20).build(),
new SubtaskVerdict.Builder().verdict(Verdict.OK).points(30).build(),
new SubtaskVerdict.Builder().verdict(Verdict.WRONG_ANSWER).points(0).build());

assertThat(aggregator.aggregate(subtaskVerdicts)).isEqualTo(SubtaskVerdict.of(Verdict.TIME_LIMIT_EXCEEDED, 60));
}

@Test
void aggregate_skipped() {
List<SubtaskVerdict> subtaskVerdicts = List.of(
new SubtaskVerdict.Builder().verdict(Verdict.SKIPPED).points(0).build(),
new SubtaskVerdict.Builder().verdict(Verdict.SKIPPED).points(0).build());

assertThat(aggregator.aggregate(subtaskVerdicts)).isEqualTo(SubtaskVerdict.of(Verdict.OK, 0));
}
}

0 comments on commit 528dad7

Please sign in to comment.