From eab757daf322cf5f25a2a9e43462ba82e5947bf9 Mon Sep 17 00:00:00 2001 From: Ashar Fuadi Date: Fri, 16 Dec 2016 09:51:04 +0000 Subject: [PATCH] Relax NoOutput() + CustomScorer() constraints --- ete-test/resources/multi-no-output/spec.cpp | 1 - ete-test/resources/normal-no-output/spec.cpp | 1 - include/tcframe/spec/core/StyleConfig.hpp | 6 ------ test/tcframe/spec/core/BaseProblemSpecTests.cpp | 16 ---------------- 4 files changed, 24 deletions(-) diff --git a/ete-test/resources/multi-no-output/spec.cpp b/ete-test/resources/multi-no-output/spec.cpp index 4a363738..4ba5cf99 100644 --- a/ete-test/resources/multi-no-output/spec.cpp +++ b/ete-test/resources/multi-no-output/spec.cpp @@ -13,7 +13,6 @@ class ProblemSpec : public BaseProblemSpec { } void StyleConfig() { - CustomScorer(); NoOutput(); } diff --git a/ete-test/resources/normal-no-output/spec.cpp b/ete-test/resources/normal-no-output/spec.cpp index 09f76aa5..aed13700 100644 --- a/ete-test/resources/normal-no-output/spec.cpp +++ b/ete-test/resources/normal-no-output/spec.cpp @@ -12,7 +12,6 @@ class ProblemSpec : public BaseProblemSpec { } void StyleConfig() { - CustomScorer(); NoOutput(); } diff --git a/include/tcframe/spec/core/StyleConfig.hpp b/include/tcframe/spec/core/StyleConfig.hpp index eebfe576..c0dc20cf 100644 --- a/include/tcframe/spec/core/StyleConfig.hpp +++ b/include/tcframe/spec/core/StyleConfig.hpp @@ -1,13 +1,11 @@ #pragma once -#include #include #include #include "CommonConfig.hpp" using std::move; -using std::runtime_error; using std::tie; namespace tcframe { @@ -56,10 +54,6 @@ class StyleConfigBuilder { } StyleConfig build() { - if (!subject_.needsOutput_ && !subject_.needsCustomScorer_) { - throw runtime_error("Problem that does not need output must need custom scorer"); - } - return move(subject_); } }; diff --git a/test/tcframe/spec/core/BaseProblemSpecTests.cpp b/test/tcframe/spec/core/BaseProblemSpecTests.cpp index ca26bfbe..1091f870 100644 --- a/test/tcframe/spec/core/BaseProblemSpecTests.cpp +++ b/test/tcframe/spec/core/BaseProblemSpecTests.cpp @@ -57,13 +57,6 @@ class BaseProblemSpecTests : public Test { } }; - class ProblemSpecWithIllegalStyleConfig : public ProblemSpec { - protected: - void StyleConfig() { - NoOutput(); - } - }; - class ProblemSpecWithMultipleTestCasesConfig : public ProblemSpec { protected: void MultipleTestCasesConfig() { @@ -118,15 +111,6 @@ TEST_F(BaseProblemSpecTests, StyleConfig) { EXPECT_FALSE(config.needsOutput()); } -TEST_F(BaseProblemSpecTests, StyleConfig_Illegal) { - try { - ProblemSpecWithIllegalStyleConfig().buildStyleConfig(); - FAIL(); - } catch (runtime_error& e) { - EXPECT_THAT(e.what(), StrEq("Problem that does not need output must need custom scorer")); - } -} - TEST_F(BaseProblemSpecTests, MultipleTestCasesConfig) { MultipleTestCasesConfig config = ProblemSpecWithMultipleTestCasesConfig().buildMultipleTestCasesConfig(); EXPECT_TRUE(config.counter());