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
diff --git a/tests/build_tests.gyp b/tests/build_tests.gyp
index c80a444..42a69ab 100644
--- a/tests/build_tests.gyp
+++ b/tests/build_tests.gyp
@@ -35,6 +35,12 @@
'gtest',
'gmock',
],
+ 'variables': {
+ 'ANGLE_DIR': '..',
+ },
+ 'includes': [
+ 'preprocessor_tests/preprocessor_tests.gypi',
+ ]
'include_dirs': [
'../src/compiler/preprocessor',
'../third_party/googletest/include',
@@ -42,35 +48,23 @@
],
'sources': [
'../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',
'type': 'executable',
- 'dependencies': [
+ 'dependencies':
+ '../src/build_angle.gyp:translator_common',
'../src/build_angle.gyp:translator_glsl',
'gtest',
'gmock',
],
+ 'variables': {
+ 'ANGLE_DIR': '..',
+ },
+ 'includes': [
+ 'compiler_tests/compiler_tests.gypi',
+ ]
'include_dirs': [
'../include',
'../src',
@@ -79,8 +73,6 @@
],
'sources': [
'../third_party/googlemock/src/gmock_main.cc',
- 'compiler_tests/ExpressionLimit_test.cpp',
- 'compiler_tests/VariablePacker_test.cpp',
],
},
],
diff --git a/tests/compiler_tests/compiler_tests.gypi b/tests/compiler_tests/compiler_tests.gypi
new file mode 100644
index 0000000..2a5e85d
--- /dev/null
+++ b/tests/compiler_tests/compiler_tests.gypi
@@ -0,0 +1,18 @@
+# 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:
+
diff --git a/tests/preprocessor_tests/input_test.cpp b/tests/preprocessor_tests/input_test.cpp
index b6a132a..3c23729 100644
--- a/tests/preprocessor_tests/input_test.cpp
+++ b/tests/preprocessor_tests/input_test.cpp
@@ -34,15 +34,15 @@
TEST(InputTest, DefaultConstructor)
{
pp::Input input;
- EXPECT_EQ(0, input.count());
- EXPECT_EQ(0, input.read(NULL, 1));
+ EXPECT_EQ(0u, input.count());
+ EXPECT_EQ(0u, input.read(NULL, 1));
}
TEST(InputTest, NullLength)
{
const char* str[] = {"foo"};
pp::Input input(1, str, NULL);
- EXPECT_EQ(3, input.length(0));
+ EXPECT_EQ(3u, input.length(0));
}
TEST(InputTest, NegativeLength)
@@ -50,7 +50,7 @@
const char* str[] = {"foo"};
int length[] = {-1};
pp::Input input(1, str, length);
- EXPECT_EQ(3, input.length(0));
+ EXPECT_EQ(3u, input.length(0));
}
TEST(InputTest, ActualLength)
@@ -60,7 +60,7 @@
pp::Input input(1, str, length);
// Note that strlen(str[0]) != length[0].
// 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)
@@ -78,33 +78,33 @@
int maxSize = 1;
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(1, input1.read(buf, maxSize));
+ EXPECT_EQ(1u, input1.read(buf, maxSize));
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(0, input1.read(buf, maxSize));
+ EXPECT_EQ(0u, input1.read(buf, maxSize));
maxSize = 2;
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_EQ(1, input2.read(buf, maxSize));
+ EXPECT_EQ(1u, input2.read(buf, maxSize));
EXPECT_EQ('o', buf[0]);
- EXPECT_EQ(0, input2.read(buf, maxSize));
+ EXPECT_EQ(0u, input2.read(buf, maxSize));
maxSize = 3;
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_EQ(0, input3.read(buf, maxSize));
+ EXPECT_EQ(0u, input3.read(buf, maxSize));
maxSize = 4;
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_EQ(0, input4.read(buf, maxSize));
+ EXPECT_EQ(0u, input4.read(buf, maxSize));
}
TEST(InputTest, ReadMultipleStrings)
@@ -115,33 +115,33 @@
int maxSize = 1;
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(1, input1.read(buf, maxSize));
+ EXPECT_EQ(1u, input1.read(buf, maxSize));
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(0, input1.read(buf, maxSize));
+ EXPECT_EQ(0u, input1.read(buf, maxSize));
maxSize = 2;
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_EQ(1, input2.read(buf, maxSize));
+ EXPECT_EQ(1u, input2.read(buf, maxSize));
EXPECT_EQ('o', buf[0]);
- EXPECT_EQ(0, input2.read(buf, maxSize));
+ EXPECT_EQ(0u, input2.read(buf, maxSize));
maxSize = 3;
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_EQ(0, input3.read(buf, maxSize));
+ EXPECT_EQ(0u, input3.read(buf, maxSize));
maxSize = 4;
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_EQ(0, input4.read(buf, maxSize));
+ EXPECT_EQ(0u, input4.read(buf, maxSize));
}
TEST(InputTest, ReadStringsWithLength)
@@ -152,7 +152,7 @@
// strlen(str[0]. We want to make sure that the last character is ignored.
int length[] = {2, 3};
char buf[6] = {'\0', '\0', '\0', '\0', '\0', '\0'};
- int maxSize = 5;
+ size_t maxSize = 5;
pp::Input input(count, str, length);
EXPECT_EQ(maxSize, input.read(buf, maxSize));
diff --git a/tests/preprocessor_tests/preprocessor_tests.gypi b/tests/preprocessor_tests/preprocessor_tests.gypi
new file mode 100644
index 0000000..daf560d
--- /dev/null
+++ b/tests/preprocessor_tests/preprocessor_tests.gypi
@@ -0,0 +1,35 @@
+# 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:
+
diff --git a/tests/preprocessor_tests/token_test.cpp b/tests/preprocessor_tests/token_test.cpp
index 323d468..22898e7 100644
--- a/tests/preprocessor_tests/token_test.cpp
+++ b/tests/preprocessor_tests/token_test.cpp
@@ -12,7 +12,7 @@
{
pp::Token token;
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.file);
EXPECT_EQ("", token.text);
@@ -29,7 +29,7 @@
token = pp::Token();
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.file);
EXPECT_EQ("", token.text);