-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include ExecutionResult in ScoringResult (#106)
We need this as a preparation for custom scorer support. - Make scorers output debug messages (e.g. diff) to stderr - Integration tests for DiffScorer instead of just unit tests (actually run the diff command in a shell)
- Loading branch information
Showing
16 changed files
with
144 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
yes | ||
1 2 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
yes | ||
1 4 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
yes | ||
1 2 3 |
39 changes: 39 additions & 0 deletions
39
integration-test/tcframe/scorer/DiffScorerIntegrationTests.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "gmock/gmock.h" | ||
|
||
#include "tcframe/scorer/DiffScorer.hpp" | ||
#include "tcframe/util.hpp" | ||
|
||
using ::testing::Eq; | ||
using ::testing::HasSubstr; | ||
using ::testing::StartsWith; | ||
using ::testing::Test; | ||
|
||
namespace tcframe { | ||
|
||
class DiffScorerIntegrationTests : public Test { | ||
protected: | ||
DiffScorer scorer = DiffScorer(new UnixOperatingSystem()); | ||
}; | ||
|
||
TEST_F(DiffScorerIntegrationTests, Scoring_AC) { | ||
ScoringResult result = scorer.score( | ||
"", | ||
"integration/scorer/judge.out", | ||
"integration/scorer/diff/contestant_ac.out"); | ||
EXPECT_THAT(result.verdict(), Eq(Verdict::ac())); | ||
} | ||
|
||
TEST_F(DiffScorerIntegrationTests, Scoring_WA) { | ||
ScoringResult result = scorer.score( | ||
"", | ||
"integration/scorer/judge.out", | ||
"integration/scorer/diff/contestant_wa.out"); | ||
EXPECT_THAT(result.verdict(), Eq(Verdict::wa())); | ||
|
||
string scorerMessage = StringUtils::streamToString(result.executionResult().errorStream()); | ||
EXPECT_THAT(scorerMessage, StartsWith("Diff:\n")); | ||
EXPECT_THAT(scorerMessage, HasSubstr("(expected) [line 02] 1 2 3\n")); | ||
EXPECT_THAT(scorerMessage, HasSubstr("(received) [line 02] 1 4 5\n")); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.