Commit f84ef70b by Zhenyao Mo

Restructure the tests gyp so they can be included in chromium

BUG= R=alokp@chromium.org, kbr@chromium.org Review URL: https://codereview.appspot.com/13429045
parent 300b1eb5
...@@ -35,6 +35,12 @@ ...@@ -35,6 +35,12 @@
'gtest', 'gtest',
'gmock', 'gmock',
], ],
'variables': {
'ANGLE_DIR': '..',
},
'includes': [
'preprocessor_tests/preprocessor_tests.gypi',
]
'include_dirs': [ 'include_dirs': [
'../src/compiler/preprocessor', '../src/compiler/preprocessor',
'../third_party/googletest/include', '../third_party/googletest/include',
...@@ -42,35 +48,23 @@ ...@@ -42,35 +48,23 @@
], ],
'sources': [ 'sources': [
'../third_party/googlemock/src/gmock_main.cc', '../third_party/googlemock/src/gmock_main.cc',
'preprocessor_tests/char_test.cpp',
'preprocessor_tests/comment_test.cpp',
'preprocessor_tests/define_test.cpp',
'preprocessor_tests/error_test.cpp',
'preprocessor_tests/extension_test.cpp',
'preprocessor_tests/identifier_test.cpp',
'preprocessor_tests/if_test.cpp',
'preprocessor_tests/input_test.cpp',
'preprocessor_tests/location_test.cpp',
'preprocessor_tests/MockDiagnostics.h',
'preprocessor_tests/MockDirectiveHandler.h',
'preprocessor_tests/number_test.cpp',
'preprocessor_tests/operator_test.cpp',
'preprocessor_tests/pragma_test.cpp',
'preprocessor_tests/PreprocessorTest.cpp',
'preprocessor_tests/PreprocessorTest.h',
'preprocessor_tests/space_test.cpp',
'preprocessor_tests/token_test.cpp',
'preprocessor_tests/version_test.cpp',
], ],
}, },
{ {
'target_name': 'compiler_tests', 'target_name': 'compiler_tests',
'type': 'executable', 'type': 'executable',
'dependencies': [ 'dependencies':
'../src/build_angle.gyp:translator_common',
'../src/build_angle.gyp:translator_glsl', '../src/build_angle.gyp:translator_glsl',
'gtest', 'gtest',
'gmock', 'gmock',
], ],
'variables': {
'ANGLE_DIR': '..',
},
'includes': [
'compiler_tests/compiler_tests.gypi',
]
'include_dirs': [ 'include_dirs': [
'../include', '../include',
'../src', '../src',
...@@ -79,8 +73,6 @@ ...@@ -79,8 +73,6 @@
], ],
'sources': [ 'sources': [
'../third_party/googlemock/src/gmock_main.cc', '../third_party/googlemock/src/gmock_main.cc',
'compiler_tests/ExpressionLimit_test.cpp',
'compiler_tests/VariablePacker_test.cpp',
], ],
}, },
], ],
......
# Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'sources': [
'<(ANGLE_DIR)/tests/compiler_tests/ExpressionLimit_test.cpp',
'<(ANGLE_DIR)/tests/compiler_tests/VariablePacker_test.cpp',
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
...@@ -34,15 +34,15 @@ TEST_F(InitTest, NullString) ...@@ -34,15 +34,15 @@ TEST_F(InitTest, NullString)
TEST(InputTest, DefaultConstructor) TEST(InputTest, DefaultConstructor)
{ {
pp::Input input; pp::Input input;
EXPECT_EQ(0, input.count()); EXPECT_EQ(0u, input.count());
EXPECT_EQ(0, input.read(NULL, 1)); EXPECT_EQ(0u, input.read(NULL, 1));
} }
TEST(InputTest, NullLength) TEST(InputTest, NullLength)
{ {
const char* str[] = {"foo"}; const char* str[] = {"foo"};
pp::Input input(1, str, NULL); pp::Input input(1, str, NULL);
EXPECT_EQ(3, input.length(0)); EXPECT_EQ(3u, input.length(0));
} }
TEST(InputTest, NegativeLength) TEST(InputTest, NegativeLength)
...@@ -50,7 +50,7 @@ TEST(InputTest, NegativeLength) ...@@ -50,7 +50,7 @@ TEST(InputTest, NegativeLength)
const char* str[] = {"foo"}; const char* str[] = {"foo"};
int length[] = {-1}; int length[] = {-1};
pp::Input input(1, str, length); pp::Input input(1, str, length);
EXPECT_EQ(3, input.length(0)); EXPECT_EQ(3u, input.length(0));
} }
TEST(InputTest, ActualLength) TEST(InputTest, ActualLength)
...@@ -60,7 +60,7 @@ TEST(InputTest, ActualLength) ...@@ -60,7 +60,7 @@ TEST(InputTest, ActualLength)
pp::Input input(1, str, length); pp::Input input(1, str, length);
// Note that strlen(str[0]) != length[0]. // Note that strlen(str[0]) != length[0].
// Even then Input should just accept any non-negative number. // Even then Input should just accept any non-negative number.
EXPECT_EQ(length[0], input.length(0)); EXPECT_EQ(static_cast<size_t>(length[0]), input.length(0));
} }
TEST(InputTest, String) TEST(InputTest, String)
...@@ -78,33 +78,33 @@ TEST(InputTest, ReadSingleString) ...@@ -78,33 +78,33 @@ TEST(InputTest, ReadSingleString)
int maxSize = 1; int maxSize = 1;
pp::Input input1(count, str, NULL); pp::Input input1(count, str, NULL);
EXPECT_EQ(1, input1.read(buf, maxSize)); EXPECT_EQ(1u, input1.read(buf, maxSize));
EXPECT_EQ('f', buf[0]); EXPECT_EQ('f', buf[0]);
EXPECT_EQ(1, input1.read(buf, maxSize)); EXPECT_EQ(1u, input1.read(buf, maxSize));
EXPECT_EQ('o', buf[0]); EXPECT_EQ('o', buf[0]);
EXPECT_EQ(1, input1.read(buf, maxSize)); EXPECT_EQ(1u, input1.read(buf, maxSize));
EXPECT_EQ('o', buf[0]); EXPECT_EQ('o', buf[0]);
EXPECT_EQ(0, input1.read(buf, maxSize)); EXPECT_EQ(0u, input1.read(buf, maxSize));
maxSize = 2; maxSize = 2;
pp::Input input2(count, str, NULL); pp::Input input2(count, str, NULL);
EXPECT_EQ(2, input2.read(buf, maxSize)); EXPECT_EQ(2u, input2.read(buf, maxSize));
EXPECT_STREQ("fo", buf); EXPECT_STREQ("fo", buf);
EXPECT_EQ(1, input2.read(buf, maxSize)); EXPECT_EQ(1u, input2.read(buf, maxSize));
EXPECT_EQ('o', buf[0]); EXPECT_EQ('o', buf[0]);
EXPECT_EQ(0, input2.read(buf, maxSize)); EXPECT_EQ(0u, input2.read(buf, maxSize));
maxSize = 3; maxSize = 3;
pp::Input input3(count, str, NULL); pp::Input input3(count, str, NULL);
EXPECT_EQ(3, input3.read(buf, maxSize)); EXPECT_EQ(3u, input3.read(buf, maxSize));
EXPECT_STREQ("foo", buf); EXPECT_STREQ("foo", buf);
EXPECT_EQ(0, input3.read(buf, maxSize)); EXPECT_EQ(0u, input3.read(buf, maxSize));
maxSize = 4; maxSize = 4;
pp::Input input4(count, str, NULL); pp::Input input4(count, str, NULL);
EXPECT_EQ(3, input4.read(buf, maxSize)); EXPECT_EQ(3u, input4.read(buf, maxSize));
EXPECT_STREQ("foo", buf); EXPECT_STREQ("foo", buf);
EXPECT_EQ(0, input4.read(buf, maxSize)); EXPECT_EQ(0u, input4.read(buf, maxSize));
} }
TEST(InputTest, ReadMultipleStrings) TEST(InputTest, ReadMultipleStrings)
...@@ -115,33 +115,33 @@ TEST(InputTest, ReadMultipleStrings) ...@@ -115,33 +115,33 @@ TEST(InputTest, ReadMultipleStrings)
int maxSize = 1; int maxSize = 1;
pp::Input input1(count, str, NULL); pp::Input input1(count, str, NULL);
EXPECT_EQ(1, input1.read(buf, maxSize)); EXPECT_EQ(1u, input1.read(buf, maxSize));
EXPECT_EQ('f', buf[0]); EXPECT_EQ('f', buf[0]);
EXPECT_EQ(1, input1.read(buf, maxSize)); EXPECT_EQ(1u, input1.read(buf, maxSize));
EXPECT_EQ('o', buf[0]); EXPECT_EQ('o', buf[0]);
EXPECT_EQ(1, input1.read(buf, maxSize)); EXPECT_EQ(1u, input1.read(buf, maxSize));
EXPECT_EQ('o', buf[0]); EXPECT_EQ('o', buf[0]);
EXPECT_EQ(0, input1.read(buf, maxSize)); EXPECT_EQ(0u, input1.read(buf, maxSize));
maxSize = 2; maxSize = 2;
pp::Input input2(count, str, NULL); pp::Input input2(count, str, NULL);
EXPECT_EQ(2, input2.read(buf, maxSize)); EXPECT_EQ(2u, input2.read(buf, maxSize));
EXPECT_STREQ("fo", buf); EXPECT_STREQ("fo", buf);
EXPECT_EQ(1, input2.read(buf, maxSize)); EXPECT_EQ(1u, input2.read(buf, maxSize));
EXPECT_EQ('o', buf[0]); EXPECT_EQ('o', buf[0]);
EXPECT_EQ(0, input2.read(buf, maxSize)); EXPECT_EQ(0u, input2.read(buf, maxSize));
maxSize = 3; maxSize = 3;
pp::Input input3(count, str, NULL); pp::Input input3(count, str, NULL);
EXPECT_EQ(3, input3.read(buf, maxSize)); EXPECT_EQ(3u, input3.read(buf, maxSize));
EXPECT_STREQ("foo", buf); EXPECT_STREQ("foo", buf);
EXPECT_EQ(0, input3.read(buf, maxSize)); EXPECT_EQ(0u, input3.read(buf, maxSize));
maxSize = 4; maxSize = 4;
pp::Input input4(count, str, NULL); pp::Input input4(count, str, NULL);
EXPECT_EQ(3, input4.read(buf, maxSize)); EXPECT_EQ(3u, input4.read(buf, maxSize));
EXPECT_STREQ("foo", buf); EXPECT_STREQ("foo", buf);
EXPECT_EQ(0, input4.read(buf, maxSize)); EXPECT_EQ(0u, input4.read(buf, maxSize));
} }
TEST(InputTest, ReadStringsWithLength) TEST(InputTest, ReadStringsWithLength)
...@@ -152,7 +152,7 @@ TEST(InputTest, ReadStringsWithLength) ...@@ -152,7 +152,7 @@ TEST(InputTest, ReadStringsWithLength)
// strlen(str[0]. We want to make sure that the last character is ignored. // strlen(str[0]. We want to make sure that the last character is ignored.
int length[] = {2, 3}; int length[] = {2, 3};
char buf[6] = {'\0', '\0', '\0', '\0', '\0', '\0'}; char buf[6] = {'\0', '\0', '\0', '\0', '\0', '\0'};
int maxSize = 5; size_t maxSize = 5;
pp::Input input(count, str, length); pp::Input input(count, str, length);
EXPECT_EQ(maxSize, input.read(buf, maxSize)); EXPECT_EQ(maxSize, input.read(buf, maxSize));
......
# Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'sources': [
'<(ANGLE_DIR)/tests/preprocessor_tests/char_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/comment_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/define_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/error_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/extension_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/identifier_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/if_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/input_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/location_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/MockDiagnostics.h',
'<(ANGLE_DIR)/tests/preprocessor_tests/MockDirectiveHandler.h',
'<(ANGLE_DIR)/tests/preprocessor_tests/number_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/operator_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/pragma_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/PreprocessorTest.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/PreprocessorTest.h',
'<(ANGLE_DIR)/tests/preprocessor_tests/space_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/token_test.cpp',
'<(ANGLE_DIR)/tests/preprocessor_tests/version_test.cpp',
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
...@@ -12,7 +12,7 @@ TEST(TokenTest, DefaultConstructor) ...@@ -12,7 +12,7 @@ TEST(TokenTest, DefaultConstructor)
{ {
pp::Token token; pp::Token token;
EXPECT_EQ(0, token.type); EXPECT_EQ(0, token.type);
EXPECT_EQ(0, token.flags); EXPECT_EQ(0u, token.flags);
EXPECT_EQ(0, token.location.line); EXPECT_EQ(0, token.location.line);
EXPECT_EQ(0, token.location.file); EXPECT_EQ(0, token.location.file);
EXPECT_EQ("", token.text); EXPECT_EQ("", token.text);
...@@ -29,7 +29,7 @@ TEST(TokenTest, Assignment) ...@@ -29,7 +29,7 @@ TEST(TokenTest, Assignment)
token = pp::Token(); token = pp::Token();
EXPECT_EQ(0, token.type); EXPECT_EQ(0, token.type);
EXPECT_EQ(0, token.flags); EXPECT_EQ(0u, token.flags);
EXPECT_EQ(0, token.location.line); EXPECT_EQ(0, token.location.line);
EXPECT_EQ(0, token.location.file); EXPECT_EQ(0, token.location.file);
EXPECT_EQ("", token.text); EXPECT_EQ("", token.text);
......
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