Commit 484730bc by alokp@chromium.org

Removed the unnecessary usage of GTEST_HAS_PARAM_TEST and GTEST_HAS_COMBINE. I…

Removed the unnecessary usage of GTEST_HAS_PARAM_TEST and GTEST_HAS_COMBINE. I would rather have tests fail to compile than be silently ignored. git-svn-id: https://angleproject.googlecode.com/svn/trunk@1098 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent fc8b7200
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
#include "PreprocessorTest.h" #include "PreprocessorTest.h"
#include "Token.h" #include "Token.h"
#if GTEST_HAS_PARAM_TEST
class CharTest : public PreprocessorTest, class CharTest : public PreprocessorTest,
public testing::WithParamInterface<int> public testing::WithParamInterface<int>
{ {
...@@ -98,4 +96,3 @@ TEST_P(CharTest, Identified) ...@@ -98,4 +96,3 @@ TEST_P(CharTest, Identified)
INSTANTIATE_TEST_CASE_P(All, CharTest, INSTANTIATE_TEST_CASE_P(All, CharTest,
testing::Range(CHAR_MIN, CHAR_MAX + 1)); testing::Range(CHAR_MIN, CHAR_MAX + 1));
#endif // GTEST_HAS_PARAM_TEST
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include "PreprocessorTest.h" #include "PreprocessorTest.h"
#include "Token.h" #include "Token.h"
#if GTEST_HAS_PARAM_TEST
class CommentTest : public PreprocessorTest, class CommentTest : public PreprocessorTest,
public testing::WithParamInterface<const char*> public testing::WithParamInterface<const char*>
{ {
...@@ -40,8 +38,6 @@ INSTANTIATE_TEST_CASE_P(BlockComment, CommentTest, ...@@ -40,8 +38,6 @@ INSTANTIATE_TEST_CASE_P(BlockComment, CommentTest,
"/***/", // With lone '*'. "/***/", // With lone '*'.
"/*\"*/")); // Invalid character. "/*\"*/")); // Invalid character.
#endif // GTEST_HAS_PARAM_TEST
class BlockCommentTest : public PreprocessorTest class BlockCommentTest : public PreprocessorTest
{ {
}; };
......
...@@ -73,8 +73,6 @@ TEST_F(ExtensionTest, MissingNewline) ...@@ -73,8 +73,6 @@ TEST_F(ExtensionTest, MissingNewline)
preprocess(str); preprocess(str);
} }
#if GTEST_HAS_PARAM_TEST
struct ExtensionTestParam struct ExtensionTestParam
{ {
const char* str; const char* str;
...@@ -109,5 +107,3 @@ static const ExtensionTestParam kParams[] = { ...@@ -109,5 +107,3 @@ static const ExtensionTestParam kParams[] = {
{"#extension foo : bar baz\n", pp::Diagnostics::UNEXPECTED_TOKEN} {"#extension foo : bar baz\n", pp::Diagnostics::UNEXPECTED_TOKEN}
}; };
INSTANTIATE_TEST_CASE_P(All, InvalidExtensionTest, testing::ValuesIn(kParams)); INSTANTIATE_TEST_CASE_P(All, InvalidExtensionTest, testing::ValuesIn(kParams));
#endif // GTEST_HAS_PARAM_TEST
\ No newline at end of file
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include "PreprocessorTest.h" #include "PreprocessorTest.h"
#include "Token.h" #include "Token.h"
#define CLOSED_RANGE(x, y) testing::Range(x, static_cast<char>((y) + 1))
class IdentifierTest : public PreprocessorTest class IdentifierTest : public PreprocessorTest
{ {
protected: protected:
...@@ -22,10 +24,6 @@ protected: ...@@ -22,10 +24,6 @@ protected:
} }
}; };
#if GTEST_HAS_PARAM_TEST
#define CLOSED_RANGE(x, y) testing::Range(x, static_cast<char>((y) + 1))
class SingleLetterIdentifierTest : public IdentifierTest, class SingleLetterIdentifierTest : public IdentifierTest,
public testing::WithParamInterface<char> public testing::WithParamInterface<char>
{ {
...@@ -53,10 +51,6 @@ INSTANTIATE_TEST_CASE_P(A_Z, ...@@ -53,10 +51,6 @@ INSTANTIATE_TEST_CASE_P(A_Z,
SingleLetterIdentifierTest, SingleLetterIdentifierTest,
CLOSED_RANGE('A', 'Z')); CLOSED_RANGE('A', 'Z'));
#endif // GTEST_HAS_PARAM_TEST
#if GTEST_HAS_COMBINE
typedef std::tr1::tuple<char, char> IdentifierParams; typedef std::tr1::tuple<char, char> IdentifierParams;
class DoubleLetterIdentifierTest : class DoubleLetterIdentifierTest :
public IdentifierTest, public IdentifierTest,
...@@ -146,8 +140,6 @@ INSTANTIATE_TEST_CASE_P(A_Z_0_9, ...@@ -146,8 +140,6 @@ INSTANTIATE_TEST_CASE_P(A_Z_0_9,
testing::Combine(CLOSED_RANGE('A', 'Z'), testing::Combine(CLOSED_RANGE('A', 'Z'),
CLOSED_RANGE('0', '9'))); CLOSED_RANGE('0', '9')));
#endif // GTEST_HAS_COMBINE
// The tests above cover one-letter and various combinations of two-letter // The tests above cover one-letter and various combinations of two-letter
// identifier names. This test covers all characters in a single string. // identifier names. This test covers all characters in a single string.
TEST_F(IdentifierTest, AllLetters) TEST_F(IdentifierTest, AllLetters)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "PreprocessorTest.h" #include "PreprocessorTest.h"
#include "Token.h" #include "Token.h"
#if GTEST_HAS_PARAM_TEST #define CLOSED_RANGE(x, y) testing::Range(x, static_cast<char>((y) + 1))
class InvalidNumberTest : public PreprocessorTest, class InvalidNumberTest : public PreprocessorTest,
public testing::WithParamInterface<const char*> public testing::WithParamInterface<const char*>
...@@ -33,10 +33,6 @@ INSTANTIATE_TEST_CASE_P(InvalidIntegers, InvalidNumberTest, ...@@ -33,10 +33,6 @@ INSTANTIATE_TEST_CASE_P(InvalidIntegers, InvalidNumberTest,
INSTANTIATE_TEST_CASE_P(InvalidFloats, InvalidNumberTest, INSTANTIATE_TEST_CASE_P(InvalidFloats, InvalidNumberTest,
testing::Values("1eg", "0.a", "0.1.2", ".0a", ".0.1")); testing::Values("1eg", "0.a", "0.1.2", ".0a", ".0.1"));
#endif // GTEST_HAS_PARAM_TEST
#if GTEST_HAS_COMBINE
typedef std::tr1::tuple<const char*, char> IntegerParams; typedef std::tr1::tuple<const char*, char> IntegerParams;
class IntegerTest : public PreprocessorTest, class IntegerTest : public PreprocessorTest,
public testing::WithParamInterface<IntegerParams> public testing::WithParamInterface<IntegerParams>
...@@ -57,8 +53,6 @@ TEST_P(IntegerTest, Identified) ...@@ -57,8 +53,6 @@ TEST_P(IntegerTest, Identified)
EXPECT_EQ(str, token.value); EXPECT_EQ(str, token.value);
} }
#define CLOSED_RANGE(x, y) testing::Range(x, static_cast<char>((y) + 1))
INSTANTIATE_TEST_CASE_P(DecimalInteger, INSTANTIATE_TEST_CASE_P(DecimalInteger,
IntegerTest, IntegerTest,
testing::Combine(testing::Values(""), testing::Combine(testing::Values(""),
...@@ -167,8 +161,6 @@ INSTANTIATE_TEST_CASE_P(FloatFraction_X_0, ...@@ -167,8 +161,6 @@ INSTANTIATE_TEST_CASE_P(FloatFraction_X_0,
testing::Combine(CLOSED_RANGE('0', '9'), testing::Combine(CLOSED_RANGE('0', '9'),
testing::Values('\0'))); testing::Values('\0')));
#endif // GTEST_HAS_COMBINE
// In the tests above we have tested individual parts of a float separately. // In the tests above we have tested individual parts of a float separately.
// This test has all parts of a float. // This test has all parts of a float.
TEST_F(FloatTest, FractionScientific) TEST_F(FloatTest, FractionScientific)
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include "PreprocessorTest.h" #include "PreprocessorTest.h"
#include "Token.h" #include "Token.h"
#if GTEST_HAS_PARAM_TEST
struct OperatorTestParam struct OperatorTestParam
{ {
const char* str; const char* str;
...@@ -80,4 +78,3 @@ static const OperatorTestParam kOperators[] = { ...@@ -80,4 +78,3 @@ static const OperatorTestParam kOperators[] = {
INSTANTIATE_TEST_CASE_P(All, OperatorTest, INSTANTIATE_TEST_CASE_P(All, OperatorTest,
testing::ValuesIn(kOperators)); testing::ValuesIn(kOperators));
#endif // GTEST_HAS_PARAM_TEST
...@@ -101,8 +101,6 @@ TEST_F(PragmaTest, MissingNewline) ...@@ -101,8 +101,6 @@ TEST_F(PragmaTest, MissingNewline)
preprocess(str); preprocess(str);
} }
#if GTEST_HAS_PARAM_TEST
class InvalidPragmaTest : public PragmaTest, class InvalidPragmaTest : public PragmaTest,
public testing::WithParamInterface<const char*> public testing::WithParamInterface<const char*>
{ {
...@@ -130,5 +128,3 @@ INSTANTIATE_TEST_CASE_P(All, InvalidPragmaTest, testing::Values( ...@@ -130,5 +128,3 @@ INSTANTIATE_TEST_CASE_P(All, InvalidPragmaTest, testing::Values(
"#pragma foo(bar\n", // Missing right paren. "#pragma foo(bar\n", // Missing right paren.
"#pragma foo bar\n", // Missing parens. "#pragma foo bar\n", // Missing parens.
"#pragma foo(bar) baz\n")); // Extra tokens. "#pragma foo(bar) baz\n")); // Extra tokens.
#endif // GTEST_HAS_PARAM_TEST
\ No newline at end of file
...@@ -29,8 +29,6 @@ class SpaceTest : public PreprocessorTest ...@@ -29,8 +29,6 @@ class SpaceTest : public PreprocessorTest
// Note that newline characters (\n) will be tested separately. // Note that newline characters (\n) will be tested separately.
static const char kSpaceChars[] = {' ', '\t', '\v', '\f'}; static const char kSpaceChars[] = {' ', '\t', '\v', '\f'};
#if GTEST_HAS_PARAM_TEST
// This test fixture tests the processing of a single whitespace character. // This test fixture tests the processing of a single whitespace character.
// All tests in this fixture are ran with all possible whitespace character // All tests in this fixture are ran with all possible whitespace character
// allowed in GLSL. // allowed in GLSL.
...@@ -52,10 +50,6 @@ INSTANTIATE_TEST_CASE_P(SingleSpaceChar, ...@@ -52,10 +50,6 @@ INSTANTIATE_TEST_CASE_P(SingleSpaceChar,
SpaceCharTest, SpaceCharTest,
testing::ValuesIn(kSpaceChars)); testing::ValuesIn(kSpaceChars));
#endif // GTEST_HAS_PARAM_TEST
#if GTEST_HAS_COMBINE
// This test fixture tests the processing of a string containing consecutive // This test fixture tests the processing of a string containing consecutive
// whitespace characters. All tests in this fixture are ran with all possible // whitespace characters. All tests in this fixture are ran with all possible
// combinations of whitespace characters allowed in GLSL. // combinations of whitespace characters allowed in GLSL.
...@@ -83,8 +77,6 @@ INSTANTIATE_TEST_CASE_P(SpaceCharCombination, ...@@ -83,8 +77,6 @@ INSTANTIATE_TEST_CASE_P(SpaceCharCombination,
testing::ValuesIn(kSpaceChars), testing::ValuesIn(kSpaceChars),
testing::ValuesIn(kSpaceChars))); testing::ValuesIn(kSpaceChars)));
#endif // GTEST_HAS_COMBINE
// The tests above make sure that the space char is recorded in the // The tests above make sure that the space char is recorded in the
// next token. This test makes sure that a token is not incorrectly marked // next token. This test makes sure that a token is not incorrectly marked
// to have leading space. // to have leading space.
......
...@@ -70,8 +70,6 @@ TEST_F(VersionTest, MissingNewline) ...@@ -70,8 +70,6 @@ TEST_F(VersionTest, MissingNewline)
lex(); lex();
} }
#if GTEST_HAS_PARAM_TEST
struct VersionTestParam struct VersionTestParam
{ {
const char* str; const char* str;
...@@ -104,5 +102,3 @@ static const VersionTestParam kParams[] = { ...@@ -104,5 +102,3 @@ static const VersionTestParam kParams[] = {
}; };
INSTANTIATE_TEST_CASE_P(All, InvalidVersionTest, testing::ValuesIn(kParams)); INSTANTIATE_TEST_CASE_P(All, InvalidVersionTest, testing::ValuesIn(kParams));
#endif // GTEST_HAS_PARAM_TEST
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment