Skip to content

Commit

Permalink
Improve GraderTests by adding tests for non-AC final verdict
Browse files Browse the repository at this point in the history
  • Loading branch information
fushar committed Dec 14, 2016
1 parent fc23480 commit e06e5fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions test/tcframe/grader/GraderTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ class GraderTests : public Test {
TestCase tc4 = TestUtils::createFakeTestCase("foo_4_1", {4});
TestCase tc5 = TestUtils::createFakeTestCase("foo_4_2", {4});

TestSuite testSuite = TestSuite({
TestSuite testSuiteAC = TestSuite({
TestGroup(0, {stcA}),
TestGroup(-1, {tcA})});
TestSuite testSuiteNonAC = TestSuite({
TestGroup(0, {stcA}),
TestGroup(-1, {tcA, tcB})});
ConstraintSuite constraintSuite = ConstraintSuite(
Expand Down Expand Up @@ -80,20 +83,25 @@ class GraderTests : public Test {

int GraderTests::T;

TEST_F(GraderTests, Grading) {
TEST_F(GraderTests, Grading_AC) {
{
InSequence sequence;
EXPECT_CALL(logger, logIntroduction());
EXPECT_CALL(logger, logTestGroupIntroduction(0));
EXPECT_CALL(testCaseGrader, grade(stcA, config));
EXPECT_CALL(logger, logTestGroupIntroduction(-1));
EXPECT_CALL(testCaseGrader, grade(tcA, config));
EXPECT_CALL(testCaseGrader, grade(tcB, config));

EXPECT_CALL(logger, logResult(map<int, Verdict>{
{-1, Verdict::ac()}}));
}
grader.grade(testSuite, constraintSuite, config);
grader.grade(testSuiteAC, constraintSuite, config);
}

TEST_F(GraderTests, Grading_NonAC) {
EXPECT_CALL(logger, logResult(map<int, Verdict>{
{-1, Verdict::rte()}}));
grader.grade(testSuiteNonAC, constraintSuite, config);
}

TEST_F(GraderTests, Grading_WithSubtasks) {
Expand Down
2 changes: 1 addition & 1 deletion test/tcframe/util/TestUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace tcframe {
class TestUtils {
public:
static TestCase createFakeTestCase(string id) {
return TestCaseBuilder().setId(id).build();
return createFakeTestCase(id, {-1});
}

static TestCase createFakeTestCase(string id, set<int> subtaskIds) {
Expand Down

0 comments on commit e06e5fe

Please sign in to comment.