Skip to content

Commit

Permalink
grader: Allow OK feedback to be on separate, third line (#644)
Browse files Browse the repository at this point in the history
  • Loading branch information
fushar authored Aug 12, 2024
1 parent 9c3dc60 commit 68fa199
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public TestCaseVerdict parseOutput(String output) throws ScoringException {
}
}

if (lines.length > 2) {
feedback = Optional.of(lines[2]);
}
if (tokens.length > 1) {
feedback = Optional.of(tokens[1]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ void ok_points() throws ScoringException {

@Test
void ok_points_with_feedback() throws ScoringException {
assertThat(parser.parseOutput("OK\n70\na feedback\n")).isEqualTo(
new TestCaseVerdict.Builder().verdict(Verdict.OK).points(70.0).feedback("a feedback").build());
}

@Test
void ok_points_with_feedback_on_same_line() throws ScoringException {
assertThat(parser.parseOutput("OK\n70 a feedback\n")).isEqualTo(
new TestCaseVerdict.Builder().verdict(Verdict.OK).points(70.0).feedback("a feedback").build());
}
Expand All @@ -75,6 +81,12 @@ void ok_percentage() throws ScoringException {

@Test
void ok_percentage_with_feedback() throws ScoringException {
assertThat(parser.parseOutput("OK\n25%\na feedback\n")).isEqualTo(
new TestCaseVerdict.Builder().verdict(Verdict.OK).percentage(25).feedback("a feedback").build());
}

@Test
void ok_percentage_with_feedback_on_same_line() throws ScoringException {
assertThat(parser.parseOutput("OK\n25% a feedback\n")).isEqualTo(
new TestCaseVerdict.Builder().verdict(Verdict.OK).percentage(25).feedback("a feedback").build());
}
Expand Down

0 comments on commit 68fa199

Please sign in to comment.