Skip to content

Commit

Permalink
Refactor runner: Move evaluator package to runner/
Browse files Browse the repository at this point in the history
  • Loading branch information
fushar committed Jul 25, 2017
1 parent 06c55ab commit d76baed
Show file tree
Hide file tree
Showing 49 changed files with 98 additions and 97 deletions.
58 changes: 29 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,6 @@ include_directories("${source_dir}/googlemock/include")
include_directories(include)

set(INCLUDE
include/tcframe/evaluator.hpp
include/tcframe/evaluator/BatchEvaluator.hpp
include/tcframe/evaluator/EvaluationOptions.hpp
include/tcframe/evaluator/EvaluationResult.hpp
include/tcframe/evaluator/Evaluator.hpp
include/tcframe/evaluator/EvaluatorConfig.hpp
include/tcframe/evaluator/EvaluatorHelperRegistry.hpp
include/tcframe/evaluator/EvaluatorRegistry.hpp
include/tcframe/evaluator/InteractiveEvaluator.hpp
include/tcframe/evaluator/GenerationResult.hpp
include/tcframe/evaluator/communicator.hpp
include/tcframe/evaluator/communicator/CommunicationResult.hpp
include/tcframe/evaluator/communicator/Communicator.hpp
include/tcframe/evaluator/scorer.hpp
include/tcframe/evaluator/scorer/CustomScorer.hpp
include/tcframe/evaluator/scorer/DiffScorer.hpp
include/tcframe/evaluator/scorer/Scorer.hpp
include/tcframe/evaluator/scorer/ScoringResult.hpp
include/tcframe/logger.hpp
include/tcframe/logger/BaseLogger.hpp
include/tcframe/logger/DefaultBaseLogger.hpp
Expand All @@ -75,6 +57,24 @@ set(INCLUDE
include/tcframe/runner/aggregator/AggregatorRegistry.hpp
include/tcframe/runner/aggregator/MinAggregator.hpp
include/tcframe/runner/aggregator/SumAggregator.hpp
include/tcframe/runner/evaluator.hpp
include/tcframe/runner/evaluator/BatchEvaluator.hpp
include/tcframe/runner/evaluator/EvaluationOptions.hpp
include/tcframe/runner/evaluator/EvaluationResult.hpp
include/tcframe/runner/evaluator/Evaluator.hpp
include/tcframe/runner/evaluator/EvaluatorConfig.hpp
include/tcframe/runner/evaluator/EvaluatorHelperRegistry.hpp
include/tcframe/runner/evaluator/EvaluatorRegistry.hpp
include/tcframe/runner/evaluator/InteractiveEvaluator.hpp
include/tcframe/runner/evaluator/GenerationResult.hpp
include/tcframe/runner/evaluator/communicator.hpp
include/tcframe/runner/evaluator/communicator/CommunicationResult.hpp
include/tcframe/runner/evaluator/communicator/Communicator.hpp
include/tcframe/runner/evaluator/scorer.hpp
include/tcframe/runner/evaluator/scorer/CustomScorer.hpp
include/tcframe/runner/evaluator/scorer/DiffScorer.hpp
include/tcframe/runner/evaluator/scorer/Scorer.hpp
include/tcframe/runner/evaluator/scorer/ScoringResult.hpp
include/tcframe/runner/grader.hpp
include/tcframe/runner/grader/BriefGraderLogger.hpp
include/tcframe/runner/grader/DefaultGraderLogger.hpp
Expand Down Expand Up @@ -158,14 +158,6 @@ set(INCLUDE
set(TEST_UNIT
test/unit/tcframe/helper.hpp
test/unit/tcframe/mock.hpp
test/unit/tcframe/evaluator/BatchEvaluatorTests.cpp
test/unit/tcframe/evaluator/InteractiveEvaluatorTests.cpp
test/unit/tcframe/evaluator/MockEvaluator.hpp
test/unit/tcframe/evaluator/MockEvaluatorRegistry.hpp
test/unit/tcframe/evaluator/communicator/CommunicatorTests.cpp
test/unit/tcframe/evaluator/communicator/MockCommunicator.hpp
test/unit/tcframe/evaluator/scorer/CustomScorerTests.cpp
test/unit/tcframe/evaluator/scorer/MockScorer.hpp
test/unit/tcframe/logger/DefaultBaseLogggerTests.cpp
test/unit/tcframe/logger/MockLoggerEngine.hpp
test/unit/tcframe/logger/SimpleLoggerEngineTests.cpp
Expand All @@ -174,6 +166,14 @@ set(TEST_UNIT
test/unit/tcframe/runner/aggregator/MockAggregator.hpp
test/unit/tcframe/runner/aggregator/MockAggregatorRegistry.hpp
test/unit/tcframe/runner/aggregator/SumAggregatorTests.cpp
test/unit/tcframe/runner/evaluator/BatchEvaluatorTests.cpp
test/unit/tcframe/runner/evaluator/InteractiveEvaluatorTests.cpp
test/unit/tcframe/runner/evaluator/MockEvaluator.hpp
test/unit/tcframe/runner/evaluator/MockEvaluatorRegistry.hpp
test/unit/tcframe/runner/evaluator/communicator/CommunicatorTests.cpp
test/unit/tcframe/runner/evaluator/communicator/MockCommunicator.hpp
test/unit/tcframe/runner/evaluator/scorer/CustomScorerTests.cpp
test/unit/tcframe/runner/evaluator/scorer/MockScorer.hpp
test/unit/tcframe/runner/generator/DefaultGeneratorLoggerTests.cpp
test/unit/tcframe/runner/generator/GeneratorTests.cpp
test/unit/tcframe/runner/generator/MockGenerator.hpp
Expand Down Expand Up @@ -245,9 +245,9 @@ target_link_libraries(test_unit
)

set(TEST_INTEGRATION
test/integration/tcframe/evaluator/communicator/CommunicatorIntegrationTests.cpp
test/integration/tcframe/evaluator/scorer/CustomScorerIntegrationTests.cpp
test/integration/tcframe/evaluator/scorer/DiffScorerIntegrationTests.cpp
test/integration/tcframe/runner/evaluator/communicator/CommunicatorIntegrationTests.cpp
test/integration/tcframe/runner/evaluator/scorer/CustomScorerIntegrationTests.cpp
test/integration/tcframe/runner/evaluator/scorer/DiffScorerIntegrationTests.cpp
test/integration/tcframe/os/OperatingSystemIntegrationTests.cpp
)

Expand Down
13 changes: 0 additions & 13 deletions include/tcframe/evaluator.hpp

This file was deleted.

4 changes: 0 additions & 4 deletions include/tcframe/evaluator/communicator.hpp

This file was deleted.

6 changes: 0 additions & 6 deletions include/tcframe/evaluator/scorer.hpp

This file was deleted.

1 change: 1 addition & 0 deletions include/tcframe/runner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "tcframe/runner/aggregator.hpp"
#include "tcframe/runner/core.hpp"
#include "tcframe/runner/evaluator.hpp"
#include "tcframe/runner/generator.hpp"
#include "tcframe/runner/grader.hpp"
#include "tcframe/runner/logger.hpp"
2 changes: 1 addition & 1 deletion include/tcframe/runner/core/Runner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include "Args.hpp"
#include "ArgsParser.hpp"
#include "SlugParser.hpp"
#include "tcframe/evaluator.hpp"
#include "tcframe/os.hpp"
#include "tcframe/runner/aggregator.hpp"
#include "tcframe/runner/evaluator.hpp"
#include "tcframe/runner/generator.hpp"
#include "tcframe/runner/grader.hpp"
#include "tcframe/runner/logger.hpp"
Expand Down
13 changes: 13 additions & 0 deletions include/tcframe/runner/evaluator.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include "tcframe/runner/evaluator/BatchEvaluator.hpp"
#include "tcframe/runner/evaluator/EvaluationOptions.hpp"
#include "tcframe/runner/evaluator/EvaluationResult.hpp"
#include "tcframe/runner/evaluator/Evaluator.hpp"
#include "tcframe/runner/evaluator/EvaluatorConfig.hpp"
#include "tcframe/runner/evaluator/EvaluatorHelperRegistry.hpp"
#include "tcframe/runner/evaluator/EvaluatorRegistry.hpp"
#include "tcframe/runner/evaluator/GenerationResult.hpp"
#include "tcframe/runner/evaluator/InteractiveEvaluator.hpp"
#include "tcframe/runner/evaluator/communicator.hpp"
#include "tcframe/runner/evaluator/scorer.hpp"
File renamed without changes.
4 changes: 4 additions & 0 deletions include/tcframe/runner/evaluator/communicator.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#pragma once

#include "tcframe/runner/evaluator/communicator/CommunicationResult.hpp"
#include "tcframe/runner/evaluator/communicator/Communicator.hpp"
6 changes: 6 additions & 0 deletions include/tcframe/runner/evaluator/scorer.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

#include "tcframe/runner/evaluator/scorer/CustomScorer.hpp"
#include "tcframe/runner/evaluator/scorer/DiffScorer.hpp"
#include "tcframe/runner/evaluator/scorer/Scorer.hpp"
#include "tcframe/runner/evaluator/scorer/ScoringResult.hpp"
File renamed without changes.
2 changes: 1 addition & 1 deletion include/tcframe/runner/generator/TestCaseGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include "GenerationException.hpp"
#include "GenerationOptions.hpp"
#include "GeneratorLogger.hpp"
#include "tcframe/evaluator.hpp"
#include "tcframe/os.hpp"
#include "tcframe/runner/evaluator.hpp"
#include "tcframe/spec.hpp"
#include "tcframe/verdict.hpp"

Expand Down
2 changes: 1 addition & 1 deletion include/tcframe/runner/grader/TestCaseGrader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "GradingOptions.hpp"
#include "GraderLogger.hpp"
#include "tcframe/evaluator.hpp"
#include "tcframe/runner/evaluator.hpp"
#include "tcframe/util.hpp"
#include "tcframe/verdict.hpp"

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

#include <cstdlib>

#include "tcframe/evaluator/communicator/Communicator.hpp"
#include "tcframe/runner/evaluator/communicator/Communicator.hpp"

using ::testing::Eq;
using ::testing::HasSubstr;
Expand All @@ -16,27 +16,27 @@ class CommunicatorIntegrationTests : public Test {
Communicator communicator = Communicator(
new OperatingSystem(),
new VerdictCreator(),
"test-integration/evaluator/communicator/communicator");
"test-integration/runner/evaluator/communicator/communicator");

static void SetUpTestCase() {
system(
"g++ -o "
"test-integration/evaluator/communicator/communicator "
"test-integration/evaluator/communicator/communicator.cpp");
"test-integration/runner/evaluator/communicator/communicator "
"test-integration/runner/evaluator/communicator/communicator.cpp");
}
};

TEST_F(CommunicatorIntegrationTests, Communication) {
system(
"g++ -o "
"test-integration/evaluator/communicator/contestant "
"test-integration/evaluator/communicator/contestant.cpp");
"test-integration/runner/evaluator/communicator/contestant "
"test-integration/runner/evaluator/communicator/contestant.cpp");

EvaluationOptions options = EvaluationOptionsBuilder()
.setSolutionCommand("test-integration/evaluator/communicator/contestant")
.setSolutionCommand("test-integration/runner/evaluator/communicator/contestant")
.build();
CommunicationResult result = communicator.communicate(
"test-integration/evaluator/communicator/judge.in",
"test-integration/runner/evaluator/communicator/judge.in",
options);
EXPECT_THAT(result.verdict(), Eq(Verdict(VerdictStatus::ac())));
EXPECT_THAT(result.executionResult().standardError(), IsEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <cstdlib>

#include "tcframe/evaluator/scorer/CustomScorer.hpp"
#include "tcframe/runner/evaluator/scorer/CustomScorer.hpp"

using ::testing::AllOf;
using ::testing::Eq;
Expand All @@ -17,21 +17,21 @@ class CustomScorerIntegrationTests : public Test {
CustomScorer scorer = CustomScorer(
new OperatingSystem(),
new VerdictCreator(),
"test-integration/evaluator/scorer/custom/scorer");
"test-integration/runner/evaluator/scorer/custom/scorer");

static void SetUpTestCase() {
system(
"g++ -o "
"test-integration/evaluator/scorer/custom/scorer "
"test-integration/evaluator/scorer/custom/scorer.cpp");
"test-integration/runner/evaluator/scorer/custom/scorer "
"test-integration/runner/evaluator/scorer/custom/scorer.cpp");
}
};

TEST_F(CustomScorerIntegrationTests, Scoring) {
ScoringResult result = scorer.score(
"test-integration/evaluator/scorer/judge.in",
"test-integration/evaluator/scorer/judge.out",
"test-integration/evaluator/scorer/custom/contestant.out");
"test-integration/runner/evaluator/scorer/judge.in",
"test-integration/runner/evaluator/scorer/judge.out",
"test-integration/runner/evaluator/scorer/custom/contestant.out");
EXPECT_THAT(result.verdict(), Eq(Verdict(VerdictStatus::ac())));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "gmock/gmock.h"

#include "tcframe/evaluator/scorer/DiffScorer.hpp"
#include "tcframe/runner/evaluator/scorer/DiffScorer.hpp"

using ::testing::AllOf;
using ::testing::Eq;
Expand All @@ -19,17 +19,17 @@ class DiffScorerIntegrationTests : public Test {
TEST_F(DiffScorerIntegrationTests, Scoring_AC) {
ScoringResult result = scorer.score(
"",
"test-integration/evaluator/scorer/judge.out",
"test-integration/evaluator/scorer/diff/contestant_ac.out");
"test-integration/runner/evaluator/scorer/judge.out",
"test-integration/runner/evaluator/scorer/diff/contestant_ac.out");
EXPECT_THAT(result.verdict(), Eq(Verdict(VerdictStatus::ac())));
EXPECT_THAT(result.executionResult().standardError(), IsEmpty());
}

TEST_F(DiffScorerIntegrationTests, Scoring_WA) {
ScoringResult result = scorer.score(
"",
"test-integration/evaluator/scorer/judge.out",
"test-integration/evaluator/scorer/diff/contestant_wa.out");
"test-integration/runner/evaluator/scorer/judge.out",
"test-integration/runner/evaluator/scorer/diff/contestant_wa.out");
EXPECT_THAT(result.verdict(), Eq(Verdict(VerdictStatus::wa())));

EXPECT_THAT(result.executionResult().standardError(), AllOf(
Expand Down
4 changes: 2 additions & 2 deletions test/unit/tcframe/runner/core/BaseRunnerTests.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "gmock/gmock.h"
#include "../../mock.hpp"

#include "../../evaluator/MockEvaluator.hpp"
#include "../../evaluator/MockEvaluatorRegistry.hpp"
#include "../../os/MockOperatingSystem.hpp"
#include "../../runner/aggregator/MockAggregator.hpp"
#include "../../runner/aggregator/MockAggregatorRegistry.hpp"
#include "../../runner/evaluator/MockEvaluator.hpp"
#include "../../runner/evaluator/MockEvaluatorRegistry.hpp"
#include "../../runner/generator/MockGenerator.hpp"
#include "../../runner/grader/MockGrader.hpp"
#include "../../runner/grader/MockGraderLogger.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "gmock/gmock.h"
#include "../mock.hpp"
#include "../../mock.hpp"

#include <sstream>

#include "../os/MockOperatingSystem.hpp"
#include "../verdict/MockVerdictCreator.hpp"
#include "../../os/MockOperatingSystem.hpp"
#include "../../verdict/MockVerdictCreator.hpp"
#include "scorer/MockScorer.hpp"
#include "tcframe/evaluator/BatchEvaluator.hpp"
#include "tcframe/runner/evaluator/BatchEvaluator.hpp"

using ::testing::_;
using ::testing::AllOf;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "gmock/gmock.h"
#include "../mock.hpp"
#include "../../mock.hpp"

#include "./communicator/MockCommunicator.hpp"
#include "tcframe/evaluator/InteractiveEvaluator.hpp"
#include "tcframe/runner/evaluator/InteractiveEvaluator.hpp"

using ::testing::Eq;
using ::testing::Return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "gmock/gmock.h"

#include "tcframe/evaluator/Evaluator.hpp"
#include "tcframe/runner/evaluator/Evaluator.hpp"

namespace tcframe {

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

#include "gmock/gmock.h"

#include "tcframe/evaluator/EvaluatorRegistry.hpp"
#include "tcframe/runner/evaluator/EvaluatorRegistry.hpp"

namespace tcframe {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "gmock/gmock.h"
#include "../../mock.hpp"
#include "../../../mock.hpp"

#include <sstream>

#include "../../os/MockOperatingSystem.hpp"
#include "../../verdict/MockVerdictCreator.hpp"
#include "tcframe/evaluator/communicator/Communicator.hpp"
#include "../../../os/MockOperatingSystem.hpp"
#include "../../../verdict/MockVerdictCreator.hpp"
#include "tcframe/runner/evaluator/communicator/Communicator.hpp"

using ::testing::_;
using ::testing::Eq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "gmock/gmock.h"

#include "tcframe/evaluator/communicator/Communicator.hpp"
#include "tcframe/runner/evaluator/communicator/Communicator.hpp"

namespace tcframe {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "gmock/gmock.h"
#include "../../mock.hpp"
#include "../../../mock.hpp"

#include <sstream>

#include "../../os/MockOperatingSystem.hpp"
#include "../../verdict/MockVerdictCreator.hpp"
#include "tcframe/evaluator/scorer/CustomScorer.hpp"
#include "../../../os/MockOperatingSystem.hpp"
#include "../../../verdict/MockVerdictCreator.hpp"
#include "tcframe/runner/evaluator/scorer/CustomScorer.hpp"

using ::testing::_;
using ::testing::Eq;
Expand Down

0 comments on commit d76baed

Please sign in to comment.