├── .gitignore ├── COPYING ├── Makefile ├── README.markdown ├── base ├── basictypes.h ├── callback-types.h ├── callback.cc ├── callback.h ├── integral_types.h ├── logging.h ├── macros.h ├── scoped_ptr.h ├── stl_decl.h ├── stl_decl_linux.h ├── stl_decl_osx.h ├── stringpiece.cc ├── stringpiece.h ├── stringprintf.cc ├── stringprintf.h ├── targets.mk ├── template_util.h ├── timer.cc ├── timer.h └── type_traits.h ├── file ├── file_utils.cc ├── file_utils.h └── targets.mk ├── gjstest ├── internal │ ├── cpp │ │ ├── builtin_data.cc │ │ ├── builtin_data.h │ │ ├── generate_builtin_paths.sh │ │ ├── gjstest.cc │ │ ├── run_tests.cc │ │ ├── run_tests.h │ │ ├── targets.mk │ │ ├── test_case.cc │ │ ├── test_case.h │ │ ├── typed_arrays.cc │ │ ├── typed_arrays.h │ │ ├── v8_utils.cc │ │ ├── v8_utils.h │ │ └── v8_utils_test.cc │ ├── integration_tests │ │ ├── README │ │ ├── exception.golden.txt │ │ ├── exception.golden.xml │ │ ├── exception_test.js │ │ ├── failing.golden.txt │ │ ├── failing.golden.xml │ │ ├── failing_test.js │ │ ├── integration_test.cc │ │ ├── mocks.golden.txt │ │ ├── mocks.golden.xml │ │ ├── mocks_test.js │ │ ├── passing.golden.txt │ │ ├── passing.golden.xml │ │ ├── passing_test.js │ │ ├── registration.golden.txt │ │ ├── registration.golden.xml │ │ ├── registration_test.js │ │ ├── syntax_error.golden.txt │ │ ├── syntax_error.golden.xml │ │ ├── syntax_error.js │ │ ├── targets.mk │ │ ├── typed_arrays.golden.txt │ │ ├── typed_arrays.golden.xml │ │ └── typed_arrays_test.js │ ├── js │ │ ├── browser │ │ │ ├── browser.css │ │ │ ├── html_builder.js │ │ │ ├── html_builder_test.js │ │ │ ├── run_tests.js │ │ │ └── targets.mk │ │ ├── call_expectation.js │ │ ├── call_expectation_test.js │ │ ├── error_utils.js │ │ ├── error_utils_test.js │ │ ├── expect_that.js │ │ ├── expect_that_test.js │ │ ├── mock_function.js │ │ ├── mock_function_test.js │ │ ├── mock_instance.js │ │ ├── mock_instance_test.js │ │ ├── namespace.js │ │ ├── run_test.js │ │ ├── slice.js │ │ ├── stack_frame.js │ │ ├── stack_utils.js │ │ ├── stack_utils_test.js │ │ ├── targets.mk │ │ ├── test_environment.js │ │ ├── test_environment_test.js │ │ └── use_global_namespace.js │ └── proto │ │ ├── named_scripts.proto │ │ └── targets.mk └── public │ ├── actions.js │ ├── actions_test.js │ ├── assertions.js │ ├── logging.js │ ├── matcher_types.js │ ├── matchers │ ├── array_matchers.js │ ├── array_matchers_test.js │ ├── boolean_matchers.js │ ├── boolean_matchers_test.js │ ├── combining_matchers.js │ ├── combining_matchers_test.js │ ├── equality_matchers.js │ ├── equality_matchers_test.js │ ├── function_matchers.js │ ├── function_matchers_test.js │ ├── missing_arg_matchers.js │ ├── missing_arg_matchers_test.js │ ├── number_matchers.js │ ├── number_matchers_test.js │ ├── string_matchers.js │ ├── string_matchers_test.js │ └── targets.mk │ ├── mocking.js │ ├── mocking_test.js │ ├── register.js │ ├── register_test.js │ ├── stringify.js │ ├── stringify_test.js │ └── targets.mk ├── scripts ├── cc_binary_build.sh ├── cc_library_make_header_deps_file.sh ├── cc_library_make_object_deps_file.sh ├── cc_rules.mk ├── cc_test_run.sh ├── js_library_check_compile.sh ├── js_library_make_deps_file.sh ├── js_rules.mk ├── js_test_run.sh └── proto_rules.mk ├── strings ├── ascii_ctype.cc ├── ascii_ctype.h ├── strutil.cc ├── strutil.h └── targets.mk ├── third_party ├── cityhash │ ├── city.cc │ ├── city.h │ ├── city_test.cc │ ├── citycrc.h │ └── targets.mk └── gmock │ ├── CHANGES │ ├── CMakeLists.txt │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── Makefile.am │ ├── Makefile.in │ ├── README │ ├── aclocal.m4 │ ├── build-aux │ ├── config.guess │ ├── config.h.in │ ├── config.sub │ ├── depcomp │ ├── install-sh │ ├── ltmain.sh │ └── missing │ ├── configure │ ├── configure.ac │ ├── fused-src │ ├── gmock-gtest-all.cc │ ├── gmock │ │ └── gmock.h │ ├── gmock_main.cc │ └── gtest │ │ └── gtest.h │ ├── gtest │ ├── CHANGES │ ├── CMakeLists.txt │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── Makefile.am │ ├── Makefile.in │ ├── README │ ├── aclocal.m4 │ ├── build-aux │ │ ├── config.guess │ │ ├── config.h.in │ │ ├── config.sub │ │ ├── depcomp │ │ ├── install-sh │ │ ├── ltmain.sh │ │ └── missing │ ├── cmake │ │ └── internal_utils.cmake │ ├── codegear │ │ ├── gtest.cbproj │ │ ├── gtest.groupproj │ │ ├── gtest_all.cc │ │ ├── gtest_link.cc │ │ ├── gtest_main.cbproj │ │ └── gtest_unittest.cbproj │ ├── configure │ ├── configure.ac │ ├── fused-src │ │ └── gtest │ │ │ ├── gtest-all.cc │ │ │ ├── gtest.h │ │ │ └── gtest_main.cc │ ├── include │ │ └── gtest │ │ │ ├── gtest-death-test.h │ │ │ ├── gtest-message.h │ │ │ ├── gtest-param-test.h │ │ │ ├── gtest-param-test.h.pump │ │ │ ├── gtest-printers.h │ │ │ ├── gtest-spi.h │ │ │ ├── gtest-test-part.h │ │ │ ├── gtest-typed-test.h │ │ │ ├── gtest.h │ │ │ ├── gtest_pred_impl.h │ │ │ ├── gtest_prod.h │ │ │ └── internal │ │ │ ├── gtest-death-test-internal.h │ │ │ ├── gtest-filepath.h │ │ │ ├── gtest-internal.h │ │ │ ├── gtest-linked_ptr.h │ │ │ ├── gtest-param-util-generated.h │ │ │ ├── gtest-param-util-generated.h.pump │ │ │ ├── gtest-param-util.h │ │ │ ├── gtest-port.h │ │ │ ├── gtest-string.h │ │ │ ├── gtest-tuple.h │ │ │ ├── gtest-tuple.h.pump │ │ │ ├── gtest-type-util.h │ │ │ └── gtest-type-util.h.pump │ ├── m4 │ │ ├── acx_pthread.m4 │ │ ├── gtest.m4 │ │ ├── libtool.m4 │ │ ├── ltoptions.m4 │ │ ├── ltsugar.m4 │ │ ├── ltversion.m4 │ │ └── lt~obsolete.m4 │ ├── make │ │ └── Makefile │ ├── msvc │ │ ├── gtest-md.sln │ │ ├── gtest-md.vcproj │ │ ├── gtest.sln │ │ ├── gtest.vcproj │ │ ├── gtest_main-md.vcproj │ │ ├── gtest_main.vcproj │ │ ├── gtest_prod_test-md.vcproj │ │ ├── gtest_prod_test.vcproj │ │ ├── gtest_unittest-md.vcproj │ │ └── gtest_unittest.vcproj │ ├── samples │ │ ├── prime_tables.h │ │ ├── sample1.cc │ │ ├── sample1.h │ │ ├── sample10_unittest.cc │ │ ├── sample1_unittest.cc │ │ ├── sample2.cc │ │ ├── sample2.h │ │ ├── sample2_unittest.cc │ │ ├── sample3-inl.h │ │ ├── sample3_unittest.cc │ │ ├── sample4.cc │ │ ├── sample4.h │ │ ├── sample4_unittest.cc │ │ ├── sample5_unittest.cc │ │ ├── sample6_unittest.cc │ │ ├── sample7_unittest.cc │ │ ├── sample8_unittest.cc │ │ └── sample9_unittest.cc │ ├── scripts │ │ ├── fuse_gtest_files.py │ │ ├── gen_gtest_pred_impl.py │ │ ├── gtest-config.in │ │ ├── pump.py │ │ └── test │ │ │ └── Makefile │ ├── src │ │ ├── gtest-all.cc │ │ ├── gtest-death-test.cc │ │ ├── gtest-filepath.cc │ │ ├── gtest-internal-inl.h │ │ ├── gtest-port.cc │ │ ├── gtest-printers.cc │ │ ├── gtest-test-part.cc │ │ ├── gtest-typed-test.cc │ │ ├── gtest.cc │ │ └── gtest_main.cc │ ├── test │ │ ├── gtest-death-test_ex_test.cc │ │ ├── gtest-death-test_test.cc │ │ ├── gtest-filepath_test.cc │ │ ├── gtest-linked_ptr_test.cc │ │ ├── gtest-listener_test.cc │ │ ├── gtest-message_test.cc │ │ ├── gtest-options_test.cc │ │ ├── gtest-param-test2_test.cc │ │ ├── gtest-param-test_test.cc │ │ ├── gtest-param-test_test.h │ │ ├── gtest-port_test.cc │ │ ├── gtest-printers_test.cc │ │ ├── gtest-test-part_test.cc │ │ ├── gtest-tuple_test.cc │ │ ├── gtest-typed-test2_test.cc │ │ ├── gtest-typed-test_test.cc │ │ ├── gtest-typed-test_test.h │ │ ├── gtest-unittest-api_test.cc │ │ ├── gtest_all_test.cc │ │ ├── gtest_break_on_failure_unittest.py │ │ ├── gtest_break_on_failure_unittest_.cc │ │ ├── gtest_catch_exceptions_test.py │ │ ├── gtest_catch_exceptions_test_.cc │ │ ├── gtest_color_test.py │ │ ├── gtest_color_test_.cc │ │ ├── gtest_env_var_test.py │ │ ├── gtest_env_var_test_.cc │ │ ├── gtest_environment_test.cc │ │ ├── gtest_filter_unittest.py │ │ ├── gtest_filter_unittest_.cc │ │ ├── gtest_help_test.py │ │ ├── gtest_help_test_.cc │ │ ├── gtest_list_tests_unittest.py │ │ ├── gtest_list_tests_unittest_.cc │ │ ├── gtest_main_unittest.cc │ │ ├── gtest_no_test_unittest.cc │ │ ├── gtest_output_test.py │ │ ├── gtest_output_test_.cc │ │ ├── gtest_output_test_golden_lin.txt │ │ ├── gtest_pred_impl_unittest.cc │ │ ├── gtest_premature_exit_test.cc │ │ ├── gtest_prod_test.cc │ │ ├── gtest_repeat_test.cc │ │ ├── gtest_shuffle_test.py │ │ ├── gtest_shuffle_test_.cc │ │ ├── gtest_sole_header_test.cc │ │ ├── gtest_stress_test.cc │ │ ├── gtest_test_utils.py │ │ ├── gtest_throw_on_failure_ex_test.cc │ │ ├── gtest_throw_on_failure_test.py │ │ ├── gtest_throw_on_failure_test_.cc │ │ ├── gtest_uninitialized_test.py │ │ ├── gtest_uninitialized_test_.cc │ │ ├── gtest_unittest.cc │ │ ├── gtest_xml_outfile1_test_.cc │ │ ├── gtest_xml_outfile2_test_.cc │ │ ├── gtest_xml_outfiles_test.py │ │ ├── gtest_xml_output_unittest.py │ │ ├── gtest_xml_output_unittest_.cc │ │ ├── gtest_xml_test_utils.py │ │ ├── production.cc │ │ └── production.h │ └── xcode │ │ ├── Config │ │ ├── DebugProject.xcconfig │ │ ├── FrameworkTarget.xcconfig │ │ ├── General.xcconfig │ │ ├── ReleaseProject.xcconfig │ │ ├── StaticLibraryTarget.xcconfig │ │ └── TestTarget.xcconfig │ │ ├── Resources │ │ └── Info.plist │ │ ├── Samples │ │ └── FrameworkSample │ │ │ ├── Info.plist │ │ │ ├── WidgetFramework.xcodeproj │ │ │ └── project.pbxproj │ │ │ ├── runtests.sh │ │ │ ├── widget.cc │ │ │ ├── widget.h │ │ │ └── widget_test.cc │ │ ├── Scripts │ │ ├── runtests.sh │ │ └── versiongenerate.py │ │ └── gtest.xcodeproj │ │ └── project.pbxproj │ ├── include │ └── gmock │ │ ├── gmock-actions.h │ │ ├── gmock-cardinalities.h │ │ ├── gmock-generated-actions.h │ │ ├── gmock-generated-actions.h.pump │ │ ├── gmock-generated-function-mockers.h │ │ ├── gmock-generated-function-mockers.h.pump │ │ ├── gmock-generated-matchers.h │ │ ├── gmock-generated-matchers.h.pump │ │ ├── gmock-generated-nice-strict.h │ │ ├── gmock-generated-nice-strict.h.pump │ │ ├── gmock-matchers.h │ │ ├── gmock-more-actions.h │ │ ├── gmock-more-matchers.h │ │ ├── gmock-spec-builders.h │ │ ├── gmock.h │ │ └── internal │ │ ├── gmock-generated-internal-utils.h │ │ ├── gmock-generated-internal-utils.h.pump │ │ ├── gmock-internal-utils.h │ │ └── gmock-port.h │ ├── make │ └── Makefile │ ├── msvc │ ├── 2005 │ │ ├── gmock.sln │ │ ├── gmock.vcproj │ │ ├── gmock_config.vsprops │ │ ├── gmock_main.vcproj │ │ └── gmock_test.vcproj │ └── 2010 │ │ ├── gmock.sln │ │ ├── gmock.vcxproj │ │ ├── gmock_config.props │ │ ├── gmock_main.vcxproj │ │ └── gmock_test.vcxproj │ ├── scripts │ ├── fuse_gmock_files.py │ ├── generator │ │ ├── LICENSE │ │ ├── README │ │ ├── README.cppclean │ │ ├── cpp │ │ │ ├── __init__.py │ │ │ ├── ast.py │ │ │ ├── gmock_class.py │ │ │ ├── keywords.py │ │ │ ├── tokenize.py │ │ │ └── utils.py │ │ └── gmock_gen.py │ └── gmock-config.in │ ├── src │ ├── gmock-all.cc │ ├── gmock-cardinalities.cc │ ├── gmock-internal-utils.cc │ ├── gmock-matchers.cc │ ├── gmock-spec-builders.cc │ ├── gmock.cc │ └── gmock_main.cc │ └── test │ ├── gmock-actions_test.cc │ ├── gmock-cardinalities_test.cc │ ├── gmock-generated-actions_test.cc │ ├── gmock-generated-function-mockers_test.cc │ ├── gmock-generated-internal-utils_test.cc │ ├── gmock-generated-matchers_test.cc │ ├── gmock-internal-utils_test.cc │ ├── gmock-matchers_test.cc │ ├── gmock-more-actions_test.cc │ ├── gmock-nice-strict_test.cc │ ├── gmock-port_test.cc │ ├── gmock-spec-builders_test.cc │ ├── gmock_all_test.cc │ ├── gmock_ex_test.cc │ ├── gmock_leak_test.py │ ├── gmock_leak_test_.cc │ ├── gmock_link2_test.cc │ ├── gmock_link_test.cc │ ├── gmock_link_test.h │ ├── gmock_output_test.py │ ├── gmock_output_test_.cc │ ├── gmock_output_test_golden.txt │ ├── gmock_stress_test.cc │ ├── gmock_test.cc │ └── gmock_test_utils.py ├── util └── gtl │ ├── map_util.h │ └── targets.mk └── webutil └── xml ├── targets.mk ├── xml_writer.cc ├── xml_writer.h └── xml_writer_test.cc /.gitignore: -------------------------------------------------------------------------------- 1 | # Things built by make. 2 | *.a 3 | *.bin 4 | *.compile 5 | *.deps 6 | *.generated.h 7 | *.generated.cc 8 | *.header_deps 9 | *.o 10 | *.object_deps 11 | *test.out 12 | share/ 13 | 14 | # Generated proto buffer code. 15 | *.pb.cc 16 | *.pb.h 17 | -------------------------------------------------------------------------------- /base/basictypes.h: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #ifndef BASE_BASICTYPES_H_ 17 | #define BASE_BASICTYPES_H_ 18 | 19 | #include 20 | #include 21 | 22 | #include "base/integral_types.h" 23 | 24 | using std::string; 25 | using std::vector; 26 | 27 | #endif // BASE_BASICTYPES_H_ 28 | -------------------------------------------------------------------------------- /base/callback-types.h: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | #ifndef BASE_CALLBACK_TYPES_H_ 15 | #define BASE_CALLBACK_TYPES_H_ 16 | 17 | #include "base/callback.h" 18 | 19 | // This file is defined for compatibility reasons. 20 | 21 | #endif // BASE_CALLBACK_TYPES_H_ 22 | -------------------------------------------------------------------------------- /base/callback.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | #include "base/callback.h" 15 | 16 | namespace gjstest { 17 | 18 | void CallbackUtils_::FailIsRepeatable(const char* name) { 19 | LOG(FATAL) << "A " << name << " made with NewCallback() " 20 | "is not a repeatable callback!"; 21 | } 22 | } // namespace gjstest 23 | -------------------------------------------------------------------------------- /base/logging.h: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #ifndef BASE_LOGGING_H_ 17 | #define BASE_LOGGING_H_ 18 | 19 | // Redirect to glog. 20 | #include 21 | 22 | #endif // BASE_LOGGING_H_ 23 | -------------------------------------------------------------------------------- /base/stl_decl.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 1999 and onwards Google, Inc. 2 | // 3 | // DEPRECATED: This file is deprecated. Do not use in new code. 4 | // Be careful about removing from old code, though, because your 5 | // header file might be included by higher-level code that is 6 | // accidentally depending on this. This file has no impact in linux 7 | // compilations; you can safely remove dependencies from linux code. 8 | // 9 | // Original file level comment: 10 | // In most .h files, we would rather include a declaration of an stl 11 | // rather than including the appropriate stl h file (which brings in 12 | // lots of crap). For many STL classes this is ok (eg pair), but for 13 | // some it's really annoying. We define those here, so you can 14 | // just include this file instead of having to deal with the annoyance. 15 | // 16 | // Most of the annoyance, btw, has to do with the default allocator. 17 | // 18 | 19 | #ifndef BASE_STL_DECL_H_ 20 | #define BASE_STL_DECL_H_ 21 | 22 | #if defined(STL_MSVC) /* If VC++'s STL */ 23 | #include "base/stl_decl_msvc.h" 24 | 25 | #elif defined(__APPLE__) /* gcc with a twist */ 26 | #include "base/stl_decl_osx.h" 27 | 28 | #elif defined(__linux__) || defined(__FreeBSD__) 29 | #include "base/stl_decl_linux.h" 30 | 31 | #else 32 | #error "Unsupported OS." 33 | #endif 34 | 35 | #endif // BASE_STL_DECL_H_ 36 | -------------------------------------------------------------------------------- /base/stl_decl_linux.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 and onwards Google, Inc. 3 | // 4 | // 5 | // NOTE(jacobsa): A hacked up stl_decl.h for Linux. This should probably be done 6 | // better. 7 | // 8 | // Don't include this directly. 9 | 10 | #ifndef _STL_DECL_LINUX_H 11 | #define _STL_DECL_LINUX_H 12 | 13 | #include 14 | #include 15 | using std::min; 16 | using std::max; 17 | using std::swap; 18 | using std::reverse; 19 | 20 | #include 21 | using std::string; 22 | 23 | #include 24 | using std::vector; 25 | 26 | #include 27 | using std::less; 28 | 29 | #include 30 | using std::pair; 31 | using std::make_pair; 32 | 33 | #include 34 | using std::set; 35 | using std::multiset; 36 | 37 | #include 38 | #include 39 | #include 40 | using std::ostream; 41 | using std::cout; 42 | using std::endl; 43 | 44 | #include 45 | using std::map; 46 | using std::multimap; 47 | 48 | #include 49 | using std::priority_queue; 50 | 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | using std::string; 57 | 58 | #include 59 | #include 60 | 61 | using namespace std; 62 | using __gnu_cxx::hash; 63 | using __gnu_cxx::hash_set; 64 | using __gnu_cxx::hash_map; 65 | using __gnu_cxx::select1st; 66 | 67 | /* On Linux (and gdrive on LINUX), this comes from places like 68 | google3/third_party/stl/gcc3/new. On LINUX using "builtin" 69 | stl headers, however, it does not get defined. */ 70 | #ifndef __STL_USE_STD_ALLOCATORS 71 | #define __STL_USE_STD_ALLOCATORS 1 72 | #endif 73 | 74 | 75 | #ifndef HASH_NAMESPACE 76 | /* We can't define it here; it's too late. */ 77 | #error "HASH_NAMESPACE needs to be defined in the Makefile". 78 | #endif 79 | 80 | #endif /* _STL_DECL_LINUX_H */ 81 | -------------------------------------------------------------------------------- /base/stl_decl_osx.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 and onwards Google, Inc. 3 | // 4 | // 5 | // MacOSX-specific STL help, mirroring examples in stl_decl_msvc.h et 6 | // al. Although this convention is apparently deprecated (see mec's 7 | // comments in stl_decl_msvc.h), it is the consistent way of getting 8 | // google3 happy on OSX. 9 | // 10 | // Don't include this directly. 11 | 12 | #ifndef _STL_DECL_OSX_H 13 | #define _STL_DECL_OSX_H 14 | 15 | #if !defined(__APPLE__) 16 | #error "This file is only for MacOSX." 17 | #endif 18 | 19 | #include 20 | #include 21 | using std::min; 22 | using std::max; 23 | using std::swap; 24 | using std::reverse; 25 | 26 | #include 27 | using std::string; 28 | 29 | #include 30 | using std::vector; 31 | 32 | #include 33 | using std::less; 34 | 35 | #include 36 | using std::pair; 37 | using std::make_pair; 38 | 39 | #include 40 | using std::set; 41 | using std::multiset; 42 | 43 | #include 44 | #include 45 | #include 46 | using std::ostream; 47 | using std::cout; 48 | using std::endl; 49 | 50 | #include 51 | using std::map; 52 | using std::multimap; 53 | 54 | #include 55 | using std::priority_queue; 56 | 57 | #include 58 | #include 59 | #include 60 | using std::string; 61 | 62 | using namespace std; 63 | 64 | /* On Linux (and gdrive on OSX), this comes from places like 65 | google3/third_party/stl/gcc3/new. On OSX using "builtin" 66 | stl headers, however, it does not get defined. */ 67 | #ifndef __STL_USE_STD_ALLOCATORS 68 | #define __STL_USE_STD_ALLOCATORS 1 69 | #endif 70 | 71 | 72 | #ifndef HASH_NAMESPACE 73 | /* We can't define it here; it's too late. */ 74 | #error "HASH_NAMESPACE needs to be defined in the Makefile". 75 | #endif 76 | 77 | #endif /* _STL_DECL_OSX_H */ 78 | -------------------------------------------------------------------------------- /base/stringprintf.h: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | #ifndef BASE_STRINGPRINTF_H_ 15 | #define BASE_STRINGPRINTF_H_ 16 | 17 | #include 18 | 19 | std::string StringPrintf(const char* const format, ...); 20 | void SStringPrintf(std::string* const dst, const char* const format, ...); 21 | void StringAppendF(std::string* const dst, const char* const format, ...); 22 | 23 | #endif // BASE_STRINGPRINTF_H_ 24 | -------------------------------------------------------------------------------- /base/targets.mk: -------------------------------------------------------------------------------- 1 | $(eval $(call hdr_only_cc_library, \ 2 | base/basictypes, \ 3 | base/integral_types \ 4 | )) 5 | 6 | $(eval $(call cc_library, \ 7 | base/callback, \ 8 | base/logging \ 9 | )) 10 | 11 | $(eval $(call hdr_only_cc_library, \ 12 | base/callback-types, \ 13 | base/callback \ 14 | )) 15 | 16 | $(eval $(call hdr_only_cc_library, \ 17 | base/integral_types, \ 18 | )) 19 | 20 | $(eval $(call hdr_only_cc_library, \ 21 | base/logging, \ 22 | )) 23 | 24 | $(eval $(call hdr_only_cc_library, \ 25 | base/macros, \ 26 | base/type_traits \ 27 | )) 28 | 29 | $(eval $(call hdr_only_cc_library, \ 30 | base/scoped_ptr, \ 31 | base/basictypes \ 32 | base/macros \ 33 | )) 34 | 35 | $(eval $(call hdr_only_cc_library, \ 36 | base/stl_decl, \ 37 | base/stl_decl_linux \ 38 | base/stl_decl_osx \ 39 | )) 40 | 41 | $(eval $(call hdr_only_cc_library, \ 42 | base/stl_decl_linux, \ 43 | )) 44 | 45 | $(eval $(call hdr_only_cc_library, \ 46 | base/stl_decl_osx, \ 47 | )) 48 | 49 | $(eval $(call cc_library, \ 50 | base/stringpiece, \ 51 | )) 52 | 53 | $(eval $(call cc_library, \ 54 | base/stringprintf, \ 55 | )) 56 | 57 | $(eval $(call hdr_only_cc_library, \ 58 | base/template_util, \ 59 | )) 60 | 61 | $(eval $(call cc_library, \ 62 | base/timer, \ 63 | base/integral_types \ 64 | base/logging \ 65 | base/macros \ 66 | )) 67 | 68 | $(eval $(call hdr_only_cc_library, \ 69 | base/type_traits, \ 70 | base/template_util \ 71 | )) 72 | -------------------------------------------------------------------------------- /base/timer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | #ifndef BASE_TIMER_H_ 15 | #define BASE_TIMER_H_ 16 | 17 | #include "base/integral_types.h" 18 | #include "base/macros.h" 19 | 20 | class WallTimer { 21 | public: 22 | WallTimer(); 23 | 24 | void Start(); 25 | void Stop(); 26 | bool Reset(); 27 | void Restart(); 28 | bool IsRunning() const; 29 | int64 GetInMs() const; 30 | double Get() const; 31 | static int64 GetTimeInMicroSeconds(); 32 | 33 | private: 34 | int64 start_usec_; // start time in microseconds. 35 | int64 sum_usec_; // sum of time diffs in microseconds. 36 | bool has_started_; 37 | 38 | DISALLOW_COPY_AND_ASSIGN(WallTimer); 39 | }; 40 | 41 | // This class of timer is very precise and potentially more expensive than 42 | // the WallTimer class. 43 | class CycleTimer { 44 | public: 45 | CycleTimer(); 46 | void Reset(); 47 | void Start(); 48 | void Stop(); 49 | int64 GetInUsec() const; 50 | int64 GetInMs() const; 51 | private: 52 | enum State { 53 | INIT, 54 | STARTED, 55 | STOPPED 56 | }; 57 | int64 time_in_us_; 58 | State state_; 59 | }; 60 | #endif // BASE_TIMER_H_ 61 | -------------------------------------------------------------------------------- /file/file_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | // Utility functions for dealing with files. 17 | 18 | #ifndef FILE_FILE_UTILS_H_ 19 | #define FILE_FILE_UTILS_H_ 20 | 21 | #include "base/basictypes.h" 22 | 23 | // Return the contents of the file at the given path, crashing on failure. 24 | string ReadFileOrDie(const string& path); 25 | 26 | // Write the supplied string to the given path, crashing on failure. 27 | void WriteStringToFileOrDie(const string& str, const string& path); 28 | 29 | // Strip an optional directory name from the supplied path, returning only the 30 | // file name. 31 | string Basename(const string& path); 32 | 33 | // Recursively find all regular files in the supplied directory. 34 | void FindFiles(const string& directory, vector* files); 35 | 36 | #endif // FILE_FILE_UTILS_H_ 37 | -------------------------------------------------------------------------------- /file/targets.mk: -------------------------------------------------------------------------------- 1 | $(eval $(call cc_library, \ 2 | file/file_utils, \ 3 | base/basictypes \ 4 | base/integral_types \ 5 | base/logging \ 6 | base/macros \ 7 | )) 8 | -------------------------------------------------------------------------------- /gjstest/internal/cpp/builtin_data.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #include 17 | 18 | #include "base/logging.h" 19 | #include "base/macros.h" 20 | #include "file/file_utils.h" 21 | #include "gjstest/internal/cpp/builtin_data.h" 22 | #include "gjstest/internal/cpp/builtin_paths.generated.h" 23 | #include "gjstest/internal/proto/named_scripts.pb.h" 24 | #include "strings/strutil.h" 25 | 26 | // The default data directory, which must be set at compilation time. 27 | #ifndef DEFAULT_DATA_DIR 28 | #error "You must specify DEFAULT_DATA_DIR when compiling." 29 | #endif 30 | 31 | #define DOUBLE_STRINGIFY(x) STRINGIFY(x) 32 | #define STRINGIFY(x) #x 33 | 34 | DEFINE_string(data_dir, DOUBLE_STRINGIFY(DEFAULT_DATA_DIR), 35 | "A path containing built-in test dependencies."); 36 | 37 | namespace gjstest { 38 | 39 | static string GetPath( 40 | const string& relative_path) { 41 | return FLAGS_data_dir + "/" + relative_path; 42 | } 43 | 44 | bool GetBuiltinScripts( 45 | NamedScripts* scripts, 46 | string* error) { 47 | // Attempt to get absolute paths for each built-in script. 48 | std::vector paths; 49 | if (!GetBuiltinScriptPaths(&paths, error)) { 50 | return false; 51 | } 52 | 53 | // Load each script. 54 | for (uint32 i = 0; i < paths.size(); ++i) { 55 | const string& path = paths[i]; 56 | 57 | NamedScript* script = scripts->add_script(); 58 | script->set_name(Basename(path)); 59 | script->set_source(ReadFileOrDie(path)); 60 | } 61 | 62 | return true; 63 | } 64 | 65 | bool GetBuiltinScriptPaths( 66 | std::vector* paths, 67 | string* error) { 68 | for (uint32 i = 0; i < arraysize(kBuiltinPaths); ++i) { 69 | paths->push_back(GetPath(kBuiltinPaths[i])); 70 | } 71 | 72 | return true; 73 | } 74 | 75 | string GetBuiltinCssPath() { 76 | return GetPath("internal/js/browser/browser.css"); 77 | } 78 | 79 | } // namespace gjstest 80 | -------------------------------------------------------------------------------- /gjstest/internal/cpp/builtin_data.h: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #ifndef GJSTEST_INTERNAL_CPP_BUILTIN_DATA_H_ 17 | #define GJSTEST_INTERNAL_CPP_BUILTIN_DATA_H_ 18 | 19 | #include "base/stl_decl.h" 20 | 21 | namespace gjstest { 22 | 23 | class NamedScripts; 24 | 25 | // Attempt to load the built-in scripts that every test should have accessible 26 | // (e.g. matchers and the mocking framework) into the supplied proto. 27 | // 28 | // The scripts are found using the data_dir flag. 29 | bool GetBuiltinScripts( 30 | NamedScripts* scripts, 31 | string* error); 32 | 33 | // Get absolute paths for the built-in scripts. 34 | bool GetBuiltinScriptPaths( 35 | std::vector* paths, 36 | string* error); 37 | 38 | // Get the path for the built-in CSS file. 39 | string GetBuiltinCssPath(); 40 | 41 | } // namespace gjstest 42 | 43 | #endif // GJSTEST_INTERNAL_CPP_BUILTIN_DATA_H_ 44 | -------------------------------------------------------------------------------- /gjstest/internal/cpp/generate_builtin_paths.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Based on a deps file, generate C++ code exporting an array of entries in the 4 | # file. 5 | # 6 | # The input deps file should look like this: 7 | # 8 | # gjstest/foo/bar.js 9 | # gjstest/baz.js 10 | # 11 | 12 | if [[ $# -ne 2 ]]; then 13 | echo "Usage: $0 " 14 | exit 1 15 | fi 16 | 17 | DEPS_FILE=$1 18 | H_FILE=$2 19 | 20 | rm -f $H_FILE $CC_FILE || exit 1 21 | touch $H_FILE $CC_FILE || exit 1 22 | 23 | # Write out top matter. 24 | echo "#ifndef BUILTIN_PATHS_H_" >> $H_FILE 25 | echo "#define BUILTIN_PATHS_H_" >> $H_FILE 26 | echo "" >> $H_FILE 27 | echo "namespace gjstest {" >> $H_FILE 28 | echo "const char* kBuiltinPaths[] = {" >> $H_FILE 29 | 30 | # Iterate over each entry in the deps file. 31 | for js_file in `cat $DEPS_FILE`; do 32 | # Make sure the file starts with gjstest/. 33 | if [[ ${js_file:0:8} != "gjstest/" ]]; then 34 | echo "Unsupported entry: " $js_file 35 | exit 1 36 | fi 37 | 38 | # Strip off the gjstest/ prefix. 39 | STRIPPED_FILE=${js_file:8} 40 | 41 | # Write the line of code. 42 | echo " \"$STRIPPED_FILE\"," >> $H_FILE 43 | done 44 | 45 | # Write out botton matter for the .cc file. 46 | echo "};" >> $H_FILE 47 | echo "" >> $H_FILE 48 | echo "} // namespace gjstest" >> $H_FILE 49 | echo "" >> $H_FILE 50 | echo "#endif // BUILTIN_PATHS_H_" >> $H_FILE 51 | -------------------------------------------------------------------------------- /gjstest/internal/cpp/run_tests.h: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | // Utility function for driving the whole test runner process. 17 | 18 | #ifndef GJSTEST_INTERNAL_CPP_RUN_TESTS_H_ 19 | #define GJSTEST_INTERNAL_CPP_RUN_TESTS_H_ 20 | 21 | #include "base/stl_decl.h" 22 | 23 | namespace gjstest { 24 | 25 | class NamedScripts; 26 | 27 | // Given a set of test scripts and their dependencies, run the tests registered 28 | // by the scripts, returning true iff they all pass and setting *output and *xml 29 | // to human-readable output and XML respectively. 30 | // 31 | // If test_filter is non-empty, it is interpreted to be a regular expression 32 | // specifying which test names should be run. Others will be excluded. 33 | // 34 | // If coverage_info is non-NULL, the JS scripts are assumed to be instrumented 35 | // with jscoverage (that is, they are the output of the jscoverage tool). The 36 | // coverage information generated by the code will be extracted after the tests 37 | // are run and returned LCOV format in *coverage_info. 38 | // 39 | // This function is not safe to be called multiple times concurrently. It 40 | // assumes that v8 has already been successfully initialized. 41 | bool RunTests( 42 | const NamedScripts& scripts, 43 | const string& test_filter, 44 | string* output, 45 | string* xml, 46 | string* coverage_info); 47 | 48 | } // namespace gjstest 49 | 50 | #endif // GJSTEST_INTERNAL_CPP_RUN_TESTS_H_ 51 | -------------------------------------------------------------------------------- /gjstest/internal/cpp/test_case.h: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | // A class that encapsulates the behavior needed to run a single test case. 17 | 18 | #ifndef GJSTEST_INTERNAL_CPP_TEST_CASE_H_ 19 | #define GJSTEST_INTERNAL_CPP_TEST_CASE_H_ 20 | 21 | #include 22 | 23 | #include 24 | 25 | #include "base/integral_types.h" 26 | #include "base/macros.h" 27 | #include "base/stl_decl.h" 28 | 29 | namespace gjstest { 30 | 31 | class TestCase { 32 | public: 33 | // Create a test case that wraps the supplied test function, as created by 34 | // gjstest.registerTestCase. 35 | TestCase( 36 | v8::Isolate* isolate, 37 | const v8::Local& test_function); 38 | 39 | // Run the test case and fill in the properties below. It is assumed that a 40 | // context is currently active in which all of the test's dependencies have 41 | // been evaluated. 42 | // 43 | // Behavior is undefined if this method is called twice on the same object. 44 | void Run(); 45 | 46 | // Did the test succeed or fail? 47 | bool succeeded = false; 48 | 49 | // All output from the test. 50 | string output; 51 | 52 | // Failure-only output from the test. 53 | string failure_output; 54 | 55 | // The duration of the test run, in milliseconds. 56 | uint32 duration_ms = kuint32max; 57 | 58 | private: 59 | v8::Isolate* const isolate_; 60 | const v8::Local test_function_; 61 | 62 | /////////////////////////////////// 63 | // Helpers 64 | /////////////////////////////////// 65 | 66 | v8::Local GetFunctionNamed( 67 | const string& name) const; 68 | 69 | v8::Local LogString( 70 | const v8::FunctionCallbackInfo& cb_info); 71 | 72 | v8::Local RecordFailure( 73 | const v8::FunctionCallbackInfo& cb_info); 74 | 75 | DISALLOW_COPY_AND_ASSIGN(TestCase); 76 | }; 77 | 78 | } // namespace gjstest 79 | 80 | #endif // GJSTEST_INTERNAL_CPP_TEST_CASE_H_ 81 | -------------------------------------------------------------------------------- /gjstest/internal/cpp/typed_arrays.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | #include "gjstest/internal/cpp/typed_arrays.h" 21 | 22 | namespace gjstest { 23 | 24 | namespace { 25 | class MallocArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 26 | public: 27 | virtual void* Allocate(size_t length) { 28 | void* const result = malloc(length); 29 | if (result) { 30 | memset(result, 0, length); 31 | } 32 | 33 | return result; 34 | } 35 | 36 | virtual void* AllocateUninitialized(size_t length) { 37 | return malloc(length); 38 | } 39 | 40 | virtual void Free(void* data, size_t length) { 41 | free(data); 42 | } 43 | }; 44 | } // namespace 45 | 46 | std::unique_ptr NewArrayBufferAllocator() { 47 | return std::unique_ptr( 48 | new MallocArrayBufferAllocator); 49 | } 50 | 51 | } // namespace gjstest 52 | -------------------------------------------------------------------------------- /gjstest/internal/cpp/typed_arrays.h: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | // Utility functions useful in implementing typed array support, as defined in 17 | // this specification: 18 | // 19 | // http://www.khronos.org/registry/typedarray/specs/latest/ 20 | // 21 | 22 | #ifndef GJSTEST_INTERNAL_CPP_TYPED_ARRAYS_H_ 23 | #define GJSTEST_INTERNAL_CPP_TYPED_ARRAYS_H_ 24 | 25 | #include 26 | 27 | #include 28 | 29 | namespace gjstest { 30 | 31 | // Create a straightforward array buffer allocator for v8. 32 | std::unique_ptr NewArrayBufferAllocator(); 33 | 34 | } // namespace gjstest 35 | 36 | #endif // GJSTEST_INTERNAL_CPP_TYPED_ARRAYS_H_ 37 | -------------------------------------------------------------------------------- /gjstest/internal/integration_tests/README: -------------------------------------------------------------------------------- 1 | This directory contains a number of *_test.js files that are read by 2 | integration_test.cc. Many of them have intentional errors in order to exercise 3 | various pieces of logic in the test runner. 4 | -------------------------------------------------------------------------------- /gjstest/internal/integration_tests/passing.golden.txt: -------------------------------------------------------------------------------- 1 | [----------] 2 | [ RUN ] PassingTest.SomeString 3 | [ OK ] PassingTest.SomeString (1 ms) 4 | [ RUN ] PassingTest.PassingTest 5 | [ OK ] PassingTest.PassingTest (1 ms) 6 | [ RUN ] PassingTest.StringMatchers 7 | [ OK ] PassingTest.StringMatchers (1 ms) 8 | [ RUN ] PassingTest.Logging 9 | foo bar 10 | [ OK ] PassingTest.Logging (1 ms) 11 | [ RUN ] PassingTest.NumberExpectations 12 | [ OK ] PassingTest.NumberExpectations (1 ms) 13 | [ RUN ] PassingTest.UserErrors 14 | [ OK ] PassingTest.UserErrors (1 ms) 15 | [----------] 16 | 17 | [ PASSED ] 18 | -------------------------------------------------------------------------------- /gjstest/internal/integration_tests/passing.golden.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /gjstest/internal/integration_tests/passing_test.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | // A test file with test cases that all pass, for use by integration_test.cc. 17 | 18 | function returnMe(obj) { 19 | return obj; 20 | } 21 | 22 | function PassingTest() { 23 | this.someString_ = 'taco'; 24 | } 25 | registerTestSuite(PassingTest); 26 | 27 | PassingTest.prototype.SomeString = function() { 28 | expectThat(this.someString_, containsRegExp(/burrito|taco/)); 29 | }; 30 | 31 | PassingTest.prototype.PassingTest = function() { 32 | expectThat(returnMe('s'), evalsToTrue); 33 | expectThat(returnMe(null), evalsToFalse); 34 | }; 35 | 36 | PassingTest.prototype.StringMatchers = function() { 37 | expectThat('burritos and tacos', containsRegExp(/taco/)); 38 | expectThat('burritos and tacos', hasSubstr('taco')); 39 | expectThat('enchiladas', not(hasSubstr('taco'))); 40 | }; 41 | 42 | PassingTest.prototype.Logging = function() { 43 | gjstest.log('foo bar'); 44 | }; 45 | 46 | PassingTest.prototype.NumberExpectations = function() { 47 | expectLe(1, 1); 48 | expectLe(1, 2); 49 | expectLt(1, 2); 50 | 51 | expectGt(1, 0); 52 | expectGe(1, 0); 53 | expectGe(1, 1); 54 | }; 55 | 56 | PassingTest.prototype.UserErrors = function() { 57 | expectThat('taco', hasSubstr('t'), 'foo'); 58 | expectEq('', '', 'foo'); 59 | expectNe('', 'a', 'foo'); 60 | expectFalse(false, 'foo'); 61 | expectTrue(true, 'foo'); 62 | expectGe(1, 1, 'foo'); 63 | expectGt(1, 0, 'foo'); 64 | expectLe(1, 2, 'foo'); 65 | expectLt(1, 2, 'foo'); 66 | }; 67 | -------------------------------------------------------------------------------- /gjstest/internal/integration_tests/registration.golden.txt: -------------------------------------------------------------------------------- 1 | [----------] 2 | [ RUN ] HelperRegistrationTest.constructor 3 | Expected: true 4 | Actual: false 5 | at registration_test.js:45 6 | 7 | tearDown has been run. 8 | [ FAILED ] HelperRegistrationTest.constructor (1 ms) 9 | [ RUN ] HelperRegistrationTest.FooBar 10 | Expected: true 11 | Actual: false 12 | at registration_test.js:40 13 | 14 | tearDown has been run. 15 | [ FAILED ] HelperRegistrationTest.FooBar (1 ms) 16 | [ RUN ] HelperRegistrationTest.hasOwnProperty 17 | Expected: true 18 | Actual: false 19 | at registration_test.js:50 20 | 21 | tearDown has been run. 22 | [ FAILED ] HelperRegistrationTest.hasOwnProperty (1 ms) 23 | [ RUN ] HelperRegistrationTest.propertyIsEnumerable 24 | Expected: true 25 | Actual: false 26 | at registration_test.js:56 27 | 28 | tearDown has been run. 29 | [ FAILED ] HelperRegistrationTest.propertyIsEnumerable (1 ms) 30 | [ RUN ] HelperRegistrationTest.prototype 31 | Expected: true 32 | Actual: false 33 | at registration_test.js:61 34 | 35 | tearDown has been run. 36 | [ FAILED ] HelperRegistrationTest.prototype (1 ms) 37 | [----------] 38 | 39 | [----------] 40 | [ RUN ] BareRegistrationTest.FooBar 41 | tearDown has been run. 42 | [ OK ] BareRegistrationTest.FooBar (1 ms) 43 | [----------] 44 | 45 | [ FAILED ] 46 | -------------------------------------------------------------------------------- /gjstest/internal/integration_tests/registration.golden.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 12 | 13 | 14 | 17 | 18 | 19 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /gjstest/internal/integration_tests/syntax_error.golden.txt: -------------------------------------------------------------------------------- 1 | syntax_error.js:22: SyntaxError: Unexpected end of input 2 | -------------------------------------------------------------------------------- /gjstest/internal/integration_tests/syntax_error.golden.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/gjstest/a9c3511359385cd178508713fdc76315babae27b/gjstest/internal/integration_tests/syntax_error.golden.xml -------------------------------------------------------------------------------- /gjstest/internal/integration_tests/syntax_error.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | // A JS file with an intentional syntax error, for use by integration_test.cc. 17 | 18 | // Missing end curly brace. 19 | var someVar = { 20 | 'taco': 1, 21 | 'burrito': 2 22 | -------------------------------------------------------------------------------- /gjstest/internal/integration_tests/targets.mk: -------------------------------------------------------------------------------- 1 | ###################################################### 2 | # Binaries 3 | ###################################################### 4 | 5 | $(eval $(call cc_binary, \ 6 | gjstest/internal/integration_tests/integration_test, \ 7 | base/logging \ 8 | base/macros \ 9 | base/stringprintf \ 10 | file/file_utils \ 11 | strings/strutil \ 12 | , \ 13 | -lgflags -lglog -lre2 ./third_party/gmock/make/gmock.a \ 14 | )) 15 | 16 | ###################################################### 17 | # Tests 18 | ###################################################### 19 | 20 | INT_TEST_ARGS = 21 | 22 | gjstest/internal/integration_tests/integration_test.out : gjstest/internal/integration_tests/integration_test.bin scripts/cc_test_run.sh share gjstest/internal/cpp/gjstest.bin gjstest/internal/integration_tests/*.js gjstest/internal/integration_tests/*.golden.txt gjstest/internal/integration_tests/*.golden.xml 23 | ./scripts/cc_test_run.sh gjstest/internal/integration_tests/integration_test --test_srcdir=gjstest/internal/integration_tests --data_dir=share/gjstest --gjstest_binary=gjstest/internal/cpp/gjstest.bin $(INT_TEST_ARGS) 24 | 25 | CC_TESTS += gjstest/internal/integration_tests/integration_test.out 26 | -------------------------------------------------------------------------------- /gjstest/internal/integration_tests/typed_arrays.golden.txt: -------------------------------------------------------------------------------- 1 | [----------] 2 | [ RUN ] TypedArraysTest.ArrayBuffer 3 | [ OK ] TypedArraysTest.ArrayBuffer (1 ms) 4 | [ RUN ] TypedArraysTest.ArrayBufferSlices 5 | [ OK ] TypedArraysTest.ArrayBufferSlices (1 ms) 6 | [ RUN ] TypedArraysTest.ArrayBufferView 7 | [ OK ] TypedArraysTest.ArrayBufferView (1 ms) 8 | [ RUN ] TypedArraysTest.DataViewReading 9 | [ OK ] TypedArraysTest.DataViewReading (1 ms) 10 | [ RUN ] TypedArraysTest.DataViewWriting 11 | [ OK ] TypedArraysTest.DataViewWriting (1 ms) 12 | [ RUN ] TypedArraysTest.DataViewErrors 13 | [ OK ] TypedArraysTest.DataViewErrors (1 ms) 14 | [ RUN ] TypedArraysTest.Int8Array 15 | [ OK ] TypedArraysTest.Int8Array (1 ms) 16 | [ RUN ] TypedArraysTest.Int16Array 17 | [ OK ] TypedArraysTest.Int16Array (1 ms) 18 | [ RUN ] TypedArraysTest.Int32Array 19 | [ OK ] TypedArraysTest.Int32Array (1 ms) 20 | [ RUN ] TypedArraysTest.Uint8Array 21 | [ OK ] TypedArraysTest.Uint8Array (1 ms) 22 | [ RUN ] TypedArraysTest.Uint16Array 23 | [ OK ] TypedArraysTest.Uint16Array (1 ms) 24 | [ RUN ] TypedArraysTest.Uint32Array 25 | [ OK ] TypedArraysTest.Uint32Array (1 ms) 26 | [ RUN ] TypedArraysTest.Float32Array 27 | [ OK ] TypedArraysTest.Float32Array (1 ms) 28 | [ RUN ] TypedArraysTest.Float64Array 29 | [ OK ] TypedArraysTest.Float64Array (1 ms) 30 | [ RUN ] TypedArraysTest.ConstructFromOtherTypedArray 31 | [ OK ] TypedArraysTest.ConstructFromOtherTypedArray (1 ms) 32 | [ RUN ] TypedArraysTest.ArrayBufferContructorErrors 33 | [ OK ] TypedArraysTest.ArrayBufferContructorErrors (1 ms) 34 | [ RUN ] TypedArraysTest.TypedArrayContructorErrors 35 | [ OK ] TypedArraysTest.TypedArrayContructorErrors (1 ms) 36 | [ RUN ] TypedArraysTest.ZeroInitialization 37 | [ OK ] TypedArraysTest.ZeroInitialization (1 ms) 38 | [----------] 39 | 40 | [ PASSED ] 41 | -------------------------------------------------------------------------------- /gjstest/internal/integration_tests/typed_arrays.golden.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /gjstest/internal/js/browser/browser.css: -------------------------------------------------------------------------------- 1 | /* Reset */ 2 | html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, 3 | pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, 4 | strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, 5 | legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, 6 | details, figcaption, figure, footer, header, hgroup, menu, nav, section, 7 | summary, time, mark, audio, video { 8 | margin: 0; 9 | padding: 0; 10 | border: 0; 11 | outline: 0; 12 | font-size: 1em; 13 | vertical-align: baseline; 14 | background: transparent; 15 | } 16 | 17 | /* Base text styling */ 18 | body { 19 | color: #444; 20 | font-size: 13px; 21 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 22 | } 23 | 24 | /* Styling for the inital heading */ 25 | header.title { 26 | margin: 12px; 27 | border-bottom: 1px solid #444; 28 | } 29 | 30 | header.title h1 { 31 | font-size: 1.8em; 32 | } 33 | 34 | /* Test suite */ 35 | .test-suite { 36 | margin: 12px; 37 | padding: 8px 12px; 38 | border-radius: 12px; 39 | border: 1px solid #d5dcf1; 40 | background: #e6ecf9; 41 | } 42 | 43 | .test-suite h1 { 44 | font-size: 1.2em; 45 | } 46 | 47 | /* Test case */ 48 | .test-case { 49 | margin-left: 18px; 50 | margin-top: 4px; 51 | } 52 | 53 | .test-case h1 { 54 | font-size: 1em; 55 | color: #a8aebf; 56 | } 57 | 58 | .test-case ol { 59 | padding: 2px 2px 2px 12px; 60 | background-color: #fff; 61 | border: 1px solid #d5dcf1; 62 | list-style: none; 63 | margin-left: 6px; 64 | } 65 | 66 | .test-case li { 67 | padding: 10px 0; 68 | } 69 | 70 | /* Expander classes */ 71 | .expanded, .collapsed { 72 | cursor: pointer; 73 | } 74 | 75 | .expanded:before { 76 | content: '\25BD'; 77 | margin-right: 0.4em; 78 | opacity: 0.5; 79 | } 80 | 81 | .collapsed:before { 82 | content: '\25B7'; 83 | margin-right: 0.4em; 84 | opacity: 0.5; 85 | } 86 | 87 | .expanded:hover:before, .collapsed:hover:before { 88 | opacity: 1.0; 89 | } 90 | 91 | .hidden { 92 | display: none; 93 | } 94 | 95 | /* Base colours for statuses */ 96 | .pass { color: #298206 !important; } 97 | .fail { color: #802626 !important; } 98 | .skip { color: #808080 !important; } 99 | .running { color: #425280 !important; } 100 | -------------------------------------------------------------------------------- /gjstest/internal/js/browser/targets.mk: -------------------------------------------------------------------------------- 1 | $(eval $(call compiled_js_library, \ 2 | gjstest/internal/js/browser/html_builder, \ 3 | gjstest/internal/js/namespace \ 4 | )) 5 | 6 | $(eval $(call compiled_js_library, \ 7 | gjstest/internal/js/browser/run_tests, \ 8 | gjstest/internal/js/browser/html_builder \ 9 | gjstest/internal/js/namespace \ 10 | gjstest/internal/js/run_test \ 11 | gjstest/internal/js/stack_utils \ 12 | gjstest/public/register \ 13 | )) 14 | 15 | ###################################################### 16 | # Tests 17 | ###################################################### 18 | 19 | $(eval $(call js_test,gjstest/internal/js/browser/html_builder)) 20 | -------------------------------------------------------------------------------- /gjstest/internal/js/error_utils_test.js: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Google Inc. All Rights Reserved. 2 | // Author: eschoeffler@google.com (Eric Schoeffler) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | function ErrorUtilsTest() {} 17 | registerTestSuite(ErrorUtilsTest); 18 | 19 | ErrorUtilsTest.prototype.FallsBackOnEvalOrigin = function() { 20 | var errorStack = gjstest.internal.getErrorStack(/** @type {!Error} */ ({ 21 | stack: 'formatted stack', 22 | structuredStack: [ 23 | new FakeCallSite('', 'evalfoobar.js', 11), 24 | new FakeCallSite('foobar.js', 'evalfoobar.js', 11), 25 | new FakeCallSite('foobar.js', '', 11) 26 | ] 27 | })); 28 | 29 | expectEq('evalfoobar.js', errorStack[0].fileName); 30 | expectEq('foobar.js', errorStack[1].fileName); 31 | expectEq('foobar.js', errorStack[2].fileName); 32 | }; 33 | 34 | /** 35 | * @param {string} fileName 36 | * @param {string} evalOrigin 37 | * @param {number} lineNumber 38 | * @constructor 39 | */ 40 | function FakeCallSite(fileName, evalOrigin, lineNumber) { 41 | this.fileName_ = fileName; 42 | this.evalOrigin_ = evalOrigin; 43 | this.lineNumber_ = lineNumber; 44 | }; 45 | 46 | /** @return {string} */ 47 | FakeCallSite.prototype.getFileName = function() { 48 | return this.fileName_; 49 | }; 50 | 51 | /** @return {string} */ 52 | FakeCallSite.prototype.getEvalOrigin = function() { 53 | return this.evalOrigin_; 54 | }; 55 | 56 | /** @return {string} */ 57 | FakeCallSite.prototype.getLineNumber = function() { 58 | return this.lineNumber_; 59 | }; 60 | 61 | /** @return {boolean} */ 62 | FakeCallSite.prototype.isNative = function() { 63 | return false; 64 | }; 65 | -------------------------------------------------------------------------------- /gjstest/internal/js/expect_that.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | // Internal implementation of expectThat. 17 | 18 | /** 19 | * Verify an expectation, reporting failure when appropriate. 20 | * 21 | * @param {*} obj 22 | * The object that should satisfy the supplied predicate. 23 | * 24 | * @param {!gjstest.Matcher} matcher 25 | * A matcher that the supplied object should satisfy. 26 | * 27 | * @param {function(*):!string} stringify 28 | * A function that turns arbitrary objects into a convenient human-readable 29 | * form. 30 | * 31 | * @param {function(string)} reportFailure 32 | * A function that will be called with a descriptive error message in the 33 | * event of failure. 34 | * 35 | * @param {string|undefined} errorMessage 36 | * An optional error message to report with a failure. 37 | */ 38 | gjstest.internal.expectThat = function( 39 | obj, 40 | matcher, 41 | stringify, 42 | reportFailure, 43 | errorMessage) { 44 | // Ask the matcher about the object. 45 | var predicateResult = matcher.predicate(obj); 46 | 47 | // If the matcher says the object is okay, we're done. 48 | if (predicateResult === true) return; 49 | 50 | // Describe the failure. 51 | var failureMessage = ''; 52 | 53 | failureMessage += 'Expected: ' + matcher.getDescription() + '\n'; 54 | failureMessage += 'Actual: ' + stringify(obj); 55 | 56 | // Add a clause like "which has length 7" if one is available. 57 | if (typeof(predicateResult) == 'string') { 58 | failureMessage += ', ' + predicateResult; 59 | } 60 | 61 | if (errorMessage != null) { 62 | failureMessage += '\n' + errorMessage; 63 | } 64 | 65 | // Report the failure. 66 | reportFailure(failureMessage); 67 | }; 68 | -------------------------------------------------------------------------------- /gjstest/internal/js/namespace.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | // Make sure the gjstest namespace doesn't already exist. This is to help catch 17 | // errors with dependency funniness -- for example, accidentally including this 18 | // file twice. The second inclusion would otherwise silently overwrite the 19 | // namespace, causing inscrutable errors from other code. 20 | var globalContext = this; 21 | if (!!globalContext['gjstest']) { 22 | throw new Error( 23 | 'The gjstest namespace is already defined! ' + 24 | 'Did you include namespace.js twice?'); 25 | } 26 | 27 | /** @const */ 28 | var gjstest = {}; 29 | 30 | /** @const */ 31 | gjstest.internal = {}; 32 | -------------------------------------------------------------------------------- /gjstest/internal/js/stack_frame.js: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | /** 17 | * A representation of a single stack frame. 18 | * @constructor 19 | */ 20 | gjstest.internal.StackFrame = function() { 21 | this.fileName = null; 22 | this.lineNumber = null; 23 | }; 24 | 25 | /** 26 | * The name of the source file if known, or null otherwise. 27 | * 28 | * @type {string?} 29 | */ 30 | gjstest.internal.StackFrame.prototype.fileName; 31 | 32 | /** 33 | * The line number of the source file if known, or null otherwise. 34 | * 35 | * @type {number?} 36 | */ 37 | gjstest.internal.StackFrame.prototype.lineNumber; 38 | -------------------------------------------------------------------------------- /gjstest/internal/js/stack_utils.js: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | /** 17 | * Return an array of stack frames representing the current stack up to the 18 | * point at which this function was called. The returned array is in order from 19 | * the top of the stack to the bottom. 20 | * 21 | * @return {!Array.} 22 | */ 23 | gjstest.internal.getCurrentStack = function() { 24 | // Create an error with the current stack, and get its frames. 25 | var stackFrames = gjstest.internal.getErrorStack(new Error); 26 | 27 | // Skip the first line, which contains the current stack frame. 28 | stackFrames.splice(0, 1); 29 | 30 | return stackFrames; 31 | }; 32 | 33 | /** 34 | * Return a human-readable description of the supplied stack trace. Each line of 35 | * the description is indented, for convenient printing. 36 | * 37 | * @param {!Array.} stackFrames 38 | * @return {!string} 39 | */ 40 | gjstest.internal.describeStack = function(stackFrames) { 41 | // Special case: handle the empty array. 42 | if (!stackFrames.length) { 43 | return ' (Empty)'; 44 | } 45 | 46 | // Describe each frame. 47 | function describeFrame(frame) { 48 | var fileName = frame.fileName || '(unknown)'; 49 | var lineNumber = '' + (frame.lineNumber || '(unknown)'); 50 | 51 | return ' ' + fileName + ':' + lineNumber; 52 | } 53 | 54 | return stackFrames.map(describeFrame).join('\n'); 55 | }; 56 | -------------------------------------------------------------------------------- /gjstest/internal/js/use_global_namespace.js: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | // Copy every public member of the gjstest namespace to the global one. This is 17 | // used to make symbols globally-accessible for tests that are run by the 18 | // gjstest runner program. 19 | (function() { 20 | var globalContext = this; 21 | for (var property in gjstest) { 22 | if (property == 'internal') continue; 23 | globalContext[property] = gjstest[property]; 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /gjstest/internal/proto/named_scripts.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | syntax = "proto2"; 17 | 18 | package gjstest; 19 | 20 | message NamedScript { 21 | // The name of this script, e.g. "foo_test.js". 22 | optional string name = 1; 23 | 24 | // The JS source code for this script. 25 | optional string source = 2; 26 | } 27 | 28 | // A collection of named scripts. 29 | message NamedScripts { 30 | repeated NamedScript script = 1; 31 | } 32 | -------------------------------------------------------------------------------- /gjstest/internal/proto/targets.mk: -------------------------------------------------------------------------------- 1 | $(eval $(call proto_library, \ 2 | gjstest/internal/proto/named_scripts, \ 3 | \ 4 | )) 5 | -------------------------------------------------------------------------------- /gjstest/public/actions.js: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | /** 17 | * A mock action that simply returns retVal. 18 | * 19 | * @param {*} retVal 20 | * @return {!Function} 21 | */ 22 | gjstest.returnWith = function(retVal) { 23 | return function() { return retVal; }; 24 | }; 25 | 26 | /** 27 | * A mock action that invokes a list of other mock actions, serially, in order. 28 | * Returns the last action's return value (if any). 29 | * 30 | * @param {!Array.} actions 31 | * @return {!Function} 32 | */ 33 | gjstest.doAll = function(actions) { 34 | if (!(actions instanceof Array)) { 35 | throw new TypeError('doAll requires an array argument.'); 36 | } 37 | 38 | if (actions.length == 0) { 39 | throw new Error('doAll requires a non-empty array.'); 40 | } 41 | 42 | return function() { 43 | var retVal; 44 | for (var i = 0; i < actions.length; ++i) { 45 | retVal = actions[i].apply(this, arguments); 46 | } 47 | 48 | return retVal; 49 | } 50 | }; 51 | -------------------------------------------------------------------------------- /gjstest/public/actions_test.js: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | //////////////////////////////////////////////////////////////////////// 17 | // returnWith 18 | //////////////////////////////////////////////////////////////////////// 19 | 20 | function ReturnWithTest() {} 21 | registerTestSuite(ReturnWithTest); 22 | 23 | ReturnWithTest.prototype.ReturnsArg = function() { 24 | expectEq('taco', returnWith('taco')()); 25 | expectEq(2, returnWith(2)()); 26 | expectEq(null, returnWith(null)()); 27 | }; 28 | 29 | //////////////////////////////////////////////////////////////////////// 30 | // doAll 31 | //////////////////////////////////////////////////////////////////////// 32 | 33 | function DoAllTest() {} 34 | registerTestSuite(DoAllTest); 35 | 36 | DoAllTest.prototype.ArgNotArray = function() { 37 | expectThat(function() { doAll(17); }, throwsError(/TypeError.*doAll.*array/)); 38 | }; 39 | 40 | DoAllTest.prototype.NoActions = function() { 41 | expectThat(function() { doAll([]); }, throwsError(/doAll.*non-empty/)); 42 | }; 43 | 44 | DoAllTest.prototype.CallsActionsWithCorrectArgs = function() { 45 | var wrapped1 = createMockFunction('wrapped1'); 46 | var wrapped2 = createMockFunction('wrapped2'); 47 | var wrapped3 = createMockFunction('wrapped3'); 48 | 49 | var action = doAll([wrapped1, wrapped2, wrapped3]); 50 | 51 | expectCall(wrapped1)('taco', 17, undefined); 52 | expectCall(wrapped2)('taco', 17, undefined); 53 | expectCall(wrapped3)('taco', 17, undefined); 54 | 55 | action('taco', 17, undefined); 56 | }; 57 | 58 | DoAllTest.prototype.ReturnsLastReturnValue = function() { 59 | var action = doAll([returnWith(17), returnWith(19), returnWith(23)]); 60 | 61 | expectEq(23, action()); 62 | }; 63 | 64 | DoAllTest.prototype.SetsAppropriateThis = function() { 65 | var suppliedThis = undefined; 66 | function recordThis() { suppliedThis = this; } 67 | 68 | var action = doAll([recordThis]); 69 | 70 | var expectedThis = {}; 71 | action.apply(expectedThis); 72 | 73 | expectEq(expectedThis, suppliedThis); 74 | }; 75 | -------------------------------------------------------------------------------- /gjstest/public/logging.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | /** 17 | * Log a message to somewhere convenient for the current method of running tests 18 | * (e.g. console output or the browser's console). An implicit newline is added 19 | * to the end of the message. 20 | * 21 | * @param {!string} message 22 | */ 23 | gjstest.log = function(message) { 24 | // Simply redirect to the run-time implementation. 25 | gjstest.internal.currentTestEnvironment.log(message); 26 | }; 27 | -------------------------------------------------------------------------------- /gjstest/public/matchers/boolean_matchers.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | /** 17 | * A matcher for objects that evaluate to true. 18 | * 19 | * @type {!gjstest.Matcher} 20 | */ 21 | gjstest.evalsToTrue = new gjstest.Matcher( 22 | 'evaluates to true', 23 | 'evaluates to false', 24 | function(obj) { return !!obj; } 25 | ); 26 | 27 | /** 28 | * A matcher for objects that evaluate to false. 29 | * 30 | * @type {!gjstest.Matcher} 31 | */ 32 | gjstest.evalsToFalse = new gjstest.Matcher( 33 | 'evaluates to false', 34 | 'evaluates to true', 35 | function(obj) { return !obj; } 36 | ); 37 | -------------------------------------------------------------------------------- /gjstest/public/matchers/function_matchers.js: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | /** 17 | * Match functions that, when invoked, throw an error whose toString() method 18 | * returns a string that matches the supplied regular expression. 19 | * 20 | * @param {RegExp} re 21 | * @return {!gjstest.Matcher} 22 | */ 23 | gjstest.throwsError = function(re) { 24 | // Make sure the input is a regexp. 25 | if (!(re instanceof RegExp)) { 26 | throw new TypeError('throwsError requires a RegExp argument.'); 27 | } 28 | 29 | var description = 'is a function that throws an error matching ' + re; 30 | var negativeDescription = description.replace('is a', 'is not a'); 31 | 32 | return new gjstest.Matcher( 33 | description, 34 | negativeDescription, 35 | function(func) { 36 | // The argument must be a function that takes no arguments. 37 | if (!(func instanceof Function)) { 38 | return 'which is not a function'; 39 | } else if (func.length != 0) { 40 | return 'which has arity ' + func.length; 41 | } 42 | 43 | // Run the function and look for an error. 44 | try { 45 | func(); 46 | } catch (e) { 47 | if (re.test('' + e)) return true; 48 | 49 | return 'which threw the wrong error: ' + e; 50 | } 51 | 52 | return 'which threw no errors'; 53 | } 54 | ); 55 | }; 56 | -------------------------------------------------------------------------------- /gjstest/public/matchers/missing_arg_matchers.js: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | /** 17 | * Match only non-present arguments. This is mostly useful in conjunction with 18 | * other matchers. For example: 19 | * 20 | * // The second argument must be 23 if it's present, but it's okay for it 21 | * // to not be present. 22 | * expectCall(foo)(_, anyOf([notPresent, 23])); 23 | * 24 | * @type {!gjstest.Matcher} 25 | */ 26 | gjstest.notPresent = new gjstest.Matcher( 27 | 'is not present', 28 | 'is present', 29 | function(obj) { return obj === gjstest.missingArgSentinel; } 30 | ); 31 | 32 | /** @inheritDoc */ 33 | gjstest.notPresent.understandsMissingArgs = true; 34 | 35 | /** 36 | * Match anything, including non-present arguments. For example: 37 | * 38 | * var foo = createMockFunction(); 39 | * expectCall(foo)(_, maybePresent) 40 | * .willRepeatedly(function() {}); 41 | * 42 | * foo(); // Fails 43 | * foo(17); // Passes 44 | * foo(17, 19); // Passes 45 | * foo(17, undefined); // Passes 46 | * foo(17, 19, 23); // Fails 47 | * 48 | * @type {!gjstest.Matcher} 49 | */ 50 | gjstest.maybePresent = gjstest.anyOf([gjstest._, gjstest.notPresent]); 51 | 52 | /** 53 | * Match the missing argument sentinel (see docs for gjstest.missingArgSentinel) 54 | * when it is actually fed to the relevant mock function, but not when it is 55 | * present due to a missing argument. 56 | * 57 | * This is supported by special-case logic in the guts of gjstest, and is useful 58 | * only for testing matchers that call other matchers. For an example, see 59 | * boolean_matchers_test.js. 60 | * 61 | * @type {!gjstest.Matcher} 62 | */ 63 | gjstest.isMissingArgSentinel = 64 | new gjstest.Matcher( 65 | 'is the missing arg sentinel', 66 | 'is not the missing arg sentinel', 67 | /** @type {function():boolean} */(function() { 68 | throw new Error('this predicate should never be called'); 69 | })); 70 | -------------------------------------------------------------------------------- /gjstest/public/matchers/string_matchers.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // Author: jacobsa@google.com (Aaron Jacobs) 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | /** 17 | * Match strings that fit the supplied regular expression, without an implied 18 | * anchor to the start and end of the string. That is, /a/ matches 'bar'. 19 | * 20 | * @param {RegExp} re 21 | * @return {!gjstest.Matcher} 22 | */ 23 | gjstest.containsRegExp = function(re) { 24 | if (!(re instanceof RegExp)) { 25 | throw new TypeError('containsRegExp requires a RegExp argument.'); 26 | } 27 | 28 | return new gjstest.Matcher( 29 | 'partially matches regex: ' + re, 30 | 'doesn\'t partially match regex: ' + re, 31 | function(candidate) { 32 | if (typeof(candidate) != 'string') { 33 | return 'which is not a string'; 34 | } 35 | 36 | return re.test(candidate); 37 | } 38 | ); 39 | }; 40 | 41 | /** 42 | * Match strings containing the supplied substring. 43 | * 44 | * @param {string} substr 45 | * @return {!gjstest.Matcher} 46 | */ 47 | gjstest.hasSubstr = function(substr) { 48 | if (typeof(substr) != 'string') { 49 | throw new TypeError('hasSubstr requires a string argument.'); 50 | } 51 | 52 | return new gjstest.Matcher( 53 | 'is a string containing the substring ' + gjstest.stringify(substr), 54 | 'is not a string containing the substring ' + gjstest.stringify(substr), 55 | function(candidate) { 56 | if (typeof(candidate) != 'string') { 57 | return 'which is not a string'; 58 | } 59 | 60 | return candidate.indexOf(substr) != -1; 61 | } 62 | ); 63 | }; 64 | -------------------------------------------------------------------------------- /gjstest/public/targets.mk: -------------------------------------------------------------------------------- 1 | $(eval $(call compiled_js_library, \ 2 | gjstest/public/actions, \ 3 | gjstest/internal/js/namespace \ 4 | )) 5 | 6 | $(eval $(call compiled_js_library, \ 7 | gjstest/public/assertions, \ 8 | gjstest/internal/js/expect_that \ 9 | gjstest/internal/js/test_environment \ 10 | gjstest/internal/js/namespace \ 11 | gjstest/public/matchers/boolean_matchers \ 12 | gjstest/public/matchers/combining_matchers \ 13 | gjstest/public/matchers/equality_matchers \ 14 | gjstest/public/matchers/number_matchers \ 15 | gjstest/public/stringify \ 16 | )) 17 | 18 | $(eval $(call compiled_js_library, \ 19 | gjstest/public/logging, \ 20 | gjstest/internal/js/namespace \ 21 | gjstest/internal/js/test_environment \ 22 | )) 23 | 24 | $(eval $(call compiled_js_library, \ 25 | gjstest/public/matcher_types, \ 26 | gjstest/internal/js/namespace \ 27 | )) 28 | 29 | $(eval $(call compiled_js_library, \ 30 | gjstest/public/mocking, \ 31 | gjstest/internal/js/call_expectation \ 32 | gjstest/internal/js/mock_function \ 33 | gjstest/internal/js/mock_instance \ 34 | gjstest/internal/js/namespace \ 35 | gjstest/internal/js/stack_utils \ 36 | gjstest/internal/js/test_environment \ 37 | gjstest/public/matcher_types \ 38 | gjstest/public/matchers/equality_matchers \ 39 | gjstest/public/stringify \ 40 | )) 41 | 42 | $(eval $(call compiled_js_library, \ 43 | gjstest/public/register, \ 44 | gjstest/internal/js/namespace \ 45 | )) 46 | 47 | $(eval $(call compiled_js_library, \ 48 | gjstest/public/stringify, \ 49 | gjstest/internal/js/namespace \ 50 | )) 51 | 52 | ###################################################### 53 | # Tests 54 | ###################################################### 55 | 56 | $(eval $(call js_test,gjstest/public/actions)) 57 | $(eval $(call js_test,gjstest/public/mocking)) 58 | $(eval $(call js_test,gjstest/public/register)) 59 | $(eval $(call js_test,gjstest/public/stringify)) 60 | -------------------------------------------------------------------------------- /scripts/cc_binary_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Build a C++ binary. 4 | # 5 | # Usage: 6 | # 7 | # ./cc_binary_build.sh foo/target 8 | # 9 | # The file foo/object_deps must already exist. 10 | 11 | if [[ $# -lt 1 ]]; then 12 | echo "Usage: $0 TARGET " 13 | exit 1 14 | fi 15 | 16 | TARGET=$1 17 | shift 18 | 19 | OBJECT_DEPS_FILE="$TARGET.object_deps" 20 | OUTPUT_FILE="$TARGET.bin" 21 | 22 | # Build an appropriate invocation. 23 | GCC_ARGS=() 24 | 25 | for object_file in `cat $OBJECT_DEPS_FILE`; do 26 | GCC_ARGS[${#GCC_ARGS[@]}]="$object_file" 27 | done 28 | 29 | while [[ $1 ]] 30 | do 31 | GCC_ARGS[${#GCC_ARGS[@]}]="$1" 32 | shift 33 | done 34 | 35 | # Run g++. 36 | set -x 37 | g++ "${GCC_ARGS[@]}" -o $OUTPUT_FILE || 38 | (rm -f $OUTPUT_FILE; exit 1) 39 | -------------------------------------------------------------------------------- /scripts/cc_library_make_header_deps_file.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Create a .header_deps file for a C++ target, for use with dependency analysis 4 | # magic in the makefile. 5 | # 6 | # Usage: 7 | # 8 | # ./cc_library_make_header_deps_file.sh \ 9 | # foo/target \ 10 | # bar.header_deps \ 11 | # baz/qux.header_deps \ 12 | # 13 | # 14 | # is there to allow the makefile to declare dependencies on other 15 | # files. Anything that doesn't end in .header_deps will be ignored by this 16 | # script. 17 | 18 | if [[ $# -lt 1 ]]; then 19 | echo "Usage: $0 TARGET DEPS ..." 20 | exit 1 21 | fi 22 | 23 | TARGET=$1 24 | shift 25 | 26 | OUTPUT_FILE="$TARGET.header_deps" 27 | 28 | # Delete the existing file. 29 | rm -f $OUTPUT_FILE 30 | 31 | # Append the contents of each dependency's .deps file. 32 | while [[ $1 ]] 33 | do 34 | FILE=$1 35 | shift 36 | 37 | # Skip other files. 38 | if [[ $FILE =~ '.header_deps' ]]; then 39 | cat $FILE >> $OUTPUT_FILE || exit 1 40 | fi 41 | done 42 | 43 | # Add the library's .h file to the end of the list. 44 | echo "$TARGET.h" >> $OUTPUT_FILE || exit 1 45 | 46 | # Remove duplicate lines, preserving order. 47 | mv $OUTPUT_FILE $OUTPUT_FILE.tmp || exit 1 48 | awk '!x[$0]++' $OUTPUT_FILE.tmp > $OUTPUT_FILE || exit 1 49 | rm $OUTPUT_FILE.tmp || exit 1 50 | -------------------------------------------------------------------------------- /scripts/cc_library_make_object_deps_file.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Create a .object_deps file for a C++ target, for use with dependency analysis 4 | # magic in the makefile. 5 | # 6 | # Usage: 7 | # 8 | # ./cc_library_make_object_deps_file.sh \ 9 | # foo/target \ 10 | # bar.object_deps \ 11 | # baz/qux.object_deps \ 12 | # 13 | # 14 | # is there to allow the makefile to declare dependencies on other 15 | # files. Anything that doesn't end in .object_deps will be ignored by this 16 | # script. 17 | 18 | if [[ $# -lt 1 ]]; then 19 | echo "Usage: $0 TARGET DEPS ..." 20 | exit 1 21 | fi 22 | 23 | TARGET=$1 24 | shift 25 | 26 | OUTPUT_FILE="$TARGET.object_deps" 27 | 28 | # Delete the existing file. 29 | rm -f $OUTPUT_FILE 30 | 31 | # Make sure it exists again. 32 | touch $OUTPUT_FILE 33 | 34 | # Append the contents of each dependency's .deps file. 35 | while [[ $1 ]] 36 | do 37 | FILE=$1 38 | shift 39 | 40 | # Skip other files. 41 | if [[ $FILE =~ '.object_deps' ]]; then 42 | cat $FILE >> $OUTPUT_FILE || exit 1 43 | fi 44 | done 45 | 46 | # Add the library's .o file to the end of the list, if a .cc file exists. 47 | if [ -r $TARGET.cc ]; then 48 | echo "$TARGET.o" >> $OUTPUT_FILE || exit 1 49 | fi 50 | 51 | # Remove duplicate lines, preserving order. 52 | mv $OUTPUT_FILE $OUTPUT_FILE.tmp || exit 1 53 | awk '!x[$0]++' $OUTPUT_FILE.tmp > $OUTPUT_FILE || exit 1 54 | rm $OUTPUT_FILE.tmp || exit 1 55 | -------------------------------------------------------------------------------- /scripts/cc_test_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Run a C++ test. 4 | # 5 | # Usage: 6 | # 7 | # ./cc_test_run.sh foo/target 8 | # 9 | # The file foo/target.bin must already exist. 10 | 11 | if [[ $# -lt 1 ]]; then 12 | echo "Usage: $0 TARGET" 13 | exit 1 14 | fi 15 | 16 | TARGET=$1 17 | OUTPUT_FILE="$TARGET.out" 18 | shift 19 | 20 | rm -f $OUTPUT_FILE 21 | 22 | set -x 23 | ./$TARGET.bin $@ || exit 1 24 | set +x 25 | 26 | echo "ok" > $OUTPUT_FILE 27 | -------------------------------------------------------------------------------- /scripts/js_library_check_compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Make sure that the closure compiler is happy with a target. 4 | # 5 | # Usage: 6 | # 7 | # ./js_library_check_compile.sh foo/target 8 | # 9 | # The file foo/target.deps must already exist. 10 | 11 | if [[ $# -ne 1 ]]; then 12 | echo "Usage: $0 TARGET" 13 | exit 1 14 | fi 15 | 16 | TARGET=$1 17 | shift 18 | 19 | DEPS_FILE="$TARGET.deps" 20 | OUTPUT_FILE="$TARGET.compile" 21 | 22 | # Build an appropriate invocation. 23 | CLOSURE_ARGS=(\ 24 | "--warning_level=VERBOSE" \ 25 | "--jscomp_error=checkTypes" \ 26 | "--jscomp_error=invalidCasts" \ 27 | "--jscomp_error=missingProperties" \ 28 | "--jscomp_off=internetExplorerChecks" \ 29 | "--compilation_level=WHITESPACE_ONLY" \ 30 | ) 31 | 32 | for js_file in `cat $DEPS_FILE`; do 33 | CLOSURE_ARGS[${#CLOSURE_ARGS[@]}]="--js=$js_file" 34 | done 35 | set -x 36 | 37 | # Run closure. 38 | closure-compiler "${CLOSURE_ARGS[@]}" --js_output_file=$OUTPUT_FILE || 39 | (rm -f $OUTPUT_FILE; exit 1) 40 | -------------------------------------------------------------------------------- /scripts/js_library_make_deps_file.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Create a .deps file for a JS target, for use with dependency analysis magic in 4 | # the makefile. 5 | # 6 | # Usage: 7 | # 8 | # ./js_library_make_deps_file.sh \ 9 | # foo/target \ 10 | # bar.deps \ 11 | # baz/qux.deps \ 12 | # 13 | # 14 | # is there to allow the makefile to declare dependencies on other 15 | # files. Anything that doesn't end in .deps will be ignored by this script. 16 | 17 | if [[ $# -lt 1 ]]; then 18 | echo "Usage: $0 TARGET DEPS ..." 19 | exit 1 20 | fi 21 | 22 | TARGET=$1 23 | shift 24 | 25 | OUTPUT_FILE="$TARGET.deps" 26 | 27 | # Delete the existing file. 28 | rm -f $OUTPUT_FILE 29 | 30 | # Append the contents of each dependency's .deps file. 31 | while [[ $1 ]] 32 | do 33 | FILE=$1 34 | shift 35 | 36 | # Skip other files. 37 | if [[ $FILE =~ '.deps' ]]; then 38 | cat $FILE >> $OUTPUT_FILE || exit 1 39 | fi 40 | done 41 | 42 | # Add the library's .js file to the end of the list. 43 | echo "$TARGET.js" >> $OUTPUT_FILE || exit 1 44 | 45 | # Remove duplicate lines, preserving order. 46 | mv $OUTPUT_FILE $OUTPUT_FILE.tmp || exit 1 47 | awk '!x[$0]++' $OUTPUT_FILE.tmp > $OUTPUT_FILE || exit 1 48 | rm $OUTPUT_FILE.tmp || exit 1 49 | -------------------------------------------------------------------------------- /scripts/js_rules.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Google Inc. All Rights Reserved. 2 | # Author: jacobsa@google.com (Aaron Jacobs) 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Define a JS library. 17 | # 18 | # Arg 1: 19 | # Name of the library, including a path. It is assumed that the relevant 20 | # source file is $(1).js. 21 | # 22 | # Arg 2: 23 | # Space-separated list of dependencies, also defined with this rule. 24 | # 25 | define js_library 26 | 27 | # A file listing the transitive dependencies of this rule, topologically 28 | # sorted. Depend on the makefile to ensure that this file is rebuilt when the 29 | # graph changes. Depend on the .js file to make sure that compilation targets 30 | # are rerun whenever a transitive dependency changes. 31 | $(1).deps : $(2:=.deps) Makefile $(1).js scripts/js_library_make_deps_file.sh 32 | ./scripts/js_library_make_deps_file.sh $(1) $$^ 33 | 34 | endef 35 | 36 | # Define a JS library with a compilation test. 37 | # 38 | # Arg 1: 39 | # Name of the library, including a path. It is assumed that the relevant 40 | # source file is $(1).js. 41 | # 42 | # Arg 2: 43 | # Space-separated list of dependencies, also defined with this rule. 44 | # 45 | define compiled_js_library 46 | 47 | $(eval $(call js_library,$(1),$(2))) 48 | 49 | # A target that makes sure the Closure compiler is okay with the code and its 50 | # dependencies. 51 | $(1).compile : $(1).deps scripts/js_library_check_compile.sh 52 | ./scripts/js_library_check_compile.sh $(1) 53 | 54 | COMPILATION_TESTS += $(1).compile 55 | 56 | endef 57 | 58 | # Define a JS test. 59 | # 60 | # Arg 1: 61 | # The name of the library to test, including a path. It is assumed that the 62 | # relevant test file is $(1)_test.js. 63 | # 64 | define js_test 65 | 66 | # Create a library target for the test. 67 | $(eval $(call js_library,$(1)_test,$(1))) 68 | 69 | # Create a target for the test itself. Make sure to depend on the 70 | # use_global_namespace deps target, because the shell script tests it for 71 | # duplicates. 72 | $(1)_test.out : $(1)_test.deps scripts/js_test_run.sh gjstest/internal/js/use_global_namespace.deps gjstest/internal/cpp/gjstest.bin share 73 | ./scripts/js_test_run.sh $(1)_test 74 | 75 | JS_TESTS += $(1)_test.out 76 | 77 | endef 78 | -------------------------------------------------------------------------------- /scripts/js_test_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Run gjstest for a test target. 4 | # 5 | # Usage: 6 | # 7 | # ./js_test_run.sh foo/target 8 | # 9 | # The file foo/target.deps must already exist. 10 | 11 | if [[ $# -ne 1 ]]; then 12 | echo "Usage: $0 TARGET" 13 | exit 1 14 | fi 15 | 16 | TARGET=$1 17 | shift 18 | 19 | DEPS_FILE="$TARGET.deps" 20 | OUTPUT_FILE="$TARGET.out" 21 | 22 | # Build an appropriate invocation. 23 | JS_FILES= 24 | for js_file in `cat $DEPS_FILE`; do 25 | # Skip files that are built in to gjstest; otherwise we would, for example, 26 | # define the gjstest namespace twice. 27 | if [ `grep "$js_file" gjstest/internal/js/use_global_namespace.deps` ]; then 28 | continue 29 | fi 30 | 31 | JS_FILES[${#JS_FILES[@]}]=$js_file 32 | done 33 | 34 | JOINED_JS_FILES=$(printf ",%s" "${JS_FILES[@]}") 35 | JOINED_JS_FILES=${JOINED_JS_FILES:1} 36 | 37 | set -x 38 | gjstest/internal/cpp/gjstest.bin --data_dir=share/gjstest "--js_files=$JOINED_JS_FILES" || exit 1 39 | set +x 40 | 41 | echo "ok" > $OUTPUT_FILE 42 | -------------------------------------------------------------------------------- /scripts/proto_rules.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Google Inc. All Rights Reserved. 2 | # Author: jacobsa@google.com (Aaron Jacobs) 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Create a C++ library for a proto buffer. 17 | # 18 | # Arg 1: 19 | # Name of the library, including a path. It is assumed that $(1).proto is 20 | # the proto file. Users can depend on $(1).pb from cc_library and cc_binary 21 | # targets. 22 | # 23 | # TODO(jacobsa): Support dependencies when needed. 24 | define proto_library 25 | 26 | $(1:=.pb.h) $(1:=.pb.cc) : $(1:=.proto) 27 | protoc --proto_path=. --cpp_out=. $(1:=.proto) 28 | 29 | $(eval $(call cc_library,$(1:=.pb),)) 30 | 31 | endef 32 | -------------------------------------------------------------------------------- /strings/targets.mk: -------------------------------------------------------------------------------- 1 | $(eval $(call cc_library, \ 2 | strings/ascii_ctype, \ 3 | base/basictypes \ 4 | )) 5 | 6 | $(eval $(call cc_library, \ 7 | strings/strutil, \ 8 | base/basictypes \ 9 | base/logging \ 10 | base/scoped_ptr \ 11 | strings/ascii_ctype \ 12 | )) 13 | -------------------------------------------------------------------------------- /third_party/cityhash/citycrc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Google, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | // 21 | // CityHash, by Geoff Pike and Jyrki Alakuijala 22 | // 23 | // This file declares the subset of the CityHash functions that require 24 | // _mm_crc32_u64(). See the CityHash README for details. 25 | // 26 | // Functions in the CityHash family are not suitable for cryptography. 27 | 28 | #ifndef CITY_HASH_CRC_H_ 29 | #define CITY_HASH_CRC_H_ 30 | 31 | #include "third_party/cityhash/city.h" 32 | 33 | // Hash function for a byte array. 34 | uint128 CityHashCrc128(const char *s, size_t len); 35 | 36 | // Hash function for a byte array. For convenience, a 128-bit seed is also 37 | // hashed into the result. 38 | uint128 CityHashCrc128WithSeed(const char *s, size_t len, uint128 seed); 39 | 40 | // Hash function for a byte array. Sets result[0] ... result[3]. 41 | void CityHashCrc256(const char *s, size_t len, uint64 *result); 42 | 43 | #endif // CITY_HASH_CRC_H_ 44 | -------------------------------------------------------------------------------- /third_party/cityhash/targets.mk: -------------------------------------------------------------------------------- 1 | $(eval $(call hdr_only_cc_library, \ 2 | third_party/cityhash/citycrc, \ 3 | third_party/cityhash/city \ 4 | )) 5 | 6 | $(eval $(call cc_library, \ 7 | third_party/cityhash/city, \ 8 | base/integral_types \ 9 | )) 10 | 11 | ###################################################### 12 | # Tests 13 | ###################################################### 14 | 15 | $(eval $(call cc_test, \ 16 | third_party/cityhash/city_test, \ 17 | third_party/cityhash/city \ 18 | third_party/cityhash/citycrc, \ 19 | )) 20 | -------------------------------------------------------------------------------- /third_party/gmock/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Mocking Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Benoit Sigoure 7 | Bogdan Piloca 8 | Chandler Carruth 9 | Dave MacLachlan 10 | David Anderson 11 | Dean Sturtevant 12 | Gene Volovich 13 | Hal Burch 14 | Jeffrey Yasskin 15 | Jim Keller 16 | Joe Walnes 17 | Jon Wray 18 | Keir Mierle 19 | Keith Ray 20 | Kostya Serebryany 21 | Lev Makhlis 22 | Manuel Klimek 23 | Mario Tanev 24 | Mark Paskin 25 | Markus Heule 26 | Matthew Simmons 27 | Mike Bland 28 | Neal Norwitz 29 | Nermin Ozkiranartli 30 | Owen Carlsen 31 | Paneendra Ba 32 | Paul Menage 33 | Piotr Kaminski 34 | Russ Rufer 35 | Sverre Sundsdal 36 | Takeshi Yoshino 37 | Vadim Berman 38 | Vlad Losev 39 | Wolfgang Klier 40 | Zhanyong Wan 41 | -------------------------------------------------------------------------------- /third_party/gmock/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /third_party/gmock/build-aux/config.h.in: -------------------------------------------------------------------------------- 1 | /* build-aux/config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file. */ 4 | #undef HAVE_DLFCN_H 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_INTTYPES_H 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #undef HAVE_MEMORY_H 11 | 12 | /* Define if you have POSIX threads libraries and header files. */ 13 | #undef HAVE_PTHREAD 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_STDINT_H 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_STDLIB_H 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #undef HAVE_STRINGS_H 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_STRING_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_SYS_STAT_H 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_SYS_TYPES_H 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_UNISTD_H 35 | 36 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 37 | */ 38 | #undef LT_OBJDIR 39 | 40 | /* Name of package */ 41 | #undef PACKAGE 42 | 43 | /* Define to the address where bug reports for this package should be sent. */ 44 | #undef PACKAGE_BUGREPORT 45 | 46 | /* Define to the full name of this package. */ 47 | #undef PACKAGE_NAME 48 | 49 | /* Define to the full name and version of this package. */ 50 | #undef PACKAGE_STRING 51 | 52 | /* Define to the one symbol short name of this package. */ 53 | #undef PACKAGE_TARNAME 54 | 55 | /* Define to the home page for this package. */ 56 | #undef PACKAGE_URL 57 | 58 | /* Define to the version of this package. */ 59 | #undef PACKAGE_VERSION 60 | 61 | /* Define to necessary symbol if this constant uses a non-standard name on 62 | your system. */ 63 | #undef PTHREAD_CREATE_JOINABLE 64 | 65 | /* Define to 1 if you have the ANSI C header files. */ 66 | #undef STDC_HEADERS 67 | 68 | /* Version number of package */ 69 | #undef VERSION 70 | -------------------------------------------------------------------------------- /third_party/gmock/fused-src/gmock_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include 33 | #include "gmock/gmock.h" 34 | #include "gtest/gtest.h" 35 | 36 | // MS C++ compiler/linker has a bug on Windows (not on Windows CE), which 37 | // causes a link error when _tmain is defined in a static library and UNICODE 38 | // is enabled. For this reason instead of _tmain, main function is used on 39 | // Windows. See the following link to track the current status of this bug: 40 | // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=394464 // NOLINT 41 | #if GTEST_OS_WINDOWS_MOBILE 42 | # include // NOLINT 43 | 44 | GTEST_API_ int _tmain(int argc, TCHAR** argv) { 45 | #else 46 | GTEST_API_ int main(int argc, char** argv) { 47 | #endif // GTEST_OS_WINDOWS_MOBILE 48 | std::cout << "Running main() from gmock_main.cc\n"; 49 | // Since Google Mock depends on Google Test, InitGoogleMock() is 50 | // also responsible for initializing Google Test. Therefore there's 51 | // no need for calling testing::InitGoogleTest() separately. 52 | testing::InitGoogleMock(&argc, argv); 53 | return RUN_ALL_TESTS(); 54 | } 55 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Testing Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Ajay Joshi 7 | Balázs Dán 8 | Bharat Mediratta 9 | Chandler Carruth 10 | Chris Prince 11 | Chris Taylor 12 | Dan Egnor 13 | Eric Roman 14 | Hady Zalek 15 | Jeffrey Yasskin 16 | Jói Sigurðsson 17 | Keir Mierle 18 | Keith Ray 19 | Kenton Varda 20 | Manuel Klimek 21 | Markus Heule 22 | Mika Raento 23 | Miklós Fazekas 24 | Pasi Valminen 25 | Patrick Hanna 26 | Patrick Riley 27 | Peter Kaminski 28 | Preston Jackson 29 | Rainer Klaffenboeck 30 | Russ Cox 31 | Russ Rufer 32 | Sean Mcafee 33 | Sigurður Ásgeirsson 34 | Tracy Bialik 35 | Vadim Berman 36 | Vlad Losev 37 | Zhanyong Wan 38 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/build-aux/config.h.in: -------------------------------------------------------------------------------- 1 | /* build-aux/config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file. */ 4 | #undef HAVE_DLFCN_H 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_INTTYPES_H 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #undef HAVE_MEMORY_H 11 | 12 | /* Define if you have POSIX threads libraries and header files. */ 13 | #undef HAVE_PTHREAD 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_STDINT_H 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_STDLIB_H 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #undef HAVE_STRINGS_H 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_STRING_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_SYS_STAT_H 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_SYS_TYPES_H 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_UNISTD_H 35 | 36 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 37 | */ 38 | #undef LT_OBJDIR 39 | 40 | /* Name of package */ 41 | #undef PACKAGE 42 | 43 | /* Define to the address where bug reports for this package should be sent. */ 44 | #undef PACKAGE_BUGREPORT 45 | 46 | /* Define to the full name of this package. */ 47 | #undef PACKAGE_NAME 48 | 49 | /* Define to the full name and version of this package. */ 50 | #undef PACKAGE_STRING 51 | 52 | /* Define to the one symbol short name of this package. */ 53 | #undef PACKAGE_TARNAME 54 | 55 | /* Define to the home page for this package. */ 56 | #undef PACKAGE_URL 57 | 58 | /* Define to the version of this package. */ 59 | #undef PACKAGE_VERSION 60 | 61 | /* Define to necessary symbol if this constant uses a non-standard name on 62 | your system. */ 63 | #undef PTHREAD_CREATE_JOINABLE 64 | 65 | /* Define to 1 if you have the ANSI C header files. */ 66 | #undef STDC_HEADERS 67 | 68 | /* Version number of package */ 69 | #undef VERSION 70 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/codegear/gtest.groupproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {c1d923e0-6cba-4332-9b6f-3420acbf5091} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Default.Personality 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/codegear/gtest_all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // C++Builder's IDE cannot build a static library from files with hyphens 35 | // in their name. See http://qc.codegear.com/wc/qcmain.aspx?d=70977 . 36 | // This file serves as a workaround. 37 | 38 | #include "src/gtest-all.cc" 39 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/codegear/gtest_link.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Links gtest.lib and gtest_main.lib into the current project in C++Builder. 35 | // This means that these libraries can't be renamed, but it's the only way to 36 | // ensure that Debug versus Release test builds are linked against the 37 | // appropriate Debug or Release build of the libraries. 38 | 39 | #pragma link "gtest.lib" 40 | #pragma link "gtest_main.lib" 41 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/fused-src/gtest/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | printf("Running main() from gtest_main.cc\n"); 36 | testing::InitGoogleTest(&argc, argv); 37 | return RUN_ALL_TESTS(); 38 | } 39 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/include/gtest/gtest_prod.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Google C++ Testing Framework definitions useful in production code. 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 35 | #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 36 | 37 | // When you need to test the private or protected members of a class, 38 | // use the FRIEND_TEST macro to declare your tests as friends of the 39 | // class. For example: 40 | // 41 | // class MyClass { 42 | // private: 43 | // void MyMethod(); 44 | // FRIEND_TEST(MyClassTest, MyMethod); 45 | // }; 46 | // 47 | // class MyClassTest : public testing::Test { 48 | // // ... 49 | // }; 50 | // 51 | // TEST_F(MyClassTest, MyMethod) { 52 | // // Can call MyClass::MyMethod() here. 53 | // } 54 | 55 | #define FRIEND_TEST(test_case_name, test_name)\ 56 | friend class test_case_name##_##test_name##_Test 57 | 58 | #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 59 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/msvc/gtest-md.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest-md", "gtest-md.vcproj", "{C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_main-md", "gtest_main-md.vcproj", "{3AF54C8A-10BF-4332-9147-F68ED9862033}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | EndProjectSection 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_prod_test-md", "gtest_prod_test-md.vcproj", "{24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}" 11 | ProjectSection(ProjectDependencies) = postProject 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_unittest-md", "gtest_unittest-md.vcproj", "{4D9FDFB5-986A-4139-823C-F4EE0ED481A2}" 15 | ProjectSection(ProjectDependencies) = postProject 16 | EndProjectSection 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfiguration) = preSolution 20 | Debug = Debug 21 | Release = Release 22 | EndGlobalSection 23 | GlobalSection(ProjectConfiguration) = postSolution 24 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug.ActiveCfg = Debug|Win32 25 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug.Build.0 = Debug|Win32 26 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release.ActiveCfg = Release|Win32 27 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release.Build.0 = Release|Win32 28 | {3AF54C8A-10BF-4332-9147-F68ED9862033}.Debug.ActiveCfg = Debug|Win32 29 | {3AF54C8A-10BF-4332-9147-F68ED9862033}.Debug.Build.0 = Debug|Win32 30 | {3AF54C8A-10BF-4332-9147-F68ED9862033}.Release.ActiveCfg = Release|Win32 31 | {3AF54C8A-10BF-4332-9147-F68ED9862033}.Release.Build.0 = Release|Win32 32 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Debug.ActiveCfg = Debug|Win32 33 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Debug.Build.0 = Debug|Win32 34 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Release.ActiveCfg = Release|Win32 35 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Release.Build.0 = Release|Win32 36 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Debug.ActiveCfg = Debug|Win32 37 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Debug.Build.0 = Debug|Win32 38 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Release.ActiveCfg = Release|Win32 39 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Release.Build.0 = Release|Win32 40 | EndGlobalSection 41 | GlobalSection(ExtensibilityGlobals) = postSolution 42 | EndGlobalSection 43 | GlobalSection(ExtensibilityAddIns) = postSolution 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/msvc/gtest.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest", "gtest.vcproj", "{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_main", "gtest_main.vcproj", "{3AF54C8A-10BF-4332-9147-F68ED9862032}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | EndProjectSection 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_unittest", "gtest_unittest.vcproj", "{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}" 11 | ProjectSection(ProjectDependencies) = postProject 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_prod_test", "gtest_prod_test.vcproj", "{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}" 15 | ProjectSection(ProjectDependencies) = postProject 16 | EndProjectSection 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfiguration) = preSolution 20 | Debug = Debug 21 | Release = Release 22 | EndGlobalSection 23 | GlobalSection(ProjectConfiguration) = postSolution 24 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Debug.ActiveCfg = Debug|Win32 25 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Debug.Build.0 = Debug|Win32 26 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Release.ActiveCfg = Release|Win32 27 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Release.Build.0 = Release|Win32 28 | {3AF54C8A-10BF-4332-9147-F68ED9862032}.Debug.ActiveCfg = Debug|Win32 29 | {3AF54C8A-10BF-4332-9147-F68ED9862032}.Debug.Build.0 = Debug|Win32 30 | {3AF54C8A-10BF-4332-9147-F68ED9862032}.Release.ActiveCfg = Release|Win32 31 | {3AF54C8A-10BF-4332-9147-F68ED9862032}.Release.Build.0 = Release|Win32 32 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Debug.ActiveCfg = Debug|Win32 33 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Debug.Build.0 = Debug|Win32 34 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Release.ActiveCfg = Release|Win32 35 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Release.Build.0 = Release|Win32 36 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Debug.ActiveCfg = Debug|Win32 37 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Debug.Build.0 = Debug|Win32 38 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Release.ActiveCfg = Release|Win32 39 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Release.Build.0 = Release|Win32 40 | EndGlobalSection 41 | GlobalSection(ExtensibilityGlobals) = postSolution 42 | EndGlobalSection 43 | GlobalSection(ExtensibilityAddIns) = postSolution 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/samples/sample1.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #include "sample1.h" 35 | 36 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1. 37 | int Factorial(int n) { 38 | int result = 1; 39 | for (int i = 1; i <= n; i++) { 40 | result *= i; 41 | } 42 | 43 | return result; 44 | } 45 | 46 | // Returns true iff n is a prime number. 47 | bool IsPrime(int n) { 48 | // Trivial case 1: small numbers 49 | if (n <= 1) return false; 50 | 51 | // Trivial case 2: even numbers 52 | if (n % 2 == 0) return n == 2; 53 | 54 | // Now, we have that n is odd and n >= 3. 55 | 56 | // Try to divide n by every odd number i, starting from 3 57 | for (int i = 3; ; i += 2) { 58 | // We only have to try i up to the squre root of n 59 | if (i > n/i) break; 60 | 61 | // Now, we have i <= n/i < n. 62 | // If n is divisible by i, n is not prime. 63 | if (n % i == 0) return false; 64 | } 65 | 66 | // n has no integer factor in the range (1, n), and thus is prime. 67 | return true; 68 | } 69 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/samples/sample1.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #ifndef GTEST_SAMPLES_SAMPLE1_H_ 35 | #define GTEST_SAMPLES_SAMPLE1_H_ 36 | 37 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1. 38 | int Factorial(int n); 39 | 40 | // Returns true iff n is a prime number. 41 | bool IsPrime(int n); 42 | 43 | #endif // GTEST_SAMPLES_SAMPLE1_H_ 44 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/samples/sample2.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #include "sample2.h" 35 | 36 | #include 37 | 38 | // Clones a 0-terminated C string, allocating memory using new. 39 | const char* MyString::CloneCString(const char* a_c_string) { 40 | if (a_c_string == NULL) return NULL; 41 | 42 | const size_t len = strlen(a_c_string); 43 | char* const clone = new char[ len + 1 ]; 44 | memcpy(clone, a_c_string, len + 1); 45 | 46 | return clone; 47 | } 48 | 49 | // Sets the 0-terminated C string this MyString object 50 | // represents. 51 | void MyString::Set(const char* a_c_string) { 52 | // Makes sure this works when c_string == c_string_ 53 | const char* const temp = MyString::CloneCString(a_c_string); 54 | delete[] c_string_; 55 | c_string_ = temp; 56 | } 57 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/samples/sample4.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #include 35 | 36 | #include "sample4.h" 37 | 38 | // Returns the current counter value, and increments it. 39 | int Counter::Increment() { 40 | return counter_++; 41 | } 42 | 43 | // Prints the current counter value to STDOUT. 44 | void Counter::Print() const { 45 | printf("%d", counter_); 46 | } 47 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/samples/sample4.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #ifndef GTEST_SAMPLES_SAMPLE4_H_ 35 | #define GTEST_SAMPLES_SAMPLE4_H_ 36 | 37 | // A simple monotonic counter. 38 | class Counter { 39 | private: 40 | int counter_; 41 | 42 | public: 43 | // Creates a counter that starts at 0. 44 | Counter() : counter_(0) {} 45 | 46 | // Returns the current counter value, and increments it. 47 | int Increment(); 48 | 49 | // Prints the current counter value to STDOUT. 50 | void Print() const; 51 | }; 52 | 53 | #endif // GTEST_SAMPLES_SAMPLE4_H_ 54 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/samples/sample4_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | #include "sample4.h" 34 | 35 | // Tests the Increment() method. 36 | TEST(Counter, Increment) { 37 | Counter c; 38 | 39 | // EXPECT_EQ() evaluates its arguments exactly once, so they 40 | // can have side effects. 41 | 42 | EXPECT_EQ(0, c.Increment()); 43 | EXPECT_EQ(1, c.Increment()); 44 | EXPECT_EQ(2, c.Increment()); 45 | } 46 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/scripts/test/Makefile: -------------------------------------------------------------------------------- 1 | # A Makefile for fusing Google Test and building a sample test against it. 2 | # 3 | # SYNOPSIS: 4 | # 5 | # make [all] - makes everything. 6 | # make TARGET - makes the given target. 7 | # make check - makes everything and runs the built sample test. 8 | # make clean - removes all files generated by make. 9 | 10 | # Points to the root of fused Google Test, relative to where this file is. 11 | FUSED_GTEST_DIR = output 12 | 13 | # Paths to the fused gtest files. 14 | FUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h 15 | FUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 16 | 17 | # Where to find the sample test. 18 | SAMPLE_DIR = ../../samples 19 | 20 | # Where to find gtest_main.cc. 21 | GTEST_MAIN_CC = ../../src/gtest_main.cc 22 | 23 | # Flags passed to the preprocessor. 24 | # We have no idea here whether pthreads is available in the system, so 25 | # disable its use. 26 | CPPFLAGS += -I$(FUSED_GTEST_DIR) -DGTEST_HAS_PTHREAD=0 27 | 28 | # Flags passed to the C++ compiler. 29 | CXXFLAGS += -g 30 | 31 | all : sample1_unittest 32 | 33 | check : all 34 | ./sample1_unittest 35 | 36 | clean : 37 | rm -rf $(FUSED_GTEST_DIR) sample1_unittest *.o 38 | 39 | $(FUSED_GTEST_H) : 40 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 41 | 42 | $(FUSED_GTEST_ALL_CC) : 43 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 44 | 45 | gtest-all.o : $(FUSED_GTEST_H) $(FUSED_GTEST_ALL_CC) 46 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 47 | 48 | gtest_main.o : $(FUSED_GTEST_H) $(GTEST_MAIN_CC) 49 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_MAIN_CC) 50 | 51 | sample1.o : $(SAMPLE_DIR)/sample1.cc $(SAMPLE_DIR)/sample1.h 52 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1.cc 53 | 54 | sample1_unittest.o : $(SAMPLE_DIR)/sample1_unittest.cc \ 55 | $(SAMPLE_DIR)/sample1.h $(FUSED_GTEST_H) 56 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1_unittest.cc 57 | 58 | sample1_unittest : sample1.o sample1_unittest.o gtest-all.o gtest_main.o 59 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ 60 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/src/gtest-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Sometimes it's desirable to build Google Test by compiling a single file. 35 | // This file serves this purpose. 36 | 37 | // This line ensures that gtest.h can be compiled on its own, even 38 | // when it's fused. 39 | #include "gtest/gtest.h" 40 | 41 | // The following lines pull in the real gtest *.cc files. 42 | #include "src/gtest.cc" 43 | #include "src/gtest-death-test.cc" 44 | #include "src/gtest-filepath.cc" 45 | #include "src/gtest-port.cc" 46 | #include "src/gtest-printers.cc" 47 | #include "src/gtest-test-part.cc" 48 | #include "src/gtest-typed-test.cc" 49 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | printf("Running main() from gtest_main.cc\n"); 36 | testing::InitGoogleTest(&argc, argv); 37 | return RUN_ALL_TESTS(); 38 | } 39 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/gtest-param-test_test.h: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Authors: vladl@google.com (Vlad Losev) 31 | // 32 | // The Google C++ Testing Framework (Google Test) 33 | // 34 | // This header file provides classes and functions used internally 35 | // for testing Google Test itself. 36 | 37 | #ifndef GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ 38 | #define GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ 39 | 40 | #include "gtest/gtest.h" 41 | 42 | #if GTEST_HAS_PARAM_TEST 43 | 44 | // Test fixture for testing definition and instantiation of a test 45 | // in separate translation units. 46 | class ExternalInstantiationTest : public ::testing::TestWithParam { 47 | }; 48 | 49 | // Test fixture for testing instantiation of a test in multiple 50 | // translation units. 51 | class InstantiationInMultipleTranslaionUnitsTest 52 | : public ::testing::TestWithParam { 53 | }; 54 | 55 | #endif // GTEST_HAS_PARAM_TEST 56 | 57 | #endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ 58 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/gtest-typed-test2_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. 2 | // All Rights Reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include 33 | 34 | #include "test/gtest-typed-test_test.h" 35 | #include "gtest/gtest.h" 36 | 37 | #if GTEST_HAS_TYPED_TEST_P 38 | 39 | // Tests that the same type-parameterized test case can be 40 | // instantiated in different translation units linked together. 41 | // (ContainerTest is also instantiated in gtest-typed-test_test.cc.) 42 | INSTANTIATE_TYPED_TEST_CASE_P(Vector, ContainerTest, 43 | testing::Types >); 44 | 45 | #endif // GTEST_HAS_TYPED_TEST_P 46 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/gtest-typed-test_test.h: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. 2 | // All Rights Reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #ifndef GTEST_TEST_GTEST_TYPED_TEST_TEST_H_ 33 | #define GTEST_TEST_GTEST_TYPED_TEST_TEST_H_ 34 | 35 | #include "gtest/gtest.h" 36 | 37 | #if GTEST_HAS_TYPED_TEST_P 38 | 39 | using testing::Test; 40 | 41 | // For testing that the same type-parameterized test case can be 42 | // instantiated in different translation units linked together. 43 | // ContainerTest will be instantiated in both gtest-typed-test_test.cc 44 | // and gtest-typed-test2_test.cc. 45 | 46 | template 47 | class ContainerTest : public Test { 48 | }; 49 | 50 | TYPED_TEST_CASE_P(ContainerTest); 51 | 52 | TYPED_TEST_P(ContainerTest, CanBeDefaultConstructed) { 53 | TypeParam container; 54 | } 55 | 56 | TYPED_TEST_P(ContainerTest, InitialSizeIsZero) { 57 | TypeParam container; 58 | EXPECT_EQ(0U, container.size()); 59 | } 60 | 61 | REGISTER_TYPED_TEST_CASE_P(ContainerTest, 62 | CanBeDefaultConstructed, InitialSizeIsZero); 63 | 64 | #endif // GTEST_HAS_TYPED_TEST_P 65 | 66 | #endif // GTEST_TEST_GTEST_TYPED_TEST_TEST_H_ 67 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/gtest_all_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Tests for Google C++ Testing Framework (Google Test) 33 | // 34 | // Sometimes it's desirable to build most of Google Test's own tests 35 | // by compiling a single file. This file serves this purpose. 36 | #include "test/gtest-filepath_test.cc" 37 | #include "test/gtest-linked_ptr_test.cc" 38 | #include "test/gtest-message_test.cc" 39 | #include "test/gtest-options_test.cc" 40 | #include "test/gtest-port_test.cc" 41 | #include "test/gtest_pred_impl_unittest.cc" 42 | #include "test/gtest_prod_test.cc" 43 | #include "test/gtest-test-part_test.cc" 44 | #include "test/gtest-typed-test_test.cc" 45 | #include "test/gtest-typed-test2_test.cc" 46 | #include "test/gtest_unittest.cc" 47 | #include "test/production.cc" 48 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/gtest_help_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | // This program is meant to be run by gtest_help_test.py. Do not run 33 | // it directly. 34 | 35 | #include "gtest/gtest.h" 36 | 37 | // When a help flag is specified, this program should skip the tests 38 | // and exit with 0; otherwise the following test will be executed, 39 | // causing this program to exit with a non-zero code. 40 | TEST(HelpFlagTest, ShouldNotBeRun) { 41 | ASSERT_TRUE(false) << "Tests shouldn't be run when --help is specified."; 42 | } 43 | 44 | #if GTEST_HAS_DEATH_TEST 45 | TEST(DeathTest, UsedByPythonScriptToDetectSupportForDeathTestsInThisBinary) {} 46 | #endif 47 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/gtest_main_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | 34 | // Tests that we don't have to define main() when we link to 35 | // gtest_main instead of gtest. 36 | 37 | namespace { 38 | 39 | TEST(GTestMainTest, ShouldSucceed) { 40 | } 41 | 42 | } // namespace 43 | 44 | // We are using the main() function defined in src/gtest_main.cc, so 45 | // we don't define it here. 46 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/gtest_no_test_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Tests that a Google Test program that has no test defined can run 31 | // successfully. 32 | // 33 | // Author: wan@google.com (Zhanyong Wan) 34 | 35 | #include "gtest/gtest.h" 36 | 37 | int main(int argc, char **argv) { 38 | testing::InitGoogleTest(&argc, argv); 39 | 40 | // An ad-hoc assertion outside of all tests. 41 | // 42 | // This serves three purposes: 43 | // 44 | // 1. It verifies that an ad-hoc assertion can be executed even if 45 | // no test is defined. 46 | // 2. It verifies that a failed ad-hoc assertion causes the test 47 | // program to fail. 48 | // 3. We had a bug where the XML output won't be generated if an 49 | // assertion is executed before RUN_ALL_TESTS() is called, even 50 | // though --gtest_output=xml is specified. This makes sure the 51 | // bug is fixed and doesn't regress. 52 | EXPECT_EQ(1, 2); 53 | 54 | // The above EXPECT_EQ() should cause RUN_ALL_TESTS() to return non-zero. 55 | return RUN_ALL_TESTS() ? 0 : 1; 56 | } 57 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/gtest_prod_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Unit test for include/gtest/gtest_prod.h. 33 | 34 | #include "gtest/gtest.h" 35 | #include "test/production.h" 36 | 37 | // Tests that private members can be accessed from a TEST declared as 38 | // a friend of the class. 39 | TEST(PrivateCodeTest, CanAccessPrivateMembers) { 40 | PrivateCode a; 41 | EXPECT_EQ(0, a.x_); 42 | 43 | a.set_x(1); 44 | EXPECT_EQ(1, a.x_); 45 | } 46 | 47 | typedef testing::Test PrivateCodeFixtureTest; 48 | 49 | // Tests that private members can be accessed from a TEST_F declared 50 | // as a friend of the class. 51 | TEST_F(PrivateCodeFixtureTest, CanAccessPrivateMembers) { 52 | PrivateCode a; 53 | EXPECT_EQ(0, a.x_); 54 | 55 | a.set_x(2); 56 | EXPECT_EQ(2, a.x_); 57 | } 58 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/gtest_sole_header_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | // This test verifies that it's possible to use Google Test by including 33 | // the gtest.h header file alone. 34 | 35 | #include "gtest/gtest.h" 36 | 37 | namespace { 38 | 39 | void Subroutine() { 40 | EXPECT_EQ(42, 42); 41 | } 42 | 43 | TEST(NoFatalFailureTest, ExpectNoFatalFailure) { 44 | EXPECT_NO_FATAL_FAILURE(;); 45 | EXPECT_NO_FATAL_FAILURE(SUCCEED()); 46 | EXPECT_NO_FATAL_FAILURE(Subroutine()); 47 | EXPECT_NO_FATAL_FAILURE({ SUCCEED(); }); 48 | } 49 | 50 | TEST(NoFatalFailureTest, AssertNoFatalFailure) { 51 | ASSERT_NO_FATAL_FAILURE(;); 52 | ASSERT_NO_FATAL_FAILURE(SUCCEED()); 53 | ASSERT_NO_FATAL_FAILURE(Subroutine()); 54 | ASSERT_NO_FATAL_FAILURE({ SUCCEED(); }); 55 | } 56 | 57 | } // namespace 58 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/gtest_uninitialized_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2008, Google Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | """Verifies that Google Test warns the user when not initialized properly.""" 33 | 34 | __author__ = 'wan@google.com (Zhanyong Wan)' 35 | 36 | import gtest_test_utils 37 | 38 | 39 | COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_uninitialized_test_') 40 | 41 | 42 | def Assert(condition): 43 | if not condition: 44 | raise AssertionError 45 | 46 | 47 | def AssertEq(expected, actual): 48 | if expected != actual: 49 | print 'Expected: %s' % (expected,) 50 | print ' Actual: %s' % (actual,) 51 | raise AssertionError 52 | 53 | 54 | def TestExitCodeAndOutput(command): 55 | """Runs the given command and verifies its exit code and output.""" 56 | 57 | # Verifies that 'command' exits with code 1. 58 | p = gtest_test_utils.Subprocess(command) 59 | Assert(p.exited) 60 | AssertEq(1, p.exit_code) 61 | Assert('InitGoogleTest' in p.output) 62 | 63 | 64 | class GTestUninitializedTest(gtest_test_utils.TestCase): 65 | def testExitCodeAndOutput(self): 66 | TestExitCodeAndOutput(COMMAND) 67 | 68 | 69 | if __name__ == '__main__': 70 | gtest_test_utils.Main() 71 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/gtest_uninitialized_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | 34 | TEST(DummyTest, Dummy) { 35 | // This test doesn't verify anything. We just need it to create a 36 | // realistic stage for testing the behavior of Google Test when 37 | // RUN_ALL_TESTS() is called without testing::InitGoogleTest() being 38 | // called first. 39 | } 40 | 41 | int main() { 42 | return RUN_ALL_TESTS(); 43 | } 44 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/gtest_xml_outfile1_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: keith.ray@gmail.com (Keith Ray) 31 | // 32 | // gtest_xml_outfile1_test_ writes some xml via TestProperty used by 33 | // gtest_xml_outfiles_test.py 34 | 35 | #include "gtest/gtest.h" 36 | 37 | class PropertyOne : public testing::Test { 38 | protected: 39 | virtual void SetUp() { 40 | RecordProperty("SetUpProp", 1); 41 | } 42 | virtual void TearDown() { 43 | RecordProperty("TearDownProp", 1); 44 | } 45 | }; 46 | 47 | TEST_F(PropertyOne, TestSomeProperties) { 48 | RecordProperty("TestSomeProperty", 1); 49 | } 50 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/gtest_xml_outfile2_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: keith.ray@gmail.com (Keith Ray) 31 | // 32 | // gtest_xml_outfile2_test_ writes some xml via TestProperty used by 33 | // gtest_xml_outfiles_test.py 34 | 35 | #include "gtest/gtest.h" 36 | 37 | class PropertyTwo : public testing::Test { 38 | protected: 39 | virtual void SetUp() { 40 | RecordProperty("SetUpProp", 2); 41 | } 42 | virtual void TearDown() { 43 | RecordProperty("TearDownProp", 2); 44 | } 45 | }; 46 | 47 | TEST_F(PropertyTwo, TestSomeProperties) { 48 | RecordProperty("TestSomeProperty", 2); 49 | } 50 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/production.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // This is part of the unit test for include/gtest/gtest_prod.h. 33 | 34 | #include "production.h" 35 | 36 | PrivateCode::PrivateCode() : x_(0) {} 37 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/test/production.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // This is part of the unit test for include/gtest/gtest_prod.h. 33 | 34 | #ifndef GTEST_TEST_PRODUCTION_H_ 35 | #define GTEST_TEST_PRODUCTION_H_ 36 | 37 | #include "gtest/gtest_prod.h" 38 | 39 | class PrivateCode { 40 | public: 41 | // Declares a friend test that does not use a fixture. 42 | FRIEND_TEST(PrivateCodeTest, CanAccessPrivateMembers); 43 | 44 | // Declares a friend test that uses a fixture. 45 | FRIEND_TEST(PrivateCodeFixtureTest, CanAccessPrivateMembers); 46 | 47 | PrivateCode(); 48 | 49 | int x() const { return x_; } 50 | private: 51 | void set_x(int an_x) { x_ = an_x; } 52 | int x_; 53 | }; 54 | 55 | #endif // GTEST_TEST_PRODUCTION_H_ 56 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/xcode/Config/DebugProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugProject.xcconfig 3 | // 4 | // These are Debug Configuration project settings for the gtest framework and 5 | // examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // No optimization 14 | GCC_OPTIMIZATION_LEVEL = 0 15 | 16 | // Deployment postprocessing is what triggers Xcode to strip, turn it off 17 | DEPLOYMENT_POSTPROCESSING = NO 18 | 19 | // Dead code stripping off 20 | DEAD_CODE_STRIPPING = NO 21 | 22 | // Debug symbols should be on obviously 23 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 24 | 25 | // Define the DEBUG macro in all debug builds 26 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1 27 | 28 | // These are turned off to avoid STL incompatibilities with client code 29 | // // Turns on special C++ STL checks to "encourage" good STL use 30 | // GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS 31 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/xcode/Config/FrameworkTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // FrameworkTarget.xcconfig 3 | // 4 | // These are Framework target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Dynamic libs need to be position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Dynamic libs should not have their external symbols stripped. 14 | STRIP_STYLE = non-global 15 | 16 | // Let the user install by specifying the $DSTROOT with xcodebuild 17 | SKIP_INSTALL = NO 18 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/xcode/Config/General.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // General.xcconfig 3 | // 4 | // These are General configuration settings for the gtest framework and 5 | // examples. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Build for PPC and Intel, 32- and 64-bit 11 | ARCHS = i386 x86_64 ppc ppc64 12 | 13 | // Zerolink prevents link warnings so turn it off 14 | ZERO_LINK = NO 15 | 16 | // Prebinding considered unhelpful in 10.3 and later 17 | PREBINDING = NO 18 | 19 | // Strictest warning policy 20 | WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow 21 | 22 | // Work around Xcode bugs by using external strip. See: 23 | // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html 24 | SEPARATE_STRIP = YES 25 | 26 | // Force C99 dialect 27 | GCC_C_LANGUAGE_STANDARD = c99 28 | 29 | // not sure why apple defaults this on, but it's pretty risky 30 | ALWAYS_SEARCH_USER_PATHS = NO 31 | 32 | // Turn on position dependent code for most cases (overridden where appropriate) 33 | GCC_DYNAMIC_NO_PIC = YES 34 | 35 | // Default SDK and minimum OS version is 10.4 36 | SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk 37 | MACOSX_DEPLOYMENT_TARGET = 10.4 38 | GCC_VERSION = 4.0 39 | 40 | // VERSIONING BUILD SETTINGS (used in Info.plist) 41 | GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc. 42 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/xcode/Config/ReleaseProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseProject.xcconfig 3 | // 4 | // These are Release Configuration project settings for the gtest framework 5 | // and examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // subconfig/Release.xcconfig 14 | 15 | // Optimize for space and size (Apple recommendation) 16 | GCC_OPTIMIZATION_LEVEL = s 17 | 18 | // Deploment postprocessing is what triggers Xcode to strip 19 | DEPLOYMENT_POSTPROCESSING = YES 20 | 21 | // No symbols 22 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 23 | 24 | // Dead code strip does not affect ObjC code but can help for C 25 | DEAD_CODE_STRIPPING = YES 26 | 27 | // NDEBUG is used by things like assert.h, so define it for general compat. 28 | // ASSERT going away in release tends to create unused vars. 29 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable 30 | 31 | // When we strip we want to strip all symbols in release, but save externals. 32 | STRIP_STYLE = all 33 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/xcode/Config/StaticLibraryTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // StaticLibraryTarget.xcconfig 3 | // 4 | // These are static library target settings for libgtest.a. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Static libs can be included in bundles so make them position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Static libs should not have their internal globals or external symbols 14 | // stripped. 15 | STRIP_STYLE = debugging 16 | 17 | // Let the user install by specifying the $DSTROOT with xcodebuild 18 | SKIP_INSTALL = NO 19 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/xcode/Config/TestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // TestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME) 8 | HEADER_SEARCH_PATHS = ../include 9 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/xcode/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.${PRODUCT_NAME} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | GTEST_VERSIONINFO_LONG 21 | CFBundleShortVersionString 22 | GTEST_VERSIONINFO_SHORT 23 | CFBundleGetInfoString 24 | ${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT} 25 | NSHumanReadableCopyright 26 | ${GTEST_VERSIONINFO_ABOUT} 27 | CSResourcesFileMapped 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/xcode/Samples/FrameworkSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.gtest.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/xcode/Samples/FrameworkSample/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2008, Google Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # Executes the samples and tests for the Google Test Framework. 33 | 34 | # Help the dynamic linker find the path to the libraries. 35 | export DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR 36 | export DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR 37 | 38 | # Create some executables. 39 | test_executables=$@ 40 | 41 | # Now execute each one in turn keeping track of how many succeeded and failed. 42 | succeeded=0 43 | failed=0 44 | failed_list=() 45 | for test in ${test_executables[*]}; do 46 | "$test" 47 | result=$? 48 | if [ $result -eq 0 ]; then 49 | succeeded=$(( $succeeded + 1 )) 50 | else 51 | failed=$(( failed + 1 )) 52 | failed_list="$failed_list $test" 53 | fi 54 | done 55 | 56 | # Report the successes and failures to the console. 57 | echo "Tests complete with $succeeded successes and $failed failures." 58 | if [ $failed -ne 0 ]; then 59 | echo "The following tests failed:" 60 | echo $failed_list 61 | fi 62 | exit $failed 63 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/xcode/Samples/FrameworkSample/widget.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: preston.a.jackson@gmail.com (Preston Jackson) 31 | // 32 | // Google Test - FrameworkSample 33 | // widget.cc 34 | // 35 | 36 | // Widget is a very simple class used for demonstrating the use of gtest 37 | 38 | #include "widget.h" 39 | 40 | Widget::Widget(int number, const std::string& name) 41 | : number_(number), 42 | name_(name) {} 43 | 44 | Widget::~Widget() {} 45 | 46 | float Widget::GetFloatValue() const { 47 | return number_; 48 | } 49 | 50 | int Widget::GetIntValue() const { 51 | return static_cast(number_); 52 | } 53 | 54 | std::string Widget::GetStringValue() const { 55 | return name_; 56 | } 57 | 58 | void Widget::GetCharPtrValue(char* buffer, size_t max_size) const { 59 | // Copy the char* representation of name_ into buffer, up to max_size. 60 | strncpy(buffer, name_.c_str(), max_size-1); 61 | buffer[max_size-1] = '\0'; 62 | return; 63 | } 64 | -------------------------------------------------------------------------------- /third_party/gmock/gtest/xcode/Samples/FrameworkSample/widget.h: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: preston.a.jackson@gmail.com (Preston Jackson) 31 | // 32 | // Google Test - FrameworkSample 33 | // widget.h 34 | // 35 | 36 | // Widget is a very simple class used for demonstrating the use of gtest. It 37 | // simply stores two values a string and an integer, which are returned via 38 | // public accessors in multiple forms. 39 | 40 | #import 41 | 42 | class Widget { 43 | public: 44 | Widget(int number, const std::string& name); 45 | ~Widget(); 46 | 47 | // Public accessors to number data 48 | float GetFloatValue() const; 49 | int GetIntValue() const; 50 | 51 | // Public accessors to the string data 52 | std::string GetStringValue() const; 53 | void GetCharPtrValue(char* buffer, size_t max_size) const; 54 | 55 | private: 56 | // Data members 57 | float number_; 58 | std::string name_; 59 | }; 60 | -------------------------------------------------------------------------------- /third_party/gmock/include/gmock/gmock-more-matchers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: marcus.boerger@google.com (Marcus Boerger) 31 | 32 | // Google Mock - a framework for writing C++ mock classes. 33 | // 34 | // This file implements some matchers that depend on gmock-generated-matchers.h. 35 | // 36 | // Note that tests are implemented in gmock-matchers_test.cc rather than 37 | // gmock-more-matchers-test.cc. 38 | 39 | #ifndef GMOCK_GMOCK_MORE_MATCHERS_H_ 40 | #define GMOCK_GMOCK_MORE_MATCHERS_H_ 41 | 42 | #include "gmock/gmock-generated-matchers.h" 43 | 44 | namespace testing { 45 | 46 | // Defines a matcher that matches an empty container. The container must 47 | // support both size() and empty(), which all STL-like containers provide. 48 | MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") { 49 | if (arg.empty()) { 50 | return true; 51 | } 52 | *result_listener << "whose size is " << arg.size(); 53 | return false; 54 | } 55 | 56 | } // namespace testing 57 | 58 | #endif // GMOCK_GMOCK_MORE_MATCHERS_H_ 59 | -------------------------------------------------------------------------------- /third_party/gmock/msvc/2005/gmock.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock", "gmock.vcproj", "{34681F0D-CE45-415D-B5F2-5C662DFE3BD5}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_test", "gmock_test.vcproj", "{F10D22F8-AC7B-4213-8720-608E7D878CD2}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_main", "gmock_main.vcproj", "{E4EF614B-30DF-4954-8C53-580A0BF6B589}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Release|Win32 = Release|Win32 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.Build.0 = Debug|Win32 18 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.ActiveCfg = Release|Win32 19 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.Build.0 = Release|Win32 20 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.Build.0 = Debug|Win32 22 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.ActiveCfg = Release|Win32 23 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.Build.0 = Release|Win32 24 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.Build.0 = Debug|Win32 26 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.ActiveCfg = Release|Win32 27 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.Build.0 = Release|Win32 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /third_party/gmock/msvc/2005/gmock_config.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 7 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /third_party/gmock/msvc/2010/gmock.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual C++ Express 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock", "gmock.vcxproj", "{34681F0D-CE45-415D-B5F2-5C662DFE3BD5}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_test", "gmock_test.vcxproj", "{F10D22F8-AC7B-4213-8720-608E7D878CD2}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_main", "gmock_main.vcxproj", "{E4EF614B-30DF-4954-8C53-580A0BF6B589}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Release|Win32 = Release|Win32 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.Build.0 = Debug|Win32 18 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.ActiveCfg = Release|Win32 19 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.Build.0 = Release|Win32 20 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.Build.0 = Debug|Win32 22 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.ActiveCfg = Release|Win32 23 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.Build.0 = Release|Win32 24 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.Build.0 = Debug|Win32 26 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.ActiveCfg = Release|Win32 27 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.Build.0 = Release|Win32 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /third_party/gmock/msvc/2010/gmock_config.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ../../gtest 5 | 6 | 7 | <_ProjectFileVersion>10.0.30319.1 8 | 9 | 10 | 11 | $(GTestDir)/include;%(AdditionalIncludeDirectories) 12 | 13 | 14 | 15 | 16 | $(GTestDir) 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /third_party/gmock/scripts/generator/README: -------------------------------------------------------------------------------- 1 | 2 | The Google Mock class generator is an application that is part of cppclean. 3 | For more information about cppclean, see the README.cppclean file or 4 | visit http://code.google.com/p/cppclean/ 5 | 6 | cppclean requires Python 2.3.5 or later. If you don't have Python installed 7 | on your system, you will also need to install it. You can download Python 8 | from: http://www.python.org/download/releases/ 9 | 10 | To use the Google Mock class generator, you need to call it 11 | on the command line passing the header file and class for which you want 12 | to generate a Google Mock class. 13 | 14 | Make sure to install the scripts somewhere in your path. Then you can 15 | run the program. 16 | 17 | gmock_gen.py header-file.h [ClassName]... 18 | 19 | If no ClassNames are specified, all classes in the file are emitted. 20 | 21 | To change the indentation from the default of 2, set INDENT in 22 | the environment. For example to use an indent of 4 spaces: 23 | 24 | INDENT=4 gmock_gen.py header-file.h ClassName 25 | 26 | This version was made from SVN revision 281 in the cppclean repository. 27 | 28 | Known Limitations 29 | ----------------- 30 | Not all code will be generated properly. For example, when mocking templated 31 | classes, the template information is lost. You will need to add the template 32 | information manually. 33 | 34 | Not all permutations of using multiple pointers/references will be rendered 35 | properly. These will also have to be fixed manually. 36 | -------------------------------------------------------------------------------- /third_party/gmock/scripts/generator/cpp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/gjstest/a9c3511359385cd178508713fdc76315babae27b/third_party/gmock/scripts/generator/cpp/__init__.py -------------------------------------------------------------------------------- /third_party/gmock/scripts/generator/cpp/keywords.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2007 Neal Norwitz 4 | # Portions Copyright 2007 Google Inc. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | """C++ keywords and helper utilities for determining keywords.""" 19 | 20 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 21 | 22 | 23 | try: 24 | # Python 3.x 25 | import builtins 26 | except ImportError: 27 | # Python 2.x 28 | import __builtin__ as builtins 29 | 30 | 31 | if not hasattr(builtins, 'set'): 32 | # Nominal support for Python 2.3. 33 | from sets import Set as set 34 | 35 | 36 | TYPES = set('bool char int long short double float void wchar_t unsigned signed'.split()) 37 | TYPE_MODIFIERS = set('auto register const inline extern static virtual volatile mutable'.split()) 38 | ACCESS = set('public protected private friend'.split()) 39 | 40 | CASTS = set('static_cast const_cast dynamic_cast reinterpret_cast'.split()) 41 | 42 | OTHERS = set('true false asm class namespace using explicit this operator sizeof'.split()) 43 | OTHER_TYPES = set('new delete typedef struct union enum typeid typename template'.split()) 44 | 45 | CONTROL = set('case switch default if else return goto'.split()) 46 | EXCEPTION = set('try catch throw'.split()) 47 | LOOP = set('while do for break continue'.split()) 48 | 49 | ALL = TYPES | TYPE_MODIFIERS | ACCESS | CASTS | OTHERS | OTHER_TYPES | CONTROL | EXCEPTION | LOOP 50 | 51 | 52 | def IsKeyword(token): 53 | return token in ALL 54 | 55 | def IsBuiltinType(token): 56 | if token in ('virtual', 'inline'): 57 | # These only apply to methods, they can't be types by themselves. 58 | return False 59 | return token in TYPES or token in TYPE_MODIFIERS 60 | -------------------------------------------------------------------------------- /third_party/gmock/scripts/generator/cpp/utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2007 Neal Norwitz 4 | # Portions Copyright 2007 Google Inc. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | """Generic utilities for C++ parsing.""" 19 | 20 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 21 | 22 | 23 | import sys 24 | 25 | 26 | # Set to True to see the start/end token indices. 27 | DEBUG = True 28 | 29 | 30 | def ReadFile(filename, print_error=True): 31 | """Returns the contents of a file.""" 32 | try: 33 | fp = open(filename) 34 | try: 35 | return fp.read() 36 | finally: 37 | fp.close() 38 | except IOError: 39 | if print_error: 40 | print('Error reading %s: %s' % (filename, sys.exc_info()[1])) 41 | return None 42 | -------------------------------------------------------------------------------- /third_party/gmock/scripts/generator/gmock_gen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2008 Google Inc. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | """Driver for starting up Google Mock class generator.""" 18 | 19 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 20 | 21 | import os 22 | import sys 23 | 24 | if __name__ == '__main__': 25 | # Add the directory of this script to the path so we can import gmock_class. 26 | sys.path.append(os.path.dirname(__file__)) 27 | 28 | from cpp import gmock_class 29 | # Fix the docstring in case they require the usage. 30 | gmock_class.__doc__ = gmock_class.__doc__.replace('gmock_class.py', __file__) 31 | gmock_class.main() 32 | -------------------------------------------------------------------------------- /third_party/gmock/src/gmock-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Google C++ Mocking Framework (Google Mock) 33 | // 34 | // This file #includes all Google Mock implementation .cc files. The 35 | // purpose is to allow a user to build Google Mock by compiling this 36 | // file alone. 37 | 38 | // This line ensures that gmock.h can be compiled on its own, even 39 | // when it's fused. 40 | #include "gmock/gmock.h" 41 | 42 | // The following lines pull in the real gmock *.cc files. 43 | #include "src/gmock-cardinalities.cc" 44 | #include "src/gmock-internal-utils.cc" 45 | #include "src/gmock-matchers.cc" 46 | #include "src/gmock-spec-builders.cc" 47 | #include "src/gmock.cc" 48 | -------------------------------------------------------------------------------- /third_party/gmock/src/gmock_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include 33 | #include "gmock/gmock.h" 34 | #include "gtest/gtest.h" 35 | 36 | // MS C++ compiler/linker has a bug on Windows (not on Windows CE), which 37 | // causes a link error when _tmain is defined in a static library and UNICODE 38 | // is enabled. For this reason instead of _tmain, main function is used on 39 | // Windows. See the following link to track the current status of this bug: 40 | // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=394464 // NOLINT 41 | #if GTEST_OS_WINDOWS_MOBILE 42 | # include // NOLINT 43 | 44 | GTEST_API_ int _tmain(int argc, TCHAR** argv) { 45 | #else 46 | GTEST_API_ int main(int argc, char** argv) { 47 | #endif // GTEST_OS_WINDOWS_MOBILE 48 | std::cout << "Running main() from gmock_main.cc\n"; 49 | // Since Google Mock depends on Google Test, InitGoogleMock() is 50 | // also responsible for initializing Google Test. Therefore there's 51 | // no need for calling testing::InitGoogleTest() separately. 52 | testing::InitGoogleMock(&argc, argv); 53 | return RUN_ALL_TESTS(); 54 | } 55 | -------------------------------------------------------------------------------- /third_party/gmock/test/gmock-port_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: vladl@google.com (Vlad Losev) 31 | 32 | // Google Mock - a framework for writing C++ mock classes. 33 | // 34 | // This file tests the internal cross-platform support utilities. 35 | 36 | #include "gmock/internal/gmock-port.h" 37 | #include "gtest/gtest.h" 38 | 39 | // NOTE: if this file is left without tests for some reason, put a dummy 40 | // test here to make references to symbols in the gtest library and avoid 41 | // 'undefined symbol' linker errors in gmock_main: 42 | 43 | TEST(DummyTest, Dummy) {} 44 | -------------------------------------------------------------------------------- /third_party/gmock/test/gmock_all_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Tests for Google C++ Mocking Framework (Google Mock) 33 | // 34 | // Sometimes it's desirable to build most of Google Mock's own tests 35 | // by compiling a single file. This file serves this purpose. 36 | #include "test/gmock-actions_test.cc" 37 | #include "test/gmock-cardinalities_test.cc" 38 | #include "test/gmock-generated-actions_test.cc" 39 | #include "test/gmock-generated-function-mockers_test.cc" 40 | #include "test/gmock-generated-internal-utils_test.cc" 41 | #include "test/gmock-generated-matchers_test.cc" 42 | #include "test/gmock-internal-utils_test.cc" 43 | #include "test/gmock-matchers_test.cc" 44 | #include "test/gmock-more-actions_test.cc" 45 | #include "test/gmock-nice-strict_test.cc" 46 | #include "test/gmock-port_test.cc" 47 | #include "test/gmock-spec-builders_test.cc" 48 | #include "test/gmock_test.cc" 49 | -------------------------------------------------------------------------------- /third_party/gmock/test/gmock_link2_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev) 31 | 32 | // Google Mock - a framework for writing C++ mock classes. 33 | // 34 | // This file is for verifying that various Google Mock constructs do not 35 | // produce linker errors when instantiated in different translation units. 36 | // Please see gmock_link_test.h for details. 37 | 38 | #define LinkTest LinkTest2 39 | 40 | #include "test/gmock_link_test.h" 41 | -------------------------------------------------------------------------------- /third_party/gmock/test/gmock_link_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev) 31 | 32 | // Google Mock - a framework for writing C++ mock classes. 33 | // 34 | // This file is for verifying that various Google Mock constructs do not 35 | // produce linker errors when instantiated in different translation units. 36 | // Please see gmock_link_test.h for details. 37 | 38 | #define LinkTest LinkTest1 39 | 40 | #include "test/gmock_link_test.h" 41 | -------------------------------------------------------------------------------- /util/gtl/targets.mk: -------------------------------------------------------------------------------- 1 | $(eval $(call hdr_only_cc_library, \ 2 | util/gtl/map_util, \ 3 | )) 4 | -------------------------------------------------------------------------------- /webutil/xml/targets.mk: -------------------------------------------------------------------------------- 1 | $(eval $(call cc_library, \ 2 | webutil/xml/xml_writer, \ 3 | base/basictypes \ 4 | base/logging \ 5 | base/macros \ 6 | base/scoped_ptr \ 7 | base/stl_decl \ 8 | base/stringprintf \ 9 | )) 10 | 11 | ###################################################### 12 | # Tests 13 | ###################################################### 14 | 15 | $(eval $(call cc_test, \ 16 | webutil/xml/xml_writer_test, \ 17 | base/logging \ 18 | webutil/xml/xml_writer \ 19 | , \ 20 | -lxml2 \ 21 | )) 22 | -------------------------------------------------------------------------------- /webutil/xml/xml_writer_test.cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/gjstest/a9c3511359385cd178508713fdc76315babae27b/webutil/xml/xml_writer_test.cc --------------------------------------------------------------------------------