Skip to content

Commit

Permalink
Add solution command in the intro message for local grading (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanirvings authored and fushar committed Feb 20, 2017
1 parent 7c019b6 commit c304556
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/tcframe/grader/Grader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Grader {
, logger_(logger) {}

virtual void grade(const TestSuite& testSuite, const ConstraintSuite& constraintSuite, const GraderConfig& config) {
logger_->logIntroduction();
logger_->logIntroduction(config.solutionCommand());

map<int, Verdict> subtaskVerdicts;
for (int subtaskId : getSubtaskIdsToGrade(constraintSuite)) {
Expand Down
4 changes: 2 additions & 2 deletions include/tcframe/grader/GraderLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class GraderLogger : public BaseLogger {
GraderLogger(LoggerEngine* engine)
: BaseLogger(engine) {}

virtual void logIntroduction() {
engine_->logParagraph(0, "Grading...");
virtual void logIntroduction(const string& solutionCommand) {
engine_->logParagraph(0, "Local grading with solution command: '" + solutionCommand + "'...");
}

virtual void logTestCaseVerdict(const Verdict& verdict) {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/tcframe/grader/GraderLoggerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class GraderLoggerTests : public Test {
};

TEST_F(GraderLoggerTests, Introduction) {
EXPECT_CALL(engine, logParagraph(0, "Grading..."));
EXPECT_CALL(engine, logParagraph(0, "Local grading with solution command: './solution'..."));

logger.logIntroduction();
logger.logIntroduction("./solution");
}

TEST_F(GraderLoggerTests, TestCaseVerdict) {
Expand Down
6 changes: 3 additions & 3 deletions test/unit/tcframe/grader/GraderTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ int GraderTests::T;
TEST_F(GraderTests, Grading_AC) {
{
InSequence sequence;
EXPECT_CALL(logger, logIntroduction());
EXPECT_CALL(logger, logIntroduction("python Sol.py"));
EXPECT_CALL(logger, logTestGroupIntroduction(0));
EXPECT_CALL(testCaseGrader, grade(stcA, config));
EXPECT_CALL(logger, logTestGroupIntroduction(-1));
Expand All @@ -107,7 +107,7 @@ TEST_F(GraderTests, Grading_NonAC) {
TEST_F(GraderTests, Grading_WithSubtasks) {
{
InSequence sequence;
EXPECT_CALL(logger, logIntroduction());
EXPECT_CALL(logger, logIntroduction("python Sol.py"));
EXPECT_CALL(logger, logTestGroupIntroduction(0));
EXPECT_CALL(testCaseGrader, grade(stc1, config));
EXPECT_CALL(testCaseGrader, grade(stc2, config));
Expand Down Expand Up @@ -143,7 +143,7 @@ TEST_F(GraderTests, Grading_WithSubtasks_WithGlobalConstraints) {
TEST_F(GraderTests, Grading_WithSubtasks_MultipleTestCases) {
{
InSequence sequence;
EXPECT_CALL(logger, logIntroduction());
EXPECT_CALL(logger, logIntroduction("python Sol.py"));
EXPECT_CALL(logger, logTestGroupIntroduction(0));
EXPECT_CALL(testCaseGrader, grade(
TestUtils::createFakeTestCase("foo_sample", {1, 2}), multipleTestCasesConfig));
Expand Down
2 changes: 1 addition & 1 deletion test/unit/tcframe/grader/MockGraderLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MockGraderLogger : public GraderLogger {
MOCK_METHOD1(logTestCaseScoringMessage, void(const string&));
MOCK_METHOD2(logExecutionFailure, void(const string&, const ExecutionResult&));

MOCK_METHOD0(logIntroduction, void());
MOCK_METHOD1(logIntroduction, void(const string&));
MOCK_METHOD1(logTestCaseVerdict, void(const Verdict&));

MOCK_METHOD1(logResult, void(const map<int, Verdict>&));
Expand Down

0 comments on commit c304556

Please sign in to comment.