[Gtest][Latest version 1.8.0 build successfully for all four architechtures - armv7l... 55/152255/2 submit/tizen/20171018.023037
authorAmritanshu Pandia <a.pandia1@samsung.com>
Mon, 25 Sep 2017 09:44:03 +0000 (18:44 +0900)
committerJaeKyung Lee <jk79.lee@samsung.com>
Wed, 18 Oct 2017 02:28:23 +0000 (02:28 +0000)
Change-Id: I4cdb71ec83f7f6ad76fb9e450bab89fe17431f7e
Signed-off-by: Amritanshu Pandia <a.pandia1@samsung.com>
(cherry picked from commit 635d3976455f8384d9b387082ec79cacb17d83d1)

158 files changed:
CHANGES
CMakeLists.txt
LICENSE [new file with mode: 0755]
Makefile.am
NOTICE [deleted file]
README [deleted file]
README.md [new file with mode: 0755]
build-aux/.keep [moved from src/.dirstamp with 100% similarity, mode: 0755]
cmake/internal_utils.cmake
codegear/gtest.cbproj
codegear/gtest.groupproj
codegear/gtest_all.cc
codegear/gtest_link.cc
codegear/gtest_main.cbproj
codegear/gtest_unittest.cbproj
config.log [deleted file]
config.status [deleted file]
configure.ac
docs/AdvancedGuide.md [new file with mode: 0755]
docs/DevGuide.md [new file with mode: 0755]
docs/Documentation.md [new file with mode: 0755]
docs/FAQ.md [new file with mode: 0755]
docs/Primer.md [new file with mode: 0755]
docs/PumpManual.md [new file with mode: 0755]
docs/Samples.md [new file with mode: 0755]
docs/V1_5_AdvancedGuide.md [new file with mode: 0755]
docs/V1_5_Documentation.md [new file with mode: 0755]
docs/V1_5_FAQ.md [new file with mode: 0755]
docs/V1_5_Primer.md [new file with mode: 0755]
docs/V1_5_PumpManual.md [new file with mode: 0755]
docs/V1_5_XcodeGuide.md [new file with mode: 0755]
docs/V1_6_AdvancedGuide.md [new file with mode: 0755]
docs/V1_6_Documentation.md [new file with mode: 0755]
docs/V1_6_FAQ.md [new file with mode: 0755]
docs/V1_6_Primer.md [new file with mode: 0755]
docs/V1_6_PumpManual.md [new file with mode: 0755]
docs/V1_6_Samples.md [new file with mode: 0755]
docs/V1_6_XcodeGuide.md [new file with mode: 0755]
docs/V1_7_AdvancedGuide.md [new file with mode: 0755]
docs/V1_7_Documentation.md [new file with mode: 0755]
docs/V1_7_FAQ.md [new file with mode: 0755]
docs/V1_7_Primer.md [new file with mode: 0755]
docs/V1_7_PumpManual.md [new file with mode: 0755]
docs/V1_7_Samples.md [new file with mode: 0755]
docs/V1_7_XcodeGuide.md [new file with mode: 0755]
docs/XcodeGuide.md [new file with mode: 0755]
include/gtest/gtest-death-test.h
include/gtest/gtest-message.h
include/gtest/gtest-param-test.h
include/gtest/gtest-param-test.h.pump
include/gtest/gtest-printers.h
include/gtest/gtest-spi.h
include/gtest/gtest-test-part.h
include/gtest/gtest-typed-test.h
include/gtest/gtest.h
include/gtest/gtest_pred_impl.h
include/gtest/internal/custom/gtest-port.h [new file with mode: 0755]
include/gtest/internal/custom/gtest-printers.h [new file with mode: 0755]
include/gtest/internal/custom/gtest.h [new file with mode: 0755]
include/gtest/internal/gtest-death-test-internal.h
include/gtest/internal/gtest-filepath.h
include/gtest/internal/gtest-internal.h
include/gtest/internal/gtest-linked_ptr.h
include/gtest/internal/gtest-param-util-generated.h
include/gtest/internal/gtest-param-util-generated.h.pump
include/gtest/internal/gtest-param-util.h
include/gtest/internal/gtest-port-arch.h [new file with mode: 0755]
include/gtest/internal/gtest-port.h
include/gtest/internal/gtest-string.h
include/gtest/internal/gtest-tuple.h
include/gtest/internal/gtest-tuple.h.pump
include/gtest/internal/gtest-type-util.h
include/gtest/internal/gtest-type-util.h.pump
lib/.dirstamp [deleted file]
lib/libgtest.la [deleted file]
lib/libgtest_main.la [deleted file]
libtool [deleted file]
make/Makefile
packaging/gtest.changes [changed mode: 0644->0755]
packaging/gtest.manifest [changed mode: 0644->0755]
packaging/gtest.spec [changed mode: 0644->0755]
samples/.dirstamp [deleted file]
samples/libsamples.la [deleted file]
samples/sample1.lo [deleted file]
samples/sample1.o [deleted file]
samples/sample10_unittest.cc
samples/sample1_unittest.cc
samples/sample2.h
samples/sample2.lo [deleted file]
samples/sample2.o [deleted file]
samples/sample2_unittest.cc
samples/sample3-inl.h
samples/sample4.lo [deleted file]
samples/sample4.o [deleted file]
samples/sample5_unittest.cc
samples/sample8_unittest.cc
scripts/common.py [new file with mode: 0755]
scripts/fuse_gtest_files.py
scripts/gen_gtest_pred_impl.py
scripts/gtest-config [deleted file]
scripts/gtest-config.in
scripts/pump.py
scripts/release_docs.py [new file with mode: 0755]
scripts/upload.py [new file with mode: 0755]
scripts/upload_gtest.py [new file with mode: 0755]
src/.libs/gtest-all.o [deleted file]
src/.libs/gtest_main.o [deleted file]
src/gtest-all.o [deleted file]
src/gtest-death-test.cc
src/gtest-filepath.cc
src/gtest-internal-inl.h
src/gtest-port.cc
src/gtest-printers.cc
src/gtest-test-part.cc
src/gtest-typed-test.cc
src/gtest.cc
src/gtest_main.cc
src/gtest_main.o [deleted file]
test/gtest-death-test_test.cc
test/gtest-filepath_test.cc
test/gtest-linked_ptr_test.cc
test/gtest-listener_test.cc
test/gtest-message_test.cc
test/gtest-options_test.cc
test/gtest-param-test_test.cc
test/gtest-param-test_test.h
test/gtest-port_test.cc
test/gtest-printers_test.cc
test/gtest-typed-test_test.cc
test/gtest-unittest-api_test.cc
test/gtest_break_on_failure_unittest.py
test/gtest_catch_exceptions_test.py
test/gtest_catch_exceptions_test_.cc
test/gtest_env_var_test.py
test/gtest_environment_test.cc
test/gtest_filter_unittest.py
test/gtest_list_tests_unittest.py
test/gtest_list_tests_unittest_.cc
test/gtest_no_test_unittest.cc
test/gtest_output_test.py
test/gtest_output_test_.cc
test/gtest_output_test_golden_lin.txt
test/gtest_output_test_golden_win.txt [deleted file]
test/gtest_pred_impl_unittest.cc
test/gtest_premature_exit_test.cc [new file with mode: 0755]
test/gtest_repeat_test.cc
test/gtest_shuffle_test_.cc
test/gtest_stress_test.cc
test/gtest_test_utils.py
test/gtest_throw_on_failure_test.py
test/gtest_throw_on_failure_test_.cc
test/gtest_uninitialized_test.py
test/gtest_unittest.cc
test/gtest_xml_outfiles_test.py
test/gtest_xml_output_unittest.py
test/gtest_xml_output_unittest_.cc
test/gtest_xml_test_utils.py
xcode/gtest.xcodeproj/project.pbxproj

diff --git a/CHANGES b/CHANGES
index 5919245..0552132 100755 (executable)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,30 @@
+Changes for 1.7.0:
+
+* New feature: death tests are supported on OpenBSD and in iOS
+  simulator now.
+* New feature: Google Test now implements a protocol to allow
+  a test runner to detect that a test program has exited
+  prematurely and report it as a failure (before it would be
+  falsely reported as a success if the exit code is 0).
+* New feature: Test::RecordProperty() can now be used outside of the
+  lifespan of a test method, in which case it will be attributed to
+  the current test case or the test program in the XML report.
+* New feature (potentially breaking): --gtest_list_tests now prints
+  the type parameters and value parameters for each test.
+* Improvement: char pointers and char arrays are now escaped properly
+  in failure messages.
+* Improvement: failure summary in XML reports now includes file and
+  line information.
+* Improvement: the <testsuites> XML element now has a timestamp attribute.
+* Improvement: When --gtest_filter is specified, XML report now doesn't
+  contain information about tests that are filtered out.
+* Fixed the bug where long --gtest_filter flag values are truncated in
+  death tests.
+* Potentially breaking change: RUN_ALL_TESTS() is now implemented as a
+  function instead of a macro in order to work better with Clang.
+* Compatibility fixes with C++ 11 and various platforms.
+* Bug/warning fixes.
+
 Changes for 1.6.0:
 
 * New feature: ADD_FAILURE_AT() for reporting a test failure at the
index 0fe2654..621d0f0 100755 (executable)
@@ -22,6 +22,11 @@ option(gtest_build_samples "Build gtest's sample programs." OFF)
 
 option(gtest_disable_pthreads "Disable uses of pthreads in gtest." OFF)
 
+option(
+  gtest_hide_internal_symbols
+  "Build gtest with internal symbols hidden in shared libraries."
+  OFF)
+
 # Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
 include(cmake/hermetic_build.cmake OPTIONAL)
 
@@ -46,6 +51,11 @@ if (COMMAND set_up_hermetic_build)
   set_up_hermetic_build()
 endif()
 
+if (gtest_hide_internal_symbols)
+  set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+  set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
+endif()
+
 # Define helper functions and macros used by Google Test.
 include(cmake/internal_utils.cmake)
 
@@ -59,6 +69,16 @@ include_directories(
 # Where Google Test's libraries can be found.
 link_directories(${gtest_BINARY_DIR}/src)
 
+# Summary of tuple support for Microsoft Visual Studio:
+# Compiler    version(MS)  version(cmake)  Support
+# ----------  -----------  --------------  -----------------------------
+# <= VS 2010  <= 10        <= 1600         Use Google Tests's own tuple.
+# VS 2012     11           1700            std::tr1::tuple + _VARIADIC_MAX=10
+# VS 2013     12           1800            std::tr1::tuple
+if (MSVC AND MSVC_VERSION EQUAL 1700)
+  add_definitions(/D _VARIADIC_MAX=10)
+endif()
+
 ########################################################################
 #
 # Defines the gtest & gtest_main libraries.  User tests should link
@@ -71,13 +91,29 @@ cxx_library(gtest "${cxx_strict}" src/gtest-all.cc)
 cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
 target_link_libraries(gtest_main gtest)
 
+# If the CMake version supports it, attach header directory information
+# to the targets for when we are part of a parent build (ie being pulled
+# in via add_subdirectory() rather than being a standalone build).
+if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
+  target_include_directories(gtest      INTERFACE "${gtest_SOURCE_DIR}/include")
+  target_include_directories(gtest_main INTERFACE "${gtest_SOURCE_DIR}/include")
+endif()
+
+########################################################################
+#
+# Install rules
+install(TARGETS gtest gtest_main
+  DESTINATION lib)
+install(DIRECTORY ${gtest_SOURCE_DIR}/include/gtest
+  DESTINATION include)
+
 ########################################################################
 #
 # Samples on how to link user tests with gtest or gtest_main.
 #
 # They are not built by default.  To build them, set the
 # gtest_build_samples option to ON.  You can do it by running ccmake
-# or specifying the -Dbuild_gtest_samples=ON flag when running cmake.
+# or specifying the -Dgtest_build_samples=ON flag when running cmake.
 
 if (gtest_build_samples)
   cxx_executable(sample1_unittest samples gtest_main samples/sample1.cc)
@@ -124,6 +160,8 @@ if (gtest_build_tests)
     test/gtest-param-test2_test.cc)
   cxx_test(gtest-port_test gtest_main)
   cxx_test(gtest_pred_impl_unittest gtest_main)
+  cxx_test(gtest_premature_exit_test gtest
+    test/gtest_premature_exit_test.cc)
   cxx_test(gtest-printers_test gtest_main)
   cxx_test(gtest_prod_test gtest_main
     test/production.cc)
@@ -140,10 +178,13 @@ if (gtest_build_tests)
   ############################################################
   # C++ tests built with non-standard compiler flags.
 
-  cxx_library(gtest_no_exception "${cxx_no_exception}"
-    src/gtest-all.cc)
-  cxx_library(gtest_main_no_exception "${cxx_no_exception}"
-    src/gtest-all.cc src/gtest_main.cc)
+  # MSVC 7.1 does not support STL with exceptions disabled.
+  if (NOT MSVC OR MSVC_VERSION GREATER 1310)
+    cxx_library(gtest_no_exception "${cxx_no_exception}"
+      src/gtest-all.cc)
+    cxx_library(gtest_main_no_exception "${cxx_no_exception}"
+      src/gtest-all.cc src/gtest_main.cc)
+  endif()
   cxx_library(gtest_main_no_rtti "${cxx_no_rtti}"
     src/gtest-all.cc src/gtest_main.cc)
 
@@ -166,12 +207,10 @@ if (gtest_build_tests)
                         PROPERTIES
                         COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
 
-  if (NOT MSVC OR NOT MSVC_VERSION EQUAL 1600)
-    # The C++ Standard specifies tuple_element<int, class>.
-    # Yet MSVC 10's <utility> declares tuple_element<size_t, class>.
-    # That declaration conflicts with our own standard-conforming
-    # tuple implementation.  Therefore using our own tuple with
-    # MSVC 10 doesn't compile.
+  if (NOT MSVC OR MSVC_VERSION LESS 1600)  # 1600 is Visual Studio 2010.
+    # Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that
+    # conflict with our own definitions. Therefore using our own tuple does not
+    # work on those compilers.
     cxx_library(gtest_main_use_own_tuple "${cxx_use_own_tuple}"
       src/gtest-all.cc src/gtest_main.cc)
 
@@ -189,11 +228,15 @@ if (gtest_build_tests)
   cxx_executable(gtest_break_on_failure_unittest_ test gtest)
   py_test(gtest_break_on_failure_unittest)
 
-  cxx_executable_with_flags(
-    gtest_catch_exceptions_no_ex_test_
-    "${cxx_no_exception}"
-    gtest_main_no_exception
-    test/gtest_catch_exceptions_test_.cc)
+  # Visual Studio .NET 2003 does not support STL with exceptions disabled.
+  if (NOT MSVC OR MSVC_VERSION GREATER 1310)  # 1310 is Visual Studio .NET 2003
+    cxx_executable_with_flags(
+      gtest_catch_exceptions_no_ex_test_
+      "${cxx_no_exception}"
+      gtest_main_no_exception
+      test/gtest_catch_exceptions_test_.cc)
+  endif()
+
   cxx_executable_with_flags(
     gtest_catch_exceptions_ex_test_
     "${cxx_exception}"
@@ -222,11 +265,14 @@ if (gtest_build_tests)
   cxx_executable(gtest_shuffle_test_ test gtest)
   py_test(gtest_shuffle_test)
 
-  cxx_executable(gtest_throw_on_failure_test_ test gtest_no_exception)
-  set_target_properties(gtest_throw_on_failure_test_
-    PROPERTIES
-    COMPILE_FLAGS "${cxx_no_exception}")
-  py_test(gtest_throw_on_failure_test)
+  # MSVC 7.1 does not support STL with exceptions disabled.
+  if (NOT MSVC OR MSVC_VERSION GREATER 1310)
+    cxx_executable(gtest_throw_on_failure_test_ test gtest_no_exception)
+    set_target_properties(gtest_throw_on_failure_test_
+      PROPERTIES
+      COMPILE_FLAGS "${cxx_no_exception}")
+    py_test(gtest_throw_on_failure_test)
+  endif()
 
   cxx_executable(gtest_uninitialized_test_ test gtest)
   py_test(gtest_uninitialized_test)
diff --git a/LICENSE b/LICENSE
new file mode 100755 (executable)
index 0000000..1941a11
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,28 @@
+Copyright 2008, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+    * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
index 6634e86..29797e4 100755 (executable)
@@ -6,6 +6,7 @@ ACLOCAL_AMFLAGS = -I m4
 EXTRA_DIST = \
   CHANGES \
   CONTRIBUTORS \
+  LICENSE \
   include/gtest/gtest-param-test.h.pump \
   include/gtest/internal/gtest-param-util-generated.h.pump \
   include/gtest/internal/gtest-tuple.h.pump \
@@ -57,6 +58,7 @@ EXTRA_DIST += \
   test/gtest-param-test_test.cc \
   test/gtest-param-test_test.h \
   test/gtest-port_test.cc \
+  test/gtest_premature_exit_test.cc \
   test/gtest-printers_test.cc \
   test/gtest-test-part_test.cc \
   test/gtest-tuple_test.cc \
@@ -203,9 +205,13 @@ pkginclude_internal_HEADERS = \
   include/gtest/internal/gtest-param-util-generated.h \
   include/gtest/internal/gtest-param-util.h \
   include/gtest/internal/gtest-port.h \
+  include/gtest/internal/gtest-port-arch.h \
   include/gtest/internal/gtest-string.h \
   include/gtest/internal/gtest-tuple.h \
-  include/gtest/internal/gtest-type-util.h
+  include/gtest/internal/gtest-type-util.h \
+  include/gtest/internal/custom/gtest.h \
+  include/gtest/internal/custom/gtest-port.h \
+  include/gtest/internal/custom/gtest-printers.h
 
 lib_libgtest_main_la_SOURCES = src/gtest_main.cc
 lib_libgtest_main_la_LIBADD = lib/libgtest.la
@@ -261,6 +267,7 @@ FUSED_GTEST_SRC = \
   fused-src/gtest/gtest.h \
   fused-src/gtest/gtest_main.cc
 
+if HAVE_PYTHON
 TESTS += test/fused_gtest_test
 check_PROGRAMS += test/fused_gtest_test
 test_fused_gtest_test_SOURCES = $(FUSED_GTEST_SRC) \
@@ -284,6 +291,7 @@ fused-gtest: $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS) \
 
 maintainer-clean-local:
        rm -rf "$(srcdir)/fused-src"
+endif
 
 # Death tests may produce core dumps in the build directory. In case
 # this happens, clean them to keep distcleancheck happy.
@@ -295,6 +303,8 @@ CLEANFILES = core
 
 install-exec-local:
        echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system."
+       false
 
 install-data-local:
        echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system."
+       false
diff --git a/NOTICE b/NOTICE
deleted file mode 100644 (file)
index ae3bae4..0000000
--- a/NOTICE
+++ /dev/null
@@ -1,2 +0,0 @@
-2011-10-15 Sanghyun Lee <sanghyunnim.lee@samsung.com>
- * gtest.cc, gtest.h: Modified that tests work in a child process
diff --git a/README b/README
deleted file mode 100755 (executable)
index 51a9376..0000000
--- a/README
+++ /dev/null
@@ -1,424 +0,0 @@
-Google C++ Testing Framework
-============================
-
-http://code.google.com/p/googletest/
-
-Overview
---------
-
-Google's framework for writing C++ tests on a variety of platforms
-(Linux, Mac OS X, Windows, Windows CE, Symbian, etc).  Based on the
-xUnit architecture.  Supports automatic test discovery, a rich set of
-assertions, user-defined assertions, death tests, fatal and non-fatal
-failures, various options for running the tests, and XML test report
-generation.
-
-Please see the project page above for more information as well as the
-mailing list for questions, discussions, and development.  There is
-also an IRC channel on OFTC (irc.oftc.net) #gtest available.  Please
-join us!
-
-Requirements for End Users
---------------------------
-
-Google Test is designed to have fairly minimal requirements to build
-and use with your projects, but there are some.  Currently, we support
-Linux, Windows, Mac OS X, and Cygwin.  We will also make our best
-effort to support other platforms (e.g. Solaris, AIX, and z/OS).
-However, since core members of the Google Test project have no access
-to these platforms, Google Test may have outstanding issues there.  If
-you notice any problems on your platform, please notify
-googletestframework@googlegroups.com.  Patches for fixing them are
-even more welcome!
-
-### Linux Requirements ###
-
-These are the base requirements to build and use Google Test from a source
-package (as described below):
-  * GNU-compatible Make or gmake
-  * POSIX-standard shell
-  * POSIX(-2) Regular Expressions (regex.h)
-  * A C++98-standard-compliant compiler
-
-### Windows Requirements ###
-
-  * Microsoft Visual C++ 7.1 or newer
-
-### Cygwin Requirements ###
-
-  * Cygwin 1.5.25-14 or newer
-
-### Mac OS X Requirements ###
-
-  * Mac OS X 10.4 Tiger or newer
-  * Developer Tools Installed
-
-Also, you'll need CMake 2.6.4 or higher if you want to build the
-samples using the provided CMake script, regardless of the platform.
-
-Requirements for Contributors
------------------------------
-
-We welcome patches.  If you plan to contribute a patch, you need to
-build Google Test and its own tests from an SVN checkout (described
-below), which has further requirements:
-
-  * Python version 2.3 or newer (for running some of the tests and
-    re-generating certain source files from templates)
-  * CMake 2.6.4 or newer
-
-Getting the Source
-------------------
-
-There are two primary ways of getting Google Test's source code: you
-can download a stable source release in your preferred archive format,
-or directly check out the source from our Subversion (SVN) repositary.
-The SVN checkout requires a few extra steps and some extra software
-packages on your system, but lets you track the latest development and
-make patches much more easily, so we highly encourage it.
-
-### Source Package ###
-
-Google Test is released in versioned source packages which can be
-downloaded from the download page [1].  Several different archive
-formats are provided, but the only difference is the tools used to
-manipulate them, and the size of the resulting file.  Download
-whichever you are most comfortable with.
-
-  [1] http://code.google.com/p/googletest/downloads/list
-
-Once the package is downloaded, expand it using whichever tools you
-prefer for that type.  This will result in a new directory with the
-name "gtest-X.Y.Z" which contains all of the source code.  Here are
-some examples on Linux:
-
-  tar -xvzf gtest-X.Y.Z.tar.gz
-  tar -xvjf gtest-X.Y.Z.tar.bz2
-  unzip gtest-X.Y.Z.zip
-
-### SVN Checkout ###
-
-To check out the main branch (also known as the "trunk") of Google
-Test, run the following Subversion command:
-
-  svn checkout http://googletest.googlecode.com/svn/trunk/ gtest-svn
-
-Setting up the Build
---------------------
-
-To build Google Test and your tests that use it, you need to tell your
-build system where to find its headers and source files.  The exact
-way to do it depends on which build system you use, and is usually
-straightforward.
-
-### Generic Build Instructions ###
-
-Suppose you put Google Test in directory ${GTEST_DIR}.  To build it,
-create a library build target (or a project as called by Visual Studio
-and Xcode) to compile
-
-  ${GTEST_DIR}/src/gtest-all.cc
-
-with
-
-  ${GTEST_DIR}/include and ${GTEST_DIR}
-
-in the header search path.  Assuming a Linux-like system and gcc,
-something like the following will do:
-
-  g++ -I${GTEST_DIR}/include -I${GTEST_DIR} -c ${GTEST_DIR}/src/gtest-all.cc
-  ar -rv libgtest.a gtest-all.o
-
-Next, you should compile your test source file with
-${GTEST_DIR}/include in the header search path, and link it with gtest
-and any other necessary libraries:
-
-  g++ -I${GTEST_DIR}/include path/to/your_test.cc libgtest.a -o your_test
-
-As an example, the make/ directory contains a Makefile that you can
-use to build Google Test on systems where GNU make is available
-(e.g. Linux, Mac OS X, and Cygwin).  It doesn't try to build Google
-Test's own tests.  Instead, it just builds the Google Test library and
-a sample test.  You can use it as a starting point for your own build
-script.
-
-If the default settings are correct for your environment, the
-following commands should succeed:
-
-  cd ${GTEST_DIR}/make
-  make
-  ./sample1_unittest
-
-If you see errors, try to tweak the contents of make/Makefile to make
-them go away.  There are instructions in make/Makefile on how to do
-it.
-
-### Using CMake ###
-
-Google Test comes with a CMake build script (CMakeLists.txt) that can
-be used on a wide range of platforms ("C" stands for cross-platofrm.).
-If you don't have CMake installed already, you can download it for
-free from http://www.cmake.org/.
-
-CMake works by generating native makefiles or build projects that can
-be used in the compiler environment of your choice.  The typical
-workflow starts with:
-
-  mkdir mybuild       # Create a directory to hold the build output.
-  cd mybuild
-  cmake ${GTEST_DIR}  # Generate native build scripts.
-
-If you want to build Google Test's samples, you should replace the
-last command with
-
-  cmake -Dgtest_build_samples=ON ${GTEST_DIR}
-
-If you are on a *nix system, you should now see a Makefile in the
-current directory.  Just type 'make' to build gtest.
-
-If you use Windows and have Vistual Studio installed, a gtest.sln file
-and several .vcproj files will be created.  You can then build them
-using Visual Studio.
-
-On Mac OS X with Xcode installed, a .xcodeproj file will be generated.
-
-### Legacy Build Scripts ###
-
-Before settling on CMake, we have been providing hand-maintained build
-projects/scripts for Visual Studio, Xcode, and Autotools.  While we
-continue to provide them for convenience, they are not actively
-maintained any more.  We highly recommend that you follow the
-instructions in the previous two sections to integrate Google Test
-with your existing build system.
-
-If you still need to use the legacy build scripts, here's how:
-
-The msvc\ folder contains two solutions with Visual C++ projects.
-Open the gtest.sln or gtest-md.sln file using Visual Studio, and you
-are ready to build Google Test the same way you build any Visual
-Studio project.  Files that have names ending with -md use DLL
-versions of Microsoft runtime libraries (the /MD or the /MDd compiler
-option).  Files without that suffix use static versions of the runtime
-libraries (the /MT or the /MTd option).  Please note that one must use
-the same option to compile both gtest and the test code.  If you use
-Visual Studio 2005 or above, we recommend the -md version as /MD is
-the default for new projects in these versions of Visual Studio.
-
-On Mac OS X, open the gtest.xcodeproj in the xcode/ folder using
-Xcode.  Build the "gtest" target.  The universal binary framework will
-end up in your selected build directory (selected in the Xcode
-"Preferences..." -> "Building" pane and defaults to xcode/build).
-Alternatively, at the command line, enter:
-
-  xcodebuild
-
-This will build the "Release" configuration of gtest.framework in your
-default build location.  See the "xcodebuild" man page for more
-information about building different configurations and building in
-different locations.
-
-Tweaking Google Test
---------------------
-
-Google Test can be used in diverse environments.  The default
-configuration may not work (or may not work well) out of the box in
-some environments.  However, you can easily tweak Google Test by
-defining control macros on the compiler command line.  Generally,
-these macros are named like GTEST_XYZ and you define them to either 1
-or 0 to enable or disable a certain feature.
-
-We list the most frequently used macros below.  For a complete list,
-see file include/gtest/internal/gtest-port.h.
-
-### Choosing a TR1 Tuple Library ###
-
-Some Google Test features require the C++ Technical Report 1 (TR1)
-tuple library, which is not yet available with all compilers.  The
-good news is that Google Test implements a subset of TR1 tuple that's
-enough for its own need, and will automatically use this when the
-compiler doesn't provide TR1 tuple.
-
-Usually you don't need to care about which tuple library Google Test
-uses.  However, if your project already uses TR1 tuple, you need to
-tell Google Test to use the same TR1 tuple library the rest of your
-project uses, or the two tuple implementations will clash.  To do
-that, add
-
-  -DGTEST_USE_OWN_TR1_TUPLE=0
-
-to the compiler flags while compiling Google Test and your tests.  If
-you want to force Google Test to use its own tuple library, just add
-
-  -DGTEST_USE_OWN_TR1_TUPLE=1
-
-to the compiler flags instead.
-
-If you don't want Google Test to use tuple at all, add
-
-  -DGTEST_HAS_TR1_TUPLE=0
-
-and all features using tuple will be disabled.
-
-### Multi-threaded Tests ###
-
-Google Test is thread-safe where the pthread library is available.
-After #include "gtest/gtest.h", you can check the GTEST_IS_THREADSAFE
-macro to see whether this is the case (yes if the macro is #defined to
-1, no if it's undefined.).
-
-If Google Test doesn't correctly detect whether pthread is available
-in your environment, you can force it with
-
-  -DGTEST_HAS_PTHREAD=1
-
-or
-
-  -DGTEST_HAS_PTHREAD=0
-
-When Google Test uses pthread, you may need to add flags to your
-compiler and/or linker to select the pthread library, or you'll get
-link errors.  If you use the CMake script or the deprecated Autotools
-script, this is taken care of for you.  If you use your own build
-script, you'll need to read your compiler and linker's manual to
-figure out what flags to add.
-
-### As a Shared Library (DLL) ###
-
-Google Test is compact, so most users can build and link it as a
-static library for the simplicity.  You can choose to use Google Test
-as a shared library (known as a DLL on Windows) if you prefer.
-
-To compile *gtest* as a shared library, add
-
-  -DGTEST_CREATE_SHARED_LIBRARY=1
-
-to the compiler flags.  You'll also need to tell the linker to produce
-a shared library instead - consult your linker's manual for how to do
-it.
-
-To compile your *tests* that use the gtest shared library, add
-
-  -DGTEST_LINKED_AS_SHARED_LIBRARY=1
-
-to the compiler flags.
-
-Note: while the above steps aren't technically necessary today when
-using some compilers (e.g. GCC), they may become necessary in the
-future, if we decide to improve the speed of loading the library (see
-http://gcc.gnu.org/wiki/Visibility for details).  Therefore you are
-recommended to always add the above flags when using Google Test as a
-shared library.  Otherwise a future release of Google Test may break
-your build script.
-
-### Avoiding Macro Name Clashes ###
-
-In C++, macros don't obey namespaces.  Therefore two libraries that
-both define a macro of the same name will clash if you #include both
-definitions.  In case a Google Test macro clashes with another
-library, you can force Google Test to rename its macro to avoid the
-conflict.
-
-Specifically, if both Google Test and some other code define macro
-FOO, you can add
-
-  -DGTEST_DONT_DEFINE_FOO=1
-
-to the compiler flags to tell Google Test to change the macro's name
-from FOO to GTEST_FOO.  Currently FOO can be FAIL, SUCCEED, or TEST.
-For example, with -DGTEST_DONT_DEFINE_TEST=1, you'll need to write
-
-  GTEST_TEST(SomeTest, DoesThis) { ... }
-
-instead of
-
-  TEST(SomeTest, DoesThis) { ... }
-
-in order to define a test.
-
-Upgrating from an Earlier Version
----------------------------------
-
-We strive to keep Google Test releases backward compatible.
-Sometimes, though, we have to make some breaking changes for the
-users' long-term benefits.  This section describes what you'll need to
-do if you are upgrading from an earlier version of Google Test.
-
-### Upgrading from 1.3.0 or Earlier ###
-
-You may need to explicitly enable or disable Google Test's own TR1
-tuple library.  See the instructions in section "Choosing a TR1 Tuple
-Library".
-
-### Upgrading from 1.4.0 or Earlier ###
-
-The Autotools build script (configure + make) is no longer officially
-supportted.  You are encouraged to migrate to your own build system or
-use CMake.  If you still need to use Autotools, you can find
-instructions in the README file from Google Test 1.4.0.
-
-On platforms where the pthread library is available, Google Test uses
-it in order to be thread-safe.  See the "Multi-threaded Tests" section
-for what this means to your build script.
-
-If you use Microsoft Visual C++ 7.1 with exceptions disabled, Google
-Test will no longer compile.  This should affect very few people, as a
-large portion of STL (including <string>) doesn't compile in this mode
-anyway.  We decided to stop supporting it in order to greatly simplify
-Google Test's implementation.
-
-Developing Google Test
-----------------------
-
-This section discusses how to make your own changes to Google Test.
-
-### Testing Google Test Itself ###
-
-To make sure your changes work as intended and don't break existing
-functionality, you'll want to compile and run Google Test's own tests.
-For that you can use CMake:
-
-  mkdir mybuild
-  cd mybuild
-  cmake -Dgtest_build_tests=ON ${GTEST_DIR}
-
-Make sure you have Python installed, as some of Google Test's tests
-are written in Python.  If the cmake command complains about not being
-able to find Python ("Could NOT find PythonInterp (missing:
-PYTHON_EXECUTABLE)"), try telling it explicitly where your Python
-executable can be found:
-
-  cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}
-
-Next, you can build Google Test and all of its own tests.  On *nix,
-this is usually done by 'make'.  To run the tests, do
-
-  make test
-
-All tests should pass.
-
-### Regenerating Source Files ###
-
-Some of Google Test's source files are generated from templates (not
-in the C++ sense) using a script.  A template file is named FOO.pump,
-where FOO is the name of the file it will generate.  For example, the
-file include/gtest/internal/gtest-type-util.h.pump is used to generate
-gtest-type-util.h in the same directory.
-
-Normally you don't need to worry about regenerating the source files,
-unless you need to modify them.  In that case, you should modify the
-corresponding .pump files instead and run the pump.py Python script to
-regenerate them.  You can find pump.py in the scripts/ directory.
-Read the Pump manual [2] for how to use it.
-
-  [2] http://code.google.com/p/googletest/wiki/PumpManual
-
-### Contributing a Patch ###
-
-We welcome patches.  Please read the Google Test developer's guide [3]
-for how you can contribute.  In particular, make sure you have signed
-the Contributor License Agreement, or we won't be able to accept the
-patch.
-
-  [3] http://code.google.com/p/googletest/wiki/GoogleTestDevGuide
-
-Happy testing!
diff --git a/README.md b/README.md
new file mode 100755 (executable)
index 0000000..edd4408
--- /dev/null
+++ b/README.md
@@ -0,0 +1,280 @@
+
+### Generic Build Instructions ###
+
+#### Setup ####
+
+To build Google Test and your tests that use it, you need to tell your
+build system where to find its headers and source files.  The exact
+way to do it depends on which build system you use, and is usually
+straightforward.
+
+#### Build ####
+
+Suppose you put Google Test in directory `${GTEST_DIR}`.  To build it,
+create a library build target (or a project as called by Visual Studio
+and Xcode) to compile
+
+    ${GTEST_DIR}/src/gtest-all.cc
+
+with `${GTEST_DIR}/include` in the system header search path and `${GTEST_DIR}`
+in the normal header search path.  Assuming a Linux-like system and gcc,
+something like the following will do:
+
+    g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \
+        -pthread -c ${GTEST_DIR}/src/gtest-all.cc
+    ar -rv libgtest.a gtest-all.o
+
+(We need `-pthread` as Google Test uses threads.)
+
+Next, you should compile your test source file with
+`${GTEST_DIR}/include` in the system header search path, and link it
+with gtest and any other necessary libraries:
+
+    g++ -isystem ${GTEST_DIR}/include -pthread path/to/your_test.cc libgtest.a \
+        -o your_test
+
+As an example, the make/ directory contains a Makefile that you can
+use to build Google Test on systems where GNU make is available
+(e.g. Linux, Mac OS X, and Cygwin).  It doesn't try to build Google
+Test's own tests.  Instead, it just builds the Google Test library and
+a sample test.  You can use it as a starting point for your own build
+script.
+
+If the default settings are correct for your environment, the
+following commands should succeed:
+
+    cd ${GTEST_DIR}/make
+    make
+    ./sample1_unittest
+
+If you see errors, try to tweak the contents of `make/Makefile` to make
+them go away.  There are instructions in `make/Makefile` on how to do
+it.
+
+### Using CMake ###
+
+Google Test comes with a CMake build script (
+[CMakeLists.txt](CMakeLists.txt)) that can be used on a wide range of platforms ("C" stands for
+cross-platform.). If you don't have CMake installed already, you can
+download it for free from <http://www.cmake.org/>.
+
+CMake works by generating native makefiles or build projects that can
+be used in the compiler environment of your choice.  The typical
+workflow starts with:
+
+    mkdir mybuild       # Create a directory to hold the build output.
+    cd mybuild
+    cmake ${GTEST_DIR}  # Generate native build scripts.
+
+If you want to build Google Test's samples, you should replace the
+last command with
+
+    cmake -Dgtest_build_samples=ON ${GTEST_DIR}
+
+If you are on a \*nix system, you should now see a Makefile in the
+current directory.  Just type 'make' to build gtest.
+
+If you use Windows and have Visual Studio installed, a `gtest.sln` file
+and several `.vcproj` files will be created.  You can then build them
+using Visual Studio.
+
+On Mac OS X with Xcode installed, a `.xcodeproj` file will be generated.
+
+### Legacy Build Scripts ###
+
+Before settling on CMake, we have been providing hand-maintained build
+projects/scripts for Visual Studio, Xcode, and Autotools.  While we
+continue to provide them for convenience, they are not actively
+maintained any more.  We highly recommend that you follow the
+instructions in the previous two sections to integrate Google Test
+with your existing build system.
+
+If you still need to use the legacy build scripts, here's how:
+
+The msvc\ folder contains two solutions with Visual C++ projects.
+Open the `gtest.sln` or `gtest-md.sln` file using Visual Studio, and you
+are ready to build Google Test the same way you build any Visual
+Studio project.  Files that have names ending with -md use DLL
+versions of Microsoft runtime libraries (the /MD or the /MDd compiler
+option).  Files without that suffix use static versions of the runtime
+libraries (the /MT or the /MTd option).  Please note that one must use
+the same option to compile both gtest and the test code.  If you use
+Visual Studio 2005 or above, we recommend the -md version as /MD is
+the default for new projects in these versions of Visual Studio.
+
+On Mac OS X, open the `gtest.xcodeproj` in the `xcode/` folder using
+Xcode.  Build the "gtest" target.  The universal binary framework will
+end up in your selected build directory (selected in the Xcode
+"Preferences..." -> "Building" pane and defaults to xcode/build).
+Alternatively, at the command line, enter:
+
+    xcodebuild
+
+This will build the "Release" configuration of gtest.framework in your
+default build location.  See the "xcodebuild" man page for more
+information about building different configurations and building in
+different locations.
+
+If you wish to use the Google Test Xcode project with Xcode 4.x and
+above, you need to either:
+
+ * update the SDK configuration options in xcode/Config/General.xconfig.
+   Comment options `SDKROOT`, `MACOS_DEPLOYMENT_TARGET`, and `GCC_VERSION`. If
+   you choose this route you lose the ability to target earlier versions
+   of MacOS X.
+ * Install an SDK for an earlier version. This doesn't appear to be
+   supported by Apple, but has been reported to work
+   (http://stackoverflow.com/questions/5378518).
+
+### Tweaking Google Test ###
+
+Google Test can be used in diverse environments.  The default
+configuration may not work (or may not work well) out of the box in
+some environments.  However, you can easily tweak Google Test by
+defining control macros on the compiler command line.  Generally,
+these macros are named like `GTEST_XYZ` and you define them to either 1
+or 0 to enable or disable a certain feature.
+
+We list the most frequently used macros below.  For a complete list,
+see file [include/gtest/internal/gtest-port.h](include/gtest/internal/gtest-port.h).
+
+### Choosing a TR1 Tuple Library ###
+
+Some Google Test features require the C++ Technical Report 1 (TR1)
+tuple library, which is not yet available with all compilers.  The
+good news is that Google Test implements a subset of TR1 tuple that's
+enough for its own need, and will automatically use this when the
+compiler doesn't provide TR1 tuple.
+
+Usually you don't need to care about which tuple library Google Test
+uses.  However, if your project already uses TR1 tuple, you need to
+tell Google Test to use the same TR1 tuple library the rest of your
+project uses, or the two tuple implementations will clash.  To do
+that, add
+
+    -DGTEST_USE_OWN_TR1_TUPLE=0
+
+to the compiler flags while compiling Google Test and your tests.  If
+you want to force Google Test to use its own tuple library, just add
+
+    -DGTEST_USE_OWN_TR1_TUPLE=1
+
+to the compiler flags instead.
+
+If you don't want Google Test to use tuple at all, add
+
+    -DGTEST_HAS_TR1_TUPLE=0
+
+and all features using tuple will be disabled.
+
+### Multi-threaded Tests ###
+
+Google Test is thread-safe where the pthread library is available.
+After `#include "gtest/gtest.h"`, you can check the `GTEST_IS_THREADSAFE`
+macro to see whether this is the case (yes if the macro is `#defined` to
+1, no if it's undefined.).
+
+If Google Test doesn't correctly detect whether pthread is available
+in your environment, you can force it with
+
+    -DGTEST_HAS_PTHREAD=1
+
+or
+
+    -DGTEST_HAS_PTHREAD=0
+
+When Google Test uses pthread, you may need to add flags to your
+compiler and/or linker to select the pthread library, or you'll get
+link errors.  If you use the CMake script or the deprecated Autotools
+script, this is taken care of for you.  If you use your own build
+script, you'll need to read your compiler and linker's manual to
+figure out what flags to add.
+
+### As a Shared Library (DLL) ###
+
+Google Test is compact, so most users can build and link it as a
+static library for the simplicity.  You can choose to use Google Test
+as a shared library (known as a DLL on Windows) if you prefer.
+
+To compile *gtest* as a shared library, add
+
+    -DGTEST_CREATE_SHARED_LIBRARY=1
+
+to the compiler flags.  You'll also need to tell the linker to produce
+a shared library instead - consult your linker's manual for how to do
+it.
+
+To compile your *tests* that use the gtest shared library, add
+
+    -DGTEST_LINKED_AS_SHARED_LIBRARY=1
+
+to the compiler flags.
+
+Note: while the above steps aren't technically necessary today when
+using some compilers (e.g. GCC), they may become necessary in the
+future, if we decide to improve the speed of loading the library (see
+<http://gcc.gnu.org/wiki/Visibility> for details).  Therefore you are
+recommended to always add the above flags when using Google Test as a
+shared library.  Otherwise a future release of Google Test may break
+your build script.
+
+### Avoiding Macro Name Clashes ###
+
+In C++, macros don't obey namespaces.  Therefore two libraries that
+both define a macro of the same name will clash if you `#include` both
+definitions.  In case a Google Test macro clashes with another
+library, you can force Google Test to rename its macro to avoid the
+conflict.
+
+Specifically, if both Google Test and some other code define macro
+FOO, you can add
+
+    -DGTEST_DONT_DEFINE_FOO=1
+
+to the compiler flags to tell Google Test to change the macro's name
+from `FOO` to `GTEST_FOO`.  Currently `FOO` can be `FAIL`, `SUCCEED`,
+or `TEST`.  For example, with `-DGTEST_DONT_DEFINE_TEST=1`, you'll
+need to write
+
+    GTEST_TEST(SomeTest, DoesThis) { ... }
+
+instead of
+
+    TEST(SomeTest, DoesThis) { ... }
+
+in order to define a test.
+
+## Developing Google Test ##
+
+This section discusses how to make your own changes to Google Test.
+
+### Testing Google Test Itself ###
+
+To make sure your changes work as intended and don't break existing
+functionality, you'll want to compile and run Google Test's own tests.
+For that you can use CMake:
+
+    mkdir mybuild
+    cd mybuild
+    cmake -Dgtest_build_tests=ON ${GTEST_DIR}
+
+Make sure you have Python installed, as some of Google Test's tests
+are written in Python.  If the cmake command complains about not being
+able to find Python (`Could NOT find PythonInterp (missing:
+PYTHON_EXECUTABLE)`), try telling it explicitly where your Python
+executable can be found:
+
+    cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}
+
+Next, you can build Google Test and all of its own tests.  On \*nix,
+this is usually done by 'make'.  To run the tests, do
+
+    make test
+
+All tests should pass.
+
+Normally you don't need to worry about regenerating the source files,
+unless you need to modify them.  In that case, you should modify the
+corresponding .pump files instead and run the pump.py Python script to
+regenerate them.  You can find pump.py in the [scripts/](scripts/) directory.
+Read the [Pump manual](docs/PumpManual.md) for how to use it.
old mode 100644 (file)
new mode 100755 (executable)
similarity index 100%
rename from src/.dirstamp
rename to build-aux/.keep
index 7efc2ac..777b91e 100755 (executable)
@@ -37,7 +37,7 @@ macro(fix_default_compiler_settings_)
 
       # We prefer more strict warning checking for building Google Test.
       # Replaces /W3 with /W4 in defaults.
-      string(REPLACE "/W3" "-W4" ${flag_var} "${${flag_var}}")
+      string(REPLACE "/W3" "/W4" ${flag_var} "${${flag_var}}")
     endforeach()
   endif()
 endmacro()
@@ -55,7 +55,36 @@ macro(config_compiler_and_linker)
   if (MSVC)
     # Newlines inside flags variables break CMake's NMake generator.
     # TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds.
-    set(cxx_base_flags "-GS -W4 -WX -wd4127 -wd4251 -wd4275 -nologo -J -Zi")
+    set(cxx_base_flags "-GS -W4 -WX -wd4251 -wd4275 -nologo -J -Zi")
+    if (MSVC_VERSION LESS 1400)  # 1400 is Visual Studio 2005
+      # Suppress spurious warnings MSVC 7.1 sometimes issues.
+      # Forcing value to bool.
+      set(cxx_base_flags "${cxx_base_flags} -wd4800")
+      # Copy constructor and assignment operator could not be generated.
+      set(cxx_base_flags "${cxx_base_flags} -wd4511 -wd4512")
+      # Compatibility warnings not applicable to Google Test.
+      # Resolved overload was found by argument-dependent lookup.
+      set(cxx_base_flags "${cxx_base_flags} -wd4675")
+    endif()
+    if (MSVC_VERSION LESS 1500)  # 1500 is Visual Studio 2008
+      # Conditional expression is constant.
+      # When compiling with /W4, we get several instances of C4127
+      # (Conditional expression is constant). In our code, we disable that
+      # warning on a case-by-case basis. However, on Visual Studio 2005,
+      # the warning fires on std::list. Therefore on that compiler and earlier,
+      # we disable the warning project-wide.
+      set(cxx_base_flags "${cxx_base_flags} -wd4127")
+    endif()
+    if (NOT (MSVC_VERSION LESS 1700))  # 1700 is Visual Studio 2012.
+      # Suppress "unreachable code" warning on VS 2012 and later.
+      # http://stackoverflow.com/questions/3232669 explains the issue.
+      set(cxx_base_flags "${cxx_base_flags} -wd4702")
+    endif()
+    if (NOT (MSVC_VERSION GREATER 1900))  # 1900 is Visual Studio 2015
+      # BigObj required for tests.
+      set(cxx_base_flags "${cxx_base_flags} -bigobj")
+    endif()
+
     set(cxx_base_flags "${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32")
     set(cxx_base_flags "${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN")
     set(cxx_exception_flags "-EHsc -D_HAS_EXCEPTIONS=1")
@@ -69,7 +98,8 @@ macro(config_compiler_and_linker)
     # whether RTTI is enabled.  Therefore we define GTEST_HAS_RTTI
     # explicitly.
     set(cxx_no_rtti_flags "-fno-rtti -DGTEST_HAS_RTTI=0")
-    set(cxx_strict_flags "-Wextra")
+    set(cxx_strict_flags
+      "-Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
   elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
     set(cxx_exception_flags "-features=except")
     # Sun Pro doesn't provide macros to indicate whether exceptions and
@@ -209,8 +239,16 @@ function(py_test name)
     # directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known
     # only at ctest runtime (by calling ctest -c <Configuration>), so
     # we have to escape $ to delay variable substitution here.
-    add_test(${name}
-      ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
+    if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
+      add_test(
+        NAME ${name}
+        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
+            --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>)
+    else (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
+      add_test(
+        ${name}
+        ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
           --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE})
+    endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
   endif()
 endfunction()
index 285bb2a..95c3054 100755 (executable)
-<?xml version="1.0" encoding="utf-8"?>
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <ProjectGuid>{bca37a72-5b07-46cf-b44e-89f8e06451a2}</ProjectGuid>
-    <Config Condition="'$(Config)'==''">Release</Config>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
-    <Base>true</Base>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
-    <Base>true</Base>
-    <Cfg_1>true</Cfg_1>
-    <CfgParent>Base</CfgParent>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
-    <Base>true</Base>
-    <Cfg_2>true</Cfg_2>
-    <CfgParent>Base</CfgParent>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Base)'!=''">
-    <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
-    <OutputExt>lib</OutputExt>
-    <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
-    <Defines>NO_STRICT</Defines>
-    <DynamicRTL>true</DynamicRTL>
-    <UsePackages>true</UsePackages>
-    <ProjectType>CppStaticLibrary</ProjectType>
-    <BCC_CPPCompileAlways>true</BCC_CPPCompileAlways>
-    <PackageImports>rtl.bpi;vcl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;dsnap.bpi;dsnapcon.bpi;vclib.bpi;ibxpress.bpi;adortl.bpi;dbxcds.bpi;dbexpress.bpi;DbxCommonDriver.bpi;websnap.bpi;vclie.bpi;webdsnap.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;Rave75VCL.bpi;teeUI.bpi;tee.bpi;teedb.bpi;IndyCore.bpi;IndySystem.bpi;IndyProtocols.bpi;IntrawebDB_90_100.bpi;Intraweb_90_100.bpi;dclZipForged11.bpi;vclZipForged11.bpi;GR32_BDS2006.bpi;GR32_DSGN_BDS2006.bpi;Jcl.bpi;JclVcl.bpi;JvCoreD11R.bpi;JvSystemD11R.bpi;JvStdCtrlsD11R.bpi;JvAppFrmD11R.bpi;JvBandsD11R.bpi;JvDBD11R.bpi;JvDlgsD11R.bpi;JvBDED11R.bpi;JvCmpD11R.bpi;JvCryptD11R.bpi;JvCtrlsD11R.bpi;JvCustomD11R.bpi;JvDockingD11R.bpi;JvDotNetCtrlsD11R.bpi;JvEDID11R.bpi;JvGlobusD11R.bpi;JvHMID11R.bpi;JvInterpreterD11R.bpi;JvJansD11R.bpi;JvManagedThreadsD11R.bpi;JvMMD11R.bpi;JvNetD11R.bpi;JvPageCompsD11R.bpi;JvPluginD11R.bpi;JvPrintPreviewD11R.bpi;JvRuntimeDesignD11R.bpi;JvTimeFrameworkD11R.bpi;JvValidatorsD11R.bpi;JvWizardD11R.bpi;JvXPCtrlsD11R.bpi;VclSmp.bpi;CExceptionExpert11.bpi</PackageImports>
-    <BCC_wpar>false</BCC_wpar>
-    <IncludePath>$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</IncludePath>
-    <AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>
-    <TLIB_PageSize>32</TLIB_PageSize>
-    <ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk</ILINK_LibraryPath>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Cfg_1)'!=''">
-    <BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
-    <DCC_Optimize>false</DCC_Optimize>
-    <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
-    <Defines>_DEBUG;$(Defines)</Defines>
-    <ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
-    <BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
-    <ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
-    <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
-    <DCC_Define>DEBUG</DCC_Define>
-    <BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
-    <IntermediateOutputDir>Debug</IntermediateOutputDir>
-    <TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
-    <BCC_StackFrames>true</BCC_StackFrames>
-    <BCC_DisableOptimizations>true</BCC_DisableOptimizations>
-    <ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
-    <TASM_Debugging>Full</TASM_Debugging>
-    <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Cfg_2)'!=''">
-    <Defines>NDEBUG;$(Defines)</Defines>
-    <IntermediateOutputDir>Release</IntermediateOutputDir>
-    <ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>
-    <TASM_Debugging>None</TASM_Debugging>
-  </PropertyGroup>
-  <ProjectExtensions>
-    <Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>
-    <Borland.ProjectType>CppStaticLibrary</Borland.ProjectType>
-    <BorlandProject>
-<BorlandProject><CPlusPlusBuilder.Personality><VersionInfo><VersionInfo Name="IncludeVerInfo">False</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1033</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName"></VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Debugging><Debugging Name="DebugSourceDirs"></Debugging></Debugging><Parameters><Parameters Name="RunParams"></Parameters><Parameters Name="Launcher"></Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="DebugCWD"></Parameters><Parameters Name="HostApplication"></Parameters><Parameters Name="RemoteHost"></Parameters><Parameters Name="RemotePath"></Parameters><Parameters Name="RemoteParams"></Parameters><Parameters Name="RemoteLauncher"></Parameters><Parameters Name="UseRemoteLauncher">False</Parameters><Parameters Name="RemoteCWD"></Parameters><Parameters Name="RemoteDebug">False</Parameters><Parameters Name="Debug Symbols Search Path"></Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Excluded_Packages>
-      
-      
-      <Excluded_Packages Name="$(BDS)\bin\bcboffice2k100.bpl">CodeGear C++Builder Office 2000 Servers Package</Excluded_Packages>
-      <Excluded_Packages Name="$(BDS)\bin\bcbofficexp100.bpl">CodeGear C++Builder Office XP Servers Package</Excluded_Packages>
-    </Excluded_Packages><Linker><Linker Name="LibPrefix"></Linker><Linker Name="LibSuffix"></Linker><Linker Name="LibVersion"></Linker></Linker><ProjectProperties><ProjectProperties Name="AutoShowDeps">False</ProjectProperties><ProjectProperties Name="ManagePaths">True</ProjectProperties><ProjectProperties Name="VerifyPackages">True</ProjectProperties></ProjectProperties><HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Count">3</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item0">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item1">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item2">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\src;..\include</HistoryLists_hlIncludePath></HistoryLists_hlIncludePath><HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Count">1</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item0">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk</HistoryLists_hlILINK_LibraryPath></HistoryLists_hlILINK_LibraryPath><HistoryLists_hlDefines><HistoryLists_hlDefines Name="Count">1</HistoryLists_hlDefines><HistoryLists_hlDefines Name="Item0">NO_STRICT</HistoryLists_hlDefines></HistoryLists_hlDefines><HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Count">1</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Item0">32</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Item1">16</HistoryLists_hlTLIB_PageSize></HistoryLists_hlTLIB_PageSize></CPlusPlusBuilder.Personality></BorlandProject></BorlandProject>
-  </ProjectExtensions>
-  <Import Project="$(MSBuildBinPath)\Borland.Cpp.Targets" />
-  <ItemGroup>
-    <None Include="..\include\gtest\gtest-death-test.h">
-      <BuildOrder>3</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\gtest-message.h">
-      <BuildOrder>4</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\gtest-param-test.h">
-      <BuildOrder>5</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\gtest-spi.h">
-      <BuildOrder>6</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\gtest-test-part.h">
-      <BuildOrder>7</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\gtest-typed-test.h">
-      <BuildOrder>8</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\gtest.h">
-      <BuildOrder>0</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\gtest_pred_impl.h">
-      <BuildOrder>1</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\gtest_prod.h">
-      <BuildOrder>2</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\internal\gtest-death-test-internal.h">
-      <BuildOrder>9</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\internal\gtest-filepath.h">
-      <BuildOrder>10</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\internal\gtest-internal.h">
-      <BuildOrder>11</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\internal\gtest-linked_ptr.h">
-      <BuildOrder>12</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\internal\gtest-param-util-generated.h">
-      <BuildOrder>14</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\internal\gtest-param-util.h">
-      <BuildOrder>13</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\internal\gtest-port.h">
-      <BuildOrder>15</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\internal\gtest-string.h">
-      <BuildOrder>16</BuildOrder>
-    </None>
-    <None Include="..\include\gtest\internal\gtest-type-util.h">
-      <BuildOrder>17</BuildOrder>
-    </None>
-    <CppCompile Include="gtest_all.cc">
-      <BuildOrder>18</BuildOrder>
-    </CppCompile>
-    <BuildConfiguration Include="Debug">
-      <Key>Cfg_1</Key>
-    </BuildConfiguration>
-    <BuildConfiguration Include="Release">
-      <Key>Cfg_2</Key>
-    </BuildConfiguration>
-  </ItemGroup>
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <ProjectGuid>{bca37a72-5b07-46cf-b44e-89f8e06451a2}</ProjectGuid>\r
+    <Config Condition="'$(Config)'==''">Release</Config>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">\r
+    <Base>true</Base>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">\r
+    <Base>true</Base>\r
+    <Cfg_1>true</Cfg_1>\r
+    <CfgParent>Base</CfgParent>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">\r
+    <Base>true</Base>\r
+    <Cfg_2>true</Cfg_2>\r
+    <CfgParent>Base</CfgParent>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Base)'!=''">\r
+    <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>\r
+    <OutputExt>lib</OutputExt>\r
+    <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>\r
+    <Defines>NO_STRICT</Defines>\r
+    <DynamicRTL>true</DynamicRTL>\r
+    <UsePackages>true</UsePackages>\r
+    <ProjectType>CppStaticLibrary</ProjectType>\r
+    <BCC_CPPCompileAlways>true</BCC_CPPCompileAlways>\r
+    <PackageImports>rtl.bpi;vcl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;dsnap.bpi;dsnapcon.bpi;vclib.bpi;ibxpress.bpi;adortl.bpi;dbxcds.bpi;dbexpress.bpi;DbxCommonDriver.bpi;websnap.bpi;vclie.bpi;webdsnap.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;Rave75VCL.bpi;teeUI.bpi;tee.bpi;teedb.bpi;IndyCore.bpi;IndySystem.bpi;IndyProtocols.bpi;IntrawebDB_90_100.bpi;Intraweb_90_100.bpi;dclZipForged11.bpi;vclZipForged11.bpi;GR32_BDS2006.bpi;GR32_DSGN_BDS2006.bpi;Jcl.bpi;JclVcl.bpi;JvCoreD11R.bpi;JvSystemD11R.bpi;JvStdCtrlsD11R.bpi;JvAppFrmD11R.bpi;JvBandsD11R.bpi;JvDBD11R.bpi;JvDlgsD11R.bpi;JvBDED11R.bpi;JvCmpD11R.bpi;JvCryptD11R.bpi;JvCtrlsD11R.bpi;JvCustomD11R.bpi;JvDockingD11R.bpi;JvDotNetCtrlsD11R.bpi;JvEDID11R.bpi;JvGlobusD11R.bpi;JvHMID11R.bpi;JvInterpreterD11R.bpi;JvJansD11R.bpi;JvManagedThreadsD11R.bpi;JvMMD11R.bpi;JvNetD11R.bpi;JvPageCompsD11R.bpi;JvPluginD11R.bpi;JvPrintPreviewD11R.bpi;JvRuntimeDesignD11R.bpi;JvTimeFrameworkD11R.bpi;JvValidatorsD11R.bpi;JvWizardD11R.bpi;JvXPCtrlsD11R.bpi;VclSmp.bpi;CExceptionExpert11.bpi</PackageImports>\r
+    <BCC_wpar>false</BCC_wpar>\r
+    <IncludePath>$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</IncludePath>\r
+    <AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>\r
+    <TLIB_PageSize>32</TLIB_PageSize>\r
+    <ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk</ILINK_LibraryPath>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Cfg_1)'!=''">\r
+    <BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>\r
+    <DCC_Optimize>false</DCC_Optimize>\r
+    <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>\r
+    <Defines>_DEBUG;$(Defines)</Defines>\r
+    <ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>\r
+    <BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>\r
+    <ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>\r
+    <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>\r
+    <DCC_Define>DEBUG</DCC_Define>\r
+    <BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>\r
+    <IntermediateOutputDir>Debug</IntermediateOutputDir>\r
+    <TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>\r
+    <BCC_StackFrames>true</BCC_StackFrames>\r
+    <BCC_DisableOptimizations>true</BCC_DisableOptimizations>\r
+    <ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>\r
+    <TASM_Debugging>Full</TASM_Debugging>\r
+    <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Cfg_2)'!=''">\r
+    <Defines>NDEBUG;$(Defines)</Defines>\r
+    <IntermediateOutputDir>Release</IntermediateOutputDir>\r
+    <ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>\r
+    <TASM_Debugging>None</TASM_Debugging>\r
+  </PropertyGroup>\r
+  <ProjectExtensions>\r
+    <Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>\r
+    <Borland.ProjectType>CppStaticLibrary</Borland.ProjectType>\r
+    <BorlandProject>\r
+<BorlandProject><CPlusPlusBuilder.Personality><VersionInfo><VersionInfo Name="IncludeVerInfo">False</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1033</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName"></VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Debugging><Debugging Name="DebugSourceDirs"></Debugging></Debugging><Parameters><Parameters Name="RunParams"></Parameters><Parameters Name="Launcher"></Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="DebugCWD"></Parameters><Parameters Name="HostApplication"></Parameters><Parameters Name="RemoteHost"></Parameters><Parameters Name="RemotePath"></Parameters><Parameters Name="RemoteParams"></Parameters><Parameters Name="RemoteLauncher"></Parameters><Parameters Name="UseRemoteLauncher">False</Parameters><Parameters Name="RemoteCWD"></Parameters><Parameters Name="RemoteDebug">False</Parameters><Parameters Name="Debug Symbols Search Path"></Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Excluded_Packages>\r
+      \r
+      \r
+      <Excluded_Packages Name="$(BDS)\bin\bcboffice2k100.bpl">CodeGear C++Builder Office 2000 Servers Package</Excluded_Packages>\r
+      <Excluded_Packages Name="$(BDS)\bin\bcbofficexp100.bpl">CodeGear C++Builder Office XP Servers Package</Excluded_Packages>\r
+    </Excluded_Packages><Linker><Linker Name="LibPrefix"></Linker><Linker Name="LibSuffix"></Linker><Linker Name="LibVersion"></Linker></Linker><ProjectProperties><ProjectProperties Name="AutoShowDeps">False</ProjectProperties><ProjectProperties Name="ManagePaths">True</ProjectProperties><ProjectProperties Name="VerifyPackages">True</ProjectProperties></ProjectProperties><HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Count">3</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item0">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item1">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item2">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\src;..\include</HistoryLists_hlIncludePath></HistoryLists_hlIncludePath><HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Count">1</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item0">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk</HistoryLists_hlILINK_LibraryPath></HistoryLists_hlILINK_LibraryPath><HistoryLists_hlDefines><HistoryLists_hlDefines Name="Count">1</HistoryLists_hlDefines><HistoryLists_hlDefines Name="Item0">NO_STRICT</HistoryLists_hlDefines></HistoryLists_hlDefines><HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Count">1</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Item0">32</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Item1">16</HistoryLists_hlTLIB_PageSize></HistoryLists_hlTLIB_PageSize></CPlusPlusBuilder.Personality></BorlandProject></BorlandProject>\r
+  </ProjectExtensions>\r
+  <Import Project="$(MSBuildBinPath)\Borland.Cpp.Targets" />\r
+  <ItemGroup>\r
+    <None Include="..\include\gtest\gtest-death-test.h">\r
+      <BuildOrder>3</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\gtest-message.h">\r
+      <BuildOrder>4</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\gtest-param-test.h">\r
+      <BuildOrder>5</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\gtest-spi.h">\r
+      <BuildOrder>6</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\gtest-test-part.h">\r
+      <BuildOrder>7</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\gtest-typed-test.h">\r
+      <BuildOrder>8</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\gtest.h">\r
+      <BuildOrder>0</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\gtest_pred_impl.h">\r
+      <BuildOrder>1</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\gtest_prod.h">\r
+      <BuildOrder>2</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\internal\gtest-death-test-internal.h">\r
+      <BuildOrder>9</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\internal\gtest-filepath.h">\r
+      <BuildOrder>10</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\internal\gtest-internal.h">\r
+      <BuildOrder>11</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\internal\gtest-linked_ptr.h">\r
+      <BuildOrder>12</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\internal\gtest-param-util-generated.h">\r
+      <BuildOrder>14</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\internal\gtest-param-util.h">\r
+      <BuildOrder>13</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\internal\gtest-port.h">\r
+      <BuildOrder>15</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\internal\gtest-string.h">\r
+      <BuildOrder>16</BuildOrder>\r
+    </None>\r
+    <None Include="..\include\gtest\internal\gtest-type-util.h">\r
+      <BuildOrder>17</BuildOrder>\r
+    </None>\r
+    <CppCompile Include="gtest_all.cc">\r
+      <BuildOrder>18</BuildOrder>\r
+    </CppCompile>\r
+    <BuildConfiguration Include="Debug">\r
+      <Key>Cfg_1</Key>\r
+    </BuildConfiguration>\r
+    <BuildConfiguration Include="Release">\r
+      <Key>Cfg_2</Key>\r
+    </BuildConfiguration>\r
+  </ItemGroup>\r
 </Project>
\ No newline at end of file
index 849f4c4..faf31ca 100755 (executable)
@@ -1,54 +1,54 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <ProjectGuid>{c1d923e0-6cba-4332-9b6f-3420acbf5091}</ProjectGuid>
-  </PropertyGroup>
-  <ItemGroup />
-  <ItemGroup>
-    <Projects Include="gtest.cbproj" />
-    <Projects Include="gtest_main.cbproj" />
-    <Projects Include="gtest_unittest.cbproj" />
-  </ItemGroup>
-  <ProjectExtensions>
-    <Borland.Personality>Default.Personality</Borland.Personality>
-    <Borland.ProjectType />
-    <BorlandProject>
-<BorlandProject xmlns=""><Default.Personality></Default.Personality></BorlandProject></BorlandProject>
-  </ProjectExtensions>
-  <Target Name="gtest">
-    <MSBuild Projects="gtest.cbproj" Targets="" />
-  </Target>
-  <Target Name="gtest:Clean">
-    <MSBuild Projects="gtest.cbproj" Targets="Clean" />
-  </Target>
-  <Target Name="gtest:Make">
-    <MSBuild Projects="gtest.cbproj" Targets="Make" />
-  </Target>
-  <Target Name="gtest_main">
-    <MSBuild Projects="gtest_main.cbproj" Targets="" />
-  </Target>
-  <Target Name="gtest_main:Clean">
-    <MSBuild Projects="gtest_main.cbproj" Targets="Clean" />
-  </Target>
-  <Target Name="gtest_main:Make">
-    <MSBuild Projects="gtest_main.cbproj" Targets="Make" />
-  </Target>
-  <Target Name="gtest_unittest">
-    <MSBuild Projects="gtest_unittest.cbproj" Targets="" />
-  </Target>
-  <Target Name="gtest_unittest:Clean">
-    <MSBuild Projects="gtest_unittest.cbproj" Targets="Clean" />
-  </Target>
-  <Target Name="gtest_unittest:Make">
-    <MSBuild Projects="gtest_unittest.cbproj" Targets="Make" />
-  </Target>
-  <Target Name="Build">
-    <CallTarget Targets="gtest;gtest_main;gtest_unittest" />
-  </Target>
-  <Target Name="Clean">
-    <CallTarget Targets="gtest:Clean;gtest_main:Clean;gtest_unittest:Clean" />
-  </Target>
-  <Target Name="Make">
-    <CallTarget Targets="gtest:Make;gtest_main:Make;gtest_unittest:Make" />
-  </Target>
-  <Import Condition="Exists('$(MSBuildBinPath)\Borland.Group.Targets')" Project="$(MSBuildBinPath)\Borland.Group.Targets" />
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <ProjectGuid>{c1d923e0-6cba-4332-9b6f-3420acbf5091}</ProjectGuid>\r
+  </PropertyGroup>\r
+  <ItemGroup />\r
+  <ItemGroup>\r
+    <Projects Include="gtest.cbproj" />\r
+    <Projects Include="gtest_main.cbproj" />\r
+    <Projects Include="gtest_unittest.cbproj" />\r
+  </ItemGroup>\r
+  <ProjectExtensions>\r
+    <Borland.Personality>Default.Personality</Borland.Personality>\r
+    <Borland.ProjectType />\r
+    <BorlandProject>\r
+<BorlandProject xmlns=""><Default.Personality></Default.Personality></BorlandProject></BorlandProject>\r
+  </ProjectExtensions>\r
+  <Target Name="gtest">\r
+    <MSBuild Projects="gtest.cbproj" Targets="" />\r
+  </Target>\r
+  <Target Name="gtest:Clean">\r
+    <MSBuild Projects="gtest.cbproj" Targets="Clean" />\r
+  </Target>\r
+  <Target Name="gtest:Make">\r
+    <MSBuild Projects="gtest.cbproj" Targets="Make" />\r
+  </Target>\r
+  <Target Name="gtest_main">\r
+    <MSBuild Projects="gtest_main.cbproj" Targets="" />\r
+  </Target>\r
+  <Target Name="gtest_main:Clean">\r
+    <MSBuild Projects="gtest_main.cbproj" Targets="Clean" />\r
+  </Target>\r
+  <Target Name="gtest_main:Make">\r
+    <MSBuild Projects="gtest_main.cbproj" Targets="Make" />\r
+  </Target>\r
+  <Target Name="gtest_unittest">\r
+    <MSBuild Projects="gtest_unittest.cbproj" Targets="" />\r
+  </Target>\r
+  <Target Name="gtest_unittest:Clean">\r
+    <MSBuild Projects="gtest_unittest.cbproj" Targets="Clean" />\r
+  </Target>\r
+  <Target Name="gtest_unittest:Make">\r
+    <MSBuild Projects="gtest_unittest.cbproj" Targets="Make" />\r
+  </Target>\r
+  <Target Name="Build">\r
+    <CallTarget Targets="gtest;gtest_main;gtest_unittest" />\r
+  </Target>\r
+  <Target Name="Clean">\r
+    <CallTarget Targets="gtest:Clean;gtest_main:Clean;gtest_unittest:Clean" />\r
+  </Target>\r
+  <Target Name="Make">\r
+    <CallTarget Targets="gtest:Make;gtest_main:Make;gtest_unittest:Make" />\r
+  </Target>\r
+  <Import Condition="Exists('$(MSBuildBinPath)\Borland.Group.Targets')" Project="$(MSBuildBinPath)\Borland.Group.Targets" />\r
 </Project>
\ No newline at end of file
index ba7ad68..121b2d8 100755 (executable)
@@ -1,38 +1,38 @@
-// Copyright 2009, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Josh Kelley (joshkel@gmail.com)
-//
-// Google C++ Testing Framework (Google Test)
-//
-// C++Builder's IDE cannot build a static library from files with hyphens
-// in their name.  See http://qc.codegear.com/wc/qcmain.aspx?d=70977 .
-// This file serves as a workaround.
-
-#include "src/gtest-all.cc"
+// Copyright 2009, Google Inc.\r
+// All rights reserved.\r
+//\r
+// Redistribution and use in source and binary forms, with or without\r
+// modification, are permitted provided that the following conditions are\r
+// met:\r
+//\r
+//     * Redistributions of source code must retain the above copyright\r
+// notice, this list of conditions and the following disclaimer.\r
+//     * Redistributions in binary form must reproduce the above\r
+// copyright notice, this list of conditions and the following disclaimer\r
+// in the documentation and/or other materials provided with the\r
+// distribution.\r
+//     * Neither the name of Google Inc. nor the names of its\r
+// contributors may be used to endorse or promote products derived from\r
+// this software without specific prior written permission.\r
+//\r
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+//\r
+// Author: Josh Kelley (joshkel@gmail.com)\r
+//\r
+// Google C++ Testing Framework (Google Test)\r
+//\r
+// C++Builder's IDE cannot build a static library from files with hyphens\r
+// in their name.  See http://qc.codegear.com/wc/qcmain.aspx?d=70977 .\r
+// This file serves as a workaround.\r
+\r
+#include "src/gtest-all.cc"\r
index b955ebf..918eccd 100755 (executable)
@@ -1,40 +1,40 @@
-// Copyright 2009, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Josh Kelley (joshkel@gmail.com)
-//
-// Google C++ Testing Framework (Google Test)
-//
-// Links gtest.lib and gtest_main.lib into the current project in C++Builder.
-// This means that these libraries can't be renamed, but it's the only way to
-// ensure that Debug versus Release test builds are linked against the
-// appropriate Debug or Release build of the libraries.
-
-#pragma link "gtest.lib"
-#pragma link "gtest_main.lib"
+// Copyright 2009, Google Inc.\r
+// All rights reserved.\r
+//\r
+// Redistribution and use in source and binary forms, with or without\r
+// modification, are permitted provided that the following conditions are\r
+// met:\r
+//\r
+//     * Redistributions of source code must retain the above copyright\r
+// notice, this list of conditions and the following disclaimer.\r
+//     * Redistributions in binary form must reproduce the above\r
+// copyright notice, this list of conditions and the following disclaimer\r
+// in the documentation and/or other materials provided with the\r
+// distribution.\r
+//     * Neither the name of Google Inc. nor the names of its\r
+// contributors may be used to endorse or promote products derived from\r
+// this software without specific prior written permission.\r
+//\r
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+//\r
+// Author: Josh Kelley (joshkel@gmail.com)\r
+//\r
+// Google C++ Testing Framework (Google Test)\r
+//\r
+// Links gtest.lib and gtest_main.lib into the current project in C++Builder.\r
+// This means that these libraries can't be renamed, but it's the only way to\r
+// ensure that Debug versus Release test builds are linked against the\r
+// appropriate Debug or Release build of the libraries.\r
+\r
+#pragma link "gtest.lib"\r
+#pragma link "gtest_main.lib"\r
index fae32cb..d76ce13 100755 (executable)
@@ -1,82 +1,82 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <ProjectGuid>{bca37a72-5b07-46cf-b44e-89f8e06451a2}</ProjectGuid>
-    <Config Condition="'$(Config)'==''">Release</Config>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
-    <Base>true</Base>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
-    <Base>true</Base>
-    <Cfg_1>true</Cfg_1>
-    <CfgParent>Base</CfgParent>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
-    <Base>true</Base>
-    <Cfg_2>true</Cfg_2>
-    <CfgParent>Base</CfgParent>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Base)'!=''">
-    <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
-    <OutputExt>lib</OutputExt>
-    <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
-    <Defines>NO_STRICT</Defines>
-    <DynamicRTL>true</DynamicRTL>
-    <UsePackages>true</UsePackages>
-    <ProjectType>CppStaticLibrary</ProjectType>
-    <BCC_CPPCompileAlways>true</BCC_CPPCompileAlways>
-    <PackageImports>rtl.bpi;vcl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;dsnap.bpi;dsnapcon.bpi;vclib.bpi;ibxpress.bpi;adortl.bpi;dbxcds.bpi;dbexpress.bpi;DbxCommonDriver.bpi;websnap.bpi;vclie.bpi;webdsnap.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;Rave75VCL.bpi;teeUI.bpi;tee.bpi;teedb.bpi;IndyCore.bpi;IndySystem.bpi;IndyProtocols.bpi;IntrawebDB_90_100.bpi;Intraweb_90_100.bpi;dclZipForged11.bpi;vclZipForged11.bpi;GR32_BDS2006.bpi;GR32_DSGN_BDS2006.bpi;Jcl.bpi;JclVcl.bpi;JvCoreD11R.bpi;JvSystemD11R.bpi;JvStdCtrlsD11R.bpi;JvAppFrmD11R.bpi;JvBandsD11R.bpi;JvDBD11R.bpi;JvDlgsD11R.bpi;JvBDED11R.bpi;JvCmpD11R.bpi;JvCryptD11R.bpi;JvCtrlsD11R.bpi;JvCustomD11R.bpi;JvDockingD11R.bpi;JvDotNetCtrlsD11R.bpi;JvEDID11R.bpi;JvGlobusD11R.bpi;JvHMID11R.bpi;JvInterpreterD11R.bpi;JvJansD11R.bpi;JvManagedThreadsD11R.bpi;JvMMD11R.bpi;JvNetD11R.bpi;JvPageCompsD11R.bpi;JvPluginD11R.bpi;JvPrintPreviewD11R.bpi;JvRuntimeDesignD11R.bpi;JvTimeFrameworkD11R.bpi;JvValidatorsD11R.bpi;JvWizardD11R.bpi;JvXPCtrlsD11R.bpi;VclSmp.bpi;CExceptionExpert11.bpi</PackageImports>
-    <BCC_wpar>false</BCC_wpar>
-    <IncludePath>$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</IncludePath>
-    <AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>
-    <TLIB_PageSize>32</TLIB_PageSize>
-    <ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk</ILINK_LibraryPath>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Cfg_1)'!=''">
-    <BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
-    <DCC_Optimize>false</DCC_Optimize>
-    <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
-    <Defines>_DEBUG;$(Defines)</Defines>
-    <ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
-    <BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
-    <ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
-    <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
-    <DCC_Define>DEBUG</DCC_Define>
-    <BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
-    <IntermediateOutputDir>Debug</IntermediateOutputDir>
-    <TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
-    <BCC_StackFrames>true</BCC_StackFrames>
-    <BCC_DisableOptimizations>true</BCC_DisableOptimizations>
-    <ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
-    <TASM_Debugging>Full</TASM_Debugging>
-    <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Cfg_2)'!=''">
-    <Defines>NDEBUG;$(Defines)</Defines>
-    <IntermediateOutputDir>Release</IntermediateOutputDir>
-    <ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>
-    <TASM_Debugging>None</TASM_Debugging>
-  </PropertyGroup>
-  <ProjectExtensions>
-    <Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>
-    <Borland.ProjectType>CppStaticLibrary</Borland.ProjectType>
-    <BorlandProject>
-<BorlandProject><CPlusPlusBuilder.Personality><VersionInfo><VersionInfo Name="IncludeVerInfo">False</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1033</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName"></VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Debugging><Debugging Name="DebugSourceDirs"></Debugging></Debugging><Parameters><Parameters Name="RunParams"></Parameters><Parameters Name="Launcher"></Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="DebugCWD"></Parameters><Parameters Name="HostApplication"></Parameters><Parameters Name="RemoteHost"></Parameters><Parameters Name="RemotePath"></Parameters><Parameters Name="RemoteParams"></Parameters><Parameters Name="RemoteLauncher"></Parameters><Parameters Name="UseRemoteLauncher">False</Parameters><Parameters Name="RemoteCWD"></Parameters><Parameters Name="RemoteDebug">False</Parameters><Parameters Name="Debug Symbols Search Path"></Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Excluded_Packages>
-      <Excluded_Packages Name="$(BDS)\bin\bcboffice2k100.bpl">CodeGear C++Builder Office 2000 Servers Package</Excluded_Packages>
-      <Excluded_Packages Name="$(BDS)\bin\bcbofficexp100.bpl">CodeGear C++Builder Office XP Servers Package</Excluded_Packages>
-    </Excluded_Packages><Linker><Linker Name="LibPrefix"></Linker><Linker Name="LibSuffix"></Linker><Linker Name="LibVersion"></Linker></Linker><ProjectProperties><ProjectProperties Name="AutoShowDeps">False</ProjectProperties><ProjectProperties Name="ManagePaths">True</ProjectProperties><ProjectProperties Name="VerifyPackages">True</ProjectProperties></ProjectProperties><HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Count">3</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item0">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item1">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item2">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\src;..\include</HistoryLists_hlIncludePath></HistoryLists_hlIncludePath><HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Count">1</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item0">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk</HistoryLists_hlILINK_LibraryPath></HistoryLists_hlILINK_LibraryPath><HistoryLists_hlDefines><HistoryLists_hlDefines Name="Count">1</HistoryLists_hlDefines><HistoryLists_hlDefines Name="Item0">NO_STRICT</HistoryLists_hlDefines></HistoryLists_hlDefines><HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Count">1</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Item0">32</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Item1">16</HistoryLists_hlTLIB_PageSize></HistoryLists_hlTLIB_PageSize></CPlusPlusBuilder.Personality></BorlandProject></BorlandProject>
-  </ProjectExtensions>
-  <Import Project="$(MSBuildBinPath)\Borland.Cpp.Targets" />
-  <ItemGroup>
-    <CppCompile Include="..\src\gtest_main.cc">
-      <BuildOrder>0</BuildOrder>
-    </CppCompile>
-    <BuildConfiguration Include="Debug">
-      <Key>Cfg_1</Key>
-    </BuildConfiguration>
-    <BuildConfiguration Include="Release">
-      <Key>Cfg_2</Key>
-    </BuildConfiguration>
-  </ItemGroup>
-</Project>
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <ProjectGuid>{bca37a72-5b07-46cf-b44e-89f8e06451a2}</ProjectGuid>\r
+    <Config Condition="'$(Config)'==''">Release</Config>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">\r
+    <Base>true</Base>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">\r
+    <Base>true</Base>\r
+    <Cfg_1>true</Cfg_1>\r
+    <CfgParent>Base</CfgParent>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">\r
+    <Base>true</Base>\r
+    <Cfg_2>true</Cfg_2>\r
+    <CfgParent>Base</CfgParent>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Base)'!=''">\r
+    <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>\r
+    <OutputExt>lib</OutputExt>\r
+    <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>\r
+    <Defines>NO_STRICT</Defines>\r
+    <DynamicRTL>true</DynamicRTL>\r
+    <UsePackages>true</UsePackages>\r
+    <ProjectType>CppStaticLibrary</ProjectType>\r
+    <BCC_CPPCompileAlways>true</BCC_CPPCompileAlways>\r
+    <PackageImports>rtl.bpi;vcl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;dsnap.bpi;dsnapcon.bpi;vclib.bpi;ibxpress.bpi;adortl.bpi;dbxcds.bpi;dbexpress.bpi;DbxCommonDriver.bpi;websnap.bpi;vclie.bpi;webdsnap.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;Rave75VCL.bpi;teeUI.bpi;tee.bpi;teedb.bpi;IndyCore.bpi;IndySystem.bpi;IndyProtocols.bpi;IntrawebDB_90_100.bpi;Intraweb_90_100.bpi;dclZipForged11.bpi;vclZipForged11.bpi;GR32_BDS2006.bpi;GR32_DSGN_BDS2006.bpi;Jcl.bpi;JclVcl.bpi;JvCoreD11R.bpi;JvSystemD11R.bpi;JvStdCtrlsD11R.bpi;JvAppFrmD11R.bpi;JvBandsD11R.bpi;JvDBD11R.bpi;JvDlgsD11R.bpi;JvBDED11R.bpi;JvCmpD11R.bpi;JvCryptD11R.bpi;JvCtrlsD11R.bpi;JvCustomD11R.bpi;JvDockingD11R.bpi;JvDotNetCtrlsD11R.bpi;JvEDID11R.bpi;JvGlobusD11R.bpi;JvHMID11R.bpi;JvInterpreterD11R.bpi;JvJansD11R.bpi;JvManagedThreadsD11R.bpi;JvMMD11R.bpi;JvNetD11R.bpi;JvPageCompsD11R.bpi;JvPluginD11R.bpi;JvPrintPreviewD11R.bpi;JvRuntimeDesignD11R.bpi;JvTimeFrameworkD11R.bpi;JvValidatorsD11R.bpi;JvWizardD11R.bpi;JvXPCtrlsD11R.bpi;VclSmp.bpi;CExceptionExpert11.bpi</PackageImports>\r
+    <BCC_wpar>false</BCC_wpar>\r
+    <IncludePath>$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</IncludePath>\r
+    <AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>\r
+    <TLIB_PageSize>32</TLIB_PageSize>\r
+    <ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk</ILINK_LibraryPath>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Cfg_1)'!=''">\r
+    <BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>\r
+    <DCC_Optimize>false</DCC_Optimize>\r
+    <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>\r
+    <Defines>_DEBUG;$(Defines)</Defines>\r
+    <ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>\r
+    <BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>\r
+    <ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>\r
+    <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>\r
+    <DCC_Define>DEBUG</DCC_Define>\r
+    <BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>\r
+    <IntermediateOutputDir>Debug</IntermediateOutputDir>\r
+    <TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>\r
+    <BCC_StackFrames>true</BCC_StackFrames>\r
+    <BCC_DisableOptimizations>true</BCC_DisableOptimizations>\r
+    <ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>\r
+    <TASM_Debugging>Full</TASM_Debugging>\r
+    <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Cfg_2)'!=''">\r
+    <Defines>NDEBUG;$(Defines)</Defines>\r
+    <IntermediateOutputDir>Release</IntermediateOutputDir>\r
+    <ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>\r
+    <TASM_Debugging>None</TASM_Debugging>\r
+  </PropertyGroup>\r
+  <ProjectExtensions>\r
+    <Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>\r
+    <Borland.ProjectType>CppStaticLibrary</Borland.ProjectType>\r
+    <BorlandProject>\r
+<BorlandProject><CPlusPlusBuilder.Personality><VersionInfo><VersionInfo Name="IncludeVerInfo">False</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1033</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName"></VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Debugging><Debugging Name="DebugSourceDirs"></Debugging></Debugging><Parameters><Parameters Name="RunParams"></Parameters><Parameters Name="Launcher"></Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="DebugCWD"></Parameters><Parameters Name="HostApplication"></Parameters><Parameters Name="RemoteHost"></Parameters><Parameters Name="RemotePath"></Parameters><Parameters Name="RemoteParams"></Parameters><Parameters Name="RemoteLauncher"></Parameters><Parameters Name="UseRemoteLauncher">False</Parameters><Parameters Name="RemoteCWD"></Parameters><Parameters Name="RemoteDebug">False</Parameters><Parameters Name="Debug Symbols Search Path"></Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Excluded_Packages>\r
+      <Excluded_Packages Name="$(BDS)\bin\bcboffice2k100.bpl">CodeGear C++Builder Office 2000 Servers Package</Excluded_Packages>\r
+      <Excluded_Packages Name="$(BDS)\bin\bcbofficexp100.bpl">CodeGear C++Builder Office XP Servers Package</Excluded_Packages>\r
+    </Excluded_Packages><Linker><Linker Name="LibPrefix"></Linker><Linker Name="LibSuffix"></Linker><Linker Name="LibVersion"></Linker></Linker><ProjectProperties><ProjectProperties Name="AutoShowDeps">False</ProjectProperties><ProjectProperties Name="ManagePaths">True</ProjectProperties><ProjectProperties Name="VerifyPackages">True</ProjectProperties></ProjectProperties><HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Count">3</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item0">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item1">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\include;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item2">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\src;..\src;..\include</HistoryLists_hlIncludePath></HistoryLists_hlIncludePath><HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Count">1</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item0">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk</HistoryLists_hlILINK_LibraryPath></HistoryLists_hlILINK_LibraryPath><HistoryLists_hlDefines><HistoryLists_hlDefines Name="Count">1</HistoryLists_hlDefines><HistoryLists_hlDefines Name="Item0">NO_STRICT</HistoryLists_hlDefines></HistoryLists_hlDefines><HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Count">1</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Item0">32</HistoryLists_hlTLIB_PageSize><HistoryLists_hlTLIB_PageSize Name="Item1">16</HistoryLists_hlTLIB_PageSize></HistoryLists_hlTLIB_PageSize></CPlusPlusBuilder.Personality></BorlandProject></BorlandProject>\r
+  </ProjectExtensions>\r
+  <Import Project="$(MSBuildBinPath)\Borland.Cpp.Targets" />\r
+  <ItemGroup>\r
+    <CppCompile Include="..\src\gtest_main.cc">\r
+      <BuildOrder>0</BuildOrder>\r
+    </CppCompile>\r
+    <BuildConfiguration Include="Debug">\r
+      <Key>Cfg_1</Key>\r
+    </BuildConfiguration>\r
+    <BuildConfiguration Include="Release">\r
+      <Key>Cfg_2</Key>\r
+    </BuildConfiguration>\r
+  </ItemGroup>\r
+</Project>\r
index 33f7056..dc5db8e 100755 (executable)
@@ -1,88 +1,88 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <ProjectGuid>{eea63393-5ac5-4b9c-8909-d75fef2daa41}</ProjectGuid>
-    <Config Condition="'$(Config)'==''">Release</Config>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
-    <Base>true</Base>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
-    <Base>true</Base>
-    <Cfg_1>true</Cfg_1>
-    <CfgParent>Base</CfgParent>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
-    <Base>true</Base>
-    <Cfg_2>true</Cfg_2>
-    <CfgParent>Base</CfgParent>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Base)'!=''">
-    <OutputExt>exe</OutputExt>
-    <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
-    <Defines>NO_STRICT</Defines>
-    <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
-    <DynamicRTL>true</DynamicRTL>
-    <ILINK_ObjectSearchPath>..\test</ILINK_ObjectSearchPath>
-    <UsePackages>true</UsePackages>
-    <ProjectType>CppConsoleApplication</ProjectType>
-    <NoVCL>true</NoVCL>
-    <BCC_CPPCompileAlways>true</BCC_CPPCompileAlways>
-    <PackageImports>rtl.bpi;vcl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;dsnap.bpi;dsnapcon.bpi;vclib.bpi;ibxpress.bpi;adortl.bpi;dbxcds.bpi;dbexpress.bpi;DbxCommonDriver.bpi;websnap.bpi;vclie.bpi;webdsnap.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;Rave75VCL.bpi;teeUI.bpi;tee.bpi;teedb.bpi;IndyCore.bpi;IndySystem.bpi;IndyProtocols.bpi;IntrawebDB_90_100.bpi;Intraweb_90_100.bpi;Jcl.bpi;JclVcl.bpi;JvCoreD11R.bpi;JvSystemD11R.bpi;JvStdCtrlsD11R.bpi;JvAppFrmD11R.bpi;JvBandsD11R.bpi;JvDBD11R.bpi;JvDlgsD11R.bpi;JvBDED11R.bpi;JvCmpD11R.bpi;JvCryptD11R.bpi;JvCtrlsD11R.bpi;JvCustomD11R.bpi;JvDockingD11R.bpi;JvDotNetCtrlsD11R.bpi;JvEDID11R.bpi;JvGlobusD11R.bpi;JvHMID11R.bpi;JvInterpreterD11R.bpi;JvJansD11R.bpi;JvManagedThreadsD11R.bpi;JvMMD11R.bpi;JvNetD11R.bpi;JvPageCompsD11R.bpi;JvPluginD11R.bpi;JvPrintPreviewD11R.bpi;JvRuntimeDesignD11R.bpi;JvTimeFrameworkD11R.bpi;JvValidatorsD11R.bpi;JvWizardD11R.bpi;JvXPCtrlsD11R.bpi;VclSmp.bpi</PackageImports>
-    <BCC_wpar>false</BCC_wpar>
-    <IncludePath>$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\include;..\test;..</IncludePath>
-    <ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\test</ILINK_LibraryPath>
-    <Multithreaded>true</Multithreaded>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Cfg_1)'!=''">
-    <BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
-    <DCC_Optimize>false</DCC_Optimize>
-    <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
-    <Defines>_DEBUG;$(Defines)</Defines>
-    <ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
-    <BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
-    <ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
-    <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
-    <DCC_Define>DEBUG</DCC_Define>
-    <BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
-    <IntermediateOutputDir>Debug</IntermediateOutputDir>
-    <TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
-    <BCC_StackFrames>true</BCC_StackFrames>
-    <BCC_DisableOptimizations>true</BCC_DisableOptimizations>
-    <ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
-    <TASM_Debugging>Full</TASM_Debugging>
-    <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Cfg_2)'!=''">
-    <Defines>NDEBUG;$(Defines)</Defines>
-    <IntermediateOutputDir>Release</IntermediateOutputDir>
-    <ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>
-    <TASM_Debugging>None</TASM_Debugging>
-  </PropertyGroup>
-  <ProjectExtensions>
-    <Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>
-    <Borland.ProjectType>CppConsoleApplication</Borland.ProjectType>
-    <BorlandProject>
-<BorlandProject><CPlusPlusBuilder.Personality><VersionInfo><VersionInfo Name="IncludeVerInfo">False</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1033</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName"></VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Debugging><Debugging Name="DebugSourceDirs"></Debugging></Debugging><Parameters><Parameters Name="RunParams"></Parameters><Parameters Name="Launcher"></Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="DebugCWD"></Parameters><Parameters Name="HostApplication"></Parameters><Parameters Name="RemoteHost"></Parameters><Parameters Name="RemotePath"></Parameters><Parameters Name="RemoteParams"></Parameters><Parameters Name="RemoteLauncher"></Parameters><Parameters Name="UseRemoteLauncher">False</Parameters><Parameters Name="RemoteCWD"></Parameters><Parameters Name="RemoteDebug">False</Parameters><Parameters Name="Debug Symbols Search Path"></Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Excluded_Packages>
-      
-      
-      <Excluded_Packages Name="$(BDS)\bin\bcboffice2k100.bpl">CodeGear C++Builder Office 2000 Servers Package</Excluded_Packages>
-      <Excluded_Packages Name="$(BDS)\bin\bcbofficexp100.bpl">CodeGear C++Builder Office XP Servers Package</Excluded_Packages>
-    </Excluded_Packages><Linker><Linker Name="LibPrefix"></Linker><Linker Name="LibSuffix"></Linker><Linker Name="LibVersion"></Linker></Linker><ProjectProperties><ProjectProperties Name="AutoShowDeps">False</ProjectProperties><ProjectProperties Name="ManagePaths">True</ProjectProperties><ProjectProperties Name="VerifyPackages">True</ProjectProperties></ProjectProperties><HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Count">3</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item0">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\include;..\test;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item1">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\include;..\test</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item2">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\include</HistoryLists_hlIncludePath></HistoryLists_hlIncludePath><HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Count">1</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item0">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\test</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item1">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\test</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item2">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;$(OUTPUTDIR);..\test</HistoryLists_hlILINK_LibraryPath></HistoryLists_hlILINK_LibraryPath><HistoryLists_hlDefines><HistoryLists_hlDefines Name="Count">2</HistoryLists_hlDefines><HistoryLists_hlDefines Name="Item0">NO_STRICT</HistoryLists_hlDefines><HistoryLists_hlDefines Name="Item1">STRICT</HistoryLists_hlDefines></HistoryLists_hlDefines></CPlusPlusBuilder.Personality></BorlandProject></BorlandProject>
-  </ProjectExtensions>
-  <Import Project="$(MSBuildBinPath)\Borland.Cpp.Targets" />
-  <ItemGroup>
-    <CppCompile Include="..\test\gtest_unittest.cc">
-      <BuildOrder>0</BuildOrder>
-    </CppCompile>
-    <CppCompile Include="gtest_link.cc">
-      <BuildOrder>1</BuildOrder>
-    </CppCompile>
-    <BuildConfiguration Include="Debug">
-      <Key>Cfg_1</Key>
-    </BuildConfiguration>
-    <BuildConfiguration Include="Release">
-      <Key>Cfg_2</Key>
-    </BuildConfiguration>
-  </ItemGroup>
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <ProjectGuid>{eea63393-5ac5-4b9c-8909-d75fef2daa41}</ProjectGuid>\r
+    <Config Condition="'$(Config)'==''">Release</Config>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">\r
+    <Base>true</Base>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">\r
+    <Base>true</Base>\r
+    <Cfg_1>true</Cfg_1>\r
+    <CfgParent>Base</CfgParent>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">\r
+    <Base>true</Base>\r
+    <Cfg_2>true</Cfg_2>\r
+    <CfgParent>Base</CfgParent>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Base)'!=''">\r
+    <OutputExt>exe</OutputExt>\r
+    <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>\r
+    <Defines>NO_STRICT</Defines>\r
+    <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>\r
+    <DynamicRTL>true</DynamicRTL>\r
+    <ILINK_ObjectSearchPath>..\test</ILINK_ObjectSearchPath>\r
+    <UsePackages>true</UsePackages>\r
+    <ProjectType>CppConsoleApplication</ProjectType>\r
+    <NoVCL>true</NoVCL>\r
+    <BCC_CPPCompileAlways>true</BCC_CPPCompileAlways>\r
+    <PackageImports>rtl.bpi;vcl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;dsnap.bpi;dsnapcon.bpi;vclib.bpi;ibxpress.bpi;adortl.bpi;dbxcds.bpi;dbexpress.bpi;DbxCommonDriver.bpi;websnap.bpi;vclie.bpi;webdsnap.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;Rave75VCL.bpi;teeUI.bpi;tee.bpi;teedb.bpi;IndyCore.bpi;IndySystem.bpi;IndyProtocols.bpi;IntrawebDB_90_100.bpi;Intraweb_90_100.bpi;Jcl.bpi;JclVcl.bpi;JvCoreD11R.bpi;JvSystemD11R.bpi;JvStdCtrlsD11R.bpi;JvAppFrmD11R.bpi;JvBandsD11R.bpi;JvDBD11R.bpi;JvDlgsD11R.bpi;JvBDED11R.bpi;JvCmpD11R.bpi;JvCryptD11R.bpi;JvCtrlsD11R.bpi;JvCustomD11R.bpi;JvDockingD11R.bpi;JvDotNetCtrlsD11R.bpi;JvEDID11R.bpi;JvGlobusD11R.bpi;JvHMID11R.bpi;JvInterpreterD11R.bpi;JvJansD11R.bpi;JvManagedThreadsD11R.bpi;JvMMD11R.bpi;JvNetD11R.bpi;JvPageCompsD11R.bpi;JvPluginD11R.bpi;JvPrintPreviewD11R.bpi;JvRuntimeDesignD11R.bpi;JvTimeFrameworkD11R.bpi;JvValidatorsD11R.bpi;JvWizardD11R.bpi;JvXPCtrlsD11R.bpi;VclSmp.bpi</PackageImports>\r
+    <BCC_wpar>false</BCC_wpar>\r
+    <IncludePath>$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\include;..\test;..</IncludePath>\r
+    <ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\test</ILINK_LibraryPath>\r
+    <Multithreaded>true</Multithreaded>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Cfg_1)'!=''">\r
+    <BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>\r
+    <DCC_Optimize>false</DCC_Optimize>\r
+    <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>\r
+    <Defines>_DEBUG;$(Defines)</Defines>\r
+    <ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>\r
+    <BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>\r
+    <ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>\r
+    <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>\r
+    <DCC_Define>DEBUG</DCC_Define>\r
+    <BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>\r
+    <IntermediateOutputDir>Debug</IntermediateOutputDir>\r
+    <TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>\r
+    <BCC_StackFrames>true</BCC_StackFrames>\r
+    <BCC_DisableOptimizations>true</BCC_DisableOptimizations>\r
+    <ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>\r
+    <TASM_Debugging>Full</TASM_Debugging>\r
+    <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Cfg_2)'!=''">\r
+    <Defines>NDEBUG;$(Defines)</Defines>\r
+    <IntermediateOutputDir>Release</IntermediateOutputDir>\r
+    <ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>\r
+    <TASM_Debugging>None</TASM_Debugging>\r
+  </PropertyGroup>\r
+  <ProjectExtensions>\r
+    <Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>\r
+    <Borland.ProjectType>CppConsoleApplication</Borland.ProjectType>\r
+    <BorlandProject>\r
+<BorlandProject><CPlusPlusBuilder.Personality><VersionInfo><VersionInfo Name="IncludeVerInfo">False</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1033</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName"></VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Debugging><Debugging Name="DebugSourceDirs"></Debugging></Debugging><Parameters><Parameters Name="RunParams"></Parameters><Parameters Name="Launcher"></Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="DebugCWD"></Parameters><Parameters Name="HostApplication"></Parameters><Parameters Name="RemoteHost"></Parameters><Parameters Name="RemotePath"></Parameters><Parameters Name="RemoteParams"></Parameters><Parameters Name="RemoteLauncher"></Parameters><Parameters Name="UseRemoteLauncher">False</Parameters><Parameters Name="RemoteCWD"></Parameters><Parameters Name="RemoteDebug">False</Parameters><Parameters Name="Debug Symbols Search Path"></Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Excluded_Packages>\r
+      \r
+      \r
+      <Excluded_Packages Name="$(BDS)\bin\bcboffice2k100.bpl">CodeGear C++Builder Office 2000 Servers Package</Excluded_Packages>\r
+      <Excluded_Packages Name="$(BDS)\bin\bcbofficexp100.bpl">CodeGear C++Builder Office XP Servers Package</Excluded_Packages>\r
+    </Excluded_Packages><Linker><Linker Name="LibPrefix"></Linker><Linker Name="LibSuffix"></Linker><Linker Name="LibVersion"></Linker></Linker><ProjectProperties><ProjectProperties Name="AutoShowDeps">False</ProjectProperties><ProjectProperties Name="ManagePaths">True</ProjectProperties><ProjectProperties Name="VerifyPackages">True</ProjectProperties></ProjectProperties><HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Count">3</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item0">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\include;..\test;..</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item1">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\include;..\test</HistoryLists_hlIncludePath><HistoryLists_hlIncludePath Name="Item2">$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\include</HistoryLists_hlIncludePath></HistoryLists_hlIncludePath><HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Count">1</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item0">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\test</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item1">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\test</HistoryLists_hlILINK_LibraryPath><HistoryLists_hlILINK_LibraryPath Name="Item2">$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;$(OUTPUTDIR);..\test</HistoryLists_hlILINK_LibraryPath></HistoryLists_hlILINK_LibraryPath><HistoryLists_hlDefines><HistoryLists_hlDefines Name="Count">2</HistoryLists_hlDefines><HistoryLists_hlDefines Name="Item0">NO_STRICT</HistoryLists_hlDefines><HistoryLists_hlDefines Name="Item1">STRICT</HistoryLists_hlDefines></HistoryLists_hlDefines></CPlusPlusBuilder.Personality></BorlandProject></BorlandProject>\r
+  </ProjectExtensions>\r
+  <Import Project="$(MSBuildBinPath)\Borland.Cpp.Targets" />\r
+  <ItemGroup>\r
+    <CppCompile Include="..\test\gtest_unittest.cc">\r
+      <BuildOrder>0</BuildOrder>\r
+    </CppCompile>\r
+    <CppCompile Include="gtest_link.cc">\r
+      <BuildOrder>1</BuildOrder>\r
+    </CppCompile>\r
+    <BuildConfiguration Include="Debug">\r
+      <Key>Cfg_1</Key>\r
+    </BuildConfiguration>\r
+    <BuildConfiguration Include="Release">\r
+      <Key>Cfg_2</Key>\r
+    </BuildConfiguration>\r
+  </ItemGroup>\r
 </Project>
\ No newline at end of file
diff --git a/config.log b/config.log
deleted file mode 100644 (file)
index 4a0faa4..0000000
+++ /dev/null
@@ -1,969 +0,0 @@
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by Google C++ Testing Framework configure 1.6.0, which was
-generated by GNU Autoconf 2.65.  Invocation command line was
-
-  $ ./configure 
-
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = dahyeong-Samsung-DeskTop-System
-uname -m = i686
-uname -r = 3.0.0-12-generic
-uname -s = Linux
-uname -v = #20-Ubuntu SMP Fri Oct 7 14:50:42 UTC 2011
-
-/usr/bin/uname -p = unknown
-/bin/uname -X     = unknown
-
-/bin/arch              = unknown
-/usr/bin/arch -k       = unknown
-/usr/convex/getsysinfo = unknown
-/usr/bin/hostinfo      = unknown
-/bin/machine           = unknown
-/usr/bin/oslevel       = unknown
-/bin/universe          = unknown
-
-PATH: /usr/lib/lightdm/lightdm
-PATH: /usr/local/sbin
-PATH: /usr/local/bin
-PATH: /usr/sbin
-PATH: /usr/bin
-PATH: /sbin
-PATH: /bin
-PATH: /usr/games
-PATH: /usr/lib/jdk1.7.0_05/bin
-PATH: /opt/k9/k9_user_application/bin
-PATH: /home/dahyeong/C++TEST/parasoft/cpptest/9.2
-PATH: /home/dahyeong/tizen_sdk/SDK/sdb
-PATH: /home/dahyeong/tizen_sdk/SDK/build-system/bin
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-configure:2410: checking for a BSD-compatible install
-configure:2478: result: /usr/bin/install -c
-configure:2489: checking whether build environment is sane
-configure:2539: result: yes
-configure:2680: checking for a thread-safe mkdir -p
-configure:2719: result: /bin/mkdir -p
-configure:2732: checking for gawk
-configure:2762: result: no
-configure:2732: checking for mawk
-configure:2748: found /usr/bin/mawk
-configure:2759: result: mawk
-configure:2770: checking whether make sets $(MAKE)
-configure:2792: result: yes
-configure:2922: checking for gcc
-configure:2938: found /usr/bin/gcc
-configure:2949: result: gcc
-configure:3178: checking for C compiler version
-configure:3187: gcc --version >&5
-gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
-Copyright (C) 2011 Free Software Foundation, Inc.
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-configure:3198: $? = 0
-configure:3187: gcc -v >&5
-Using built-in specs.
-COLLECT_GCC=gcc
-COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6.1/lto-wrapper
-Target: i686-linux-gnu
-Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
-Thread model: posix
-gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) 
-configure:3198: $? = 0
-configure:3187: gcc -V >&5
-gcc: error: unrecognized option '-V'
-gcc: fatal error: no input files
-compilation terminated.
-configure:3198: $? = 4
-configure:3187: gcc -qversion >&5
-gcc: error: unrecognized option '-qversion'
-gcc: fatal error: no input files
-compilation terminated.
-configure:3198: $? = 4
-configure:3218: checking whether the C compiler works
-configure:3240: gcc    conftest.c  >&5
-configure:3244: $? = 0
-configure:3293: result: yes
-configure:3296: checking for C compiler default output file name
-configure:3298: result: a.out
-configure:3304: checking for suffix of executables
-configure:3311: gcc -o conftest    conftest.c  >&5
-configure:3315: $? = 0
-configure:3337: result: 
-configure:3359: checking whether we are cross compiling
-configure:3367: gcc -o conftest    conftest.c  >&5
-configure:3371: $? = 0
-configure:3378: ./conftest
-configure:3382: $? = 0
-configure:3397: result: no
-configure:3402: checking for suffix of object files
-configure:3424: gcc -c   conftest.c >&5
-configure:3428: $? = 0
-configure:3449: result: o
-configure:3453: checking whether we are using the GNU C compiler
-configure:3472: gcc -c   conftest.c >&5
-configure:3472: $? = 0
-configure:3481: result: yes
-configure:3490: checking whether gcc accepts -g
-configure:3510: gcc -c -g  conftest.c >&5
-configure:3510: $? = 0
-configure:3551: result: yes
-configure:3568: checking for gcc option to accept ISO C89
-configure:3632: gcc  -c -g -O2  conftest.c >&5
-configure:3632: $? = 0
-configure:3645: result: none needed
-configure:3676: checking for style of include used by make
-configure:3704: result: GNU
-configure:3729: checking dependency style of gcc
-configure:3839: result: gcc3
-configure:3912: checking for g++
-configure:3928: found /usr/bin/g++
-configure:3939: result: g++
-configure:3966: checking for C++ compiler version
-configure:3975: g++ --version >&5
-g++ (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
-Copyright (C) 2011 Free Software Foundation, Inc.
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-configure:3986: $? = 0
-configure:3975: g++ -v >&5
-Using built-in specs.
-COLLECT_GCC=g++
-COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6.1/lto-wrapper
-Target: i686-linux-gnu
-Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
-Thread model: posix
-gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) 
-configure:3986: $? = 0
-configure:3975: g++ -V >&5
-g++: error: unrecognized option '-V'
-g++: fatal error: no input files
-compilation terminated.
-configure:3986: $? = 4
-configure:3975: g++ -qversion >&5
-g++: error: unrecognized option '-qversion'
-g++: fatal error: no input files
-compilation terminated.
-configure:3986: $? = 4
-configure:3990: checking whether we are using the GNU C++ compiler
-configure:4009: g++ -c   conftest.cpp >&5
-configure:4009: $? = 0
-configure:4018: result: yes
-configure:4027: checking whether g++ accepts -g
-configure:4047: g++ -c -g  conftest.cpp >&5
-configure:4047: $? = 0
-configure:4088: result: yes
-configure:4113: checking dependency style of g++
-configure:4223: result: gcc3
-configure:4273: checking build system type
-configure:4287: result: i686-pc-linux-gnu
-configure:4307: checking host system type
-configure:4320: result: i686-pc-linux-gnu
-configure:4340: checking for a sed that does not truncate output
-configure:4404: result: /bin/sed
-configure:4422: checking for grep that handles long lines and -e
-configure:4480: result: /bin/grep
-configure:4485: checking for egrep
-configure:4547: result: /bin/grep -E
-configure:4552: checking for fgrep
-configure:4614: result: /bin/grep -F
-configure:4649: checking for ld used by gcc
-configure:4716: result: /usr/bin/ld
-configure:4723: checking if the linker (/usr/bin/ld) is GNU ld
-configure:4738: result: yes
-configure:4750: checking for BSD- or MS-compatible name lister (nm)
-configure:4799: result: /usr/bin/nm -B
-configure:4917: checking the name lister (/usr/bin/nm -B) interface
-configure:4924: g++ -c -g -O2  conftest.cpp >&5
-configure:4927: /usr/bin/nm -B "conftest.o"
-configure:4930: output
-00000000 B some_variable
-configure:4937: result: BSD nm
-configure:4940: checking whether ln -s works
-configure:4944: result: yes
-configure:4952: checking the maximum length of command line arguments
-configure:5072: result: 1572864
-configure:5089: checking whether the shell understands some XSI constructs
-configure:5099: result: yes
-configure:5103: checking whether the shell understands "+="
-configure:5109: result: yes
-configure:5144: checking for /usr/bin/ld option to reload object files
-configure:5151: result: -r
-configure:5220: checking for objdump
-configure:5236: found /usr/bin/objdump
-configure:5247: result: objdump
-configure:5279: checking how to recognize dependent libraries
-configure:5475: result: pass_all
-configure:5535: checking for ar
-configure:5551: found /usr/bin/ar
-configure:5562: result: ar
-configure:5640: checking for strip
-configure:5656: found /usr/bin/strip
-configure:5667: result: strip
-configure:5739: checking for ranlib
-configure:5755: found /usr/bin/ranlib
-configure:5766: result: ranlib
-configure:5856: checking command to parse /usr/bin/nm -B output from gcc object
-configure:5974: g++ -c -g -O2  conftest.cpp >&5
-configure:5977: $? = 0
-configure:5981: /usr/bin/nm -B conftest.o \| sed -n -e 's/^.*[  ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[         ][      ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' \> conftest.nm
-configure:5984: $? = 0
-configure:6038: g++ -o conftest -g -O2   conftest.cpp conftstm.o >&5
-configure:6041: $? = 0
-configure:6079: result: ok
-configure:6888: checking how to run the C preprocessor
-configure:6919: gcc -E  conftest.c
-configure:6919: $? = 0
-configure:6933: gcc -E  conftest.c
-conftest.c:11:28: fatal error: ac_nonexistent.h: No such file or directory
-compilation terminated.
-configure:6933: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME "Google C++ Testing Framework"
-| #define PACKAGE_TARNAME "gtest"
-| #define PACKAGE_VERSION "1.6.0"
-| #define PACKAGE_STRING "Google C++ Testing Framework 1.6.0"
-| #define PACKAGE_BUGREPORT "googletestframework@googlegroups.com"
-| #define PACKAGE_URL ""
-| #define PACKAGE "gtest"
-| #define VERSION "1.6.0"
-| /* end confdefs.h.  */
-| #include <ac_nonexistent.h>
-configure:6958: result: gcc -E
-configure:6978: gcc -E  conftest.c
-configure:6978: $? = 0
-configure:6992: gcc -E  conftest.c
-conftest.c:11:28: fatal error: ac_nonexistent.h: No such file or directory
-compilation terminated.
-configure:6992: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME "Google C++ Testing Framework"
-| #define PACKAGE_TARNAME "gtest"
-| #define PACKAGE_VERSION "1.6.0"
-| #define PACKAGE_STRING "Google C++ Testing Framework 1.6.0"
-| #define PACKAGE_BUGREPORT "googletestframework@googlegroups.com"
-| #define PACKAGE_URL ""
-| #define PACKAGE "gtest"
-| #define VERSION "1.6.0"
-| /* end confdefs.h.  */
-| #include <ac_nonexistent.h>
-configure:7021: checking for ANSI C header files
-configure:7041: gcc -c -g -O2  conftest.c >&5
-configure:7041: $? = 0
-configure:7114: gcc -o conftest -g -O2   conftest.c  >&5
-configure:7114: $? = 0
-configure:7114: ./conftest
-configure:7114: $? = 0
-configure:7125: result: yes
-configure:7138: checking for sys/types.h
-configure:7138: gcc -c -g -O2  conftest.c >&5
-configure:7138: $? = 0
-configure:7138: result: yes
-configure:7138: checking for sys/stat.h
-configure:7138: gcc -c -g -O2  conftest.c >&5
-configure:7138: $? = 0
-configure:7138: result: yes
-configure:7138: checking for stdlib.h
-configure:7138: gcc -c -g -O2  conftest.c >&5
-configure:7138: $? = 0
-configure:7138: result: yes
-configure:7138: checking for string.h
-configure:7138: gcc -c -g -O2  conftest.c >&5
-configure:7138: $? = 0
-configure:7138: result: yes
-configure:7138: checking for memory.h
-configure:7138: gcc -c -g -O2  conftest.c >&5
-configure:7138: $? = 0
-configure:7138: result: yes
-configure:7138: checking for strings.h
-configure:7138: gcc -c -g -O2  conftest.c >&5
-configure:7138: $? = 0
-configure:7138: result: yes
-configure:7138: checking for inttypes.h
-configure:7138: gcc -c -g -O2  conftest.c >&5
-configure:7138: $? = 0
-configure:7138: result: yes
-configure:7138: checking for stdint.h
-configure:7138: gcc -c -g -O2  conftest.c >&5
-configure:7138: $? = 0
-configure:7138: result: yes
-configure:7138: checking for unistd.h
-configure:7138: gcc -c -g -O2  conftest.c >&5
-configure:7138: $? = 0
-configure:7138: result: yes
-configure:7153: checking for dlfcn.h
-configure:7153: gcc -c -g -O2  conftest.c >&5
-configure:7153: $? = 0
-configure:7153: result: yes
-configure:7278: checking for C++ compiler version
-configure:7287: g++ --version >&5
-g++ (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
-Copyright (C) 2011 Free Software Foundation, Inc.
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-configure:7298: $? = 0
-configure:7287: g++ -v >&5
-Using built-in specs.
-COLLECT_GCC=g++
-COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6.1/lto-wrapper
-Target: i686-linux-gnu
-Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
-Thread model: posix
-gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) 
-configure:7298: $? = 0
-configure:7287: g++ -V >&5
-g++: error: unrecognized option '-V'
-g++: fatal error: no input files
-compilation terminated.
-configure:7298: $? = 4
-configure:7287: g++ -qversion >&5
-g++: error: unrecognized option '-qversion'
-g++: fatal error: no input files
-compilation terminated.
-configure:7298: $? = 4
-configure:7302: checking whether we are using the GNU C++ compiler
-configure:7330: result: yes
-configure:7339: checking whether g++ accepts -g
-configure:7400: result: yes
-configure:7425: checking dependency style of g++
-configure:7535: result: gcc3
-configure:7558: checking how to run the C++ preprocessor
-configure:7585: g++ -E  conftest.cpp
-configure:7585: $? = 0
-configure:7599: g++ -E  conftest.cpp
-conftest.cpp:22:28: fatal error: ac_nonexistent.h: No such file or directory
-compilation terminated.
-configure:7599: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME "Google C++ Testing Framework"
-| #define PACKAGE_TARNAME "gtest"
-| #define PACKAGE_VERSION "1.6.0"
-| #define PACKAGE_STRING "Google C++ Testing Framework 1.6.0"
-| #define PACKAGE_BUGREPORT "googletestframework@googlegroups.com"
-| #define PACKAGE_URL ""
-| #define PACKAGE "gtest"
-| #define VERSION "1.6.0"
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| /* end confdefs.h.  */
-| #include <ac_nonexistent.h>
-configure:7624: result: g++ -E
-configure:7644: g++ -E  conftest.cpp
-configure:7644: $? = 0
-configure:7658: g++ -E  conftest.cpp
-conftest.cpp:22:28: fatal error: ac_nonexistent.h: No such file or directory
-compilation terminated.
-configure:7658: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME "Google C++ Testing Framework"
-| #define PACKAGE_TARNAME "gtest"
-| #define PACKAGE_VERSION "1.6.0"
-| #define PACKAGE_STRING "Google C++ Testing Framework 1.6.0"
-| #define PACKAGE_BUGREPORT "googletestframework@googlegroups.com"
-| #define PACKAGE_URL ""
-| #define PACKAGE "gtest"
-| #define VERSION "1.6.0"
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| /* end confdefs.h.  */
-| #include <ac_nonexistent.h>
-configure:7864: checking for objdir
-configure:7879: result: .libs
-configure:8175: checking if gcc supports -fno-rtti -fno-exceptions
-configure:8193: gcc -c -g -O2  -fno-rtti -fno-exceptions conftest.c >&5
-cc1: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C [enabled by default]
-configure:8197: $? = 0
-configure:8210: result: no
-configure:8230: checking for gcc option to produce PIC
-configure:8502: result: -fPIC -DPIC
-configure:8514: checking if gcc PIC flag -fPIC -DPIC works
-configure:8532: gcc -c -g -O2  -fPIC -DPIC -DPIC conftest.c >&5
-configure:8536: $? = 0
-configure:8549: result: yes
-configure:8573: checking if gcc static flag -static works
-configure:8601: result: yes
-configure:8616: checking if gcc supports -c -o file.o
-configure:8637: gcc -c -g -O2  -o out/conftest2.o conftest.c >&5
-configure:8641: $? = 0
-configure:8663: result: yes
-configure:8671: checking if gcc supports -c -o file.o
-configure:8718: result: yes
-configure:8751: checking whether the gcc linker (/usr/bin/ld) supports shared libraries
-configure:9742: result: yes
-configure:9779: checking whether -lc should be explicitly linked in
-configure:9784: gcc -c -g -O2  conftest.c >&5
-configure:9787: $? = 0
-configure:9802: gcc -shared conftest.o  -v -Wl,-soname -Wl,conftest -o conftest 2\>\&1 \| /bin/grep  -lc  \>/dev/null 2\>\&1
-configure:9805: $? = 0
-configure:9817: result: no
-configure:9981: checking dynamic linker characteristics
-configure:10414: gcc -o conftest -g -O2   -Wl,-rpath -Wl,/foo conftest.c  >&5
-configure:10414: $? = 0
-configure:10644: result: GNU/Linux ld.so
-configure:10746: checking how to hardcode library paths into programs
-configure:10771: result: immediate
-configure:11291: checking whether stripping libraries is possible
-configure:11296: result: yes
-configure:11331: checking if libtool supports shared libraries
-configure:11333: result: yes
-configure:11336: checking whether to build shared libraries
-configure:11357: result: yes
-configure:11360: checking whether to build static libraries
-configure:11364: result: yes
-configure:11514: checking for ld used by g++
-configure:11581: result: /usr/bin/ld
-configure:11588: checking if the linker (/usr/bin/ld) is GNU ld
-configure:11603: result: yes
-configure:11658: checking whether the g++ linker (/usr/bin/ld) supports shared libraries
-configure:12571: result: yes
-configure:12599: g++ -c -g -O2  conftest.cpp >&5
-configure:12602: $? = 0
-configure:12784: checking for g++ option to produce PIC
-configure:13101: result: -fPIC -DPIC
-configure:13110: checking if g++ PIC flag -fPIC -DPIC works
-configure:13128: g++ -c -g -O2  -fPIC -DPIC -DPIC conftest.cpp >&5
-configure:13132: $? = 0
-configure:13145: result: yes
-configure:13166: checking if g++ static flag -static works
-configure:13194: result: yes
-configure:13206: checking if g++ supports -c -o file.o
-configure:13227: g++ -c -g -O2  -o out/conftest2.o conftest.cpp >&5
-configure:13231: $? = 0
-configure:13253: result: yes
-configure:13258: checking if g++ supports -c -o file.o
-configure:13305: result: yes
-configure:13335: checking whether the g++ linker (/usr/bin/ld) supports shared libraries
-configure:13364: result: yes
-configure:13501: checking dynamic linker characteristics
-configure:13882: g++ -o conftest -g -O2   -Wl,-rpath -Wl,/foo conftest.cpp  >&5
-configure:13882: $? = 0
-configure:14112: result: GNU/Linux ld.so
-configure:14163: checking how to hardcode library paths into programs
-configure:14188: result: immediate
-configure:14255: checking for python
-configure:14273: found /usr/bin/python
-configure:14286: result: /usr/bin/python
-configure:14304: /usr/bin/python -c import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x minver = list(map(int, '2.3'.split('.'))) + [0, 0, 0] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] sys.exit(sys.hexversion < minverhex)
-configure:14307: $? = 0
-configure:14500: checking for the pthreads library -lpthreads
-configure:14533: gcc -o conftest -g -O2    conftest.c -lpthreads  >&5
-/usr/bin/ld: cannot find -lpthreads
-collect2: ld returned 1 exit status
-configure:14533: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME "Google C++ Testing Framework"
-| #define PACKAGE_TARNAME "gtest"
-| #define PACKAGE_VERSION "1.6.0"
-| #define PACKAGE_STRING "Google C++ Testing Framework 1.6.0"
-| #define PACKAGE_BUGREPORT "googletestframework@googlegroups.com"
-| #define PACKAGE_URL ""
-| #define PACKAGE "gtest"
-| #define VERSION "1.6.0"
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define LT_OBJDIR ".libs/"
-| /* end confdefs.h.  */
-| #include <pthread.h>
-| int
-| main ()
-| {
-| pthread_t th; pthread_join(th, 0);
-|                      pthread_attr_init(0); pthread_cleanup_push(0, 0);
-|                      pthread_create(0,0,0,0); pthread_cleanup_pop(0);
-|   ;
-|   return 0;
-| }
-configure:14542: result: no
-configure:14445: checking whether pthreads work without any flags
-configure:14533: gcc -o conftest -g -O2    conftest.c   >&5
-/tmp/ccEfzPYz.o: In function `main':
-/home/dahyeong/git_/osp/external/gtest/conftest.c:27: undefined reference to `pthread_join'
-/home/dahyeong/git_/osp/external/gtest/conftest.c:28: undefined reference to `__pthread_register_cancel'
-/home/dahyeong/git_/osp/external/gtest/conftest.c:29: undefined reference to `pthread_create'
-/home/dahyeong/git_/osp/external/gtest/conftest.c:29: undefined reference to `__pthread_unregister_cancel'
-collect2: ld returned 1 exit status
-configure:14533: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME "Google C++ Testing Framework"
-| #define PACKAGE_TARNAME "gtest"
-| #define PACKAGE_VERSION "1.6.0"
-| #define PACKAGE_STRING "Google C++ Testing Framework 1.6.0"
-| #define PACKAGE_BUGREPORT "googletestframework@googlegroups.com"
-| #define PACKAGE_URL ""
-| #define PACKAGE "gtest"
-| #define VERSION "1.6.0"
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define LT_OBJDIR ".libs/"
-| /* end confdefs.h.  */
-| #include <pthread.h>
-| int
-| main ()
-| {
-| pthread_t th; pthread_join(th, 0);
-|                      pthread_attr_init(0); pthread_cleanup_push(0, 0);
-|                      pthread_create(0,0,0,0); pthread_cleanup_pop(0);
-|   ;
-|   return 0;
-| }
-configure:14542: result: no
-configure:14450: checking whether pthreads work with -Kthread
-configure:14533: gcc -o conftest -g -O2 -Kthread   conftest.c   >&5
-gcc: error: unrecognized option '-Kthread'
-configure:14533: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME "Google C++ Testing Framework"
-| #define PACKAGE_TARNAME "gtest"
-| #define PACKAGE_VERSION "1.6.0"
-| #define PACKAGE_STRING "Google C++ Testing Framework 1.6.0"
-| #define PACKAGE_BUGREPORT "googletestframework@googlegroups.com"
-| #define PACKAGE_URL ""
-| #define PACKAGE "gtest"
-| #define VERSION "1.6.0"
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define LT_OBJDIR ".libs/"
-| /* end confdefs.h.  */
-| #include <pthread.h>
-| int
-| main ()
-| {
-| pthread_t th; pthread_join(th, 0);
-|                      pthread_attr_init(0); pthread_cleanup_push(0, 0);
-|                      pthread_create(0,0,0,0); pthread_cleanup_pop(0);
-|   ;
-|   return 0;
-| }
-configure:14542: result: no
-configure:14450: checking whether pthreads work with -kthread
-configure:14533: gcc -o conftest -g -O2 -kthread   conftest.c   >&5
-gcc: error: unrecognized option '-kthread'
-configure:14533: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME "Google C++ Testing Framework"
-| #define PACKAGE_TARNAME "gtest"
-| #define PACKAGE_VERSION "1.6.0"
-| #define PACKAGE_STRING "Google C++ Testing Framework 1.6.0"
-| #define PACKAGE_BUGREPORT "googletestframework@googlegroups.com"
-| #define PACKAGE_URL ""
-| #define PACKAGE "gtest"
-| #define VERSION "1.6.0"
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define LT_OBJDIR ".libs/"
-| /* end confdefs.h.  */
-| #include <pthread.h>
-| int
-| main ()
-| {
-| pthread_t th; pthread_join(th, 0);
-|                      pthread_attr_init(0); pthread_cleanup_push(0, 0);
-|                      pthread_create(0,0,0,0); pthread_cleanup_pop(0);
-|   ;
-|   return 0;
-| }
-configure:14542: result: no
-configure:14500: checking for the pthreads library -llthread
-configure:14533: gcc -o conftest -g -O2    conftest.c -llthread  >&5
-/usr/bin/ld: cannot find -llthread
-collect2: ld returned 1 exit status
-configure:14533: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME "Google C++ Testing Framework"
-| #define PACKAGE_TARNAME "gtest"
-| #define PACKAGE_VERSION "1.6.0"
-| #define PACKAGE_STRING "Google C++ Testing Framework 1.6.0"
-| #define PACKAGE_BUGREPORT "googletestframework@googlegroups.com"
-| #define PACKAGE_URL ""
-| #define PACKAGE "gtest"
-| #define VERSION "1.6.0"
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define LT_OBJDIR ".libs/"
-| /* end confdefs.h.  */
-| #include <pthread.h>
-| int
-| main ()
-| {
-| pthread_t th; pthread_join(th, 0);
-|                      pthread_attr_init(0); pthread_cleanup_push(0, 0);
-|                      pthread_create(0,0,0,0); pthread_cleanup_pop(0);
-|   ;
-|   return 0;
-| }
-configure:14542: result: no
-configure:14450: checking whether pthreads work with -pthread
-configure:14533: gcc -o conftest -g -O2 -pthread   conftest.c   >&5
-configure:14533: $? = 0
-configure:14542: result: yes
-configure:14561: checking for joinable pthread attribute
-configure:14576: gcc -o conftest -g -O2 -pthread   conftest.c   >&5
-configure:14576: $? = 0
-configure:14582: result: PTHREAD_CREATE_JOINABLE
-configure:14592: checking if more special flags are required for pthreads
-configure:14599: result: no
-configure:14688: checking whether to check for GCC pthread/shared inconsistencies
-configure:14701: gcc -o conftest -shared -fPIC -Wl,-z,defs -g -O2 -pthread   conftest.c   >&5
-configure:14701: $? = 0
-configure:14713: result: yes
-configure:14719: checking whether -pthread is sufficient with -shared
-configure:14734: gcc -o conftest -shared -fPIC -Wl,-z,defs -g -O2 -pthread   conftest.c   >&5
-configure:14734: $? = 0
-configure:14741: result: yes
-configure:15015: creating ./config.status
-
-## ---------------------- ##
-## Running config.status. ##
-## ---------------------- ##
-
-This file was extended by Google C++ Testing Framework config.status 1.6.0, which was
-generated by GNU Autoconf 2.65.  Invocation command line was
-
-  CONFIG_FILES    = 
-  CONFIG_HEADERS  = 
-  CONFIG_LINKS    = 
-  CONFIG_COMMANDS = 
-  $ ./config.status 
-
-on dahyeong-Samsung-DeskTop-System
-
-config.status:1135: creating Makefile
-config.status:1135: creating scripts/gtest-config
-config.status:1135: creating build-aux/config.h
-config.status:1307: build-aux/config.h is unchanged
-config.status:1355: executing depfiles commands
-config.status:1355: executing libtool commands
-
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-
-ac_cv_build=i686-pc-linux-gnu
-ac_cv_c_compiler_gnu=yes
-ac_cv_cxx_compiler_gnu=yes
-ac_cv_env_CCC_set=
-ac_cv_env_CCC_value=
-ac_cv_env_CC_set=
-ac_cv_env_CC_value=
-ac_cv_env_CFLAGS_set=
-ac_cv_env_CFLAGS_value=
-ac_cv_env_CPPFLAGS_set=
-ac_cv_env_CPPFLAGS_value=
-ac_cv_env_CPP_set=
-ac_cv_env_CPP_value=
-ac_cv_env_CXXCPP_set=
-ac_cv_env_CXXCPP_value=
-ac_cv_env_CXXFLAGS_set=
-ac_cv_env_CXXFLAGS_value=
-ac_cv_env_CXX_set=
-ac_cv_env_CXX_value=
-ac_cv_env_LDFLAGS_set=
-ac_cv_env_LDFLAGS_value=
-ac_cv_env_LIBS_set=
-ac_cv_env_LIBS_value=
-ac_cv_env_build_alias_set=
-ac_cv_env_build_alias_value=
-ac_cv_env_host_alias_set=
-ac_cv_env_host_alias_value=
-ac_cv_env_target_alias_set=
-ac_cv_env_target_alias_value=
-ac_cv_header_dlfcn_h=yes
-ac_cv_header_inttypes_h=yes
-ac_cv_header_memory_h=yes
-ac_cv_header_stdc=yes
-ac_cv_header_stdint_h=yes
-ac_cv_header_stdlib_h=yes
-ac_cv_header_string_h=yes
-ac_cv_header_strings_h=yes
-ac_cv_header_sys_stat_h=yes
-ac_cv_header_sys_types_h=yes
-ac_cv_header_unistd_h=yes
-ac_cv_host=i686-pc-linux-gnu
-ac_cv_objext=o
-ac_cv_path_EGREP='/bin/grep -E'
-ac_cv_path_FGREP='/bin/grep -F'
-ac_cv_path_GREP=/bin/grep
-ac_cv_path_PYTHON=/usr/bin/python
-ac_cv_path_SED=/bin/sed
-ac_cv_path_install='/usr/bin/install -c'
-ac_cv_path_mkdir=/bin/mkdir
-ac_cv_prog_AWK=mawk
-ac_cv_prog_CPP='gcc -E'
-ac_cv_prog_CXXCPP='g++ -E'
-ac_cv_prog_ac_ct_AR=ar
-ac_cv_prog_ac_ct_CC=gcc
-ac_cv_prog_ac_ct_CXX=g++
-ac_cv_prog_ac_ct_OBJDUMP=objdump
-ac_cv_prog_ac_ct_RANLIB=ranlib
-ac_cv_prog_ac_ct_STRIP=strip
-ac_cv_prog_cc_c89=
-ac_cv_prog_cc_g=yes
-ac_cv_prog_cxx_g=yes
-ac_cv_prog_make_make_set=yes
-am_cv_CC_dependencies_compiler_type=gcc3
-am_cv_CXX_dependencies_compiler_type=gcc3
-lt_cv_deplibs_check_method=pass_all
-lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_ld_reload_flag=-r
-lt_cv_nm_interface='BSD nm'
-lt_cv_objdir=.libs
-lt_cv_path_LD=/usr/bin/ld
-lt_cv_path_LDCXX=/usr/bin/ld
-lt_cv_path_NM='/usr/bin/nm -B'
-lt_cv_prog_compiler_c_o=yes
-lt_cv_prog_compiler_c_o_CXX=yes
-lt_cv_prog_compiler_pic_works=yes
-lt_cv_prog_compiler_pic_works_CXX=yes
-lt_cv_prog_compiler_rtti_exceptions=no
-lt_cv_prog_compiler_static_works=yes
-lt_cv_prog_compiler_static_works_CXX=yes
-lt_cv_prog_gnu_ld=yes
-lt_cv_prog_gnu_ldcxx=yes
-lt_cv_sys_global_symbol_pipe='sed -n -e '\''s/^.*[      ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[         ][      ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p'\'''
-lt_cv_sys_global_symbol_to_c_name_address='sed -n -e '\''s/^: \([^ ]*\) $/  {\"\1\", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \([^ ]*\)$/  {"\2", (void *) \&\2},/p'\'''
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='sed -n -e '\''s/^: \([^ ]*\) $/  {\"\1\", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \(lib[^ ]*\)$/  {"\2", (void *) \&\2},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \([^ ]*\)$/  {"lib\2", (void *) \&\2},/p'\'''
-lt_cv_sys_global_symbol_to_cdecl='sed -n -e '\''s/^T .* \(.*\)$/extern int \1();/p'\'' -e '\''s/^[ABCDGIRSTW]* .* \(.*\)$/extern char \1;/p'\'''
-lt_cv_sys_max_cmd_len=1572864
-
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-
-ACLOCAL='${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/missing --run aclocal-1.11'
-AMDEPBACKSLASH='\'
-AMDEP_FALSE='#'
-AMDEP_TRUE=''
-AMTAR='${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/missing --run tar'
-AR='ar'
-AUTOCONF='${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/missing --run autoconf'
-AUTOHEADER='${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/missing --run autoheader'
-AUTOMAKE='${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/missing --run automake-1.11'
-AWK='mawk'
-CC='gcc'
-CCDEPMODE='depmode=gcc3'
-CFLAGS='-g -O2'
-CPP='gcc -E'
-CPPFLAGS=''
-CXX='g++'
-CXXCPP='g++ -E'
-CXXDEPMODE='depmode=gcc3'
-CXXFLAGS='-g -O2'
-CYGPATH_W='echo'
-DEFS='-DHAVE_CONFIG_H'
-DEPDIR='.deps'
-DSYMUTIL=''
-DUMPBIN=''
-ECHO_C=''
-ECHO_N='-n'
-ECHO_T=''
-EGREP='/bin/grep -E'
-EXEEXT=''
-FGREP='/bin/grep -F'
-GREP='/bin/grep'
-HAVE_PTHREADS_FALSE='#'
-HAVE_PTHREADS_TRUE=''
-HAVE_PYTHON_FALSE='#'
-HAVE_PYTHON_TRUE=''
-INSTALL_DATA='${INSTALL} -m 644'
-INSTALL_PROGRAM='${INSTALL}'
-INSTALL_SCRIPT='${INSTALL}'
-INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
-LD='/usr/bin/ld'
-LDFLAGS=''
-LIBOBJS=''
-LIBS=''
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-LIPO=''
-LN_S='ln -s'
-LTLIBOBJS=''
-MAKEINFO='${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/missing --run makeinfo'
-MKDIR_P='/bin/mkdir -p'
-NM='/usr/bin/nm -B'
-NMEDIT=''
-OBJDUMP='objdump'
-OBJEXT='o'
-OTOOL64=''
-OTOOL=''
-PACKAGE='gtest'
-PACKAGE_BUGREPORT='googletestframework@googlegroups.com'
-PACKAGE_NAME='Google C++ Testing Framework'
-PACKAGE_STRING='Google C++ Testing Framework 1.6.0'
-PACKAGE_TARNAME='gtest'
-PACKAGE_URL=''
-PACKAGE_VERSION='1.6.0'
-PATH_SEPARATOR=':'
-PTHREAD_CC='gcc'
-PTHREAD_CFLAGS='-pthread'
-PTHREAD_LIBS=''
-PYTHON='/usr/bin/python'
-RANLIB='ranlib'
-SED='/bin/sed'
-SET_MAKE=''
-SHELL='/bin/bash'
-STRIP='strip'
-VERSION='1.6.0'
-ac_ct_CC='gcc'
-ac_ct_CXX='g++'
-ac_ct_DUMPBIN=''
-acx_pthread_config=''
-am__EXEEXT_FALSE=''
-am__EXEEXT_TRUE='#'
-am__fastdepCC_FALSE='#'
-am__fastdepCC_TRUE=''
-am__fastdepCXX_FALSE='#'
-am__fastdepCXX_TRUE=''
-am__include='include'
-am__isrc=''
-am__leading_dot='.'
-am__quote=''
-am__tar='${AMTAR} chof - "$$tardir"'
-am__untar='${AMTAR} xf -'
-bindir='${exec_prefix}/bin'
-build='i686-pc-linux-gnu'
-build_alias=''
-build_cpu='i686'
-build_os='linux-gnu'
-build_vendor='pc'
-datadir='${datarootdir}'
-datarootdir='${prefix}/share'
-docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
-dvidir='${docdir}'
-exec_prefix='${prefix}'
-host='i686-pc-linux-gnu'
-host_alias=''
-host_cpu='i686'
-host_os='linux-gnu'
-host_vendor='pc'
-htmldir='${docdir}'
-includedir='${prefix}/include'
-infodir='${datarootdir}/info'
-install_sh='${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/install-sh'
-libdir='${exec_prefix}/lib'
-libexecdir='${exec_prefix}/libexec'
-localedir='${datarootdir}/locale'
-localstatedir='${prefix}/var'
-lt_ECHO='echo'
-mandir='${datarootdir}/man'
-mkdir_p='/bin/mkdir -p'
-oldincludedir='/usr/include'
-pdfdir='${docdir}'
-prefix='/usr/local'
-program_transform_name='s,x,x,'
-psdir='${docdir}'
-sbindir='${exec_prefix}/sbin'
-sharedstatedir='${prefix}/com'
-sysconfdir='${prefix}/etc'
-target_alias=''
-
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-
-/* confdefs.h */
-#define PACKAGE_NAME "Google C++ Testing Framework"
-#define PACKAGE_TARNAME "gtest"
-#define PACKAGE_VERSION "1.6.0"
-#define PACKAGE_STRING "Google C++ Testing Framework 1.6.0"
-#define PACKAGE_BUGREPORT "googletestframework@googlegroups.com"
-#define PACKAGE_URL ""
-#define PACKAGE "gtest"
-#define VERSION "1.6.0"
-#define STDC_HEADERS 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_SYS_STAT_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STRING_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_UNISTD_H 1
-#define HAVE_DLFCN_H 1
-#define LT_OBJDIR ".libs/"
-#define HAVE_PTHREAD 1
-
-configure: exit 0
diff --git a/config.status b/config.status
deleted file mode 100755 (executable)
index 3969d28..0000000
+++ /dev/null
@@ -1,2265 +0,0 @@
-#! /bin/bash
-# Generated by configure.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-
-SHELL=${CONFIG_SHELL-/bin/bash}
-export SHELL
-## -------------------- ##
-## M4sh Initialization. ##
-## -------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in #(
-  *posix*) :
-    set -o posix ;; #(
-  *) :
-     ;;
-esac
-fi
-
-
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
-    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='print -r --'
-  as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='printf %s\n'
-  as_echo_n='printf %s'
-else
-  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
-    as_echo_n='/usr/ucb/echo -n'
-  else
-    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
-    as_echo_n_body='eval
-      arg=$1;
-      case $arg in #(
-      *"$as_nl"*)
-       expr "X$arg" : "X\\(.*\\)$as_nl";
-       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
-      esac;
-      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
-    '
-    export as_echo_n_body
-    as_echo_n='sh -c $as_echo_n_body as_echo'
-  fi
-  export as_echo_body
-  as_echo='sh -c $as_echo_body as_echo'
-fi
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  PATH_SEPARATOR=:
-  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
-    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
-      PATH_SEPARATOR=';'
-  }
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" ""       $as_nl"
-
-# Find who we are.  Look in the path if we contain no directory separator.
-case $0 in #((
-  *[\\/]* ) as_myself=$0 ;;
-  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-  done
-IFS=$as_save_IFS
-
-     ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
-  as_myself=$0
-fi
-if test ! -f "$as_myself"; then
-  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  exit 1
-fi
-
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there.  '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
-  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-
-# as_fn_error ERROR [LINENO LOG_FD]
-# ---------------------------------
-# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with status $?, using 1 if that was 0.
-as_fn_error ()
-{
-  as_status=$?; test $as_status -eq 0 && as_status=1
-  if test "$3"; then
-    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
-  fi
-  $as_echo "$as_me: error: $1" >&2
-  as_fn_exit $as_status
-} # as_fn_error
-
-
-# as_fn_set_status STATUS
-# -----------------------
-# Set $? to STATUS, without forking.
-as_fn_set_status ()
-{
-  return $1
-} # as_fn_set_status
-
-# as_fn_exit STATUS
-# -----------------
-# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
-as_fn_exit ()
-{
-  set +e
-  as_fn_set_status $1
-  exit $1
-} # as_fn_exit
-
-# as_fn_unset VAR
-# ---------------
-# Portably unset VAR.
-as_fn_unset ()
-{
-  { eval $1=; unset $1;}
-}
-as_unset=as_fn_unset
-# as_fn_append VAR VALUE
-# ----------------------
-# Append the text in VALUE to the end of the definition contained in VAR. Take
-# advantage of any shell optimizations that allow amortized linear growth over
-# repeated appends, instead of the typical quadratic growth present in naive
-# implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
-  eval 'as_fn_append ()
-  {
-    eval $1+=\$2
-  }'
-else
-  as_fn_append ()
-  {
-    eval $1=\$$1\$2
-  }
-fi # as_fn_append
-
-# as_fn_arith ARG...
-# ------------------
-# Perform arithmetic evaluation on the ARGs, and store the result in the
-# global $as_val. Take advantage of shells that can avoid forks. The arguments
-# must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
-  eval 'as_fn_arith ()
-  {
-    as_val=$(( $* ))
-  }'
-else
-  as_fn_arith ()
-  {
-    as_val=`expr "$@" || test $? -eq 1`
-  }
-fi # as_fn_arith
-
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in #(((((
--n*)
-  case `echo 'xy\c'` in
-  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
-  xy)  ECHO_C='\c';;
-  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
-       ECHO_T='        ';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
-  if ln -s conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s='ln -s'
-    # ... but there are two gotchas:
-    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
-    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
-  elif ln conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s=ln
-  else
-    as_ln_s='cp -p'
-  fi
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-
-# as_fn_mkdir_p
-# -------------
-# Create "$as_dir" as a directory, including parents if necessary.
-as_fn_mkdir_p ()
-{
-
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || eval $as_mkdir_p || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$as_dir" : 'X\(//\)[^/]' \| \
-        X"$as_dir" : 'X\(//\)$' \| \
-        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
-
-
-} # as_fn_mkdir_p
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p='mkdir -p "$as_dir"'
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
-
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-       test -d "$1/.";
-      else
-       case $1 in #(
-       -*)set "./$1";;
-       esac;
-       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-       ???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-exec 6>&1
-## ----------------------------------- ##
-## Main body of $CONFIG_STATUS script. ##
-## ----------------------------------- ##
-# Save the log message, to keep $0 and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.
-ac_log="
-This file was extended by Google C++ Testing Framework $as_me 1.6.0, which was
-generated by GNU Autoconf 2.65.  Invocation command line was
-
-  CONFIG_FILES    = $CONFIG_FILES
-  CONFIG_HEADERS  = $CONFIG_HEADERS
-  CONFIG_LINKS    = $CONFIG_LINKS
-  CONFIG_COMMANDS = $CONFIG_COMMANDS
-  $ $0 $@
-
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
-"
-
-# Files that config.status was made for.
-config_files=" Makefile scripts/gtest-config"
-config_headers=" build-aux/config.h"
-config_commands=" depfiles libtool"
-
-ac_cs_usage="\
-\`$as_me' instantiates files and other configuration actions
-from templates according to the current configuration.  Unless the files
-and actions are specified as TAGs, all are instantiated by default.
-
-Usage: $0 [OPTION]... [TAG]...
-
-  -h, --help       print this help, then exit
-  -V, --version    print version number and configuration settings, then exit
-      --config     print configuration, then exit
-  -q, --quiet, --silent
-                   do not print progress messages
-  -d, --debug      don't remove temporary files
-      --recheck    update $as_me by reconfiguring in the same conditions
-      --file=FILE[:TEMPLATE]
-                   instantiate the configuration file FILE
-      --header=FILE[:TEMPLATE]
-                   instantiate the configuration header FILE
-
-Configuration files:
-$config_files
-
-Configuration headers:
-$config_headers
-
-Configuration commands:
-$config_commands
-
-Report bugs to <googletestframework@googlegroups.com>."
-
-ac_cs_config=""
-ac_cs_version="\
-Google C++ Testing Framework config.status 1.6.0
-configured by ./configure, generated by GNU Autoconf 2.65,
-  with options \"$ac_cs_config\"
-
-Copyright (C) 2009 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-
-ac_pwd='/home/dahyeong/git_/osp/external/gtest'
-srcdir='.'
-INSTALL='/usr/bin/install -c'
-MKDIR_P='/bin/mkdir -p'
-AWK='mawk'
-test -n "$AWK" || AWK=awk
-# The default lists apply if the user does not specify any file.
-ac_need_defaults=:
-while test $# != 0
-do
-  case $1 in
-  --*=*)
-    ac_option=`expr "X$1" : 'X\([^=]*\)='`
-    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
-    ac_shift=:
-    ;;
-  *)
-    ac_option=$1
-    ac_optarg=$2
-    ac_shift=shift
-    ;;
-  esac
-
-  case $ac_option in
-  # Handling of the options.
-  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-    ac_cs_recheck=: ;;
-  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
-    $as_echo "$ac_cs_version"; exit ;;
-  --config | --confi | --conf | --con | --co | --c )
-    $as_echo "$ac_cs_config"; exit ;;
-  --debug | --debu | --deb | --de | --d | -d )
-    debug=: ;;
-  --file | --fil | --fi | --f )
-    $ac_shift
-    case $ac_optarg in
-    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    as_fn_append CONFIG_FILES " '$ac_optarg'"
-    ac_need_defaults=false;;
-  --header | --heade | --head | --hea )
-    $ac_shift
-    case $ac_optarg in
-    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
-    ac_need_defaults=false;;
-  --he | --h)
-    # Conflict between --help and --header
-    as_fn_error "ambiguous option: \`$1'
-Try \`$0 --help' for more information.";;
-  --help | --hel | -h )
-    $as_echo "$ac_cs_usage"; exit ;;
-  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-  | -silent | --silent | --silen | --sile | --sil | --si | --s)
-    ac_cs_silent=: ;;
-
-  # This is an error.
-  -*) as_fn_error "unrecognized option: \`$1'
-Try \`$0 --help' for more information." ;;
-
-  *) as_fn_append ac_config_targets " $1"
-     ac_need_defaults=false ;;
-
-  esac
-  shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
-  exec 6>/dev/null
-  ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-if $ac_cs_recheck; then
-  set X '/bin/bash' './configure'  $ac_configure_extra_args --no-create --no-recursion
-  shift
-  $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6
-  CONFIG_SHELL='/bin/bash'
-  export CONFIG_SHELL
-  exec "$@"
-fi
-
-exec 5>>config.log
-{
-  echo
-  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-  $as_echo "$ac_log"
-} >&5
-
-#
-# INIT-COMMANDS
-#
-AMDEP_TRUE="" ac_aux_dir="build-aux"
-
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-macro_version='2.2.6b'
-macro_revision='1.3017'
-enable_shared='yes'
-enable_static='yes'
-pic_mode='default'
-enable_fast_install='yes'
-host_alias=''
-host='i686-pc-linux-gnu'
-host_os='linux-gnu'
-build_alias=''
-build='i686-pc-linux-gnu'
-build_os='linux-gnu'
-SED='/bin/sed'
-Xsed='/bin/sed -e 1s/^X//'
-GREP='/bin/grep'
-EGREP='/bin/grep -E'
-FGREP='/bin/grep -F'
-LD='/usr/bin/ld'
-NM='/usr/bin/nm -B'
-LN_S='ln -s'
-max_cmd_len='1572864'
-ac_objext='o'
-exeext=''
-lt_unset='unset'
-lt_SP2NL='tr \040 \012'
-lt_NL2SP='tr \015\012 \040\040'
-reload_flag=' -r'
-reload_cmds='$LD$reload_flag -o $output$reload_objs'
-OBJDUMP='objdump'
-deplibs_check_method='pass_all'
-file_magic_cmd='$MAGIC_CMD'
-AR='ar'
-AR_FLAGS='cru'
-STRIP='strip'
-RANLIB='ranlib'
-old_postinstall_cmds='chmod 644 $oldlib~$RANLIB $oldlib'
-old_postuninstall_cmds=''
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs~$RANLIB $oldlib'
-CC='gcc'
-CFLAGS='-g -O2'
-compiler='g++'
-GCC='yes'
-lt_cv_sys_global_symbol_pipe='sed -n -e '\''s/^.*[      ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[         ][      ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p'\'''
-lt_cv_sys_global_symbol_to_cdecl='sed -n -e '\''s/^T .* \(.*\)$/extern int \1();/p'\'' -e '\''s/^[ABCDGIRSTW]* .* \(.*\)$/extern char \1;/p'\'''
-lt_cv_sys_global_symbol_to_c_name_address='sed -n -e '\''s/^: \([^ ]*\) $/  {\"\1\", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \([^ ]*\)$/  {"\2", (void *) \&\2},/p'\'''
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='sed -n -e '\''s/^: \([^ ]*\) $/  {\"\1\", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \(lib[^ ]*\)$/  {"\2", (void *) \&\2},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \([^ ]*\)$/  {"lib\2", (void *) \&\2},/p'\'''
-objdir='.libs'
-SHELL='/bin/bash'
-ECHO='echo'
-MAGIC_CMD='file'
-lt_prog_compiler_no_builtin_flag=' -fno-builtin'
-lt_prog_compiler_wl='-Wl,'
-lt_prog_compiler_pic=' -fPIC -DPIC'
-lt_prog_compiler_static='-static'
-lt_cv_prog_compiler_c_o='yes'
-need_locks='no'
-DSYMUTIL=''
-NMEDIT=''
-LIPO=''
-OTOOL=''
-OTOOL64=''
-libext='a'
-shrext_cmds='.so'
-extract_expsyms_cmds=''
-archive_cmds_need_lc='no'
-enable_shared_with_static_runtimes='no'
-export_dynamic_flag_spec='${wl}--export-dynamic'
-whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-compiler_needs_object='no'
-old_archive_from_new_cmds=''
-old_archive_from_expsyms_cmds=''
-archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
-           cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-           echo "local: *; };" >> $output_objdir/$libname.ver~
-           $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-module_cmds=''
-module_expsym_cmds=''
-with_gnu_ld='yes'
-allow_undefined_flag=''
-no_undefined_flag=''
-hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-hardcode_libdir_flag_spec_ld=''
-hardcode_libdir_separator=''
-hardcode_direct='no'
-hardcode_direct_absolute='no'
-hardcode_minus_L='no'
-hardcode_shlibpath_var='unsupported'
-hardcode_automatic='no'
-inherit_rpath='no'
-link_all_deplibs='no'
-fix_srcfile_path=''
-always_export_symbols='no'
-export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
-include_expsyms=''
-prelink_cmds=''
-file_list_spec=''
-variables_saved_for_relink='PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH'
-need_lib_prefix='no'
-need_version='no'
-version_type='linux'
-runpath_var='LD_RUN_PATH'
-shlibpath_var='LD_LIBRARY_PATH'
-shlibpath_overrides_runpath='no'
-libname_spec='lib$name'
-library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-soname_spec='${libname}${release}${shared_ext}$major'
-postinstall_cmds=''
-postuninstall_cmds=''
-finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-finish_eval=''
-hardcode_into_libs='yes'
-sys_lib_search_path_spec='/usr/lib/gcc/i686-linux-gnu/4.6.1 /usr/lib/i386-linux-gnu /usr/lib /lib/i386-linux-gnu /lib'
-sys_lib_dlsearch_path_spec='/lib /usr/lib /usr/lib/nvidia-current /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/local/lib /usr/lib/nvidia-settings '
-hardcode_action='immediate'
-enable_dlopen='unknown'
-enable_dlopen_self='unknown'
-enable_dlopen_self_static='unknown'
-old_striplib='strip --strip-debug'
-striplib='strip --strip-unneeded'
-compiler_lib_search_dirs=''
-predep_objects=''
-postdep_objects=''
-predeps=''
-postdeps=''
-compiler_lib_search_path=''
-LD_CXX='/usr/bin/ld'
-old_archive_cmds_CXX='$AR $AR_FLAGS $oldlib$oldobjs~$RANLIB $oldlib'
-compiler_CXX='g++'
-GCC_CXX='yes'
-lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
-lt_prog_compiler_wl_CXX='-Wl,'
-lt_prog_compiler_pic_CXX=' -fPIC -DPIC'
-lt_prog_compiler_static_CXX='-static'
-lt_cv_prog_compiler_c_o_CXX='yes'
-archive_cmds_need_lc_CXX='no'
-enable_shared_with_static_runtimes_CXX='no'
-export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
-whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-compiler_needs_object_CXX='no'
-old_archive_from_new_cmds_CXX=''
-old_archive_from_expsyms_cmds_CXX=''
-archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-module_cmds_CXX=''
-module_expsym_cmds_CXX=''
-with_gnu_ld_CXX='yes'
-allow_undefined_flag_CXX=''
-no_undefined_flag_CXX=''
-hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
-hardcode_libdir_flag_spec_ld_CXX=''
-hardcode_libdir_separator_CXX=''
-hardcode_direct_CXX='no'
-hardcode_direct_absolute_CXX='no'
-hardcode_minus_L_CXX='no'
-hardcode_shlibpath_var_CXX='unsupported'
-hardcode_automatic_CXX='no'
-inherit_rpath_CXX='no'
-link_all_deplibs_CXX='no'
-fix_srcfile_path_CXX=''
-always_export_symbols_CXX='no'
-export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
-include_expsyms_CXX=''
-prelink_cmds_CXX=''
-file_list_spec_CXX=''
-hardcode_action_CXX='immediate'
-compiler_lib_search_dirs_CXX='/usr/lib/gcc/i686-linux-gnu/4.6.1 /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../../lib /lib/i386-linux-gnu /lib/../lib /usr/lib/i386-linux-gnu /usr/lib/../lib /usr/lib/gcc/i686-linux-gnu/4.6.1/../../..'
-predep_objects_CXX='/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crti.o /usr/lib/gcc/i686-linux-gnu/4.6.1/crtbeginS.o'
-postdep_objects_CXX='/usr/lib/gcc/i686-linux-gnu/4.6.1/crtendS.o /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crtn.o'
-predeps_CXX=''
-postdeps_CXX='-lstdc++ -lm -lgcc_s -lc -lgcc_s'
-compiler_lib_search_path_CXX='-L/usr/lib/gcc/i686-linux-gnu/4.6.1 -L/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu -L/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../../lib -L/lib/i386-linux-gnu -L/lib/../lib -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/i686-linux-gnu/4.6.1/../../..'
-
-LTCC='gcc'
-LTCFLAGS='-g -O2'
-compiler='gcc'
-
-# Quote evaled strings.
-for var in SED GREP EGREP FGREP LD NM LN_S lt_SP2NL lt_NL2SP reload_flag OBJDUMP deplibs_check_method file_magic_cmd AR AR_FLAGS STRIP RANLIB CC CFLAGS compiler lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl lt_cv_sys_global_symbol_to_c_name_address lt_cv_sys_global_symbol_to_c_name_address_lib_prefix SHELL ECHO lt_prog_compiler_no_builtin_flag lt_prog_compiler_wl lt_prog_compiler_pic lt_prog_compiler_static lt_cv_prog_compiler_c_o need_locks DSYMUTIL NMEDIT LIPO OTOOL OTOOL64 shrext_cmds export_dynamic_flag_spec whole_archive_flag_spec compiler_needs_object with_gnu_ld allow_undefined_flag no_undefined_flag hardcode_libdir_flag_spec hardcode_libdir_flag_spec_ld hardcode_libdir_separator fix_srcfile_path exclude_expsyms include_expsyms file_list_spec variables_saved_for_relink libname_spec library_names_spec soname_spec finish_eval old_striplib striplib compiler_lib_search_dirs predep_objects postdep_objects predeps postdeps compiler_lib_search_path LD_CXX compiler_CXX lt_prog_compiler_no_builtin_flag_CXX lt_prog_compiler_wl_CXX lt_prog_compiler_pic_CXX lt_prog_compiler_static_CXX lt_cv_prog_compiler_c_o_CXX export_dynamic_flag_spec_CXX whole_archive_flag_spec_CXX compiler_needs_object_CXX with_gnu_ld_CXX allow_undefined_flag_CXX no_undefined_flag_CXX hardcode_libdir_flag_spec_CXX hardcode_libdir_flag_spec_ld_CXX hardcode_libdir_separator_CXX fix_srcfile_path_CXX exclude_expsyms_CXX include_expsyms_CXX file_list_spec_CXX compiler_lib_search_dirs_CXX predep_objects_CXX postdep_objects_CXX predeps_CXX postdeps_CXX compiler_lib_search_path_CXX; do
-    case `eval \\$ECHO "X\\$$var"` in
-    *[\\\`\"\$]*)
-      eval "lt_$var=\\\"\`\$ECHO \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
-      ;;
-    *)
-      eval "lt_$var=\\\"\$$var\\\""
-      ;;
-    esac
-done
-
-# Double-quote double-evaled strings.
-for var in reload_cmds old_postinstall_cmds old_postuninstall_cmds old_archive_cmds extract_expsyms_cmds old_archive_from_new_cmds old_archive_from_expsyms_cmds archive_cmds archive_expsym_cmds module_cmds module_expsym_cmds export_symbols_cmds prelink_cmds postinstall_cmds postuninstall_cmds finish_cmds sys_lib_search_path_spec sys_lib_dlsearch_path_spec old_archive_cmds_CXX old_archive_from_new_cmds_CXX old_archive_from_expsyms_cmds_CXX archive_cmds_CXX archive_expsym_cmds_CXX module_cmds_CXX module_expsym_cmds_CXX export_symbols_cmds_CXX prelink_cmds_CXX; do
-    case `eval \\$ECHO "X\\$$var"` in
-    *[\\\`\"\$]*)
-      eval "lt_$var=\\\"\`\$ECHO \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
-      ;;
-    *)
-      eval "lt_$var=\\\"\$$var\\\""
-      ;;
-    esac
-done
-
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case $lt_ECHO in
-*'\$0 --fallback-echo"')  lt_ECHO=`$ECHO "X$lt_ECHO" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
-  ;;
-esac
-
-ac_aux_dir='build-aux'
-xsi_shell='yes'
-lt_shell_append='yes'
-
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes INIT.
-if test -n "${ZSH_VERSION+set}" ; then
-   setopt NO_GLOB_SUBST
-fi
-
-
-    PACKAGE='gtest'
-    VERSION='1.6.0'
-    TIMESTAMP=''
-    RM='rm -f'
-    ofile='libtool'
-
-
-
-
-
-
-
-# Handling of arguments.
-for ac_config_target in $ac_config_targets
-do
-  case $ac_config_target in
-    "build-aux/config.h") CONFIG_HEADERS="$CONFIG_HEADERS build-aux/config.h" ;;
-    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "scripts/gtest-config") CONFIG_FILES="$CONFIG_FILES scripts/gtest-config" ;;
-    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
-    "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
-
-  *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
-  esac
-done
-
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used.  Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
-  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
-  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
-fi
-
-# Have a temporary directory for convenience.  Make it in the build tree
-# simply because there is no reason against having it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Hook for its removal unless debugging.
-# Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
-$debug ||
-{
-  tmp=
-  trap 'exit_status=$?
-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
-' 0
-  trap 'as_fn_exit 1' 1 2 13 15
-}
-# Create a (secure) tmp directory for tmp files.
-
-{
-  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -n "$tmp" && test -d "$tmp"
-}  ||
-{
-  tmp=./conf$$-$RANDOM
-  (umask 077 && mkdir "$tmp")
-} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
-
-# Set up the scripts for CONFIG_FILES section.
-# No need to generate them if there are no CONFIG_FILES.
-# This happens for instance with `./config.status config.h'.
-if test -n "$CONFIG_FILES"; then
-
-
-ac_cr=`echo X | tr X '\015'`
-# On cygwin, bash can eat \r inside `` if the user requested igncr.
-# But we know of no other shell where ac_cr would be empty at this
-# point, so we can use a bashism as a fallback.
-if test "x$ac_cr" = x; then
-  eval ac_cr=\$\'\\r\'
-fi
-ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
-if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
-  ac_cs_awk_cr='\r'
-else
-  ac_cs_awk_cr=$ac_cr
-fi
-
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
-cat >>"$tmp/subs1.awk" <<\_ACAWK &&
-S["am__EXEEXT_FALSE"]=""
-S["am__EXEEXT_TRUE"]="#"
-S["LTLIBOBJS"]=""
-S["LIBOBJS"]=""
-S["HAVE_PTHREADS_FALSE"]="#"
-S["HAVE_PTHREADS_TRUE"]=""
-S["PTHREAD_CFLAGS"]="-pthread"
-S["PTHREAD_LIBS"]=""
-S["PTHREAD_CC"]="gcc"
-S["acx_pthread_config"]=""
-S["HAVE_PYTHON_FALSE"]="#"
-S["HAVE_PYTHON_TRUE"]=""
-S["PYTHON"]="/usr/bin/python"
-S["CXXCPP"]="g++ -E"
-S["CPP"]="gcc -E"
-S["OTOOL64"]=""
-S["OTOOL"]=""
-S["LIPO"]=""
-S["NMEDIT"]=""
-S["DSYMUTIL"]=""
-S["lt_ECHO"]="echo"
-S["RANLIB"]="ranlib"
-S["AR"]="ar"
-S["OBJDUMP"]="objdump"
-S["LN_S"]="ln -s"
-S["NM"]="/usr/bin/nm -B"
-S["ac_ct_DUMPBIN"]=""
-S["DUMPBIN"]=""
-S["LD"]="/usr/bin/ld"
-S["FGREP"]="/bin/grep -F"
-S["EGREP"]="/bin/grep -E"
-S["GREP"]="/bin/grep"
-S["SED"]="/bin/sed"
-S["host_os"]="linux-gnu"
-S["host_vendor"]="pc"
-S["host_cpu"]="i686"
-S["host"]="i686-pc-linux-gnu"
-S["build_os"]="linux-gnu"
-S["build_vendor"]="pc"
-S["build_cpu"]="i686"
-S["build"]="i686-pc-linux-gnu"
-S["LIBTOOL"]="$(SHELL) $(top_builddir)/libtool"
-S["am__fastdepCXX_FALSE"]="#"
-S["am__fastdepCXX_TRUE"]=""
-S["CXXDEPMODE"]="depmode=gcc3"
-S["ac_ct_CXX"]="g++"
-S["CXXFLAGS"]="-g -O2"
-S["CXX"]="g++"
-S["am__fastdepCC_FALSE"]="#"
-S["am__fastdepCC_TRUE"]=""
-S["CCDEPMODE"]="depmode=gcc3"
-S["AMDEPBACKSLASH"]="\\"
-S["AMDEP_FALSE"]="#"
-S["AMDEP_TRUE"]=""
-S["am__quote"]=""
-S["am__include"]="include"
-S["DEPDIR"]=".deps"
-S["OBJEXT"]="o"
-S["EXEEXT"]=""
-S["ac_ct_CC"]="gcc"
-S["CPPFLAGS"]=""
-S["LDFLAGS"]=""
-S["CFLAGS"]="-g -O2"
-S["CC"]="gcc"
-S["am__untar"]="${AMTAR} xf -"
-S["am__tar"]="${AMTAR} chof - \"$$tardir\""
-S["AMTAR"]="${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/missing --run tar"
-S["am__leading_dot"]="."
-S["SET_MAKE"]=""
-S["AWK"]="mawk"
-S["mkdir_p"]="/bin/mkdir -p"
-S["MKDIR_P"]="/bin/mkdir -p"
-S["INSTALL_STRIP_PROGRAM"]="$(install_sh) -c -s"
-S["STRIP"]="strip"
-S["install_sh"]="${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/install-sh"
-S["MAKEINFO"]="${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/missing --run makeinfo"
-S["AUTOHEADER"]="${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/missing --run autoheader"
-S["AUTOMAKE"]="${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/missing --run automake-1.11"
-S["AUTOCONF"]="${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/missing --run autoconf"
-S["ACLOCAL"]="${SHELL} /home/dahyeong/git_/osp/external/gtest/build-aux/missing --run aclocal-1.11"
-S["VERSION"]="1.6.0"
-S["PACKAGE"]="gtest"
-S["CYGPATH_W"]="echo"
-S["am__isrc"]=""
-S["INSTALL_DATA"]="${INSTALL} -m 644"
-S["INSTALL_SCRIPT"]="${INSTALL}"
-S["INSTALL_PROGRAM"]="${INSTALL}"
-S["target_alias"]=""
-S["host_alias"]=""
-S["build_alias"]=""
-S["LIBS"]=""
-S["ECHO_T"]=""
-S["ECHO_N"]="-n"
-S["ECHO_C"]=""
-S["DEFS"]="-DHAVE_CONFIG_H"
-S["mandir"]="${datarootdir}/man"
-S["localedir"]="${datarootdir}/locale"
-S["libdir"]="${exec_prefix}/lib"
-S["psdir"]="${docdir}"
-S["pdfdir"]="${docdir}"
-S["dvidir"]="${docdir}"
-S["htmldir"]="${docdir}"
-S["infodir"]="${datarootdir}/info"
-S["docdir"]="${datarootdir}/doc/${PACKAGE_TARNAME}"
-S["oldincludedir"]="/usr/include"
-S["includedir"]="${prefix}/include"
-S["localstatedir"]="${prefix}/var"
-S["sharedstatedir"]="${prefix}/com"
-S["sysconfdir"]="${prefix}/etc"
-S["datadir"]="${datarootdir}"
-S["datarootdir"]="${prefix}/share"
-S["libexecdir"]="${exec_prefix}/libexec"
-S["sbindir"]="${exec_prefix}/sbin"
-S["bindir"]="${exec_prefix}/bin"
-S["program_transform_name"]="s,x,x,"
-S["prefix"]="/usr/local"
-S["exec_prefix"]="${prefix}"
-S["PACKAGE_URL"]=""
-S["PACKAGE_BUGREPORT"]="googletestframework@googlegroups.com"
-S["PACKAGE_STRING"]="Google C++ Testing Framework 1.6.0"
-S["PACKAGE_VERSION"]="1.6.0"
-S["PACKAGE_TARNAME"]="gtest"
-S["PACKAGE_NAME"]="Google C++ Testing Framework"
-S["PATH_SEPARATOR"]=":"
-S["SHELL"]="/bin/bash"
-_ACAWK
-cat >>"$tmp/subs1.awk" <<_ACAWK &&
-  for (key in S) S_is_set[key] = 1
-  FS = "\a"
-
-}
-{
-  line = $ 0
-  nfields = split(line, field, "@")
-  substed = 0
-  len = length(field[1])
-  for (i = 2; i < nfields; i++) {
-    key = field[i]
-    keylen = length(key)
-    if (S_is_set[key]) {
-      value = S[key]
-      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
-      len += length(value) + length(field[++i])
-      substed = 1
-    } else
-      len += 1 + keylen
-  }
-
-  print line
-}
-
-_ACAWK
-if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
-  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
-else
-  cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
-  || as_fn_error "could not setup config files machinery" "$LINENO" 5
-fi # test -n "$CONFIG_FILES"
-
-# Set up the scripts for CONFIG_HEADERS section.
-# No need to generate them if there are no CONFIG_HEADERS.
-# This happens for instance with `./config.status Makefile'.
-if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
-BEGIN {
-D["PACKAGE_NAME"]=" \"Google C++ Testing Framework\""
-D["PACKAGE_TARNAME"]=" \"gtest\""
-D["PACKAGE_VERSION"]=" \"1.6.0\""
-D["PACKAGE_STRING"]=" \"Google C++ Testing Framework 1.6.0\""
-D["PACKAGE_BUGREPORT"]=" \"googletestframework@googlegroups.com\""
-D["PACKAGE_URL"]=" \"\""
-D["PACKAGE"]=" \"gtest\""
-D["VERSION"]=" \"1.6.0\""
-D["STDC_HEADERS"]=" 1"
-D["HAVE_SYS_TYPES_H"]=" 1"
-D["HAVE_SYS_STAT_H"]=" 1"
-D["HAVE_STDLIB_H"]=" 1"
-D["HAVE_STRING_H"]=" 1"
-D["HAVE_MEMORY_H"]=" 1"
-D["HAVE_STRINGS_H"]=" 1"
-D["HAVE_INTTYPES_H"]=" 1"
-D["HAVE_STDINT_H"]=" 1"
-D["HAVE_UNISTD_H"]=" 1"
-D["HAVE_DLFCN_H"]=" 1"
-D["LT_OBJDIR"]=" \".libs/\""
-D["HAVE_PTHREAD"]=" 1"
-  for (key in D) D_is_set[key] = 1
-  FS = "\a"
-}
-/^[\t ]*#[\t ]*(define|undef)[\t ]+[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*([\t (]|$)/ {
-  line = $ 0
-  split(line, arg, " ")
-  if (arg[1] == "#") {
-    defundef = arg[2]
-    mac1 = arg[3]
-  } else {
-    defundef = substr(arg[1], 2)
-    mac1 = arg[2]
-  }
-  split(mac1, mac2, "(") #)
-  macro = mac2[1]
-  prefix = substr(line, 1, index(line, defundef) - 1)
-  if (D_is_set[macro]) {
-    # Preserve the white space surrounding the "#".
-    print prefix "define", macro P[macro] D[macro]
-    next
-  } else {
-    # Replace #undef with comments.  This is necessary, for example,
-    # in the case of _POSIX_SOURCE, which is predefined and required
-    # on some systems where configure will not decide to define it.
-    if (defundef == "undef") {
-      print "/*", prefix defundef, macro, "*/"
-      next
-    }
-  }
-}
-{ print }
-_ACAWK
-  as_fn_error "could not setup config headers machinery" "$LINENO" 5
-fi # test -n "$CONFIG_HEADERS"
-
-
-eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS"
-shift
-for ac_tag
-do
-  case $ac_tag in
-  :[FHLC]) ac_mode=$ac_tag; continue;;
-  esac
-  case $ac_mode$ac_tag in
-  :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
-  :[FH]-) ac_tag=-:-;;
-  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
-  esac
-  ac_save_IFS=$IFS
-  IFS=:
-  set x $ac_tag
-  IFS=$ac_save_IFS
-  shift
-  ac_file=$1
-  shift
-
-  case $ac_mode in
-  :L) ac_source=$1;;
-  :[FH])
-    ac_file_inputs=
-    for ac_f
-    do
-      case $ac_f in
-      -) ac_f="$tmp/stdin";;
-      *) # Look for the file first in the build tree, then in the source tree
-        # (if the path is not absolute).  The absolute path cannot be DOS-style,
-        # because $ac_f cannot contain `:'.
-        test -f "$ac_f" ||
-          case $ac_f in
-          [\\/$]*) false;;
-          *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
-          esac ||
-          as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
-      esac
-      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
-      as_fn_append ac_file_inputs " '$ac_f'"
-    done
-
-    # Let's still pretend it is `configure' which instantiates (i.e., don't
-    # use $as_me), people would be surprised to read:
-    #    /* config.h.  Generated by config.status.  */
-    configure_input='Generated from '`
-         $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
-       `' by configure.'
-    if test x"$ac_file" != x-; then
-      configure_input="$ac_file.  $configure_input"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
-$as_echo "$as_me: creating $ac_file" >&6;}
-    fi
-    # Neutralize special characters interpreted by sed in replacement strings.
-    case $configure_input in #(
-    *\&* | *\|* | *\\* )
-       ac_sed_conf_input=`$as_echo "$configure_input" |
-       sed 's/[\\\\&|]/\\\\&/g'`;; #(
-    *) ac_sed_conf_input=$configure_input;;
-    esac
-
-    case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin" \
-      || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
-    esac
-    ;;
-  esac
-
-  ac_dir=`$as_dirname -- "$ac_file" ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$ac_file" : 'X\(//\)[^/]' \| \
-        X"$ac_file" : 'X\(//\)$' \| \
-        X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-  as_dir="$ac_dir"; as_fn_mkdir_p
-  ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
-  .)  # We are building in place.
-    ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-
-  case $ac_mode in
-  :F)
-  #
-  # CONFIG_FILE
-  #
-
-  case $INSTALL in
-  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
-  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
-  esac
-  ac_MKDIR_P=$MKDIR_P
-  case $MKDIR_P in
-  [\\/$]* | ?:[\\/]* ) ;;
-  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
-  esac
-# If the template does not know about datarootdir, expand it.
-# FIXME: This hack should be removed a few years after 2.60.
-ac_datarootdir_hack=; ac_datarootdir_seen=
-ac_sed_dataroot='
-/datarootdir/ {
-  p
-  q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p'
-case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
-  ac_datarootdir_hack='
-  s&@datadir@&${datarootdir}&g
-  s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g
-  s&@infodir@&${datarootdir}/info&g
-  s&@localedir@&${datarootdir}/locale&g
-  s&@mandir@&${datarootdir}/man&g
-  s&\${datarootdir}&${prefix}/share&g' ;;
-esac
-ac_sed_extra="/^[       ]*VPATH[        ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[    ]*\):*/\1/
-s/:*$//
-s/^[^=]*=[      ]*$//
-}
-
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s|@configure_input@|$ac_sed_conf_input|;t t
-s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@top_build_prefix@&$ac_top_build_prefix&;t t
-s&@srcdir@&$ac_srcdir&;t t
-s&@abs_srcdir@&$ac_abs_srcdir&;t t
-s&@top_srcdir@&$ac_top_srcdir&;t t
-s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
-s&@builddir@&$ac_builddir&;t t
-s&@abs_builddir@&$ac_abs_builddir&;t t
-s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
-s&@INSTALL@&$ac_INSTALL&;t t
-s&@MKDIR_P@&$ac_MKDIR_P&;t t
-$ac_datarootdir_hack
-"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || as_fn_error "could not create $ac_file" "$LINENO" 5
-
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&5
-$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&2;}
-
-  rm -f "$tmp/stdin"
-  case $ac_file in
-  -) cat "$tmp/out" && rm -f "$tmp/out";;
-  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
-  esac \
-  || as_fn_error "could not create $ac_file" "$LINENO" 5
- ;;
-  :H)
-  #
-  # CONFIG_HEADER
-  #
-  if test x"$ac_file" != x-; then
-    {
-      $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
-    } >"$tmp/config.h" \
-      || as_fn_error "could not create $ac_file" "$LINENO" 5
-    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
-$as_echo "$as_me: $ac_file is unchanged" >&6;}
-    else
-      rm -f "$ac_file"
-      mv "$tmp/config.h" "$ac_file" \
-       || as_fn_error "could not create $ac_file" "$LINENO" 5
-    fi
-  else
-    $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
-      || as_fn_error "could not create -" "$LINENO" 5
-  fi
-# Compute "$ac_file"'s index in $config_headers.
-_am_arg="$ac_file"
-_am_stamp_count=1
-for _am_header in $config_headers :; do
-  case $_am_header in
-    $_am_arg | $_am_arg:* )
-      break ;;
-    * )
-      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
-  esac
-done
-echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
-$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$_am_arg" : 'X\(//\)[^/]' \| \
-        X"$_am_arg" : 'X\(//\)$' \| \
-        X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$_am_arg" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`/stamp-h$_am_stamp_count
- ;;
-
-  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
-$as_echo "$as_me: executing $ac_file commands" >&6;}
- ;;
-  esac
-
-
-  case $ac_file$ac_mode in
-    "scripts/gtest-config":F) chmod +x scripts/gtest-config ;;
-    "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
-  # are listed without --file.  Let's play safe and only enable the eval
-  # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
-  esac
-  shift
-  for mf
-  do
-    # Strip MF so we end up with the name of the file.
-    mf=`echo "$mf" | sed -e 's/:.*$//'`
-    # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named `Makefile.in', but
-    # some people rename them; so instead we look at the file content.
-    # Grep'ing the first line is not enough: some people post-process
-    # each Makefile.in and add a new line on top of each file to say so.
-    # Grep'ing the whole file is not good either: AIX grep has a line
-    # limit of 2048, but all sed's we know have understand at least 4000.
-    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-      dirpart=`$as_dirname -- "$mf" ||
-$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$mf" : 'X\(//\)[^/]' \| \
-        X"$mf" : 'X\(//\)$' \| \
-        X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$mf" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-    else
-      continue
-    fi
-    # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
-    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-    test -z "$DEPDIR" && continue
-    am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
-    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
-    # Find all dependency output files, they are included files with
-    # $(DEPDIR) in their names.  We invoke sed twice because it is the
-    # simplest approach to changing $(DEPDIR) to its actual value in the
-    # expansion.
-    for file in `sed -n "
-      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-      # Make sure the directory exists.
-      test -f "$dirpart/$file" && continue
-      fdir=`$as_dirname -- "$file" ||
-$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$file" : 'X\(//\)[^/]' \| \
-        X"$file" : 'X\(//\)$' \| \
-        X"$file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-      as_dir=$dirpart/$fdir; as_fn_mkdir_p
-      # echo "creating $dirpart/$file"
-      echo '# dummy' > "$dirpart/$file"
-    done
-  done
-}
- ;;
-    "libtool":C)
-
-    # See if we are running on zsh, and set the options which allow our
-    # commands through without removal of \ escapes.
-    if test -n "${ZSH_VERSION+set}" ; then
-      setopt NO_GLOB_SUBST
-    fi
-
-    cfgfile="${ofile}T"
-    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
-    $RM "$cfgfile"
-
-    cat <<_LT_EOF >> "$cfgfile"
-#! $SHELL
-
-# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
-# obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-
-# The names of the tagged configurations supported by this script.
-available_tags="CXX "
-
-# ### BEGIN LIBTOOL CONFIG
-
-# Which release of libtool.m4 was used?
-macro_version=$macro_version
-macro_revision=$macro_revision
-
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
-
-# Whether or not to build static libraries.
-build_old_libs=$enable_static
-
-# What type of objects to build.
-pic_mode=$pic_mode
-
-# Whether or not to optimize for fast installation.
-fast_install=$enable_fast_install
-
-# The host system.
-host_alias=$host_alias
-host=$host
-host_os=$host_os
-
-# The build system.
-build_alias=$build_alias
-build=$build
-build_os=$build_os
-
-# A sed program that does not truncate output.
-SED=$lt_SED
-
-# Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="\$SED -e 1s/^X//"
-
-# A grep program that handles long lines.
-GREP=$lt_GREP
-
-# An ERE matcher.
-EGREP=$lt_EGREP
-
-# A literal string matcher.
-FGREP=$lt_FGREP
-
-# A BSD- or MS-compatible name lister.
-NM=$lt_NM
-
-# Whether we need soft or hard links.
-LN_S=$lt_LN_S
-
-# What is the maximum length of a command?
-max_cmd_len=$max_cmd_len
-
-# Object file suffix (normally "o").
-objext=$ac_objext
-
-# Executable file suffix (normally "").
-exeext=$exeext
-
-# whether the shell understands "unset".
-lt_unset=$lt_unset
-
-# turn spaces into newlines.
-SP2NL=$lt_lt_SP2NL
-
-# turn newlines into spaces.
-NL2SP=$lt_lt_NL2SP
-
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
-
-# An object symbol dumper.
-OBJDUMP=$lt_OBJDUMP
-
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method=$lt_deplibs_check_method
-
-# Command to use when deplibs_check_method == "file_magic".
-file_magic_cmd=$lt_file_magic_cmd
-
-# The archiver.
-AR=$lt_AR
-AR_FLAGS=$lt_AR_FLAGS
-
-# A symbol stripping program.
-STRIP=$lt_STRIP
-
-# Commands used to install an old-style archive.
-RANLIB=$lt_RANLIB
-old_postinstall_cmds=$lt_old_postinstall_cmds
-old_postuninstall_cmds=$lt_old_postuninstall_cmds
-
-# A C compiler.
-LTCC=$lt_CC
-
-# LTCC compiler flags.
-LTCFLAGS=$lt_CFLAGS
-
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
-
-# Transform the output of nm in a proper C declaration.
-global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
-
-# Transform the output of nm in a C name address pair.
-global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
-
-# Transform the output of nm in a C name address pair when lib prefix is needed.
-global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
-
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
-
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
-
-# An echo program that does not interpret backslashes.
-ECHO=$lt_ECHO
-
-# Used to examine libraries when file_magic_cmd begins with "file".
-MAGIC_CMD=$MAGIC_CMD
-
-# Must we lock files when doing compilation?
-need_locks=$lt_need_locks
-
-# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
-DSYMUTIL=$lt_DSYMUTIL
-
-# Tool to change global to local symbols on Mac OS X.
-NMEDIT=$lt_NMEDIT
-
-# Tool to manipulate fat objects and archives on Mac OS X.
-LIPO=$lt_LIPO
-
-# ldd/readelf like tool for Mach-O binaries on Mac OS X.
-OTOOL=$lt_OTOOL
-
-# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
-OTOOL64=$lt_OTOOL64
-
-# Old archive suffix (normally "a").
-libext=$libext
-
-# Shared library suffix (normally ".so").
-shrext_cmds=$lt_shrext_cmds
-
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=$lt_extract_expsyms_cmds
-
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at link time.
-variables_saved_for_relink=$lt_variables_saved_for_relink
-
-# Do we need the "lib" prefix for modules?
-need_lib_prefix=$need_lib_prefix
-
-# Do we need a version for libraries?
-need_version=$need_version
-
-# Library versioning type.
-version_type=$version_type
-
-# Shared library runtime path variable.
-runpath_var=$runpath_var
-
-# Shared library path variable.
-shlibpath_var=$shlibpath_var
-
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=$shlibpath_overrides_runpath
-
-# Format of library name prefix.
-libname_spec=$lt_libname_spec
-
-# List of archive names.  First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME
-library_names_spec=$lt_library_names_spec
-
-# The coded name of the library, if different from the real name.
-soname_spec=$lt_soname_spec
-
-# Command to use after installation of a shared archive.
-postinstall_cmds=$lt_postinstall_cmds
-
-# Command to use after uninstallation of a shared archive.
-postuninstall_cmds=$lt_postuninstall_cmds
-
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds=$lt_finish_cmds
-
-# As "finish_cmds", except a single script fragment to be evaled but
-# not shown.
-finish_eval=$lt_finish_eval
-
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=$hardcode_into_libs
-
-# Compile-time system search path for libraries.
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
-
-# Run-time system search path for libraries.
-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
-
-# Whether dlopen is supported.
-dlopen_support=$enable_dlopen
-
-# Whether dlopen of programs is supported.
-dlopen_self=$enable_dlopen_self
-
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=$enable_dlopen_self_static
-
-# Commands to strip libraries.
-old_striplib=$lt_old_striplib
-striplib=$lt_striplib
-
-
-# The linker used to build libraries.
-LD=$lt_LD
-
-# Commands used to build an old-style archive.
-old_archive_cmds=$lt_old_archive_cmds
-
-# A language specific compiler.
-CC=$lt_compiler
-
-# Is the compiler the GNU compiler?
-with_gcc=$GCC
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
-
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl
-
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_lt_prog_compiler_static
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_lt_cv_prog_compiler_c_o
-
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$archive_cmds_need_lc
-
-# Whether or not to disallow shared libs when runtime libs are static.
-allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
-
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_whole_archive_flag_spec
-
-# Whether the compiler copes with passing no objects directly.
-compiler_needs_object=$lt_compiler_needs_object
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
-
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
-
-# Commands used to build a shared archive.
-archive_cmds=$lt_archive_cmds
-archive_expsym_cmds=$lt_archive_expsym_cmds
-
-# Commands used to build a loadable module if different from building
-# a shared archive.
-module_cmds=$lt_module_cmds
-module_expsym_cmds=$lt_module_expsym_cmds
-
-# Whether we are building with GNU ld or not.
-with_gnu_ld=$lt_with_gnu_ld
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_allow_undefined_flag
-
-# Flag that enforces no undefined symbols.
-no_undefined_flag=$lt_no_undefined_flag
-
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist
-hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
-
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
-
-# Whether we need a single "-rpath" flag with a separated argument.
-hardcode_libdir_separator=$lt_hardcode_libdir_separator
-
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
-# DIR into the resulting binary.
-hardcode_direct=$hardcode_direct
-
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
-# DIR into the resulting binary and the resulting library dependency is
-# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
-# library is relocated.
-hardcode_direct_absolute=$hardcode_direct_absolute
-
-# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
-# into the resulting binary.
-hardcode_minus_L=$hardcode_minus_L
-
-# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
-# into the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var
-
-# Set to "yes" if building a shared library automatically hardcodes DIR
-# into the library and all subsequent libraries and executables linked
-# against it.
-hardcode_automatic=$hardcode_automatic
-
-# Set to yes if linker adds runtime paths of dependent libraries
-# to runtime path list.
-inherit_rpath=$inherit_rpath
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$link_all_deplibs
-
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
-
-# Set to "yes" if exported symbols are required.
-always_export_symbols=$always_export_symbols
-
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_export_symbols_cmds
-
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_exclude_expsyms
-
-# Symbols that must always be exported.
-include_expsyms=$lt_include_expsyms
-
-# Commands necessary for linking programs (against libraries) with templates.
-prelink_cmds=$lt_prelink_cmds
-
-# Specify filename containing input files.
-file_list_spec=$lt_file_list_spec
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action
-
-# The directories searched by this compiler when creating a shared library.
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
-
-# Dependencies to place before and after the objects being linked to
-# create a shared library.
-predep_objects=$lt_predep_objects
-postdep_objects=$lt_postdep_objects
-predeps=$lt_predeps
-postdeps=$lt_postdeps
-
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path
-
-# ### END LIBTOOL CONFIG
-
-_LT_EOF
-
-  case $host_os in
-  aix3*)
-    cat <<\_LT_EOF >> "$cfgfile"
-# AIX sometimes has problems with the GCC collect2 program.  For some
-# reason, if we set the COLLECT_NAMES environment variable, the problems
-# vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
-  COLLECT_NAMES=
-  export COLLECT_NAMES
-fi
-_LT_EOF
-    ;;
-  esac
-
-
-ltmain="$ac_aux_dir/ltmain.sh"
-
-
-  # We use sed instead of cat because bash on DJGPP gets confused if
-  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
-  # text mode, it properly converts lines to CR/LF.  This bash problem
-  # is reportedly fixed, but why not run on old versions too?
-  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  case $xsi_shell in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result="${1##*/}"
-}
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-  func_basename_result="${1##*/}"
-}
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-func_stripname ()
-{
-  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-  # positional parameters, so assign one to ordinary parameter first.
-  func_stripname_result=${3}
-  func_stripname_result=${func_stripname_result#"${1}"}
-  func_stripname_result=${func_stripname_result%"${2}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=${1%%=*}
-  func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  case ${1} in
-    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-    *)    func_lo2o_result=${1} ;;
-  esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=$(( $* ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=${#1}
-}
-
-_LT_EOF
-    ;;
-  *) # Bourne compatible functions.
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
-
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-  case ${2} in
-    .*) func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
-    *)  func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
-  esac
-}
-
-# sed scripts:
-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
-my_sed_long_arg='1s/^-[^=]*=//'
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
-  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=`expr "$@"`
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
-}
-
-_LT_EOF
-esac
-
-case $lt_shell_append in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1+=\$2"
-}
-_LT_EOF
-    ;;
-  *)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1=\$$1\$2"
-}
-
-_LT_EOF
-    ;;
-  esac
-
-
-  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  mv -f "$cfgfile" "$ofile" ||
-    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
-  chmod +x "$ofile"
-
-
-    cat <<_LT_EOF >> "$ofile"
-
-# ### BEGIN LIBTOOL TAG CONFIG: CXX
-
-# The linker used to build libraries.
-LD=$lt_LD_CXX
-
-# Commands used to build an old-style archive.
-old_archive_cmds=$lt_old_archive_cmds_CXX
-
-# A language specific compiler.
-CC=$lt_compiler_CXX
-
-# Is the compiler the GNU compiler?
-with_gcc=$GCC_CXX
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
-
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl_CXX
-
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic_CXX
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_lt_prog_compiler_static_CXX
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
-
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$archive_cmds_need_lc_CXX
-
-# Whether or not to disallow shared libs when runtime libs are static.
-allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
-
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
-
-# Whether the compiler copes with passing no objects directly.
-compiler_needs_object=$lt_compiler_needs_object_CXX
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
-
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
-
-# Commands used to build a shared archive.
-archive_cmds=$lt_archive_cmds_CXX
-archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
-
-# Commands used to build a loadable module if different from building
-# a shared archive.
-module_cmds=$lt_module_cmds_CXX
-module_expsym_cmds=$lt_module_expsym_cmds_CXX
-
-# Whether we are building with GNU ld or not.
-with_gnu_ld=$lt_with_gnu_ld_CXX
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_allow_undefined_flag_CXX
-
-# Flag that enforces no undefined symbols.
-no_undefined_flag=$lt_no_undefined_flag_CXX
-
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist
-hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
-
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
-
-# Whether we need a single "-rpath" flag with a separated argument.
-hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
-
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
-# DIR into the resulting binary.
-hardcode_direct=$hardcode_direct_CXX
-
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
-# DIR into the resulting binary and the resulting library dependency is
-# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
-# library is relocated.
-hardcode_direct_absolute=$hardcode_direct_absolute_CXX
-
-# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
-# into the resulting binary.
-hardcode_minus_L=$hardcode_minus_L_CXX
-
-# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
-# into the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
-
-# Set to "yes" if building a shared library automatically hardcodes DIR
-# into the library and all subsequent libraries and executables linked
-# against it.
-hardcode_automatic=$hardcode_automatic_CXX
-
-# Set to yes if linker adds runtime paths of dependent libraries
-# to runtime path list.
-inherit_rpath=$inherit_rpath_CXX
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$link_all_deplibs_CXX
-
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path_CXX
-
-# Set to "yes" if exported symbols are required.
-always_export_symbols=$always_export_symbols_CXX
-
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_export_symbols_cmds_CXX
-
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_exclude_expsyms_CXX
-
-# Symbols that must always be exported.
-include_expsyms=$lt_include_expsyms_CXX
-
-# Commands necessary for linking programs (against libraries) with templates.
-prelink_cmds=$lt_prelink_cmds_CXX
-
-# Specify filename containing input files.
-file_list_spec=$lt_file_list_spec_CXX
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action_CXX
-
-# The directories searched by this compiler when creating a shared library.
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
-
-# Dependencies to place before and after the objects being linked to
-# create a shared library.
-predep_objects=$lt_predep_objects_CXX
-postdep_objects=$lt_postdep_objects_CXX
-predeps=$lt_predeps_CXX
-postdeps=$lt_postdeps_CXX
-
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
-
-# ### END LIBTOOL TAG CONFIG: CXX
-_LT_EOF
-
- ;;
-
-  esac
-done # for ac_tag
-
-
-as_fn_exit 0
index fa66029..4dda87c 100755 (executable)
@@ -5,7 +5,7 @@ m4_include(m4/acx_pthread.m4)
 # "[1.0.1]"). It also asumes that there won't be any closing parenthesis
 # between "AC_INIT(" and the closing ")" including comments and strings.
 AC_INIT([Google C++ Testing Framework],
-        [1.6.0],
+        [1.7.0],
         [googletestframework@googlegroups.com],
         [gtest])
 
@@ -55,7 +55,7 @@ AS_IF([test "x$with_pthreads" != "xno"],
                [AC_MSG_FAILURE(
                  [--with-pthreads was specified, but unable to be used])])])
        have_pthreads="$acx_pthread_ok"])
-AM_CONDITIONAL([HAVE_PTHREADS],[test "x$have_pthreads" == "xyes"])
+AM_CONDITIONAL([HAVE_PTHREADS],[test "x$have_pthreads" = "xyes"])
 AC_SUBST(PTHREAD_CFLAGS)
 AC_SUBST(PTHREAD_LIBS)
 
diff --git a/docs/AdvancedGuide.md b/docs/AdvancedGuide.md
new file mode 100755 (executable)
index 0000000..93a6520
--- /dev/null
@@ -0,0 +1,2182 @@
+
+
+Now that you have read [Primer](Primer.md) and learned how to write tests
+using Google Test, it's time to learn some new tricks. This document
+will show you more assertions as well as how to construct complex
+failure messages, propagate fatal failures, reuse and speed up your
+test fixtures, and use various flags with your tests.
+
+# More Assertions #
+
+This section covers some less frequently used, but still significant,
+assertions.
+
+## Explicit Success and Failure ##
+
+These three assertions do not actually test a value or expression. Instead,
+they generate a success or failure directly. Like the macros that actually
+perform a test, you may stream a custom failure message into the them.
+
+| `SUCCEED();` |
+|:-------------|
+
+Generates a success. This does NOT make the overall test succeed. A test is
+considered successful only if none of its assertions fail during its execution.
+
+Note: `SUCCEED()` is purely documentary and currently doesn't generate any
+user-visible output. However, we may add `SUCCEED()` messages to Google Test's
+output in the future.
+
+| `FAIL();`  | `ADD_FAILURE();` | `ADD_FAILURE_AT("`_file\_path_`", `_line\_number_`);` |
+|:-----------|:-----------------|:------------------------------------------------------|
+
+`FAIL()` generates a fatal failure, while `ADD_FAILURE()` and `ADD_FAILURE_AT()` generate a nonfatal
+failure. These are useful when control flow, rather than a Boolean expression,
+deteremines the test's success or failure. For example, you might want to write
+something like:
+
+```
+switch(expression) {
+  case 1: ... some checks ...
+  case 2: ... some other checks
+  ...
+  default: FAIL() << "We shouldn't get here.";
+}
+```
+
+Note: you can only use `FAIL()` in functions that return `void`. See the [Assertion Placement section](#assertion-placement) for more information.
+
+_Availability_: Linux, Windows, Mac.
+
+## Exception Assertions ##
+
+These are for verifying that a piece of code throws (or does not
+throw) an exception of the given type:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_THROW(`_statement_, _exception\_type_`);`  | `EXPECT_THROW(`_statement_, _exception\_type_`);`  | _statement_ throws an exception of the given type  |
+| `ASSERT_ANY_THROW(`_statement_`);`                | `EXPECT_ANY_THROW(`_statement_`);`                | _statement_ throws an exception of any type        |
+| `ASSERT_NO_THROW(`_statement_`);`                 | `EXPECT_NO_THROW(`_statement_`);`                 | _statement_ doesn't throw any exception            |
+
+Examples:
+
+```
+ASSERT_THROW(Foo(5), bar_exception);
+
+EXPECT_NO_THROW({
+  int n = 5;
+  Bar(&n);
+});
+```
+
+_Availability_: Linux, Windows, Mac; since version 1.1.0.
+
+## Predicate Assertions for Better Error Messages ##
+
+Even though Google Test has a rich set of assertions, they can never be
+complete, as it's impossible (nor a good idea) to anticipate all the scenarios
+a user might run into. Therefore, sometimes a user has to use `EXPECT_TRUE()`
+to check a complex expression, for lack of a better macro. This has the problem
+of not showing you the values of the parts of the expression, making it hard to
+understand what went wrong. As a workaround, some users choose to construct the
+failure message by themselves, streaming it into `EXPECT_TRUE()`. However, this
+is awkward especially when the expression has side-effects or is expensive to
+evaluate.
+
+Google Test gives you three different options to solve this problem:
+
+### Using an Existing Boolean Function ###
+
+If you already have a function or a functor that returns `bool` (or a type
+that can be implicitly converted to `bool`), you can use it in a _predicate
+assertion_ to get the function arguments printed for free:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_PRED1(`_pred1, val1_`);`       | `EXPECT_PRED1(`_pred1, val1_`);` | _pred1(val1)_ returns true |
+| `ASSERT_PRED2(`_pred2, val1, val2_`);` | `EXPECT_PRED2(`_pred2, val1, val2_`);` |  _pred2(val1, val2)_ returns true |
+|  ...                | ...                    | ...          |
+
+In the above, _predn_ is an _n_-ary predicate function or functor, where
+_val1_, _val2_, ..., and _valn_ are its arguments. The assertion succeeds
+if the predicate returns `true` when applied to the given arguments, and fails
+otherwise. When the assertion fails, it prints the value of each argument. In
+either case, the arguments are evaluated exactly once.
+
+Here's an example. Given
+
+```
+// Returns true iff m and n have no common divisors except 1.
+bool MutuallyPrime(int m, int n) { ... }
+const int a = 3;
+const int b = 4;
+const int c = 10;
+```
+
+the assertion `EXPECT_PRED2(MutuallyPrime, a, b);` will succeed, while the
+assertion `EXPECT_PRED2(MutuallyPrime, b, c);` will fail with the message
+
+<pre>
+!MutuallyPrime(b, c) is false, where<br>
+b is 4<br>
+c is 10<br>
+</pre>
+
+**Notes:**
+
+  1. If you see a compiler error "no matching function to call" when using `ASSERT_PRED*` or `EXPECT_PRED*`, please see [this FAQ](FAQ.md#the-compiler-complains-no-matching-function-to-call-when-i-use-assert_predn-how-do-i-fix-it) for how to resolve it.
+  1. Currently we only provide predicate assertions of arity <= 5. If you need a higher-arity assertion, let us know.
+
+_Availability_: Linux, Windows, Mac
+
+### Using a Function That Returns an AssertionResult ###
+
+While `EXPECT_PRED*()` and friends are handy for a quick job, the
+syntax is not satisfactory: you have to use different macros for
+different arities, and it feels more like Lisp than C++.  The
+`::testing::AssertionResult` class solves this problem.
+
+An `AssertionResult` object represents the result of an assertion
+(whether it's a success or a failure, and an associated message).  You
+can create an `AssertionResult` using one of these factory
+functions:
+
+```
+namespace testing {
+
+// Returns an AssertionResult object to indicate that an assertion has
+// succeeded.
+AssertionResult AssertionSuccess();
+
+// Returns an AssertionResult object to indicate that an assertion has
+// failed.
+AssertionResult AssertionFailure();
+
+}
+```
+
+You can then use the `<<` operator to stream messages to the
+`AssertionResult` object.
+
+To provide more readable messages in Boolean assertions
+(e.g. `EXPECT_TRUE()`), write a predicate function that returns
+`AssertionResult` instead of `bool`. For example, if you define
+`IsEven()` as:
+
+```
+::testing::AssertionResult IsEven(int n) {
+  if ((n % 2) == 0)
+    return ::testing::AssertionSuccess();
+  else
+    return ::testing::AssertionFailure() << n << " is odd";
+}
+```
+
+instead of:
+
+```
+bool IsEven(int n) {
+  return (n % 2) == 0;
+}
+```
+
+the failed assertion `EXPECT_TRUE(IsEven(Fib(4)))` will print:
+
+<pre>
+Value of: IsEven(Fib(4))<br>
+Actual: false (*3 is odd*)<br>
+Expected: true<br>
+</pre>
+
+instead of a more opaque
+
+<pre>
+Value of: IsEven(Fib(4))<br>
+Actual: false<br>
+Expected: true<br>
+</pre>
+
+If you want informative messages in `EXPECT_FALSE` and `ASSERT_FALSE`
+as well, and are fine with making the predicate slower in the success
+case, you can supply a success message:
+
+```
+::testing::AssertionResult IsEven(int n) {
+  if ((n % 2) == 0)
+    return ::testing::AssertionSuccess() << n << " is even";
+  else
+    return ::testing::AssertionFailure() << n << " is odd";
+}
+```
+
+Then the statement `EXPECT_FALSE(IsEven(Fib(6)))` will print
+
+<pre>
+Value of: IsEven(Fib(6))<br>
+Actual: true (8 is even)<br>
+Expected: false<br>
+</pre>
+
+_Availability_: Linux, Windows, Mac; since version 1.4.1.
+
+### Using a Predicate-Formatter ###
+
+If you find the default message generated by `(ASSERT|EXPECT)_PRED*` and
+`(ASSERT|EXPECT)_(TRUE|FALSE)` unsatisfactory, or some arguments to your
+predicate do not support streaming to `ostream`, you can instead use the
+following _predicate-formatter assertions_ to _fully_ customize how the
+message is formatted:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_PRED_FORMAT1(`_pred\_format1, val1_`);`        | `EXPECT_PRED_FORMAT1(`_pred\_format1, val1_`);` | _pred\_format1(val1)_ is successful |
+| `ASSERT_PRED_FORMAT2(`_pred\_format2, val1, val2_`);` | `EXPECT_PRED_FORMAT2(`_pred\_format2, val1, val2_`);` | _pred\_format2(val1, val2)_ is successful |
+| `...`               | `...`                  | `...`        |
+
+The difference between this and the previous two groups of macros is that instead of
+a predicate, `(ASSERT|EXPECT)_PRED_FORMAT*` take a _predicate-formatter_
+(_pred\_formatn_), which is a function or functor with the signature:
+
+`::testing::AssertionResult PredicateFormattern(const char* `_expr1_`, const char* `_expr2_`, ... const char* `_exprn_`, T1 `_val1_`, T2 `_val2_`, ... Tn `_valn_`);`
+
+where _val1_, _val2_, ..., and _valn_ are the values of the predicate
+arguments, and _expr1_, _expr2_, ..., and _exprn_ are the corresponding
+expressions as they appear in the source code. The types `T1`, `T2`, ..., and
+`Tn` can be either value types or reference types. For example, if an
+argument has type `Foo`, you can declare it as either `Foo` or `const Foo&`,
+whichever is appropriate.
+
+A predicate-formatter returns a `::testing::AssertionResult` object to indicate
+whether the assertion has succeeded or not. The only way to create such an
+object is to call one of these factory functions:
+
+As an example, let's improve the failure message in the previous example, which uses `EXPECT_PRED2()`:
+
+```
+// Returns the smallest prime common divisor of m and n,
+// or 1 when m and n are mutually prime.
+int SmallestPrimeCommonDivisor(int m, int n) { ... }
+
+// A predicate-formatter for asserting that two integers are mutually prime.
+::testing::AssertionResult AssertMutuallyPrime(const char* m_expr,
+                                               const char* n_expr,
+                                               int m,
+                                               int n) {
+  if (MutuallyPrime(m, n))
+    return ::testing::AssertionSuccess();
+
+  return ::testing::AssertionFailure()
+      << m_expr << " and " << n_expr << " (" << m << " and " << n
+      << ") are not mutually prime, " << "as they have a common divisor "
+      << SmallestPrimeCommonDivisor(m, n);
+}
+```
+
+With this predicate-formatter, we can use
+
+```
+EXPECT_PRED_FORMAT2(AssertMutuallyPrime, b, c);
+```
+
+to generate the message
+
+<pre>
+b and c (4 and 10) are not mutually prime, as they have a common divisor 2.<br>
+</pre>
+
+As you may have realized, many of the assertions we introduced earlier are
+special cases of `(EXPECT|ASSERT)_PRED_FORMAT*`. In fact, most of them are
+indeed defined using `(EXPECT|ASSERT)_PRED_FORMAT*`.
+
+_Availability_: Linux, Windows, Mac.
+
+
+## Floating-Point Comparison ##
+
+Comparing floating-point numbers is tricky. Due to round-off errors, it is
+very unlikely that two floating-points will match exactly. Therefore,
+`ASSERT_EQ` 's naive comparison usually doesn't work. And since floating-points
+can have a wide value range, no single fixed error bound works. It's better to
+compare by a fixed relative error bound, except for values close to 0 due to
+the loss of precision there.
+
+In general, for floating-point comparison to make sense, the user needs to
+carefully choose the error bound. If they don't want or care to, comparing in
+terms of Units in the Last Place (ULPs) is a good default, and Google Test
+provides assertions to do this. Full details about ULPs are quite long; if you
+want to learn more, see
+[this article on float comparison](http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm).
+
+### Floating-Point Macros ###
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_FLOAT_EQ(`_val1, val2_`);`  | `EXPECT_FLOAT_EQ(`_val1, val2_`);` | the two `float` values are almost equal |
+| `ASSERT_DOUBLE_EQ(`_val1, val2_`);` | `EXPECT_DOUBLE_EQ(`_val1, val2_`);` | the two `double` values are almost equal |
+
+By "almost equal", we mean the two values are within 4 ULP's from each
+other.
+
+The following assertions allow you to choose the acceptable error bound:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_NEAR(`_val1, val2, abs\_error_`);` | `EXPECT_NEAR`_(val1, val2, abs\_error_`);` | the difference between _val1_ and _val2_ doesn't exceed the given absolute error |
+
+_Availability_: Linux, Windows, Mac.
+
+### Floating-Point Predicate-Format Functions ###
+
+Some floating-point operations are useful, but not that often used. In order
+to avoid an explosion of new macros, we provide them as predicate-format
+functions that can be used in predicate assertion macros (e.g.
+`EXPECT_PRED_FORMAT2`, etc).
+
+```
+EXPECT_PRED_FORMAT2(::testing::FloatLE, val1, val2);
+EXPECT_PRED_FORMAT2(::testing::DoubleLE, val1, val2);
+```
+
+Verifies that _val1_ is less than, or almost equal to, _val2_. You can
+replace `EXPECT_PRED_FORMAT2` in the above table with `ASSERT_PRED_FORMAT2`.
+
+_Availability_: Linux, Windows, Mac.
+
+## Windows HRESULT assertions ##
+
+These assertions test for `HRESULT` success or failure.
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_HRESULT_SUCCEEDED(`_expression_`);` | `EXPECT_HRESULT_SUCCEEDED(`_expression_`);` | _expression_ is a success `HRESULT` |
+| `ASSERT_HRESULT_FAILED(`_expression_`);`    | `EXPECT_HRESULT_FAILED(`_expression_`);`    | _expression_ is a failure `HRESULT` |
+
+The generated output contains the human-readable error message
+associated with the `HRESULT` code returned by _expression_.
+
+You might use them like this:
+
+```
+CComPtr shell;
+ASSERT_HRESULT_SUCCEEDED(shell.CoCreateInstance(L"Shell.Application"));
+CComVariant empty;
+ASSERT_HRESULT_SUCCEEDED(shell->ShellExecute(CComBSTR(url), empty, empty, empty, empty));
+```
+
+_Availability_: Windows.
+
+## Type Assertions ##
+
+You can call the function
+```
+::testing::StaticAssertTypeEq<T1, T2>();
+```
+to assert that types `T1` and `T2` are the same.  The function does
+nothing if the assertion is satisfied.  If the types are different,
+the function call will fail to compile, and the compiler error message
+will likely (depending on the compiler) show you the actual values of
+`T1` and `T2`.  This is mainly useful inside template code.
+
+_Caveat:_ When used inside a member function of a class template or a
+function template, `StaticAssertTypeEq<T1, T2>()` is effective _only if_
+the function is instantiated.  For example, given:
+```
+template <typename T> class Foo {
+ public:
+  void Bar() { ::testing::StaticAssertTypeEq<int, T>(); }
+};
+```
+the code:
+```
+void Test1() { Foo<bool> foo; }
+```
+will _not_ generate a compiler error, as `Foo<bool>::Bar()` is never
+actually instantiated.  Instead, you need:
+```
+void Test2() { Foo<bool> foo; foo.Bar(); }
+```
+to cause a compiler error.
+
+_Availability:_ Linux, Windows, Mac; since version 1.3.0.
+
+## Assertion Placement ##
+
+You can use assertions in any C++ function. In particular, it doesn't
+have to be a method of the test fixture class. The one constraint is
+that assertions that generate a fatal failure (`FAIL*` and `ASSERT_*`)
+can only be used in void-returning functions. This is a consequence of
+Google Test not using exceptions. By placing it in a non-void function
+you'll get a confusing compile error like
+`"error: void value not ignored as it ought to be"`.
+
+If you need to use assertions in a function that returns non-void, one option
+is to make the function return the value in an out parameter instead. For
+example, you can rewrite `T2 Foo(T1 x)` to `void Foo(T1 x, T2* result)`. You
+need to make sure that `*result` contains some sensible value even when the
+function returns prematurely. As the function now returns `void`, you can use
+any assertion inside of it.
+
+If changing the function's type is not an option, you should just use
+assertions that generate non-fatal failures, such as `ADD_FAILURE*` and
+`EXPECT_*`.
+
+_Note_: Constructors and destructors are not considered void-returning
+functions, according to the C++ language specification, and so you may not use
+fatal assertions in them. You'll get a compilation error if you try. A simple
+workaround is to transfer the entire body of the constructor or destructor to a
+private void-returning method. However, you should be aware that a fatal
+assertion failure in a constructor does not terminate the current test, as your
+intuition might suggest; it merely returns from the constructor early, possibly
+leaving your object in a partially-constructed state. Likewise, a fatal
+assertion failure in a destructor may leave your object in a
+partially-destructed state. Use assertions carefully in these situations!
+
+# Teaching Google Test How to Print Your Values #
+
+When a test assertion such as `EXPECT_EQ` fails, Google Test prints the
+argument values to help you debug.  It does this using a
+user-extensible value printer.
+
+This printer knows how to print built-in C++ types, native arrays, STL
+containers, and any type that supports the `<<` operator.  For other
+types, it prints the raw bytes in the value and hopes that you the
+user can figure it out.
+
+As mentioned earlier, the printer is _extensible_.  That means
+you can teach it to do a better job at printing your particular type
+than to dump the bytes.  To do that, define `<<` for your type:
+
+```
+#include <iostream>
+
+namespace foo {
+
+class Bar { ... };  // We want Google Test to be able to print instances of this.
+
+// It's important that the << operator is defined in the SAME
+// namespace that defines Bar.  C++'s look-up rules rely on that.
+::std::ostream& operator<<(::std::ostream& os, const Bar& bar) {
+  return os << bar.DebugString();  // whatever needed to print bar to os
+}
+
+}  // namespace foo
+```
+
+Sometimes, this might not be an option: your team may consider it bad
+style to have a `<<` operator for `Bar`, or `Bar` may already have a
+`<<` operator that doesn't do what you want (and you cannot change
+it).  If so, you can instead define a `PrintTo()` function like this:
+
+```
+#include <iostream>
+
+namespace foo {
+
+class Bar { ... };
+
+// It's important that PrintTo() is defined in the SAME
+// namespace that defines Bar.  C++'s look-up rules rely on that.
+void PrintTo(const Bar& bar, ::std::ostream* os) {
+  *os << bar.DebugString();  // whatever needed to print bar to os
+}
+
+}  // namespace foo
+```
+
+If you have defined both `<<` and `PrintTo()`, the latter will be used
+when Google Test is concerned.  This allows you to customize how the value
+appears in Google Test's output without affecting code that relies on the
+behavior of its `<<` operator.
+
+If you want to print a value `x` using Google Test's value printer
+yourself, just call `::testing::PrintToString(`_x_`)`, which
+returns an `std::string`:
+
+```
+vector<pair<Bar, int> > bar_ints = GetBarIntVector();
+
+EXPECT_TRUE(IsCorrectBarIntVector(bar_ints))
+    << "bar_ints = " << ::testing::PrintToString(bar_ints);
+```
+
+# Death Tests #
+
+In many applications, there are assertions that can cause application failure
+if a condition is not met. These sanity checks, which ensure that the program
+is in a known good state, are there to fail at the earliest possible time after
+some program state is corrupted. If the assertion checks the wrong condition,
+then the program may proceed in an erroneous state, which could lead to memory
+corruption, security holes, or worse. Hence it is vitally important to test
+that such assertion statements work as expected.
+
+Since these precondition checks cause the processes to die, we call such tests
+_death tests_. More generally, any test that checks that a program terminates
+(except by throwing an exception) in an expected fashion is also a death test.
+
+Note that if a piece of code throws an exception, we don't consider it "death"
+for the purpose of death tests, as the caller of the code could catch the exception
+and avoid the crash. If you want to verify exceptions thrown by your code,
+see [Exception Assertions](#exception-assertions).
+
+If you want to test `EXPECT_*()/ASSERT_*()` failures in your test code, see [Catching Failures](#catching-failures).
+
+## How to Write a Death Test ##
+
+Google Test has the following macros to support death tests:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_DEATH(`_statement, regex_`);` | `EXPECT_DEATH(`_statement, regex_`);` | _statement_ crashes with the given error |
+| `ASSERT_DEATH_IF_SUPPORTED(`_statement, regex_`);` | `EXPECT_DEATH_IF_SUPPORTED(`_statement, regex_`);` | if death tests are supported, verifies that _statement_ crashes with the given error; otherwise verifies nothing |
+| `ASSERT_EXIT(`_statement, predicate, regex_`);` | `EXPECT_EXIT(`_statement, predicate, regex_`);` |_statement_ exits with the given error and its exit code matches _predicate_ |
+
+where _statement_ is a statement that is expected to cause the process to
+die, _predicate_ is a function or function object that evaluates an integer
+exit status, and _regex_ is a regular expression that the stderr output of
+_statement_ is expected to match. Note that _statement_ can be _any valid
+statement_ (including _compound statement_) and doesn't have to be an
+expression.
+
+As usual, the `ASSERT` variants abort the current test function, while the
+`EXPECT` variants do not.
+
+**Note:** We use the word "crash" here to mean that the process
+terminates with a _non-zero_ exit status code.  There are two
+possibilities: either the process has called `exit()` or `_exit()`
+with a non-zero value, or it may be killed by a signal.
+
+This means that if _statement_ terminates the process with a 0 exit
+code, it is _not_ considered a crash by `EXPECT_DEATH`.  Use
+`EXPECT_EXIT` instead if this is the case, or if you want to restrict
+the exit code more precisely.
+
+A predicate here must accept an `int` and return a `bool`. The death test
+succeeds only if the predicate returns `true`. Google Test defines a few
+predicates that handle the most common cases:
+
+```
+::testing::ExitedWithCode(exit_code)
+```
+
+This expression is `true` if the program exited normally with the given exit
+code.
+
+```
+::testing::KilledBySignal(signal_number)  // Not available on Windows.
+```
+
+This expression is `true` if the program was killed by the given signal.
+
+The `*_DEATH` macros are convenient wrappers for `*_EXIT` that use a predicate
+that verifies the process' exit code is non-zero.
+
+Note that a death test only cares about three things:
+
+  1. does _statement_ abort or exit the process?
+  1. (in the case of `ASSERT_EXIT` and `EXPECT_EXIT`) does the exit status satisfy _predicate_?  Or (in the case of `ASSERT_DEATH` and `EXPECT_DEATH`) is the exit status non-zero?  And
+  1. does the stderr output match _regex_?
+
+In particular, if _statement_ generates an `ASSERT_*` or `EXPECT_*` failure, it will **not** cause the death test to fail, as Google Test assertions don't abort the process.
+
+To write a death test, simply use one of the above macros inside your test
+function. For example,
+
+```
+TEST(MyDeathTest, Foo) {
+  // This death test uses a compound statement.
+  ASSERT_DEATH({ int n = 5; Foo(&n); }, "Error on line .* of Foo()");
+}
+TEST(MyDeathTest, NormalExit) {
+  EXPECT_EXIT(NormalExit(), ::testing::ExitedWithCode(0), "Success");
+}
+TEST(MyDeathTest, KillMyself) {
+  EXPECT_EXIT(KillMyself(), ::testing::KilledBySignal(SIGKILL), "Sending myself unblockable signal");
+}
+```
+
+verifies that:
+
+  * calling `Foo(5)` causes the process to die with the given error message,
+  * calling `NormalExit()` causes the process to print `"Success"` to stderr and exit with exit code 0, and
+  * calling `KillMyself()` kills the process with signal `SIGKILL`.
+
+The test function body may contain other assertions and statements as well, if
+necessary.
+
+_Important:_ We strongly recommend you to follow the convention of naming your
+test case (not test) `*DeathTest` when it contains a death test, as
+demonstrated in the above example. The `Death Tests And Threads` section below
+explains why.
+
+If a test fixture class is shared by normal tests and death tests, you
+can use typedef to introduce an alias for the fixture class and avoid
+duplicating its code:
+```
+class FooTest : public ::testing::Test { ... };
+
+typedef FooTest FooDeathTest;
+
+TEST_F(FooTest, DoesThis) {
+  // normal test
+}
+
+TEST_F(FooDeathTest, DoesThat) {
+  // death test
+}
+```
+
+_Availability:_ Linux, Windows (requires MSVC 8.0 or above), Cygwin, and Mac (the latter three are supported since v1.3.0).  `(ASSERT|EXPECT)_DEATH_IF_SUPPORTED` are new in v1.4.0.
+
+## Regular Expression Syntax ##
+
+On POSIX systems (e.g. Linux, Cygwin, and Mac), Google Test uses the
+[POSIX extended regular expression](http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04)
+syntax in death tests. To learn about this syntax, you may want to read this [Wikipedia entry](http://en.wikipedia.org/wiki/Regular_expression#POSIX_Extended_Regular_Expressions).
+
+On Windows, Google Test uses its own simple regular expression
+implementation. It lacks many features you can find in POSIX extended
+regular expressions.  For example, we don't support union (`"x|y"`),
+grouping (`"(xy)"`), brackets (`"[xy]"`), and repetition count
+(`"x{5,7}"`), among others. Below is what we do support (Letter `A` denotes a
+literal character, period (`.`), or a single `\\` escape sequence; `x`
+and `y` denote regular expressions.):
+
+| `c` | matches any literal character `c` |
+|:----|:----------------------------------|
+| `\\d` | matches any decimal digit         |
+| `\\D` | matches any character that's not a decimal digit |
+| `\\f` | matches `\f`                      |
+| `\\n` | matches `\n`                      |
+| `\\r` | matches `\r`                      |
+| `\\s` | matches any ASCII whitespace, including `\n` |
+| `\\S` | matches any character that's not a whitespace |
+| `\\t` | matches `\t`                      |
+| `\\v` | matches `\v`                      |
+| `\\w` | matches any letter, `_`, or decimal digit |
+| `\\W` | matches any character that `\\w` doesn't match |
+| `\\c` | matches any literal character `c`, which must be a punctuation |
+| `\\.` | matches the `.` character         |
+| `.` | matches any single character except `\n` |
+| `A?` | matches 0 or 1 occurrences of `A` |
+| `A*` | matches 0 or many occurrences of `A` |
+| `A+` | matches 1 or many occurrences of `A` |
+| `^` | matches the beginning of a string (not that of each line) |
+| `$` | matches the end of a string (not that of each line) |
+| `xy` | matches `x` followed by `y`       |
+
+To help you determine which capability is available on your system,
+Google Test defines macro `GTEST_USES_POSIX_RE=1` when it uses POSIX
+extended regular expressions, or `GTEST_USES_SIMPLE_RE=1` when it uses
+the simple version.  If you want your death tests to work in both
+cases, you can either `#if` on these macros or use the more limited
+syntax only.
+
+## How It Works ##
+
+Under the hood, `ASSERT_EXIT()` spawns a new process and executes the
+death test statement in that process. The details of of how precisely
+that happens depend on the platform and the variable
+`::testing::GTEST_FLAG(death_test_style)` (which is initialized from the
+command-line flag `--gtest_death_test_style`).
+
+  * On POSIX systems, `fork()` (or `clone()` on Linux) is used to spawn the child, after which:
+    * If the variable's value is `"fast"`, the death test statement is immediately executed.
+    * If the variable's value is `"threadsafe"`, the child process re-executes the unit test binary just as it was originally invoked, but with some extra flags to cause just the single death test under consideration to be run.
+  * On Windows, the child is spawned using the `CreateProcess()` API, and re-executes the binary to cause just the single death test under consideration to be run - much like the `threadsafe` mode on POSIX.
+
+Other values for the variable are illegal and will cause the death test to
+fail. Currently, the flag's default value is `"fast"`. However, we reserve the
+right to change it in the future. Therefore, your tests should not depend on
+this.
+
+In either case, the parent process waits for the child process to complete, and checks that
+
+  1. the child's exit status satisfies the predicate, and
+  1. the child's stderr matches the regular expression.
+
+If the death test statement runs to completion without dying, the child
+process will nonetheless terminate, and the assertion fails.
+
+## Death Tests And Threads ##
+
+The reason for the two death test styles has to do with thread safety. Due to
+well-known problems with forking in the presence of threads, death tests should
+be run in a single-threaded context. Sometimes, however, it isn't feasible to
+arrange that kind of environment. For example, statically-initialized modules
+may start threads before main is ever reached. Once threads have been created,
+it may be difficult or impossible to clean them up.
+
+Google Test has three features intended to raise awareness of threading issues.
+
+  1. A warning is emitted if multiple threads are running when a death test is encountered.
+  1. Test cases with a name ending in "DeathTest" are run before all other tests.
+  1. It uses `clone()` instead of `fork()` to spawn the child process on Linux (`clone()` is not available on Cygwin and Mac), as `fork()` is more likely to cause the child to hang when the parent process has multiple threads.
+
+It's perfectly fine to create threads inside a death test statement; they are
+executed in a separate process and cannot affect the parent.
+
+## Death Test Styles ##
+
+The "threadsafe" death test style was introduced in order to help mitigate the
+risks of testing in a possibly multithreaded environment. It trades increased
+test execution time (potentially dramatically so) for improved thread safety.
+We suggest using the faster, default "fast" style unless your test has specific
+problems with it.
+
+You can choose a particular style of death tests by setting the flag
+programmatically:
+
+```
+::testing::FLAGS_gtest_death_test_style = "threadsafe";
+```
+
+You can do this in `main()` to set the style for all death tests in the
+binary, or in individual tests. Recall that flags are saved before running each
+test and restored afterwards, so you need not do that yourself. For example:
+
+```
+TEST(MyDeathTest, TestOne) {
+  ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+  // This test is run in the "threadsafe" style:
+  ASSERT_DEATH(ThisShouldDie(), "");
+}
+
+TEST(MyDeathTest, TestTwo) {
+  // This test is run in the "fast" style:
+  ASSERT_DEATH(ThisShouldDie(), "");
+}
+
+int main(int argc, char** argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  ::testing::FLAGS_gtest_death_test_style = "fast";
+  return RUN_ALL_TESTS();
+}
+```
+
+## Caveats ##
+
+The _statement_ argument of `ASSERT_EXIT()` can be any valid C++ statement.
+If it leaves the current function via a `return` statement or by throwing an exception,
+the death test is considered to have failed.  Some Google Test macros may return
+from the current function (e.g. `ASSERT_TRUE()`), so be sure to avoid them in _statement_.
+
+Since _statement_ runs in the child process, any in-memory side effect (e.g.
+modifying a variable, releasing memory, etc) it causes will _not_ be observable
+in the parent process. In particular, if you release memory in a death test,
+your program will fail the heap check as the parent process will never see the
+memory reclaimed. To solve this problem, you can
+
+  1. try not to free memory in a death test;
+  1. free the memory again in the parent process; or
+  1. do not use the heap checker in your program.
+
+Due to an implementation detail, you cannot place multiple death test
+assertions on the same line; otherwise, compilation will fail with an unobvious
+error message.
+
+Despite the improved thread safety afforded by the "threadsafe" style of death
+test, thread problems such as deadlock are still possible in the presence of
+handlers registered with `pthread_atfork(3)`.
+
+# Using Assertions in Sub-routines #
+
+## Adding Traces to Assertions ##
+
+If a test sub-routine is called from several places, when an assertion
+inside it fails, it can be hard to tell which invocation of the
+sub-routine the failure is from.  You can alleviate this problem using
+extra logging or custom failure messages, but that usually clutters up
+your tests. A better solution is to use the `SCOPED_TRACE` macro:
+
+| `SCOPED_TRACE(`_message_`);` |
+|:-----------------------------|
+
+where _message_ can be anything streamable to `std::ostream`. This
+macro will cause the current file name, line number, and the given
+message to be added in every failure message. The effect will be
+undone when the control leaves the current lexical scope.
+
+For example,
+
+```
+10: void Sub1(int n) {
+11:   EXPECT_EQ(1, Bar(n));
+12:   EXPECT_EQ(2, Bar(n + 1));
+13: }
+14:
+15: TEST(FooTest, Bar) {
+16:   {
+17:     SCOPED_TRACE("A");  // This trace point will be included in
+18:                         // every failure in this scope.
+19:     Sub1(1);
+20:   }
+21:   // Now it won't.
+22:   Sub1(9);
+23: }
+```
+
+could result in messages like these:
+
+```
+path/to/foo_test.cc:11: Failure
+Value of: Bar(n)
+Expected: 1
+  Actual: 2
+   Trace:
+path/to/foo_test.cc:17: A
+
+path/to/foo_test.cc:12: Failure
+Value of: Bar(n + 1)
+Expected: 2
+  Actual: 3
+```
+
+Without the trace, it would've been difficult to know which invocation
+of `Sub1()` the two failures come from respectively. (You could add an
+extra message to each assertion in `Sub1()` to indicate the value of
+`n`, but that's tedious.)
+
+Some tips on using `SCOPED_TRACE`:
+
+  1. With a suitable message, it's often enough to use `SCOPED_TRACE` at the beginning of a sub-routine, instead of at each call site.
+  1. When calling sub-routines inside a loop, make the loop iterator part of the message in `SCOPED_TRACE` such that you can know which iteration the failure is from.
+  1. Sometimes the line number of the trace point is enough for identifying the particular invocation of a sub-routine. In this case, you don't have to choose a unique message for `SCOPED_TRACE`. You can simply use `""`.
+  1. You can use `SCOPED_TRACE` in an inner scope when there is one in the outer scope. In this case, all active trace points will be included in the failure messages, in reverse order they are encountered.
+  1. The trace dump is clickable in Emacs' compilation buffer - hit return on a line number and you'll be taken to that line in the source file!
+
+_Availability:_ Linux, Windows, Mac.
+
+## Propagating Fatal Failures ##
+
+A common pitfall when using `ASSERT_*` and `FAIL*` is not understanding that
+when they fail they only abort the _current function_, not the entire test. For
+example, the following test will segfault:
+```
+void Subroutine() {
+  // Generates a fatal failure and aborts the current function.
+  ASSERT_EQ(1, 2);
+  // The following won't be executed.
+  ...
+}
+
+TEST(FooTest, Bar) {
+  Subroutine();
+  // The intended behavior is for the fatal failure
+  // in Subroutine() to abort the entire test.
+  // The actual behavior: the function goes on after Subroutine() returns.
+  int* p = NULL;
+  *p = 3; // Segfault!
+}
+```
+
+Since we don't use exceptions, it is technically impossible to
+implement the intended behavior here.  To alleviate this, Google Test
+provides two solutions.  You could use either the
+`(ASSERT|EXPECT)_NO_FATAL_FAILURE` assertions or the
+`HasFatalFailure()` function.  They are described in the following two
+subsections.
+
+### Asserting on Subroutines ###
+
+As shown above, if your test calls a subroutine that has an `ASSERT_*`
+failure in it, the test will continue after the subroutine
+returns. This may not be what you want.
+
+Often people want fatal failures to propagate like exceptions.  For
+that Google Test offers the following macros:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_NO_FATAL_FAILURE(`_statement_`);` | `EXPECT_NO_FATAL_FAILURE(`_statement_`);` | _statement_ doesn't generate any new fatal failures in the current thread. |
+
+Only failures in the thread that executes the assertion are checked to
+determine the result of this type of assertions.  If _statement_
+creates new threads, failures in these threads are ignored.
+
+Examples:
+
+```
+ASSERT_NO_FATAL_FAILURE(Foo());
+
+int i;
+EXPECT_NO_FATAL_FAILURE({
+  i = Bar();
+});
+```
+
+_Availability:_ Linux, Windows, Mac. Assertions from multiple threads
+are currently not supported.
+
+### Checking for Failures in the Current Test ###
+
+`HasFatalFailure()` in the `::testing::Test` class returns `true` if an
+assertion in the current test has suffered a fatal failure. This
+allows functions to catch fatal failures in a sub-routine and return
+early.
+
+```
+class Test {
+ public:
+  ...
+  static bool HasFatalFailure();
+};
+```
+
+The typical usage, which basically simulates the behavior of a thrown
+exception, is:
+
+```
+TEST(FooTest, Bar) {
+  Subroutine();
+  // Aborts if Subroutine() had a fatal failure.
+  if (HasFatalFailure())
+    return;
+  // The following won't be executed.
+  ...
+}
+```
+
+If `HasFatalFailure()` is used outside of `TEST()` , `TEST_F()` , or a test
+fixture, you must add the `::testing::Test::` prefix, as in:
+
+```
+if (::testing::Test::HasFatalFailure())
+  return;
+```
+
+Similarly, `HasNonfatalFailure()` returns `true` if the current test
+has at least one non-fatal failure, and `HasFailure()` returns `true`
+if the current test has at least one failure of either kind.
+
+_Availability:_ Linux, Windows, Mac.  `HasNonfatalFailure()` and
+`HasFailure()` are available since version 1.4.0.
+
+# Logging Additional Information #
+
+In your test code, you can call `RecordProperty("key", value)` to log
+additional information, where `value` can be either a string or an `int`. The _last_ value recorded for a key will be emitted to the XML output
+if you specify one. For example, the test
+
+```
+TEST_F(WidgetUsageTest, MinAndMaxWidgets) {
+  RecordProperty("MaximumWidgets", ComputeMaxUsage());
+  RecordProperty("MinimumWidgets", ComputeMinUsage());
+}
+```
+
+will output XML like this:
+
+```
+...
+  <testcase name="MinAndMaxWidgets" status="run" time="6" classname="WidgetUsageTest"
+            MaximumWidgets="12"
+            MinimumWidgets="9" />
+...
+```
+
+_Note_:
+  * `RecordProperty()` is a static member of the `Test` class. Therefore it needs to be prefixed with `::testing::Test::` if used outside of the `TEST` body and the test fixture class.
+  * `key` must be a valid XML attribute name, and cannot conflict with the ones already used by Google Test (`name`, `status`, `time`, `classname`, `type_param`, and `value_param`).
+  * Calling `RecordProperty()` outside of the lifespan of a test is allowed. If it's called outside of a test but between a test case's `SetUpTestCase()` and `TearDownTestCase()` methods, it will be attributed to the XML element for the test case. If it's called outside of all test cases (e.g. in a test environment), it will be attributed to the top-level XML element.
+
+_Availability_: Linux, Windows, Mac.
+
+# Sharing Resources Between Tests in the Same Test Case #
+
+
+
+Google Test creates a new test fixture object for each test in order to make
+tests independent and easier to debug. However, sometimes tests use resources
+that are expensive to set up, making the one-copy-per-test model prohibitively
+expensive.
+
+If the tests don't change the resource, there's no harm in them sharing a
+single resource copy. So, in addition to per-test set-up/tear-down, Google Test
+also supports per-test-case set-up/tear-down. To use it:
+
+  1. In your test fixture class (say `FooTest` ), define as `static` some member variables to hold the shared resources.
+  1. In the same test fixture class, define a `static void SetUpTestCase()` function (remember not to spell it as **`SetupTestCase`** with a small `u`!) to set up the shared resources and a `static void TearDownTestCase()` function to tear them down.
+
+That's it! Google Test automatically calls `SetUpTestCase()` before running the
+_first test_ in the `FooTest` test case (i.e. before creating the first
+`FooTest` object), and calls `TearDownTestCase()` after running the _last test_
+in it (i.e. after deleting the last `FooTest` object). In between, the tests
+can use the shared resources.
+
+Remember that the test order is undefined, so your code can't depend on a test
+preceding or following another. Also, the tests must either not modify the
+state of any shared resource, or, if they do modify the state, they must
+restore the state to its original value before passing control to the next
+test.
+
+Here's an example of per-test-case set-up and tear-down:
+```
+class FooTest : public ::testing::Test {
+ protected:
+  // Per-test-case set-up.
+  // Called before the first test in this test case.
+  // Can be omitted if not needed.
+  static void SetUpTestCase() {
+    shared_resource_ = new ...;
+  }
+
+  // Per-test-case tear-down.
+  // Called after the last test in this test case.
+  // Can be omitted if not needed.
+  static void TearDownTestCase() {
+    delete shared_resource_;
+    shared_resource_ = NULL;
+  }
+
+  // You can define per-test set-up and tear-down logic as usual.
+  virtual void SetUp() { ... }
+  virtual void TearDown() { ... }
+
+  // Some expensive resource shared by all tests.
+  static T* shared_resource_;
+};
+
+T* FooTest::shared_resource_ = NULL;
+
+TEST_F(FooTest, Test1) {
+  ... you can refer to shared_resource here ...
+}
+TEST_F(FooTest, Test2) {
+  ... you can refer to shared_resource here ...
+}
+```
+
+_Availability:_ Linux, Windows, Mac.
+
+# Global Set-Up and Tear-Down #
+
+Just as you can do set-up and tear-down at the test level and the test case
+level, you can also do it at the test program level. Here's how.
+
+First, you subclass the `::testing::Environment` class to define a test
+environment, which knows how to set-up and tear-down:
+
+```
+class Environment {
+ public:
+  virtual ~Environment() {}
+  // Override this to define how to set up the environment.
+  virtual void SetUp() {}
+  // Override this to define how to tear down the environment.
+  virtual void TearDown() {}
+};
+```
+
+Then, you register an instance of your environment class with Google Test by
+calling the `::testing::AddGlobalTestEnvironment()` function:
+
+```
+Environment* AddGlobalTestEnvironment(Environment* env);
+```
+
+Now, when `RUN_ALL_TESTS()` is called, it first calls the `SetUp()` method of
+the environment object, then runs the tests if there was no fatal failures, and
+finally calls `TearDown()` of the environment object.
+
+It's OK to register multiple environment objects. In this case, their `SetUp()`
+will be called in the order they are registered, and their `TearDown()` will be
+called in the reverse order.
+
+Note that Google Test takes ownership of the registered environment objects.
+Therefore **do not delete them** by yourself.
+
+You should call `AddGlobalTestEnvironment()` before `RUN_ALL_TESTS()` is
+called, probably in `main()`. If you use `gtest_main`, you need to      call
+this before `main()` starts for it to take effect. One way to do this is to
+define a global variable like this:
+
+```
+::testing::Environment* const foo_env = ::testing::AddGlobalTestEnvironment(new FooEnvironment);
+```
+
+However, we strongly recommend you to write your own `main()` and call
+`AddGlobalTestEnvironment()` there, as relying on initialization of global
+variables makes the code harder to read and may cause problems when you
+register multiple environments from different translation units and the
+environments have dependencies among them (remember that the compiler doesn't
+guarantee the order in which global variables from different translation units
+are initialized).
+
+_Availability:_ Linux, Windows, Mac.
+
+
+# Value Parameterized Tests #
+
+_Value-parameterized tests_ allow you to test your code with different
+parameters without writing multiple copies of the same test.
+
+Suppose you write a test for your code and then realize that your code is affected by a presence of a Boolean command line flag.
+
+```
+TEST(MyCodeTest, TestFoo) {
+  // A code to test foo().
+}
+```
+
+Usually people factor their test code into a function with a Boolean parameter in such situations. The function sets the flag, then executes the testing code.
+
+```
+void TestFooHelper(bool flag_value) {
+  flag = flag_value;
+  // A code to test foo().
+}
+
+TEST(MyCodeTest, TestFoo) {
+  TestFooHelper(false);
+  TestFooHelper(true);
+}
+```
+
+But this setup has serious drawbacks. First, when a test assertion fails in your tests, it becomes unclear what value of the parameter caused it to fail. You can stream a clarifying message into your `EXPECT`/`ASSERT` statements, but it you'll have to do it with all of them. Second, you have to add one such helper function per test. What if you have ten tests? Twenty? A hundred?
+
+Value-parameterized tests will let you write your test only once and then easily instantiate and run it with an arbitrary number of parameter values.
+
+Here are some other situations when value-parameterized tests come handy:
+
+  * You want to test different implementations of an OO interface.
+  * You want to test your code over various inputs (a.k.a. data-driven testing). This feature is easy to abuse, so please exercise your good sense when doing it!
+
+## How to Write Value-Parameterized Tests ##
+
+To write value-parameterized tests, first you should define a fixture
+class.  It must be derived from both `::testing::Test` and
+`::testing::WithParamInterface<T>` (the latter is a pure interface),
+where `T` is the type of your parameter values.  For convenience, you
+can just derive the fixture class from `::testing::TestWithParam<T>`,
+which itself is derived from both `::testing::Test` and
+`::testing::WithParamInterface<T>`. `T` can be any copyable type. If
+it's a raw pointer, you are responsible for managing the lifespan of
+the pointed values.
+
+```
+class FooTest : public ::testing::TestWithParam<const char*> {
+  // You can implement all the usual fixture class members here.
+  // To access the test parameter, call GetParam() from class
+  // TestWithParam<T>.
+};
+
+// Or, when you want to add parameters to a pre-existing fixture class:
+class BaseTest : public ::testing::Test {
+  ...
+};
+class BarTest : public BaseTest,
+                public ::testing::WithParamInterface<const char*> {
+  ...
+};
+```
+
+Then, use the `TEST_P` macro to define as many test patterns using
+this fixture as you want.  The `_P` suffix is for "parameterized" or
+"pattern", whichever you prefer to think.
+
+```
+TEST_P(FooTest, DoesBlah) {
+  // Inside a test, access the test parameter with the GetParam() method
+  // of the TestWithParam<T> class:
+  EXPECT_TRUE(foo.Blah(GetParam()));
+  ...
+}
+
+TEST_P(FooTest, HasBlahBlah) {
+  ...
+}
+```
+
+Finally, you can use `INSTANTIATE_TEST_CASE_P` to instantiate the test
+case with any set of parameters you want. Google Test defines a number of
+functions for generating test parameters. They return what we call
+(surprise!) _parameter generators_. Here is a summary of them,
+which are all in the `testing` namespace:
+
+| `Range(begin, end[, step])` | Yields values `{begin, begin+step, begin+step+step, ...}`. The values do not include `end`. `step` defaults to 1. |
+|:----------------------------|:------------------------------------------------------------------------------------------------------------------|
+| `Values(v1, v2, ..., vN)`   | Yields values `{v1, v2, ..., vN}`.                                                                                |
+| `ValuesIn(container)` and `ValuesIn(begin, end)` | Yields values from a C-style array, an STL-style container, or an iterator range `[begin, end)`. `container`, `begin`, and `end` can be expressions whose values are determined at run time.  |
+| `Bool()`                    | Yields sequence `{false, true}`.                                                                                  |
+| `Combine(g1, g2, ..., gN)`  | Yields all combinations (the Cartesian product for the math savvy) of the values generated by the `N` generators. This is only available if your system provides the `<tr1/tuple>` header. If you are sure your system does, and Google Test disagrees, you can override it by defining `GTEST_HAS_TR1_TUPLE=1`. See comments in [include/gtest/internal/gtest-port.h](../include/gtest/internal/gtest-port.h) for more information. |
+
+For more details, see the comments at the definitions of these functions in the [source code](../include/gtest/gtest-param-test.h).
+
+The following statement will instantiate tests from the `FooTest` test case
+each with parameter values `"meeny"`, `"miny"`, and `"moe"`.
+
+```
+INSTANTIATE_TEST_CASE_P(InstantiationName,
+                        FooTest,
+                        ::testing::Values("meeny", "miny", "moe"));
+```
+
+To distinguish different instances of the pattern (yes, you can
+instantiate it more than once), the first argument to
+`INSTANTIATE_TEST_CASE_P` is a prefix that will be added to the actual
+test case name. Remember to pick unique prefixes for different
+instantiations. The tests from the instantiation above will have these
+names:
+
+  * `InstantiationName/FooTest.DoesBlah/0` for `"meeny"`
+  * `InstantiationName/FooTest.DoesBlah/1` for `"miny"`
+  * `InstantiationName/FooTest.DoesBlah/2` for `"moe"`
+  * `InstantiationName/FooTest.HasBlahBlah/0` for `"meeny"`
+  * `InstantiationName/FooTest.HasBlahBlah/1` for `"miny"`
+  * `InstantiationName/FooTest.HasBlahBlah/2` for `"moe"`
+
+You can use these names in [--gtest\_filter](#running-a-subset-of-the-tests).
+
+This statement will instantiate all tests from `FooTest` again, each
+with parameter values `"cat"` and `"dog"`:
+
+```
+const char* pets[] = {"cat", "dog"};
+INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest,
+                        ::testing::ValuesIn(pets));
+```
+
+The tests from the instantiation above will have these names:
+
+  * `AnotherInstantiationName/FooTest.DoesBlah/0` for `"cat"`
+  * `AnotherInstantiationName/FooTest.DoesBlah/1` for `"dog"`
+  * `AnotherInstantiationName/FooTest.HasBlahBlah/0` for `"cat"`
+  * `AnotherInstantiationName/FooTest.HasBlahBlah/1` for `"dog"`
+
+Please note that `INSTANTIATE_TEST_CASE_P` will instantiate _all_
+tests in the given test case, whether their definitions come before or
+_after_ the `INSTANTIATE_TEST_CASE_P` statement.
+
+You can see
+[these](../samples/sample7_unittest.cc)
+[files](../samples/sample8_unittest.cc) for more examples.
+
+_Availability_: Linux, Windows (requires MSVC 8.0 or above), Mac; since version 1.2.0.
+
+## Creating Value-Parameterized Abstract Tests ##
+
+In the above, we define and instantiate `FooTest` in the same source
+file. Sometimes you may want to define value-parameterized tests in a
+library and let other people instantiate them later. This pattern is
+known as <i>abstract tests</i>. As an example of its application, when you
+are designing an interface you can write a standard suite of abstract
+tests (perhaps using a factory function as the test parameter) that
+all implementations of the interface are expected to pass. When
+someone implements the interface, he can instantiate your suite to get
+all the interface-conformance tests for free.
+
+To define abstract tests, you should organize your code like this:
+
+  1. Put the definition of the parameterized test fixture class (e.g. `FooTest`) in a header file, say `foo_param_test.h`. Think of this as _declaring_ your abstract tests.
+  1. Put the `TEST_P` definitions in `foo_param_test.cc`, which includes `foo_param_test.h`. Think of this as _implementing_ your abstract tests.
+
+Once they are defined, you can instantiate them by including
+`foo_param_test.h`, invoking `INSTANTIATE_TEST_CASE_P()`, and linking
+with `foo_param_test.cc`. You can instantiate the same abstract test
+case multiple times, possibly in different source files.
+
+# Typed Tests #
+
+Suppose you have multiple implementations of the same interface and
+want to make sure that all of them satisfy some common requirements.
+Or, you may have defined several types that are supposed to conform to
+the same "concept" and you want to verify it.  In both cases, you want
+the same test logic repeated for different types.
+
+While you can write one `TEST` or `TEST_F` for each type you want to
+test (and you may even factor the test logic into a function template
+that you invoke from the `TEST`), it's tedious and doesn't scale:
+if you want _m_ tests over _n_ types, you'll end up writing _m\*n_
+`TEST`s.
+
+_Typed tests_ allow you to repeat the same test logic over a list of
+types.  You only need to write the test logic once, although you must
+know the type list when writing typed tests.  Here's how you do it:
+
+First, define a fixture class template.  It should be parameterized
+by a type.  Remember to derive it from `::testing::Test`:
+
+```
+template <typename T>
+class FooTest : public ::testing::Test {
+ public:
+  ...
+  typedef std::list<T> List;
+  static T shared_;
+  T value_;
+};
+```
+
+Next, associate a list of types with the test case, which will be
+repeated for each type in the list:
+
+```
+typedef ::testing::Types<char, int, unsigned int> MyTypes;
+TYPED_TEST_CASE(FooTest, MyTypes);
+```
+
+The `typedef` is necessary for the `TYPED_TEST_CASE` macro to parse
+correctly.  Otherwise the compiler will think that each comma in the
+type list introduces a new macro argument.
+
+Then, use `TYPED_TEST()` instead of `TEST_F()` to define a typed test
+for this test case.  You can repeat this as many times as you want:
+
+```
+TYPED_TEST(FooTest, DoesBlah) {
+  // Inside a test, refer to the special name TypeParam to get the type
+  // parameter.  Since we are inside a derived class template, C++ requires
+  // us to visit the members of FooTest via 'this'.
+  TypeParam n = this->value_;
+
+  // To visit static members of the fixture, add the 'TestFixture::'
+  // prefix.
+  n += TestFixture::shared_;
+
+  // To refer to typedefs in the fixture, add the 'typename TestFixture::'
+  // prefix.  The 'typename' is required to satisfy the compiler.
+  typename TestFixture::List values;
+  values.push_back(n);
+  ...
+}
+
+TYPED_TEST(FooTest, HasPropertyA) { ... }
+```
+
+You can see `samples/sample6_unittest.cc` for a complete example.
+
+_Availability:_ Linux, Windows (requires MSVC 8.0 or above), Mac;
+since version 1.1.0.
+
+# Type-Parameterized Tests #
+
+_Type-parameterized tests_ are like typed tests, except that they
+don't require you to know the list of types ahead of time.  Instead,
+you can define the test logic first and instantiate it with different
+type lists later.  You can even instantiate it more than once in the
+same program.
+
+If you are designing an interface or concept, you can define a suite
+of type-parameterized tests to verify properties that any valid
+implementation of the interface/concept should have.  Then, the author
+of each implementation can just instantiate the test suite with his
+type to verify that it conforms to the requirements, without having to
+write similar tests repeatedly.  Here's an example:
+
+First, define a fixture class template, as we did with typed tests:
+
+```
+template <typename T>
+class FooTest : public ::testing::Test {
+  ...
+};
+```
+
+Next, declare that you will define a type-parameterized test case:
+
+```
+TYPED_TEST_CASE_P(FooTest);
+```
+
+The `_P` suffix is for "parameterized" or "pattern", whichever you
+prefer to think.
+
+Then, use `TYPED_TEST_P()` to define a type-parameterized test.  You
+can repeat this as many times as you want:
+
+```
+TYPED_TEST_P(FooTest, DoesBlah) {
+  // Inside a test, refer to TypeParam to get the type parameter.
+  TypeParam n = 0;
+  ...
+}
+
+TYPED_TEST_P(FooTest, HasPropertyA) { ... }
+```
+
+Now the tricky part: you need to register all test patterns using the
+`REGISTER_TYPED_TEST_CASE_P` macro before you can instantiate them.
+The first argument of the macro is the test case name; the rest are
+the names of the tests in this test case:
+
+```
+REGISTER_TYPED_TEST_CASE_P(FooTest,
+                           DoesBlah, HasPropertyA);
+```
+
+Finally, you are free to instantiate the pattern with the types you
+want.  If you put the above code in a header file, you can `#include`
+it in multiple C++ source files and instantiate it multiple times.
+
+```
+typedef ::testing::Types<char, int, unsigned int> MyTypes;
+INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
+```
+
+To distinguish different instances of the pattern, the first argument
+to the `INSTANTIATE_TYPED_TEST_CASE_P` macro is a prefix that will be
+added to the actual test case name.  Remember to pick unique prefixes
+for different instances.
+
+In the special case where the type list contains only one type, you
+can write that type directly without `::testing::Types<...>`, like this:
+
+```
+INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
+```
+
+You can see `samples/sample6_unittest.cc` for a complete example.
+
+_Availability:_ Linux, Windows (requires MSVC 8.0 or above), Mac;
+since version 1.1.0.
+
+# Testing Private Code #
+
+If you change your software's internal implementation, your tests should not
+break as long as the change is not observable by users. Therefore, per the
+_black-box testing principle_, most of the time you should test your code
+through its public interfaces.
+
+If you still find yourself needing to test internal implementation code,
+consider if there's a better design that wouldn't require you to do so. If you
+absolutely have to test non-public interface code though, you can. There are
+two cases to consider:
+
+  * Static functions (_not_ the same as static member functions!) or unnamed namespaces, and
+  * Private or protected class members
+
+## Static Functions ##
+
+Both static functions and definitions/declarations in an unnamed namespace are
+only visible within the same translation unit. To test them, you can `#include`
+the entire `.cc` file being tested in your `*_test.cc` file. (`#include`ing `.cc`
+files is not a good way to reuse code - you should not do this in production
+code!)
+
+However, a better approach is to move the private code into the
+`foo::internal` namespace, where `foo` is the namespace your project normally
+uses, and put the private declarations in a `*-internal.h` file. Your
+production `.cc` files and your tests are allowed to include this internal
+header, but your clients are not. This way, you can fully test your internal
+implementation without leaking it to your clients.
+
+## Private Class Members ##
+
+Private class members are only accessible from within the class or by friends.
+To access a class' private members, you can declare your test fixture as a
+friend to the class and define accessors in your fixture. Tests using the
+fixture can then access the private members of your production class via the
+accessors in the fixture. Note that even though your fixture is a friend to
+your production class, your tests are not automatically friends to it, as they
+are technically defined in sub-classes of the fixture.
+
+Another way to test private members is to refactor them into an implementation
+class, which is then declared in a `*-internal.h` file. Your clients aren't
+allowed to include this header but your tests can. Such is called the Pimpl
+(Private Implementation) idiom.
+
+Or, you can declare an individual test as a friend of your class by adding this
+line in the class body:
+
+```
+FRIEND_TEST(TestCaseName, TestName);
+```
+
+For example,
+```
+// foo.h
+#include "gtest/gtest_prod.h"
+
+// Defines FRIEND_TEST.
+class Foo {
+  ...
+ private:
+  FRIEND_TEST(FooTest, BarReturnsZeroOnNull);
+  int Bar(void* x);
+};
+
+// foo_test.cc
+...
+TEST(FooTest, BarReturnsZeroOnNull) {
+  Foo foo;
+  EXPECT_EQ(0, foo.Bar(NULL));
+  // Uses Foo's private member Bar().
+}
+```
+
+Pay special attention when your class is defined in a namespace, as you should
+define your test fixtures and tests in the same namespace if you want them to
+be friends of your class. For example, if the code to be tested looks like:
+
+```
+namespace my_namespace {
+
+class Foo {
+  friend class FooTest;
+  FRIEND_TEST(FooTest, Bar);
+  FRIEND_TEST(FooTest, Baz);
+  ...
+  definition of the class Foo
+  ...
+};
+
+}  // namespace my_namespace
+```
+
+Your test code should be something like:
+
+```
+namespace my_namespace {
+class FooTest : public ::testing::Test {
+ protected:
+  ...
+};
+
+TEST_F(FooTest, Bar) { ... }
+TEST_F(FooTest, Baz) { ... }
+
+}  // namespace my_namespace
+```
+
+# Catching Failures #
+
+If you are building a testing utility on top of Google Test, you'll
+want to test your utility.  What framework would you use to test it?
+Google Test, of course.
+
+The challenge is to verify that your testing utility reports failures
+correctly.  In frameworks that report a failure by throwing an
+exception, you could catch the exception and assert on it.  But Google
+Test doesn't use exceptions, so how do we test that a piece of code
+generates an expected failure?
+
+`"gtest/gtest-spi.h"` contains some constructs to do this.  After 
+`#include`ing this header, you can use
+
+| `EXPECT_FATAL_FAILURE(`_statement, substring_`);` |
+|:--------------------------------------------------|
+
+to assert that _statement_ generates a fatal (e.g. `ASSERT_*`) failure
+whose message contains the given _substring_, or use
+
+| `EXPECT_NONFATAL_FAILURE(`_statement, substring_`);` |
+|:-----------------------------------------------------|
+
+if you are expecting a non-fatal (e.g. `EXPECT_*`) failure.
+
+For technical reasons, there are some caveats:
+
+  1. You cannot stream a failure message to either macro.
+  1. _statement_ in `EXPECT_FATAL_FAILURE()` cannot reference local non-static variables or non-static members of `this` object.
+  1. _statement_ in `EXPECT_FATAL_FAILURE()` cannot return a value.
+
+_Note:_ Google Test is designed with threads in mind. Once the
+synchronization primitives in `"gtest/internal/gtest-port.h"` have
+been implemented, Google Test will become thread-safe, meaning that
+you can then use assertions in multiple threads concurrently. Before
+that, however, Google Test only supports single-threaded usage. Once
+thread-safe, `EXPECT_FATAL_FAILURE()` and `EXPECT_NONFATAL_FAILURE()`
+will capture failures in the current thread only. If _statement_
+creates new threads, failures in these threads will be ignored. If
+you want to capture failures from all threads instead, you should use
+the following macros:
+
+| `EXPECT_FATAL_FAILURE_ON_ALL_THREADS(`_statement, substring_`);` |
+|:-----------------------------------------------------------------|
+| `EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(`_statement, substring_`);` |
+
+# Getting the Current Test's Name #
+
+Sometimes a function may need to know the name of the currently running test.
+For example, you may be using the `SetUp()` method of your test fixture to set
+the golden file name based on which test is running. The `::testing::TestInfo`
+class has this information:
+
+```
+namespace testing {
+
+class TestInfo {
+ public:
+  // Returns the test case name and the test name, respectively.
+  //
+  // Do NOT delete or free the return value - it's managed by the
+  // TestInfo class.
+  const char* test_case_name() const;
+  const char* name() const;
+};
+
+}  // namespace testing
+```
+
+
+> To obtain a `TestInfo` object for the currently running test, call
+`current_test_info()` on the `UnitTest` singleton object:
+
+```
+// Gets information about the currently running test.
+// Do NOT delete the returned object - it's managed by the UnitTest class.
+const ::testing::TestInfo* const test_info =
+  ::testing::UnitTest::GetInstance()->current_test_info();
+printf("We are in test %s of test case %s.\n",
+       test_info->name(), test_info->test_case_name());
+```
+
+`current_test_info()` returns a null pointer if no test is running. In
+particular, you cannot find the test case name in `TestCaseSetUp()`,
+`TestCaseTearDown()` (where you know the test case name implicitly), or
+functions called from them.
+
+_Availability:_ Linux, Windows, Mac.
+
+# Extending Google Test by Handling Test Events #
+
+Google Test provides an <b>event listener API</b> to let you receive
+notifications about the progress of a test program and test
+failures. The events you can listen to include the start and end of
+the test program, a test case, or a test method, among others. You may
+use this API to augment or replace the standard console output,
+replace the XML output, or provide a completely different form of
+output, such as a GUI or a database. You can also use test events as
+checkpoints to implement a resource leak checker, for example.
+
+_Availability:_ Linux, Windows, Mac; since v1.4.0.
+
+## Defining Event Listeners ##
+
+To define a event listener, you subclass either
+[testing::TestEventListener](../include/gtest/gtest.h#L991)
+or [testing::EmptyTestEventListener](../include/gtest/gtest.h#L1044).
+The former is an (abstract) interface, where <i>each pure virtual method<br>
+can be overridden to handle a test event</i> (For example, when a test
+starts, the `OnTestStart()` method will be called.). The latter provides
+an empty implementation of all methods in the interface, such that a
+subclass only needs to override the methods it cares about.
+
+When an event is fired, its context is passed to the handler function
+as an argument. The following argument types are used:
+  * [UnitTest](../include/gtest/gtest.h#L1151) reflects the state of the entire test program,
+  * [TestCase](../include/gtest/gtest.h#L778) has information about a test case, which can contain one or more tests,
+  * [TestInfo](../include/gtest/gtest.h#L644) contains the state of a test, and
+  * [TestPartResult](../include/gtest/gtest-test-part.h#L47) represents the result of a test assertion.
+
+An event handler function can examine the argument it receives to find
+out interesting information about the event and the test program's
+state.  Here's an example:
+
+```
+  class MinimalistPrinter : public ::testing::EmptyTestEventListener {
+    // Called before a test starts.
+    virtual void OnTestStart(const ::testing::TestInfo& test_info) {
+      printf("*** Test %s.%s starting.\n",
+             test_info.test_case_name(), test_info.name());
+    }
+
+    // Called after a failed assertion or a SUCCEED() invocation.
+    virtual void OnTestPartResult(
+        const ::testing::TestPartResult& test_part_result) {
+      printf("%s in %s:%d\n%s\n",
+             test_part_result.failed() ? "*** Failure" : "Success",
+             test_part_result.file_name(),
+             test_part_result.line_number(),
+             test_part_result.summary());
+    }
+
+    // Called after a test ends.
+    virtual void OnTestEnd(const ::testing::TestInfo& test_info) {
+      printf("*** Test %s.%s ending.\n",
+             test_info.test_case_name(), test_info.name());
+    }
+  };
+```
+
+## Using Event Listeners ##
+
+To use the event listener you have defined, add an instance of it to
+the Google Test event listener list (represented by class
+[TestEventListeners](../include/gtest/gtest.h#L1064)
+- note the "s" at the end of the name) in your
+`main()` function, before calling `RUN_ALL_TESTS()`:
+```
+int main(int argc, char** argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  // Gets hold of the event listener list.
+  ::testing::TestEventListeners& listeners =
+      ::testing::UnitTest::GetInstance()->listeners();
+  // Adds a listener to the end.  Google Test takes the ownership.
+  listeners.Append(new MinimalistPrinter);
+  return RUN_ALL_TESTS();
+}
+```
+
+There's only one problem: the default test result printer is still in
+effect, so its output will mingle with the output from your minimalist
+printer. To suppress the default printer, just release it from the
+event listener list and delete it. You can do so by adding one line:
+```
+  ...
+  delete listeners.Release(listeners.default_result_printer());
+  listeners.Append(new MinimalistPrinter);
+  return RUN_ALL_TESTS();
+```
+
+Now, sit back and enjoy a completely different output from your
+tests. For more details, you can read this
+[sample](../samples/sample9_unittest.cc).
+
+You may append more than one listener to the list. When an `On*Start()`
+or `OnTestPartResult()` event is fired, the listeners will receive it in
+the order they appear in the list (since new listeners are added to
+the end of the list, the default text printer and the default XML
+generator will receive the event first). An `On*End()` event will be
+received by the listeners in the _reverse_ order. This allows output by
+listeners added later to be framed by output from listeners added
+earlier.
+
+## Generating Failures in Listeners ##
+
+You may use failure-raising macros (`EXPECT_*()`, `ASSERT_*()`,
+`FAIL()`, etc) when processing an event. There are some restrictions:
+
+  1. You cannot generate any failure in `OnTestPartResult()` (otherwise it will cause `OnTestPartResult()` to be called recursively).
+  1. A listener that handles `OnTestPartResult()` is not allowed to generate any failure.
+
+When you add listeners to the listener list, you should put listeners
+that handle `OnTestPartResult()` _before_ listeners that can generate
+failures. This ensures that failures generated by the latter are
+attributed to the right test by the former.
+
+We have a sample of failure-raising listener
+[here](../samples/sample10_unittest.cc).
+
+# Running Test Programs: Advanced Options #
+
+Google Test test programs are ordinary executables. Once built, you can run
+them directly and affect their behavior via the following environment variables
+and/or command line flags. For the flags to work, your programs must call
+`::testing::InitGoogleTest()` before calling `RUN_ALL_TESTS()`.
+
+To see a list of supported flags and their usage, please run your test
+program with the `--help` flag.  You can also use `-h`, `-?`, or `/?`
+for short.  This feature is added in version 1.3.0.
+
+If an option is specified both by an environment variable and by a
+flag, the latter takes precedence.  Most of the options can also be
+set/read in code: to access the value of command line flag
+`--gtest_foo`, write `::testing::GTEST_FLAG(foo)`.  A common pattern is
+to set the value of a flag before calling `::testing::InitGoogleTest()`
+to change the default value of the flag:
+```
+int main(int argc, char** argv) {
+  // Disables elapsed time by default.
+  ::testing::GTEST_FLAG(print_time) = false;
+
+  // This allows the user to override the flag on the command line.
+  ::testing::InitGoogleTest(&argc, argv);
+
+  return RUN_ALL_TESTS();
+}
+```
+
+## Selecting Tests ##
+
+This section shows various options for choosing which tests to run.
+
+### Listing Test Names ###
+
+Sometimes it is necessary to list the available tests in a program before
+running them so that a filter may be applied if needed. Including the flag
+`--gtest_list_tests` overrides all other flags and lists tests in the following
+format:
+```
+TestCase1.
+  TestName1
+  TestName2
+TestCase2.
+  TestName
+```
+
+None of the tests listed are actually run if the flag is provided. There is no
+corresponding environment variable for this flag.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Running a Subset of the Tests ###
+
+By default, a Google Test program runs all tests the user has defined.
+Sometimes, you want to run only a subset of the tests (e.g. for debugging or
+quickly verifying a change). If you set the `GTEST_FILTER` environment variable
+or the `--gtest_filter` flag to a filter string, Google Test will only run the
+tests whose full names (in the form of `TestCaseName.TestName`) match the
+filter.
+
+The format of a filter is a '`:`'-separated list of wildcard patterns (called
+the positive patterns) optionally followed by a '`-`' and another
+'`:`'-separated pattern list (called the negative patterns). A test matches the
+filter if and only if it matches any of the positive patterns but does not
+match any of the negative patterns.
+
+A pattern may contain `'*'` (matches any string) or `'?'` (matches any single
+character). For convenience, the filter `'*-NegativePatterns'` can be also
+written as `'-NegativePatterns'`.
+
+For example:
+
+  * `./foo_test` Has no flag, and thus runs all its tests.
+  * `./foo_test --gtest_filter=*` Also runs everything, due to the single match-everything `*` value.
+  * `./foo_test --gtest_filter=FooTest.*` Runs everything in test case `FooTest`.
+  * `./foo_test --gtest_filter=*Null*:*Constructor*` Runs any test whose full name contains either `"Null"` or `"Constructor"`.
+  * `./foo_test --gtest_filter=-*DeathTest.*` Runs all non-death tests.
+  * `./foo_test --gtest_filter=FooTest.*-FooTest.Bar` Runs everything in test case `FooTest` except `FooTest.Bar`.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Temporarily Disabling Tests ###
+
+If you have a broken test that you cannot fix right away, you can add the
+`DISABLED_` prefix to its name. This will exclude it from execution. This is
+better than commenting out the code or using `#if 0`, as disabled tests are
+still compiled (and thus won't rot).
+
+If you need to disable all tests in a test case, you can either add `DISABLED_`
+to the front of the name of each test, or alternatively add it to the front of
+the test case name.
+
+For example, the following tests won't be run by Google Test, even though they
+will still be compiled:
+
+```
+// Tests that Foo does Abc.
+TEST(FooTest, DISABLED_DoesAbc) { ... }
+
+class DISABLED_BarTest : public ::testing::Test { ... };
+
+// Tests that Bar does Xyz.
+TEST_F(DISABLED_BarTest, DoesXyz) { ... }
+```
+
+_Note:_ This feature should only be used for temporary pain-relief. You still
+have to fix the disabled tests at a later date. As a reminder, Google Test will
+print a banner warning you if a test program contains any disabled tests.
+
+_Tip:_ You can easily count the number of disabled tests you have
+using `grep`. This number can be used as a metric for improving your
+test quality.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Temporarily Enabling Disabled Tests ###
+
+To include [disabled tests](#temporarily-disabling-tests) in test
+execution, just invoke the test program with the
+`--gtest_also_run_disabled_tests` flag or set the
+`GTEST_ALSO_RUN_DISABLED_TESTS` environment variable to a value other
+than `0`.  You can combine this with the
+[--gtest\_filter](#running-a-subset-of-the-tests) flag to further select
+which disabled tests to run.
+
+_Availability:_ Linux, Windows, Mac; since version 1.3.0.
+
+## Repeating the Tests ##
+
+Once in a while you'll run into a test whose result is hit-or-miss. Perhaps it
+will fail only 1% of the time, making it rather hard to reproduce the bug under
+a debugger. This can be a major source of frustration.
+
+The `--gtest_repeat` flag allows you to repeat all (or selected) test methods
+in a program many times. Hopefully, a flaky test will eventually fail and give
+you a chance to debug. Here's how to use it:
+
+| `$ foo_test --gtest_repeat=1000` | Repeat foo\_test 1000 times and don't stop at failures. |
+|:---------------------------------|:--------------------------------------------------------|
+| `$ foo_test --gtest_repeat=-1`   | A negative count means repeating forever.               |
+| `$ foo_test --gtest_repeat=1000 --gtest_break_on_failure` | Repeat foo\_test 1000 times, stopping at the first failure. This is especially useful when running under a debugger: when the testfails, it will drop into the debugger and you can then inspect variables and stacks. |
+| `$ foo_test --gtest_repeat=1000 --gtest_filter=FooBar` | Repeat the tests whose name matches the filter 1000 times. |
+
+If your test program contains global set-up/tear-down code registered
+using `AddGlobalTestEnvironment()`, it will be repeated in each
+iteration as well, as the flakiness may be in it. You can also specify
+the repeat count by setting the `GTEST_REPEAT` environment variable.
+
+_Availability:_ Linux, Windows, Mac.
+
+## Shuffling the Tests ##
+
+You can specify the `--gtest_shuffle` flag (or set the `GTEST_SHUFFLE`
+environment variable to `1`) to run the tests in a program in a random
+order. This helps to reveal bad dependencies between tests.
+
+By default, Google Test uses a random seed calculated from the current
+time. Therefore you'll get a different order every time. The console
+output includes the random seed value, such that you can reproduce an
+order-related test failure later. To specify the random seed
+explicitly, use the `--gtest_random_seed=SEED` flag (or set the
+`GTEST_RANDOM_SEED` environment variable), where `SEED` is an integer
+between 0 and 99999. The seed value 0 is special: it tells Google Test
+to do the default behavior of calculating the seed from the current
+time.
+
+If you combine this with `--gtest_repeat=N`, Google Test will pick a
+different random seed and re-shuffle the tests in each iteration.
+
+_Availability:_ Linux, Windows, Mac; since v1.4.0.
+
+## Controlling Test Output ##
+
+This section teaches how to tweak the way test results are reported.
+
+### Colored Terminal Output ###
+
+Google Test can use colors in its terminal output to make it easier to spot
+the separation between tests, and whether tests passed.
+
+You can set the GTEST\_COLOR environment variable or set the `--gtest_color`
+command line flag to `yes`, `no`, or `auto` (the default) to enable colors,
+disable colors, or let Google Test decide. When the value is `auto`, Google
+Test will use colors if and only if the output goes to a terminal and (on
+non-Windows platforms) the `TERM` environment variable is set to `xterm` or
+`xterm-color`.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Suppressing the Elapsed Time ###
+
+By default, Google Test prints the time it takes to run each test.  To
+suppress that, run the test program with the `--gtest_print_time=0`
+command line flag.  Setting the `GTEST_PRINT_TIME` environment
+variable to `0` has the same effect.
+
+_Availability:_ Linux, Windows, Mac.  (In Google Test 1.3.0 and lower,
+the default behavior is that the elapsed time is **not** printed.)
+
+### Generating an XML Report ###
+
+Google Test can emit a detailed XML report to a file in addition to its normal
+textual output. The report contains the duration of each test, and thus can
+help you identify slow tests.
+
+To generate the XML report, set the `GTEST_OUTPUT` environment variable or the
+`--gtest_output` flag to the string `"xml:_path_to_output_file_"`, which will
+create the file at the given location. You can also just use the string
+`"xml"`, in which case the output can be found in the `test_detail.xml` file in
+the current directory.
+
+If you specify a directory (for example, `"xml:output/directory/"` on Linux or
+`"xml:output\directory\"` on Windows), Google Test will create the XML file in
+that directory, named after the test executable (e.g. `foo_test.xml` for test
+program `foo_test` or `foo_test.exe`). If the file already exists (perhaps left
+over from a previous run), Google Test will pick a different name (e.g.
+`foo_test_1.xml`) to avoid overwriting it.
+
+The report uses the format described here.  It is based on the
+`junitreport` Ant task and can be parsed by popular continuous build
+systems like [Hudson](https://hudson.dev.java.net/). Since that format
+was originally intended for Java, a little interpretation is required
+to make it apply to Google Test tests, as shown here:
+
+```
+<testsuites name="AllTests" ...>
+  <testsuite name="test_case_name" ...>
+    <testcase name="test_name" ...>
+      <failure message="..."/>
+      <failure message="..."/>
+      <failure message="..."/>
+    </testcase>
+  </testsuite>
+</testsuites>
+```
+
+  * The root `<testsuites>` element corresponds to the entire test program.
+  * `<testsuite>` elements correspond to Google Test test cases.
+  * `<testcase>` elements correspond to Google Test test functions.
+
+For instance, the following program
+
+```
+TEST(MathTest, Addition) { ... }
+TEST(MathTest, Subtraction) { ... }
+TEST(LogicTest, NonContradiction) { ... }
+```
+
+could generate this report:
+
+```
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuites tests="3" failures="1" errors="0" time="35" name="AllTests">
+  <testsuite name="MathTest" tests="2" failures="1" errors="0" time="15">
+    <testcase name="Addition" status="run" time="7" classname="">
+      <failure message="Value of: add(1, 1)&#x0A; Actual: 3&#x0A;Expected: 2" type=""/>
+      <failure message="Value of: add(1, -1)&#x0A; Actual: 1&#x0A;Expected: 0" type=""/>
+    </testcase>
+    <testcase name="Subtraction" status="run" time="5" classname="">
+    </testcase>
+  </testsuite>
+  <testsuite name="LogicTest" tests="1" failures="0" errors="0" time="5">
+    <testcase name="NonContradiction" status="run" time="5" classname="">
+    </testcase>
+  </testsuite>
+</testsuites>
+```
+
+Things to note:
+
+  * The `tests` attribute of a `<testsuites>` or `<testsuite>` element tells how many test functions the Google Test program or test case contains, while the `failures` attribute tells how many of them failed.
+  * The `time` attribute expresses the duration of the test, test case, or entire test program in milliseconds.
+  * Each `<failure>` element corresponds to a single failed Google Test assertion.
+  * Some JUnit concepts don't apply to Google Test, yet we have to conform to the DTD. Therefore you'll see some dummy elements and attributes in the report. You can safely ignore these parts.
+
+_Availability:_ Linux, Windows, Mac.
+
+## Controlling How Failures Are Reported ##
+
+### Turning Assertion Failures into Break-Points ###
+
+When running test programs under a debugger, it's very convenient if the
+debugger can catch an assertion failure and automatically drop into interactive
+mode. Google Test's _break-on-failure_ mode supports this behavior.
+
+To enable it, set the `GTEST_BREAK_ON_FAILURE` environment variable to a value
+other than `0` . Alternatively, you can use the `--gtest_break_on_failure`
+command line flag.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Disabling Catching Test-Thrown Exceptions ###
+
+Google Test can be used either with or without exceptions enabled.  If
+a test throws a C++ exception or (on Windows) a structured exception
+(SEH), by default Google Test catches it, reports it as a test
+failure, and continues with the next test method.  This maximizes the
+coverage of a test run.  Also, on Windows an uncaught exception will
+cause a pop-up window, so catching the exceptions allows you to run
+the tests automatically.
+
+When debugging the test failures, however, you may instead want the
+exceptions to be handled by the debugger, such that you can examine
+the call stack when an exception is thrown.  To achieve that, set the
+`GTEST_CATCH_EXCEPTIONS` environment variable to `0`, or use the
+`--gtest_catch_exceptions=0` flag when running the tests.
+
+**Availability**: Linux, Windows, Mac.
+
+### Letting Another Testing Framework Drive ###
+
+If you work on a project that has already been using another testing
+framework and is not ready to completely switch to Google Test yet,
+you can get much of Google Test's benefit by using its assertions in
+your existing tests.  Just change your `main()` function to look
+like:
+
+```
+#include "gtest/gtest.h"
+
+int main(int argc, char** argv) {
+  ::testing::GTEST_FLAG(throw_on_failure) = true;
+  // Important: Google Test must be initialized.
+  ::testing::InitGoogleTest(&argc, argv);
+
+  ... whatever your existing testing framework requires ...
+}
+```
+
+With that, you can use Google Test assertions in addition to the
+native assertions your testing framework provides, for example:
+
+```
+void TestFooDoesBar() {
+  Foo foo;
+  EXPECT_LE(foo.Bar(1), 100);     // A Google Test assertion.
+  CPPUNIT_ASSERT(foo.IsEmpty());  // A native assertion.
+}
+```
+
+If a Google Test assertion fails, it will print an error message and
+throw an exception, which will be treated as a failure by your host
+testing framework.  If you compile your code with exceptions disabled,
+a failed Google Test assertion will instead exit your program with a
+non-zero code, which will also signal a test failure to your test
+runner.
+
+If you don't write `::testing::GTEST_FLAG(throw_on_failure) = true;` in
+your `main()`, you can alternatively enable this feature by specifying
+the `--gtest_throw_on_failure` flag on the command-line or setting the
+`GTEST_THROW_ON_FAILURE` environment variable to a non-zero value.
+
+Death tests are _not_ supported when other test framework is used to organize tests.
+
+_Availability:_ Linux, Windows, Mac; since v1.3.0.
+
+## Distributing Test Functions to Multiple Machines ##
+
+If you have more than one machine you can use to run a test program,
+you might want to run the test functions in parallel and get the
+result faster.  We call this technique _sharding_, where each machine
+is called a _shard_.
+
+Google Test is compatible with test sharding.  To take advantage of
+this feature, your test runner (not part of Google Test) needs to do
+the following:
+
+  1. Allocate a number of machines (shards) to run the tests.
+  1. On each shard, set the `GTEST_TOTAL_SHARDS` environment variable to the total number of shards.  It must be the same for all shards.
+  1. On each shard, set the `GTEST_SHARD_INDEX` environment variable to the index of the shard.  Different shards must be assigned different indices, which must be in the range `[0, GTEST_TOTAL_SHARDS - 1]`.
+  1. Run the same test program on all shards.  When Google Test sees the above two environment variables, it will select a subset of the test functions to run.  Across all shards, each test function in the program will be run exactly once.
+  1. Wait for all shards to finish, then collect and report the results.
+
+Your project may have tests that were written without Google Test and
+thus don't understand this protocol.  In order for your test runner to
+figure out which test supports sharding, it can set the environment
+variable `GTEST_SHARD_STATUS_FILE` to a non-existent file path.  If a
+test program supports sharding, it will create this file to
+acknowledge the fact (the actual contents of the file are not
+important at this time; although we may stick some useful information
+in it in the future.); otherwise it will not create it.
+
+Here's an example to make it clear.  Suppose you have a test program
+`foo_test` that contains the following 5 test functions:
+```
+TEST(A, V)
+TEST(A, W)
+TEST(B, X)
+TEST(B, Y)
+TEST(B, Z)
+```
+and you have 3 machines at your disposal.  To run the test functions in
+parallel, you would set `GTEST_TOTAL_SHARDS` to 3 on all machines, and
+set `GTEST_SHARD_INDEX` to 0, 1, and 2 on the machines respectively.
+Then you would run the same `foo_test` on each machine.
+
+Google Test reserves the right to change how the work is distributed
+across the shards, but here's one possible scenario:
+
+  * Machine #0 runs `A.V` and `B.X`.
+  * Machine #1 runs `A.W` and `B.Y`.
+  * Machine #2 runs `B.Z`.
+
+_Availability:_ Linux, Windows, Mac; since version 1.3.0.
+
+# Fusing Google Test Source Files #
+
+Google Test's implementation consists of ~30 files (excluding its own
+tests).  Sometimes you may want them to be packaged up in two files (a
+`.h` and a `.cc`) instead, such that you can easily copy them to a new
+machine and start hacking there.  For this we provide an experimental
+Python script `fuse_gtest_files.py` in the `scripts/` directory (since release 1.3.0).
+Assuming you have Python 2.4 or above installed on your machine, just
+go to that directory and run
+```
+python fuse_gtest_files.py OUTPUT_DIR
+```
+
+and you should see an `OUTPUT_DIR` directory being created with files
+`gtest/gtest.h` and `gtest/gtest-all.cc` in it.  These files contain
+everything you need to use Google Test.  Just copy them to anywhere
+you want and you are ready to write tests.  You can use the
+[scripts/test/Makefile](../scripts/test/Makefile)
+file as an example on how to compile your tests against them.
+
+# Where to Go from Here #
+
+Congratulations! You've now learned more advanced Google Test tools and are
+ready to tackle more complex testing tasks. If you want to dive even deeper, you
+can read the [Frequently-Asked Questions](FAQ.md).
diff --git a/docs/DevGuide.md b/docs/DevGuide.md
new file mode 100755 (executable)
index 0000000..06467a3
--- /dev/null
@@ -0,0 +1,126 @@
+
+
+If you are interested in understanding the internals of Google Test,
+building from source, or contributing ideas or modifications to the
+project, then this document is for you.
+
+# Introduction #
+
+First, let's give you some background of the project.
+
+## Licensing ##
+
+All Google Test source and pre-built packages are provided under the [New BSD License](http://www.opensource.org/licenses/bsd-license.php).
+
+## The Google Test Community ##
+
+The Google Test community exists primarily through the [discussion group](http://groups.google.com/group/googletestframework) and the GitHub repository.
+You are definitely encouraged to contribute to the
+discussion and you can also help us to keep the effectiveness of the
+group high by following and promoting the guidelines listed here.
+
+### Please Be Friendly ###
+
+Showing courtesy and respect to others is a vital part of the Google
+culture, and we strongly encourage everyone participating in Google
+Test development to join us in accepting nothing less. Of course,
+being courteous is not the same as failing to constructively disagree
+with each other, but it does mean that we should be respectful of each
+other when enumerating the 42 technical reasons that a particular
+proposal may not be the best choice. There's never a reason to be
+antagonistic or dismissive toward anyone who is sincerely trying to
+contribute to a discussion.
+
+Sure, C++ testing is serious business and all that, but it's also
+a lot of fun. Let's keep it that way. Let's strive to be one of the
+friendliest communities in all of open source.
+
+As always, discuss Google Test in the official GoogleTest discussion group.
+You don't have to actually submit code in order to sign up. Your participation
+itself is a valuable contribution.
+
+# Working with the Code #
+
+If you want to get your hands dirty with the code inside Google Test,
+this is the section for you.
+
+## Compiling from Source ##
+
+Once you check out the code, you can find instructions on how to
+compile it in the [README](../README.md) file.
+
+## Testing ##
+
+A testing framework is of no good if itself is not thoroughly tested.
+Tests should be written for any new code, and changes should be
+verified to not break existing tests before they are submitted for
+review. To perform the tests, follow the instructions in
+[README](../README.md) and verify that there are no failures.
+
+# Contributing Code #
+
+We are excited that Google Test is now open source, and hope to get
+great patches from the community. Before you fire up your favorite IDE
+and begin hammering away at that new feature, though, please take the
+time to read this section and understand the process. While it seems
+rigorous, we want to keep a high standard of quality in the code
+base.
+
+## Contributor License Agreements ##
+
+You must sign a Contributor License Agreement (CLA) before we can
+accept any code.  The CLA protects you and us.
+
+  * If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html).
+  * If you work for a company that wants to allow you to contribute your work to Google Test, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html).
+
+Follow either of the two links above to access the appropriate CLA and
+instructions for how to sign and return it.
+
+## Coding Style ##
+
+To keep the source consistent, readable, diffable and easy to merge,
+we use a fairly rigid coding style, as defined by the [google-styleguide](http://code.google.com/p/google-styleguide/) project.  All patches will be expected
+to conform to the style outlined [here](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml).
+
+## Updating Generated Code ##
+
+Some of Google Test's source files are generated by the Pump tool (a
+Python script).  If you need to update such files, please modify the
+source (`foo.h.pump`) and re-generate the C++ file using Pump.  You
+can read the PumpManual for details.
+
+## Submitting Patches ##
+
+Please do submit code. Here's what you need to do:
+
+  1. A submission should be a set of changes that addresses one issue in the [issue tracker](https://github.com/google/googletest/issues). Please don't mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn't have a corresponding issue in the issue tracker, please create one.
+  1. Also, coordinate with team members that are listed on the issue in question. This ensures that work isn't being duplicated and communicating your plan early also generally leads to better patches.
+  1. Ensure that your code adheres to the [Google Test source code style](#Coding_Style.md).
+  1. Ensure that there are unit tests for your code.
+  1. Sign a Contributor License Agreement.
+  1. Create a Pull Request in the usual way.
+
+## Google Test Committers ##
+
+The current members of the Google Test engineering team are the only
+committers at present. In the great tradition of eating one's own
+dogfood, we will be requiring each new Google Test engineering team
+member to earn the right to become a committer by following the
+procedures in this document, writing consistently great code, and
+demonstrating repeatedly that he or she truly gets the zen of Google
+Test.
+
+# Release Process #
+
+We follow a typical release process:
+
+  1. A release branch named `release-X.Y` is created.
+  1. Bugs are fixed and features are added in trunk; those individual patches are merged into the release branch until it's stable.
+  1. An individual point release (the `Z` in `X.Y.Z`) is made by creating a tag from the branch.
+  1. Repeat steps 2 and 3 throughout one release cycle (as determined by features or time).
+  1. Go back to step 1 to create another release branch and so on.
+
+---
+
+This page is based on the [Making GWT Better](http://code.google.com/webtoolkit/makinggwtbetter.html) guide from the [Google Web Toolkit](http://code.google.com/webtoolkit/) project.  Except as otherwise [noted](http://code.google.com/policies.html#restrictions), the content of this page is licensed under the [Creative Commons Attribution 2.5 License](http://creativecommons.org/licenses/by/2.5/).
diff --git a/docs/Documentation.md b/docs/Documentation.md
new file mode 100755 (executable)
index 0000000..8ca1aac
--- /dev/null
@@ -0,0 +1,14 @@
+This page lists all documentation wiki pages for Google Test **(the SVN trunk version)**
+-- **if you use a released version of Google Test, please read the
+documentation for that specific version instead.**
+
+  * [Primer](Primer.md) -- start here if you are new to Google Test.
+  * [Samples](Samples.md) -- learn from examples.
+  * [AdvancedGuide](AdvancedGuide.md) -- learn more about Google Test.
+  * [XcodeGuide](XcodeGuide.md) -- how to use Google Test in Xcode on Mac.
+  * [Frequently-Asked Questions](FAQ.md) -- check here before asking a question on the mailing list.
+
+To contribute code to Google Test, read:
+
+  * [DevGuide](DevGuide.md) -- read this _before_ writing your first patch.
+  * [PumpManual](PumpManual.md) -- how we generate some of Google Test's source files.
\ No newline at end of file
diff --git a/docs/FAQ.md b/docs/FAQ.md
new file mode 100755 (executable)
index 0000000..5fd6cb7
--- /dev/null
@@ -0,0 +1,1087 @@
+
+
+If you cannot find the answer to your question here, and you have read
+[Primer](Primer.md) and [AdvancedGuide](AdvancedGuide.md), send it to
+googletestframework@googlegroups.com.
+
+## Why should I use Google Test instead of my favorite C++ testing framework? ##
+
+First, let us say clearly that we don't want to get into the debate of
+which C++ testing framework is **the best**.  There exist many fine
+frameworks for writing C++ tests, and we have tremendous respect for
+the developers and users of them.  We don't think there is (or will
+be) a single best framework - you have to pick the right tool for the
+particular task you are tackling.
+
+We created Google Test because we couldn't find the right combination
+of features and conveniences in an existing framework to satisfy _our_
+needs.  The following is a list of things that _we_ like about Google
+Test.  We don't claim them to be unique to Google Test - rather, the
+combination of them makes Google Test the choice for us.  We hope this
+list can help you decide whether it is for you too.
+
+  * Google Test is designed to be portable: it doesn't require exceptions or RTTI; it works around various bugs in various compilers and environments; etc.  As a result, it works on Linux, Mac OS X, Windows and several embedded operating systems.
+  * Nonfatal assertions (`EXPECT_*`) have proven to be great time savers, as they allow a test to report multiple failures in a single edit-compile-test cycle.
+  * It's easy to write assertions that generate informative messages: you just use the stream syntax to append any additional information, e.g. `ASSERT_EQ(5, Foo(i)) << " where i = " << i;`.  It doesn't require a new set of macros or special functions.
+  * Google Test automatically detects your tests and doesn't require you to enumerate them in order to run them.
+  * Death tests are pretty handy for ensuring that your asserts in production code are triggered by the right conditions.
+  * `SCOPED_TRACE` helps you understand the context of an assertion failure when it comes from inside a sub-routine or loop.
+  * You can decide which tests to run using name patterns.  This saves time when you want to quickly reproduce a test failure.
+  * Google Test can generate XML test result reports that can be parsed by popular continuous build system like Hudson.
+  * Simple things are easy in Google Test, while hard things are possible: in addition to advanced features like [global test environments](AdvancedGuide.md#global-set-up-and-tear-down) and tests parameterized by [values](AdvancedGuide.md#value-parameterized-tests) or [types](docs/AdvancedGuide.md#typed-tests), Google Test supports various ways for the user to extend the framework -- if Google Test doesn't do something out of the box, chances are that a user can implement the feature using Google Test's public API, without changing Google Test itself.  In particular, you can:
+    * expand your testing vocabulary by defining [custom predicates](AdvancedGuide.md#predicate-assertions-for-better-error-messages),
+    * teach Google Test how to [print your types](AdvancedGuide.md#teaching-google-test-how-to-print-your-values),
+    * define your own testing macros or utilities and verify them using Google Test's [Service Provider Interface](AdvancedGuide.md#catching-failures), and
+    * reflect on the test cases or change the test output format by intercepting the [test events](AdvancedGuide.md#extending-google-test-by-handling-test-events).
+
+## I'm getting warnings when compiling Google Test.  Would you fix them? ##
+
+We strive to minimize compiler warnings Google Test generates.  Before releasing a new version, we test to make sure that it doesn't generate warnings when compiled using its CMake script on Windows, Linux, and Mac OS.
+
+Unfortunately, this doesn't mean you are guaranteed to see no warnings when compiling Google Test in your environment:
+
+  * You may be using a different compiler as we use, or a different version of the same compiler.  We cannot possibly test for all compilers.
+  * You may be compiling on a different platform as we do.
+  * Your project may be using different compiler flags as we do.
+
+It is not always possible to make Google Test warning-free for everyone.  Or, it may not be desirable if the warning is rarely enabled and fixing the violations makes the code more complex.
+
+If you see warnings when compiling Google Test, we suggest that you use the `-isystem` flag (assuming your are using GCC) to mark Google Test headers as system headers.  That'll suppress warnings from Google Test headers.
+
+## Why should not test case names and test names contain underscore? ##
+
+Underscore (`_`) is special, as C++ reserves the following to be used by
+the compiler and the standard library:
+
+  1. any identifier that starts with an `_` followed by an upper-case letter, and
+  1. any identifier that containers two consecutive underscores (i.e. `__`) _anywhere_ in its name.
+
+User code is _prohibited_ from using such identifiers.
+
+Now let's look at what this means for `TEST` and `TEST_F`.
+
+Currently `TEST(TestCaseName, TestName)` generates a class named
+`TestCaseName_TestName_Test`.  What happens if `TestCaseName` or `TestName`
+contains `_`?
+
+  1. If `TestCaseName` starts with an `_` followed by an upper-case letter (say, `_Foo`), we end up with `_Foo_TestName_Test`, which is reserved and thus invalid.
+  1. If `TestCaseName` ends with an `_` (say, `Foo_`), we get `Foo__TestName_Test`, which is invalid.
+  1. If `TestName` starts with an `_` (say, `_Bar`), we get `TestCaseName__Bar_Test`, which is invalid.
+  1. If `TestName` ends with an `_` (say, `Bar_`), we get `TestCaseName_Bar__Test`, which is invalid.
+
+So clearly `TestCaseName` and `TestName` cannot start or end with `_`
+(Actually, `TestCaseName` can start with `_` -- as long as the `_` isn't
+followed by an upper-case letter.  But that's getting complicated.  So
+for simplicity we just say that it cannot start with `_`.).
+
+It may seem fine for `TestCaseName` and `TestName` to contain `_` in the
+middle.  However, consider this:
+``` cpp
+TEST(Time, Flies_Like_An_Arrow) { ... }
+TEST(Time_Flies, Like_An_Arrow) { ... }
+```
+
+Now, the two `TEST`s will both generate the same class
+(`Time_Files_Like_An_Arrow_Test`).  That's not good.
+
+So for simplicity, we just ask the users to avoid `_` in `TestCaseName`
+and `TestName`.  The rule is more constraining than necessary, but it's
+simple and easy to remember.  It also gives Google Test some wiggle
+room in case its implementation needs to change in the future.
+
+If you violate the rule, there may not be immediately consequences,
+but your test may (just may) break with a new compiler (or a new
+version of the compiler you are using) or with a new version of Google
+Test.  Therefore it's best to follow the rule.
+
+## Why is it not recommended to install a pre-compiled copy of Google Test (for example, into /usr/local)? ##
+
+In the early days, we said that you could install
+compiled Google Test libraries on `*`nix systems using `make install`.
+Then every user of your machine can write tests without
+recompiling Google Test.
+
+This seemed like a good idea, but it has a
+got-cha: every user needs to compile his tests using the _same_ compiler
+flags used to compile the installed Google Test libraries; otherwise
+he may run into undefined behaviors (i.e. the tests can behave
+strangely and may even crash for no obvious reasons).
+
+Why?  Because C++ has this thing called the One-Definition Rule: if
+two C++ source files contain different definitions of the same
+class/function/variable, and you link them together, you violate the
+rule.  The linker may or may not catch the error (in many cases it's
+not required by the C++ standard to catch the violation).  If it
+doesn't, you get strange run-time behaviors that are unexpected and
+hard to debug.
+
+If you compile Google Test and your test code using different compiler
+flags, they may see different definitions of the same
+class/function/variable (e.g. due to the use of `#if` in Google Test).
+Therefore, for your sanity, we recommend to avoid installing pre-compiled
+Google Test libraries.  Instead, each project should compile
+Google Test itself such that it can be sure that the same flags are
+used for both Google Test and the tests.
+
+## How do I generate 64-bit binaries on Windows (using Visual Studio 2008)? ##
+
+(Answered by Trevor Robinson)
+
+Load the supplied Visual Studio solution file, either `msvc\gtest-md.sln` or
+`msvc\gtest.sln`. Go through the migration wizard to migrate the
+solution and project files to Visual Studio 2008. Select
+`Configuration Manager...` from the `Build` menu. Select `<New...>` from
+the `Active solution platform` dropdown.  Select `x64` from the new
+platform dropdown, leave `Copy settings from` set to `Win32` and
+`Create new project platforms` checked, then click `OK`. You now have
+`Win32` and `x64` platform configurations, selectable from the
+`Standard` toolbar, which allow you to toggle between building 32-bit or
+64-bit binaries (or both at once using Batch Build).
+
+In order to prevent build output files from overwriting one another,
+you'll need to change the `Intermediate Directory` settings for the
+newly created platform configuration across all the projects. To do
+this, multi-select (e.g. using shift-click) all projects (but not the
+solution) in the `Solution Explorer`. Right-click one of them and
+select `Properties`. In the left pane, select `Configuration Properties`,
+and from the `Configuration` dropdown, select `All Configurations`.
+Make sure the selected platform is `x64`. For the
+`Intermediate Directory` setting, change the value from
+`$(PlatformName)\$(ConfigurationName)` to
+`$(OutDir)\$(ProjectName)`. Click `OK` and then build the
+solution. When the build is complete, the 64-bit binaries will be in
+the `msvc\x64\Debug` directory.
+
+## Can I use Google Test on MinGW? ##
+
+We haven't tested this ourselves, but Per Abrahamsen reported that he
+was able to compile and install Google Test successfully when using
+MinGW from Cygwin.  You'll need to configure it with:
+
+`PATH/TO/configure CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin"`
+
+You should be able to replace the `-mno-cygwin` option with direct links
+to the real MinGW binaries, but we haven't tried that.
+
+Caveats:
+
+  * There are many warnings when compiling.
+  * `make check` will produce some errors as not all tests for Google Test itself are compatible with MinGW.
+
+We also have reports on successful cross compilation of Google Test
+MinGW binaries on Linux using
+[these instructions](http://wiki.wxwidgets.org/Cross-Compiling_Under_Linux#Cross-compiling_under_Linux_for_MS_Windows)
+on the WxWidgets site.
+
+Please contact `googletestframework@googlegroups.com` if you are
+interested in improving the support for MinGW.
+
+## Why does Google Test support EXPECT\_EQ(NULL, ptr) and ASSERT\_EQ(NULL, ptr) but not EXPECT\_NE(NULL, ptr) and ASSERT\_NE(NULL, ptr)? ##
+
+Due to some peculiarity of C++, it requires some non-trivial template
+meta programming tricks to support using `NULL` as an argument of the
+`EXPECT_XX()` and `ASSERT_XX()` macros. Therefore we only do it where
+it's most needed (otherwise we make the implementation of Google Test
+harder to maintain and more error-prone than necessary).
+
+The `EXPECT_EQ()` macro takes the _expected_ value as its first
+argument and the _actual_ value as the second. It's reasonable that
+someone wants to write `EXPECT_EQ(NULL, some_expression)`, and this
+indeed was requested several times. Therefore we implemented it.
+
+The need for `EXPECT_NE(NULL, ptr)` isn't nearly as strong. When the
+assertion fails, you already know that `ptr` must be `NULL`, so it
+doesn't add any information to print ptr in this case. That means
+`EXPECT_TRUE(ptr != NULL)` works just as well.
+
+If we were to support `EXPECT_NE(NULL, ptr)`, for consistency we'll
+have to support `EXPECT_NE(ptr, NULL)` as well, as unlike `EXPECT_EQ`,
+we don't have a convention on the order of the two arguments for
+`EXPECT_NE`. This means using the template meta programming tricks
+twice in the implementation, making it even harder to understand and
+maintain. We believe the benefit doesn't justify the cost.
+
+Finally, with the growth of Google Mock's [matcher](../../googlemock/docs/CookBook.md#using-matchers-in-google-test-assertions) library, we are
+encouraging people to use the unified `EXPECT_THAT(value, matcher)`
+syntax more often in tests. One significant advantage of the matcher
+approach is that matchers can be easily combined to form new matchers,
+while the `EXPECT_NE`, etc, macros cannot be easily
+combined. Therefore we want to invest more in the matchers than in the
+`EXPECT_XX()` macros.
+
+## Does Google Test support running tests in parallel? ##
+
+Test runners tend to be tightly coupled with the build/test
+environment, and Google Test doesn't try to solve the problem of
+running tests in parallel.  Instead, we tried to make Google Test work
+nicely with test runners.  For example, Google Test's XML report
+contains the time spent on each test, and its `gtest_list_tests` and
+`gtest_filter` flags can be used for splitting the execution of test
+methods into multiple processes.  These functionalities can help the
+test runner run the tests in parallel.
+
+## Why don't Google Test run the tests in different threads to speed things up? ##
+
+It's difficult to write thread-safe code.  Most tests are not written
+with thread-safety in mind, and thus may not work correctly in a
+multi-threaded setting.
+
+If you think about it, it's already hard to make your code work when
+you know what other threads are doing.  It's much harder, and
+sometimes even impossible, to make your code work when you don't know
+what other threads are doing (remember that test methods can be added,
+deleted, or modified after your test was written).  If you want to run
+the tests in parallel, you'd better run them in different processes.
+
+## Why aren't Google Test assertions implemented using exceptions? ##
+
+Our original motivation was to be able to use Google Test in projects
+that disable exceptions.  Later we realized some additional benefits
+of this approach:
+
+  1. Throwing in a destructor is undefined behavior in C++.  Not using exceptions means Google Test's assertions are safe to use in destructors.
+  1. The `EXPECT_*` family of macros will continue even after a failure, allowing multiple failures in a `TEST` to be reported in a single run. This is a popular feature, as in C++ the edit-compile-test cycle is usually quite long and being able to fixing more than one thing at a time is a blessing.
+  1. If assertions are implemented using exceptions, a test may falsely ignore a failure if it's caught by user code:
+``` cpp
+try { ... ASSERT_TRUE(...) ... }
+catch (...) { ... }
+```
+The above code will pass even if the `ASSERT_TRUE` throws.  While it's unlikely for someone to write this in a test, it's possible to run into this pattern when you write assertions in callbacks that are called by the code under test.
+
+The downside of not using exceptions is that `ASSERT_*` (implemented
+using `return`) will only abort the current function, not the current
+`TEST`.
+
+## Why do we use two different macros for tests with and without fixtures? ##
+
+Unfortunately, C++'s macro system doesn't allow us to use the same
+macro for both cases.  One possibility is to provide only one macro
+for tests with fixtures, and require the user to define an empty
+fixture sometimes:
+
+``` cpp
+class FooTest : public ::testing::Test {};
+
+TEST_F(FooTest, DoesThis) { ... }
+```
+or
+``` cpp
+typedef ::testing::Test FooTest;
+
+TEST_F(FooTest, DoesThat) { ... }
+```
+
+Yet, many people think this is one line too many. :-) Our goal was to
+make it really easy to write tests, so we tried to make simple tests
+trivial to create.  That means using a separate macro for such tests.
+
+We think neither approach is ideal, yet either of them is reasonable.
+In the end, it probably doesn't matter much either way.
+
+## Why don't we use structs as test fixtures? ##
+
+We like to use structs only when representing passive data.  This
+distinction between structs and classes is good for documenting the
+intent of the code's author.  Since test fixtures have logic like
+`SetUp()` and `TearDown()`, they are better defined as classes.
+
+## Why are death tests implemented as assertions instead of using a test runner? ##
+
+Our goal was to make death tests as convenient for a user as C++
+possibly allows.  In particular:
+
+  * The runner-style requires to split the information into two pieces: the definition of the death test itself, and the specification for the runner on how to run the death test and what to expect.  The death test would be written in C++, while the runner spec may or may not be.  A user needs to carefully keep the two in sync. `ASSERT_DEATH(statement, expected_message)` specifies all necessary information in one place, in one language, without boilerplate code. It is very declarative.
+  * `ASSERT_DEATH` has a similar syntax and error-reporting semantics as other Google Test assertions, and thus is easy to learn.
+  * `ASSERT_DEATH` can be mixed with other assertions and other logic at your will.  You are not limited to one death test per test method. For example, you can write something like:
+``` cpp
+    if (FooCondition()) {
+      ASSERT_DEATH(Bar(), "blah");
+    } else {
+      ASSERT_EQ(5, Bar());
+    }
+```
+If you prefer one death test per test method, you can write your tests in that style too, but we don't want to impose that on the users.  The fewer artificial limitations the better.
+  * `ASSERT_DEATH` can reference local variables in the current function, and you can decide how many death tests you want based on run-time information.  For example,
+``` cpp
+    const int count = GetCount();  // Only known at run time.
+    for (int i = 1; i <= count; i++) {
+      ASSERT_DEATH({
+        double* buffer = new double[i];
+        ... initializes buffer ...
+        Foo(buffer, i)
+      }, "blah blah");
+    }
+```
+The runner-based approach tends to be more static and less flexible, or requires more user effort to get this kind of flexibility.
+
+Another interesting thing about `ASSERT_DEATH` is that it calls `fork()`
+to create a child process to run the death test.  This is lightening
+fast, as `fork()` uses copy-on-write pages and incurs almost zero
+overhead, and the child process starts from the user-supplied
+statement directly, skipping all global and local initialization and
+any code leading to the given statement.  If you launch the child
+process from scratch, it can take seconds just to load everything and
+start running if the test links to many libraries dynamically.
+
+## My death test modifies some state, but the change seems lost after the death test finishes. Why? ##
+
+Death tests (`EXPECT_DEATH`, etc) are executed in a sub-process s.t. the
+expected crash won't kill the test program (i.e. the parent process). As a
+result, any in-memory side effects they incur are observable in their
+respective sub-processes, but not in the parent process. You can think of them
+as running in a parallel universe, more or less.
+
+## The compiler complains about "undefined references" to some static const member variables, but I did define them in the class body. What's wrong? ##
+
+If your class has a static data member:
+
+``` cpp
+// foo.h
+class Foo {
+  ...
+  static const int kBar = 100;
+};
+```
+
+You also need to define it _outside_ of the class body in `foo.cc`:
+
+``` cpp
+const int Foo::kBar;  // No initializer here.
+```
+
+Otherwise your code is **invalid C++**, and may break in unexpected ways. In
+particular, using it in Google Test comparison assertions (`EXPECT_EQ`, etc)
+will generate an "undefined reference" linker error.
+
+## I have an interface that has several implementations. Can I write a set of tests once and repeat them over all the implementations? ##
+
+Google Test doesn't yet have good support for this kind of tests, or
+data-driven tests in general. We hope to be able to make improvements in this
+area soon.
+
+## Can I derive a test fixture from another? ##
+
+Yes.
+
+Each test fixture has a corresponding and same named test case. This means only
+one test case can use a particular fixture. Sometimes, however, multiple test
+cases may want to use the same or slightly different fixtures. For example, you
+may want to make sure that all of a GUI library's test cases don't leak
+important system resources like fonts and brushes.
+
+In Google Test, you share a fixture among test cases by putting the shared
+logic in a base test fixture, then deriving from that base a separate fixture
+for each test case that wants to use this common logic. You then use `TEST_F()`
+to write tests using each derived fixture.
+
+Typically, your code looks like this:
+
+``` cpp
+// Defines a base test fixture.
+class BaseTest : public ::testing::Test {
+  protected:
+   ...
+};
+
+// Derives a fixture FooTest from BaseTest.
+class FooTest : public BaseTest {
+  protected:
+    virtual void SetUp() {
+      BaseTest::SetUp();  // Sets up the base fixture first.
+      ... additional set-up work ...
+    }
+    virtual void TearDown() {
+      ... clean-up work for FooTest ...
+      BaseTest::TearDown();  // Remember to tear down the base fixture
+                             // after cleaning up FooTest!
+    }
+    ... functions and variables for FooTest ...
+};
+
+// Tests that use the fixture FooTest.
+TEST_F(FooTest, Bar) { ... }
+TEST_F(FooTest, Baz) { ... }
+
+... additional fixtures derived from BaseTest ...
+```
+
+If necessary, you can continue to derive test fixtures from a derived fixture.
+Google Test has no limit on how deep the hierarchy can be.
+
+For a complete example using derived test fixtures, see
+[sample5](../samples/sample5_unittest.cc).
+
+## My compiler complains "void value not ignored as it ought to be." What does this mean? ##
+
+You're probably using an `ASSERT_*()` in a function that doesn't return `void`.
+`ASSERT_*()` can only be used in `void` functions.
+
+## My death test hangs (or seg-faults). How do I fix it? ##
+
+In Google Test, death tests are run in a child process and the way they work is
+delicate. To write death tests you really need to understand how they work.
+Please make sure you have read this.
+
+In particular, death tests don't like having multiple threads in the parent
+process. So the first thing you can try is to eliminate creating threads
+outside of `EXPECT_DEATH()`.
+
+Sometimes this is impossible as some library you must use may be creating
+threads before `main()` is even reached. In this case, you can try to minimize
+the chance of conflicts by either moving as many activities as possible inside
+`EXPECT_DEATH()` (in the extreme case, you want to move everything inside), or
+leaving as few things as possible in it. Also, you can try to set the death
+test style to `"threadsafe"`, which is safer but slower, and see if it helps.
+
+If you go with thread-safe death tests, remember that they rerun the test
+program from the beginning in the child process. Therefore make sure your
+program can run side-by-side with itself and is deterministic.
+
+In the end, this boils down to good concurrent programming. You have to make
+sure that there is no race conditions or dead locks in your program. No silver
+bullet - sorry!
+
+## Should I use the constructor/destructor of the test fixture or the set-up/tear-down function? ##
+
+The first thing to remember is that Google Test does not reuse the
+same test fixture object across multiple tests. For each `TEST_F`,
+Google Test will create a fresh test fixture object, _immediately_
+call `SetUp()`, run the test body, call `TearDown()`, and then
+_immediately_ delete the test fixture object.
+
+When you need to write per-test set-up and tear-down logic, you have
+the choice between using the test fixture constructor/destructor or
+`SetUp()/TearDown()`. The former is usually preferred, as it has the
+following benefits:
+
+  * By initializing a member variable in the constructor, we have the option to make it `const`, which helps prevent accidental changes to its value and makes the tests more obviously correct.
+  * In case we need to subclass the test fixture class, the subclass' constructor is guaranteed to call the base class' constructor first, and the subclass' destructor is guaranteed to call the base class' destructor afterward. With `SetUp()/TearDown()`, a subclass may make the mistake of forgetting to call the base class' `SetUp()/TearDown()` or call them at the wrong moment.
+
+You may still want to use `SetUp()/TearDown()` in the following rare cases:
+  * If the tear-down operation could throw an exception, you must use `TearDown()` as opposed to the destructor, as throwing in a destructor leads to undefined behavior and usually will kill your program right away. Note that many standard libraries (like STL) may throw when exceptions are enabled in the compiler. Therefore you should prefer `TearDown()` if you want to write portable tests that work with or without exceptions.
+  * The assertion macros throw an exception when flag `--gtest_throw_on_failure` is specified. Therefore, you shouldn't use Google Test assertions in a destructor if you plan to run your tests with this flag.
+  * In a constructor or destructor, you cannot make a virtual function call on this object. (You can call a method declared as virtual, but it will be statically bound.) Therefore, if you need to call a method that will be overriden in a derived class, you have to use `SetUp()/TearDown()`.
+
+## The compiler complains "no matching function to call" when I use ASSERT\_PREDn. How do I fix it? ##
+
+If the predicate function you use in `ASSERT_PRED*` or `EXPECT_PRED*` is
+overloaded or a template, the compiler will have trouble figuring out which
+overloaded version it should use. `ASSERT_PRED_FORMAT*` and
+`EXPECT_PRED_FORMAT*` don't have this problem.
+
+If you see this error, you might want to switch to
+`(ASSERT|EXPECT)_PRED_FORMAT*`, which will also give you a better failure
+message. If, however, that is not an option, you can resolve the problem by
+explicitly telling the compiler which version to pick.
+
+For example, suppose you have
+
+``` cpp
+bool IsPositive(int n) {
+  return n > 0;
+}
+bool IsPositive(double x) {
+  return x > 0;
+}
+```
+
+you will get a compiler error if you write
+
+``` cpp
+EXPECT_PRED1(IsPositive, 5);
+```
+
+However, this will work:
+
+``` cpp
+EXPECT_PRED1(*static_cast<bool (*)(int)>*(IsPositive), 5);
+```
+
+(The stuff inside the angled brackets for the `static_cast` operator is the
+type of the function pointer for the `int`-version of `IsPositive()`.)
+
+As another example, when you have a template function
+
+``` cpp
+template <typename T>
+bool IsNegative(T x) {
+  return x < 0;
+}
+```
+
+you can use it in a predicate assertion like this:
+
+``` cpp
+ASSERT_PRED1(IsNegative*<int>*, -5);
+```
+
+Things are more interesting if your template has more than one parameters. The
+following won't compile:
+
+``` cpp
+ASSERT_PRED2(*GreaterThan<int, int>*, 5, 0);
+```
+
+
+as the C++ pre-processor thinks you are giving `ASSERT_PRED2` 4 arguments,
+which is one more than expected. The workaround is to wrap the predicate
+function in parentheses:
+
+``` cpp
+ASSERT_PRED2(*(GreaterThan<int, int>)*, 5, 0);
+```
+
+
+## My compiler complains about "ignoring return value" when I call RUN\_ALL\_TESTS(). Why? ##
+
+Some people had been ignoring the return value of `RUN_ALL_TESTS()`. That is,
+instead of
+
+``` cpp
+return RUN_ALL_TESTS();
+```
+
+they write
+
+``` cpp
+RUN_ALL_TESTS();
+```
+
+This is wrong and dangerous. A test runner needs to see the return value of
+`RUN_ALL_TESTS()` in order to determine if a test has passed. If your `main()`
+function ignores it, your test will be considered successful even if it has a
+Google Test assertion failure. Very bad.
+
+To help the users avoid this dangerous bug, the implementation of
+`RUN_ALL_TESTS()` causes gcc to raise this warning, when the return value is
+ignored. If you see this warning, the fix is simple: just make sure its value
+is used as the return value of `main()`.
+
+## My compiler complains that a constructor (or destructor) cannot return a value. What's going on? ##
+
+Due to a peculiarity of C++, in order to support the syntax for streaming
+messages to an `ASSERT_*`, e.g.
+
+``` cpp
+ASSERT_EQ(1, Foo()) << "blah blah" << foo;
+```
+
+we had to give up using `ASSERT*` and `FAIL*` (but not `EXPECT*` and
+`ADD_FAILURE*`) in constructors and destructors. The workaround is to move the
+content of your constructor/destructor to a private void member function, or
+switch to `EXPECT_*()` if that works. This section in the user's guide explains
+it.
+
+## My set-up function is not called. Why? ##
+
+C++ is case-sensitive. It should be spelled as `SetUp()`.  Did you
+spell it as `Setup()`?
+
+Similarly, sometimes people spell `SetUpTestCase()` as `SetupTestCase()` and
+wonder why it's never called.
+
+## How do I jump to the line of a failure in Emacs directly? ##
+
+Google Test's failure message format is understood by Emacs and many other
+IDEs, like acme and XCode. If a Google Test message is in a compilation buffer
+in Emacs, then it's clickable. You can now hit `enter` on a message to jump to
+the corresponding source code, or use `C-x `` to jump to the next failure.
+
+## I have several test cases which share the same test fixture logic, do I have to define a new test fixture class for each of them? This seems pretty tedious. ##
+
+You don't have to. Instead of
+
+``` cpp
+class FooTest : public BaseTest {};
+
+TEST_F(FooTest, Abc) { ... }
+TEST_F(FooTest, Def) { ... }
+
+class BarTest : public BaseTest {};
+
+TEST_F(BarTest, Abc) { ... }
+TEST_F(BarTest, Def) { ... }
+```
+
+you can simply `typedef` the test fixtures:
+``` cpp
+typedef BaseTest FooTest;
+
+TEST_F(FooTest, Abc) { ... }
+TEST_F(FooTest, Def) { ... }
+
+typedef BaseTest BarTest;
+
+TEST_F(BarTest, Abc) { ... }
+TEST_F(BarTest, Def) { ... }
+```
+
+## The Google Test output is buried in a whole bunch of log messages. What do I do? ##
+
+The Google Test output is meant to be a concise and human-friendly report. If
+your test generates textual output itself, it will mix with the Google Test
+output, making it hard to read. However, there is an easy solution to this
+problem.
+
+Since most log messages go to stderr, we decided to let Google Test output go
+to stdout. This way, you can easily separate the two using redirection. For
+example:
+```
+./my_test > googletest_output.txt
+```
+
+## Why should I prefer test fixtures over global variables? ##
+
+There are several good reasons:
+  1. It's likely your test needs to change the states of its global variables. This makes it difficult to keep side effects from escaping one test and contaminating others, making debugging difficult. By using fixtures, each test has a fresh set of variables that's different (but with the same names). Thus, tests are kept independent of each other.
+  1. Global variables pollute the global namespace.
+  1. Test fixtures can be reused via subclassing, which cannot be done easily with global variables. This is useful if many test cases have something in common.
+
+## How do I test private class members without writing FRIEND\_TEST()s? ##
+
+You should try to write testable code, which means classes should be easily
+tested from their public interface. One way to achieve this is the Pimpl idiom:
+you move all private members of a class into a helper class, and make all
+members of the helper class public.
+
+You have several other options that don't require using `FRIEND_TEST`:
+  * Write the tests as members of the fixture class:
+``` cpp
+class Foo {
+  friend class FooTest;
+  ...
+};
+
+class FooTest : public ::testing::Test {
+ protected:
+  ...
+  void Test1() {...} // This accesses private members of class Foo.
+  void Test2() {...} // So does this one.
+};
+
+TEST_F(FooTest, Test1) {
+  Test1();
+}
+
+TEST_F(FooTest, Test2) {
+  Test2();
+}
+```
+  * In the fixture class, write accessors for the tested class' private members, then use the accessors in your tests:
+``` cpp
+class Foo {
+  friend class FooTest;
+  ...
+};
+
+class FooTest : public ::testing::Test {
+ protected:
+  ...
+  T1 get_private_member1(Foo* obj) {
+    return obj->private_member1_;
+  }
+};
+
+TEST_F(FooTest, Test1) {
+  ...
+  get_private_member1(x)
+  ...
+}
+```
+  * If the methods are declared **protected**, you can change their access level in a test-only subclass:
+``` cpp
+class YourClass {
+  ...
+ protected: // protected access for testability.
+  int DoSomethingReturningInt();
+  ...
+};
+
+// in the your_class_test.cc file:
+class TestableYourClass : public YourClass {
+  ...
+ public: using YourClass::DoSomethingReturningInt; // changes access rights
+  ...
+};
+
+TEST_F(YourClassTest, DoSomethingTest) {
+  TestableYourClass obj;
+  assertEquals(expected_value, obj.DoSomethingReturningInt());
+}
+```
+
+## How do I test private class static members without writing FRIEND\_TEST()s? ##
+
+We find private static methods clutter the header file.  They are
+implementation details and ideally should be kept out of a .h. So often I make
+them free functions instead.
+
+Instead of:
+``` cpp
+// foo.h
+class Foo {
+  ...
+ private:
+  static bool Func(int n);
+};
+
+// foo.cc
+bool Foo::Func(int n) { ... }
+
+// foo_test.cc
+EXPECT_TRUE(Foo::Func(12345));
+```
+
+You probably should better write:
+``` cpp
+// foo.h
+class Foo {
+  ...
+};
+
+// foo.cc
+namespace internal {
+  bool Func(int n) { ... }
+}
+
+// foo_test.cc
+namespace internal {
+  bool Func(int n);
+}
+
+EXPECT_TRUE(internal::Func(12345));
+```
+
+## I would like to run a test several times with different parameters. Do I need to write several similar copies of it? ##
+
+No. You can use a feature called [value-parameterized tests](AdvancedGuide.md#Value_Parameterized_Tests) which
+lets you repeat your tests with different parameters, without defining it more than once.
+
+## How do I test a file that defines main()? ##
+
+To test a `foo.cc` file, you need to compile and link it into your unit test
+program. However, when the file contains a definition for the `main()`
+function, it will clash with the `main()` of your unit test, and will result in
+a build error.
+
+The right solution is to split it into three files:
+  1. `foo.h` which contains the declarations,
+  1. `foo.cc` which contains the definitions except `main()`, and
+  1. `foo_main.cc` which contains nothing but the definition of `main()`.
+
+Then `foo.cc` can be easily tested.
+
+If you are adding tests to an existing file and don't want an intrusive change
+like this, there is a hack: just include the entire `foo.cc` file in your unit
+test. For example:
+``` cpp
+// File foo_unittest.cc
+
+// The headers section
+...
+
+// Renames main() in foo.cc to make room for the unit test main()
+#define main FooMain
+
+#include "a/b/foo.cc"
+
+// The tests start here.
+...
+```
+
+
+However, please remember this is a hack and should only be used as the last
+resort.
+
+## What can the statement argument in ASSERT\_DEATH() be? ##
+
+`ASSERT_DEATH(_statement_, _regex_)` (or any death assertion macro) can be used
+wherever `_statement_` is valid. So basically `_statement_` can be any C++
+statement that makes sense in the current context. In particular, it can
+reference global and/or local variables, and can be:
+  * a simple function call (often the case),
+  * a complex expression, or
+  * a compound statement.
+
+Some examples are shown here:
+
+``` cpp
+// A death test can be a simple function call.
+TEST(MyDeathTest, FunctionCall) {
+  ASSERT_DEATH(Xyz(5), "Xyz failed");
+}
+
+// Or a complex expression that references variables and functions.
+TEST(MyDeathTest, ComplexExpression) {
+  const bool c = Condition();
+  ASSERT_DEATH((c ? Func1(0) : object2.Method("test")),
+               "(Func1|Method) failed");
+}
+
+// Death assertions can be used any where in a function. In
+// particular, they can be inside a loop.
+TEST(MyDeathTest, InsideLoop) {
+  // Verifies that Foo(0), Foo(1), ..., and Foo(4) all die.
+  for (int i = 0; i < 5; i++) {
+    EXPECT_DEATH_M(Foo(i), "Foo has \\d+ errors",
+                   ::testing::Message() << "where i is " << i);
+  }
+}
+
+// A death assertion can contain a compound statement.
+TEST(MyDeathTest, CompoundStatement) {
+  // Verifies that at lease one of Bar(0), Bar(1), ..., and
+  // Bar(4) dies.
+  ASSERT_DEATH({
+    for (int i = 0; i < 5; i++) {
+      Bar(i);
+    }
+  },
+  "Bar has \\d+ errors");}
+```
+
+`googletest_unittest.cc` contains more examples if you are interested.
+
+## What syntax does the regular expression in ASSERT\_DEATH use? ##
+
+On POSIX systems, Google Test uses the POSIX Extended regular
+expression syntax
+(http://en.wikipedia.org/wiki/Regular_expression#POSIX_Extended_Regular_Expressions).
+On Windows, it uses a limited variant of regular expression
+syntax. For more details, see the
+[regular expression syntax](AdvancedGuide.md#Regular_Expression_Syntax).
+
+## I have a fixture class Foo, but TEST\_F(Foo, Bar) gives me error "no matching function for call to Foo::Foo()". Why? ##
+
+Google Test needs to be able to create objects of your test fixture class, so
+it must have a default constructor. Normally the compiler will define one for
+you. However, there are cases where you have to define your own:
+  * If you explicitly declare a non-default constructor for class `Foo`, then you need to define a default constructor, even if it would be empty.
+  * If `Foo` has a const non-static data member, then you have to define the default constructor _and_ initialize the const member in the initializer list of the constructor. (Early versions of `gcc` doesn't force you to initialize the const member. It's a bug that has been fixed in `gcc 4`.)
+
+## Why does ASSERT\_DEATH complain about previous threads that were already joined? ##
+
+With the Linux pthread library, there is no turning back once you cross the
+line from single thread to multiple threads. The first time you create a
+thread, a manager thread is created in addition, so you get 3, not 2, threads.
+Later when the thread you create joins the main thread, the thread count
+decrements by 1, but the manager thread will never be killed, so you still have
+2 threads, which means you cannot safely run a death test.
+
+The new NPTL thread library doesn't suffer from this problem, as it doesn't
+create a manager thread. However, if you don't control which machine your test
+runs on, you shouldn't depend on this.
+
+## Why does Google Test require the entire test case, instead of individual tests, to be named FOODeathTest when it uses ASSERT\_DEATH? ##
+
+Google Test does not interleave tests from different test cases. That is, it
+runs all tests in one test case first, and then runs all tests in the next test
+case, and so on. Google Test does this because it needs to set up a test case
+before the first test in it is run, and tear it down afterwords. Splitting up
+the test case would require multiple set-up and tear-down processes, which is
+inefficient and makes the semantics unclean.
+
+If we were to determine the order of tests based on test name instead of test
+case name, then we would have a problem with the following situation:
+
+``` cpp
+TEST_F(FooTest, AbcDeathTest) { ... }
+TEST_F(FooTest, Uvw) { ... }
+
+TEST_F(BarTest, DefDeathTest) { ... }
+TEST_F(BarTest, Xyz) { ... }
+```
+
+Since `FooTest.AbcDeathTest` needs to run before `BarTest.Xyz`, and we don't
+interleave tests from different test cases, we need to run all tests in the
+`FooTest` case before running any test in the `BarTest` case. This contradicts
+with the requirement to run `BarTest.DefDeathTest` before `FooTest.Uvw`.
+
+## But I don't like calling my entire test case FOODeathTest when it contains both death tests and non-death tests. What do I do? ##
+
+You don't have to, but if you like, you may split up the test case into
+`FooTest` and `FooDeathTest`, where the names make it clear that they are
+related:
+
+``` cpp
+class FooTest : public ::testing::Test { ... };
+
+TEST_F(FooTest, Abc) { ... }
+TEST_F(FooTest, Def) { ... }
+
+typedef FooTest FooDeathTest;
+
+TEST_F(FooDeathTest, Uvw) { ... EXPECT_DEATH(...) ... }
+TEST_F(FooDeathTest, Xyz) { ... ASSERT_DEATH(...) ... }
+```
+
+## The compiler complains about "no match for 'operator<<'" when I use an assertion. What gives? ##
+
+If you use a user-defined type `FooType` in an assertion, you must make sure
+there is an `std::ostream& operator<<(std::ostream&, const FooType&)` function
+defined such that we can print a value of `FooType`.
+
+In addition, if `FooType` is declared in a name space, the `<<` operator also
+needs to be defined in the _same_ name space.
+
+## How do I suppress the memory leak messages on Windows? ##
+
+Since the statically initialized Google Test singleton requires allocations on
+the heap, the Visual C++ memory leak detector will report memory leaks at the
+end of the program run. The easiest way to avoid this is to use the
+`_CrtMemCheckpoint` and `_CrtMemDumpAllObjectsSince` calls to not report any
+statically initialized heap objects. See MSDN for more details and additional
+heap check/debug routines.
+
+## I am building my project with Google Test in Visual Studio and all I'm getting is a bunch of linker errors (or warnings). Help! ##
+
+You may get a number of the following linker error or warnings if you
+attempt to link your test project with the Google Test library when
+your project and the are not built using the same compiler settings.
+
+  * LNK2005: symbol already defined in object
+  * LNK4217: locally defined symbol 'symbol' imported in function 'function'
+  * LNK4049: locally defined symbol 'symbol' imported
+
+The Google Test project (gtest.vcproj) has the Runtime Library option
+set to /MT (use multi-threaded static libraries, /MTd for debug). If
+your project uses something else, for example /MD (use multi-threaded
+DLLs, /MDd for debug), you need to change the setting in the Google
+Test project to match your project's.
+
+To update this setting open the project properties in the Visual
+Studio IDE then select the branch Configuration Properties | C/C++ |
+Code Generation and change the option "Runtime Library".  You may also try
+using gtest-md.vcproj instead of gtest.vcproj.
+
+## I put my tests in a library and Google Test doesn't run them. What's happening? ##
+Have you read a
+[warning](Primer.md#important-note-for-visual-c-users) on
+the Google Test Primer page?
+
+## I want to use Google Test with Visual Studio but don't know where to start. ##
+Many people are in your position and one of the posted his solution to
+our mailing list.
+
+## I am seeing compile errors mentioning std::type\_traits when I try to use Google Test on Solaris. ##
+Google Test uses parts of the standard C++ library that SunStudio does not support.
+Our users reported success using alternative implementations. Try running the build after runing this commad:
+
+`export CC=cc CXX=CC CXXFLAGS='-library=stlport4'`
+
+## How can my code detect if it is running in a test? ##
+
+If you write code that sniffs whether it's running in a test and does
+different things accordingly, you are leaking test-only logic into
+production code and there is no easy way to ensure that the test-only
+code paths aren't run by mistake in production.  Such cleverness also
+leads to
+[Heisenbugs](http://en.wikipedia.org/wiki/Unusual_software_bug#Heisenbug).
+Therefore we strongly advise against the practice, and Google Test doesn't
+provide a way to do it.
+
+In general, the recommended way to cause the code to behave
+differently under test is [dependency injection](http://jamesshore.com/Blog/Dependency-Injection-Demystified.html).
+You can inject different functionality from the test and from the
+production code.  Since your production code doesn't link in the
+for-test logic at all, there is no danger in accidentally running it.
+
+However, if you _really_, _really_, _really_ have no choice, and if
+you follow the rule of ending your test program names with `_test`,
+you can use the _horrible_ hack of sniffing your executable name
+(`argv[0]` in `main()`) to know whether the code is under test.
+
+## Google Test defines a macro that clashes with one defined by another library. How do I deal with that? ##
+
+In C++, macros don't obey namespaces.  Therefore two libraries that
+both define a macro of the same name will clash if you `#include` both
+definitions.  In case a Google Test macro clashes with another
+library, you can force Google Test to rename its macro to avoid the
+conflict.
+
+Specifically, if both Google Test and some other code define macro
+`FOO`, you can add
+```
+  -DGTEST_DONT_DEFINE_FOO=1
+```
+to the compiler flags to tell Google Test to change the macro's name
+from `FOO` to `GTEST_FOO`. For example, with `-DGTEST_DONT_DEFINE_TEST=1`, you'll need to write
+``` cpp
+  GTEST_TEST(SomeTest, DoesThis) { ... }
+```
+instead of
+``` cpp
+  TEST(SomeTest, DoesThis) { ... }
+```
+in order to define a test.
+
+Currently, the following `TEST`, `FAIL`, `SUCCEED`, and the basic comparison assertion macros can have alternative names. You can see the full list of covered macros [here](http://www.google.com/codesearch?q=if+!GTEST_DONT_DEFINE_\w%2B+package:http://googletest\.googlecode\.com+file:/include/gtest/gtest.h). More information can be found in the "Avoiding Macro Name Clashes" section of the README file.
+
+
+## Is it OK if I have two separate `TEST(Foo, Bar)` test methods defined in different namespaces? ##
+
+Yes.
+
+The rule is **all test methods in the same test case must use the same fixture class**. This means that the following is **allowed** because both tests use the same fixture class (`::testing::Test`).
+
+``` cpp
+namespace foo {
+TEST(CoolTest, DoSomething) {
+  SUCCEED();
+}
+}  // namespace foo
+
+namespace bar {
+TEST(CoolTest, DoSomething) {
+  SUCCEED();
+}
+}  // namespace foo
+```
+
+However, the following code is **not allowed** and will produce a runtime error from Google Test because the test methods are using different test fixture classes with the same test case name.
+
+``` cpp
+namespace foo {
+class CoolTest : public ::testing::Test {};  // Fixture foo::CoolTest
+TEST_F(CoolTest, DoSomething) {
+  SUCCEED();
+}
+}  // namespace foo
+
+namespace bar {
+class CoolTest : public ::testing::Test {};  // Fixture: bar::CoolTest
+TEST_F(CoolTest, DoSomething) {
+  SUCCEED();
+}
+}  // namespace foo
+```
+
+## How do I build Google Testing Framework with Xcode 4? ##
+
+If you try to build Google Test's Xcode project with Xcode 4.0 or later, you may encounter an error message that looks like
+"Missing SDK in target gtest\_framework: /Developer/SDKs/MacOSX10.4u.sdk". That means that Xcode does not support the SDK the project is targeting. See the Xcode section in the [README](../README.md) file on how to resolve this.
+
+## My question is not covered in your FAQ! ##
+
+If you cannot find the answer to your question in this FAQ, there are
+some other resources you can use:
+
+  1. read other [wiki pages](../docs),
+  1. search the mailing list [archive](https://groups.google.com/forum/#!forum/googletestframework),
+  1. ask it on [googletestframework@googlegroups.com](mailto:googletestframework@googlegroups.com) and someone will answer it (to prevent spam, we require you to join the [discussion group](http://groups.google.com/group/googletestframework) before you can post.).
+
+Please note that creating an issue in the
+[issue tracker](https://github.com/google/googletest/issues) is _not_
+a good way to get your answer, as it is monitored infrequently by a
+very small number of people.
+
+When asking a question, it's helpful to provide as much of the
+following information as possible (people cannot help you if there's
+not enough information in your question):
+
+  * the version (or the commit hash if you check out from Git directly) of Google Test you use (Google Test is under active development, so it's possible that your problem has been solved in a later version),
+  * your operating system,
+  * the name and version of your compiler,
+  * the complete command line flags you give to your compiler,
+  * the complete compiler error messages (if the question is about compilation),
+  * the _actual_ code (ideally, a minimal but complete program) that has the problem you encounter.
diff --git a/docs/Primer.md b/docs/Primer.md
new file mode 100755 (executable)
index 0000000..474c1d2
--- /dev/null
@@ -0,0 +1,502 @@
+
+
+# Introduction: Why Google C++ Testing Framework? #
+
+_Google C++ Testing Framework_ helps you write better C++ tests.
+
+No matter whether you work on Linux, Windows, or a Mac, if you write C++ code,
+Google Test can help you.
+
+So what makes a good test, and how does Google C++ Testing Framework fit in? We believe:
+  1. Tests should be _independent_ and _repeatable_. It's a pain to debug a test that succeeds or fails as a result of other tests.  Google C++ Testing Framework isolates the tests by running each of them on a different object. When a test fails, Google C++ Testing Framework allows you to run it in isolation for quick debugging.
+  1. Tests should be well _organized_ and reflect the structure of the tested code.  Google C++ Testing Framework groups related tests into test cases that can share data and subroutines. This common pattern is easy to recognize and makes tests easy to maintain. Such consistency is especially helpful when people switch projects and start to work on a new code base.
+  1. Tests should be _portable_ and _reusable_. The open-source community has a lot of code that is platform-neutral, its tests should also be platform-neutral.  Google C++ Testing Framework works on different OSes, with different compilers (gcc, MSVC, and others), with or without exceptions, so Google C++ Testing Framework tests can easily work with a variety of configurations.  (Note that the current release only contains build scripts for Linux - we are actively working on scripts for other platforms.)
+  1. When tests fail, they should provide as much _information_ about the problem as possible. Google C++ Testing Framework doesn't stop at the first test failure. Instead, it only stops the current test and continues with the next. You can also set up tests that report non-fatal failures after which the current test continues. Thus, you can detect and fix multiple bugs in a single run-edit-compile cycle.
+  1. The testing framework should liberate test writers from housekeeping chores and let them focus on the test _content_.  Google C++ Testing Framework automatically keeps track of all tests defined, and doesn't require the user to enumerate them in order to run them.
+  1. Tests should be _fast_. With Google C++ Testing Framework, you can reuse shared resources across tests and pay for the set-up/tear-down only once, without making tests depend on each other.
+
+Since Google C++ Testing Framework is based on the popular xUnit
+architecture, you'll feel right at home if you've used JUnit or PyUnit before.
+If not, it will take you about 10 minutes to learn the basics and get started.
+So let's go!
+
+_Note:_ We sometimes refer to Google C++ Testing Framework informally
+as _Google Test_.
+
+# Setting up a New Test Project #
+
+To write a test program using Google Test, you need to compile Google
+Test into a library and link your test with it.  We provide build
+files for some popular build systems: `msvc/` for Visual Studio,
+`xcode/` for Mac Xcode, `make/` for GNU make, `codegear/` for Borland
+C++ Builder, and the autotools script (deprecated) and
+`CMakeLists.txt` for CMake (recommended) in the Google Test root
+directory.  If your build system is not on this list, you can take a
+look at `make/Makefile` to learn how Google Test should be compiled
+(basically you want to compile `src/gtest-all.cc` with `GTEST_ROOT`
+and `GTEST_ROOT/include` in the header search path, where `GTEST_ROOT`
+is the Google Test root directory).
+
+Once you are able to compile the Google Test library, you should
+create a project or build target for your test program.  Make sure you
+have `GTEST_ROOT/include` in the header search path so that the
+compiler can find `"gtest/gtest.h"` when compiling your test.  Set up
+your test project to link with the Google Test library (for example,
+in Visual Studio, this is done by adding a dependency on
+`gtest.vcproj`).
+
+If you still have questions, take a look at how Google Test's own
+tests are built and use them as examples.
+
+# Basic Concepts #
+
+When using Google Test, you start by writing _assertions_, which are statements
+that check whether a condition is true. An assertion's result can be _success_,
+_nonfatal failure_, or _fatal failure_. If a fatal failure occurs, it aborts
+the current function; otherwise the program continues normally.
+
+_Tests_ use assertions to verify the tested code's behavior. If a test crashes
+or has a failed assertion, then it _fails_; otherwise it _succeeds_.
+
+A _test case_ contains one or many tests. You should group your tests into test
+cases that reflect the structure of the tested code. When multiple tests in a
+test case need to share common objects and subroutines, you can put them into a
+_test fixture_ class.
+
+A _test program_ can contain multiple test cases.
+
+We'll now explain how to write a test program, starting at the individual
+assertion level and building up to tests and test cases.
+
+# Assertions #
+
+Google Test assertions are macros that resemble function calls. You test a
+class or function by making assertions about its behavior. When an assertion
+fails, Google Test prints the assertion's source file and line number location,
+along with a failure message. You may also supply a custom failure message
+which will be appended to Google Test's message.
+
+The assertions come in pairs that test the same thing but have different
+effects on the current function. `ASSERT_*` versions generate fatal failures
+when they fail, and **abort the current function**. `EXPECT_*` versions generate
+nonfatal failures, which don't abort the current function. Usually `EXPECT_*`
+are preferred, as they allow more than one failures to be reported in a test.
+However, you should use `ASSERT_*` if it doesn't make sense to continue when
+the assertion in question fails.
+
+Since a failed `ASSERT_*` returns from the current function immediately,
+possibly skipping clean-up code that comes after it, it may cause a space leak.
+Depending on the nature of the leak, it may or may not be worth fixing - so
+keep this in mind if you get a heap checker error in addition to assertion
+errors.
+
+To provide a custom failure message, simply stream it into the macro using the
+`<<` operator, or a sequence of such operators. An example:
+```
+ASSERT_EQ(x.size(), y.size()) << "Vectors x and y are of unequal length";
+
+for (int i = 0; i < x.size(); ++i) {
+  EXPECT_EQ(x[i], y[i]) << "Vectors x and y differ at index " << i;
+}
+```
+
+Anything that can be streamed to an `ostream` can be streamed to an assertion
+macro--in particular, C strings and `string` objects. If a wide string
+(`wchar_t*`, `TCHAR*` in `UNICODE` mode on Windows, or `std::wstring`) is
+streamed to an assertion, it will be translated to UTF-8 when printed.
+
+## Basic Assertions ##
+
+These assertions do basic true/false condition testing.
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_TRUE(`_condition_`)`;  | `EXPECT_TRUE(`_condition_`)`;   | _condition_ is true |
+| `ASSERT_FALSE(`_condition_`)`; | `EXPECT_FALSE(`_condition_`)`;  | _condition_ is false |
+
+Remember, when they fail, `ASSERT_*` yields a fatal failure and
+returns from the current function, while `EXPECT_*` yields a nonfatal
+failure, allowing the function to continue running. In either case, an
+assertion failure means its containing test fails.
+
+_Availability_: Linux, Windows, Mac.
+
+## Binary Comparison ##
+
+This section describes assertions that compare two values.
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+|`ASSERT_EQ(`_val1_`, `_val2_`);`|`EXPECT_EQ(`_val1_`, `_val2_`);`| _val1_ `==` _val2_ |
+|`ASSERT_NE(`_val1_`, `_val2_`);`|`EXPECT_NE(`_val1_`, `_val2_`);`| _val1_ `!=` _val2_ |
+|`ASSERT_LT(`_val1_`, `_val2_`);`|`EXPECT_LT(`_val1_`, `_val2_`);`| _val1_ `<` _val2_ |
+|`ASSERT_LE(`_val1_`, `_val2_`);`|`EXPECT_LE(`_val1_`, `_val2_`);`| _val1_ `<=` _val2_ |
+|`ASSERT_GT(`_val1_`, `_val2_`);`|`EXPECT_GT(`_val1_`, `_val2_`);`| _val1_ `>` _val2_ |
+|`ASSERT_GE(`_val1_`, `_val2_`);`|`EXPECT_GE(`_val1_`, `_val2_`);`| _val1_ `>=` _val2_ |
+
+In the event of a failure, Google Test prints both _val1_ and _val2_.
+
+Value arguments must be comparable by the assertion's comparison
+operator or you'll get a compiler error.  We used to require the
+arguments to support the `<<` operator for streaming to an `ostream`,
+but it's no longer necessary since v1.6.0 (if `<<` is supported, it
+will be called to print the arguments when the assertion fails;
+otherwise Google Test will attempt to print them in the best way it
+can. For more details and how to customize the printing of the
+arguments, see this Google Mock [recipe](../../googlemock/docs/CookBook.md#teaching-google-mock-how-to-print-your-values).).
+
+These assertions can work with a user-defined type, but only if you define the
+corresponding comparison operator (e.g. `==`, `<`, etc).  If the corresponding
+operator is defined, prefer using the `ASSERT_*()` macros because they will
+print out not only the result of the comparison, but the two operands as well.
+
+Arguments are always evaluated exactly once. Therefore, it's OK for the
+arguments to have side effects. However, as with any ordinary C/C++ function,
+the arguments' evaluation order is undefined (i.e. the compiler is free to
+choose any order) and your code should not depend on any particular argument
+evaluation order.
+
+`ASSERT_EQ()` does pointer equality on pointers. If used on two C strings, it
+tests if they are in the same memory location, not if they have the same value.
+Therefore, if you want to compare C strings (e.g. `const char*`) by value, use
+`ASSERT_STREQ()` , which will be described later on. In particular, to assert
+that a C string is `NULL`, use `ASSERT_STREQ(NULL, c_string)` . However, to
+compare two `string` objects, you should use `ASSERT_EQ`.
+
+Macros in this section work with both narrow and wide string objects (`string`
+and `wstring`).
+
+_Availability_: Linux, Windows, Mac.
+
+_Historical note_: Before February 2016 `*_EQ` had a convention of calling it as
+`ASSERT_EQ(expected, actual)`, so lots of existing code uses this order.
+Now `*_EQ` treats both parameters in the same way.
+
+## String Comparison ##
+
+The assertions in this group compare two **C strings**. If you want to compare
+two `string` objects, use `EXPECT_EQ`, `EXPECT_NE`, and etc instead.
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_STREQ(`_str1_`, `_str2_`);`    | `EXPECT_STREQ(`_str1_`, `_str_2`);`     | the two C strings have the same content |
+| `ASSERT_STRNE(`_str1_`, `_str2_`);`    | `EXPECT_STRNE(`_str1_`, `_str2_`);`     | the two C strings have different content |
+| `ASSERT_STRCASEEQ(`_str1_`, `_str2_`);`| `EXPECT_STRCASEEQ(`_str1_`, `_str2_`);` | the two C strings have the same content, ignoring case |
+| `ASSERT_STRCASENE(`_str1_`, `_str2_`);`| `EXPECT_STRCASENE(`_str1_`, `_str2_`);` | the two C strings have different content, ignoring case |
+
+Note that "CASE" in an assertion name means that case is ignored.
+
+`*STREQ*` and `*STRNE*` also accept wide C strings (`wchar_t*`). If a
+comparison of two wide strings fails, their values will be printed as UTF-8
+narrow strings.
+
+A `NULL` pointer and an empty string are considered _different_.
+
+_Availability_: Linux, Windows, Mac.
+
+See also: For more string comparison tricks (substring, prefix, suffix, and
+regular expression matching, for example), see the [Advanced Google Test Guide](AdvancedGuide.md).
+
+# Simple Tests #
+
+To create a test:
+  1. Use the `TEST()` macro to define and name a test function, These are ordinary C++ functions that don't return a value.
+  1. In this function, along with any valid C++ statements you want to include, use the various Google Test assertions to check values.
+  1. The test's result is determined by the assertions; if any assertion in the test fails (either fatally or non-fatally), or if the test crashes, the entire test fails. Otherwise, it succeeds.
+
+```
+TEST(test_case_name, test_name) {
+ ... test body ...
+}
+```
+
+
+`TEST()` arguments go from general to specific. The _first_ argument is the
+name of the test case, and the _second_ argument is the test's name within the
+test case. Both names must be valid C++ identifiers, and they should not contain underscore (`_`). A test's _full name_ consists of its containing test case and its
+individual name. Tests from different test cases can have the same individual
+name.
+
+For example, let's take a simple integer function:
+```
+int Factorial(int n); // Returns the factorial of n
+```
+
+A test case for this function might look like:
+```
+// Tests factorial of 0.
+TEST(FactorialTest, HandlesZeroInput) {
+  EXPECT_EQ(1, Factorial(0));
+}
+
+// Tests factorial of positive numbers.
+TEST(FactorialTest, HandlesPositiveInput) {
+  EXPECT_EQ(1, Factorial(1));
+  EXPECT_EQ(2, Factorial(2));
+  EXPECT_EQ(6, Factorial(3));
+  EXPECT_EQ(40320, Factorial(8));
+}
+```
+
+Google Test groups the test results by test cases, so logically-related tests
+should be in the same test case; in other words, the first argument to their
+`TEST()` should be the same. In the above example, we have two tests,
+`HandlesZeroInput` and `HandlesPositiveInput`, that belong to the same test
+case `FactorialTest`.
+
+_Availability_: Linux, Windows, Mac.
+
+# Test Fixtures: Using the Same Data Configuration for Multiple Tests #
+
+If you find yourself writing two or more tests that operate on similar data,
+you can use a _test fixture_. It allows you to reuse the same configuration of
+objects for several different tests.
+
+To create a fixture, just:
+  1. Derive a class from `::testing::Test` . Start its body with `protected:` or `public:` as we'll want to access fixture members from sub-classes.
+  1. Inside the class, declare any objects you plan to use.
+  1. If necessary, write a default constructor or `SetUp()` function to prepare the objects for each test. A common mistake is to spell `SetUp()` as `Setup()` with a small `u` - don't let that happen to you.
+  1. If necessary, write a destructor or `TearDown()` function to release any resources you allocated in `SetUp()` . To learn when you should use the constructor/destructor and when you should use `SetUp()/TearDown()`, read this [FAQ entry](FAQ.md#should-i-use-the-constructordestructor-of-the-test-fixture-or-the-set-uptear-down-function).
+  1. If needed, define subroutines for your tests to share.
+
+When using a fixture, use `TEST_F()` instead of `TEST()` as it allows you to
+access objects and subroutines in the test fixture:
+```
+TEST_F(test_case_name, test_name) {
+ ... test body ...
+}
+```
+
+Like `TEST()`, the first argument is the test case name, but for `TEST_F()`
+this must be the name of the test fixture class. You've probably guessed: `_F`
+is for fixture.
+
+Unfortunately, the C++ macro system does not allow us to create a single macro
+that can handle both types of tests. Using the wrong macro causes a compiler
+error.
+
+Also, you must first define a test fixture class before using it in a
+`TEST_F()`, or you'll get the compiler error "`virtual outside class
+declaration`".
+
+For each test defined with `TEST_F()`, Google Test will:
+  1. Create a _fresh_ test fixture at runtime
+  1. Immediately initialize it via `SetUp()` ,
+  1. Run the test
+  1. Clean up by calling `TearDown()`
+  1. Delete the test fixture.  Note that different tests in the same test case have different test fixture objects, and Google Test always deletes a test fixture before it creates the next one. Google Test does not reuse the same test fixture for multiple tests. Any changes one test makes to the fixture do not affect other tests.
+
+As an example, let's write tests for a FIFO queue class named `Queue`, which
+has the following interface:
+```
+template <typename E> // E is the element type.
+class Queue {
+ public:
+  Queue();
+  void Enqueue(const E& element);
+  E* Dequeue(); // Returns NULL if the queue is empty.
+  size_t size() const;
+  ...
+};
+```
+
+First, define a fixture class. By convention, you should give it the name
+`FooTest` where `Foo` is the class being tested.
+```
+class QueueTest : public ::testing::Test {
+ protected:
+  virtual void SetUp() {
+    q1_.Enqueue(1);
+    q2_.Enqueue(2);
+    q2_.Enqueue(3);
+  }
+
+  // virtual void TearDown() {}
+
+  Queue<int> q0_;
+  Queue<int> q1_;
+  Queue<int> q2_;
+};
+```
+
+In this case, `TearDown()` is not needed since we don't have to clean up after
+each test, other than what's already done by the destructor.
+
+Now we'll write tests using `TEST_F()` and this fixture.
+```
+TEST_F(QueueTest, IsEmptyInitially) {
+  EXPECT_EQ(0, q0_.size());
+}
+
+TEST_F(QueueTest, DequeueWorks) {
+  int* n = q0_.Dequeue();
+  EXPECT_EQ(NULL, n);
+
+  n = q1_.Dequeue();
+  ASSERT_TRUE(n != NULL);
+  EXPECT_EQ(1, *n);
+  EXPECT_EQ(0, q1_.size());
+  delete n;
+
+  n = q2_.Dequeue();
+  ASSERT_TRUE(n != NULL);
+  EXPECT_EQ(2, *n);
+  EXPECT_EQ(1, q2_.size());
+  delete n;
+}
+```
+
+The above uses both `ASSERT_*` and `EXPECT_*` assertions. The rule of thumb is
+to use `EXPECT_*` when you want the test to continue to reveal more errors
+after the assertion failure, and use `ASSERT_*` when continuing after failure
+doesn't make sense. For example, the second assertion in the `Dequeue` test is
+`ASSERT_TRUE(n != NULL)`, as we need to dereference the pointer `n` later,
+which would lead to a segfault when `n` is `NULL`.
+
+When these tests run, the following happens:
+  1. Google Test constructs a `QueueTest` object (let's call it `t1` ).
+  1. `t1.SetUp()` initializes `t1` .
+  1. The first test ( `IsEmptyInitially` ) runs on `t1` .
+  1. `t1.TearDown()` cleans up after the test finishes.
+  1. `t1` is destructed.
+  1. The above steps are repeated on another `QueueTest` object, this time running the `DequeueWorks` test.
+
+_Availability_: Linux, Windows, Mac.
+
+_Note_: Google Test automatically saves all _Google Test_ flags when a test
+object is constructed, and restores them when it is destructed.
+
+# Invoking the Tests #
+
+`TEST()` and `TEST_F()` implicitly register their tests with Google Test. So, unlike with many other C++ testing frameworks, you don't have to re-list all your defined tests in order to run them.
+
+After defining your tests, you can run them with `RUN_ALL_TESTS()` , which returns `0` if all the tests are successful, or `1` otherwise. Note that `RUN_ALL_TESTS()` runs _all tests_ in your link unit -- they can be from different test cases, or even different source files.
+
+When invoked, the `RUN_ALL_TESTS()` macro:
+  1. Saves the state of all  Google Test flags.
+  1. Creates a test fixture object for the first test.
+  1. Initializes it via `SetUp()`.
+  1. Runs the test on the fixture object.
+  1. Cleans up the fixture via `TearDown()`.
+  1. Deletes the fixture.
+  1. Restores the state of all Google Test flags.
+  1. Repeats the above steps for the next test, until all tests have run.
+
+In addition, if the text fixture's constructor generates a fatal failure in
+step 2, there is no point for step 3 - 5 and they are thus skipped. Similarly,
+if step 3 generates a fatal failure, step 4 will be skipped.
+
+_Important_: You must not ignore the return value of `RUN_ALL_TESTS()`, or `gcc`
+will give you a compiler error. The rationale for this design is that the
+automated testing service determines whether a test has passed based on its
+exit code, not on its stdout/stderr output; thus your `main()` function must
+return the value of `RUN_ALL_TESTS()`.
+
+Also, you should call `RUN_ALL_TESTS()` only **once**. Calling it more than once
+conflicts with some advanced Google Test features (e.g. thread-safe death
+tests) and thus is not supported.
+
+_Availability_: Linux, Windows, Mac.
+
+# Writing the main() Function #
+
+You can start from this boilerplate:
+```
+#include "this/package/foo.h"
+#include "gtest/gtest.h"
+
+namespace {
+
+// The fixture for testing class Foo.
+class FooTest : public ::testing::Test {
+ protected:
+  // You can remove any or all of the following functions if its body
+  // is empty.
+
+  FooTest() {
+    // You can do set-up work for each test here.
+  }
+
+  virtual ~FooTest() {
+    // You can do clean-up work that doesn't throw exceptions here.
+  }
+
+  // If the constructor and destructor are not enough for setting up
+  // and cleaning up each test, you can define the following methods:
+
+  virtual void SetUp() {
+    // Code here will be called immediately after the constructor (right
+    // before each test).
+  }
+
+  virtual void TearDown() {
+    // Code here will be called immediately after each test (right
+    // before the destructor).
+  }
+
+  // Objects declared here can be used by all tests in the test case for Foo.
+};
+
+// Tests that the Foo::Bar() method does Abc.
+TEST_F(FooTest, MethodBarDoesAbc) {
+  const string input_filepath = "this/package/testdata/myinputfile.dat";
+  const string output_filepath = "this/package/testdata/myoutputfile.dat";
+  Foo f;
+  EXPECT_EQ(0, f.Bar(input_filepath, output_filepath));
+}
+
+// Tests that Foo does Xyz.
+TEST_F(FooTest, DoesXyz) {
+  // Exercises the Xyz feature of Foo.
+}
+
+}  // namespace
+
+int main(int argc, char **argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  return RUN_ALL_TESTS();
+}
+```
+
+The `::testing::InitGoogleTest()` function parses the command line for Google
+Test flags, and removes all recognized flags. This allows the user to control a
+test program's behavior via various flags, which we'll cover in [AdvancedGuide](AdvancedGuide.md).
+You must call this function before calling `RUN_ALL_TESTS()`, or the flags
+won't be properly initialized.
+
+On Windows, `InitGoogleTest()` also works with wide strings, so it can be used
+in programs compiled in `UNICODE` mode as well.
+
+But maybe you think that writing all those main() functions is too much work? We agree with you completely and that's why Google Test provides a basic implementation of main(). If it fits your needs, then just link your test with gtest\_main library and you are good to go.
+
+## Important note for Visual C++ users ##
+If you put your tests into a library and your `main()` function is in a different library or in your .exe file, those tests will not run. The reason is a [bug](https://connect.microsoft.com/feedback/viewfeedback.aspx?FeedbackID=244410&siteid=210) in Visual C++. When you define your tests, Google Test creates certain static objects to register them. These objects are not referenced from elsewhere but their constructors are still supposed to run. When Visual C++ linker sees that nothing in the library is referenced from other places it throws the library out. You have to reference your library with tests from your main program to keep the linker from discarding it. Here is how to do it. Somewhere in your library code declare a function:
+```
+__declspec(dllexport) int PullInMyLibrary() { return 0; }
+```
+If you put your tests in a static library (not DLL) then `__declspec(dllexport)` is not required. Now, in your main program, write a code that invokes that function:
+```
+int PullInMyLibrary();
+static int dummy = PullInMyLibrary();
+```
+This will keep your tests referenced and will make them register themselves at startup.
+
+In addition, if you define your tests in a static library, add `/OPT:NOREF` to your main program linker options. If you use MSVC++ IDE, go to your .exe project properties/Configuration Properties/Linker/Optimization and set References setting to `Keep Unreferenced Data (/OPT:NOREF)`. This will keep Visual C++ linker from discarding individual symbols generated by your tests from the final executable.
+
+There is one more pitfall, though. If you use Google Test as a static library (that's how it is defined in gtest.vcproj) your tests must also reside in a static library. If you have to have them in a DLL, you _must_ change Google Test to build into a DLL as well. Otherwise your tests will not run correctly or will not run at all. The general conclusion here is: make your life easier - do not write your tests in libraries!
+
+# Where to Go from Here #
+
+Congratulations! You've learned the Google Test basics. You can start writing
+and running Google Test tests, read some [samples](Samples.md), or continue with
+[AdvancedGuide](AdvancedGuide.md), which describes many more useful Google Test features.
+
+# Known Limitations #
+
+Google Test is designed to be thread-safe.  The implementation is
+thread-safe on systems where the `pthreads` library is available.  It
+is currently _unsafe_ to use Google Test assertions from two threads
+concurrently on other systems (e.g. Windows).  In most tests this is
+not an issue as usually the assertions are done in the main thread. If
+you want to help, you can volunteer to implement the necessary
+synchronization primitives in `gtest-port.h` for your platform.
diff --git a/docs/PumpManual.md b/docs/PumpManual.md
new file mode 100755 (executable)
index 0000000..8184f15
--- /dev/null
@@ -0,0 +1,177 @@
+
+
+<b>P</b>ump is <b>U</b>seful for <b>M</b>eta <b>P</b>rogramming.
+
+# The Problem #
+
+Template and macro libraries often need to define many classes,
+functions, or macros that vary only (or almost only) in the number of
+arguments they take. It's a lot of repetitive, mechanical, and
+error-prone work.
+
+Variadic templates and variadic macros can alleviate the problem.
+However, while both are being considered by the C++ committee, neither
+is in the standard yet or widely supported by compilers.  Thus they
+are often not a good choice, especially when your code needs to be
+portable. And their capabilities are still limited.
+
+As a result, authors of such libraries often have to write scripts to
+generate their implementation. However, our experience is that it's
+tedious to write such scripts, which tend to reflect the structure of
+the generated code poorly and are often hard to read and edit. For
+example, a small change needed in the generated code may require some
+non-intuitive, non-trivial changes in the script. This is especially
+painful when experimenting with the code.
+
+# Our Solution #
+
+Pump (for Pump is Useful for Meta Programming, Pretty Useful for Meta
+Programming, or Practical Utility for Meta Programming, whichever you
+prefer) is a simple meta-programming tool for C++. The idea is that a
+programmer writes a `foo.pump` file which contains C++ code plus meta
+code that manipulates the C++ code. The meta code can handle
+iterations over a range, nested iterations, local meta variable
+definitions, simple arithmetic, and conditional expressions. You can
+view it as a small Domain-Specific Language. The meta language is
+designed to be non-intrusive (s.t. it won't confuse Emacs' C++ mode,
+for example) and concise, making Pump code intuitive and easy to
+maintain.
+
+## Highlights ##
+
+  * The implementation is in a single Python script and thus ultra portable: no build or installation is needed and it works cross platforms.
+  * Pump tries to be smart with respect to [Google's style guide](http://code.google.com/p/google-styleguide/): it breaks long lines (easy to have when they are generated) at acceptable places to fit within 80 columns and indent the continuation lines correctly.
+  * The format is human-readable and more concise than XML.
+  * The format works relatively well with Emacs' C++ mode.
+
+## Examples ##
+
+The following Pump code (where meta keywords start with `$`, `[[` and `]]` are meta brackets, and `$$` starts a meta comment that ends with the line):
+
+```
+$var n = 3     $$ Defines a meta variable n.
+$range i 0..n  $$ Declares the range of meta iterator i (inclusive).
+$for i [[
+               $$ Meta loop.
+// Foo$i does blah for $i-ary predicates.
+$range j 1..i
+template <size_t N $for j [[, typename A$j]]>
+class Foo$i {
+$if i == 0 [[
+  blah a;
+]] $elif i <= 2 [[
+  blah b;
+]] $else [[
+  blah c;
+]]
+};
+
+]]
+```
+
+will be translated by the Pump compiler to:
+
+```
+// Foo0 does blah for 0-ary predicates.
+template <size_t N>
+class Foo0 {
+  blah a;
+};
+
+// Foo1 does blah for 1-ary predicates.
+template <size_t N, typename A1>
+class Foo1 {
+  blah b;
+};
+
+// Foo2 does blah for 2-ary predicates.
+template <size_t N, typename A1, typename A2>
+class Foo2 {
+  blah b;
+};
+
+// Foo3 does blah for 3-ary predicates.
+template <size_t N, typename A1, typename A2, typename A3>
+class Foo3 {
+  blah c;
+};
+```
+
+In another example,
+
+```
+$range i 1..n
+Func($for i + [[a$i]]);
+$$ The text between i and [[ is the separator between iterations.
+```
+
+will generate one of the following lines (without the comments), depending on the value of `n`:
+
+```
+Func();              // If n is 0.
+Func(a1);            // If n is 1.
+Func(a1 + a2);       // If n is 2.
+Func(a1 + a2 + a3);  // If n is 3.
+// And so on...
+```
+
+## Constructs ##
+
+We support the following meta programming constructs:
+
+| `$var id = exp` | Defines a named constant value. `$id` is valid util the end of the current meta lexical block. |
+|:----------------|:-----------------------------------------------------------------------------------------------|
+| `$range id exp..exp` | Sets the range of an iteration variable, which can be reused in multiple loops later.          |
+| `$for id sep [[ code ]]` | Iteration. The range of `id` must have been defined earlier. `$id` is valid in `code`.         |
+| `$($)`          | Generates a single `$` character.                                                              |
+| `$id`           | Value of the named constant or iteration variable.                                             |
+| `$(exp)`        | Value of the expression.                                                                       |
+| `$if exp [[ code ]] else_branch` | Conditional.                                                                                   |
+| `[[ code ]]`    | Meta lexical block.                                                                            |
+| `cpp_code`      | Raw C++ code.                                                                                  |
+| `$$ comment`    | Meta comment.                                                                                  |
+
+**Note:** To give the user some freedom in formatting the Pump source
+code, Pump ignores a new-line character if it's right after `$for foo`
+or next to `[[` or `]]`. Without this rule you'll often be forced to write
+very long lines to get the desired output. Therefore sometimes you may
+need to insert an extra new-line in such places for a new-line to show
+up in your output.
+
+## Grammar ##
+
+```
+code ::= atomic_code*
+atomic_code ::= $var id = exp
+    | $var id = [[ code ]]
+    | $range id exp..exp
+    | $for id sep [[ code ]]
+    | $($)
+    | $id
+    | $(exp)
+    | $if exp [[ code ]] else_branch
+    | [[ code ]]
+    | cpp_code
+sep ::= cpp_code | empty_string
+else_branch ::= $else [[ code ]]
+    | $elif exp [[ code ]] else_branch
+    | empty_string
+exp ::= simple_expression_in_Python_syntax
+```
+
+## Code ##
+
+You can find the source code of Pump in [scripts/pump.py](../scripts/pump.py). It is still
+very unpolished and lacks automated tests, although it has been
+successfully used many times. If you find a chance to use it in your
+project, please let us know what you think!  We also welcome help on
+improving Pump.
+
+## Real Examples ##
+
+You can find real-world applications of Pump in [Google Test](http://www.google.com/codesearch?q=file%3A\.pump%24+package%3Ahttp%3A%2F%2Fgoogletest\.googlecode\.com) and [Google Mock](http://www.google.com/codesearch?q=file%3A\.pump%24+package%3Ahttp%3A%2F%2Fgooglemock\.googlecode\.com).  The source file `foo.h.pump` generates `foo.h`.
+
+## Tips ##
+
+  * If a meta variable is followed by a letter or digit, you can separate them using `[[]]`, which inserts an empty string. For example `Foo$j[[]]Helper` generate `Foo1Helper` when `j` is 1.
+  * To avoid extra-long Pump source lines, you can break a line anywhere you want by inserting `[[]]` followed by a new line. Since any new-line character next to `[[` or `]]` is ignored, the generated code won't contain this new line.
diff --git a/docs/Samples.md b/docs/Samples.md
new file mode 100755 (executable)
index 0000000..f21d200
--- /dev/null
@@ -0,0 +1,14 @@
+If you're like us, you'd like to look at some Google Test sample code.  The
+[samples folder](../samples) has a number of well-commented samples showing how to use a
+variety of Google Test features.
+
+  * [Sample #1](../samples/sample1_unittest.cc) shows the basic steps of using Google Test to test C++ functions.
+  * [Sample #2](../samples/sample2_unittest.cc) shows a more complex unit test for a class with multiple member functions.
+  * [Sample #3](../samples/sample3_unittest.cc) uses a test fixture.
+  * [Sample #4](../samples/sample4_unittest.cc) is another basic example of using Google Test.
+  * [Sample #5](../samples/sample5_unittest.cc) teaches how to reuse a test fixture in multiple test cases by deriving sub-fixtures from it.
+  * [Sample #6](../samples/sample6_unittest.cc) demonstrates type-parameterized tests.
+  * [Sample #7](../samples/sample7_unittest.cc) teaches the basics of value-parameterized tests.
+  * [Sample #8](../samples/sample8_unittest.cc) shows using `Combine()` in value-parameterized tests.
+  * [Sample #9](../samples/sample9_unittest.cc) shows use of the listener API to modify Google Test's console output and the use of its reflection API to inspect test results.
+  * [Sample #10](../samples/sample10_unittest.cc) shows use of the listener API to implement a primitive memory leak checker.
diff --git a/docs/V1_5_AdvancedGuide.md b/docs/V1_5_AdvancedGuide.md
new file mode 100755 (executable)
index 0000000..34e19c2
--- /dev/null
@@ -0,0 +1,2096 @@
+
+
+Now that you have read [Primer](V1_5_Primer.md) and learned how to write tests
+using Google Test, it's time to learn some new tricks. This document
+will show you more assertions as well as how to construct complex
+failure messages, propagate fatal failures, reuse and speed up your
+test fixtures, and use various flags with your tests.
+
+# More Assertions #
+
+This section covers some less frequently used, but still significant,
+assertions.
+
+## Explicit Success and Failure ##
+
+These three assertions do not actually test a value or expression. Instead,
+they generate a success or failure directly. Like the macros that actually
+perform a test, you may stream a custom failure message into the them.
+
+| `SUCCEED();` |
+|:-------------|
+
+Generates a success. This does NOT make the overall test succeed. A test is
+considered successful only if none of its assertions fail during its execution.
+
+Note: `SUCCEED()` is purely documentary and currently doesn't generate any
+user-visible output. However, we may add `SUCCEED()` messages to Google Test's
+output in the future.
+
+| `FAIL();`  | `ADD_FAILURE();` |
+|:-----------|:-----------------|
+
+`FAIL*` generates a fatal failure while `ADD_FAILURE*` generates a nonfatal
+failure. These are useful when control flow, rather than a Boolean expression,
+deteremines the test's success or failure. For example, you might want to write
+something like:
+
+```
+switch(expression) {
+  case 1: ... some checks ...
+  case 2: ... some other checks
+  ...
+  default: FAIL() << "We shouldn't get here.";
+}
+```
+
+_Availability_: Linux, Windows, Mac.
+
+## Exception Assertions ##
+
+These are for verifying that a piece of code throws (or does not
+throw) an exception of the given type:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_THROW(`_statement_, _exception\_type_`);`  | `EXPECT_THROW(`_statement_, _exception\_type_`);`  | _statement_ throws an exception of the given type  |
+| `ASSERT_ANY_THROW(`_statement_`);`                | `EXPECT_ANY_THROW(`_statement_`);`                | _statement_ throws an exception of any type        |
+| `ASSERT_NO_THROW(`_statement_`);`                 | `EXPECT_NO_THROW(`_statement_`);`                 | _statement_ doesn't throw any exception            |
+
+Examples:
+
+```
+ASSERT_THROW(Foo(5), bar_exception);
+
+EXPECT_NO_THROW({
+  int n = 5;
+  Bar(&n);
+});
+```
+
+_Availability_: Linux, Windows, Mac; since version 1.1.0.
+
+## Predicate Assertions for Better Error Messages ##
+
+Even though Google Test has a rich set of assertions, they can never be
+complete, as it's impossible (nor a good idea) to anticipate all the scenarios
+a user might run into. Therefore, sometimes a user has to use `EXPECT_TRUE()`
+to check a complex expression, for lack of a better macro. This has the problem
+of not showing you the values of the parts of the expression, making it hard to
+understand what went wrong. As a workaround, some users choose to construct the
+failure message by themselves, streaming it into `EXPECT_TRUE()`. However, this
+is awkward especially when the expression has side-effects or is expensive to
+evaluate.
+
+Google Test gives you three different options to solve this problem:
+
+### Using an Existing Boolean Function ###
+
+If you already have a function or a functor that returns `bool` (or a type
+that can be implicitly converted to `bool`), you can use it in a _predicate
+assertion_ to get the function arguments printed for free:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_PRED1(`_pred1, val1_`);`       | `EXPECT_PRED1(`_pred1, val1_`);` | _pred1(val1)_ returns true |
+| `ASSERT_PRED2(`_pred2, val1, val2_`);` | `EXPECT_PRED2(`_pred2, val1, val2_`);` |  _pred2(val1, val2)_ returns true |
+|  ...                | ...                    | ...          |
+
+In the above, _predn_ is an _n_-ary predicate function or functor, where
+_val1_, _val2_, ..., and _valn_ are its arguments. The assertion succeeds
+if the predicate returns `true` when applied to the given arguments, and fails
+otherwise. When the assertion fails, it prints the value of each argument. In
+either case, the arguments are evaluated exactly once.
+
+Here's an example. Given
+
+```
+// Returns true iff m and n have no common divisors except 1.
+bool MutuallyPrime(int m, int n) { ... }
+const int a = 3;
+const int b = 4;
+const int c = 10;
+```
+
+the assertion `EXPECT_PRED2(MutuallyPrime, a, b);` will succeed, while the
+assertion `EXPECT_PRED2(MutuallyPrime, b, c);` will fail with the message
+
+<pre>
+!MutuallyPrime(b, c) is false, where<br>
+b is 4<br>
+c is 10<br>
+</pre>
+
+**Notes:**
+
+  1. If you see a compiler error "no matching function to call" when using `ASSERT_PRED*` or `EXPECT_PRED*`, please see [this](V1_5_FAQ.md#the-compiler-complains-about-undefined-references-to-some-static-const-member-variables-but-i-did-define-them-in-the-class-body-whats-wrong) for how to resolve it.
+  1. Currently we only provide predicate assertions of arity <= 5. If you need a higher-arity assertion, let us know.
+
+_Availability_: Linux, Windows, Mac
+
+### Using a Function That Returns an AssertionResult ###
+
+While `EXPECT_PRED*()` and friends are handy for a quick job, the
+syntax is not satisfactory: you have to use different macros for
+different arities, and it feels more like Lisp than C++.  The
+`::testing::AssertionResult` class solves this problem.
+
+An `AssertionResult` object represents the result of an assertion
+(whether it's a success or a failure, and an associated message).  You
+can create an `AssertionResult` using one of these factory
+functions:
+
+```
+namespace testing {
+
+// Returns an AssertionResult object to indicate that an assertion has
+// succeeded.
+AssertionResult AssertionSuccess();
+
+// Returns an AssertionResult object to indicate that an assertion has
+// failed.
+AssertionResult AssertionFailure();
+
+}
+```
+
+You can then use the `<<` operator to stream messages to the
+`AssertionResult` object.
+
+To provide more readable messages in Boolean assertions
+(e.g. `EXPECT_TRUE()`), write a predicate function that returns
+`AssertionResult` instead of `bool`. For example, if you define
+`IsEven()` as:
+
+```
+::testing::AssertionResult IsEven(int n) {
+  if ((n % 2) == 0)
+    return ::testing::AssertionSuccess();
+  else
+    return ::testing::AssertionFailure() << n << " is odd";
+}
+```
+
+instead of:
+
+```
+bool IsEven(int n) {
+  return (n % 2) == 0;
+}
+```
+
+the failed assertion `EXPECT_TRUE(IsEven(Fib(4)))` will print:
+
+<pre>
+Value of: !IsEven(Fib(4))<br>
+Actual: false (*3 is odd*)<br>
+Expected: true<br>
+</pre>
+
+instead of a more opaque
+
+<pre>
+Value of: !IsEven(Fib(4))<br>
+Actual: false<br>
+Expected: true<br>
+</pre>
+
+If you want informative messages in `EXPECT_FALSE` and `ASSERT_FALSE`
+as well, and are fine with making the predicate slower in the success
+case, you can supply a success message:
+
+```
+::testing::AssertionResult IsEven(int n) {
+  if ((n % 2) == 0)
+    return ::testing::AssertionSuccess() << n << " is even";
+  else
+    return ::testing::AssertionFailure() << n << " is odd";
+}
+```
+
+Then the statement `EXPECT_FALSE(IsEven(Fib(6)))` will print
+
+<pre>
+Value of: !IsEven(Fib(6))<br>
+Actual: true (8 is even)<br>
+Expected: false<br>
+</pre>
+
+_Availability_: Linux, Windows, Mac; since version 1.4.1.
+
+### Using a Predicate-Formatter ###
+
+If you find the default message generated by `(ASSERT|EXPECT)_PRED*` and
+`(ASSERT|EXPECT)_(TRUE|FALSE)` unsatisfactory, or some arguments to your
+predicate do not support streaming to `ostream`, you can instead use the
+following _predicate-formatter assertions_ to _fully_ customize how the
+message is formatted:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_PRED_FORMAT1(`_pred\_format1, val1_`);`        | `EXPECT_PRED_FORMAT1(`_pred\_format1, val1_`); | _pred\_format1(val1)_ is successful |
+| `ASSERT_PRED_FORMAT2(`_pred\_format2, val1, val2_`);` | `EXPECT_PRED_FORMAT2(`_pred\_format2, val1, val2_`);` | _pred\_format2(val1, val2)_ is successful |
+| `...`               | `...`                  | `...`        |
+
+The difference between this and the previous two groups of macros is that instead of
+a predicate, `(ASSERT|EXPECT)_PRED_FORMAT*` take a _predicate-formatter_
+(_pred\_formatn_), which is a function or functor with the signature:
+
+`::testing::AssertionResult PredicateFormattern(const char* `_expr1_`, const char* `_expr2_`, ... const char* `_exprn_`, T1 `_val1_`, T2 `_val2_`, ... Tn `_valn_`);`
+
+where _val1_, _val2_, ..., and _valn_ are the values of the predicate
+arguments, and _expr1_, _expr2_, ..., and _exprn_ are the corresponding
+expressions as they appear in the source code. The types `T1`, `T2`, ..., and
+`Tn` can be either value types or reference types. For example, if an
+argument has type `Foo`, you can declare it as either `Foo` or `const Foo&`,
+whichever is appropriate.
+
+A predicate-formatter returns a `::testing::AssertionResult` object to indicate
+whether the assertion has succeeded or not. The only way to create such an
+object is to call one of these factory functions:
+
+As an example, let's improve the failure message in the previous example, which uses `EXPECT_PRED2()`:
+
+```
+// Returns the smallest prime common divisor of m and n,
+// or 1 when m and n are mutually prime.
+int SmallestPrimeCommonDivisor(int m, int n) { ... }
+
+// A predicate-formatter for asserting that two integers are mutually prime.
+::testing::AssertionResult AssertMutuallyPrime(const char* m_expr,
+                                               const char* n_expr,
+                                               int m,
+                                               int n) {
+  if (MutuallyPrime(m, n))
+    return ::testing::AssertionSuccess();
+
+  return ::testing::AssertionFailure()
+      << m_expr << " and " << n_expr << " (" << m << " and " << n
+      << ") are not mutually prime, " << "as they have a common divisor "
+      << SmallestPrimeCommonDivisor(m, n);
+}
+```
+
+With this predicate-formatter, we can use
+
+```
+EXPECT_PRED_FORMAT2(AssertMutuallyPrime, b, c);
+```
+
+to generate the message
+
+<pre>
+b and c (4 and 10) are not mutually prime, as they have a common divisor 2.<br>
+</pre>
+
+As you may have realized, many of the assertions we introduced earlier are
+special cases of `(EXPECT|ASSERT)_PRED_FORMAT*`. In fact, most of them are
+indeed defined using `(EXPECT|ASSERT)_PRED_FORMAT*`.
+
+_Availability_: Linux, Windows, Mac.
+
+
+## Floating-Point Comparison ##
+
+Comparing floating-point numbers is tricky. Due to round-off errors, it is
+very unlikely that two floating-points will match exactly. Therefore,
+`ASSERT_EQ` 's naive comparison usually doesn't work. And since floating-points
+can have a wide value range, no single fixed error bound works. It's better to
+compare by a fixed relative error bound, except for values close to 0 due to
+the loss of precision there.
+
+In general, for floating-point comparison to make sense, the user needs to
+carefully choose the error bound. If they don't want or care to, comparing in
+terms of Units in the Last Place (ULPs) is a good default, and Google Test
+provides assertions to do this. Full details about ULPs are quite long; if you
+want to learn more, see
+[this article on float comparison](http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm).
+
+### Floating-Point Macros ###
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_FLOAT_EQ(`_expected, actual_`);`  | `EXPECT_FLOAT_EQ(`_expected, actual_`);` | the two `float` values are almost equal |
+| `ASSERT_DOUBLE_EQ(`_expected, actual_`);` | `EXPECT_DOUBLE_EQ(`_expected, actual_`);` | the two `double` values are almost equal |
+
+By "almost equal", we mean the two values are within 4 ULP's from each
+other.
+
+The following assertions allow you to choose the acceptable error bound:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_NEAR(`_val1, val2, abs\_error_`);` | `EXPECT_NEAR`_(val1, val2, abs\_error_`);` | the difference between _val1_ and _val2_ doesn't exceed the given absolute error |
+
+_Availability_: Linux, Windows, Mac.
+
+### Floating-Point Predicate-Format Functions ###
+
+Some floating-point operations are useful, but not that often used. In order
+to avoid an explosion of new macros, we provide them as predicate-format
+functions that can be used in predicate assertion macros (e.g.
+`EXPECT_PRED_FORMAT2`, etc).
+
+```
+EXPECT_PRED_FORMAT2(::testing::FloatLE, val1, val2);
+EXPECT_PRED_FORMAT2(::testing::DoubleLE, val1, val2);
+```
+
+Verifies that _val1_ is less than, or almost equal to, _val2_. You can
+replace `EXPECT_PRED_FORMAT2` in the above table with `ASSERT_PRED_FORMAT2`.
+
+_Availability_: Linux, Windows, Mac.
+
+## Windows HRESULT assertions ##
+
+These assertions test for `HRESULT` success or failure.
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_HRESULT_SUCCEEDED(`_expression_`);` | `EXPECT_HRESULT_SUCCEEDED(`_expression_`);` | _expression_ is a success `HRESULT` |
+| `ASSERT_HRESULT_FAILED(`_expression_`);`    | `EXPECT_HRESULT_FAILED(`_expression_`);`    | _expression_ is a failure `HRESULT` |
+
+The generated output contains the human-readable error message
+associated with the `HRESULT` code returned by _expression_.
+
+You might use them like this:
+
+```
+CComPtr shell;
+ASSERT_HRESULT_SUCCEEDED(shell.CoCreateInstance(L"Shell.Application"));
+CComVariant empty;
+ASSERT_HRESULT_SUCCEEDED(shell->ShellExecute(CComBSTR(url), empty, empty, empty, empty));
+```
+
+_Availability_: Windows.
+
+## Type Assertions ##
+
+You can call the function
+```
+::testing::StaticAssertTypeEq<T1, T2>();
+```
+to assert that types `T1` and `T2` are the same.  The function does
+nothing if the assertion is satisfied.  If the types are different,
+the function call will fail to compile, and the compiler error message
+will likely (depending on the compiler) show you the actual values of
+`T1` and `T2`.  This is mainly useful inside template code.
+
+_Caveat:_ When used inside a member function of a class template or a
+function template, `StaticAssertTypeEq<T1, T2>()` is effective _only if_
+the function is instantiated.  For example, given:
+```
+template <typename T> class Foo {
+ public:
+  void Bar() { ::testing::StaticAssertTypeEq<int, T>(); }
+};
+```
+the code:
+```
+void Test1() { Foo<bool> foo; }
+```
+will _not_ generate a compiler error, as `Foo<bool>::Bar()` is never
+actually instantiated.  Instead, you need:
+```
+void Test2() { Foo<bool> foo; foo.Bar(); }
+```
+to cause a compiler error.
+
+_Availability:_ Linux, Windows, Mac; since version 1.3.0.
+
+## Assertion Placement ##
+
+You can use assertions in any C++ function. In particular, it doesn't
+have to be a method of the test fixture class. The one constraint is
+that assertions that generate a fatal failure (`FAIL*` and `ASSERT_*`)
+can only be used in void-returning functions. This is a consequence of
+Google Test not using exceptions. By placing it in a non-void function
+you'll get a confusing compile error like
+`"error: void value not ignored as it ought to be"`.
+
+If you need to use assertions in a function that returns non-void, one option
+is to make the function return the value in an out parameter instead. For
+example, you can rewrite `T2 Foo(T1 x)` to `void Foo(T1 x, T2* result)`. You
+need to make sure that `*result` contains some sensible value even when the
+function returns prematurely. As the function now returns `void`, you can use
+any assertion inside of it.
+
+If changing the function's type is not an option, you should just use
+assertions that generate non-fatal failures, such as `ADD_FAILURE*` and
+`EXPECT_*`.
+
+_Note_: Constructors and destructors are not considered void-returning
+functions, according to the C++ language specification, and so you may not use
+fatal assertions in them. You'll get a compilation error if you try. A simple
+workaround is to transfer the entire body of the constructor or destructor to a
+private void-returning method. However, you should be aware that a fatal
+assertion failure in a constructor does not terminate the current test, as your
+intuition might suggest; it merely returns from the constructor early, possibly
+leaving your object in a partially-constructed state. Likewise, a fatal
+assertion failure in a destructor may leave your object in a
+partially-destructed state. Use assertions carefully in these situations!
+
+# Death Tests #
+
+In many applications, there are assertions that can cause application failure
+if a condition is not met. These sanity checks, which ensure that the program
+is in a known good state, are there to fail at the earliest possible time after
+some program state is corrupted. If the assertion checks the wrong condition,
+then the program may proceed in an erroneous state, which could lead to memory
+corruption, security holes, or worse. Hence it is vitally important to test
+that such assertion statements work as expected.
+
+Since these precondition checks cause the processes to die, we call such tests
+_death tests_. More generally, any test that checks that a program terminates
+in an expected fashion is also a death test.
+
+If you want to test `EXPECT_*()/ASSERT_*()` failures in your test code, see [Catching Failures](#catching-failures).
+
+## How to Write a Death Test ##
+
+Google Test has the following macros to support death tests:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_DEATH(`_statement, regex_`); | `EXPECT_DEATH(`_statement, regex_`); | _statement_ crashes with the given error |
+| `ASSERT_DEATH_IF_SUPPORTED(`_statement, regex_`); | `EXPECT_DEATH_IF_SUPPORTED(`_statement, regex_`); | if death tests are supported, verifies that _statement_ crashes with the given error; otherwise verifies nothing |
+| `ASSERT_EXIT(`_statement, predicate, regex_`); | `EXPECT_EXIT(`_statement, predicate, regex_`); |_statement_ exits with the given error and its exit code matches _predicate_ |
+
+where _statement_ is a statement that is expected to cause the process to
+die, _predicate_ is a function or function object that evaluates an integer
+exit status, and _regex_ is a regular expression that the stderr output of
+_statement_ is expected to match. Note that _statement_ can be _any valid
+statement_ (including _compound statement_) and doesn't have to be an
+expression.
+
+As usual, the `ASSERT` variants abort the current test function, while the
+`EXPECT` variants do not.
+
+**Note:** We use the word "crash" here to mean that the process
+terminates with a _non-zero_ exit status code.  There are two
+possibilities: either the process has called `exit()` or `_exit()`
+with a non-zero value, or it may be killed by a signal.
+
+This means that if _statement_ terminates the process with a 0 exit
+code, it is _not_ considered a crash by `EXPECT_DEATH`.  Use
+`EXPECT_EXIT` instead if this is the case, or if you want to restrict
+the exit code more precisely.
+
+A predicate here must accept an `int` and return a `bool`. The death test
+succeeds only if the predicate returns `true`. Google Test defines a few
+predicates that handle the most common cases:
+
+```
+::testing::ExitedWithCode(exit_code)
+```
+
+This expression is `true` if the program exited normally with the given exit
+code.
+
+```
+::testing::KilledBySignal(signal_number)  // Not available on Windows.
+```
+
+This expression is `true` if the program was killed by the given signal.
+
+The `*_DEATH` macros are convenient wrappers for `*_EXIT` that use a predicate
+that verifies the process' exit code is non-zero.
+
+Note that a death test only cares about three things:
+
+  1. does _statement_ abort or exit the process?
+  1. (in the case of `ASSERT_EXIT` and `EXPECT_EXIT`) does the exit status satisfy _predicate_?  Or (in the case of `ASSERT_DEATH` and `EXPECT_DEATH`) is the exit status non-zero?  And
+  1. does the stderr output match _regex_?
+
+In particular, if _statement_ generates an `ASSERT_*` or `EXPECT_*` failure, it will **not** cause the death test to fail, as Google Test assertions don't abort the process.
+
+To write a death test, simply use one of the above macros inside your test
+function. For example,
+
+```
+TEST(My*DeathTest*, Foo) {
+  // This death test uses a compound statement.
+  ASSERT_DEATH({ int n = 5; Foo(&n); }, "Error on line .* of Foo()");
+}
+TEST(MyDeathTest, NormalExit) {
+  EXPECT_EXIT(NormalExit(), ::testing::ExitedWithCode(0), "Success");
+}
+TEST(MyDeathTest, KillMyself) {
+  EXPECT_EXIT(KillMyself(), ::testing::KilledBySignal(SIGKILL), "Sending myself unblockable signal");
+}
+```
+
+verifies that:
+
+  * calling `Foo(5)` causes the process to die with the given error message,
+  * calling `NormalExit()` causes the process to print `"Success"` to stderr and exit with exit code 0, and
+  * calling `KillMyself()` kills the process with signal `SIGKILL`.
+
+The test function body may contain other assertions and statements as well, if
+necessary.
+
+_Important:_ We strongly recommend you to follow the convention of naming your
+test case (not test) `*DeathTest` when it contains a death test, as
+demonstrated in the above example. The `Death Tests And Threads` section below
+explains why.
+
+If a test fixture class is shared by normal tests and death tests, you
+can use typedef to introduce an alias for the fixture class and avoid
+duplicating its code:
+```
+class FooTest : public ::testing::Test { ... };
+
+typedef FooTest FooDeathTest;
+
+TEST_F(FooTest, DoesThis) {
+  // normal test
+}
+
+TEST_F(FooDeathTest, DoesThat) {
+  // death test
+}
+```
+
+_Availability:_ Linux, Windows (requires MSVC 8.0 or above), Cygwin, and Mac (the latter three are supported since v1.3.0).  `(ASSERT|EXPECT)_DEATH_IF_SUPPORTED` are new in v1.4.0.
+
+## Regular Expression Syntax ##
+
+On POSIX systems (e.g. Linux, Cygwin, and Mac), Google Test uses the
+[POSIX extended regular expression](http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04)
+syntax in death tests. To learn about this syntax, you may want to read this [Wikipedia entry](http://en.wikipedia.org/wiki/Regular_expression#POSIX_Extended_Regular_Expressions).
+
+On Windows, Google Test uses its own simple regular expression
+implementation. It lacks many features you can find in POSIX extended
+regular expressions.  For example, we don't support union (`"x|y"`),
+grouping (`"(xy)"`), brackets (`"[xy]"`), and repetition count
+(`"x{5,7}"`), among others. Below is what we do support (`A` denotes a
+literal character, period (`.`), or a single `\\` escape sequence; `x`
+and `y` denote regular expressions.):
+
+| `c` | matches any literal character `c` |
+|:----|:----------------------------------|
+| `\\d` | matches any decimal digit         |
+| `\\D` | matches any character that's not a decimal digit |
+| `\\f` | matches `\f`                      |
+| `\\n` | matches `\n`                      |
+| `\\r` | matches `\r`                      |
+| `\\s` | matches any ASCII whitespace, including `\n` |
+| `\\S` | matches any character that's not a whitespace |
+| `\\t` | matches `\t`                      |
+| `\\v` | matches `\v`                      |
+| `\\w` | matches any letter, `_`, or decimal digit |
+| `\\W` | matches any character that `\\w` doesn't match |
+| `\\c` | matches any literal character `c`, which must be a punctuation |
+| `.` | matches any single character except `\n` |
+| `A?` | matches 0 or 1 occurrences of `A` |
+| `A*` | matches 0 or many occurrences of `A` |
+| `A+` | matches 1 or many occurrences of `A` |
+| `^` | matches the beginning of a string (not that of each line) |
+| `$` | matches the end of a string (not that of each line) |
+| `xy` | matches `x` followed by `y`       |
+
+To help you determine which capability is available on your system,
+Google Test defines macro `GTEST_USES_POSIX_RE=1` when it uses POSIX
+extended regular expressions, or `GTEST_USES_SIMPLE_RE=1` when it uses
+the simple version.  If you want your death tests to work in both
+cases, you can either `#if` on these macros or use the more limited
+syntax only.
+
+## How It Works ##
+
+Under the hood, `ASSERT_EXIT()` spawns a new process and executes the
+death test statement in that process. The details of of how precisely
+that happens depend on the platform and the variable
+`::testing::GTEST_FLAG(death_test_style)` (which is initialized from the
+command-line flag `--gtest_death_test_style`).
+
+  * On POSIX systems, `fork()` (or `clone()` on Linux) is used to spawn the child, after which:
+    * If the variable's value is `"fast"`, the death test statement is immediately executed.
+    * If the variable's value is `"threadsafe"`, the child process re-executes the unit test binary just as it was originally invoked, but with some extra flags to cause just the single death test under consideration to be run.
+  * On Windows, the child is spawned using the `CreateProcess()` API, and re-executes the binary to cause just the single death test under consideration to be run - much like the `threadsafe` mode on POSIX.
+
+Other values for the variable are illegal and will cause the death test to
+fail. Currently, the flag's default value is `"fast"`. However, we reserve the
+right to change it in the future. Therefore, your tests should not depend on
+this.
+
+In either case, the parent process waits for the child process to complete, and checks that
+
+  1. the child's exit status satisfies the predicate, and
+  1. the child's stderr matches the regular expression.
+
+If the death test statement runs to completion without dying, the child
+process will nonetheless terminate, and the assertion fails.
+
+## Death Tests And Threads ##
+
+The reason for the two death test styles has to do with thread safety. Due to
+well-known problems with forking in the presence of threads, death tests should
+be run in a single-threaded context. Sometimes, however, it isn't feasible to
+arrange that kind of environment. For example, statically-initialized modules
+may start threads before main is ever reached. Once threads have been created,
+it may be difficult or impossible to clean them up.
+
+Google Test has three features intended to raise awareness of threading issues.
+
+  1. A warning is emitted if multiple threads are running when a death test is encountered.
+  1. Test cases with a name ending in "DeathTest" are run before all other tests.
+  1. It uses `clone()` instead of `fork()` to spawn the child process on Linux (`clone()` is not available on Cygwin and Mac), as `fork()` is more likely to cause the child to hang when the parent process has multiple threads.
+
+It's perfectly fine to create threads inside a death test statement; they are
+executed in a separate process and cannot affect the parent.
+
+## Death Test Styles ##
+
+The "threadsafe" death test style was introduced in order to help mitigate the
+risks of testing in a possibly multithreaded environment. It trades increased
+test execution time (potentially dramatically so) for improved thread safety.
+We suggest using the faster, default "fast" style unless your test has specific
+problems with it.
+
+You can choose a particular style of death tests by setting the flag
+programmatically:
+
+```
+::testing::FLAGS_gtest_death_test_style = "threadsafe";
+```
+
+You can do this in `main()` to set the style for all death tests in the
+binary, or in individual tests. Recall that flags are saved before running each
+test and restored afterwards, so you need not do that yourself. For example:
+
+```
+TEST(MyDeathTest, TestOne) {
+  ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+  // This test is run in the "threadsafe" style:
+  ASSERT_DEATH(ThisShouldDie(), "");
+}
+
+TEST(MyDeathTest, TestTwo) {
+  // This test is run in the "fast" style:
+  ASSERT_DEATH(ThisShouldDie(), "");
+}
+
+int main(int argc, char** argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  ::testing::FLAGS_gtest_death_test_style = "fast";
+  return RUN_ALL_TESTS();
+}
+```
+
+## Caveats ##
+
+The _statement_ argument of `ASSERT_EXIT()` can be any valid C++ statement
+except that it can not return from the current function. This means
+_statement_ should not contain `return` or a macro that might return (e.g.
+`ASSERT_TRUE()` ). If _statement_ returns before it crashes, Google Test will
+print an error message, and the test will fail.
+
+Since _statement_ runs in the child process, any in-memory side effect (e.g.
+modifying a variable, releasing memory, etc) it causes will _not_ be observable
+in the parent process. In particular, if you release memory in a death test,
+your program will fail the heap check as the parent process will never see the
+memory reclaimed. To solve this problem, you can
+
+  1. try not to free memory in a death test;
+  1. free the memory again in the parent process; or
+  1. do not use the heap checker in your program.
+
+Due to an implementation detail, you cannot place multiple death test
+assertions on the same line; otherwise, compilation will fail with an unobvious
+error message.
+
+Despite the improved thread safety afforded by the "threadsafe" style of death
+test, thread problems such as deadlock are still possible in the presence of
+handlers registered with `pthread_atfork(3)`.
+
+# Using Assertions in Sub-routines #
+
+## Adding Traces to Assertions ##
+
+If a test sub-routine is called from several places, when an assertion
+inside it fails, it can be hard to tell which invocation of the
+sub-routine the failure is from.  You can alleviate this problem using
+extra logging or custom failure messages, but that usually clutters up
+your tests. A better solution is to use the `SCOPED_TRACE` macro:
+
+| `SCOPED_TRACE(`_message_`);` |
+|:-----------------------------|
+
+where _message_ can be anything streamable to `std::ostream`. This
+macro will cause the current file name, line number, and the given
+message to be added in every failure message. The effect will be
+undone when the control leaves the current lexical scope.
+
+For example,
+
+```
+10: void Sub1(int n) {
+11:   EXPECT_EQ(1, Bar(n));
+12:   EXPECT_EQ(2, Bar(n + 1));
+13: }
+14:
+15: TEST(FooTest, Bar) {
+16:   {
+17:     SCOPED_TRACE("A");  // This trace point will be included in
+18:                         // every failure in this scope.
+19:     Sub1(1);
+20:   }
+21:   // Now it won't.
+22:   Sub1(9);
+23: }
+```
+
+could result in messages like these:
+
+```
+path/to/foo_test.cc:11: Failure
+Value of: Bar(n)
+Expected: 1
+  Actual: 2
+   Trace:
+path/to/foo_test.cc:17: A
+
+path/to/foo_test.cc:12: Failure
+Value of: Bar(n + 1)
+Expected: 2
+  Actual: 3
+```
+
+Without the trace, it would've been difficult to know which invocation
+of `Sub1()` the two failures come from respectively. (You could add an
+extra message to each assertion in `Sub1()` to indicate the value of
+`n`, but that's tedious.)
+
+Some tips on using `SCOPED_TRACE`:
+
+  1. With a suitable message, it's often enough to use `SCOPED_TRACE` at the beginning of a sub-routine, instead of at each call site.
+  1. When calling sub-routines inside a loop, make the loop iterator part of the message in `SCOPED_TRACE` such that you can know which iteration the failure is from.
+  1. Sometimes the line number of the trace point is enough for identifying the particular invocation of a sub-routine. In this case, you don't have to choose a unique message for `SCOPED_TRACE`. You can simply use `""`.
+  1. You can use `SCOPED_TRACE` in an inner scope when there is one in the outer scope. In this case, all active trace points will be included in the failure messages, in reverse order they are encountered.
+  1. The trace dump is clickable in Emacs' compilation buffer - hit return on a line number and you'll be taken to that line in the source file!
+
+_Availability:_ Linux, Windows, Mac.
+
+## Propagating Fatal Failures ##
+
+A common pitfall when using `ASSERT_*` and `FAIL*` is not understanding that
+when they fail they only abort the _current function_, not the entire test. For
+example, the following test will segfault:
+```
+void Subroutine() {
+  // Generates a fatal failure and aborts the current function.
+  ASSERT_EQ(1, 2);
+  // The following won't be executed.
+  ...
+}
+
+TEST(FooTest, Bar) {
+  Subroutine();
+  // The intended behavior is for the fatal failure
+  // in Subroutine() to abort the entire test.
+  // The actual behavior: the function goes on after Subroutine() returns.
+  int* p = NULL;
+  *p = 3; // Segfault!
+}
+```
+
+Since we don't use exceptions, it is technically impossible to
+implement the intended behavior here.  To alleviate this, Google Test
+provides two solutions.  You could use either the
+`(ASSERT|EXPECT)_NO_FATAL_FAILURE` assertions or the
+`HasFatalFailure()` function.  They are described in the following two
+subsections.
+
+
+
+### Asserting on Subroutines ###
+
+As shown above, if your test calls a subroutine that has an `ASSERT_*`
+failure in it, the test will continue after the subroutine
+returns. This may not be what you want.
+
+Often people want fatal failures to propagate like exceptions.  For
+that Google Test offers the following macros:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_NO_FATAL_FAILURE(`_statement_`);` | `EXPECT_NO_FATAL_FAILURE(`_statement_`);` | _statement_ doesn't generate any new fatal failures in the current thread. |
+
+Only failures in the thread that executes the assertion are checked to
+determine the result of this type of assertions.  If _statement_
+creates new threads, failures in these threads are ignored.
+
+Examples:
+
+```
+ASSERT_NO_FATAL_FAILURE(Foo());
+
+int i;
+EXPECT_NO_FATAL_FAILURE({
+  i = Bar();
+});
+```
+
+_Availability:_ Linux, Windows, Mac. Assertions from multiple threads
+are currently not supported.
+
+### Checking for Failures in the Current Test ###
+
+`HasFatalFailure()` in the `::testing::Test` class returns `true` if an
+assertion in the current test has suffered a fatal failure. This
+allows functions to catch fatal failures in a sub-routine and return
+early.
+
+```
+class Test {
+ public:
+  ...
+  static bool HasFatalFailure();
+};
+```
+
+The typical usage, which basically simulates the behavior of a thrown
+exception, is:
+
+```
+TEST(FooTest, Bar) {
+  Subroutine();
+  // Aborts if Subroutine() had a fatal failure.
+  if (HasFatalFailure())
+    return;
+  // The following won't be executed.
+  ...
+}
+```
+
+If `HasFatalFailure()` is used outside of `TEST()` , `TEST_F()` , or a test
+fixture, you must add the `::testing::Test::` prefix, as in:
+
+```
+if (::testing::Test::HasFatalFailure())
+  return;
+```
+
+Similarly, `HasNonfatalFailure()` returns `true` if the current test
+has at least one non-fatal failure, and `HasFailure()` returns `true`
+if the current test has at least one failure of either kind.
+
+_Availability:_ Linux, Windows, Mac.  `HasNonfatalFailure()` and
+`HasFailure()` are available since version 1.4.0.
+
+# Logging Additional Information #
+
+In your test code, you can call `RecordProperty("key", value)` to log
+additional information, where `value` can be either a C string or a 32-bit
+integer. The _last_ value recorded for a key will be emitted to the XML output
+if you specify one. For example, the test
+
+```
+TEST_F(WidgetUsageTest, MinAndMaxWidgets) {
+  RecordProperty("MaximumWidgets", ComputeMaxUsage());
+  RecordProperty("MinimumWidgets", ComputeMinUsage());
+}
+```
+
+will output XML like this:
+
+```
+...
+  <testcase name="MinAndMaxWidgets" status="run" time="6" classname="WidgetUsageTest"
+            MaximumWidgets="12"
+            MinimumWidgets="9" />
+...
+```
+
+_Note_:
+  * `RecordProperty()` is a static member of the `Test` class. Therefore it needs to be prefixed with `::testing::Test::` if used outside of the `TEST` body and the test fixture class.
+  * `key` must be a valid XML attribute name, and cannot conflict with the ones already used by Google Test (`name`, `status`,     `time`, and `classname`).
+
+_Availability_: Linux, Windows, Mac.
+
+# Sharing Resources Between Tests in the Same Test Case #
+
+
+
+Google Test creates a new test fixture object for each test in order to make
+tests independent and easier to debug. However, sometimes tests use resources
+that are expensive to set up, making the one-copy-per-test model prohibitively
+expensive.
+
+If the tests don't change the resource, there's no harm in them sharing a
+single resource copy. So, in addition to per-test set-up/tear-down, Google Test
+also supports per-test-case set-up/tear-down. To use it:
+
+  1. In your test fixture class (say `FooTest` ), define as `static` some member variables to hold the shared resources.
+  1. In the same test fixture class, define a `static void SetUpTestCase()` function (remember not to spell it as **`SetupTestCase`** with a small `u`!) to set up the shared resources and a `static void TearDownTestCase()` function to tear them down.
+
+That's it! Google Test automatically calls `SetUpTestCase()` before running the
+_first test_ in the `FooTest` test case (i.e. before creating the first
+`FooTest` object), and calls `TearDownTestCase()` after running the _last test_
+in it (i.e. after deleting the last `FooTest` object). In between, the tests
+can use the shared resources.
+
+Remember that the test order is undefined, so your code can't depend on a test
+preceding or following another. Also, the tests must either not modify the
+state of any shared resource, or, if they do modify the state, they must
+restore the state to its original value before passing control to the next
+test.
+
+Here's an example of per-test-case set-up and tear-down:
+```
+class FooTest : public ::testing::Test {
+ protected:
+  // Per-test-case set-up.
+  // Called before the first test in this test case.
+  // Can be omitted if not needed.
+  static void SetUpTestCase() {
+    shared_resource_ = new ...;
+  }
+
+  // Per-test-case tear-down.
+  // Called after the last test in this test case.
+  // Can be omitted if not needed.
+  static void TearDownTestCase() {
+    delete shared_resource_;
+    shared_resource_ = NULL;
+  }
+
+  // You can define per-test set-up and tear-down logic as usual.
+  virtual void SetUp() { ... }
+  virtual void TearDown() { ... }
+
+  // Some expensive resource shared by all tests.
+  static T* shared_resource_;
+};
+
+T* FooTest::shared_resource_ = NULL;
+
+TEST_F(FooTest, Test1) {
+  ... you can refer to shared_resource here ...
+}
+TEST_F(FooTest, Test2) {
+  ... you can refer to shared_resource here ...
+}
+```
+
+_Availability:_ Linux, Windows, Mac.
+
+# Global Set-Up and Tear-Down #
+
+Just as you can do set-up and tear-down at the test level and the test case
+level, you can also do it at the test program level. Here's how.
+
+First, you subclass the `::testing::Environment` class to define a test
+environment, which knows how to set-up and tear-down:
+
+```
+class Environment {
+ public:
+  virtual ~Environment() {}
+  // Override this to define how to set up the environment.
+  virtual void SetUp() {}
+  // Override this to define how to tear down the environment.
+  virtual void TearDown() {}
+};
+```
+
+Then, you register an instance of your environment class with Google Test by
+calling the `::testing::AddGlobalTestEnvironment()` function:
+
+```
+Environment* AddGlobalTestEnvironment(Environment* env);
+```
+
+Now, when `RUN_ALL_TESTS()` is called, it first calls the `SetUp()` method of
+the environment object, then runs the tests if there was no fatal failures, and
+finally calls `TearDown()` of the environment object.
+
+It's OK to register multiple environment objects. In this case, their `SetUp()`
+will be called in the order they are registered, and their `TearDown()` will be
+called in the reverse order.
+
+Note that Google Test takes ownership of the registered environment objects.
+Therefore **do not delete them** by yourself.
+
+You should call `AddGlobalTestEnvironment()` before `RUN_ALL_TESTS()` is
+called, probably in `main()`. If you use `gtest_main`, you need to      call
+this before `main()` starts for it to take effect. One way to do this is to
+define a global variable like this:
+
+```
+::testing::Environment* const foo_env = ::testing::AddGlobalTestEnvironment(new FooEnvironment);
+```
+
+However, we strongly recommend you to write your own `main()` and call
+`AddGlobalTestEnvironment()` there, as relying on initialization of global
+variables makes the code harder to read and may cause problems when you
+register multiple environments from different translation units and the
+environments have dependencies among them (remember that the compiler doesn't
+guarantee the order in which global variables from different translation units
+are initialized).
+
+_Availability:_ Linux, Windows, Mac.
+
+
+# Value Parameterized Tests #
+
+_Value-parameterized tests_ allow you to test your code with different
+parameters without writing multiple copies of the same test.
+
+Suppose you write a test for your code and then realize that your code is affected by a presence of a Boolean command line flag.
+
+```
+TEST(MyCodeTest, TestFoo) {
+  // A code to test foo().
+}
+```
+
+Usually people factor their test code into a function with a Boolean parameter in such situations. The function sets the flag, then executes the testing code.
+
+```
+void TestFooHelper(bool flag_value) {
+  flag = flag_value;
+  // A code to test foo().
+}
+
+TEST(MyCodeTest, TestFooo) {
+  TestFooHelper(false);
+  TestFooHelper(true);
+}
+```
+
+But this setup has serious drawbacks. First, when a test assertion fails in your tests, it becomes unclear what value of the parameter caused it to fail. You can stream a clarifying message into your `EXPECT`/`ASSERT` statements, but it you'll have to do it with all of them. Second, you have to add one such helper function per test. What if you have ten tests? Twenty? A hundred?
+
+Value-parameterized tests will let you write your test only once and then easily instantiate and run it with an arbitrary number of parameter values.
+
+Here are some other situations when value-parameterized tests come handy:
+
+  * You wan to test different implementations of an OO interface.
+  * You want to test your code over various inputs (a.k.a. data-driven testing). This feature is easy to abuse, so please exercise your good sense when doing it!
+
+## How to Write Value-Parameterized Tests ##
+
+To write value-parameterized tests, first you should define a fixture
+class. It must be derived from `::testing::TestWithParam<T>`, where `T`
+is the type of your parameter values. `TestWithParam<T>` is itself
+derived from `::testing::Test`. `T` can be any copyable type. If it's
+a raw pointer, you are responsible for managing the lifespan of the
+pointed values.
+
+```
+class FooTest : public ::testing::TestWithParam<const char*> {
+  // You can implement all the usual fixture class members here.
+  // To access the test parameter, call GetParam() from class
+  // TestWithParam<T>.
+};
+```
+
+Then, use the `TEST_P` macro to define as many test patterns using
+this fixture as you want.  The `_P` suffix is for "parameterized" or
+"pattern", whichever you prefer to think.
+
+```
+TEST_P(FooTest, DoesBlah) {
+  // Inside a test, access the test parameter with the GetParam() method
+  // of the TestWithParam<T> class:
+  EXPECT_TRUE(foo.Blah(GetParam()));
+  ...
+}
+
+TEST_P(FooTest, HasBlahBlah) {
+  ...
+}
+```
+
+Finally, you can use `INSTANTIATE_TEST_CASE_P` to instantiate the test
+case with any set of parameters you want. Google Test defines a number of
+functions for generating test parameters. They return what we call
+(surprise!) _parameter generators_. Here is a summary of them,
+which are all in the `testing` namespace:
+
+| `Range(begin, end[, step])` | Yields values `{begin, begin+step, begin+step+step, ...}`. The values do not include `end`. `step` defaults to 1. |
+|:----------------------------|:------------------------------------------------------------------------------------------------------------------|
+| `Values(v1, v2, ..., vN)`   | Yields values `{v1, v2, ..., vN}`.                                                                                |
+| `ValuesIn(container)` and `ValuesIn(begin, end)` | Yields values from a C-style array, an STL-style container, or an iterator range `[begin, end)`.                  |
+| `Bool()`                    | Yields sequence `{false, true}`.                                                                                  |
+| `Combine(g1, g2, ..., gN)`  | Yields all combinations (the Cartesian product for the math savvy) of the values generated by the `N` generators. This is only available if your system provides the `<tr1/tuple>` header. If you are sure your system does, and Google Test disagrees, you can override it by defining `GTEST_HAS_TR1_TUPLE=1`. See comments in [include/gtest/internal/gtest-port.h](../include/gtest/internal/gtest-port.h) for more information. |
+
+For more details, see the comments at the definitions of these functions in the [source code](../include/gtest/gtest-param-test.h).
+
+The following statement will instantiate tests from the `FooTest` test case
+each with parameter values `"meeny"`, `"miny"`, and `"moe"`.
+
+```
+INSTANTIATE_TEST_CASE_P(InstantiationName,
+                        FooTest,
+                        ::testing::Values("meeny", "miny", "moe"));
+```
+
+To distinguish different instances of the pattern (yes, you can
+instantiate it more than once), the first argument to
+`INSTANTIATE_TEST_CASE_P` is a prefix that will be added to the actual
+test case name. Remember to pick unique prefixes for different
+instantiations. The tests from the instantiation above will have these
+names:
+
+  * `InstantiationName/FooTest.DoesBlah/0` for `"meeny"`
+  * `InstantiationName/FooTest.DoesBlah/1` for `"miny"`
+  * `InstantiationName/FooTest.DoesBlah/2` for `"moe"`
+  * `InstantiationName/FooTest.HasBlahBlah/0` for `"meeny"`
+  * `InstantiationName/FooTest.HasBlahBlah/1` for `"miny"`
+  * `InstantiationName/FooTest.HasBlahBlah/2` for `"moe"`
+
+You can use these names in [--gtest\-filter](#running-a-subset-of-the-tests).
+
+This statement will instantiate all tests from `FooTest` again, each
+with parameter values `"cat"` and `"dog"`:
+
+```
+const char* pets[] = {"cat", "dog"};
+INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest,
+                        ::testing::ValuesIn(pets));
+```
+
+The tests from the instantiation above will have these names:
+
+  * `AnotherInstantiationName/FooTest.DoesBlah/0` for `"cat"`
+  * `AnotherInstantiationName/FooTest.DoesBlah/1` for `"dog"`
+  * `AnotherInstantiationName/FooTest.HasBlahBlah/0` for `"cat"`
+  * `AnotherInstantiationName/FooTest.HasBlahBlah/1` for `"dog"`
+
+Please note that `INSTANTIATE_TEST_CASE_P` will instantiate _all_
+tests in the given test case, whether their definitions come before or
+_after_ the `INSTANTIATE_TEST_CASE_P` statement.
+
+You can see
+[these](../samples/sample7_unittest.cc)
+[files](../samples/sample8_unittest.cc) for more examples.
+
+_Availability_: Linux, Windows (requires MSVC 8.0 or above), Mac; since version 1.2.0.
+
+## Creating Value-Parameterized Abstract Tests ##
+
+In the above, we define and instantiate `FooTest` in the same source
+file. Sometimes you may want to define value-parameterized tests in a
+library and let other people instantiate them later. This pattern is
+known as <i>abstract tests</i>. As an example of its application, when you
+are designing an interface you can write a standard suite of abstract
+tests (perhaps using a factory function as the test parameter) that
+all implementations of the interface are expected to pass. When
+someone implements the interface, he can instantiate your suite to get
+all the interface-conformance tests for free.
+
+To define abstract tests, you should organize your code like this:
+
+  1. Put the definition of the parameterized test fixture class (e.g. `FooTest`) in a header file, say `foo_param_test.h`. Think of this as _declaring_ your abstract tests.
+  1. Put the `TEST_P` definitions in `foo_param_test.cc`, which includes `foo_param_test.h`. Think of this as _implementing_ your abstract tests.
+
+Once they are defined, you can instantiate them by including
+`foo_param_test.h`, invoking `INSTANTIATE_TEST_CASE_P()`, and linking
+with `foo_param_test.cc`. You can instantiate the same abstract test
+case multiple times, possibly in different source files.
+
+# Typed Tests #
+
+Suppose you have multiple implementations of the same interface and
+want to make sure that all of them satisfy some common requirements.
+Or, you may have defined several types that are supposed to conform to
+the same "concept" and you want to verify it.  In both cases, you want
+the same test logic repeated for different types.
+
+While you can write one `TEST` or `TEST_F` for each type you want to
+test (and you may even factor the test logic into a function template
+that you invoke from the `TEST`), it's tedious and doesn't scale:
+if you want _m_ tests over _n_ types, you'll end up writing _m\*n_
+`TEST`s.
+
+_Typed tests_ allow you to repeat the same test logic over a list of
+types.  You only need to write the test logic once, although you must
+know the type list when writing typed tests.  Here's how you do it:
+
+First, define a fixture class template.  It should be parameterized
+by a type.  Remember to derive it from `::testing::Test`:
+
+```
+template <typename T>
+class FooTest : public ::testing::Test {
+ public:
+  ...
+  typedef std::list<T> List;
+  static T shared_;
+  T value_;
+};
+```
+
+Next, associate a list of types with the test case, which will be
+repeated for each type in the list:
+
+```
+typedef ::testing::Types<char, int, unsigned int> MyTypes;
+TYPED_TEST_CASE(FooTest, MyTypes);
+```
+
+The `typedef` is necessary for the `TYPED_TEST_CASE` macro to parse
+correctly.  Otherwise the compiler will think that each comma in the
+type list introduces a new macro argument.
+
+Then, use `TYPED_TEST()` instead of `TEST_F()` to define a typed test
+for this test case.  You can repeat this as many times as you want:
+
+```
+TYPED_TEST(FooTest, DoesBlah) {
+  // Inside a test, refer to the special name TypeParam to get the type
+  // parameter.  Since we are inside a derived class template, C++ requires
+  // us to visit the members of FooTest via 'this'.
+  TypeParam n = this->value_;
+
+  // To visit static members of the fixture, add the 'TestFixture::'
+  // prefix.
+  n += TestFixture::shared_;
+
+  // To refer to typedefs in the fixture, add the 'typename TestFixture::'
+  // prefix.  The 'typename' is required to satisfy the compiler.
+  typename TestFixture::List values;
+  values.push_back(n);
+  ...
+}
+
+TYPED_TEST(FooTest, HasPropertyA) { ... }
+```
+
+You can see `samples/sample6_unittest.cc` for a complete example.
+
+_Availability:_ Linux, Windows (requires MSVC 8.0 or above), Mac;
+since version 1.1.0.
+
+# Type-Parameterized Tests #
+
+_Type-parameterized tests_ are like typed tests, except that they
+don't require you to know the list of types ahead of time.  Instead,
+you can define the test logic first and instantiate it with different
+type lists later.  You can even instantiate it more than once in the
+same program.
+
+If you are designing an interface or concept, you can define a suite
+of type-parameterized tests to verify properties that any valid
+implementation of the interface/concept should have.  Then, the author
+of each implementation can just instantiate the test suite with his
+type to verify that it conforms to the requirements, without having to
+write similar tests repeatedly.  Here's an example:
+
+First, define a fixture class template, as we did with typed tests:
+
+```
+template <typename T>
+class FooTest : public ::testing::Test {
+  ...
+};
+```
+
+Next, declare that you will define a type-parameterized test case:
+
+```
+TYPED_TEST_CASE_P(FooTest);
+```
+
+The `_P` suffix is for "parameterized" or "pattern", whichever you
+prefer to think.
+
+Then, use `TYPED_TEST_P()` to define a type-parameterized test.  You
+can repeat this as many times as you want:
+
+```
+TYPED_TEST_P(FooTest, DoesBlah) {
+  // Inside a test, refer to TypeParam to get the type parameter.
+  TypeParam n = 0;
+  ...
+}
+
+TYPED_TEST_P(FooTest, HasPropertyA) { ... }
+```
+
+Now the tricky part: you need to register all test patterns using the
+`REGISTER_TYPED_TEST_CASE_P` macro before you can instantiate them.
+The first argument of the macro is the test case name; the rest are
+the names of the tests in this test case:
+
+```
+REGISTER_TYPED_TEST_CASE_P(FooTest,
+                           DoesBlah, HasPropertyA);
+```
+
+Finally, you are free to instantiate the pattern with the types you
+want.  If you put the above code in a header file, you can `#include`
+it in multiple C++ source files and instantiate it multiple times.
+
+```
+typedef ::testing::Types<char, int, unsigned int> MyTypes;
+INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
+```
+
+To distinguish different instances of the pattern, the first argument
+to the `INSTANTIATE_TYPED_TEST_CASE_P` macro is a prefix that will be
+added to the actual test case name.  Remember to pick unique prefixes
+for different instances.
+
+In the special case where the type list contains only one type, you
+can write that type directly without `::testing::Types<...>`, like this:
+
+```
+INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
+```
+
+You can see `samples/sample6_unittest.cc` for a complete example.
+
+_Availability:_ Linux, Windows (requires MSVC 8.0 or above), Mac;
+since version 1.1.0.
+
+# Testing Private Code #
+
+If you change your software's internal implementation, your tests should not
+break as long as the change is not observable by users. Therefore, per the
+_black-box testing principle_, most of the time you should test your code
+through its public interfaces.
+
+If you still find yourself needing to test internal implementation code,
+consider if there's a better design that wouldn't require you to do so. If you
+absolutely have to test non-public interface code though, you can. There are
+two cases to consider:
+
+  * Static functions (_not_ the same as static member functions!) or unnamed namespaces, and
+  * Private or protected class members
+
+## Static Functions ##
+
+Both static functions and definitions/declarations in an unnamed namespace are
+only visible within the same translation unit. To test them, you can `#include`
+the entire `.cc` file being tested in your `*_test.cc` file. (`#include`ing `.cc`
+files is not a good way to reuse code - you should not do this in production
+code!)
+
+However, a better approach is to move the private code into the
+`foo::internal` namespace, where `foo` is the namespace your project normally
+uses, and put the private declarations in a `*-internal.h` file. Your
+production `.cc` files and your tests are allowed to include this internal
+header, but your clients are not. This way, you can fully test your internal
+implementation without leaking it to your clients.
+
+## Private Class Members ##
+
+Private class members are only accessible from within the class or by friends.
+To access a class' private members, you can declare your test fixture as a
+friend to the class and define accessors in your fixture. Tests using the
+fixture can then access the private members of your production class via the
+accessors in the fixture. Note that even though your fixture is a friend to
+your production class, your tests are not automatically friends to it, as they
+are technically defined in sub-classes of the fixture.
+
+Another way to test private members is to refactor them into an implementation
+class, which is then declared in a `*-internal.h` file. Your clients aren't
+allowed to include this header but your tests can. Such is called the Pimpl
+(Private Implementation) idiom.
+
+Or, you can declare an individual test as a friend of your class by adding this
+line in the class body:
+
+```
+FRIEND_TEST(TestCaseName, TestName);
+```
+
+For example,
+```
+// foo.h
+#include <gtest/gtest_prod.h>
+
+// Defines FRIEND_TEST.
+class Foo {
+  ...
+ private:
+  FRIEND_TEST(FooTest, BarReturnsZeroOnNull);
+  int Bar(void* x);
+};
+
+// foo_test.cc
+...
+TEST(FooTest, BarReturnsZeroOnNull) {
+  Foo foo;
+  EXPECT_EQ(0, foo.Bar(NULL));
+  // Uses Foo's private member Bar().
+}
+```
+
+Pay special attention when your class is defined in a namespace, as you should
+define your test fixtures and tests in the same namespace if you want them to
+be friends of your class. For example, if the code to be tested looks like:
+
+```
+namespace my_namespace {
+
+class Foo {
+  friend class FooTest;
+  FRIEND_TEST(FooTest, Bar);
+  FRIEND_TEST(FooTest, Baz);
+  ...
+  definition of the class Foo
+  ...
+};
+
+}  // namespace my_namespace
+```
+
+Your test code should be something like:
+
+```
+namespace my_namespace {
+class FooTest : public ::testing::Test {
+ protected:
+  ...
+};
+
+TEST_F(FooTest, Bar) { ... }
+TEST_F(FooTest, Baz) { ... }
+
+}  // namespace my_namespace
+```
+
+# Catching Failures #
+
+If you are building a testing utility on top of Google Test, you'll
+want to test your utility.  What framework would you use to test it?
+Google Test, of course.
+
+The challenge is to verify that your testing utility reports failures
+correctly.  In frameworks that report a failure by throwing an
+exception, you could catch the exception and assert on it.  But Google
+Test doesn't use exceptions, so how do we test that a piece of code
+generates an expected failure?
+
+`<gtest/gtest-spi.h>` contains some constructs to do this.  After
+`#include`ing this header, you can use
+
+| `EXPECT_FATAL_FAILURE(`_statement, substring_`);` |
+|:--------------------------------------------------|
+
+to assert that _statement_ generates a fatal (e.g. `ASSERT_*`) failure
+whose message contains the given _substring_, or use
+
+| `EXPECT_NONFATAL_FAILURE(`_statement, substring_`);` |
+|:-----------------------------------------------------|
+
+if you are expecting a non-fatal (e.g. `EXPECT_*`) failure.
+
+For technical reasons, there are some caveats:
+
+  1. You cannot stream a failure message to either macro.
+  1. _statement_ in `EXPECT_FATAL_FAILURE()` cannot reference local non-static variables or non-static members of `this` object.
+  1. _statement_ in `EXPECT_FATAL_FAILURE()` cannot return a value.
+
+_Note:_ Google Test is designed with threads in mind.  Once the
+synchronization primitives in `<gtest/internal/gtest-port.h>` have
+been implemented, Google Test will become thread-safe, meaning that
+you can then use assertions in multiple threads concurrently.  Before
+
+that, however, Google Test only supports single-threaded usage.  Once
+thread-safe, `EXPECT_FATAL_FAILURE()` and `EXPECT_NONFATAL_FAILURE()`
+will capture failures in the current thread only. If _statement_
+creates new threads, failures in these threads will be ignored.  If
+you want to capture failures from all threads instead, you should use
+the following macros:
+
+| `EXPECT_FATAL_FAILURE_ON_ALL_THREADS(`_statement, substring_`);` |
+|:-----------------------------------------------------------------|
+| `EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(`_statement, substring_`);` |
+
+# Getting the Current Test's Name #
+
+Sometimes a function may need to know the name of the currently running test.
+For example, you may be using the `SetUp()` method of your test fixture to set
+the golden file name based on which test is running. The `::testing::TestInfo`
+class has this information:
+
+```
+namespace testing {
+
+class TestInfo {
+ public:
+  // Returns the test case name and the test name, respectively.
+  //
+  // Do NOT delete or free the return value - it's managed by the
+  // TestInfo class.
+  const char* test_case_name() const;
+  const char* name() const;
+};
+
+}  // namespace testing
+```
+
+
+> To obtain a `TestInfo` object for the currently running test, call
+`current_test_info()` on the `UnitTest` singleton object:
+
+```
+// Gets information about the currently running test.
+// Do NOT delete the returned object - it's managed by the UnitTest class.
+const ::testing::TestInfo* const test_info =
+  ::testing::UnitTest::GetInstance()->current_test_info();
+printf("We are in test %s of test case %s.\n",
+       test_info->name(), test_info->test_case_name());
+```
+
+`current_test_info()` returns a null pointer if no test is running. In
+particular, you cannot find the test case name in `TestCaseSetUp()`,
+`TestCaseTearDown()` (where you know the test case name implicitly), or
+functions called from them.
+
+_Availability:_ Linux, Windows, Mac.
+
+# Extending Google Test by Handling Test Events #
+
+Google Test provides an <b>event listener API</b> to let you receive
+notifications about the progress of a test program and test
+failures. The events you can listen to include the start and end of
+the test program, a test case, or a test method, among others. You may
+use this API to augment or replace the standard console output,
+replace the XML output, or provide a completely different form of
+output, such as a GUI or a database. You can also use test events as
+checkpoints to implement a resource leak checker, for example.
+
+_Availability:_ Linux, Windows, Mac; since v1.4.0.
+
+## Defining Event Listeners ##
+
+To define a event listener, you subclass either
+[testing::TestEventListener](../include/gtest/gtest.h#L855)
+or [testing::EmptyTestEventListener](../include/gtest/gtest.h#L905).
+The former is an (abstract) interface, where <i>each pure virtual method<br>
+can be overridden to handle a test event</i> (For example, when a test
+starts, the `OnTestStart()` method will be called.). The latter provides
+an empty implementation of all methods in the interface, such that a
+subclass only needs to override the methods it cares about.
+
+When an event is fired, its context is passed to the handler function
+as an argument. The following argument types are used:
+  * [UnitTest](../include/gtest/gtest.h#L1007) reflects the state of the entire test program,
+  * [TestCase](../include/gtest/gtest.h#L689) has information about a test case, which can contain one or more tests,
+  * [TestInfo](../include/gtest/gtest.h#L599) contains the state of a test, and
+  * [TestPartResult](../include/gtest/gtest-test-part.h#L42) represents the result of a test assertion.
+
+An event handler function can examine the argument it receives to find
+out interesting information about the event and the test program's
+state.  Here's an example:
+
+```
+  class MinimalistPrinter : public ::testing::EmptyTestEventListener {
+    // Called before a test starts.
+    virtual void OnTestStart(const ::testing::TestInfo& test_info) {
+      printf("*** Test %s.%s starting.\n",
+             test_info.test_case_name(), test_info.name());
+    }
+
+    // Called after a failed assertion or a SUCCESS().
+    virtual void OnTestPartResult(
+        const ::testing::TestPartResult& test_part_result) {
+      printf("%s in %s:%d\n%s\n",
+             test_part_result.failed() ? "*** Failure" : "Success",
+             test_part_result.file_name(),
+             test_part_result.line_number(),
+             test_part_result.summary());
+    }
+
+    // Called after a test ends.
+    virtual void OnTestEnd(const ::testing::TestInfo& test_info) {
+      printf("*** Test %s.%s ending.\n",
+             test_info.test_case_name(), test_info.name());
+    }
+  };
+```
+
+## Using Event Listeners ##
+
+To use the event listener you have defined, add an instance of it to
+the Google Test event listener list (represented by class
+[TestEventListeners](../include/gtest/gtest.h#L929)
+- note the "s" at the end of the name) in your
+`main()` function, before calling `RUN_ALL_TESTS()`:
+```
+int main(int argc, char** argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  // Gets hold of the event listener list.
+  ::testing::TestEventListeners& listeners =
+      ::testing::UnitTest::GetInstance()->listeners();
+  // Adds a listener to the end.  Google Test takes the ownership.
+  listeners.Append(new MinimalistPrinter);
+  return RUN_ALL_TESTS();
+}
+```
+
+There's only one problem: the default test result printer is still in
+effect, so its output will mingle with the output from your minimalist
+printer. To suppress the default printer, just release it from the
+event listener list and delete it. You can do so by adding one line:
+```
+  ...
+  delete listeners.Release(listeners.default_result_printer());
+  listeners.Append(new MinimalistPrinter);
+  return RUN_ALL_TESTS();
+```
+
+Now, sit back and enjoy a completely different output from your
+tests. For more details, you can read this
+[sample](../samples/sample9_unittest.cc).
+
+You may append more than one listener to the list. When an `On*Start()`
+or `OnTestPartResult()` event is fired, the listeners will receive it in
+the order they appear in the list (since new listeners are added to
+the end of the list, the default text printer and the default XML
+generator will receive the event first). An `On*End()` event will be
+received by the listeners in the _reverse_ order. This allows output by
+listeners added later to be framed by output from listeners added
+earlier.
+
+## Generating Failures in Listeners ##
+
+You may use failure-raising macros (`EXPECT_*()`, `ASSERT_*()`,
+`FAIL()`, etc) when processing an event. There are some restrictions:
+
+  1. You cannot generate any failure in `OnTestPartResult()` (otherwise it will cause `OnTestPartResult()` to be called recursively).
+  1. A listener that handles `OnTestPartResult()` is not allowed to generate any failure.
+
+When you add listeners to the listener list, you should put listeners
+that handle `OnTestPartResult()` _before_ listeners that can generate
+failures. This ensures that failures generated by the latter are
+attributed to the right test by the former.
+
+We have a sample of failure-raising listener
+[here](../samples/sample10_unittest.cc).
+
+# Running Test Programs: Advanced Options #
+
+Google Test test programs are ordinary executables. Once built, you can run
+them directly and affect their behavior via the following environment variables
+and/or command line flags. For the flags to work, your programs must call
+`::testing::InitGoogleTest()` before calling `RUN_ALL_TESTS()`.
+
+To see a list of supported flags and their usage, please run your test
+program with the `--help` flag.  You can also use `-h`, `-?`, or `/?`
+for short.  This feature is added in version 1.3.0.
+
+If an option is specified both by an environment variable and by a
+flag, the latter takes precedence.  Most of the options can also be
+set/read in code: to access the value of command line flag
+`--gtest_foo`, write `::testing::GTEST_FLAG(foo)`.  A common pattern is
+to set the value of a flag before calling `::testing::InitGoogleTest()`
+to change the default value of the flag:
+```
+int main(int argc, char** argv) {
+  // Disables elapsed time by default.
+  ::testing::GTEST_FLAG(print_time) = false;
+
+  // This allows the user to override the flag on the command line.
+  ::testing::InitGoogleTest(&argc, argv);
+
+  return RUN_ALL_TESTS();
+}
+```
+
+## Selecting Tests ##
+
+This section shows various options for choosing which tests to run.
+
+### Listing Test Names ###
+
+Sometimes it is necessary to list the available tests in a program before
+running them so that a filter may be applied if needed. Including the flag
+`--gtest_list_tests` overrides all other flags and lists tests in the following
+format:
+```
+TestCase1.
+  TestName1
+  TestName2
+TestCase2.
+  TestName
+```
+
+None of the tests listed are actually run if the flag is provided. There is no
+corresponding environment variable for this flag.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Running a Subset of the Tests ###
+
+By default, a Google Test program runs all tests the user has defined.
+Sometimes, you want to run only a subset of the tests (e.g. for debugging or
+quickly verifying a change). If you set the `GTEST_FILTER` environment variable
+or the `--gtest_filter` flag to a filter string, Google Test will only run the
+tests whose full names (in the form of `TestCaseName.TestName`) match the
+filter.
+
+The format of a filter is a '`:`'-separated list of wildcard patterns (called
+the positive patterns) optionally followed by a '`-`' and another
+'`:`'-separated pattern list (called the negative patterns). A test matches the
+filter if and only if it matches any of the positive patterns but does not
+match any of the negative patterns.
+
+A pattern may contain `'*'` (matches any string) or `'?'` (matches any single
+character). For convenience, the filter `'*-NegativePatterns'` can be also
+written as `'-NegativePatterns'`.
+
+For example:
+
+  * `./foo_test` Has no flag, and thus runs all its tests.
+  * `./foo_test --gtest_filter=*` Also runs everything, due to the single match-everything `*` value.
+  * `./foo_test --gtest_filter=FooTest.*` Runs everything in test case `FooTest`.
+  * `./foo_test --gtest_filter=*Null*:*Constructor*` Runs any test whose full name contains either `"Null"` or `"Constructor"`.
+  * `./foo_test --gtest_filter=-*DeathTest.*` Runs all non-death tests.
+  * `./foo_test --gtest_filter=FooTest.*-FooTest.Bar` Runs everything in test case `FooTest` except `FooTest.Bar`.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Temporarily Disabling Tests ###
+
+If you have a broken test that you cannot fix right away, you can add the
+`DISABLED_` prefix to its name. This will exclude it from execution. This is
+better than commenting out the code or using `#if 0`, as disabled tests are
+still compiled (and thus won't rot).
+
+If you need to disable all tests in a test case, you can either add `DISABLED_`
+to the front of the name of each test, or alternatively add it to the front of
+the test case name.
+
+For example, the following tests won't be run by Google Test, even though they
+will still be compiled:
+
+```
+// Tests that Foo does Abc.
+TEST(FooTest, DISABLED_DoesAbc) { ... }
+
+class DISABLED_BarTest : public ::testing::Test { ... };
+
+// Tests that Bar does Xyz.
+TEST_F(DISABLED_BarTest, DoesXyz) { ... }
+```
+
+_Note:_ This feature should only be used for temporary pain-relief. You still
+have to fix the disabled tests at a later date. As a reminder, Google Test will
+print a banner warning you if a test program contains any disabled tests.
+
+_Tip:_ You can easily count the number of disabled tests you have
+using `grep`. This number can be used as a metric for improving your
+test quality.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Temporarily Enabling Disabled Tests ###
+
+To include [disabled tests](#temporarily-disabling-tests) in test
+execution, just invoke the test program with the
+`--gtest_also_run_disabled_tests` flag or set the
+`GTEST_ALSO_RUN_DISABLED_TESTS` environment variable to a value other
+than `0`.  You can combine this with the
+[--gtest\_filter](#running-a-subset-of-the-tests) flag to further select
+which disabled tests to run.
+
+_Availability:_ Linux, Windows, Mac; since version 1.3.0.
+
+## Repeating the Tests ##
+
+Once in a while you'll run into a test whose result is hit-or-miss. Perhaps it
+will fail only 1% of the time, making it rather hard to reproduce the bug under
+a debugger. This can be a major source of frustration.
+
+The `--gtest_repeat` flag allows you to repeat all (or selected) test methods
+in a program many times. Hopefully, a flaky test will eventually fail and give
+you a chance to debug. Here's how to use it:
+
+| `$ foo_test --gtest_repeat=1000` | Repeat foo\_test 1000 times and don't stop at failures. |
+|:---------------------------------|:--------------------------------------------------------|
+| `$ foo_test --gtest_repeat=-1`   | A negative count means repeating forever.               |
+| `$ foo_test --gtest_repeat=1000 --gtest_break_on_failure` | Repeat foo\_test 1000 times, stopping at the first failure. This is especially useful when running under a debugger: when the testfails, it will drop into the debugger and you can then inspect variables and stacks. |
+| `$ foo_test --gtest_repeat=1000 --gtest_filter=FooBar` | Repeat the tests whose name matches the filter 1000 times. |
+
+If your test program contains global set-up/tear-down code registered
+using `AddGlobalTestEnvironment()`, it will be repeated in each
+iteration as well, as the flakiness may be in it. You can also specify
+the repeat count by setting the `GTEST_REPEAT` environment variable.
+
+_Availability:_ Linux, Windows, Mac.
+
+## Shuffling the Tests ##
+
+You can specify the `--gtest_shuffle` flag (or set the `GTEST_SHUFFLE`
+environment variable to `1`) to run the tests in a program in a random
+order. This helps to reveal bad dependencies between tests.
+
+By default, Google Test uses a random seed calculated from the current
+time. Therefore you'll get a different order every time. The console
+output includes the random seed value, such that you can reproduce an
+order-related test failure later. To specify the random seed
+explicitly, use the `--gtest_random_seed=SEED` flag (or set the
+`GTEST_RANDOM_SEED` environment variable), where `SEED` is an integer
+between 0 and 99999. The seed value 0 is special: it tells Google Test
+to do the default behavior of calculating the seed from the current
+time.
+
+If you combine this with `--gtest_repeat=N`, Google Test will pick a
+different random seed and re-shuffle the tests in each iteration.
+
+_Availability:_ Linux, Windows, Mac; since v1.4.0.
+
+## Controlling Test Output ##
+
+This section teaches how to tweak the way test results are reported.
+
+### Colored Terminal Output ###
+
+Google Test can use colors in its terminal output to make it easier to spot
+the separation between tests, and whether tests passed.
+
+You can set the GTEST\_COLOR environment variable or set the `--gtest_color`
+command line flag to `yes`, `no`, or `auto` (the default) to enable colors,
+disable colors, or let Google Test decide. When the value is `auto`, Google
+Test will use colors if and only if the output goes to a terminal and (on
+non-Windows platforms) the `TERM` environment variable is set to `xterm` or
+`xterm-color`.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Suppressing the Elapsed Time ###
+
+By default, Google Test prints the time it takes to run each test.  To
+suppress that, run the test program with the `--gtest_print_time=0`
+command line flag.  Setting the `GTEST_PRINT_TIME` environment
+variable to `0` has the same effect.
+
+_Availability:_ Linux, Windows, Mac.  (In Google Test 1.3.0 and lower,
+the default behavior is that the elapsed time is **not** printed.)
+
+### Generating an XML Report ###
+
+Google Test can emit a detailed XML report to a file in addition to its normal
+textual output. The report contains the duration of each test, and thus can
+help you identify slow tests.
+
+To generate the XML report, set the `GTEST_OUTPUT` environment variable or the
+`--gtest_output` flag to the string `"xml:_path_to_output_file_"`, which will
+create the file at the given location. You can also just use the string
+`"xml"`, in which case the output can be found in the `test_detail.xml` file in
+the current directory.
+
+If you specify a directory (for example, `"xml:output/directory/"` on Linux or
+`"xml:output\directory\"` on Windows), Google Test will create the XML file in
+that directory, named after the test executable (e.g. `foo_test.xml` for test
+program `foo_test` or `foo_test.exe`). If the file already exists (perhaps left
+over from a previous run), Google Test will pick a different name (e.g.
+`foo_test_1.xml`) to avoid overwriting it.
+
+The report uses the format described here.  It is based on the
+`junitreport` Ant task and can be parsed by popular continuous build
+systems like [Hudson](https://hudson.dev.java.net/). Since that format
+was originally intended for Java, a little interpretation is required
+to make it apply to Google Test tests, as shown here:
+
+```
+<testsuites name="AllTests" ...>
+  <testsuite name="test_case_name" ...>
+    <testcase name="test_name" ...>
+      <failure message="..."/>
+      <failure message="..."/>
+      <failure message="..."/>
+    </testcase>
+  </testsuite>
+</testsuites>
+```
+
+  * The root `<testsuites>` element corresponds to the entire test program.
+  * `<testsuite>` elements correspond to Google Test test cases.
+  * `<testcase>` elements correspond to Google Test test functions.
+
+For instance, the following program
+
+```
+TEST(MathTest, Addition) { ... }
+TEST(MathTest, Subtraction) { ... }
+TEST(LogicTest, NonContradiction) { ... }
+```
+
+could generate this report:
+
+```
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuites tests="3" failures="1" errors="0" time="35" name="AllTests">
+  <testsuite name="MathTest" tests="2" failures="1"* errors="0" time="15">
+    <testcase name="Addition" status="run" time="7" classname="">
+      <failure message="Value of: add(1, 1)&#x0A; Actual: 3&#x0A;Expected: 2" type=""/>
+      <failure message="Value of: add(1, -1)&#x0A; Actual: 1&#x0A;Expected: 0" type=""/>
+    </testcase>
+    <testcase name="Subtraction" status="run" time="5" classname="">
+    </testcase>
+  </testsuite>
+  <testsuite name="LogicTest" tests="1" failures="0" errors="0" time="5">
+    <testcase name="NonContradiction" status="run" time="5" classname="">
+    </testcase>
+  </testsuite>
+</testsuites>
+```
+
+Things to note:
+
+  * The `tests` attribute of a `<testsuites>` or `<testsuite>` element tells how many test functions the Google Test program or test case contains, while the `failures` attribute tells how many of them failed.
+  * The `time` attribute expresses the duration of the test, test case, or entire test program in milliseconds.
+  * Each `<failure>` element corresponds to a single failed Google Test assertion.
+  * Some JUnit concepts don't apply to Google Test, yet we have to conform to the DTD. Therefore you'll see some dummy elements and attributes in the report. You can safely ignore these parts.
+
+_Availability:_ Linux, Windows, Mac.
+
+## Controlling How Failures Are Reported ##
+
+### Turning Assertion Failures into Break-Points ###
+
+When running test programs under a debugger, it's very convenient if the
+debugger can catch an assertion failure and automatically drop into interactive
+mode. Google Test's _break-on-failure_ mode supports this behavior.
+
+To enable it, set the `GTEST_BREAK_ON_FAILURE` environment variable to a value
+other than `0` . Alternatively, you can use the `--gtest_break_on_failure`
+command line flag.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Suppressing Pop-ups Caused by Exceptions ###
+
+On Windows, Google Test may be used with exceptions enabled. Even when
+exceptions are disabled, an application can still throw structured exceptions
+(SEH's). If a test throws an exception, by default Google Test doesn't try to
+catch it. Instead, you'll see a pop-up dialog, at which point you can attach
+the process to a debugger and easily find out what went wrong.
+
+However, if you don't want to see the pop-ups (for example, if you run the
+tests in a batch job), set the `GTEST_CATCH_EXCEPTIONS` environment variable to
+a non- `0` value, or use the `--gtest_catch_exceptions` flag. Google Test now
+catches all test-thrown exceptions and logs them as failures.
+
+_Availability:_ Windows. `GTEST_CATCH_EXCEPTIONS` and
+`--gtest_catch_exceptions` have no effect on Google Test's behavior on Linux or
+Mac, even if exceptions are enabled. It is possible to add support for catching
+exceptions on these platforms, but it is not implemented yet.
+
+### Letting Another Testing Framework Drive ###
+
+If you work on a project that has already been using another testing
+framework and is not ready to completely switch to Google Test yet,
+you can get much of Google Test's benefit by using its assertions in
+your existing tests.  Just change your `main()` function to look
+like:
+
+```
+#include <gtest/gtest.h>
+
+int main(int argc, char** argv) {
+  ::testing::GTEST_FLAG(throw_on_failure) = true;
+  // Important: Google Test must be initialized.
+  ::testing::InitGoogleTest(&argc, argv);
+
+  ... whatever your existing testing framework requires ...
+}
+```
+
+With that, you can use Google Test assertions in addition to the
+native assertions your testing framework provides, for example:
+
+```
+void TestFooDoesBar() {
+  Foo foo;
+  EXPECT_LE(foo.Bar(1), 100);     // A Google Test assertion.
+  CPPUNIT_ASSERT(foo.IsEmpty());  // A native assertion.
+}
+```
+
+If a Google Test assertion fails, it will print an error message and
+throw an exception, which will be treated as a failure by your host
+testing framework.  If you compile your code with exceptions disabled,
+a failed Google Test assertion will instead exit your program with a
+non-zero code, which will also signal a test failure to your test
+runner.
+
+If you don't write `::testing::GTEST_FLAG(throw_on_failure) = true;` in
+your `main()`, you can alternatively enable this feature by specifying
+the `--gtest_throw_on_failure` flag on the command-line or setting the
+`GTEST_THROW_ON_FAILURE` environment variable to a non-zero value.
+
+_Availability:_ Linux, Windows, Mac; since v1.3.0.
+
+## Distributing Test Functions to Multiple Machines ##
+
+If you have more than one machine you can use to run a test program,
+you might want to run the test functions in parallel and get the
+result faster.  We call this technique _sharding_, where each machine
+is called a _shard_.
+
+Google Test is compatible with test sharding.  To take advantage of
+this feature, your test runner (not part of Google Test) needs to do
+the following:
+
+  1. Allocate a number of machines (shards) to run the tests.
+  1. On each shard, set the `GTEST_TOTAL_SHARDS` environment variable to the total number of shards.  It must be the same for all shards.
+  1. On each shard, set the `GTEST_SHARD_INDEX` environment variable to the index of the shard.  Different shards must be assigned different indices, which must be in the range `[0, GTEST_TOTAL_SHARDS - 1]`.
+  1. Run the same test program on all shards.  When Google Test sees the above two environment variables, it will select a subset of the test functions to run.  Across all shards, each test function in the program will be run exactly once.
+  1. Wait for all shards to finish, then collect and report the results.
+
+Your project may have tests that were written without Google Test and
+thus don't understand this protocol.  In order for your test runner to
+figure out which test supports sharding, it can set the environment
+variable `GTEST_SHARD_STATUS_FILE` to a non-existent file path.  If a
+test program supports sharding, it will create this file to
+acknowledge the fact (the actual contents of the file are not
+important at this time; although we may stick some useful information
+in it in the future.); otherwise it will not create it.
+
+Here's an example to make it clear.  Suppose you have a test program
+`foo_test` that contains the following 5 test functions:
+```
+TEST(A, V)
+TEST(A, W)
+TEST(B, X)
+TEST(B, Y)
+TEST(B, Z)
+```
+and you have 3 machines at your disposal.  To run the test functions in
+parallel, you would set `GTEST_TOTAL_SHARDS` to 3 on all machines, and
+set `GTEST_SHARD_INDEX` to 0, 1, and 2 on the machines respectively.
+Then you would run the same `foo_test` on each machine.
+
+Google Test reserves the right to change how the work is distributed
+across the shards, but here's one possible scenario:
+
+  * Machine #0 runs `A.V` and `B.X`.
+  * Machine #1 runs `A.W` and `B.Y`.
+  * Machine #2 runs `B.Z`.
+
+_Availability:_ Linux, Windows, Mac; since version 1.3.0.
+
+# Fusing Google Test Source Files #
+
+Google Test's implementation consists of ~30 files (excluding its own
+tests).  Sometimes you may want them to be packaged up in two files (a
+`.h` and a `.cc`) instead, such that you can easily copy them to a new
+machine and start hacking there.  For this we provide an experimental
+Python script `fuse_gtest_files.py` in the `scripts/` directory (since release 1.3.0).
+Assuming you have Python 2.4 or above installed on your machine, just
+go to that directory and run
+```
+python fuse_gtest_files.py OUTPUT_DIR
+```
+
+and you should see an `OUTPUT_DIR` directory being created with files
+`gtest/gtest.h` and `gtest/gtest-all.cc` in it.  These files contain
+everything you need to use Google Test.  Just copy them to anywhere
+you want and you are ready to write tests.  You can use the
+[scrpts/test/Makefile](../scripts/test/Makefile)
+file as an example on how to compile your tests against them.
+
+# Where to Go from Here #
+
+Congratulations! You've now learned more advanced Google Test tools and are
+ready to tackle more complex testing tasks. If you want to dive even deeper, you
+can read the [FAQ](V1_5_FAQ.md).
diff --git a/docs/V1_5_Documentation.md b/docs/V1_5_Documentation.md
new file mode 100755 (executable)
index 0000000..46bba2e
--- /dev/null
@@ -0,0 +1,12 @@
+This page lists all official documentation wiki pages for Google Test **1.5.0** -- **if you use a different version of Google Test, make sure to read the documentation for that version instead.**
+
+  * [Primer](V1_5_Primer.md) -- start here if you are new to Google Test.
+  * [Samples](Samples.md) -- learn from examples.
+  * [AdvancedGuide](V1_5_AdvancedGuide.md) -- learn more about Google Test.
+  * [XcodeGuide](V1_5_XcodeGuide.md) -- how to use Google Test in Xcode on Mac.
+  * [Frequently-Asked Questions](V1_5_FAQ.md) -- check here before asking a question on the mailing list.
+
+To contribute code to Google Test, read:
+
+  * DevGuide -- read this _before_ writing your first patch.
+  * [PumpManual](V1_5_PumpManual.md) -- how we generate some of Google Test's source files.
\ No newline at end of file
diff --git a/docs/V1_5_FAQ.md b/docs/V1_5_FAQ.md
new file mode 100755 (executable)
index 0000000..e870aff
--- /dev/null
@@ -0,0 +1,886 @@
+
+
+If you cannot find the answer to your question here, and you have read
+[Primer](V1_5_Primer.md) and [AdvancedGuide](V1_5_AdvancedGuide.md), send it to
+googletestframework@googlegroups.com.
+
+## Why should I use Google Test instead of my favorite C++ testing framework? ##
+
+First, let's say clearly that we don't want to get into the debate of
+which C++ testing framework is **the best**.  There exist many fine
+frameworks for writing C++ tests, and we have tremendous respect for
+the developers and users of them.  We don't think there is (or will
+be) a single best framework - you have to pick the right tool for the
+particular task you are tackling.
+
+We created Google Test because we couldn't find the right combination
+of features and conveniences in an existing framework to satisfy _our_
+needs.  The following is a list of things that _we_ like about Google
+Test.  We don't claim them to be unique to Google Test - rather, the
+combination of them makes Google Test the choice for us.  We hope this
+list can help you decide whether it is for you too.
+
+  * Google Test is designed to be portable.  It works where many STL types (e.g. `std::string` and `std::vector`) don't compile.  It doesn't require exceptions or RTTI.  As a result, it runs on Linux, Mac OS X, Windows and several embedded operating systems.
+  * Nonfatal assertions (`EXPECT_*`) have proven to be great time savers, as they allow a test to report multiple failures in a single edit-compile-test cycle.
+  * It's easy to write assertions that generate informative messages: you just use the stream syntax to append any additional information, e.g. `ASSERT_EQ(5, Foo(i)) << " where i = " << i;`.  It doesn't require a new set of macros or special functions.
+  * Google Test automatically detects your tests and doesn't require you to enumerate them in order to run them.
+  * No framework can anticipate all your needs, so Google Test provides `EXPECT_PRED*` to make it easy to extend your assertion vocabulary.  For a nicer syntax, you can define your own assertion macros trivially in terms of `EXPECT_PRED*`.
+  * Death tests are pretty handy for ensuring that your asserts in production code are triggered by the right conditions.
+  * `SCOPED_TRACE` helps you understand the context of an assertion failure when it comes from inside a sub-routine or loop.
+  * You can decide which tests to run using name patterns.  This saves time when you want to quickly reproduce a test failure.
+
+## How do I generate 64-bit binaries on Windows (using Visual Studio 2008)? ##
+
+(Answered by Trevor Robinson)
+
+Load the supplied Visual Studio solution file, either `msvc\gtest-md.sln` or
+`msvc\gtest.sln`. Go through the migration wizard to migrate the
+solution and project files to Visual Studio 2008. Select
+`Configuration Manager...` from the `Build` menu. Select `<New...>` from
+the `Active solution platform` dropdown.  Select `x64` from the new
+platform dropdown, leave `Copy settings from` set to `Win32` and
+`Create new project platforms` checked, then click `OK`. You now have
+`Win32` and `x64` platform configurations, selectable from the
+`Standard` toolbar, which allow you to toggle between building 32-bit or
+64-bit binaries (or both at once using Batch Build).
+
+In order to prevent build output files from overwriting one another,
+you'll need to change the `Intermediate Directory` settings for the
+newly created platform configuration across all the projects. To do
+this, multi-select (e.g. using shift-click) all projects (but not the
+solution) in the `Solution Explorer`. Right-click one of them and
+select `Properties`. In the left pane, select `Configuration Properties`,
+and from the `Configuration` dropdown, select `All Configurations`.
+Make sure the selected platform is `x64`. For the
+`Intermediate Directory` setting, change the value from
+`$(PlatformName)\$(ConfigurationName)` to
+`$(OutDir)\$(ProjectName)`. Click `OK` and then build the
+solution. When the build is complete, the 64-bit binaries will be in
+the `msvc\x64\Debug` directory.
+
+## Can I use Google Test on MinGW? ##
+
+We haven't tested this ourselves, but Per Abrahamsen reported that he
+was able to compile and install Google Test successfully when using
+MinGW from Cygwin.  You'll need to configure it with:
+
+`PATH/TO/configure CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin"`
+
+You should be able to replace the `-mno-cygwin` option with direct links
+to the real MinGW binaries, but we haven't tried that.
+
+Caveats:
+
+  * There are many warnings when compiling.
+  * `make check` will produce some errors as not all tests for Google Test itself are compatible with MinGW.
+
+We also have reports on successful cross compilation of Google Test MinGW binaries on Linux using [these instructions](http://wiki.wxwidgets.org/Cross-Compiling_Under_Linux#Cross-compiling_under_Linux_for_MS_Windows) on the WxWidgets site.
+
+Please contact `googletestframework@googlegroups.com` if you are
+interested in improving the support for MinGW.
+
+## Why does Google Test support EXPECT\_EQ(NULL, ptr) and ASSERT\_EQ(NULL, ptr) but not EXPECT\_NE(NULL, ptr) and ASSERT\_NE(NULL, ptr)? ##
+
+Due to some peculiarity of C++, it requires some non-trivial template
+meta programming tricks to support using `NULL` as an argument of the
+`EXPECT_XX()` and `ASSERT_XX()` macros. Therefore we only do it where
+it's most needed (otherwise we make the implementation of Google Test
+harder to maintain and more error-prone than necessary).
+
+The `EXPECT_EQ()` macro takes the _expected_ value as its first
+argument and the _actual_ value as the second. It's reasonable that
+someone wants to write `EXPECT_EQ(NULL, some_expression)`, and this
+indeed was requested several times. Therefore we implemented it.
+
+The need for `EXPECT_NE(NULL, ptr)` isn't nearly as strong. When the
+assertion fails, you already know that `ptr` must be `NULL`, so it
+doesn't add any information to print ptr in this case. That means
+`EXPECT_TRUE(ptr ! NULL)` works just as well.
+
+If we were to support `EXPECT_NE(NULL, ptr)`, for consistency we'll
+have to support `EXPECT_NE(ptr, NULL)` as well, as unlike `EXPECT_EQ`,
+we don't have a convention on the order of the two arguments for
+`EXPECT_NE`. This means using the template meta programming tricks
+twice in the implementation, making it even harder to understand and
+maintain. We believe the benefit doesn't justify the cost.
+
+Finally, with the growth of Google Mock's [matcher](../../CookBook.md#using-matchers-in-google-test-assertions) library, we are
+encouraging people to use the unified `EXPECT_THAT(value, matcher)`
+syntax more often in tests. One significant advantage of the matcher
+approach is that matchers can be easily combined to form new matchers,
+while the `EXPECT_NE`, etc, macros cannot be easily
+combined. Therefore we want to invest more in the matchers than in the
+`EXPECT_XX()` macros.
+
+## Does Google Test support running tests in parallel? ##
+
+Test runners tend to be tightly coupled with the build/test
+environment, and Google Test doesn't try to solve the problem of
+running tests in parallel.  Instead, we tried to make Google Test work
+nicely with test runners.  For example, Google Test's XML report
+contains the time spent on each test, and its `gtest_list_tests` and
+`gtest_filter` flags can be used for splitting the execution of test
+methods into multiple processes.  These functionalities can help the
+test runner run the tests in parallel.
+
+## Why don't Google Test run the tests in different threads to speed things up? ##
+
+It's difficult to write thread-safe code.  Most tests are not written
+with thread-safety in mind, and thus may not work correctly in a
+multi-threaded setting.
+
+If you think about it, it's already hard to make your code work when
+you know what other threads are doing.  It's much harder, and
+sometimes even impossible, to make your code work when you don't know
+what other threads are doing (remember that test methods can be added,
+deleted, or modified after your test was written).  If you want to run
+the tests in parallel, you'd better run them in different processes.
+
+## Why aren't Google Test assertions implemented using exceptions? ##
+
+Our original motivation was to be able to use Google Test in projects
+that disable exceptions.  Later we realized some additional benefits
+of this approach:
+
+  1. Throwing in a destructor is undefined behavior in C++.  Not using exceptions means Google Test's assertions are safe to use in destructors.
+  1. The `EXPECT_*` family of macros will continue even after a failure, allowing multiple failures in a `TEST` to be reported in a single run. This is a popular feature, as in C++ the edit-compile-test cycle is usually quite long and being able to fixing more than one thing at a time is a blessing.
+  1. If assertions are implemented using exceptions, a test may falsely ignore a failure if it's caught by user code:
+```
+try { ... ASSERT_TRUE(...) ... }
+catch (...) { ... }
+```
+The above code will pass even if the `ASSERT_TRUE` throws.  While it's unlikely for someone to write this in a test, it's possible to run into this pattern when you write assertions in callbacks that are called by the code under test.
+
+The downside of not using exceptions is that `ASSERT_*` (implemented
+using `return`) will only abort the current function, not the current
+`TEST`.
+
+## Why do we use two different macros for tests with and without fixtures? ##
+
+Unfortunately, C++'s macro system doesn't allow us to use the same
+macro for both cases.  One possibility is to provide only one macro
+for tests with fixtures, and require the user to define an empty
+fixture sometimes:
+
+```
+class FooTest : public ::testing::Test {};
+
+TEST_F(FooTest, DoesThis) { ... }
+```
+or
+```
+typedef ::testing::Test FooTest;
+
+TEST_F(FooTest, DoesThat) { ... }
+```
+
+Yet, many people think this is one line too many. :-) Our goal was to
+make it really easy to write tests, so we tried to make simple tests
+trivial to create.  That means using a separate macro for such tests.
+
+We think neither approach is ideal, yet either of them is reasonable.
+In the end, it probably doesn't matter much either way.
+
+## Why don't we use structs as test fixtures? ##
+
+We like to use structs only when representing passive data.  This
+distinction between structs and classes is good for documenting the
+intent of the code's author.  Since test fixtures have logic like
+`SetUp()` and `TearDown()`, they are better defined as classes.
+
+## Why are death tests implemented as assertions instead of using a test runner? ##
+
+Our goal was to make death tests as convenient for a user as C++
+possibly allows.  In particular:
+
+  * The runner-style requires to split the information into two pieces: the definition of the death test itself, and the specification for the runner on how to run the death test and what to expect.  The death test would be written in C++, while the runner spec may or may not be.  A user needs to carefully keep the two in sync. `ASSERT_DEATH(statement, expected_message)` specifies all necessary information in one place, in one language, without boilerplate code. It is very declarative.
+  * `ASSERT_DEATH` has a similar syntax and error-reporting semantics as other Google Test assertions, and thus is easy to learn.
+  * `ASSERT_DEATH` can be mixed with other assertions and other logic at your will.  You are not limited to one death test per test method. For example, you can write something like:
+```
+    if (FooCondition()) {
+      ASSERT_DEATH(Bar(), "blah");
+    } else {
+      ASSERT_EQ(5, Bar());
+    }
+```
+If you prefer one death test per test method, you can write your tests in that style too, but we don't want to impose that on the users.  The fewer artificial limitations the better.
+  * `ASSERT_DEATH` can reference local variables in the current function, and you can decide how many death tests you want based on run-time information.  For example,
+```
+    const int count = GetCount();  // Only known at run time.
+    for (int i = 1; i <= count; i++) {
+      ASSERT_DEATH({
+        double* buffer = new double[i];
+        ... initializes buffer ...
+        Foo(buffer, i)
+      }, "blah blah");
+    }
+```
+The runner-based approach tends to be more static and less flexible, or requires more user effort to get this kind of flexibility.
+
+Another interesting thing about `ASSERT_DEATH` is that it calls `fork()`
+to create a child process to run the death test.  This is lightening
+fast, as `fork()` uses copy-on-write pages and incurs almost zero
+overhead, and the child process starts from the user-supplied
+statement directly, skipping all global and local initialization and
+any code leading to the given statement.  If you launch the child
+process from scratch, it can take seconds just to load everything and
+start running if the test links to many libraries dynamically.
+
+## My death test modifies some state, but the change seems lost after the death test finishes. Why? ##
+
+Death tests (`EXPECT_DEATH`, etc) are executed in a sub-process s.t. the
+expected crash won't kill the test program (i.e. the parent process). As a
+result, any in-memory side effects they incur are observable in their
+respective sub-processes, but not in the parent process. You can think of them
+as running in a parallel universe, more or less.
+
+## The compiler complains about "undefined references" to some static const member variables, but I did define them in the class body. What's wrong? ##
+
+If your class has a static data member:
+
+```
+// foo.h
+class Foo {
+  ...
+  static const int kBar = 100;
+};
+```
+
+You also need to define it _outside_ of the class body in `foo.cc`:
+
+```
+const int Foo::kBar;  // No initializer here.
+```
+
+Otherwise your code is **invalid C++**, and may break in unexpected ways. In
+particular, using it in Google Test comparison assertions (`EXPECT_EQ`, etc)
+will generate an "undefined reference" linker error.
+
+## I have an interface that has several implementations. Can I write a set of tests once and repeat them over all the implementations? ##
+
+Google Test doesn't yet have good support for this kind of tests, or
+data-driven tests in general. We hope to be able to make improvements in this
+area soon.
+
+## Can I derive a test fixture from another? ##
+
+Yes.
+
+Each test fixture has a corresponding and same named test case. This means only
+one test case can use a particular fixture. Sometimes, however, multiple test
+cases may want to use the same or slightly different fixtures. For example, you
+may want to make sure that all of a GUI library's test cases don't leak
+important system resources like fonts and brushes.
+
+In Google Test, you share a fixture among test cases by putting the shared
+logic in a base test fixture, then deriving from that base a separate fixture
+for each test case that wants to use this common logic. You then use `TEST_F()`
+to write tests using each derived fixture.
+
+Typically, your code looks like this:
+
+```
+// Defines a base test fixture.
+class BaseTest : public ::testing::Test {
+  protected:
+   ...
+};
+
+// Derives a fixture FooTest from BaseTest.
+class FooTest : public BaseTest {
+  protected:
+    virtual void SetUp() {
+      BaseTest::SetUp();  // Sets up the base fixture first.
+      ... additional set-up work ...
+    }
+    virtual void TearDown() {
+      ... clean-up work for FooTest ...
+      BaseTest::TearDown();  // Remember to tear down the base fixture
+                             // after cleaning up FooTest!
+    }
+    ... functions and variables for FooTest ...
+};
+
+// Tests that use the fixture FooTest.
+TEST_F(FooTest, Bar) { ... }
+TEST_F(FooTest, Baz) { ... }
+
+... additional fixtures derived from BaseTest ...
+```
+
+If necessary, you can continue to derive test fixtures from a derived fixture.
+Google Test has no limit on how deep the hierarchy can be.
+
+For a complete example using derived test fixtures, see
+`samples/sample5_unittest.cc`.
+
+## My compiler complains "void value not ignored as it ought to be." What does this mean? ##
+
+You're probably using an `ASSERT_*()` in a function that doesn't return `void`.
+`ASSERT_*()` can only be used in `void` functions.
+
+## My death test hangs (or seg-faults). How do I fix it? ##
+
+In Google Test, death tests are run in a child process and the way they work is
+delicate. To write death tests you really need to understand how they work.
+Please make sure you have read this.
+
+In particular, death tests don't like having multiple threads in the parent
+process. So the first thing you can try is to eliminate creating threads
+outside of `EXPECT_DEATH()`.
+
+Sometimes this is impossible as some library you must use may be creating
+threads before `main()` is even reached. In this case, you can try to minimize
+the chance of conflicts by either moving as many activities as possible inside
+`EXPECT_DEATH()` (in the extreme case, you want to move everything inside), or
+leaving as few things as possible in it. Also, you can try to set the death
+test style to `"threadsafe"`, which is safer but slower, and see if it helps.
+
+If you go with thread-safe death tests, remember that they rerun the test
+program from the beginning in the child process. Therefore make sure your
+program can run side-by-side with itself and is deterministic.
+
+In the end, this boils down to good concurrent programming. You have to make
+sure that there is no race conditions or dead locks in your program. No silver
+bullet - sorry!
+
+## Should I use the constructor/destructor of the test fixture or the set-up/tear-down function? ##
+
+The first thing to remember is that Google Test does not reuse the
+same test fixture object across multiple tests. For each `TEST_F`,
+Google Test will create a fresh test fixture object, _immediately_
+call `SetUp()`, run the test, call `TearDown()`, and then
+_immediately_ delete the test fixture object. Therefore, there is no
+need to write a `SetUp()` or `TearDown()` function if the constructor
+or destructor already does the job.
+
+You may still want to use `SetUp()/TearDown()` in the following cases:
+  * If the tear-down operation could throw an exception, you must use `TearDown()` as opposed to the destructor, as throwing in a destructor leads to undefined behavior and usually will kill your program right away. Note that many standard libraries (like STL) may throw when exceptions are enabled in the compiler. Therefore you should prefer `TearDown()` if you want to write portable tests that work with or without exceptions.
+  * The Google Test team is considering making the assertion macros throw on platforms where exceptions are enabled (e.g. Windows, Mac OS, and Linux client-side), which will eliminate the need for the user to propagate failures from a subroutine to its caller. Therefore, you shouldn't use Google Test assertions in a destructor if your code could run on such a platform.
+  * In a constructor or destructor, you cannot make a virtual function call on this object. (You can call a method declared as virtual, but it will be statically bound.) Therefore, if you need to call a method that will be overriden in a derived class, you have to use `SetUp()/TearDown()`.
+
+## The compiler complains "no matching function to call" when I use ASSERT\_PREDn. How do I fix it? ##
+
+If the predicate function you use in `ASSERT_PRED*` or `EXPECT_PRED*` is
+overloaded or a template, the compiler will have trouble figuring out which
+overloaded version it should use. `ASSERT_PRED_FORMAT*` and
+`EXPECT_PRED_FORMAT*` don't have this problem.
+
+If you see this error, you might want to switch to
+`(ASSERT|EXPECT)_PRED_FORMAT*`, which will also give you a better failure
+message. If, however, that is not an option, you can resolve the problem by
+explicitly telling the compiler which version to pick.
+
+For example, suppose you have
+
+```
+bool IsPositive(int n) {
+  return n > 0;
+}
+bool IsPositive(double x) {
+  return x > 0;
+}
+```
+
+you will get a compiler error if you write
+
+```
+EXPECT_PRED1(IsPositive, 5);
+```
+
+However, this will work:
+
+```
+EXPECT_PRED1(*static_cast<bool (*)(int)>*(IsPositive), 5);
+```
+
+(The stuff inside the angled brackets for the `static_cast` operator is the
+type of the function pointer for the `int`-version of `IsPositive()`.)
+
+As another example, when you have a template function
+
+```
+template <typename T>
+bool IsNegative(T x) {
+  return x < 0;
+}
+```
+
+you can use it in a predicate assertion like this:
+
+```
+ASSERT_PRED1(IsNegative*<int>*, -5);
+```
+
+Things are more interesting if your template has more than one parameters. The
+following won't compile:
+
+```
+ASSERT_PRED2(*GreaterThan<int, int>*, 5, 0);
+```
+
+
+as the C++ pre-processor thinks you are giving `ASSERT_PRED2` 4 arguments,
+which is one more than expected. The workaround is to wrap the predicate
+function in parentheses:
+
+```
+ASSERT_PRED2(*(GreaterThan<int, int>)*, 5, 0);
+```
+
+
+## My compiler complains about "ignoring return value" when I call RUN\_ALL\_TESTS(). Why? ##
+
+Some people had been ignoring the return value of `RUN_ALL_TESTS()`. That is,
+instead of
+
+```
+return RUN_ALL_TESTS();
+```
+
+they write
+
+```
+RUN_ALL_TESTS();
+```
+
+This is wrong and dangerous. A test runner needs to see the return value of
+`RUN_ALL_TESTS()` in order to determine if a test has passed. If your `main()`
+function ignores it, your test will be considered successful even if it has a
+Google Test assertion failure. Very bad.
+
+To help the users avoid this dangerous bug, the implementation of
+`RUN_ALL_TESTS()` causes gcc to raise this warning, when the return value is
+ignored. If you see this warning, the fix is simple: just make sure its value
+is used as the return value of `main()`.
+
+## My compiler complains that a constructor (or destructor) cannot return a value. What's going on? ##
+
+Due to a peculiarity of C++, in order to support the syntax for streaming
+messages to an `ASSERT_*`, e.g.
+
+```
+ASSERT_EQ(1, Foo()) << "blah blah" << foo;
+```
+
+we had to give up using `ASSERT*` and `FAIL*` (but not `EXPECT*` and
+`ADD_FAILURE*`) in constructors and destructors. The workaround is to move the
+content of your constructor/destructor to a private void member function, or
+switch to `EXPECT_*()` if that works. This section in the user's guide explains
+it.
+
+## My set-up function is not called. Why? ##
+
+C++ is case-sensitive. It should be spelled as `SetUp()`.  Did you
+spell it as `Setup()`?
+
+Similarly, sometimes people spell `SetUpTestCase()` as `SetupTestCase()` and
+wonder why it's never called.
+
+## How do I jump to the line of a failure in Emacs directly? ##
+
+Google Test's failure message format is understood by Emacs and many other
+IDEs, like acme and XCode. If a Google Test message is in a compilation buffer
+in Emacs, then it's clickable. You can now hit `enter` on a message to jump to
+the corresponding source code, or use `C-x `` to jump to the next failure.
+
+## I have several test cases which share the same test fixture logic, do I have to define a new test fixture class for each of them? This seems pretty tedious. ##
+
+You don't have to. Instead of
+
+```
+class FooTest : public BaseTest {};
+
+TEST_F(FooTest, Abc) { ... }
+TEST_F(FooTest, Def) { ... }
+
+class BarTest : public BaseTest {};
+
+TEST_F(BarTest, Abc) { ... }
+TEST_F(BarTest, Def) { ... }
+```
+
+you can simply `typedef` the test fixtures:
+```
+typedef BaseTest FooTest;
+
+TEST_F(FooTest, Abc) { ... }
+TEST_F(FooTest, Def) { ... }
+
+typedef BaseTest BarTest;
+
+TEST_F(BarTest, Abc) { ... }
+TEST_F(BarTest, Def) { ... }
+```
+
+## The Google Test output is buried in a whole bunch of log messages. What do I do? ##
+
+The Google Test output is meant to be a concise and human-friendly report. If
+your test generates textual output itself, it will mix with the Google Test
+output, making it hard to read. However, there is an easy solution to this
+problem.
+
+Since most log messages go to stderr, we decided to let Google Test output go
+to stdout. This way, you can easily separate the two using redirection. For
+example:
+```
+./my_test > googletest_output.txt
+```
+
+## Why should I prefer test fixtures over global variables? ##
+
+There are several good reasons:
+  1. It's likely your test needs to change the states of its global variables. This makes it difficult to keep side effects from escaping one test and contaminating others, making debugging difficult. By using fixtures, each test has a fresh set of variables that's different (but with the same names). Thus, tests are kept independent of each other.
+  1. Global variables pollute the global namespace.
+  1. Test fixtures can be reused via subclassing, which cannot be done easily with global variables. This is useful if many test cases have something in common.
+
+## How do I test private class members without writing FRIEND\_TEST()s? ##
+
+You should try to write testable code, which means classes should be easily
+tested from their public interface. One way to achieve this is the Pimpl idiom:
+you move all private members of a class into a helper class, and make all
+members of the helper class public.
+
+You have several other options that don't require using `FRIEND_TEST`:
+  * Write the tests as members of the fixture class:
+```
+class Foo {
+  friend class FooTest;
+  ...
+};
+
+class FooTest : public ::testing::Test {
+ protected:
+  ...
+  void Test1() {...} // This accesses private members of class Foo.
+  void Test2() {...} // So does this one.
+};
+
+TEST_F(FooTest, Test1) {
+  Test1();
+}
+
+TEST_F(FooTest, Test2) {
+  Test2();
+}
+```
+  * In the fixture class, write accessors for the tested class' private members, then use the accessors in your tests:
+```
+class Foo {
+  friend class FooTest;
+  ...
+};
+
+class FooTest : public ::testing::Test {
+ protected:
+  ...
+  T1 get_private_member1(Foo* obj) {
+    return obj->private_member1_;
+  }
+};
+
+TEST_F(FooTest, Test1) {
+  ...
+  get_private_member1(x)
+  ...
+}
+```
+  * If the methods are declared **protected**, you can change their access level in a test-only subclass:
+```
+class YourClass {
+  ...
+ protected: // protected access for testability.
+  int DoSomethingReturningInt();
+  ...
+};
+
+// in the your_class_test.cc file:
+class TestableYourClass : public YourClass {
+  ...
+ public: using YourClass::DoSomethingReturningInt; // changes access rights
+  ...
+};
+
+TEST_F(YourClassTest, DoSomethingTest) {
+  TestableYourClass obj;
+  assertEquals(expected_value, obj.DoSomethingReturningInt());
+}
+```
+
+## How do I test private class static members without writing FRIEND\_TEST()s? ##
+
+We find private static methods clutter the header file.  They are
+implementation details and ideally should be kept out of a .h. So often I make
+them free functions instead.
+
+Instead of:
+```
+// foo.h
+class Foo {
+  ...
+ private:
+  static bool Func(int n);
+};
+
+// foo.cc
+bool Foo::Func(int n) { ... }
+
+// foo_test.cc
+EXPECT_TRUE(Foo::Func(12345));
+```
+
+You probably should better write:
+```
+// foo.h
+class Foo {
+  ...
+};
+
+// foo.cc
+namespace internal {
+  bool Func(int n) { ... }
+}
+
+// foo_test.cc
+namespace internal {
+  bool Func(int n);
+}
+
+EXPECT_TRUE(internal::Func(12345));
+```
+
+## I would like to run a test several times with different parameters. Do I need to write several similar copies of it? ##
+
+No. You can use a feature called [value-parameterized tests](V1_5_AdvancedGuide.md#Value_Parameterized_Tests) which
+lets you repeat your tests with different parameters, without defining it more than once.
+
+## How do I test a file that defines main()? ##
+
+To test a `foo.cc` file, you need to compile and link it into your unit test
+program. However, when the file contains a definition for the `main()`
+function, it will clash with the `main()` of your unit test, and will result in
+a build error.
+
+The right solution is to split it into three files:
+  1. `foo.h` which contains the declarations,
+  1. `foo.cc` which contains the definitions except `main()`, and
+  1. `foo_main.cc` which contains nothing but the definition of `main()`.
+
+Then `foo.cc` can be easily tested.
+
+If you are adding tests to an existing file and don't want an intrusive change
+like this, there is a hack: just include the entire `foo.cc` file in your unit
+test. For example:
+```
+// File foo_unittest.cc
+
+// The headers section
+...
+
+// Renames main() in foo.cc to make room for the unit test main()
+#define main FooMain
+
+#include "a/b/foo.cc"
+
+// The tests start here.
+...
+```
+
+
+However, please remember this is a hack and should only be used as the last
+resort.
+
+## What can the statement argument in ASSERT\_DEATH() be? ##
+
+`ASSERT_DEATH(_statement_, _regex_)` (or any death assertion macro) can be used
+wherever `_statement_` is valid. So basically `_statement_` can be any C++
+statement that makes sense in the current context. In particular, it can
+reference global and/or local variables, and can be:
+  * a simple function call (often the case),
+  * a complex expression, or
+  * a compound statement.
+
+> Some examples are shown here:
+
+```
+// A death test can be a simple function call.
+TEST(MyDeathTest, FunctionCall) {
+  ASSERT_DEATH(Xyz(5), "Xyz failed");
+}
+
+// Or a complex expression that references variables and functions.
+TEST(MyDeathTest, ComplexExpression) {
+  const bool c = Condition();
+  ASSERT_DEATH((c ? Func1(0) : object2.Method("test")),
+               "(Func1|Method) failed");
+}
+
+// Death assertions can be used any where in a function. In
+// particular, they can be inside a loop.
+TEST(MyDeathTest, InsideLoop) {
+  // Verifies that Foo(0), Foo(1), ..., and Foo(4) all die.
+  for (int i = 0; i < 5; i++) {
+    EXPECT_DEATH_M(Foo(i), "Foo has \\d+ errors",
+                   ::testing::Message() << "where i is " << i);
+  }
+}
+
+// A death assertion can contain a compound statement.
+TEST(MyDeathTest, CompoundStatement) {
+  // Verifies that at lease one of Bar(0), Bar(1), ..., and
+  // Bar(4) dies.
+  ASSERT_DEATH({
+    for (int i = 0; i < 5; i++) {
+      Bar(i);
+    }
+  },
+  "Bar has \\d+ errors");}
+```
+
+`googletest_unittest.cc` contains more examples if you are interested.
+
+## What syntax does the regular expression in ASSERT\_DEATH use? ##
+
+On POSIX systems, Google Test uses the POSIX Extended regular
+expression syntax
+(http://en.wikipedia.org/wiki/Regular_expression#POSIX_Extended_Regular_Expressions). On
+Windows, it uses a limited variant of regular expression syntax. For
+more details, see the [regular expression syntax](V1_5_AdvancedGuide.md#Regular_Expression_Syntax).
+
+## I have a fixture class Foo, but TEST\_F(Foo, Bar) gives me error "no matching function for call to Foo::Foo()". Why? ##
+
+Google Test needs to be able to create objects of your test fixture class, so
+it must have a default constructor. Normally the compiler will define one for
+you. However, there are cases where you have to define your own:
+  * If you explicitly declare a non-default constructor for class `Foo`, then you need to define a default constructor, even if it would be empty.
+  * If `Foo` has a const non-static data member, then you have to define the default constructor _and_ initialize the const member in the initializer list of the constructor. (Early versions of `gcc` doesn't force you to initialize the const member. It's a bug that has been fixed in `gcc 4`.)
+
+## Why does ASSERT\_DEATH complain about previous threads that were already joined? ##
+
+With the Linux pthread library, there is no turning back once you cross the
+line from single thread to multiple threads. The first time you create a
+thread, a manager thread is created in addition, so you get 3, not 2, threads.
+Later when the thread you create joins the main thread, the thread count
+decrements by 1, but the manager thread will never be killed, so you still have
+2 threads, which means you cannot safely run a death test.
+
+The new NPTL thread library doesn't suffer from this problem, as it doesn't
+create a manager thread. However, if you don't control which machine your test
+runs on, you shouldn't depend on this.
+
+## Why does Google Test require the entire test case, instead of individual tests, to be named FOODeathTest when it uses ASSERT\_DEATH? ##
+
+Google Test does not interleave tests from different test cases. That is, it
+runs all tests in one test case first, and then runs all tests in the next test
+case, and so on. Google Test does this because it needs to set up a test case
+before the first test in it is run, and tear it down afterwords. Splitting up
+the test case would require multiple set-up and tear-down processes, which is
+inefficient and makes the semantics unclean.
+
+If we were to determine the order of tests based on test name instead of test
+case name, then we would have a problem with the following situation:
+
+```
+TEST_F(FooTest, AbcDeathTest) { ... }
+TEST_F(FooTest, Uvw) { ... }
+
+TEST_F(BarTest, DefDeathTest) { ... }
+TEST_F(BarTest, Xyz) { ... }
+```
+
+Since `FooTest.AbcDeathTest` needs to run before `BarTest.Xyz`, and we don't
+interleave tests from different test cases, we need to run all tests in the
+`FooTest` case before running any test in the `BarTest` case. This contradicts
+with the requirement to run `BarTest.DefDeathTest` before `FooTest.Uvw`.
+
+## But I don't like calling my entire test case FOODeathTest when it contains both death tests and non-death tests. What do I do? ##
+
+You don't have to, but if you like, you may split up the test case into
+`FooTest` and `FooDeathTest`, where the names make it clear that they are
+related:
+
+```
+class FooTest : public ::testing::Test { ... };
+
+TEST_F(FooTest, Abc) { ... }
+TEST_F(FooTest, Def) { ... }
+
+typedef FooTest FooDeathTest;
+
+TEST_F(FooDeathTest, Uvw) { ... EXPECT_DEATH(...) ... }
+TEST_F(FooDeathTest, Xyz) { ... ASSERT_DEATH(...) ... }
+```
+
+## The compiler complains about "no match for 'operator<<'" when I use an assertion. What gives? ##
+
+If you use a user-defined type `FooType` in an assertion, you must make sure
+there is an `std::ostream& operator<<(std::ostream&, const FooType&)` function
+defined such that we can print a value of `FooType`.
+
+In addition, if `FooType` is declared in a name space, the `<<` operator also
+needs to be defined in the _same_ name space.
+
+## How do I suppress the memory leak messages on Windows? ##
+
+Since the statically initialized Google Test singleton requires allocations on
+the heap, the Visual C++ memory leak detector will report memory leaks at the
+end of the program run. The easiest way to avoid this is to use the
+`_CrtMemCheckpoint` and `_CrtMemDumpAllObjectsSince` calls to not report any
+statically initialized heap objects. See MSDN for more details and additional
+heap check/debug routines.
+
+## I am building my project with Google Test in Visual Studio and all I'm getting is a bunch of linker errors (or warnings). Help! ##
+
+You may get a number of the following linker error or warnings if you
+attempt to link your test project with the Google Test library when
+your project and the are not built using the same compiler settings.
+
+  * LNK2005: symbol already defined in object
+  * LNK4217: locally defined symbol 'symbol' imported in function 'function'
+  * LNK4049: locally defined symbol 'symbol' imported
+
+The Google Test project (gtest.vcproj) has the Runtime Library option
+set to /MT (use multi-threaded static libraries, /MTd for debug). If
+your project uses something else, for example /MD (use multi-threaded
+DLLs, /MDd for debug), you need to change the setting in the Google
+Test project to match your project's.
+
+To update this setting open the project properties in the Visual
+Studio IDE then select the branch Configuration Properties | C/C++ |
+Code Generation and change the option "Runtime Library".  You may also try
+using gtest-md.vcproj instead of gtest.vcproj.
+
+## I put my tests in a library and Google Test doesn't run them. What's happening? ##
+Have you read a
+[warning](V1_5_Primer.md#important-note-for-visual-c-users) on
+the Google Test Primer page?
+
+## I want to use Google Test with Visual Studio but don't know where to start. ##
+Many people are in your position and one of the posted his solution to
+our mailing list. Here is his link:
+http://hassanjamilahmad.blogspot.com/2009/07/gtest-starters-help.html.
+
+## My question is not covered in your FAQ! ##
+
+If you cannot find the answer to your question in this FAQ, there are
+some other resources you can use:
+
+  1. read other [wiki pages](http://code.google.com/p/googletest/w/list),
+  1. search the mailing list [archive](http://groups.google.com/group/googletestframework/topics),
+  1. ask it on [googletestframework@googlegroups.com](mailto:googletestframework@googlegroups.com) and someone will answer it (to prevent spam, we require you to join the [discussion group](http://groups.google.com/group/googletestframework) before you can post.).
+
+Please note that creating an issue in the
+[issue tracker](http://code.google.com/p/googletest/issues/list) is _not_
+a good way to get your answer, as it is monitored infrequently by a
+very small number of people.
+
+When asking a question, it's helpful to provide as much of the
+following information as possible (people cannot help you if there's
+not enough information in your question):
+
+  * the version (or the revision number if you check out from SVN directly) of Google Test you use (Google Test is under active development, so it's possible that your problem has been solved in a later version),
+  * your operating system,
+  * the name and version of your compiler,
+  * the complete command line flags you give to your compiler,
+  * the complete compiler error messages (if the question is about compilation),
+  * the _actual_ code (ideally, a minimal but complete program) that has the problem you encounter.
diff --git a/docs/V1_5_Primer.md b/docs/V1_5_Primer.md
new file mode 100755 (executable)
index 0000000..6960d2c
--- /dev/null
@@ -0,0 +1,497 @@
+
+
+# Introduction: Why Google C++ Testing Framework? #
+
+_Google C++ Testing Framework_ helps you write better C++ tests.
+
+No matter whether you work on Linux, Windows, or a Mac, if you write C++ code,
+Google Test can help you.
+
+So what makes a good test, and how does Google C++ Testing Framework fit in? We believe:
+  1. Tests should be _independent_ and _repeatable_. It's a pain to debug a test that succeeds or fails as a result of other tests.  Google C++ Testing Framework isolates the tests by running each of them on a different object. When a test fails, Google C++ Testing Framework allows you to run it in isolation for quick debugging.
+  1. Tests should be well _organized_ and reflect the structure of the tested code.  Google C++ Testing Framework groups related tests into test cases that can share data and subroutines. This common pattern is easy to recognize and makes tests easy to maintain. Such consistency is especially helpful when people switch projects and start to work on a new code base.
+  1. Tests should be _portable_ and _reusable_. The open-source community has a lot of code that is platform-neutral, its tests should also be platform-neutral.  Google C++ Testing Framework works on different OSes, with different compilers (gcc, MSVC, and others), with or without exceptions, so Google C++ Testing Framework tests can easily work with a variety of configurations.  (Note that the current release only contains build scripts for Linux - we are actively working on scripts for other platforms.)
+  1. When tests fail, they should provide as much _information_ about the problem as possible. Google C++ Testing Framework doesn't stop at the first test failure. Instead, it only stops the current test and continues with the next. You can also set up tests that report non-fatal failures after which the current test continues. Thus, you can detect and fix multiple bugs in a single run-edit-compile cycle.
+  1. The testing framework should liberate test writers from housekeeping chores and let them focus on the test _content_.  Google C++ Testing Framework automatically keeps track of all tests defined, and doesn't require the user to enumerate them in order to run them.
+  1. Tests should be _fast_. With Google C++ Testing Framework, you can reuse shared resources across tests and pay for the set-up/tear-down only once, without making tests depend on each other.
+
+Since Google C++ Testing Framework is based on the popular xUnit
+architecture, you'll feel right at home if you've used JUnit or PyUnit before.
+If not, it will take you about 10 minutes to learn the basics and get started.
+So let's go!
+
+_Note:_ We sometimes refer to Google C++ Testing Framework informally
+as _Google Test_.
+
+# Setting up a New Test Project #
+
+To write a test program using Google Test, you need to compile Google
+Test into a library and link your test with it.  We provide build
+files for some popular build systems (`msvc/` for Visual Studio,
+`xcode/` for Mac Xcode, `make/` for GNU make, `codegear/` for Borland
+C++ Builder, and the autotools script in the
+Google Test root directory).  If your build system is not on this
+list, you can take a look at `make/Makefile` to learn how Google Test
+should be compiled (basically you want to compile `src/gtest-all.cc`
+with `GTEST_ROOT` and `GTEST_ROOT/include` in the header search path,
+where `GTEST_ROOT` is the Google Test root directory).
+
+Once you are able to compile the Google Test library, you should
+create a project or build target for your test program.  Make sure you
+have `GTEST_ROOT/include` in the header search path so that the
+compiler can find `<gtest/gtest.h>` when compiling your test.  Set up
+your test project to link with the Google Test library (for example,
+in Visual Studio, this is done by adding a dependency on
+`gtest.vcproj`).
+
+If you still have questions, take a look at how Google Test's own
+tests are built and use them as examples.
+
+# Basic Concepts #
+
+When using Google Test, you start by writing _assertions_, which are statements
+that check whether a condition is true. An assertion's result can be _success_,
+_nonfatal failure_, or _fatal failure_. If a fatal failure occurs, it aborts
+the current function; otherwise the program continues normally.
+
+_Tests_ use assertions to verify the tested code's behavior. If a test crashes
+or has a failed assertion, then it _fails_; otherwise it _succeeds_.
+
+A _test case_ contains one or many tests. You should group your tests into test
+cases that reflect the structure of the tested code. When multiple tests in a
+test case need to share common objects and subroutines, you can put them into a
+_test fixture_ class.
+
+A _test program_ can contain multiple test cases.
+
+We'll now explain how to write a test program, starting at the individual
+assertion level and building up to tests and test cases.
+
+# Assertions #
+
+Google Test assertions are macros that resemble function calls. You test a
+class or function by making assertions about its behavior. When an assertion
+fails, Google Test prints the assertion's source file and line number location,
+along with a failure message. You may also supply a custom failure message
+which will be appended to Google Test's message.
+
+The assertions come in pairs that test the same thing but have different
+effects on the current function. `ASSERT_*` versions generate fatal failures
+when they fail, and **abort the current function**. `EXPECT_*` versions generate
+nonfatal failures, which don't abort the current function. Usually `EXPECT_*`
+are preferred, as they allow more than one failures to be reported in a test.
+However, you should use `ASSERT_*` if it doesn't make sense to continue when
+the assertion in question fails.
+
+Since a failed `ASSERT_*` returns from the current function immediately,
+possibly skipping clean-up code that comes after it, it may cause a space leak.
+Depending on the nature of the leak, it may or may not be worth fixing - so
+keep this in mind if you get a heap checker error in addition to assertion
+errors.
+
+To provide a custom failure message, simply stream it into the macro using the
+`<<` operator, or a sequence of such operators. An example:
+```
+ASSERT_EQ(x.size(), y.size()) << "Vectors x and y are of unequal length";
+
+for (int i = 0; i < x.size(); ++i) {
+  EXPECT_EQ(x[i], y[i]) << "Vectors x and y differ at index " << i;
+}
+```
+
+Anything that can be streamed to an `ostream` can be streamed to an assertion
+macro--in particular, C strings and `string` objects. If a wide string
+(`wchar_t*`, `TCHAR*` in `UNICODE` mode on Windows, or `std::wstring`) is
+streamed to an assertion, it will be translated to UTF-8 when printed.
+
+## Basic Assertions ##
+
+These assertions do basic true/false condition testing.
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_TRUE(`_condition_`)`;  | `EXPECT_TRUE(`_condition_`)`;   | _condition_ is true |
+| `ASSERT_FALSE(`_condition_`)`; | `EXPECT_FALSE(`_condition_`)`;  | _condition_ is false |
+
+Remember, when they fail, `ASSERT_*` yields a fatal failure and
+returns from the current function, while `EXPECT_*` yields a nonfatal
+failure, allowing the function to continue running. In either case, an
+assertion failure means its containing test fails.
+
+_Availability_: Linux, Windows, Mac.
+
+## Binary Comparison ##
+
+This section describes assertions that compare two values.
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+|`ASSERT_EQ(`_expected_`, `_actual_`);`|`EXPECT_EQ(`_expected_`, `_actual_`);`| _expected_ `==` _actual_ |
+|`ASSERT_NE(`_val1_`, `_val2_`);`      |`EXPECT_NE(`_val1_`, `_val2_`);`      | _val1_ `!=` _val2_ |
+|`ASSERT_LT(`_val1_`, `_val2_`);`      |`EXPECT_LT(`_val1_`, `_val2_`);`      | _val1_ `<` _val2_ |
+|`ASSERT_LE(`_val1_`, `_val2_`);`      |`EXPECT_LE(`_val1_`, `_val2_`);`      | _val1_ `<=` _val2_ |
+|`ASSERT_GT(`_val1_`, `_val2_`);`      |`EXPECT_GT(`_val1_`, `_val2_`);`      | _val1_ `>` _val2_ |
+|`ASSERT_GE(`_val1_`, `_val2_`);`      |`EXPECT_GE(`_val1_`, `_val2_`);`      | _val1_ `>=` _val2_ |
+
+In the event of a failure, Google Test prints both _val1_ and _val2_
+. In `ASSERT_EQ*` and `EXPECT_EQ*` (and all other equality assertions
+we'll introduce later), you should put the expression you want to test
+in the position of _actual_, and put its expected value in _expected_,
+as Google Test's failure messages are optimized for this convention.
+
+Value arguments must be comparable by the assertion's comparison operator or
+you'll get a compiler error. Values must also support the `<<` operator for
+streaming to an `ostream`. All built-in types support this.
+
+These assertions can work with a user-defined type, but only if you define the
+corresponding comparison operator (e.g. `==`, `<`, etc).  If the corresponding
+operator is defined, prefer using the `ASSERT_*()` macros because they will
+print out not only the result of the comparison, but the two operands as well.
+
+Arguments are always evaluated exactly once. Therefore, it's OK for the
+arguments to have side effects. However, as with any ordinary C/C++ function,
+the arguments' evaluation order is undefined (i.e. the compiler is free to
+choose any order) and your code should not depend on any particular argument
+evaluation order.
+
+`ASSERT_EQ()` does pointer equality on pointers. If used on two C strings, it
+tests if they are in the same memory location, not if they have the same value.
+Therefore, if you want to compare C strings (e.g. `const char*`) by value, use
+`ASSERT_STREQ()` , which will be described later on. In particular, to assert
+that a C string is `NULL`, use `ASSERT_STREQ(NULL, c_string)` . However, to
+compare two `string` objects, you should use `ASSERT_EQ`.
+
+Macros in this section work with both narrow and wide string objects (`string`
+and `wstring`).
+
+_Availability_: Linux, Windows, Mac.
+
+## String Comparison ##
+
+The assertions in this group compare two **C strings**. If you want to compare
+two `string` objects, use `EXPECT_EQ`, `EXPECT_NE`, and etc instead.
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_STREQ(`_expected\_str_`, `_actual\_str_`);`    | `EXPECT_STREQ(`_expected\_str_`, `_actual\_str_`);`     | the two C strings have the same content |
+| `ASSERT_STRNE(`_str1_`, `_str2_`);`    | `EXPECT_STRNE(`_str1_`, `_str2_`);`     | the two C strings have different content |
+| `ASSERT_STRCASEEQ(`_expected\_str_`, `_actual\_str_`);`| `EXPECT_STRCASEEQ(`_expected\_str_`, `_actual\_str_`);` | the two C strings have the same content, ignoring case |
+| `ASSERT_STRCASENE(`_str1_`, `_str2_`);`| `EXPECT_STRCASENE(`_str1_`, `_str2_`);` | the two C strings have different content, ignoring case |
+
+Note that "CASE" in an assertion name means that case is ignored.
+
+`*STREQ*` and `*STRNE*` also accept wide C strings (`wchar_t*`). If a
+comparison of two wide strings fails, their values will be printed as UTF-8
+narrow strings.
+
+A `NULL` pointer and an empty string are considered _different_.
+
+_Availability_: Linux, Windows, Mac.
+
+See also: For more string comparison tricks (substring, prefix, suffix, and
+regular expression matching, for example), see the [AdvancedGuide Advanced
+Google Test Guide].
+
+# Simple Tests #
+
+To create a test:
+  1. Use the `TEST()` macro to define and name a test function, These are ordinary C++ functions that don't return a value.
+  1. In this function, along with any valid C++ statements you want to include, use the various Google Test assertions to check values.
+  1. The test's result is determined by the assertions; if any assertion in the test fails (either fatally or non-fatally), or if the test crashes, the entire test fails. Otherwise, it succeeds.
+
+```
+TEST(test_case_name, test_name) {
+ ... test body ...
+}
+```
+
+
+`TEST()` arguments go from general to specific. The _first_ argument is the
+name of the test case, and the _second_ argument is the test's name within the
+test case. Remember that a test case can contain any number of individual
+tests. A test's _full name_ consists of its containing test case and its
+individual name. Tests from different test cases can have the same individual
+name.
+
+For example, let's take a simple integer function:
+```
+int Factorial(int n); // Returns the factorial of n
+```
+
+A test case for this function might look like:
+```
+// Tests factorial of 0.
+TEST(FactorialTest, HandlesZeroInput) {
+  EXPECT_EQ(1, Factorial(0));
+}
+
+// Tests factorial of positive numbers.
+TEST(FactorialTest, HandlesPositiveInput) {
+  EXPECT_EQ(1, Factorial(1));
+  EXPECT_EQ(2, Factorial(2));
+  EXPECT_EQ(6, Factorial(3));
+  EXPECT_EQ(40320, Factorial(8));
+}
+```
+
+Google Test groups the test results by test cases, so logically-related tests
+should be in the same test case; in other words, the first argument to their
+`TEST()` should be the same. In the above example, we have two tests,
+`HandlesZeroInput` and `HandlesPositiveInput`, that belong to the same test
+case `FactorialTest`.
+
+_Availability_: Linux, Windows, Mac.
+
+# Test Fixtures: Using the Same Data Configuration for Multiple Tests #
+
+If you find yourself writing two or more tests that operate on similar data,
+you can use a _test fixture_. It allows you to reuse the same configuration of
+objects for several different tests.
+
+To create a fixture, just:
+  1. Derive a class from `::testing::Test` . Start its body with `protected:` or `public:` as we'll want to access fixture members from sub-classes.
+  1. Inside the class, declare any objects you plan to use.
+  1. If necessary, write a default constructor or `SetUp()` function to prepare the objects for each test. A common mistake is to spell `SetUp()` as `Setup()` with a small `u` - don't let that happen to you.
+  1. If necessary, write a destructor or `TearDown()` function to release any resources you allocated in `SetUp()` . To learn when you should use the constructor/destructor and when you should use `SetUp()/TearDown()`, read this [FAQ entry](V1_5_FAQ.md#should-i-use-the-constructordestructor-of-the-test-fixture-or-the-set-uptear-down-function).
+  1. If needed, define subroutines for your tests to share.
+
+When using a fixture, use `TEST_F()` instead of `TEST()` as it allows you to
+access objects and subroutines in the test fixture:
+```
+TEST_F(test_case_name, test_name) {
+ ... test body ...
+}
+```
+
+Like `TEST()`, the first argument is the test case name, but for `TEST_F()`
+this must be the name of the test fixture class. You've probably guessed: `_F`
+is for fixture.
+
+Unfortunately, the C++ macro system does not allow us to create a single macro
+that can handle both types of tests. Using the wrong macro causes a compiler
+error.
+
+Also, you must first define a test fixture class before using it in a
+`TEST_F()`, or you'll get the compiler error "`virtual outside class
+declaration`".
+
+For each test defined with `TEST_F()`, Google Test will:
+  1. Create a _fresh_ test fixture at runtime
+  1. Immediately initialize it via `SetUp()` ,
+  1. Run the test
+  1. Clean up by calling `TearDown()`
+  1. Delete the test fixture.  Note that different tests in the same test case have different test fixture objects, and Google Test always deletes a test fixture before it creates the next one. Google Test does not reuse the same test fixture for multiple tests. Any changes one test makes to the fixture do not affect other tests.
+
+As an example, let's write tests for a FIFO queue class named `Queue`, which
+has the following interface:
+```
+template <typename E> // E is the element type.
+class Queue {
+ public:
+  Queue();
+  void Enqueue(const E& element);
+  E* Dequeue(); // Returns NULL if the queue is empty.
+  size_t size() const;
+  ...
+};
+```
+
+First, define a fixture class. By convention, you should give it the name
+`FooTest` where `Foo` is the class being tested.
+```
+class QueueTest : public ::testing::Test {
+ protected:
+  virtual void SetUp() {
+    q1_.Enqueue(1);
+    q2_.Enqueue(2);
+    q2_.Enqueue(3);
+  }
+
+  // virtual void TearDown() {}
+
+  Queue<int> q0_;
+  Queue<int> q1_;
+  Queue<int> q2_;
+};
+```
+
+In this case, `TearDown()` is not needed since we don't have to clean up after
+each test, other than what's already done by the destructor.
+
+Now we'll write tests using `TEST_F()` and this fixture.
+```
+TEST_F(QueueTest, IsEmptyInitially) {
+  EXPECT_EQ(0, q0_.size());
+}
+
+TEST_F(QueueTest, DequeueWorks) {
+  int* n = q0_.Dequeue();
+  EXPECT_EQ(NULL, n);
+
+  n = q1_.Dequeue();
+  ASSERT_TRUE(n != NULL);
+  EXPECT_EQ(1, *n);
+  EXPECT_EQ(0, q1_.size());
+  delete n;
+
+  n = q2_.Dequeue();
+  ASSERT_TRUE(n != NULL);
+  EXPECT_EQ(2, *n);
+  EXPECT_EQ(1, q2_.size());
+  delete n;
+}
+```
+
+The above uses both `ASSERT_*` and `EXPECT_*` assertions. The rule of thumb is
+to use `EXPECT_*` when you want the test to continue to reveal more errors
+after the assertion failure, and use `ASSERT_*` when continuing after failure
+doesn't make sense. For example, the second assertion in the `Dequeue` test is
+`ASSERT_TRUE(n != NULL)`, as we need to dereference the pointer `n` later,
+which would lead to a segfault when `n` is `NULL`.
+
+When these tests run, the following happens:
+  1. Google Test constructs a `QueueTest` object (let's call it `t1` ).
+  1. `t1.SetUp()` initializes `t1` .
+  1. The first test ( `IsEmptyInitially` ) runs on `t1` .
+  1. `t1.TearDown()` cleans up after the test finishes.
+  1. `t1` is destructed.
+  1. The above steps are repeated on another `QueueTest` object, this time running the `DequeueWorks` test.
+
+_Availability_: Linux, Windows, Mac.
+
+_Note_: Google Test automatically saves all _Google Test_ flags when a test
+object is constructed, and restores them when it is destructed.
+
+# Invoking the Tests #
+
+`TEST()` and `TEST_F()` implicitly register their tests with Google Test. So, unlike with many other C++ testing frameworks, you don't have to re-list all your defined tests in order to run them.
+
+After defining your tests, you can run them with `RUN_ALL_TESTS()` , which returns `0` if all the tests are successful, or `1` otherwise. Note that `RUN_ALL_TESTS()` runs _all tests_ in your link unit -- they can be from different test cases, or even different source files.
+
+When invoked, the `RUN_ALL_TESTS()` macro:
+  1. Saves the state of all  Google Test flags.
+  1. Creates a test fixture object for the first test.
+  1. Initializes it via `SetUp()`.
+  1. Runs the test on the fixture object.
+  1. Cleans up the fixture via `TearDown()`.
+  1. Deletes the fixture.
+  1. Restores the state of all Google Test flags.
+  1. Repeats the above steps for the next test, until all tests have run.
+
+In addition, if the text fixture's constructor generates a fatal failure in
+step 2, there is no point for step 3 - 5 and they are thus skipped. Similarly,
+if step 3 generates a fatal failure, step 4 will be skipped.
+
+_Important_: You must not ignore the return value of `RUN_ALL_TESTS()`, or `gcc`
+will give you a compiler error. The rationale for this design is that the
+automated testing service determines whether a test has passed based on its
+exit code, not on its stdout/stderr output; thus your `main()` function must
+return the value of `RUN_ALL_TESTS()`.
+
+Also, you should call `RUN_ALL_TESTS()` only **once**. Calling it more than once
+conflicts with some advanced Google Test features (e.g. thread-safe death
+tests) and thus is not supported.
+
+_Availability_: Linux, Windows, Mac.
+
+# Writing the main() Function #
+
+You can start from this boilerplate:
+```
+#include "this/package/foo.h"
+#include <gtest/gtest.h>
+
+namespace {
+
+// The fixture for testing class Foo.
+class FooTest : public ::testing::Test {
+ protected:
+  // You can remove any or all of the following functions if its body
+  // is empty.
+
+  FooTest() {
+    // You can do set-up work for each test here.
+  }
+
+  virtual ~FooTest() {
+    // You can do clean-up work that doesn't throw exceptions here.
+  }
+
+  // If the constructor and destructor are not enough for setting up
+  // and cleaning up each test, you can define the following methods:
+
+  virtual void SetUp() {
+    // Code here will be called immediately after the constructor (right
+    // before each test).
+  }
+
+  virtual void TearDown() {
+    // Code here will be called immediately after each test (right
+    // before the destructor).
+  }
+
+  // Objects declared here can be used by all tests in the test case for Foo.
+};
+
+// Tests that the Foo::Bar() method does Abc.
+TEST_F(FooTest, MethodBarDoesAbc) {
+  const string input_filepath = "this/package/testdata/myinputfile.dat";
+  const string output_filepath = "this/package/testdata/myoutputfile.dat";
+  Foo f;
+  EXPECT_EQ(0, f.Bar(input_filepath, output_filepath));
+}
+
+// Tests that Foo does Xyz.
+TEST_F(FooTest, DoesXyz) {
+  // Exercises the Xyz feature of Foo.
+}
+
+}  // namespace
+
+int main(int argc, char **argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  return RUN_ALL_TESTS();
+}
+```
+
+The `::testing::InitGoogleTest()` function parses the command line for Google
+Test flags, and removes all recognized flags. This allows the user to control a
+test program's behavior via various flags, which we'll cover in [AdvancedGuide](V1_5_AdvancedGuide.md).
+You must call this function before calling `RUN_ALL_TESTS()`, or the flags
+won't be properly initialized.
+
+On Windows, `InitGoogleTest()` also works with wide strings, so it can be used
+in programs compiled in `UNICODE` mode as well.
+
+But maybe you think that writing all those main() functions is too much work? We agree with you completely and that's why Google Test provides a basic implementation of main(). If it fits your needs, then just link your test with gtest\_main library and you are good to go.
+
+## Important note for Visual C++ users ##
+If you put your tests into a library and your `main()` function is in a different library or in your .exe file, those tests will not run. The reason is a [bug](https://connect.microsoft.com/feedback/viewfeedback.aspx?FeedbackID=244410&siteid=210) in Visual C++. When you define your tests, Google Test creates certain static objects to register them. These objects are not referenced from elsewhere but their constructors are still supposed to run. When Visual C++ linker sees that nothing in the library is referenced from other places it throws the library out. You have to reference your library with tests from your main program to keep the linker from discarding it. Here is how to do it. Somewhere in your library code declare a function:
+```
+__declspec(dllexport) int PullInMyLibrary() { return 0; }
+```
+If you put your tests in a static library (not DLL) then `__declspec(dllexport)` is not required. Now, in your main program, write a code that invokes that function:
+```
+int PullInMyLibrary();
+static int dummy = PullInMyLibrary();
+```
+This will keep your tests referenced and will make them register themselves at startup.
+
+In addition, if you define your tests in a static library, add `/OPT:NOREF` to your main program linker options. If you use MSVC++ IDE, go to your .exe project properties/Configuration Properties/Linker/Optimization and set References setting to `Keep Unreferenced Data (/OPT:NOREF)`. This will keep Visual C++ linker from discarding individual symbols generated by your tests from the final executable.
+
+There is one more pitfall, though. If you use Google Test as a static library (that's how it is defined in gtest.vcproj) your tests must also reside in a static library. If you have to have them in a DLL, you _must_ change Google Test to build into a DLL as well. Otherwise your tests will not run correctly or will not run at all. The general conclusion here is: make your life easier - do not write your tests in libraries!
+
+# Where to Go from Here #
+
+Congratulations! You've learned the Google Test basics. You can start writing
+and running Google Test tests, read some [samples](Samples.md), or continue with
+[AdvancedGuide](V1_5_AdvancedGuide.md), which describes many more useful Google Test features.
+
+# Known Limitations #
+
+Google Test is designed to be thread-safe.  The implementation is
+thread-safe on systems where the `pthreads` library is available.  It
+is currently _unsafe_ to use Google Test assertions from two threads
+concurrently on other systems (e.g. Windows).  In most tests this is
+not an issue as usually the assertions are done in the main thread. If
+you want to help, you can volunteer to implement the necessary
+synchronization primitives in `gtest-port.h` for your platform.
diff --git a/docs/V1_5_PumpManual.md b/docs/V1_5_PumpManual.md
new file mode 100755 (executable)
index 0000000..1571078
--- /dev/null
@@ -0,0 +1,177 @@
+
+
+<b>P</b>ump is <b>U</b>seful for <b>M</b>eta <b>P</b>rogramming.
+
+# The Problem #
+
+Template and macro libraries often need to define many classes,
+functions, or macros that vary only (or almost only) in the number of
+arguments they take. It's a lot of repetitive, mechanical, and
+error-prone work.
+
+Variadic templates and variadic macros can alleviate the problem.
+However, while both are being considered by the C++ committee, neither
+is in the standard yet or widely supported by compilers.  Thus they
+are often not a good choice, especially when your code needs to be
+portable. And their capabilities are still limited.
+
+As a result, authors of such libraries often have to write scripts to
+generate their implementation. However, our experience is that it's
+tedious to write such scripts, which tend to reflect the structure of
+the generated code poorly and are often hard to read and edit. For
+example, a small change needed in the generated code may require some
+non-intuitive, non-trivial changes in the script. This is especially
+painful when experimenting with the code.
+
+# Our Solution #
+
+Pump (for Pump is Useful for Meta Programming, Pretty Useful for Meta
+Programming, or Practical Utility for Meta Programming, whichever you
+prefer) is a simple meta-programming tool for C++. The idea is that a
+programmer writes a `foo.pump` file which contains C++ code plus meta
+code that manipulates the C++ code. The meta code can handle
+iterations over a range, nested iterations, local meta variable
+definitions, simple arithmetic, and conditional expressions. You can
+view it as a small Domain-Specific Language. The meta language is
+designed to be non-intrusive (s.t. it won't confuse Emacs' C++ mode,
+for example) and concise, making Pump code intuitive and easy to
+maintain.
+
+## Highlights ##
+
+  * The implementation is in a single Python script and thus ultra portable: no build or installation is needed and it works cross platforms.
+  * Pump tries to be smart with respect to [Google's style guide](http://code.google.com/p/google-styleguide/): it breaks long lines (easy to have when they are generated) at acceptable places to fit within 80 columns and indent the continuation lines correctly.
+  * The format is human-readable and more concise than XML.
+  * The format works relatively well with Emacs' C++ mode.
+
+## Examples ##
+
+The following Pump code (where meta keywords start with `$`, `[[` and `]]` are meta brackets, and `$$` starts a meta comment that ends with the line):
+
+```
+$var n = 3     $$ Defines a meta variable n.
+$range i 0..n  $$ Declares the range of meta iterator i (inclusive).
+$for i [[
+               $$ Meta loop.
+// Foo$i does blah for $i-ary predicates.
+$range j 1..i
+template <size_t N $for j [[, typename A$j]]>
+class Foo$i {
+$if i == 0 [[
+  blah a;
+]] $elif i <= 2 [[
+  blah b;
+]] $else [[
+  blah c;
+]]
+};
+
+]]
+```
+
+will be translated by the Pump compiler to:
+
+```
+// Foo0 does blah for 0-ary predicates.
+template <size_t N>
+class Foo0 {
+  blah a;
+};
+
+// Foo1 does blah for 1-ary predicates.
+template <size_t N, typename A1>
+class Foo1 {
+  blah b;
+};
+
+// Foo2 does blah for 2-ary predicates.
+template <size_t N, typename A1, typename A2>
+class Foo2 {
+  blah b;
+};
+
+// Foo3 does blah for 3-ary predicates.
+template <size_t N, typename A1, typename A2, typename A3>
+class Foo3 {
+  blah c;
+};
+```
+
+In another example,
+
+```
+$range i 1..n
+Func($for i + [[a$i]]);
+$$ The text between i and [[ is the separator between iterations.
+```
+
+will generate one of the following lines (without the comments), depending on the value of `n`:
+
+```
+Func();              // If n is 0.
+Func(a1);            // If n is 1.
+Func(a1 + a2);       // If n is 2.
+Func(a1 + a2 + a3);  // If n is 3.
+// And so on...
+```
+
+## Constructs ##
+
+We support the following meta programming constructs:
+
+| `$var id = exp` | Defines a named constant value. `$id` is valid util the end of the current meta lexical block. |
+|:----------------|:-----------------------------------------------------------------------------------------------|
+| $range id exp..exp | Sets the range of an iteration variable, which can be reused in multiple loops later.          |
+| $for id sep [[code ](.md)] | Iteration. The range of `id` must have been defined earlier. `$id` is valid in `code`.         |
+| `$($)`          | Generates a single `$` character.                                                              |
+| `$id`           | Value of the named constant or iteration variable.                                             |
+| `$(exp)`        | Value of the expression.                                                                       |
+| `$if exp [[ code ]] else_branch` | Conditional.                                                                                   |
+| `[[ code ]]`    | Meta lexical block.                                                                            |
+| `cpp_code`      | Raw C++ code.                                                                                  |
+| `$$ comment`    | Meta comment.                                                                                  |
+
+**Note:** To give the user some freedom in formatting the Pump source
+code, Pump ignores a new-line character if it's right after `$for foo`
+or next to `[[` or `]]`. Without this rule you'll often be forced to write
+very long lines to get the desired output. Therefore sometimes you may
+need to insert an extra new-line in such places for a new-line to show
+up in your output.
+
+## Grammar ##
+
+```
+code ::= atomic_code*
+atomic_code ::= $var id = exp
+    | $var id = [[ code ]]
+    | $range id exp..exp
+    | $for id sep [[ code ]]
+    | $($)
+    | $id
+    | $(exp)
+    | $if exp [[ code ]] else_branch
+    | [[ code ]]
+    | cpp_code
+sep ::= cpp_code | empty_string
+else_branch ::= $else [[ code ]]
+    | $elif exp [[ code ]] else_branch
+    | empty_string
+exp ::= simple_expression_in_Python_syntax
+```
+
+## Code ##
+
+You can find the source code of Pump in [scripts/pump.py](http://code.google.com/p/googletest/source/browse/trunk/scripts/pump.py). It is still
+very unpolished and lacks automated tests, although it has been
+successfully used many times. If you find a chance to use it in your
+project, please let us know what you think!  We also welcome help on
+improving Pump.
+
+## Real Examples ##
+
+You can find real-world applications of Pump in [Google Test](http://www.google.com/codesearch?q=file%3A\.pump%24+package%3Ahttp%3A%2F%2Fgoogletest\.googlecode\.com) and [Google Mock](http://www.google.com/codesearch?q=file%3A\.pump%24+package%3Ahttp%3A%2F%2Fgooglemock\.googlecode\.com).  The source file `foo.h.pump` generates `foo.h`.
+
+## Tips ##
+
+  * If a meta variable is followed by a letter or digit, you can separate them using `[[]]`, which inserts an empty string. For example `Foo$j[[]]Helper` generate `Foo1Helper` when `j` is 1.
+  * To avoid extra-long Pump source lines, you can break a line anywhere you want by inserting `[[]]` followed by a new line. Since any new-line character next to `[[` or `]]` is ignored, the generated code won't contain this new line.
\ No newline at end of file
diff --git a/docs/V1_5_XcodeGuide.md b/docs/V1_5_XcodeGuide.md
new file mode 100755 (executable)
index 0000000..bf24bf5
--- /dev/null
@@ -0,0 +1,93 @@
+
+
+This guide will explain how to use the Google Testing Framework in your Xcode projects on Mac OS X. This tutorial begins by quickly explaining what to do for experienced users. After the quick start, the guide goes provides additional explanation about each step.
+
+# Quick Start #
+
+Here is the quick guide for using Google Test in your Xcode project.
+
+  1. Download the source from the [website](http://code.google.com/p/googletest) using this command: `svn checkout http://googletest.googlecode.com/svn/trunk/ googletest-read-only`
+  1. Open up the `gtest.xcodeproj` in the `googletest-read-only/xcode/` directory and build the gtest.framework.
+  1. Create a new "Shell Tool" target in your Xcode project called something like "UnitTests"
+  1. Add the gtest.framework to your project and add it to the "Link Binary with Libraries" build phase of "UnitTests"
+  1. Add your unit test source code to the "Compile Sources" build phase of "UnitTests"
+  1. Edit the "UnitTests" executable and add an environment variable named "DYLD\_FRAMEWORK\_PATH" with a value equal to the path to the framework containing the gtest.framework relative to the compiled executable.
+  1. Build and Go
+
+The following sections further explain each of the steps listed above in depth, describing in more detail how to complete it including some variations.
+
+# Get the Source #
+
+Currently, the gtest.framework discussed here isn't available in a tagged release of Google Test, it is only available in the trunk. As explained at the Google Test [site](http://code.google.com/p/googletest/source/checkout">svn), you can get the code from anonymous SVN with this command:
+
+```
+svn checkout http://googletest.googlecode.com/svn/trunk/ googletest-read-only
+```
+
+Alternatively, if you are working with Subversion in your own code base, you can add Google Test as an external dependency to your own Subversion repository. By following this approach, everyone that checks out your svn repository will also receive a copy of Google Test (a specific version, if you wish) without having to check it out explicitly. This makes the set up of your project simpler and reduces the copied code in the repository.
+
+To use `svn:externals`, decide where you would like to have the external source reside. You might choose to put the external source inside the trunk, because you want it to be part of the branch when you make a release. However, keeping it outside the trunk in a version-tagged directory called something like `third-party/googletest/1.0.1`, is another option. Once the location is established, use `svn propedit svn:externals _directory_` to set the svn:externals property on a directory in your repository. This directory won't contain the code, but be its versioned parent directory.
+
+The command `svn propedit` will bring up your Subversion editor, making editing the long, (potentially multi-line) property simpler. This same method can be used to check out a tagged branch, by using the appropriate URL (e.g. `http://googletest.googlecode.com/svn/tags/release-1.0.1`). Additionally, the svn:externals property allows the specification of a particular revision of the trunk with the `-r_##_` option (e.g. `externals/src/googletest -r60 http://googletest.googlecode.com/svn/trunk`).
+
+Here is an example of using the svn:externals properties on a trunk (read via `svn propget`) of a project. This value checks out a copy of Google Test into the `trunk/externals/src/googletest/` directory.
+
+```
+[Computer:svn] user$ svn propget svn:externals trunk
+externals/src/googletest http://googletest.googlecode.com/svn/trunk
+```
+
+# Add the Framework to Your Project #
+
+The next step is to build and add the gtest.framework to your own project. This guide describes two common ways below.
+
+  * **Option 1** --- The simplest way to add Google Test to your own project, is to open gtest.xcodeproj (found in the xcode/ directory of the Google Test trunk) and build the framework manually. Then, add the built framework into your project using the "Add->Existing Framework..." from the context menu or "Project->Add..." from the main menu. The gtest.framework is relocatable and contains the headers and object code that you'll need to make tests. This method requires rebuilding every time you upgrade Google Test in your project.
+  * **Option 2** --- If you are going to be living off the trunk of Google Test, incorporating its latest features into your unit tests (or are a Google Test developer yourself). You'll want to rebuild the framework every time the source updates. to do this, you'll need to add the gtest.xcodeproj file, not the framework itself, to your own Xcode project. Then, from the build products that are revealed by the project's disclosure triangle, you can find the gtest.framework, which can be added to your targets (discussed below).
+
+# Make a Test Target #
+
+To start writing tests, make a new "Shell Tool" target. This target template is available under BSD, Cocoa, or Carbon. Add your unit test source code to the "Compile Sources" build phase of the target.
+
+Next, you'll want to add gtest.framework in two different ways, depending upon which option you chose above.
+
+  * **Option 1** --- During compilation, Xcode will need to know that you are linking against the gtest.framework. Add the gtest.framework to the "Link Binary with Libraries" build phase of your test target. This will include the Google Test headers in your header search path, and will tell the linker where to find the library.
+  * **Option 2** --- If your working out of the trunk, you'll also want to add gtest.framework to your "Link Binary with Libraries" build phase of your test target. In addition, you'll  want to add the gtest.framework as a dependency to your unit test target. This way, Xcode will make sure that gtest.framework is up to date, every time your build your target. Finally, if you don't share build directories with Google Test, you'll have to copy the gtest.framework into your own build products directory using a "Run Script" build phase.
+
+# Set Up the Executable Run Environment #
+
+Since the unit test executable is a shell tool, it doesn't have a bundle with a `Contents/Frameworks` directory, in which to place gtest.framework. Instead, the dynamic linker must be told at runtime to search for the framework in another location. This can be accomplished by setting the "DYLD\_FRAMEWORK\_PATH" environment variable in the "Edit Active Executable ..." Arguments tab, under "Variables to be set in the environment:". The path for this value is the path (relative or absolute) of the directory containing the gtest.framework.
+
+If you haven't set up the DYLD\_FRAMEWORK\_PATH, correctly, you might get a message like this:
+
+```
+[Session started at 2008-08-15 06:23:57 -0600.]
+  dyld: Library not loaded: @loader_path/../Frameworks/gtest.framework/Versions/A/gtest
+    Referenced from: /Users/username/Documents/Sandbox/gtestSample/build/Debug/WidgetFrameworkTest
+    Reason: image not found
+```
+
+To correct this problem, got to the directory containing the executable named in "Referenced from:" value in the error message above. Then, with the terminal in this location, find the relative path to the directory containing the gtest.framework. That is the value you'll need to set as the DYLD\_FRAMEWORK\_PATH.
+
+# Build and Go #
+
+Now, when you click "Build and Go", the test will be executed. Dumping out something like this:
+
+```
+[Session started at 2008-08-06 06:36:13 -0600.]
+[==========] Running 2 tests from 1 test case.
+[----------] Global test environment set-up.
+[----------] 2 tests from WidgetInitializerTest
+[ RUN      ] WidgetInitializerTest.TestConstructor
+[       OK ] WidgetInitializerTest.TestConstructor
+[ RUN      ] WidgetInitializerTest.TestConversion
+[       OK ] WidgetInitializerTest.TestConversion
+[----------] Global test environment tear-down
+[==========] 2 tests from 1 test case ran.
+[  PASSED  ] 2 tests.
+
+The Debugger has exited with status 0.  
+```
+
+# Summary #
+
+Unit testing is a valuable way to ensure your data model stays valid even during rapid development or refactoring. The Google Testing Framework is a great unit testing framework for C and C++ which integrates well with an Xcode development environment.
\ No newline at end of file
diff --git a/docs/V1_6_AdvancedGuide.md b/docs/V1_6_AdvancedGuide.md
new file mode 100755 (executable)
index 0000000..78864b1
--- /dev/null
@@ -0,0 +1,2178 @@
+
+
+Now that you have read [Primer](V1_6_Primer.md) and learned how to write tests
+using Google Test, it's time to learn some new tricks. This document
+will show you more assertions as well as how to construct complex
+failure messages, propagate fatal failures, reuse and speed up your
+test fixtures, and use various flags with your tests.
+
+# More Assertions #
+
+This section covers some less frequently used, but still significant,
+assertions.
+
+## Explicit Success and Failure ##
+
+These three assertions do not actually test a value or expression. Instead,
+they generate a success or failure directly. Like the macros that actually
+perform a test, you may stream a custom failure message into the them.
+
+| `SUCCEED();` |
+|:-------------|
+
+Generates a success. This does NOT make the overall test succeed. A test is
+considered successful only if none of its assertions fail during its execution.
+
+Note: `SUCCEED()` is purely documentary and currently doesn't generate any
+user-visible output. However, we may add `SUCCEED()` messages to Google Test's
+output in the future.
+
+| `FAIL();`  | `ADD_FAILURE();` | `ADD_FAILURE_AT("`_file\_path_`", `_line\_number_`);` |
+|:-----------|:-----------------|:------------------------------------------------------|
+
+`FAIL()` generates a fatal failure, while `ADD_FAILURE()` and `ADD_FAILURE_AT()` generate a nonfatal
+failure. These are useful when control flow, rather than a Boolean expression,
+deteremines the test's success or failure. For example, you might want to write
+something like:
+
+```
+switch(expression) {
+  case 1: ... some checks ...
+  case 2: ... some other checks
+  ...
+  default: FAIL() << "We shouldn't get here.";
+}
+```
+
+_Availability_: Linux, Windows, Mac.
+
+## Exception Assertions ##
+
+These are for verifying that a piece of code throws (or does not
+throw) an exception of the given type:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_THROW(`_statement_, _exception\_type_`);`  | `EXPECT_THROW(`_statement_, _exception\_type_`);`  | _statement_ throws an exception of the given type  |
+| `ASSERT_ANY_THROW(`_statement_`);`                | `EXPECT_ANY_THROW(`_statement_`);`                | _statement_ throws an exception of any type        |
+| `ASSERT_NO_THROW(`_statement_`);`                 | `EXPECT_NO_THROW(`_statement_`);`                 | _statement_ doesn't throw any exception            |
+
+Examples:
+
+```
+ASSERT_THROW(Foo(5), bar_exception);
+
+EXPECT_NO_THROW({
+  int n = 5;
+  Bar(&n);
+});
+```
+
+_Availability_: Linux, Windows, Mac; since version 1.1.0.
+
+## Predicate Assertions for Better Error Messages ##
+
+Even though Google Test has a rich set of assertions, they can never be
+complete, as it's impossible (nor a good idea) to anticipate all the scenarios
+a user might run into. Therefore, sometimes a user has to use `EXPECT_TRUE()`
+to check a complex expression, for lack of a better macro. This has the problem
+of not showing you the values of the parts of the expression, making it hard to
+understand what went wrong. As a workaround, some users choose to construct the
+failure message by themselves, streaming it into `EXPECT_TRUE()`. However, this
+is awkward especially when the expression has side-effects or is expensive to
+evaluate.
+
+Google Test gives you three different options to solve this problem:
+
+### Using an Existing Boolean Function ###
+
+If you already have a function or a functor that returns `bool` (or a type
+that can be implicitly converted to `bool`), you can use it in a _predicate
+assertion_ to get the function arguments printed for free:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_PRED1(`_pred1, val1_`);`       | `EXPECT_PRED1(`_pred1, val1_`);` | _pred1(val1)_ returns true |
+| `ASSERT_PRED2(`_pred2, val1, val2_`);` | `EXPECT_PRED2(`_pred2, val1, val2_`);` |  _pred2(val1, val2)_ returns true |
+|  ...                | ...                    | ...          |
+
+In the above, _predn_ is an _n_-ary predicate function or functor, where
+_val1_, _val2_, ..., and _valn_ are its arguments. The assertion succeeds
+if the predicate returns `true` when applied to the given arguments, and fails
+otherwise. When the assertion fails, it prints the value of each argument. In
+either case, the arguments are evaluated exactly once.
+
+Here's an example. Given
+
+```
+// Returns true iff m and n have no common divisors except 1.
+bool MutuallyPrime(int m, int n) { ... }
+const int a = 3;
+const int b = 4;
+const int c = 10;
+```
+
+the assertion `EXPECT_PRED2(MutuallyPrime, a, b);` will succeed, while the
+assertion `EXPECT_PRED2(MutuallyPrime, b, c);` will fail with the message
+
+<pre>
+!MutuallyPrime(b, c) is false, where<br>
+b is 4<br>
+c is 10<br>
+</pre>
+
+**Notes:**
+
+  1. If you see a compiler error "no matching function to call" when using `ASSERT_PRED*` or `EXPECT_PRED*`, please see [this](v1_6_FAQ.md#ithe-compiler-complains-about-undefined-references-to-some-static-const-member-variables-but-i-did-define-them-in-the-class-body-whats-wrong) for how to resolve it.
+  1. Currently we only provide predicate assertions of arity <= 5. If you need a higher-arity assertion, let us know.
+
+_Availability_: Linux, Windows, Mac
+
+### Using a Function That Returns an AssertionResult ###
+
+While `EXPECT_PRED*()` and friends are handy for a quick job, the
+syntax is not satisfactory: you have to use different macros for
+different arities, and it feels more like Lisp than C++.  The
+`::testing::AssertionResult` class solves this problem.
+
+An `AssertionResult` object represents the result of an assertion
+(whether it's a success or a failure, and an associated message).  You
+can create an `AssertionResult` using one of these factory
+functions:
+
+```
+namespace testing {
+
+// Returns an AssertionResult object to indicate that an assertion has
+// succeeded.
+AssertionResult AssertionSuccess();
+
+// Returns an AssertionResult object to indicate that an assertion has
+// failed.
+AssertionResult AssertionFailure();
+
+}
+```
+
+You can then use the `<<` operator to stream messages to the
+`AssertionResult` object.
+
+To provide more readable messages in Boolean assertions
+(e.g. `EXPECT_TRUE()`), write a predicate function that returns
+`AssertionResult` instead of `bool`. For example, if you define
+`IsEven()` as:
+
+```
+::testing::AssertionResult IsEven(int n) {
+  if ((n % 2) == 0)
+    return ::testing::AssertionSuccess();
+  else
+    return ::testing::AssertionFailure() << n << " is odd";
+}
+```
+
+instead of:
+
+```
+bool IsEven(int n) {
+  return (n % 2) == 0;
+}
+```
+
+the failed assertion `EXPECT_TRUE(IsEven(Fib(4)))` will print:
+
+<pre>
+Value of: !IsEven(Fib(4))<br>
+Actual: false (*3 is odd*)<br>
+Expected: true<br>
+</pre>
+
+instead of a more opaque
+
+<pre>
+Value of: !IsEven(Fib(4))<br>
+Actual: false<br>
+Expected: true<br>
+</pre>
+
+If you want informative messages in `EXPECT_FALSE` and `ASSERT_FALSE`
+as well, and are fine with making the predicate slower in the success
+case, you can supply a success message:
+
+```
+::testing::AssertionResult IsEven(int n) {
+  if ((n % 2) == 0)
+    return ::testing::AssertionSuccess() << n << " is even";
+  else
+    return ::testing::AssertionFailure() << n << " is odd";
+}
+```
+
+Then the statement `EXPECT_FALSE(IsEven(Fib(6)))` will print
+
+<pre>
+Value of: !IsEven(Fib(6))<br>
+Actual: true (8 is even)<br>
+Expected: false<br>
+</pre>
+
+_Availability_: Linux, Windows, Mac; since version 1.4.1.
+
+### Using a Predicate-Formatter ###
+
+If you find the default message generated by `(ASSERT|EXPECT)_PRED*` and
+`(ASSERT|EXPECT)_(TRUE|FALSE)` unsatisfactory, or some arguments to your
+predicate do not support streaming to `ostream`, you can instead use the
+following _predicate-formatter assertions_ to _fully_ customize how the
+message is formatted:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_PRED_FORMAT1(`_pred\_format1, val1_`);`        | `EXPECT_PRED_FORMAT1(`_pred\_format1, val1_`); | _pred\_format1(val1)_ is successful |
+| `ASSERT_PRED_FORMAT2(`_pred\_format2, val1, val2_`);` | `EXPECT_PRED_FORMAT2(`_pred\_format2, val1, val2_`);` | _pred\_format2(val1, val2)_ is successful |
+| `...`               | `...`                  | `...`        |
+
+The difference between this and the previous two groups of macros is that instead of
+a predicate, `(ASSERT|EXPECT)_PRED_FORMAT*` take a _predicate-formatter_
+(_pred\_formatn_), which is a function or functor with the signature:
+
+`::testing::AssertionResult PredicateFormattern(const char* `_expr1_`, const char* `_expr2_`, ... const char* `_exprn_`, T1 `_val1_`, T2 `_val2_`, ... Tn `_valn_`);`
+
+where _val1_, _val2_, ..., and _valn_ are the values of the predicate
+arguments, and _expr1_, _expr2_, ..., and _exprn_ are the corresponding
+expressions as they appear in the source code. The types `T1`, `T2`, ..., and
+`Tn` can be either value types or reference types. For example, if an
+argument has type `Foo`, you can declare it as either `Foo` or `const Foo&`,
+whichever is appropriate.
+
+A predicate-formatter returns a `::testing::AssertionResult` object to indicate
+whether the assertion has succeeded or not. The only way to create such an
+object is to call one of these factory functions:
+
+As an example, let's improve the failure message in the previous example, which uses `EXPECT_PRED2()`:
+
+```
+// Returns the smallest prime common divisor of m and n,
+// or 1 when m and n are mutually prime.
+int SmallestPrimeCommonDivisor(int m, int n) { ... }
+
+// A predicate-formatter for asserting that two integers are mutually prime.
+::testing::AssertionResult AssertMutuallyPrime(const char* m_expr,
+                                               const char* n_expr,
+                                               int m,
+                                               int n) {
+  if (MutuallyPrime(m, n))
+    return ::testing::AssertionSuccess();
+
+  return ::testing::AssertionFailure()
+      << m_expr << " and " << n_expr << " (" << m << " and " << n
+      << ") are not mutually prime, " << "as they have a common divisor "
+      << SmallestPrimeCommonDivisor(m, n);
+}
+```
+
+With this predicate-formatter, we can use
+
+```
+EXPECT_PRED_FORMAT2(AssertMutuallyPrime, b, c);
+```
+
+to generate the message
+
+<pre>
+b and c (4 and 10) are not mutually prime, as they have a common divisor 2.<br>
+</pre>
+
+As you may have realized, many of the assertions we introduced earlier are
+special cases of `(EXPECT|ASSERT)_PRED_FORMAT*`. In fact, most of them are
+indeed defined using `(EXPECT|ASSERT)_PRED_FORMAT*`.
+
+_Availability_: Linux, Windows, Mac.
+
+
+## Floating-Point Comparison ##
+
+Comparing floating-point numbers is tricky. Due to round-off errors, it is
+very unlikely that two floating-points will match exactly. Therefore,
+`ASSERT_EQ` 's naive comparison usually doesn't work. And since floating-points
+can have a wide value range, no single fixed error bound works. It's better to
+compare by a fixed relative error bound, except for values close to 0 due to
+the loss of precision there.
+
+In general, for floating-point comparison to make sense, the user needs to
+carefully choose the error bound. If they don't want or care to, comparing in
+terms of Units in the Last Place (ULPs) is a good default, and Google Test
+provides assertions to do this. Full details about ULPs are quite long; if you
+want to learn more, see
+[this article on float comparison](http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm).
+
+### Floating-Point Macros ###
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_FLOAT_EQ(`_expected, actual_`);`  | `EXPECT_FLOAT_EQ(`_expected, actual_`);` | the two `float` values are almost equal |
+| `ASSERT_DOUBLE_EQ(`_expected, actual_`);` | `EXPECT_DOUBLE_EQ(`_expected, actual_`);` | the two `double` values are almost equal |
+
+By "almost equal", we mean the two values are within 4 ULP's from each
+other.
+
+The following assertions allow you to choose the acceptable error bound:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_NEAR(`_val1, val2, abs\_error_`);` | `EXPECT_NEAR`_(val1, val2, abs\_error_`);` | the difference between _val1_ and _val2_ doesn't exceed the given absolute error |
+
+_Availability_: Linux, Windows, Mac.
+
+### Floating-Point Predicate-Format Functions ###
+
+Some floating-point operations are useful, but not that often used. In order
+to avoid an explosion of new macros, we provide them as predicate-format
+functions that can be used in predicate assertion macros (e.g.
+`EXPECT_PRED_FORMAT2`, etc).
+
+```
+EXPECT_PRED_FORMAT2(::testing::FloatLE, val1, val2);
+EXPECT_PRED_FORMAT2(::testing::DoubleLE, val1, val2);
+```
+
+Verifies that _val1_ is less than, or almost equal to, _val2_. You can
+replace `EXPECT_PRED_FORMAT2` in the above table with `ASSERT_PRED_FORMAT2`.
+
+_Availability_: Linux, Windows, Mac.
+
+## Windows HRESULT assertions ##
+
+These assertions test for `HRESULT` success or failure.
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_HRESULT_SUCCEEDED(`_expression_`);` | `EXPECT_HRESULT_SUCCEEDED(`_expression_`);` | _expression_ is a success `HRESULT` |
+| `ASSERT_HRESULT_FAILED(`_expression_`);`    | `EXPECT_HRESULT_FAILED(`_expression_`);`    | _expression_ is a failure `HRESULT` |
+
+The generated output contains the human-readable error message
+associated with the `HRESULT` code returned by _expression_.
+
+You might use them like this:
+
+```
+CComPtr shell;
+ASSERT_HRESULT_SUCCEEDED(shell.CoCreateInstance(L"Shell.Application"));
+CComVariant empty;
+ASSERT_HRESULT_SUCCEEDED(shell->ShellExecute(CComBSTR(url), empty, empty, empty, empty));
+```
+
+_Availability_: Windows.
+
+## Type Assertions ##
+
+You can call the function
+```
+::testing::StaticAssertTypeEq<T1, T2>();
+```
+to assert that types `T1` and `T2` are the same.  The function does
+nothing if the assertion is satisfied.  If the types are different,
+the function call will fail to compile, and the compiler error message
+will likely (depending on the compiler) show you the actual values of
+`T1` and `T2`.  This is mainly useful inside template code.
+
+_Caveat:_ When used inside a member function of a class template or a
+function template, `StaticAssertTypeEq<T1, T2>()` is effective _only if_
+the function is instantiated.  For example, given:
+```
+template <typename T> class Foo {
+ public:
+  void Bar() { ::testing::StaticAssertTypeEq<int, T>(); }
+};
+```
+the code:
+```
+void Test1() { Foo<bool> foo; }
+```
+will _not_ generate a compiler error, as `Foo<bool>::Bar()` is never
+actually instantiated.  Instead, you need:
+```
+void Test2() { Foo<bool> foo; foo.Bar(); }
+```
+to cause a compiler error.
+
+_Availability:_ Linux, Windows, Mac; since version 1.3.0.
+
+## Assertion Placement ##
+
+You can use assertions in any C++ function. In particular, it doesn't
+have to be a method of the test fixture class. The one constraint is
+that assertions that generate a fatal failure (`FAIL*` and `ASSERT_*`)
+can only be used in void-returning functions. This is a consequence of
+Google Test not using exceptions. By placing it in a non-void function
+you'll get a confusing compile error like
+`"error: void value not ignored as it ought to be"`.
+
+If you need to use assertions in a function that returns non-void, one option
+is to make the function return the value in an out parameter instead. For
+example, you can rewrite `T2 Foo(T1 x)` to `void Foo(T1 x, T2* result)`. You
+need to make sure that `*result` contains some sensible value even when the
+function returns prematurely. As the function now returns `void`, you can use
+any assertion inside of it.
+
+If changing the function's type is not an option, you should just use
+assertions that generate non-fatal failures, such as `ADD_FAILURE*` and
+`EXPECT_*`.
+
+_Note_: Constructors and destructors are not considered void-returning
+functions, according to the C++ language specification, and so you may not use
+fatal assertions in them. You'll get a compilation error if you try. A simple
+workaround is to transfer the entire body of the constructor or destructor to a
+private void-returning method. However, you should be aware that a fatal
+assertion failure in a constructor does not terminate the current test, as your
+intuition might suggest; it merely returns from the constructor early, possibly
+leaving your object in a partially-constructed state. Likewise, a fatal
+assertion failure in a destructor may leave your object in a
+partially-destructed state. Use assertions carefully in these situations!
+
+# Teaching Google Test How to Print Your Values #
+
+When a test assertion such as `EXPECT_EQ` fails, Google Test prints the
+argument values to help you debug.  It does this using a
+user-extensible value printer.
+
+This printer knows how to print built-in C++ types, native arrays, STL
+containers, and any type that supports the `<<` operator.  For other
+types, it prints the raw bytes in the value and hopes that you the
+user can figure it out.
+
+As mentioned earlier, the printer is _extensible_.  That means
+you can teach it to do a better job at printing your particular type
+than to dump the bytes.  To do that, define `<<` for your type:
+
+```
+#include <iostream>
+
+namespace foo {
+
+class Bar { ... };  // We want Google Test to be able to print instances of this.
+
+// It's important that the << operator is defined in the SAME
+// namespace that defines Bar.  C++'s look-up rules rely on that.
+::std::ostream& operator<<(::std::ostream& os, const Bar& bar) {
+  return os << bar.DebugString();  // whatever needed to print bar to os
+}
+
+}  // namespace foo
+```
+
+Sometimes, this might not be an option: your team may consider it bad
+style to have a `<<` operator for `Bar`, or `Bar` may already have a
+`<<` operator that doesn't do what you want (and you cannot change
+it).  If so, you can instead define a `PrintTo()` function like this:
+
+```
+#include <iostream>
+
+namespace foo {
+
+class Bar { ... };
+
+// It's important that PrintTo() is defined in the SAME
+// namespace that defines Bar.  C++'s look-up rules rely on that.
+void PrintTo(const Bar& bar, ::std::ostream* os) {
+  *os << bar.DebugString();  // whatever needed to print bar to os
+}
+
+}  // namespace foo
+```
+
+If you have defined both `<<` and `PrintTo()`, the latter will be used
+when Google Test is concerned.  This allows you to customize how the value
+appears in Google Test's output without affecting code that relies on the
+behavior of its `<<` operator.
+
+If you want to print a value `x` using Google Test's value printer
+yourself, just call `::testing::PrintToString(`_x_`)`, which
+returns an `std::string`:
+
+```
+vector<pair<Bar, int> > bar_ints = GetBarIntVector();
+
+EXPECT_TRUE(IsCorrectBarIntVector(bar_ints))
+    << "bar_ints = " << ::testing::PrintToString(bar_ints);
+```
+
+# Death Tests #
+
+In many applications, there are assertions that can cause application failure
+if a condition is not met. These sanity checks, which ensure that the program
+is in a known good state, are there to fail at the earliest possible time after
+some program state is corrupted. If the assertion checks the wrong condition,
+then the program may proceed in an erroneous state, which could lead to memory
+corruption, security holes, or worse. Hence it is vitally important to test
+that such assertion statements work as expected.
+
+Since these precondition checks cause the processes to die, we call such tests
+_death tests_. More generally, any test that checks that a program terminates
+(except by throwing an exception) in an expected fashion is also a death test.
+
+Note that if a piece of code throws an exception, we don't consider it "death"
+for the purpose of death tests, as the caller of the code could catch the exception
+and avoid the crash. If you want to verify exceptions thrown by your code,
+see [Exception Assertions](#exception-assertions).
+
+If you want to test `EXPECT_*()/ASSERT_*()` failures in your test code, see [Catching Failures](#catching-failures).
+
+## How to Write a Death Test ##
+
+Google Test has the following macros to support death tests:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_DEATH(`_statement, regex_`); | `EXPECT_DEATH(`_statement, regex_`); | _statement_ crashes with the given error |
+| `ASSERT_DEATH_IF_SUPPORTED(`_statement, regex_`); | `EXPECT_DEATH_IF_SUPPORTED(`_statement, regex_`); | if death tests are supported, verifies that _statement_ crashes with the given error; otherwise verifies nothing |
+| `ASSERT_EXIT(`_statement, predicate, regex_`); | `EXPECT_EXIT(`_statement, predicate, regex_`); |_statement_ exits with the given error and its exit code matches _predicate_ |
+
+where _statement_ is a statement that is expected to cause the process to
+die, _predicate_ is a function or function object that evaluates an integer
+exit status, and _regex_ is a regular expression that the stderr output of
+_statement_ is expected to match. Note that _statement_ can be _any valid
+statement_ (including _compound statement_) and doesn't have to be an
+expression.
+
+As usual, the `ASSERT` variants abort the current test function, while the
+`EXPECT` variants do not.
+
+**Note:** We use the word "crash" here to mean that the process
+terminates with a _non-zero_ exit status code.  There are two
+possibilities: either the process has called `exit()` or `_exit()`
+with a non-zero value, or it may be killed by a signal.
+
+This means that if _statement_ terminates the process with a 0 exit
+code, it is _not_ considered a crash by `EXPECT_DEATH`.  Use
+`EXPECT_EXIT` instead if this is the case, or if you want to restrict
+the exit code more precisely.
+
+A predicate here must accept an `int` and return a `bool`. The death test
+succeeds only if the predicate returns `true`. Google Test defines a few
+predicates that handle the most common cases:
+
+```
+::testing::ExitedWithCode(exit_code)
+```
+
+This expression is `true` if the program exited normally with the given exit
+code.
+
+```
+::testing::KilledBySignal(signal_number)  // Not available on Windows.
+```
+
+This expression is `true` if the program was killed by the given signal.
+
+The `*_DEATH` macros are convenient wrappers for `*_EXIT` that use a predicate
+that verifies the process' exit code is non-zero.
+
+Note that a death test only cares about three things:
+
+  1. does _statement_ abort or exit the process?
+  1. (in the case of `ASSERT_EXIT` and `EXPECT_EXIT`) does the exit status satisfy _predicate_?  Or (in the case of `ASSERT_DEATH` and `EXPECT_DEATH`) is the exit status non-zero?  And
+  1. does the stderr output match _regex_?
+
+In particular, if _statement_ generates an `ASSERT_*` or `EXPECT_*` failure, it will **not** cause the death test to fail, as Google Test assertions don't abort the process.
+
+To write a death test, simply use one of the above macros inside your test
+function. For example,
+
+```
+TEST(My*DeathTest*, Foo) {
+  // This death test uses a compound statement.
+  ASSERT_DEATH({ int n = 5; Foo(&n); }, "Error on line .* of Foo()");
+}
+TEST(MyDeathTest, NormalExit) {
+  EXPECT_EXIT(NormalExit(), ::testing::ExitedWithCode(0), "Success");
+}
+TEST(MyDeathTest, KillMyself) {
+  EXPECT_EXIT(KillMyself(), ::testing::KilledBySignal(SIGKILL), "Sending myself unblockable signal");
+}
+```
+
+verifies that:
+
+  * calling `Foo(5)` causes the process to die with the given error message,
+  * calling `NormalExit()` causes the process to print `"Success"` to stderr and exit with exit code 0, and
+  * calling `KillMyself()` kills the process with signal `SIGKILL`.
+
+The test function body may contain other assertions and statements as well, if
+necessary.
+
+_Important:_ We strongly recommend you to follow the convention of naming your
+test case (not test) `*DeathTest` when it contains a death test, as
+demonstrated in the above example. The `Death Tests And Threads` section below
+explains why.
+
+If a test fixture class is shared by normal tests and death tests, you
+can use typedef to introduce an alias for the fixture class and avoid
+duplicating its code:
+```
+class FooTest : public ::testing::Test { ... };
+
+typedef FooTest FooDeathTest;
+
+TEST_F(FooTest, DoesThis) {
+  // normal test
+}
+
+TEST_F(FooDeathTest, DoesThat) {
+  // death test
+}
+```
+
+_Availability:_ Linux, Windows (requires MSVC 8.0 or above), Cygwin, and Mac (the latter three are supported since v1.3.0).  `(ASSERT|EXPECT)_DEATH_IF_SUPPORTED` are new in v1.4.0.
+
+## Regular Expression Syntax ##
+
+On POSIX systems (e.g. Linux, Cygwin, and Mac), Google Test uses the
+[POSIX extended regular expression](http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04)
+syntax in death tests. To learn about this syntax, you may want to read this [Wikipedia entry](http://en.wikipedia.org/wiki/Regular_expression#POSIX_Extended_Regular_Expressions).
+
+On Windows, Google Test uses its own simple regular expression
+implementation. It lacks many features you can find in POSIX extended
+regular expressions.  For example, we don't support union (`"x|y"`),
+grouping (`"(xy)"`), brackets (`"[xy]"`), and repetition count
+(`"x{5,7}"`), among others. Below is what we do support (`A` denotes a
+literal character, period (`.`), or a single `\\` escape sequence; `x`
+and `y` denote regular expressions.):
+
+| `c` | matches any literal character `c` |
+|:----|:----------------------------------|
+| `\\d` | matches any decimal digit         |
+| `\\D` | matches any character that's not a decimal digit |
+| `\\f` | matches `\f`                      |
+| `\\n` | matches `\n`                      |
+| `\\r` | matches `\r`                      |
+| `\\s` | matches any ASCII whitespace, including `\n` |
+| `\\S` | matches any character that's not a whitespace |
+| `\\t` | matches `\t`                      |
+| `\\v` | matches `\v`                      |
+| `\\w` | matches any letter, `_`, or decimal digit |
+| `\\W` | matches any character that `\\w` doesn't match |
+| `\\c` | matches any literal character `c`, which must be a punctuation |
+| `.` | matches any single character except `\n` |
+| `A?` | matches 0 or 1 occurrences of `A` |
+| `A*` | matches 0 or many occurrences of `A` |
+| `A+` | matches 1 or many occurrences of `A` |
+| `^` | matches the beginning of a string (not that of each line) |
+| `$` | matches the end of a string (not that of each line) |
+| `xy` | matches `x` followed by `y`       |
+
+To help you determine which capability is available on your system,
+Google Test defines macro `GTEST_USES_POSIX_RE=1` when it uses POSIX
+extended regular expressions, or `GTEST_USES_SIMPLE_RE=1` when it uses
+the simple version.  If you want your death tests to work in both
+cases, you can either `#if` on these macros or use the more limited
+syntax only.
+
+## How It Works ##
+
+Under the hood, `ASSERT_EXIT()` spawns a new process and executes the
+death test statement in that process. The details of of how precisely
+that happens depend on the platform and the variable
+`::testing::GTEST_FLAG(death_test_style)` (which is initialized from the
+command-line flag `--gtest_death_test_style`).
+
+  * On POSIX systems, `fork()` (or `clone()` on Linux) is used to spawn the child, after which:
+    * If the variable's value is `"fast"`, the death test statement is immediately executed.
+    * If the variable's value is `"threadsafe"`, the child process re-executes the unit test binary just as it was originally invoked, but with some extra flags to cause just the single death test under consideration to be run.
+  * On Windows, the child is spawned using the `CreateProcess()` API, and re-executes the binary to cause just the single death test under consideration to be run - much like the `threadsafe` mode on POSIX.
+
+Other values for the variable are illegal and will cause the death test to
+fail. Currently, the flag's default value is `"fast"`. However, we reserve the
+right to change it in the future. Therefore, your tests should not depend on
+this.
+
+In either case, the parent process waits for the child process to complete, and checks that
+
+  1. the child's exit status satisfies the predicate, and
+  1. the child's stderr matches the regular expression.
+
+If the death test statement runs to completion without dying, the child
+process will nonetheless terminate, and the assertion fails.
+
+## Death Tests And Threads ##
+
+The reason for the two death test styles has to do with thread safety. Due to
+well-known problems with forking in the presence of threads, death tests should
+be run in a single-threaded context. Sometimes, however, it isn't feasible to
+arrange that kind of environment. For example, statically-initialized modules
+may start threads before main is ever reached. Once threads have been created,
+it may be difficult or impossible to clean them up.
+
+Google Test has three features intended to raise awareness of threading issues.
+
+  1. A warning is emitted if multiple threads are running when a death test is encountered.
+  1. Test cases with a name ending in "DeathTest" are run before all other tests.
+  1. It uses `clone()` instead of `fork()` to spawn the child process on Linux (`clone()` is not available on Cygwin and Mac), as `fork()` is more likely to cause the child to hang when the parent process has multiple threads.
+
+It's perfectly fine to create threads inside a death test statement; they are
+executed in a separate process and cannot affect the parent.
+
+## Death Test Styles ##
+
+The "threadsafe" death test style was introduced in order to help mitigate the
+risks of testing in a possibly multithreaded environment. It trades increased
+test execution time (potentially dramatically so) for improved thread safety.
+We suggest using the faster, default "fast" style unless your test has specific
+problems with it.
+
+You can choose a particular style of death tests by setting the flag
+programmatically:
+
+```
+::testing::FLAGS_gtest_death_test_style = "threadsafe";
+```
+
+You can do this in `main()` to set the style for all death tests in the
+binary, or in individual tests. Recall that flags are saved before running each
+test and restored afterwards, so you need not do that yourself. For example:
+
+```
+TEST(MyDeathTest, TestOne) {
+  ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+  // This test is run in the "threadsafe" style:
+  ASSERT_DEATH(ThisShouldDie(), "");
+}
+
+TEST(MyDeathTest, TestTwo) {
+  // This test is run in the "fast" style:
+  ASSERT_DEATH(ThisShouldDie(), "");
+}
+
+int main(int argc, char** argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  ::testing::FLAGS_gtest_death_test_style = "fast";
+  return RUN_ALL_TESTS();
+}
+```
+
+## Caveats ##
+
+The _statement_ argument of `ASSERT_EXIT()` can be any valid C++ statement.
+If it leaves the current function via a `return` statement or by throwing an exception,
+the death test is considered to have failed.  Some Google Test macros may return
+from the current function (e.g. `ASSERT_TRUE()`), so be sure to avoid them in _statement_.
+
+Since _statement_ runs in the child process, any in-memory side effect (e.g.
+modifying a variable, releasing memory, etc) it causes will _not_ be observable
+in the parent process. In particular, if you release memory in a death test,
+your program will fail the heap check as the parent process will never see the
+memory reclaimed. To solve this problem, you can
+
+  1. try not to free memory in a death test;
+  1. free the memory again in the parent process; or
+  1. do not use the heap checker in your program.
+
+Due to an implementation detail, you cannot place multiple death test
+assertions on the same line; otherwise, compilation will fail with an unobvious
+error message.
+
+Despite the improved thread safety afforded by the "threadsafe" style of death
+test, thread problems such as deadlock are still possible in the presence of
+handlers registered with `pthread_atfork(3)`.
+
+# Using Assertions in Sub-routines #
+
+## Adding Traces to Assertions ##
+
+If a test sub-routine is called from several places, when an assertion
+inside it fails, it can be hard to tell which invocation of the
+sub-routine the failure is from.  You can alleviate this problem using
+extra logging or custom failure messages, but that usually clutters up
+your tests. A better solution is to use the `SCOPED_TRACE` macro:
+
+| `SCOPED_TRACE(`_message_`);` |
+|:-----------------------------|
+
+where _message_ can be anything streamable to `std::ostream`. This
+macro will cause the current file name, line number, and the given
+message to be added in every failure message. The effect will be
+undone when the control leaves the current lexical scope.
+
+For example,
+
+```
+10: void Sub1(int n) {
+11:   EXPECT_EQ(1, Bar(n));
+12:   EXPECT_EQ(2, Bar(n + 1));
+13: }
+14:
+15: TEST(FooTest, Bar) {
+16:   {
+17:     SCOPED_TRACE("A");  // This trace point will be included in
+18:                         // every failure in this scope.
+19:     Sub1(1);
+20:   }
+21:   // Now it won't.
+22:   Sub1(9);
+23: }
+```
+
+could result in messages like these:
+
+```
+path/to/foo_test.cc:11: Failure
+Value of: Bar(n)
+Expected: 1
+  Actual: 2
+   Trace:
+path/to/foo_test.cc:17: A
+
+path/to/foo_test.cc:12: Failure
+Value of: Bar(n + 1)
+Expected: 2
+  Actual: 3
+```
+
+Without the trace, it would've been difficult to know which invocation
+of `Sub1()` the two failures come from respectively. (You could add an
+extra message to each assertion in `Sub1()` to indicate the value of
+`n`, but that's tedious.)
+
+Some tips on using `SCOPED_TRACE`:
+
+  1. With a suitable message, it's often enough to use `SCOPED_TRACE` at the beginning of a sub-routine, instead of at each call site.
+  1. When calling sub-routines inside a loop, make the loop iterator part of the message in `SCOPED_TRACE` such that you can know which iteration the failure is from.
+  1. Sometimes the line number of the trace point is enough for identifying the particular invocation of a sub-routine. In this case, you don't have to choose a unique message for `SCOPED_TRACE`. You can simply use `""`.
+  1. You can use `SCOPED_TRACE` in an inner scope when there is one in the outer scope. In this case, all active trace points will be included in the failure messages, in reverse order they are encountered.
+  1. The trace dump is clickable in Emacs' compilation buffer - hit return on a line number and you'll be taken to that line in the source file!
+
+_Availability:_ Linux, Windows, Mac.
+
+## Propagating Fatal Failures ##
+
+A common pitfall when using `ASSERT_*` and `FAIL*` is not understanding that
+when they fail they only abort the _current function_, not the entire test. For
+example, the following test will segfault:
+```
+void Subroutine() {
+  // Generates a fatal failure and aborts the current function.
+  ASSERT_EQ(1, 2);
+  // The following won't be executed.
+  ...
+}
+
+TEST(FooTest, Bar) {
+  Subroutine();
+  // The intended behavior is for the fatal failure
+  // in Subroutine() to abort the entire test.
+  // The actual behavior: the function goes on after Subroutine() returns.
+  int* p = NULL;
+  *p = 3; // Segfault!
+}
+```
+
+Since we don't use exceptions, it is technically impossible to
+implement the intended behavior here.  To alleviate this, Google Test
+provides two solutions.  You could use either the
+`(ASSERT|EXPECT)_NO_FATAL_FAILURE` assertions or the
+`HasFatalFailure()` function.  They are described in the following two
+subsections.
+
+### Asserting on Subroutines ###
+
+As shown above, if your test calls a subroutine that has an `ASSERT_*`
+failure in it, the test will continue after the subroutine
+returns. This may not be what you want.
+
+Often people want fatal failures to propagate like exceptions.  For
+that Google Test offers the following macros:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_NO_FATAL_FAILURE(`_statement_`);` | `EXPECT_NO_FATAL_FAILURE(`_statement_`);` | _statement_ doesn't generate any new fatal failures in the current thread. |
+
+Only failures in the thread that executes the assertion are checked to
+determine the result of this type of assertions.  If _statement_
+creates new threads, failures in these threads are ignored.
+
+Examples:
+
+```
+ASSERT_NO_FATAL_FAILURE(Foo());
+
+int i;
+EXPECT_NO_FATAL_FAILURE({
+  i = Bar();
+});
+```
+
+_Availability:_ Linux, Windows, Mac. Assertions from multiple threads
+are currently not supported.
+
+### Checking for Failures in the Current Test ###
+
+`HasFatalFailure()` in the `::testing::Test` class returns `true` if an
+assertion in the current test has suffered a fatal failure. This
+allows functions to catch fatal failures in a sub-routine and return
+early.
+
+```
+class Test {
+ public:
+  ...
+  static bool HasFatalFailure();
+};
+```
+
+The typical usage, which basically simulates the behavior of a thrown
+exception, is:
+
+```
+TEST(FooTest, Bar) {
+  Subroutine();
+  // Aborts if Subroutine() had a fatal failure.
+  if (HasFatalFailure())
+    return;
+  // The following won't be executed.
+  ...
+}
+```
+
+If `HasFatalFailure()` is used outside of `TEST()` , `TEST_F()` , or a test
+fixture, you must add the `::testing::Test::` prefix, as in:
+
+```
+if (::testing::Test::HasFatalFailure())
+  return;
+```
+
+Similarly, `HasNonfatalFailure()` returns `true` if the current test
+has at least one non-fatal failure, and `HasFailure()` returns `true`
+if the current test has at least one failure of either kind.
+
+_Availability:_ Linux, Windows, Mac.  `HasNonfatalFailure()` and
+`HasFailure()` are available since version 1.4.0.
+
+# Logging Additional Information #
+
+In your test code, you can call `RecordProperty("key", value)` to log
+additional information, where `value` can be either a C string or a 32-bit
+integer. The _last_ value recorded for a key will be emitted to the XML output
+if you specify one. For example, the test
+
+```
+TEST_F(WidgetUsageTest, MinAndMaxWidgets) {
+  RecordProperty("MaximumWidgets", ComputeMaxUsage());
+  RecordProperty("MinimumWidgets", ComputeMinUsage());
+}
+```
+
+will output XML like this:
+
+```
+...
+  <testcase name="MinAndMaxWidgets" status="run" time="6" classname="WidgetUsageTest"
+            MaximumWidgets="12"
+            MinimumWidgets="9" />
+...
+```
+
+_Note_:
+  * `RecordProperty()` is a static member of the `Test` class. Therefore it needs to be prefixed with `::testing::Test::` if used outside of the `TEST` body and the test fixture class.
+  * `key` must be a valid XML attribute name, and cannot conflict with the ones already used by Google Test (`name`, `status`,     `time`, and `classname`).
+
+_Availability_: Linux, Windows, Mac.
+
+# Sharing Resources Between Tests in the Same Test Case #
+
+
+
+Google Test creates a new test fixture object for each test in order to make
+tests independent and easier to debug. However, sometimes tests use resources
+that are expensive to set up, making the one-copy-per-test model prohibitively
+expensive.
+
+If the tests don't change the resource, there's no harm in them sharing a
+single resource copy. So, in addition to per-test set-up/tear-down, Google Test
+also supports per-test-case set-up/tear-down. To use it:
+
+  1. In your test fixture class (say `FooTest` ), define as `static` some member variables to hold the shared resources.
+  1. In the same test fixture class, define a `static void SetUpTestCase()` function (remember not to spell it as **`SetupTestCase`** with a small `u`!) to set up the shared resources and a `static void TearDownTestCase()` function to tear them down.
+
+That's it! Google Test automatically calls `SetUpTestCase()` before running the
+_first test_ in the `FooTest` test case (i.e. before creating the first
+`FooTest` object), and calls `TearDownTestCase()` after running the _last test_
+in it (i.e. after deleting the last `FooTest` object). In between, the tests
+can use the shared resources.
+
+Remember that the test order is undefined, so your code can't depend on a test
+preceding or following another. Also, the tests must either not modify the
+state of any shared resource, or, if they do modify the state, they must
+restore the state to its original value before passing control to the next
+test.
+
+Here's an example of per-test-case set-up and tear-down:
+```
+class FooTest : public ::testing::Test {
+ protected:
+  // Per-test-case set-up.
+  // Called before the first test in this test case.
+  // Can be omitted if not needed.
+  static void SetUpTestCase() {
+    shared_resource_ = new ...;
+  }
+
+  // Per-test-case tear-down.
+  // Called after the last test in this test case.
+  // Can be omitted if not needed.
+  static void TearDownTestCase() {
+    delete shared_resource_;
+    shared_resource_ = NULL;
+  }
+
+  // You can define per-test set-up and tear-down logic as usual.
+  virtual void SetUp() { ... }
+  virtual void TearDown() { ... }
+
+  // Some expensive resource shared by all tests.
+  static T* shared_resource_;
+};
+
+T* FooTest::shared_resource_ = NULL;
+
+TEST_F(FooTest, Test1) {
+  ... you can refer to shared_resource here ...
+}
+TEST_F(FooTest, Test2) {
+  ... you can refer to shared_resource here ...
+}
+```
+
+_Availability:_ Linux, Windows, Mac.
+
+# Global Set-Up and Tear-Down #
+
+Just as you can do set-up and tear-down at the test level and the test case
+level, you can also do it at the test program level. Here's how.
+
+First, you subclass the `::testing::Environment` class to define a test
+environment, which knows how to set-up and tear-down:
+
+```
+class Environment {
+ public:
+  virtual ~Environment() {}
+  // Override this to define how to set up the environment.
+  virtual void SetUp() {}
+  // Override this to define how to tear down the environment.
+  virtual void TearDown() {}
+};
+```
+
+Then, you register an instance of your environment class with Google Test by
+calling the `::testing::AddGlobalTestEnvironment()` function:
+
+```
+Environment* AddGlobalTestEnvironment(Environment* env);
+```
+
+Now, when `RUN_ALL_TESTS()` is called, it first calls the `SetUp()` method of
+the environment object, then runs the tests if there was no fatal failures, and
+finally calls `TearDown()` of the environment object.
+
+It's OK to register multiple environment objects. In this case, their `SetUp()`
+will be called in the order they are registered, and their `TearDown()` will be
+called in the reverse order.
+
+Note that Google Test takes ownership of the registered environment objects.
+Therefore **do not delete them** by yourself.
+
+You should call `AddGlobalTestEnvironment()` before `RUN_ALL_TESTS()` is
+called, probably in `main()`. If you use `gtest_main`, you need to      call
+this before `main()` starts for it to take effect. One way to do this is to
+define a global variable like this:
+
+```
+::testing::Environment* const foo_env = ::testing::AddGlobalTestEnvironment(new FooEnvironment);
+```
+
+However, we strongly recommend you to write your own `main()` and call
+`AddGlobalTestEnvironment()` there, as relying on initialization of global
+variables makes the code harder to read and may cause problems when you
+register multiple environments from different translation units and the
+environments have dependencies among them (remember that the compiler doesn't
+guarantee the order in which global variables from different translation units
+are initialized).
+
+_Availability:_ Linux, Windows, Mac.
+
+
+# Value Parameterized Tests #
+
+_Value-parameterized tests_ allow you to test your code with different
+parameters without writing multiple copies of the same test.
+
+Suppose you write a test for your code and then realize that your code is affected by a presence of a Boolean command line flag.
+
+```
+TEST(MyCodeTest, TestFoo) {
+  // A code to test foo().
+}
+```
+
+Usually people factor their test code into a function with a Boolean parameter in such situations. The function sets the flag, then executes the testing code.
+
+```
+void TestFooHelper(bool flag_value) {
+  flag = flag_value;
+  // A code to test foo().
+}
+
+TEST(MyCodeTest, TestFooo) {
+  TestFooHelper(false);
+  TestFooHelper(true);
+}
+```
+
+But this setup has serious drawbacks. First, when a test assertion fails in your tests, it becomes unclear what value of the parameter caused it to fail. You can stream a clarifying message into your `EXPECT`/`ASSERT` statements, but it you'll have to do it with all of them. Second, you have to add one such helper function per test. What if you have ten tests? Twenty? A hundred?
+
+Value-parameterized tests will let you write your test only once and then easily instantiate and run it with an arbitrary number of parameter values.
+
+Here are some other situations when value-parameterized tests come handy:
+
+  * You want to test different implementations of an OO interface.
+  * You want to test your code over various inputs (a.k.a. data-driven testing). This feature is easy to abuse, so please exercise your good sense when doing it!
+
+## How to Write Value-Parameterized Tests ##
+
+To write value-parameterized tests, first you should define a fixture
+class.  It must be derived from both `::testing::Test` and
+`::testing::WithParamInterface<T>` (the latter is a pure interface),
+where `T` is the type of your parameter values.  For convenience, you
+can just derive the fixture class from `::testing::TestWithParam<T>`,
+which itself is derived from both `::testing::Test` and
+`::testing::WithParamInterface<T>`. `T` can be any copyable type. If
+it's a raw pointer, you are responsible for managing the lifespan of
+the pointed values.
+
+```
+class FooTest : public ::testing::TestWithParam<const char*> {
+  // You can implement all the usual fixture class members here.
+  // To access the test parameter, call GetParam() from class
+  // TestWithParam<T>.
+};
+
+// Or, when you want to add parameters to a pre-existing fixture class:
+class BaseTest : public ::testing::Test {
+  ...
+};
+class BarTest : public BaseTest,
+                public ::testing::WithParamInterface<const char*> {
+  ...
+};
+```
+
+Then, use the `TEST_P` macro to define as many test patterns using
+this fixture as you want.  The `_P` suffix is for "parameterized" or
+"pattern", whichever you prefer to think.
+
+```
+TEST_P(FooTest, DoesBlah) {
+  // Inside a test, access the test parameter with the GetParam() method
+  // of the TestWithParam<T> class:
+  EXPECT_TRUE(foo.Blah(GetParam()));
+  ...
+}
+
+TEST_P(FooTest, HasBlahBlah) {
+  ...
+}
+```
+
+Finally, you can use `INSTANTIATE_TEST_CASE_P` to instantiate the test
+case with any set of parameters you want. Google Test defines a number of
+functions for generating test parameters. They return what we call
+(surprise!) _parameter generators_. Here is a summary of them,
+which are all in the `testing` namespace:
+
+| `Range(begin, end[, step])` | Yields values `{begin, begin+step, begin+step+step, ...}`. The values do not include `end`. `step` defaults to 1. |
+|:----------------------------|:------------------------------------------------------------------------------------------------------------------|
+| `Values(v1, v2, ..., vN)`   | Yields values `{v1, v2, ..., vN}`.                                                                                |
+| `ValuesIn(container)` and `ValuesIn(begin, end)` | Yields values from a C-style array, an STL-style container, or an iterator range `[begin, end)`. `container`, `begin`, and `end` can be expressions whose values are determined at run time.  |
+| `Bool()`                    | Yields sequence `{false, true}`.                                                                                  |
+| `Combine(g1, g2, ..., gN)`  | Yields all combinations (the Cartesian product for the math savvy) of the values generated by the `N` generators. This is only available if your system provides the `<tr1/tuple>` header. If you are sure your system does, and Google Test disagrees, you can override it by defining `GTEST_HAS_TR1_TUPLE=1`. See comments in [include/gtest/internal/gtest-port.h](../include/gtest/internal/gtest-port.h) for more information. |
+
+For more details, see the comments at the definitions of these functions in the [source code](../include/gtest/gtest-param-test.h).
+
+The following statement will instantiate tests from the `FooTest` test case
+each with parameter values `"meeny"`, `"miny"`, and `"moe"`.
+
+```
+INSTANTIATE_TEST_CASE_P(InstantiationName,
+                        FooTest,
+                        ::testing::Values("meeny", "miny", "moe"));
+```
+
+To distinguish different instances of the pattern (yes, you can
+instantiate it more than once), the first argument to
+`INSTANTIATE_TEST_CASE_P` is a prefix that will be added to the actual
+test case name. Remember to pick unique prefixes for different
+instantiations. The tests from the instantiation above will have these
+names:
+
+  * `InstantiationName/FooTest.DoesBlah/0` for `"meeny"`
+  * `InstantiationName/FooTest.DoesBlah/1` for `"miny"`
+  * `InstantiationName/FooTest.DoesBlah/2` for `"moe"`
+  * `InstantiationName/FooTest.HasBlahBlah/0` for `"meeny"`
+  * `InstantiationName/FooTest.HasBlahBlah/1` for `"miny"`
+  * `InstantiationName/FooTest.HasBlahBlah/2` for `"moe"`
+
+You can use these names in [--gtest\-filter](#running-a-subset-of-the-tests).
+
+This statement will instantiate all tests from `FooTest` again, each
+with parameter values `"cat"` and `"dog"`:
+
+```
+const char* pets[] = {"cat", "dog"};
+INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest,
+                        ::testing::ValuesIn(pets));
+```
+
+The tests from the instantiation above will have these names:
+
+  * `AnotherInstantiationName/FooTest.DoesBlah/0` for `"cat"`
+  * `AnotherInstantiationName/FooTest.DoesBlah/1` for `"dog"`
+  * `AnotherInstantiationName/FooTest.HasBlahBlah/0` for `"cat"`
+  * `AnotherInstantiationName/FooTest.HasBlahBlah/1` for `"dog"`
+
+Please note that `INSTANTIATE_TEST_CASE_P` will instantiate _all_
+tests in the given test case, whether their definitions come before or
+_after_ the `INSTANTIATE_TEST_CASE_P` statement.
+
+You can see
+[these](../samples/sample7_unittest.cc)
+[files](../samples/sample8_unittest.cc) for more examples.
+
+_Availability_: Linux, Windows (requires MSVC 8.0 or above), Mac; since version 1.2.0.
+
+## Creating Value-Parameterized Abstract Tests ##
+
+In the above, we define and instantiate `FooTest` in the same source
+file. Sometimes you may want to define value-parameterized tests in a
+library and let other people instantiate them later. This pattern is
+known as <i>abstract tests</i>. As an example of its application, when you
+are designing an interface you can write a standard suite of abstract
+tests (perhaps using a factory function as the test parameter) that
+all implementations of the interface are expected to pass. When
+someone implements the interface, he can instantiate your suite to get
+all the interface-conformance tests for free.
+
+To define abstract tests, you should organize your code like this:
+
+  1. Put the definition of the parameterized test fixture class (e.g. `FooTest`) in a header file, say `foo_param_test.h`. Think of this as _declaring_ your abstract tests.
+  1. Put the `TEST_P` definitions in `foo_param_test.cc`, which includes `foo_param_test.h`. Think of this as _implementing_ your abstract tests.
+
+Once they are defined, you can instantiate them by including
+`foo_param_test.h`, invoking `INSTANTIATE_TEST_CASE_P()`, and linking
+with `foo_param_test.cc`. You can instantiate the same abstract test
+case multiple times, possibly in different source files.
+
+# Typed Tests #
+
+Suppose you have multiple implementations of the same interface and
+want to make sure that all of them satisfy some common requirements.
+Or, you may have defined several types that are supposed to conform to
+the same "concept" and you want to verify it.  In both cases, you want
+the same test logic repeated for different types.
+
+While you can write one `TEST` or `TEST_F` for each type you want to
+test (and you may even factor the test logic into a function template
+that you invoke from the `TEST`), it's tedious and doesn't scale:
+if you want _m_ tests over _n_ types, you'll end up writing _m\*n_
+`TEST`s.
+
+_Typed tests_ allow you to repeat the same test logic over a list of
+types.  You only need to write the test logic once, although you must
+know the type list when writing typed tests.  Here's how you do it:
+
+First, define a fixture class template.  It should be parameterized
+by a type.  Remember to derive it from `::testing::Test`:
+
+```
+template <typename T>
+class FooTest : public ::testing::Test {
+ public:
+  ...
+  typedef std::list<T> List;
+  static T shared_;
+  T value_;
+};
+```
+
+Next, associate a list of types with the test case, which will be
+repeated for each type in the list:
+
+```
+typedef ::testing::Types<char, int, unsigned int> MyTypes;
+TYPED_TEST_CASE(FooTest, MyTypes);
+```
+
+The `typedef` is necessary for the `TYPED_TEST_CASE` macro to parse
+correctly.  Otherwise the compiler will think that each comma in the
+type list introduces a new macro argument.
+
+Then, use `TYPED_TEST()` instead of `TEST_F()` to define a typed test
+for this test case.  You can repeat this as many times as you want:
+
+```
+TYPED_TEST(FooTest, DoesBlah) {
+  // Inside a test, refer to the special name TypeParam to get the type
+  // parameter.  Since we are inside a derived class template, C++ requires
+  // us to visit the members of FooTest via 'this'.
+  TypeParam n = this->value_;
+
+  // To visit static members of the fixture, add the 'TestFixture::'
+  // prefix.
+  n += TestFixture::shared_;
+
+  // To refer to typedefs in the fixture, add the 'typename TestFixture::'
+  // prefix.  The 'typename' is required to satisfy the compiler.
+  typename TestFixture::List values;
+  values.push_back(n);
+  ...
+}
+
+TYPED_TEST(FooTest, HasPropertyA) { ... }
+```
+
+You can see `samples/sample6_unittest.cc` for a complete example.
+
+_Availability:_ Linux, Windows (requires MSVC 8.0 or above), Mac;
+since version 1.1.0.
+
+# Type-Parameterized Tests #
+
+_Type-parameterized tests_ are like typed tests, except that they
+don't require you to know the list of types ahead of time.  Instead,
+you can define the test logic first and instantiate it with different
+type lists later.  You can even instantiate it more than once in the
+same program.
+
+If you are designing an interface or concept, you can define a suite
+of type-parameterized tests to verify properties that any valid
+implementation of the interface/concept should have.  Then, the author
+of each implementation can just instantiate the test suite with his
+type to verify that it conforms to the requirements, without having to
+write similar tests repeatedly.  Here's an example:
+
+First, define a fixture class template, as we did with typed tests:
+
+```
+template <typename T>
+class FooTest : public ::testing::Test {
+  ...
+};
+```
+
+Next, declare that you will define a type-parameterized test case:
+
+```
+TYPED_TEST_CASE_P(FooTest);
+```
+
+The `_P` suffix is for "parameterized" or "pattern", whichever you
+prefer to think.
+
+Then, use `TYPED_TEST_P()` to define a type-parameterized test.  You
+can repeat this as many times as you want:
+
+```
+TYPED_TEST_P(FooTest, DoesBlah) {
+  // Inside a test, refer to TypeParam to get the type parameter.
+  TypeParam n = 0;
+  ...
+}
+
+TYPED_TEST_P(FooTest, HasPropertyA) { ... }
+```
+
+Now the tricky part: you need to register all test patterns using the
+`REGISTER_TYPED_TEST_CASE_P` macro before you can instantiate them.
+The first argument of the macro is the test case name; the rest are
+the names of the tests in this test case:
+
+```
+REGISTER_TYPED_TEST_CASE_P(FooTest,
+                           DoesBlah, HasPropertyA);
+```
+
+Finally, you are free to instantiate the pattern with the types you
+want.  If you put the above code in a header file, you can `#include`
+it in multiple C++ source files and instantiate it multiple times.
+
+```
+typedef ::testing::Types<char, int, unsigned int> MyTypes;
+INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
+```
+
+To distinguish different instances of the pattern, the first argument
+to the `INSTANTIATE_TYPED_TEST_CASE_P` macro is a prefix that will be
+added to the actual test case name.  Remember to pick unique prefixes
+for different instances.
+
+In the special case where the type list contains only one type, you
+can write that type directly without `::testing::Types<...>`, like this:
+
+```
+INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
+```
+
+You can see `samples/sample6_unittest.cc` for a complete example.
+
+_Availability:_ Linux, Windows (requires MSVC 8.0 or above), Mac;
+since version 1.1.0.
+
+# Testing Private Code #
+
+If you change your software's internal implementation, your tests should not
+break as long as the change is not observable by users. Therefore, per the
+_black-box testing principle_, most of the time you should test your code
+through its public interfaces.
+
+If you still find yourself needing to test internal implementation code,
+consider if there's a better design that wouldn't require you to do so. If you
+absolutely have to test non-public interface code though, you can. There are
+two cases to consider:
+
+  * Static functions (_not_ the same as static member functions!) or unnamed namespaces, and
+  * Private or protected class members
+
+## Static Functions ##
+
+Both static functions and definitions/declarations in an unnamed namespace are
+only visible within the same translation unit. To test them, you can `#include`
+the entire `.cc` file being tested in your `*_test.cc` file. (`#include`ing `.cc`
+files is not a good way to reuse code - you should not do this in production
+code!)
+
+However, a better approach is to move the private code into the
+`foo::internal` namespace, where `foo` is the namespace your project normally
+uses, and put the private declarations in a `*-internal.h` file. Your
+production `.cc` files and your tests are allowed to include this internal
+header, but your clients are not. This way, you can fully test your internal
+implementation without leaking it to your clients.
+
+## Private Class Members ##
+
+Private class members are only accessible from within the class or by friends.
+To access a class' private members, you can declare your test fixture as a
+friend to the class and define accessors in your fixture. Tests using the
+fixture can then access the private members of your production class via the
+accessors in the fixture. Note that even though your fixture is a friend to
+your production class, your tests are not automatically friends to it, as they
+are technically defined in sub-classes of the fixture.
+
+Another way to test private members is to refactor them into an implementation
+class, which is then declared in a `*-internal.h` file. Your clients aren't
+allowed to include this header but your tests can. Such is called the Pimpl
+(Private Implementation) idiom.
+
+Or, you can declare an individual test as a friend of your class by adding this
+line in the class body:
+
+```
+FRIEND_TEST(TestCaseName, TestName);
+```
+
+For example,
+```
+// foo.h
+#include "gtest/gtest_prod.h"
+
+// Defines FRIEND_TEST.
+class Foo {
+  ...
+ private:
+  FRIEND_TEST(FooTest, BarReturnsZeroOnNull);
+  int Bar(void* x);
+};
+
+// foo_test.cc
+...
+TEST(FooTest, BarReturnsZeroOnNull) {
+  Foo foo;
+  EXPECT_EQ(0, foo.Bar(NULL));
+  // Uses Foo's private member Bar().
+}
+```
+
+Pay special attention when your class is defined in a namespace, as you should
+define your test fixtures and tests in the same namespace if you want them to
+be friends of your class. For example, if the code to be tested looks like:
+
+```
+namespace my_namespace {
+
+class Foo {
+  friend class FooTest;
+  FRIEND_TEST(FooTest, Bar);
+  FRIEND_TEST(FooTest, Baz);
+  ...
+  definition of the class Foo
+  ...
+};
+
+}  // namespace my_namespace
+```
+
+Your test code should be something like:
+
+```
+namespace my_namespace {
+class FooTest : public ::testing::Test {
+ protected:
+  ...
+};
+
+TEST_F(FooTest, Bar) { ... }
+TEST_F(FooTest, Baz) { ... }
+
+}  // namespace my_namespace
+```
+
+# Catching Failures #
+
+If you are building a testing utility on top of Google Test, you'll
+want to test your utility.  What framework would you use to test it?
+Google Test, of course.
+
+The challenge is to verify that your testing utility reports failures
+correctly.  In frameworks that report a failure by throwing an
+exception, you could catch the exception and assert on it.  But Google
+Test doesn't use exceptions, so how do we test that a piece of code
+generates an expected failure?
+
+`"gtest/gtest-spi.h"` contains some constructs to do this.  After
+`#include`ing this header, you can use
+
+| `EXPECT_FATAL_FAILURE(`_statement, substring_`);` |
+|:--------------------------------------------------|
+
+to assert that _statement_ generates a fatal (e.g. `ASSERT_*`) failure
+whose message contains the given _substring_, or use
+
+| `EXPECT_NONFATAL_FAILURE(`_statement, substring_`);` |
+|:-----------------------------------------------------|
+
+if you are expecting a non-fatal (e.g. `EXPECT_*`) failure.
+
+For technical reasons, there are some caveats:
+
+  1. You cannot stream a failure message to either macro.
+  1. _statement_ in `EXPECT_FATAL_FAILURE()` cannot reference local non-static variables or non-static members of `this` object.
+  1. _statement_ in `EXPECT_FATAL_FAILURE()` cannot return a value.
+
+_Note:_ Google Test is designed with threads in mind.  Once the
+synchronization primitives in `"gtest/internal/gtest-port.h"` have
+been implemented, Google Test will become thread-safe, meaning that
+you can then use assertions in multiple threads concurrently.  Before
+
+that, however, Google Test only supports single-threaded usage.  Once
+thread-safe, `EXPECT_FATAL_FAILURE()` and `EXPECT_NONFATAL_FAILURE()`
+will capture failures in the current thread only. If _statement_
+creates new threads, failures in these threads will be ignored.  If
+you want to capture failures from all threads instead, you should use
+the following macros:
+
+| `EXPECT_FATAL_FAILURE_ON_ALL_THREADS(`_statement, substring_`);` |
+|:-----------------------------------------------------------------|
+| `EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(`_statement, substring_`);` |
+
+# Getting the Current Test's Name #
+
+Sometimes a function may need to know the name of the currently running test.
+For example, you may be using the `SetUp()` method of your test fixture to set
+the golden file name based on which test is running. The `::testing::TestInfo`
+class has this information:
+
+```
+namespace testing {
+
+class TestInfo {
+ public:
+  // Returns the test case name and the test name, respectively.
+  //
+  // Do NOT delete or free the return value - it's managed by the
+  // TestInfo class.
+  const char* test_case_name() const;
+  const char* name() const;
+};
+
+}  // namespace testing
+```
+
+
+> To obtain a `TestInfo` object for the currently running test, call
+`current_test_info()` on the `UnitTest` singleton object:
+
+```
+// Gets information about the currently running test.
+// Do NOT delete the returned object - it's managed by the UnitTest class.
+const ::testing::TestInfo* const test_info =
+  ::testing::UnitTest::GetInstance()->current_test_info();
+printf("We are in test %s of test case %s.\n",
+       test_info->name(), test_info->test_case_name());
+```
+
+`current_test_info()` returns a null pointer if no test is running. In
+particular, you cannot find the test case name in `TestCaseSetUp()`,
+`TestCaseTearDown()` (where you know the test case name implicitly), or
+functions called from them.
+
+_Availability:_ Linux, Windows, Mac.
+
+# Extending Google Test by Handling Test Events #
+
+Google Test provides an <b>event listener API</b> to let you receive
+notifications about the progress of a test program and test
+failures. The events you can listen to include the start and end of
+the test program, a test case, or a test method, among others. You may
+use this API to augment or replace the standard console output,
+replace the XML output, or provide a completely different form of
+output, such as a GUI or a database. You can also use test events as
+checkpoints to implement a resource leak checker, for example.
+
+_Availability:_ Linux, Windows, Mac; since v1.4.0.
+
+## Defining Event Listeners ##
+
+To define a event listener, you subclass either
+[testing::TestEventListener](../include/gtest/gtest.h#L855)
+or [testing::EmptyTestEventListener](../include/gtest/gtest.h#L905).
+The former is an (abstract) interface, where <i>each pure virtual method<br>
+can be overridden to handle a test event</i> (For example, when a test
+starts, the `OnTestStart()` method will be called.). The latter provides
+an empty implementation of all methods in the interface, such that a
+subclass only needs to override the methods it cares about.
+
+When an event is fired, its context is passed to the handler function
+as an argument. The following argument types are used:
+  * [UnitTest](../include/gtest/gtest.h#L1007) reflects the state of the entire test program,
+  * [TestCase](../include/gtest/gtest.h#L689) has information about a test case, which can contain one or more tests,
+  * [TestInfo](../include/gtest/gtest.h#L599) contains the state of a test, and
+  * [TestPartResult](../include/gtest/gtest-test-part.h#L42) represents the result of a test assertion.
+
+An event handler function can examine the argument it receives to find
+out interesting information about the event and the test program's
+state.  Here's an example:
+
+```
+  class MinimalistPrinter : public ::testing::EmptyTestEventListener {
+    // Called before a test starts.
+    virtual void OnTestStart(const ::testing::TestInfo& test_info) {
+      printf("*** Test %s.%s starting.\n",
+             test_info.test_case_name(), test_info.name());
+    }
+
+    // Called after a failed assertion or a SUCCEED() invocation.
+    virtual void OnTestPartResult(
+        const ::testing::TestPartResult& test_part_result) {
+      printf("%s in %s:%d\n%s\n",
+             test_part_result.failed() ? "*** Failure" : "Success",
+             test_part_result.file_name(),
+             test_part_result.line_number(),
+             test_part_result.summary());
+    }
+
+    // Called after a test ends.
+    virtual void OnTestEnd(const ::testing::TestInfo& test_info) {
+      printf("*** Test %s.%s ending.\n",
+             test_info.test_case_name(), test_info.name());
+    }
+  };
+```
+
+## Using Event Listeners ##
+
+To use the event listener you have defined, add an instance of it to
+the Google Test event listener list (represented by class
+[TestEventListeners](../include/gtest/gtest.h#L929)
+- note the "s" at the end of the name) in your
+`main()` function, before calling `RUN_ALL_TESTS()`:
+```
+int main(int argc, char** argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  // Gets hold of the event listener list.
+  ::testing::TestEventListeners& listeners =
+      ::testing::UnitTest::GetInstance()->listeners();
+  // Adds a listener to the end.  Google Test takes the ownership.
+  listeners.Append(new MinimalistPrinter);
+  return RUN_ALL_TESTS();
+}
+```
+
+There's only one problem: the default test result printer is still in
+effect, so its output will mingle with the output from your minimalist
+printer. To suppress the default printer, just release it from the
+event listener list and delete it. You can do so by adding one line:
+```
+  ...
+  delete listeners.Release(listeners.default_result_printer());
+  listeners.Append(new MinimalistPrinter);
+  return RUN_ALL_TESTS();
+```
+
+Now, sit back and enjoy a completely different output from your
+tests. For more details, you can read this
+[sample](../samples/sample9_unittest.cc).
+
+You may append more than one listener to the list. When an `On*Start()`
+or `OnTestPartResult()` event is fired, the listeners will receive it in
+the order they appear in the list (since new listeners are added to
+the end of the list, the default text printer and the default XML
+generator will receive the event first). An `On*End()` event will be
+received by the listeners in the _reverse_ order. This allows output by
+listeners added later to be framed by output from listeners added
+earlier.
+
+## Generating Failures in Listeners ##
+
+You may use failure-raising macros (`EXPECT_*()`, `ASSERT_*()`,
+`FAIL()`, etc) when processing an event. There are some restrictions:
+
+  1. You cannot generate any failure in `OnTestPartResult()` (otherwise it will cause `OnTestPartResult()` to be called recursively).
+  1. A listener that handles `OnTestPartResult()` is not allowed to generate any failure.
+
+When you add listeners to the listener list, you should put listeners
+that handle `OnTestPartResult()` _before_ listeners that can generate
+failures. This ensures that failures generated by the latter are
+attributed to the right test by the former.
+
+We have a sample of failure-raising listener
+[here](../samples/sample10_unittest.cc).
+
+# Running Test Programs: Advanced Options #
+
+Google Test test programs are ordinary executables. Once built, you can run
+them directly and affect their behavior via the following environment variables
+and/or command line flags. For the flags to work, your programs must call
+`::testing::InitGoogleTest()` before calling `RUN_ALL_TESTS()`.
+
+To see a list of supported flags and their usage, please run your test
+program with the `--help` flag.  You can also use `-h`, `-?`, or `/?`
+for short.  This feature is added in version 1.3.0.
+
+If an option is specified both by an environment variable and by a
+flag, the latter takes precedence.  Most of the options can also be
+set/read in code: to access the value of command line flag
+`--gtest_foo`, write `::testing::GTEST_FLAG(foo)`.  A common pattern is
+to set the value of a flag before calling `::testing::InitGoogleTest()`
+to change the default value of the flag:
+```
+int main(int argc, char** argv) {
+  // Disables elapsed time by default.
+  ::testing::GTEST_FLAG(print_time) = false;
+
+  // This allows the user to override the flag on the command line.
+  ::testing::InitGoogleTest(&argc, argv);
+
+  return RUN_ALL_TESTS();
+}
+```
+
+## Selecting Tests ##
+
+This section shows various options for choosing which tests to run.
+
+### Listing Test Names ###
+
+Sometimes it is necessary to list the available tests in a program before
+running them so that a filter may be applied if needed. Including the flag
+`--gtest_list_tests` overrides all other flags and lists tests in the following
+format:
+```
+TestCase1.
+  TestName1
+  TestName2
+TestCase2.
+  TestName
+```
+
+None of the tests listed are actually run if the flag is provided. There is no
+corresponding environment variable for this flag.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Running a Subset of the Tests ###
+
+By default, a Google Test program runs all tests the user has defined.
+Sometimes, you want to run only a subset of the tests (e.g. for debugging or
+quickly verifying a change). If you set the `GTEST_FILTER` environment variable
+or the `--gtest_filter` flag to a filter string, Google Test will only run the
+tests whose full names (in the form of `TestCaseName.TestName`) match the
+filter.
+
+The format of a filter is a '`:`'-separated list of wildcard patterns (called
+the positive patterns) optionally followed by a '`-`' and another
+'`:`'-separated pattern list (called the negative patterns). A test matches the
+filter if and only if it matches any of the positive patterns but does not
+match any of the negative patterns.
+
+A pattern may contain `'*'` (matches any string) or `'?'` (matches any single
+character). For convenience, the filter `'*-NegativePatterns'` can be also
+written as `'-NegativePatterns'`.
+
+For example:
+
+  * `./foo_test` Has no flag, and thus runs all its tests.
+  * `./foo_test --gtest_filter=*` Also runs everything, due to the single match-everything `*` value.
+  * `./foo_test --gtest_filter=FooTest.*` Runs everything in test case `FooTest`.
+  * `./foo_test --gtest_filter=*Null*:*Constructor*` Runs any test whose full name contains either `"Null"` or `"Constructor"`.
+  * `./foo_test --gtest_filter=-*DeathTest.*` Runs all non-death tests.
+  * `./foo_test --gtest_filter=FooTest.*-FooTest.Bar` Runs everything in test case `FooTest` except `FooTest.Bar`.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Temporarily Disabling Tests ###
+
+If you have a broken test that you cannot fix right away, you can add the
+`DISABLED_` prefix to its name. This will exclude it from execution. This is
+better than commenting out the code or using `#if 0`, as disabled tests are
+still compiled (and thus won't rot).
+
+If you need to disable all tests in a test case, you can either add `DISABLED_`
+to the front of the name of each test, or alternatively add it to the front of
+the test case name.
+
+For example, the following tests won't be run by Google Test, even though they
+will still be compiled:
+
+```
+// Tests that Foo does Abc.
+TEST(FooTest, DISABLED_DoesAbc) { ... }
+
+class DISABLED_BarTest : public ::testing::Test { ... };
+
+// Tests that Bar does Xyz.
+TEST_F(DISABLED_BarTest, DoesXyz) { ... }
+```
+
+_Note:_ This feature should only be used for temporary pain-relief. You still
+have to fix the disabled tests at a later date. As a reminder, Google Test will
+print a banner warning you if a test program contains any disabled tests.
+
+_Tip:_ You can easily count the number of disabled tests you have
+using `grep`. This number can be used as a metric for improving your
+test quality.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Temporarily Enabling Disabled Tests ###
+
+To include [disabled tests](#temporarily-disabling-tests) in test
+execution, just invoke the test program with the
+`--gtest_also_run_disabled_tests` flag or set the
+`GTEST_ALSO_RUN_DISABLED_TESTS` environment variable to a value other
+than `0`.  You can combine this with the
+[--gtest\-filter](#running-a-subset-of-the_tests) flag to further select
+which disabled tests to run.
+
+_Availability:_ Linux, Windows, Mac; since version 1.3.0.
+
+## Repeating the Tests ##
+
+Once in a while you'll run into a test whose result is hit-or-miss. Perhaps it
+will fail only 1% of the time, making it rather hard to reproduce the bug under
+a debugger. This can be a major source of frustration.
+
+The `--gtest_repeat` flag allows you to repeat all (or selected) test methods
+in a program many times. Hopefully, a flaky test will eventually fail and give
+you a chance to debug. Here's how to use it:
+
+| `$ foo_test --gtest_repeat=1000` | Repeat foo\_test 1000 times and don't stop at failures. |
+|:---------------------------------|:--------------------------------------------------------|
+| `$ foo_test --gtest_repeat=-1`   | A negative count means repeating forever.               |
+| `$ foo_test --gtest_repeat=1000 --gtest_break_on_failure` | Repeat foo\_test 1000 times, stopping at the first failure. This is especially useful when running under a debugger: when the testfails, it will drop into the debugger and you can then inspect variables and stacks. |
+| `$ foo_test --gtest_repeat=1000 --gtest_filter=FooBar` | Repeat the tests whose name matches the filter 1000 times. |
+
+If your test program contains global set-up/tear-down code registered
+using `AddGlobalTestEnvironment()`, it will be repeated in each
+iteration as well, as the flakiness may be in it. You can also specify
+the repeat count by setting the `GTEST_REPEAT` environment variable.
+
+_Availability:_ Linux, Windows, Mac.
+
+## Shuffling the Tests ##
+
+You can specify the `--gtest_shuffle` flag (or set the `GTEST_SHUFFLE`
+environment variable to `1`) to run the tests in a program in a random
+order. This helps to reveal bad dependencies between tests.
+
+By default, Google Test uses a random seed calculated from the current
+time. Therefore you'll get a different order every time. The console
+output includes the random seed value, such that you can reproduce an
+order-related test failure later. To specify the random seed
+explicitly, use the `--gtest_random_seed=SEED` flag (or set the
+`GTEST_RANDOM_SEED` environment variable), where `SEED` is an integer
+between 0 and 99999. The seed value 0 is special: it tells Google Test
+to do the default behavior of calculating the seed from the current
+time.
+
+If you combine this with `--gtest_repeat=N`, Google Test will pick a
+different random seed and re-shuffle the tests in each iteration.
+
+_Availability:_ Linux, Windows, Mac; since v1.4.0.
+
+## Controlling Test Output ##
+
+This section teaches how to tweak the way test results are reported.
+
+### Colored Terminal Output ###
+
+Google Test can use colors in its terminal output to make it easier to spot
+the separation between tests, and whether tests passed.
+
+You can set the GTEST\_COLOR environment variable or set the `--gtest_color`
+command line flag to `yes`, `no`, or `auto` (the default) to enable colors,
+disable colors, or let Google Test decide. When the value is `auto`, Google
+Test will use colors if and only if the output goes to a terminal and (on
+non-Windows platforms) the `TERM` environment variable is set to `xterm` or
+`xterm-color`.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Suppressing the Elapsed Time ###
+
+By default, Google Test prints the time it takes to run each test.  To
+suppress that, run the test program with the `--gtest_print_time=0`
+command line flag.  Setting the `GTEST_PRINT_TIME` environment
+variable to `0` has the same effect.
+
+_Availability:_ Linux, Windows, Mac.  (In Google Test 1.3.0 and lower,
+the default behavior is that the elapsed time is **not** printed.)
+
+### Generating an XML Report ###
+
+Google Test can emit a detailed XML report to a file in addition to its normal
+textual output. The report contains the duration of each test, and thus can
+help you identify slow tests.
+
+To generate the XML report, set the `GTEST_OUTPUT` environment variable or the
+`--gtest_output` flag to the string `"xml:_path_to_output_file_"`, which will
+create the file at the given location. You can also just use the string
+`"xml"`, in which case the output can be found in the `test_detail.xml` file in
+the current directory.
+
+If you specify a directory (for example, `"xml:output/directory/"` on Linux or
+`"xml:output\directory\"` on Windows), Google Test will create the XML file in
+that directory, named after the test executable (e.g. `foo_test.xml` for test
+program `foo_test` or `foo_test.exe`). If the file already exists (perhaps left
+over from a previous run), Google Test will pick a different name (e.g.
+`foo_test_1.xml`) to avoid overwriting it.
+
+The report uses the format described here.  It is based on the
+`junitreport` Ant task and can be parsed by popular continuous build
+systems like [Hudson](https://hudson.dev.java.net/). Since that format
+was originally intended for Java, a little interpretation is required
+to make it apply to Google Test tests, as shown here:
+
+```
+<testsuites name="AllTests" ...>
+  <testsuite name="test_case_name" ...>
+    <testcase name="test_name" ...>
+      <failure message="..."/>
+      <failure message="..."/>
+      <failure message="..."/>
+    </testcase>
+  </testsuite>
+</testsuites>
+```
+
+  * The root `<testsuites>` element corresponds to the entire test program.
+  * `<testsuite>` elements correspond to Google Test test cases.
+  * `<testcase>` elements correspond to Google Test test functions.
+
+For instance, the following program
+
+```
+TEST(MathTest, Addition) { ... }
+TEST(MathTest, Subtraction) { ... }
+TEST(LogicTest, NonContradiction) { ... }
+```
+
+could generate this report:
+
+```
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuites tests="3" failures="1" errors="0" time="35" name="AllTests">
+  <testsuite name="MathTest" tests="2" failures="1" errors="0" time="15">
+    <testcase name="Addition" status="run" time="7" classname="">
+      <failure message="Value of: add(1, 1)&#x0A; Actual: 3&#x0A;Expected: 2" type=""/>
+      <failure message="Value of: add(1, -1)&#x0A; Actual: 1&#x0A;Expected: 0" type=""/>
+    </testcase>
+    <testcase name="Subtraction" status="run" time="5" classname="">
+    </testcase>
+  </testsuite>
+  <testsuite name="LogicTest" tests="1" failures="0" errors="0" time="5">
+    <testcase name="NonContradiction" status="run" time="5" classname="">
+    </testcase>
+  </testsuite>
+</testsuites>
+```
+
+Things to note:
+
+  * The `tests` attribute of a `<testsuites>` or `<testsuite>` element tells how many test functions the Google Test program or test case contains, while the `failures` attribute tells how many of them failed.
+  * The `time` attribute expresses the duration of the test, test case, or entire test program in milliseconds.
+  * Each `<failure>` element corresponds to a single failed Google Test assertion.
+  * Some JUnit concepts don't apply to Google Test, yet we have to conform to the DTD. Therefore you'll see some dummy elements and attributes in the report. You can safely ignore these parts.
+
+_Availability:_ Linux, Windows, Mac.
+
+## Controlling How Failures Are Reported ##
+
+### Turning Assertion Failures into Break-Points ###
+
+When running test programs under a debugger, it's very convenient if the
+debugger can catch an assertion failure and automatically drop into interactive
+mode. Google Test's _break-on-failure_ mode supports this behavior.
+
+To enable it, set the `GTEST_BREAK_ON_FAILURE` environment variable to a value
+other than `0` . Alternatively, you can use the `--gtest_break_on_failure`
+command line flag.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Disabling Catching Test-Thrown Exceptions ###
+
+Google Test can be used either with or without exceptions enabled.  If
+a test throws a C++ exception or (on Windows) a structured exception
+(SEH), by default Google Test catches it, reports it as a test
+failure, and continues with the next test method.  This maximizes the
+coverage of a test run.  Also, on Windows an uncaught exception will
+cause a pop-up window, so catching the exceptions allows you to run
+the tests automatically.
+
+When debugging the test failures, however, you may instead want the
+exceptions to be handled by the debugger, such that you can examine
+the call stack when an exception is thrown.  To achieve that, set the
+`GTEST_CATCH_EXCEPTIONS` environment variable to `0`, or use the
+`--gtest_catch_exceptions=0` flag when running the tests.
+
+**Availability**: Linux, Windows, Mac.
+
+### Letting Another Testing Framework Drive ###
+
+If you work on a project that has already been using another testing
+framework and is not ready to completely switch to Google Test yet,
+you can get much of Google Test's benefit by using its assertions in
+your existing tests.  Just change your `main()` function to look
+like:
+
+```
+#include "gtest/gtest.h"
+
+int main(int argc, char** argv) {
+  ::testing::GTEST_FLAG(throw_on_failure) = true;
+  // Important: Google Test must be initialized.
+  ::testing::InitGoogleTest(&argc, argv);
+
+  ... whatever your existing testing framework requires ...
+}
+```
+
+With that, you can use Google Test assertions in addition to the
+native assertions your testing framework provides, for example:
+
+```
+void TestFooDoesBar() {
+  Foo foo;
+  EXPECT_LE(foo.Bar(1), 100);     // A Google Test assertion.
+  CPPUNIT_ASSERT(foo.IsEmpty());  // A native assertion.
+}
+```
+
+If a Google Test assertion fails, it will print an error message and
+throw an exception, which will be treated as a failure by your host
+testing framework.  If you compile your code with exceptions disabled,
+a failed Google Test assertion will instead exit your program with a
+non-zero code, which will also signal a test failure to your test
+runner.
+
+If you don't write `::testing::GTEST_FLAG(throw_on_failure) = true;` in
+your `main()`, you can alternatively enable this feature by specifying
+the `--gtest_throw_on_failure` flag on the command-line or setting the
+`GTEST_THROW_ON_FAILURE` environment variable to a non-zero value.
+
+_Availability:_ Linux, Windows, Mac; since v1.3.0.
+
+## Distributing Test Functions to Multiple Machines ##
+
+If you have more than one machine you can use to run a test program,
+you might want to run the test functions in parallel and get the
+result faster.  We call this technique _sharding_, where each machine
+is called a _shard_.
+
+Google Test is compatible with test sharding.  To take advantage of
+this feature, your test runner (not part of Google Test) needs to do
+the following:
+
+  1. Allocate a number of machines (shards) to run the tests.
+  1. On each shard, set the `GTEST_TOTAL_SHARDS` environment variable to the total number of shards.  It must be the same for all shards.
+  1. On each shard, set the `GTEST_SHARD_INDEX` environment variable to the index of the shard.  Different shards must be assigned different indices, which must be in the range `[0, GTEST_TOTAL_SHARDS - 1]`.
+  1. Run the same test program on all shards.  When Google Test sees the above two environment variables, it will select a subset of the test functions to run.  Across all shards, each test function in the program will be run exactly once.
+  1. Wait for all shards to finish, then collect and report the results.
+
+Your project may have tests that were written without Google Test and
+thus don't understand this protocol.  In order for your test runner to
+figure out which test supports sharding, it can set the environment
+variable `GTEST_SHARD_STATUS_FILE` to a non-existent file path.  If a
+test program supports sharding, it will create this file to
+acknowledge the fact (the actual contents of the file are not
+important at this time; although we may stick some useful information
+in it in the future.); otherwise it will not create it.
+
+Here's an example to make it clear.  Suppose you have a test program
+`foo_test` that contains the following 5 test functions:
+```
+TEST(A, V)
+TEST(A, W)
+TEST(B, X)
+TEST(B, Y)
+TEST(B, Z)
+```
+and you have 3 machines at your disposal.  To run the test functions in
+parallel, you would set `GTEST_TOTAL_SHARDS` to 3 on all machines, and
+set `GTEST_SHARD_INDEX` to 0, 1, and 2 on the machines respectively.
+Then you would run the same `foo_test` on each machine.
+
+Google Test reserves the right to change how the work is distributed
+across the shards, but here's one possible scenario:
+
+  * Machine #0 runs `A.V` and `B.X`.
+  * Machine #1 runs `A.W` and `B.Y`.
+  * Machine #2 runs `B.Z`.
+
+_Availability:_ Linux, Windows, Mac; since version 1.3.0.
+
+# Fusing Google Test Source Files #
+
+Google Test's implementation consists of ~30 files (excluding its own
+tests).  Sometimes you may want them to be packaged up in two files (a
+`.h` and a `.cc`) instead, such that you can easily copy them to a new
+machine and start hacking there.  For this we provide an experimental
+Python script `fuse_gtest_files.py` in the `scripts/` directory (since release 1.3.0).
+Assuming you have Python 2.4 or above installed on your machine, just
+go to that directory and run
+```
+python fuse_gtest_files.py OUTPUT_DIR
+```
+
+and you should see an `OUTPUT_DIR` directory being created with files
+`gtest/gtest.h` and `gtest/gtest-all.cc` in it.  These files contain
+everything you need to use Google Test.  Just copy them to anywhere
+you want and you are ready to write tests.  You can use the
+[scripts/test/Makefile](../scripts/test/Makefile)
+file as an example on how to compile your tests against them.
+
+# Where to Go from Here #
+
+Congratulations! You've now learned more advanced Google Test tools and are
+ready to tackle more complex testing tasks. If you want to dive even deeper, you
+can read the [Frequently-Asked Questions](V1_6_FAQ.md).
diff --git a/docs/V1_6_Documentation.md b/docs/V1_6_Documentation.md
new file mode 100755 (executable)
index 0000000..ca92466
--- /dev/null
@@ -0,0 +1,14 @@
+This page lists all documentation wiki pages for Google Test **1.6**
+-- **if you use a released version of Google Test, please read the
+documentation for that specific version instead.**
+
+  * [Primer](V1_6_Primer.md) -- start here if you are new to Google Test.
+  * [Samples](V1_6_Samples.md) -- learn from examples.
+  * [AdvancedGuide](V1_6_AdvancedGuide.md) -- learn more about Google Test.
+  * [XcodeGuide](V1_6_XcodeGuide.md) -- how to use Google Test in Xcode on Mac.
+  * [Frequently-Asked Questions](V1_6_FAQ.md) -- check here before asking a question on the mailing list.
+
+To contribute code to Google Test, read:
+
+  * [DevGuide](DevGuide.md) -- read this _before_ writing your first patch.
+  * [PumpManual](V1_6_PumpManual.md) -- how we generate some of Google Test's source files.
\ No newline at end of file
diff --git a/docs/V1_6_FAQ.md b/docs/V1_6_FAQ.md
new file mode 100755 (executable)
index 0000000..2b7f784
--- /dev/null
@@ -0,0 +1,1038 @@
+
+
+If you cannot find the answer to your question here, and you have read
+[Primer](V1_6_Primer.md) and [AdvancedGuide](V1_6_AdvancedGuide.md), send it to
+googletestframework@googlegroups.com.
+
+## Why should I use Google Test instead of my favorite C++ testing framework? ##
+
+First, let us say clearly that we don't want to get into the debate of
+which C++ testing framework is **the best**.  There exist many fine
+frameworks for writing C++ tests, and we have tremendous respect for
+the developers and users of them.  We don't think there is (or will
+be) a single best framework - you have to pick the right tool for the
+particular task you are tackling.
+
+We created Google Test because we couldn't find the right combination
+of features and conveniences in an existing framework to satisfy _our_
+needs.  The following is a list of things that _we_ like about Google
+Test.  We don't claim them to be unique to Google Test - rather, the
+combination of them makes Google Test the choice for us.  We hope this
+list can help you decide whether it is for you too.
+
+  * Google Test is designed to be portable: it doesn't require exceptions or RTTI; it works around various bugs in various compilers and environments; etc.  As a result, it works on Linux, Mac OS X, Windows and several embedded operating systems.
+  * Nonfatal assertions (`EXPECT_*`) have proven to be great time savers, as they allow a test to report multiple failures in a single edit-compile-test cycle.
+  * It's easy to write assertions that generate informative messages: you just use the stream syntax to append any additional information, e.g. `ASSERT_EQ(5, Foo(i)) << " where i = " << i;`.  It doesn't require a new set of macros or special functions.
+  * Google Test automatically detects your tests and doesn't require you to enumerate them in order to run them.
+  * Death tests are pretty handy for ensuring that your asserts in production code are triggered by the right conditions.
+  * `SCOPED_TRACE` helps you understand the context of an assertion failure when it comes from inside a sub-routine or loop.
+  * You can decide which tests to run using name patterns.  This saves time when you want to quickly reproduce a test failure.
+  * Google Test can generate XML test result reports that can be parsed by popular continuous build system like Hudson.
+  * Simple things are easy in Google Test, while hard things are possible: in addition to advanced features like [global test environments](V1_6_AdvancedGuide.md#Global_Set-Up_and_Tear-Down) and tests parameterized by [values](V1_6_AdvancedGuide.md#value-parameterized-tests) or [types](V1_6_AdvancedGuide.md#typed-tests), Google Test supports various ways for the user to extend the framework -- if Google Test doesn't do something out of the box, chances are that a user can implement the feature using Google Test's public API, without changing Google Test itself.  In particular, you can:
+    * expand your testing vocabulary by defining [custom predicates](V1_6_AdvancedGuide.md#predicate-assertions-for-better-error-messages),
+    * teach Google Test how to [print your types](V1_6_AdvancedGuide.md#teaching-google-test-how-to-print-your-values),
+    * define your own testing macros or utilities and verify them using Google Test's [Service Provider Interface](V1_6_AdvancedGuide.md#catching-failures), and
+    * reflect on the test cases or change the test output format by intercepting the [test events](V1_6_AdvancedGuide.md#extending-google-test-by-handling-test-events).
+
+## I'm getting warnings when compiling Google Test.  Would you fix them? ##
+
+We strive to minimize compiler warnings Google Test generates.  Before releasing a new version, we test to make sure that it doesn't generate warnings when compiled using its CMake script on Windows, Linux, and Mac OS.
+
+Unfortunately, this doesn't mean you are guaranteed to see no warnings when compiling Google Test in your environment:
+
+  * You may be using a different compiler as we use, or a different version of the same compiler.  We cannot possibly test for all compilers.
+  * You may be compiling on a different platform as we do.
+  * Your project may be using different compiler flags as we do.
+
+It is not always possible to make Google Test warning-free for everyone.  Or, it may not be desirable if the warning is rarely enabled and fixing the violations makes the code more complex.
+
+If you see warnings when compiling Google Test, we suggest that you use the `-isystem` flag (assuming your are using GCC) to mark Google Test headers as system headers.  That'll suppress warnings from Google Test headers.
+
+## Why should not test case names and test names contain underscore? ##
+
+Underscore (`_`) is special, as C++ reserves the following to be used by
+the compiler and the standard library:
+
+  1. any identifier that starts with an `_` followed by an upper-case letter, and
+  1. any identifier that containers two consecutive underscores (i.e. `__`) _anywhere_ in its name.
+
+User code is _prohibited_ from using such identifiers.
+
+Now let's look at what this means for `TEST` and `TEST_F`.
+
+Currently `TEST(TestCaseName, TestName)` generates a class named
+`TestCaseName_TestName_Test`.  What happens if `TestCaseName` or `TestName`
+contains `_`?
+
+  1. If `TestCaseName` starts with an `_` followed by an upper-case letter (say, `_Foo`), we end up with `_Foo_TestName_Test`, which is reserved and thus invalid.
+  1. If `TestCaseName` ends with an `_` (say, `Foo_`), we get `Foo__TestName_Test`, which is invalid.
+  1. If `TestName` starts with an `_` (say, `_Bar`), we get `TestCaseName__Bar_Test`, which is invalid.
+  1. If `TestName` ends with an `_` (say, `Bar_`), we get `TestCaseName_Bar__Test`, which is invalid.
+
+So clearly `TestCaseName` and `TestName` cannot start or end with `_`
+(Actually, `TestCaseName` can start with `_` -- as long as the `_` isn't
+followed by an upper-case letter.  But that's getting complicated.  So
+for simplicity we just say that it cannot start with `_`.).
+
+It may seem fine for `TestCaseName` and `TestName` to contain `_` in the
+middle.  However, consider this:
+```
+TEST(Time, Flies_Like_An_Arrow) { ... }
+TEST(Time_Flies, Like_An_Arrow) { ... }
+```
+
+Now, the two `TEST`s will both generate the same class
+(`Time_Files_Like_An_Arrow_Test`).  That's not good.
+
+So for simplicity, we just ask the users to avoid `_` in `TestCaseName`
+and `TestName`.  The rule is more constraining than necessary, but it's
+simple and easy to remember.  It also gives Google Test some wiggle
+room in case its implementation needs to change in the future.
+
+If you violate the rule, there may not be immediately consequences,
+but your test may (just may) break with a new compiler (or a new
+version of the compiler you are using) or with a new version of Google
+Test.  Therefore it's best to follow the rule.
+
+## Why is it not recommended to install a pre-compiled copy of Google Test (for example, into /usr/local)? ##
+
+In the early days, we said that you could install
+compiled Google Test libraries on `*`nix systems using `make install`.
+Then every user of your machine can write tests without
+recompiling Google Test.
+
+This seemed like a good idea, but it has a
+got-cha: every user needs to compile his tests using the _same_ compiler
+flags used to compile the installed Google Test libraries; otherwise
+he may run into undefined behaviors (i.e. the tests can behave
+strangely and may even crash for no obvious reasons).
+
+Why?  Because C++ has this thing called the One-Definition Rule: if
+two C++ source files contain different definitions of the same
+class/function/variable, and you link them together, you violate the
+rule.  The linker may or may not catch the error (in many cases it's
+not required by the C++ standard to catch the violation).  If it
+doesn't, you get strange run-time behaviors that are unexpected and
+hard to debug.
+
+If you compile Google Test and your test code using different compiler
+flags, they may see different definitions of the same
+class/function/variable (e.g. due to the use of `#if` in Google Test).
+Therefore, for your sanity, we recommend to avoid installing pre-compiled
+Google Test libraries.  Instead, each project should compile
+Google Test itself such that it can be sure that the same flags are
+used for both Google Test and the tests.
+
+## How do I generate 64-bit binaries on Windows (using Visual Studio 2008)? ##
+
+(Answered by Trevor Robinson)
+
+Load the supplied Visual Studio solution file, either `msvc\gtest-md.sln` or
+`msvc\gtest.sln`. Go through the migration wizard to migrate the
+solution and project files to Visual Studio 2008. Select
+`Configuration Manager...` from the `Build` menu. Select `<New...>` from
+the `Active solution platform` dropdown.  Select `x64` from the new
+platform dropdown, leave `Copy settings from` set to `Win32` and
+`Create new project platforms` checked, then click `OK`. You now have
+`Win32` and `x64` platform configurations, selectable from the
+`Standard` toolbar, which allow you to toggle between building 32-bit or
+64-bit binaries (or both at once using Batch Build).
+
+In order to prevent build output files from overwriting one another,
+you'll need to change the `Intermediate Directory` settings for the
+newly created platform configuration across all the projects. To do
+this, multi-select (e.g. using shift-click) all projects (but not the
+solution) in the `Solution Explorer`. Right-click one of them and
+select `Properties`. In the left pane, select `Configuration Properties`,
+and from the `Configuration` dropdown, select `All Configurations`.
+Make sure the selected platform is `x64`. For the
+`Intermediate Directory` setting, change the value from
+`$(PlatformName)\$(ConfigurationName)` to
+`$(OutDir)\$(ProjectName)`. Click `OK` and then build the
+solution. When the build is complete, the 64-bit binaries will be in
+the `msvc\x64\Debug` directory.
+
+## Can I use Google Test on MinGW? ##
+
+We haven't tested this ourselves, but Per Abrahamsen reported that he
+was able to compile and install Google Test successfully when using
+MinGW from Cygwin.  You'll need to configure it with:
+
+`PATH/TO/configure CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin"`
+
+You should be able to replace the `-mno-cygwin` option with direct links
+to the real MinGW binaries, but we haven't tried that.
+
+Caveats:
+
+  * There are many warnings when compiling.
+  * `make check` will produce some errors as not all tests for Google Test itself are compatible with MinGW.
+
+We also have reports on successful cross compilation of Google Test
+MinGW binaries on Linux using
+[these instructions](http://wiki.wxwidgets.org/Cross-Compiling_Under_Linux#Cross-compiling_under_Linux_for_MS_Windows)
+on the WxWidgets site.
+
+Please contact `googletestframework@googlegroups.com` if you are
+interested in improving the support for MinGW.
+
+## Why does Google Test support EXPECT\_EQ(NULL, ptr) and ASSERT\_EQ(NULL, ptr) but not EXPECT\_NE(NULL, ptr) and ASSERT\_NE(NULL, ptr)? ##
+
+Due to some peculiarity of C++, it requires some non-trivial template
+meta programming tricks to support using `NULL` as an argument of the
+`EXPECT_XX()` and `ASSERT_XX()` macros. Therefore we only do it where
+it's most needed (otherwise we make the implementation of Google Test
+harder to maintain and more error-prone than necessary).
+
+The `EXPECT_EQ()` macro takes the _expected_ value as its first
+argument and the _actual_ value as the second. It's reasonable that
+someone wants to write `EXPECT_EQ(NULL, some_expression)`, and this
+indeed was requested several times. Therefore we implemented it.
+
+The need for `EXPECT_NE(NULL, ptr)` isn't nearly as strong. When the
+assertion fails, you already know that `ptr` must be `NULL`, so it
+doesn't add any information to print ptr in this case. That means
+`EXPECT_TRUE(ptr ! NULL)` works just as well.
+
+If we were to support `EXPECT_NE(NULL, ptr)`, for consistency we'll
+have to support `EXPECT_NE(ptr, NULL)` as well, as unlike `EXPECT_EQ`,
+we don't have a convention on the order of the two arguments for
+`EXPECT_NE`. This means using the template meta programming tricks
+twice in the implementation, making it even harder to understand and
+maintain. We believe the benefit doesn't justify the cost.
+
+Finally, with the growth of Google Mock's [matcher](../../CookBook.md#using-matchers-in-google-test-assertions) library, we are
+encouraging people to use the unified `EXPECT_THAT(value, matcher)`
+syntax more often in tests. One significant advantage of the matcher
+approach is that matchers can be easily combined to form new matchers,
+while the `EXPECT_NE`, etc, macros cannot be easily
+combined. Therefore we want to invest more in the matchers than in the
+`EXPECT_XX()` macros.
+
+## Does Google Test support running tests in parallel? ##
+
+Test runners tend to be tightly coupled with the build/test
+environment, and Google Test doesn't try to solve the problem of
+running tests in parallel.  Instead, we tried to make Google Test work
+nicely with test runners.  For example, Google Test's XML report
+contains the time spent on each test, and its `gtest_list_tests` and
+`gtest_filter` flags can be used for splitting the execution of test
+methods into multiple processes.  These functionalities can help the
+test runner run the tests in parallel.
+
+## Why don't Google Test run the tests in different threads to speed things up? ##
+
+It's difficult to write thread-safe code.  Most tests are not written
+with thread-safety in mind, and thus may not work correctly in a
+multi-threaded setting.
+
+If you think about it, it's already hard to make your code work when
+you know what other threads are doing.  It's much harder, and
+sometimes even impossible, to make your code work when you don't know
+what other threads are doing (remember that test methods can be added,
+deleted, or modified after your test was written).  If you want to run
+the tests in parallel, you'd better run them in different processes.
+
+## Why aren't Google Test assertions implemented using exceptions? ##
+
+Our original motivation was to be able to use Google Test in projects
+that disable exceptions.  Later we realized some additional benefits
+of this approach:
+
+  1. Throwing in a destructor is undefined behavior in C++.  Not using exceptions means Google Test's assertions are safe to use in destructors.
+  1. The `EXPECT_*` family of macros will continue even after a failure, allowing multiple failures in a `TEST` to be reported in a single run. This is a popular feature, as in C++ the edit-compile-test cycle is usually quite long and being able to fixing more than one thing at a time is a blessing.
+  1. If assertions are implemented using exceptions, a test may falsely ignore a failure if it's caught by user code:
+```
+try { ... ASSERT_TRUE(...) ... }
+catch (...) { ... }
+```
+The above code will pass even if the `ASSERT_TRUE` throws.  While it's unlikely for someone to write this in a test, it's possible to run into this pattern when you write assertions in callbacks that are called by the code under test.
+
+The downside of not using exceptions is that `ASSERT_*` (implemented
+using `return`) will only abort the current function, not the current
+`TEST`.
+
+## Why do we use two different macros for tests with and without fixtures? ##
+
+Unfortunately, C++'s macro system doesn't allow us to use the same
+macro for both cases.  One possibility is to provide only one macro
+for tests with fixtures, and require the user to define an empty
+fixture sometimes:
+
+```
+class FooTest : public ::testing::Test {};
+
+TEST_F(FooTest, DoesThis) { ... }
+```
+or
+```
+typedef ::testing::Test FooTest;
+
+TEST_F(FooTest, DoesThat) { ... }
+```
+
+Yet, many people think this is one line too many. :-) Our goal was to
+make it really easy to write tests, so we tried to make simple tests
+trivial to create.  That means using a separate macro for such tests.
+
+We think neither approach is ideal, yet either of them is reasonable.
+In the end, it probably doesn't matter much either way.
+
+## Why don't we use structs as test fixtures? ##
+
+We like to use structs only when representing passive data.  This
+distinction between structs and classes is good for documenting the
+intent of the code's author.  Since test fixtures have logic like
+`SetUp()` and `TearDown()`, they are better defined as classes.
+
+## Why are death tests implemented as assertions instead of using a test runner? ##
+
+Our goal was to make death tests as convenient for a user as C++
+possibly allows.  In particular:
+
+  * The runner-style requires to split the information into two pieces: the definition of the death test itself, and the specification for the runner on how to run the death test and what to expect.  The death test would be written in C++, while the runner spec may or may not be.  A user needs to carefully keep the two in sync. `ASSERT_DEATH(statement, expected_message)` specifies all necessary information in one place, in one language, without boilerplate code. It is very declarative.
+  * `ASSERT_DEATH` has a similar syntax and error-reporting semantics as other Google Test assertions, and thus is easy to learn.
+  * `ASSERT_DEATH` can be mixed with other assertions and other logic at your will.  You are not limited to one death test per test method. For example, you can write something like:
+```
+    if (FooCondition()) {
+      ASSERT_DEATH(Bar(), "blah");
+    } else {
+      ASSERT_EQ(5, Bar());
+    }
+```
+If you prefer one death test per test method, you can write your tests in that style too, but we don't want to impose that on the users.  The fewer artificial limitations the better.
+  * `ASSERT_DEATH` can reference local variables in the current function, and you can decide how many death tests you want based on run-time information.  For example,
+```
+    const int count = GetCount();  // Only known at run time.
+    for (int i = 1; i <= count; i++) {
+      ASSERT_DEATH({
+        double* buffer = new double[i];
+        ... initializes buffer ...
+        Foo(buffer, i)
+      }, "blah blah");
+    }
+```
+The runner-based approach tends to be more static and less flexible, or requires more user effort to get this kind of flexibility.
+
+Another interesting thing about `ASSERT_DEATH` is that it calls `fork()`
+to create a child process to run the death test.  This is lightening
+fast, as `fork()` uses copy-on-write pages and incurs almost zero
+overhead, and the child process starts from the user-supplied
+statement directly, skipping all global and local initialization and
+any code leading to the given statement.  If you launch the child
+process from scratch, it can take seconds just to load everything and
+start running if the test links to many libraries dynamically.
+
+## My death test modifies some state, but the change seems lost after the death test finishes. Why? ##
+
+Death tests (`EXPECT_DEATH`, etc) are executed in a sub-process s.t. the
+expected crash won't kill the test program (i.e. the parent process). As a
+result, any in-memory side effects they incur are observable in their
+respective sub-processes, but not in the parent process. You can think of them
+as running in a parallel universe, more or less.
+
+## The compiler complains about "undefined references" to some static const member variables, but I did define them in the class body. What's wrong? ##
+
+If your class has a static data member:
+
+```
+// foo.h
+class Foo {
+  ...
+  static const int kBar = 100;
+};
+```
+
+You also need to define it _outside_ of the class body in `foo.cc`:
+
+```
+const int Foo::kBar;  // No initializer here.
+```
+
+Otherwise your code is **invalid C++**, and may break in unexpected ways. In
+particular, using it in Google Test comparison assertions (`EXPECT_EQ`, etc)
+will generate an "undefined reference" linker error.
+
+## I have an interface that has several implementations. Can I write a set of tests once and repeat them over all the implementations? ##
+
+Google Test doesn't yet have good support for this kind of tests, or
+data-driven tests in general. We hope to be able to make improvements in this
+area soon.
+
+## Can I derive a test fixture from another? ##
+
+Yes.
+
+Each test fixture has a corresponding and same named test case. This means only
+one test case can use a particular fixture. Sometimes, however, multiple test
+cases may want to use the same or slightly different fixtures. For example, you
+may want to make sure that all of a GUI library's test cases don't leak
+important system resources like fonts and brushes.
+
+In Google Test, you share a fixture among test cases by putting the shared
+logic in a base test fixture, then deriving from that base a separate fixture
+for each test case that wants to use this common logic. You then use `TEST_F()`
+to write tests using each derived fixture.
+
+Typically, your code looks like this:
+
+```
+// Defines a base test fixture.
+class BaseTest : public ::testing::Test {
+  protected:
+   ...
+};
+
+// Derives a fixture FooTest from BaseTest.
+class FooTest : public BaseTest {
+  protected:
+    virtual void SetUp() {
+      BaseTest::SetUp();  // Sets up the base fixture first.
+      ... additional set-up work ...
+    }
+    virtual void TearDown() {
+      ... clean-up work for FooTest ...
+      BaseTest::TearDown();  // Remember to tear down the base fixture
+                             // after cleaning up FooTest!
+    }
+    ... functions and variables for FooTest ...
+};
+
+// Tests that use the fixture FooTest.
+TEST_F(FooTest, Bar) { ... }
+TEST_F(FooTest, Baz) { ... }
+
+... additional fixtures derived from BaseTest ...
+```
+
+If necessary, you can continue to derive test fixtures from a derived fixture.
+Google Test has no limit on how deep the hierarchy can be.
+
+For a complete example using derived test fixtures, see
+[sample5](../samples/sample5_unittest.cc).
+
+## My compiler complains "void value not ignored as it ought to be." What does this mean? ##
+
+You're probably using an `ASSERT_*()` in a function that doesn't return `void`.
+`ASSERT_*()` can only be used in `void` functions.
+
+## My death test hangs (or seg-faults). How do I fix it? ##
+
+In Google Test, death tests are run in a child process and the way they work is
+delicate. To write death tests you really need to understand how they work.
+Please make sure you have read this.
+
+In particular, death tests don't like having multiple threads in the parent
+process. So the first thing you can try is to eliminate creating threads
+outside of `EXPECT_DEATH()`.
+
+Sometimes this is impossible as some library you must use may be creating
+threads before `main()` is even reached. In this case, you can try to minimize
+the chance of conflicts by either moving as many activities as possible inside
+`EXPECT_DEATH()` (in the extreme case, you want to move everything inside), or
+leaving as few things as possible in it. Also, you can try to set the death
+test style to `"threadsafe"`, which is safer but slower, and see if it helps.
+
+If you go with thread-safe death tests, remember that they rerun the test
+program from the beginning in the child process. Therefore make sure your
+program can run side-by-side with itself and is deterministic.
+
+In the end, this boils down to good concurrent programming. You have to make
+sure that there is no race conditions or dead locks in your program. No silver
+bullet - sorry!
+
+## Should I use the constructor/destructor of the test fixture or the set-up/tear-down function? ##
+
+The first thing to remember is that Google Test does not reuse the
+same test fixture object across multiple tests. For each `TEST_F`,
+Google Test will create a fresh test fixture object, _immediately_
+call `SetUp()`, run the test, call `TearDown()`, and then
+_immediately_ delete the test fixture object. Therefore, there is no
+need to write a `SetUp()` or `TearDown()` function if the constructor
+or destructor already does the job.
+
+You may still want to use `SetUp()/TearDown()` in the following cases:
+  * If the tear-down operation could throw an exception, you must use `TearDown()` as opposed to the destructor, as throwing in a destructor leads to undefined behavior and usually will kill your program right away. Note that many standard libraries (like STL) may throw when exceptions are enabled in the compiler. Therefore you should prefer `TearDown()` if you want to write portable tests that work with or without exceptions.
+  * The Google Test team is considering making the assertion macros throw on platforms where exceptions are enabled (e.g. Windows, Mac OS, and Linux client-side), which will eliminate the need for the user to propagate failures from a subroutine to its caller. Therefore, you shouldn't use Google Test assertions in a destructor if your code could run on such a platform.
+  * In a constructor or destructor, you cannot make a virtual function call on this object. (You can call a method declared as virtual, but it will be statically bound.) Therefore, if you need to call a method that will be overriden in a derived class, you have to use `SetUp()/TearDown()`.
+
+## The compiler complains "no matching function to call" when I use ASSERT\_PREDn. How do I fix it? ##
+
+If the predicate function you use in `ASSERT_PRED*` or `EXPECT_PRED*` is
+overloaded or a template, the compiler will have trouble figuring out which
+overloaded version it should use. `ASSERT_PRED_FORMAT*` and
+`EXPECT_PRED_FORMAT*` don't have this problem.
+
+If you see this error, you might want to switch to
+`(ASSERT|EXPECT)_PRED_FORMAT*`, which will also give you a better failure
+message. If, however, that is not an option, you can resolve the problem by
+explicitly telling the compiler which version to pick.
+
+For example, suppose you have
+
+```
+bool IsPositive(int n) {
+  return n > 0;
+}
+bool IsPositive(double x) {
+  return x > 0;
+}
+```
+
+you will get a compiler error if you write
+
+```
+EXPECT_PRED1(IsPositive, 5);
+```
+
+However, this will work:
+
+```
+EXPECT_PRED1(*static_cast<bool (*)(int)>*(IsPositive), 5);
+```
+
+(The stuff inside the angled brackets for the `static_cast` operator is the
+type of the function pointer for the `int`-version of `IsPositive()`.)
+
+As another example, when you have a template function
+
+```
+template <typename T>
+bool IsNegative(T x) {
+  return x < 0;
+}
+```
+
+you can use it in a predicate assertion like this:
+
+```
+ASSERT_PRED1(IsNegative*<int>*, -5);
+```
+
+Things are more interesting if your template has more than one parameters. The
+following won't compile:
+
+```
+ASSERT_PRED2(*GreaterThan<int, int>*, 5, 0);
+```
+
+
+as the C++ pre-processor thinks you are giving `ASSERT_PRED2` 4 arguments,
+which is one more than expected. The workaround is to wrap the predicate
+function in parentheses:
+
+```
+ASSERT_PRED2(*(GreaterThan<int, int>)*, 5, 0);
+```
+
+
+## My compiler complains about "ignoring return value" when I call RUN\_ALL\_TESTS(). Why? ##
+
+Some people had been ignoring the return value of `RUN_ALL_TESTS()`. That is,
+instead of
+
+```
+return RUN_ALL_TESTS();
+```
+
+they write
+
+```
+RUN_ALL_TESTS();
+```
+
+This is wrong and dangerous. A test runner needs to see the return value of
+`RUN_ALL_TESTS()` in order to determine if a test has passed. If your `main()`
+function ignores it, your test will be considered successful even if it has a
+Google Test assertion failure. Very bad.
+
+To help the users avoid this dangerous bug, the implementation of
+`RUN_ALL_TESTS()` causes gcc to raise this warning, when the return value is
+ignored. If you see this warning, the fix is simple: just make sure its value
+is used as the return value of `main()`.
+
+## My compiler complains that a constructor (or destructor) cannot return a value. What's going on? ##
+
+Due to a peculiarity of C++, in order to support the syntax for streaming
+messages to an `ASSERT_*`, e.g.
+
+```
+ASSERT_EQ(1, Foo()) << "blah blah" << foo;
+```
+
+we had to give up using `ASSERT*` and `FAIL*` (but not `EXPECT*` and
+`ADD_FAILURE*`) in constructors and destructors. The workaround is to move the
+content of your constructor/destructor to a private void member function, or
+switch to `EXPECT_*()` if that works. This section in the user's guide explains
+it.
+
+## My set-up function is not called. Why? ##
+
+C++ is case-sensitive. It should be spelled as `SetUp()`.  Did you
+spell it as `Setup()`?
+
+Similarly, sometimes people spell `SetUpTestCase()` as `SetupTestCase()` and
+wonder why it's never called.
+
+## How do I jump to the line of a failure in Emacs directly? ##
+
+Google Test's failure message format is understood by Emacs and many other
+IDEs, like acme and XCode. If a Google Test message is in a compilation buffer
+in Emacs, then it's clickable. You can now hit `enter` on a message to jump to
+the corresponding source code, or use `C-x `` to jump to the next failure.
+
+## I have several test cases which share the same test fixture logic, do I have to define a new test fixture class for each of them? This seems pretty tedious. ##
+
+You don't have to. Instead of
+
+```
+class FooTest : public BaseTest {};
+
+TEST_F(FooTest, Abc) { ... }
+TEST_F(FooTest, Def) { ... }
+
+class BarTest : public BaseTest {};
+
+TEST_F(BarTest, Abc) { ... }
+TEST_F(BarTest, Def) { ... }
+```
+
+you can simply `typedef` the test fixtures:
+```
+typedef BaseTest FooTest;
+
+TEST_F(FooTest, Abc) { ... }
+TEST_F(FooTest, Def) { ... }
+
+typedef BaseTest BarTest;
+
+TEST_F(BarTest, Abc) { ... }
+TEST_F(BarTest, Def) { ... }
+```
+
+## The Google Test output is buried in a whole bunch of log messages. What do I do? ##
+
+The Google Test output is meant to be a concise and human-friendly report. If
+your test generates textual output itself, it will mix with the Google Test
+output, making it hard to read. However, there is an easy solution to this
+problem.
+
+Since most log messages go to stderr, we decided to let Google Test output go
+to stdout. This way, you can easily separate the two using redirection. For
+example:
+```
+./my_test > googletest_output.txt
+```
+
+## Why should I prefer test fixtures over global variables? ##
+
+There are several good reasons:
+  1. It's likely your test needs to change the states of its global variables. This makes it difficult to keep side effects from escaping one test and contaminating others, making debugging difficult. By using fixtures, each test has a fresh set of variables that's different (but with the same names). Thus, tests are kept independent of each other.
+  1. Global variables pollute the global namespace.
+  1. Test fixtures can be reused via subclassing, which cannot be done easily with global variables. This is useful if many test cases have something in common.
+
+## How do I test private class members without writing FRIEND\_TEST()s? ##
+
+You should try to write testable code, which means classes should be easily
+tested from their public interface. One way to achieve this is the Pimpl idiom:
+you move all private members of a class into a helper class, and make all
+members of the helper class public.
+
+You have several other options that don't require using `FRIEND_TEST`:
+  * Write the tests as members of the fixture class:
+```
+class Foo {
+  friend class FooTest;
+  ...
+};
+
+class FooTest : public ::testing::Test {
+ protected:
+  ...
+  void Test1() {...} // This accesses private members of class Foo.
+  void Test2() {...} // So does this one.
+};
+
+TEST_F(FooTest, Test1) {
+  Test1();
+}
+
+TEST_F(FooTest, Test2) {
+  Test2();
+}
+```
+  * In the fixture class, write accessors for the tested class' private members, then use the accessors in your tests:
+```
+class Foo {
+  friend class FooTest;
+  ...
+};
+
+class FooTest : public ::testing::Test {
+ protected:
+  ...
+  T1 get_private_member1(Foo* obj) {
+    return obj->private_member1_;
+  }
+};
+
+TEST_F(FooTest, Test1) {
+  ...
+  get_private_member1(x)
+  ...
+}
+```
+  * If the methods are declared **protected**, you can change their access level in a test-only subclass:
+```
+class YourClass {
+  ...
+ protected: // protected access for testability.
+  int DoSomethingReturningInt();
+  ...
+};
+
+// in the your_class_test.cc file:
+class TestableYourClass : public YourClass {
+  ...
+ public: using YourClass::DoSomethingReturningInt; // changes access rights
+  ...
+};
+
+TEST_F(YourClassTest, DoSomethingTest) {
+  TestableYourClass obj;
+  assertEquals(expected_value, obj.DoSomethingReturningInt());
+}
+```
+
+## How do I test private class static members without writing FRIEND\_TEST()s? ##
+
+We find private static methods clutter the header file.  They are
+implementation details and ideally should be kept out of a .h. So often I make
+them free functions instead.
+
+Instead of:
+```
+// foo.h
+class Foo {
+  ...
+ private:
+  static bool Func(int n);
+};
+
+// foo.cc
+bool Foo::Func(int n) { ... }
+
+// foo_test.cc
+EXPECT_TRUE(Foo::Func(12345));
+```
+
+You probably should better write:
+```
+// foo.h
+class Foo {
+  ...
+};
+
+// foo.cc
+namespace internal {
+  bool Func(int n) { ... }
+}
+
+// foo_test.cc
+namespace internal {
+  bool Func(int n);
+}
+
+EXPECT_TRUE(internal::Func(12345));
+```
+
+## I would like to run a test several times with different parameters. Do I need to write several similar copies of it? ##
+
+No. You can use a feature called [value-parameterized tests](V1_6_AdvancedGuide.md#Value_Parameterized_Tests) which
+lets you repeat your tests with different parameters, without defining it more than once.
+
+## How do I test a file that defines main()? ##
+
+To test a `foo.cc` file, you need to compile and link it into your unit test
+program. However, when the file contains a definition for the `main()`
+function, it will clash with the `main()` of your unit test, and will result in
+a build error.
+
+The right solution is to split it into three files:
+  1. `foo.h` which contains the declarations,
+  1. `foo.cc` which contains the definitions except `main()`, and
+  1. `foo_main.cc` which contains nothing but the definition of `main()`.
+
+Then `foo.cc` can be easily tested.
+
+If you are adding tests to an existing file and don't want an intrusive change
+like this, there is a hack: just include the entire `foo.cc` file in your unit
+test. For example:
+```
+// File foo_unittest.cc
+
+// The headers section
+...
+
+// Renames main() in foo.cc to make room for the unit test main()
+#define main FooMain
+
+#include "a/b/foo.cc"
+
+// The tests start here.
+...
+```
+
+
+However, please remember this is a hack and should only be used as the last
+resort.
+
+## What can the statement argument in ASSERT\_DEATH() be? ##
+
+`ASSERT_DEATH(_statement_, _regex_)` (or any death assertion macro) can be used
+wherever `_statement_` is valid. So basically `_statement_` can be any C++
+statement that makes sense in the current context. In particular, it can
+reference global and/or local variables, and can be:
+  * a simple function call (often the case),
+  * a complex expression, or
+  * a compound statement.
+
+> Some examples are shown here:
+
+```
+// A death test can be a simple function call.
+TEST(MyDeathTest, FunctionCall) {
+  ASSERT_DEATH(Xyz(5), "Xyz failed");
+}
+
+// Or a complex expression that references variables and functions.
+TEST(MyDeathTest, ComplexExpression) {
+  const bool c = Condition();
+  ASSERT_DEATH((c ? Func1(0) : object2.Method("test")),
+               "(Func1|Method) failed");
+}
+
+// Death assertions can be used any where in a function. In
+// particular, they can be inside a loop.
+TEST(MyDeathTest, InsideLoop) {
+  // Verifies that Foo(0), Foo(1), ..., and Foo(4) all die.
+  for (int i = 0; i < 5; i++) {
+    EXPECT_DEATH_M(Foo(i), "Foo has \\d+ errors",
+                   ::testing::Message() << "where i is " << i);
+  }
+}
+
+// A death assertion can contain a compound statement.
+TEST(MyDeathTest, CompoundStatement) {
+  // Verifies that at lease one of Bar(0), Bar(1), ..., and
+  // Bar(4) dies.
+  ASSERT_DEATH({
+    for (int i = 0; i < 5; i++) {
+      Bar(i);
+    }
+  },
+  "Bar has \\d+ errors");}
+```
+
+`googletest_unittest.cc` contains more examples if you are interested.
+
+## What syntax does the regular expression in ASSERT\_DEATH use? ##
+
+On POSIX systems, Google Test uses the POSIX Extended regular
+expression syntax
+(http://en.wikipedia.org/wiki/Regular_expression#POSIX_Extended_Regular_Expressions).
+On Windows, it uses a limited variant of regular expression
+syntax. For more details, see the
+[regular expression syntax](V1_6_AdvancedGuide.md#Regular_Expression_Syntax).
+
+## I have a fixture class Foo, but TEST\_F(Foo, Bar) gives me error "no matching function for call to Foo::Foo()". Why? ##
+
+Google Test needs to be able to create objects of your test fixture class, so
+it must have a default constructor. Normally the compiler will define one for
+you. However, there are cases where you have to define your own:
+  * If you explicitly declare a non-default constructor for class `Foo`, then you need to define a default constructor, even if it would be empty.
+  * If `Foo` has a const non-static data member, then you have to define the default constructor _and_ initialize the const member in the initializer list of the constructor. (Early versions of `gcc` doesn't force you to initialize the const member. It's a bug that has been fixed in `gcc 4`.)
+
+## Why does ASSERT\_DEATH complain about previous threads that were already joined? ##
+
+With the Linux pthread library, there is no turning back once you cross the
+line from single thread to multiple threads. The first time you create a
+thread, a manager thread is created in addition, so you get 3, not 2, threads.
+Later when the thread you create joins the main thread, the thread count
+decrements by 1, but the manager thread will never be killed, so you still have
+2 threads, which means you cannot safely run a death test.
+
+The new NPTL thread library doesn't suffer from this problem, as it doesn't
+create a manager thread. However, if you don't control which machine your test
+runs on, you shouldn't depend on this.
+
+## Why does Google Test require the entire test case, instead of individual tests, to be named FOODeathTest when it uses ASSERT\_DEATH? ##
+
+Google Test does not interleave tests from different test cases. That is, it
+runs all tests in one test case first, and then runs all tests in the next test
+case, and so on. Google Test does this because it needs to set up a test case
+before the first test in it is run, and tear it down afterwords. Splitting up
+the test case would require multiple set-up and tear-down processes, which is
+inefficient and makes the semantics unclean.
+
+If we were to determine the order of tests based on test name instead of test
+case name, then we would have a problem with the following situation:
+
+```
+TEST_F(FooTest, AbcDeathTest) { ... }
+TEST_F(FooTest, Uvw) { ... }
+
+TEST_F(BarTest, DefDeathTest) { ... }
+TEST_F(BarTest, Xyz) { ... }
+```
+
+Since `FooTest.AbcDeathTest` needs to run before `BarTest.Xyz`, and we don't
+interleave tests from different test cases, we need to run all tests in the
+`FooTest` case before running any test in the `BarTest` case. This contradicts
+with the requirement to run `BarTest.DefDeathTest` before `FooTest.Uvw`.
+
+## But I don't like calling my entire test case FOODeathTest when it contains both death tests and non-death tests. What do I do? ##
+
+You don't have to, but if you like, you may split up the test case into
+`FooTest` and `FooDeathTest`, where the names make it clear that they are
+related:
+
+```
+class FooTest : public ::testing::Test { ... };
+
+TEST_F(FooTest, Abc) { ... }
+TEST_F(FooTest, Def) { ... }
+
+typedef FooTest FooDeathTest;
+
+TEST_F(FooDeathTest, Uvw) { ... EXPECT_DEATH(...) ... }
+TEST_F(FooDeathTest, Xyz) { ... ASSERT_DEATH(...) ... }
+```
+
+## The compiler complains about "no match for 'operator<<'" when I use an assertion. What gives? ##
+
+If you use a user-defined type `FooType` in an assertion, you must make sure
+there is an `std::ostream& operator<<(std::ostream&, const FooType&)` function
+defined such that we can print a value of `FooType`.
+
+In addition, if `FooType` is declared in a name space, the `<<` operator also
+needs to be defined in the _same_ name space.
+
+## How do I suppress the memory leak messages on Windows? ##
+
+Since the statically initialized Google Test singleton requires allocations on
+the heap, the Visual C++ memory leak detector will report memory leaks at the
+end of the program run. The easiest way to avoid this is to use the
+`_CrtMemCheckpoint` and `_CrtMemDumpAllObjectsSince` calls to not report any
+statically initialized heap objects. See MSDN for more details and additional
+heap check/debug routines.
+
+## I am building my project with Google Test in Visual Studio and all I'm getting is a bunch of linker errors (or warnings). Help! ##
+
+You may get a number of the following linker error or warnings if you
+attempt to link your test project with the Google Test library when
+your project and the are not built using the same compiler settings.
+
+  * LNK2005: symbol already defined in object
+  * LNK4217: locally defined symbol 'symbol' imported in function 'function'
+  * LNK4049: locally defined symbol 'symbol' imported
+
+The Google Test project (gtest.vcproj) has the Runtime Library option
+set to /MT (use multi-threaded static libraries, /MTd for debug). If
+your project uses something else, for example /MD (use multi-threaded
+DLLs, /MDd for debug), you need to change the setting in the Google
+Test project to match your project's.
+
+To update this setting open the project properties in the Visual
+Studio IDE then select the branch Configuration Properties | C/C++ |
+Code Generation and change the option "Runtime Library".  You may also try
+using gtest-md.vcproj instead of gtest.vcproj.
+
+## I put my tests in a library and Google Test doesn't run them. What's happening? ##
+Have you read a
+[warning](V1_6_Primer.md#important-note-for-visual-c-users) on
+the Google Test Primer page?
+
+## I want to use Google Test with Visual Studio but don't know where to start. ##
+Many people are in your position and one of the posted his solution to
+our mailing list. Here is his link:
+http://hassanjamilahmad.blogspot.com/2009/07/gtest-starters-help.html.
+
+## I am seeing compile errors mentioning std::type\_traits when I try to use Google Test on Solaris. ##
+Google Test uses parts of the standard C++ library that SunStudio does not support.
+Our users reported success using alternative implementations. Try running the build after runing this commad:
+
+`export CC=cc CXX=CC CXXFLAGS='-library=stlport4'`
+
+## How can my code detect if it is running in a test? ##
+
+If you write code that sniffs whether it's running in a test and does
+different things accordingly, you are leaking test-only logic into
+production code and there is no easy way to ensure that the test-only
+code paths aren't run by mistake in production.  Such cleverness also
+leads to
+[Heisenbugs](http://en.wikipedia.org/wiki/Unusual_software_bug#Heisenbug).
+Therefore we strongly advise against the practice, and Google Test doesn't
+provide a way to do it.
+
+In general, the recommended way to cause the code to behave
+differently under test is [dependency injection](http://jamesshore.com/Blog/Dependency-Injection-Demystified.html).
+You can inject different functionality from the test and from the
+production code.  Since your production code doesn't link in the
+for-test logic at all, there is no danger in accidentally running it.
+
+However, if you _really_, _really_, _really_ have no choice, and if
+you follow the rule of ending your test program names with `_test`,
+you can use the _horrible_ hack of sniffing your executable name
+(`argv[0]` in `main()`) to know whether the code is under test.
+
+## Google Test defines a macro that clashes with one defined by another library. How do I deal with that? ##
+
+In C++, macros don't obey namespaces.  Therefore two libraries that
+both define a macro of the same name will clash if you `#include` both
+definitions.  In case a Google Test macro clashes with another
+library, you can force Google Test to rename its macro to avoid the
+conflict.
+
+Specifically, if both Google Test and some other code define macro
+`FOO`, you can add
+```
+  -DGTEST_DONT_DEFINE_FOO=1
+```
+to the compiler flags to tell Google Test to change the macro's name
+from `FOO` to `GTEST_FOO`. For example, with `-DGTEST_DONT_DEFINE_TEST=1`, you'll need to write
+```
+  GTEST_TEST(SomeTest, DoesThis) { ... }
+```
+instead of
+```
+  TEST(SomeTest, DoesThis) { ... }
+```
+in order to define a test.
+
+Currently, the following `TEST`, `FAIL`, `SUCCEED`, and the basic comparison assertion macros can have alternative names. You can see the full list of covered macros [here](http://www.google.com/codesearch?q=if+!GTEST_DONT_DEFINE_\w%2B+package:http://googletest\.googlecode\.com+file:/include/gtest/gtest.h). More information can be found in the "Avoiding Macro Name Clashes" section of the README file.
+
+## My question is not covered in your FAQ! ##
+
+If you cannot find the answer to your question in this FAQ, there are
+some other resources you can use:
+
+  1. read other [wiki pages](http://code.google.com/p/googletest/w/list),
+  1. search the mailing list [archive](http://groups.google.com/group/googletestframework/topics),
+  1. ask it on [googletestframework@googlegroups.com](mailto:googletestframework@googlegroups.com) and someone will answer it (to prevent spam, we require you to join the [discussion group](http://groups.google.com/group/googletestframework) before you can post.).
+
+Please note that creating an issue in the
+[issue tracker](http://code.google.com/p/googletest/issues/list) is _not_
+a good way to get your answer, as it is monitored infrequently by a
+very small number of people.
+
+When asking a question, it's helpful to provide as much of the
+following information as possible (people cannot help you if there's
+not enough information in your question):
+
+  * the version (or the revision number if you check out from SVN directly) of Google Test you use (Google Test is under active development, so it's possible that your problem has been solved in a later version),
+  * your operating system,
+  * the name and version of your compiler,
+  * the complete command line flags you give to your compiler,
+  * the complete compiler error messages (if the question is about compilation),
+  * the _actual_ code (ideally, a minimal but complete program) that has the problem you encounter.
diff --git a/docs/V1_6_Primer.md b/docs/V1_6_Primer.md
new file mode 100755 (executable)
index 0000000..8d840ef
--- /dev/null
@@ -0,0 +1,501 @@
+
+
+# Introduction: Why Google C++ Testing Framework? #
+
+_Google C++ Testing Framework_ helps you write better C++ tests.
+
+No matter whether you work on Linux, Windows, or a Mac, if you write C++ code,
+Google Test can help you.
+
+So what makes a good test, and how does Google C++ Testing Framework fit in? We believe:
+  1. Tests should be _independent_ and _repeatable_. It's a pain to debug a test that succeeds or fails as a result of other tests.  Google C++ Testing Framework isolates the tests by running each of them on a different object. When a test fails, Google C++ Testing Framework allows you to run it in isolation for quick debugging.
+  1. Tests should be well _organized_ and reflect the structure of the tested code.  Google C++ Testing Framework groups related tests into test cases that can share data and subroutines. This common pattern is easy to recognize and makes tests easy to maintain. Such consistency is especially helpful when people switch projects and start to work on a new code base.
+  1. Tests should be _portable_ and _reusable_. The open-source community has a lot of code that is platform-neutral, its tests should also be platform-neutral.  Google C++ Testing Framework works on different OSes, with different compilers (gcc, MSVC, and others), with or without exceptions, so Google C++ Testing Framework tests can easily work with a variety of configurations.  (Note that the current release only contains build scripts for Linux - we are actively working on scripts for other platforms.)
+  1. When tests fail, they should provide as much _information_ about the problem as possible. Google C++ Testing Framework doesn't stop at the first test failure. Instead, it only stops the current test and continues with the next. You can also set up tests that report non-fatal failures after which the current test continues. Thus, you can detect and fix multiple bugs in a single run-edit-compile cycle.
+  1. The testing framework should liberate test writers from housekeeping chores and let them focus on the test _content_.  Google C++ Testing Framework automatically keeps track of all tests defined, and doesn't require the user to enumerate them in order to run them.
+  1. Tests should be _fast_. With Google C++ Testing Framework, you can reuse shared resources across tests and pay for the set-up/tear-down only once, without making tests depend on each other.
+
+Since Google C++ Testing Framework is based on the popular xUnit
+architecture, you'll feel right at home if you've used JUnit or PyUnit before.
+If not, it will take you about 10 minutes to learn the basics and get started.
+So let's go!
+
+_Note:_ We sometimes refer to Google C++ Testing Framework informally
+as _Google Test_.
+
+# Setting up a New Test Project #
+
+To write a test program using Google Test, you need to compile Google
+Test into a library and link your test with it.  We provide build
+files for some popular build systems: `msvc/` for Visual Studio,
+`xcode/` for Mac Xcode, `make/` for GNU make, `codegear/` for Borland
+C++ Builder, and the autotools script (deprecated) and
+`CMakeLists.txt` for CMake (recommended) in the Google Test root
+directory.  If your build system is not on this list, you can take a
+look at `make/Makefile` to learn how Google Test should be compiled
+(basically you want to compile `src/gtest-all.cc` with `GTEST_ROOT`
+and `GTEST_ROOT/include` in the header search path, where `GTEST_ROOT`
+is the Google Test root directory).
+
+Once you are able to compile the Google Test library, you should
+create a project or build target for your test program.  Make sure you
+have `GTEST_ROOT/include` in the header search path so that the
+compiler can find `"gtest/gtest.h"` when compiling your test.  Set up
+your test project to link with the Google Test library (for example,
+in Visual Studio, this is done by adding a dependency on
+`gtest.vcproj`).
+
+If you still have questions, take a look at how Google Test's own
+tests are built and use them as examples.
+
+# Basic Concepts #
+
+When using Google Test, you start by writing _assertions_, which are statements
+that check whether a condition is true. An assertion's result can be _success_,
+_nonfatal failure_, or _fatal failure_. If a fatal failure occurs, it aborts
+the current function; otherwise the program continues normally.
+
+_Tests_ use assertions to verify the tested code's behavior. If a test crashes
+or has a failed assertion, then it _fails_; otherwise it _succeeds_.
+
+A _test case_ contains one or many tests. You should group your tests into test
+cases that reflect the structure of the tested code. When multiple tests in a
+test case need to share common objects and subroutines, you can put them into a
+_test fixture_ class.
+
+A _test program_ can contain multiple test cases.
+
+We'll now explain how to write a test program, starting at the individual
+assertion level and building up to tests and test cases.
+
+# Assertions #
+
+Google Test assertions are macros that resemble function calls. You test a
+class or function by making assertions about its behavior. When an assertion
+fails, Google Test prints the assertion's source file and line number location,
+along with a failure message. You may also supply a custom failure message
+which will be appended to Google Test's message.
+
+The assertions come in pairs that test the same thing but have different
+effects on the current function. `ASSERT_*` versions generate fatal failures
+when they fail, and **abort the current function**. `EXPECT_*` versions generate
+nonfatal failures, which don't abort the current function. Usually `EXPECT_*`
+are preferred, as they allow more than one failures to be reported in a test.
+However, you should use `ASSERT_*` if it doesn't make sense to continue when
+the assertion in question fails.
+
+Since a failed `ASSERT_*` returns from the current function immediately,
+possibly skipping clean-up code that comes after it, it may cause a space leak.
+Depending on the nature of the leak, it may or may not be worth fixing - so
+keep this in mind if you get a heap checker error in addition to assertion
+errors.
+
+To provide a custom failure message, simply stream it into the macro using the
+`<<` operator, or a sequence of such operators. An example:
+```
+ASSERT_EQ(x.size(), y.size()) << "Vectors x and y are of unequal length";
+
+for (int i = 0; i < x.size(); ++i) {
+  EXPECT_EQ(x[i], y[i]) << "Vectors x and y differ at index " << i;
+}
+```
+
+Anything that can be streamed to an `ostream` can be streamed to an assertion
+macro--in particular, C strings and `string` objects. If a wide string
+(`wchar_t*`, `TCHAR*` in `UNICODE` mode on Windows, or `std::wstring`) is
+streamed to an assertion, it will be translated to UTF-8 when printed.
+
+## Basic Assertions ##
+
+These assertions do basic true/false condition testing.
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_TRUE(`_condition_`)`;  | `EXPECT_TRUE(`_condition_`)`;   | _condition_ is true |
+| `ASSERT_FALSE(`_condition_`)`; | `EXPECT_FALSE(`_condition_`)`;  | _condition_ is false |
+
+Remember, when they fail, `ASSERT_*` yields a fatal failure and
+returns from the current function, while `EXPECT_*` yields a nonfatal
+failure, allowing the function to continue running. In either case, an
+assertion failure means its containing test fails.
+
+_Availability_: Linux, Windows, Mac.
+
+## Binary Comparison ##
+
+This section describes assertions that compare two values.
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+|`ASSERT_EQ(`_expected_`, `_actual_`);`|`EXPECT_EQ(`_expected_`, `_actual_`);`| _expected_ `==` _actual_ |
+|`ASSERT_NE(`_val1_`, `_val2_`);`      |`EXPECT_NE(`_val1_`, `_val2_`);`      | _val1_ `!=` _val2_ |
+|`ASSERT_LT(`_val1_`, `_val2_`);`      |`EXPECT_LT(`_val1_`, `_val2_`);`      | _val1_ `<` _val2_ |
+|`ASSERT_LE(`_val1_`, `_val2_`);`      |`EXPECT_LE(`_val1_`, `_val2_`);`      | _val1_ `<=` _val2_ |
+|`ASSERT_GT(`_val1_`, `_val2_`);`      |`EXPECT_GT(`_val1_`, `_val2_`);`      | _val1_ `>` _val2_ |
+|`ASSERT_GE(`_val1_`, `_val2_`);`      |`EXPECT_GE(`_val1_`, `_val2_`);`      | _val1_ `>=` _val2_ |
+
+In the event of a failure, Google Test prints both _val1_ and _val2_
+. In `ASSERT_EQ*` and `EXPECT_EQ*` (and all other equality assertions
+we'll introduce later), you should put the expression you want to test
+in the position of _actual_, and put its expected value in _expected_,
+as Google Test's failure messages are optimized for this convention.
+
+Value arguments must be comparable by the assertion's comparison
+operator or you'll get a compiler error.  We used to require the
+arguments to support the `<<` operator for streaming to an `ostream`,
+but it's no longer necessary since v1.6.0 (if `<<` is supported, it
+will be called to print the arguments when the assertion fails;
+otherwise Google Test will attempt to print them in the best way it
+can. For more details and how to customize the printing of the
+arguments, see this Google Mock [recipe](../../googlemock/docs/CookBook.md#teaching-google-mock-how-to-print-your-values).).
+
+These assertions can work with a user-defined type, but only if you define the
+corresponding comparison operator (e.g. `==`, `<`, etc).  If the corresponding
+operator is defined, prefer using the `ASSERT_*()` macros because they will
+print out not only the result of the comparison, but the two operands as well.
+
+Arguments are always evaluated exactly once. Therefore, it's OK for the
+arguments to have side effects. However, as with any ordinary C/C++ function,
+the arguments' evaluation order is undefined (i.e. the compiler is free to
+choose any order) and your code should not depend on any particular argument
+evaluation order.
+
+`ASSERT_EQ()` does pointer equality on pointers. If used on two C strings, it
+tests if they are in the same memory location, not if they have the same value.
+Therefore, if you want to compare C strings (e.g. `const char*`) by value, use
+`ASSERT_STREQ()` , which will be described later on. In particular, to assert
+that a C string is `NULL`, use `ASSERT_STREQ(NULL, c_string)` . However, to
+compare two `string` objects, you should use `ASSERT_EQ`.
+
+Macros in this section work with both narrow and wide string objects (`string`
+and `wstring`).
+
+_Availability_: Linux, Windows, Mac.
+
+## String Comparison ##
+
+The assertions in this group compare two **C strings**. If you want to compare
+two `string` objects, use `EXPECT_EQ`, `EXPECT_NE`, and etc instead.
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_STREQ(`_expected\_str_`, `_actual\_str_`);`    | `EXPECT_STREQ(`_expected\_str_`, `_actual\_str_`);`     | the two C strings have the same content |
+| `ASSERT_STRNE(`_str1_`, `_str2_`);`    | `EXPECT_STRNE(`_str1_`, `_str2_`);`     | the two C strings have different content |
+| `ASSERT_STRCASEEQ(`_expected\_str_`, `_actual\_str_`);`| `EXPECT_STRCASEEQ(`_expected\_str_`, `_actual\_str_`);` | the two C strings have the same content, ignoring case |
+| `ASSERT_STRCASENE(`_str1_`, `_str2_`);`| `EXPECT_STRCASENE(`_str1_`, `_str2_`);` | the two C strings have different content, ignoring case |
+
+Note that "CASE" in an assertion name means that case is ignored.
+
+`*STREQ*` and `*STRNE*` also accept wide C strings (`wchar_t*`). If a
+comparison of two wide strings fails, their values will be printed as UTF-8
+narrow strings.
+
+A `NULL` pointer and an empty string are considered _different_.
+
+_Availability_: Linux, Windows, Mac.
+
+See also: For more string comparison tricks (substring, prefix, suffix, and
+regular expression matching, for example), see the [Advanced Google Test Guide](V1_6_AdvancedGuide.md).
+
+# Simple Tests #
+
+To create a test:
+  1. Use the `TEST()` macro to define and name a test function, These are ordinary C++ functions that don't return a value.
+  1. In this function, along with any valid C++ statements you want to include, use the various Google Test assertions to check values.
+  1. The test's result is determined by the assertions; if any assertion in the test fails (either fatally or non-fatally), or if the test crashes, the entire test fails. Otherwise, it succeeds.
+
+```
+TEST(test_case_name, test_name) {
+ ... test body ...
+}
+```
+
+
+`TEST()` arguments go from general to specific. The _first_ argument is the
+name of the test case, and the _second_ argument is the test's name within the
+test case. Both names must be valid C++ identifiers, and they should not contain underscore (`_`). A test's _full name_ consists of its containing test case and its
+individual name. Tests from different test cases can have the same individual
+name.
+
+For example, let's take a simple integer function:
+```
+int Factorial(int n); // Returns the factorial of n
+```
+
+A test case for this function might look like:
+```
+// Tests factorial of 0.
+TEST(FactorialTest, HandlesZeroInput) {
+  EXPECT_EQ(1, Factorial(0));
+}
+
+// Tests factorial of positive numbers.
+TEST(FactorialTest, HandlesPositiveInput) {
+  EXPECT_EQ(1, Factorial(1));
+  EXPECT_EQ(2, Factorial(2));
+  EXPECT_EQ(6, Factorial(3));
+  EXPECT_EQ(40320, Factorial(8));
+}
+```
+
+Google Test groups the test results by test cases, so logically-related tests
+should be in the same test case; in other words, the first argument to their
+`TEST()` should be the same. In the above example, we have two tests,
+`HandlesZeroInput` and `HandlesPositiveInput`, that belong to the same test
+case `FactorialTest`.
+
+_Availability_: Linux, Windows, Mac.
+
+# Test Fixtures: Using the Same Data Configuration for Multiple Tests #
+
+If you find yourself writing two or more tests that operate on similar data,
+you can use a _test fixture_. It allows you to reuse the same configuration of
+objects for several different tests.
+
+To create a fixture, just:
+  1. Derive a class from `::testing::Test` . Start its body with `protected:` or `public:` as we'll want to access fixture members from sub-classes.
+  1. Inside the class, declare any objects you plan to use.
+  1. If necessary, write a default constructor or `SetUp()` function to prepare the objects for each test. A common mistake is to spell `SetUp()` as `Setup()` with a small `u` - don't let that happen to you.
+  1. If necessary, write a destructor or `TearDown()` function to release any resources you allocated in `SetUp()` . To learn when you should use the constructor/destructor and when you should use `SetUp()/TearDown()`, read this [FAQ entry](V1_6_FAQ.md#should-i-use-the-constructordestructor-of-the-test-fixture-or-the-set-uptear-down-function).
+  1. If needed, define subroutines for your tests to share.
+
+When using a fixture, use `TEST_F()` instead of `TEST()` as it allows you to
+access objects and subroutines in the test fixture:
+```
+TEST_F(test_case_name, test_name) {
+ ... test body ...
+}
+```
+
+Like `TEST()`, the first argument is the test case name, but for `TEST_F()`
+this must be the name of the test fixture class. You've probably guessed: `_F`
+is for fixture.
+
+Unfortunately, the C++ macro system does not allow us to create a single macro
+that can handle both types of tests. Using the wrong macro causes a compiler
+error.
+
+Also, you must first define a test fixture class before using it in a
+`TEST_F()`, or you'll get the compiler error "`virtual outside class
+declaration`".
+
+For each test defined with `TEST_F()`, Google Test will:
+  1. Create a _fresh_ test fixture at runtime
+  1. Immediately initialize it via `SetUp()` ,
+  1. Run the test
+  1. Clean up by calling `TearDown()`
+  1. Delete the test fixture.  Note that different tests in the same test case have different test fixture objects, and Google Test always deletes a test fixture before it creates the next one. Google Test does not reuse the same test fixture for multiple tests. Any changes one test makes to the fixture do not affect other tests.
+
+As an example, let's write tests for a FIFO queue class named `Queue`, which
+has the following interface:
+```
+template <typename E> // E is the element type.
+class Queue {
+ public:
+  Queue();
+  void Enqueue(const E& element);
+  E* Dequeue(); // Returns NULL if the queue is empty.
+  size_t size() const;
+  ...
+};
+```
+
+First, define a fixture class. By convention, you should give it the name
+`FooTest` where `Foo` is the class being tested.
+```
+class QueueTest : public ::testing::Test {
+ protected:
+  virtual void SetUp() {
+    q1_.Enqueue(1);
+    q2_.Enqueue(2);
+    q2_.Enqueue(3);
+  }
+
+  // virtual void TearDown() {}
+
+  Queue<int> q0_;
+  Queue<int> q1_;
+  Queue<int> q2_;
+};
+```
+
+In this case, `TearDown()` is not needed since we don't have to clean up after
+each test, other than what's already done by the destructor.
+
+Now we'll write tests using `TEST_F()` and this fixture.
+```
+TEST_F(QueueTest, IsEmptyInitially) {
+  EXPECT_EQ(0, q0_.size());
+}
+
+TEST_F(QueueTest, DequeueWorks) {
+  int* n = q0_.Dequeue();
+  EXPECT_EQ(NULL, n);
+
+  n = q1_.Dequeue();
+  ASSERT_TRUE(n != NULL);
+  EXPECT_EQ(1, *n);
+  EXPECT_EQ(0, q1_.size());
+  delete n;
+
+  n = q2_.Dequeue();
+  ASSERT_TRUE(n != NULL);
+  EXPECT_EQ(2, *n);
+  EXPECT_EQ(1, q2_.size());
+  delete n;
+}
+```
+
+The above uses both `ASSERT_*` and `EXPECT_*` assertions. The rule of thumb is
+to use `EXPECT_*` when you want the test to continue to reveal more errors
+after the assertion failure, and use `ASSERT_*` when continuing after failure
+doesn't make sense. For example, the second assertion in the `Dequeue` test is
+`ASSERT_TRUE(n != NULL)`, as we need to dereference the pointer `n` later,
+which would lead to a segfault when `n` is `NULL`.
+
+When these tests run, the following happens:
+  1. Google Test constructs a `QueueTest` object (let's call it `t1` ).
+  1. `t1.SetUp()` initializes `t1` .
+  1. The first test ( `IsEmptyInitially` ) runs on `t1` .
+  1. `t1.TearDown()` cleans up after the test finishes.
+  1. `t1` is destructed.
+  1. The above steps are repeated on another `QueueTest` object, this time running the `DequeueWorks` test.
+
+_Availability_: Linux, Windows, Mac.
+
+_Note_: Google Test automatically saves all _Google Test_ flags when a test
+object is constructed, and restores them when it is destructed.
+
+# Invoking the Tests #
+
+`TEST()` and `TEST_F()` implicitly register their tests with Google Test. So, unlike with many other C++ testing frameworks, you don't have to re-list all your defined tests in order to run them.
+
+After defining your tests, you can run them with `RUN_ALL_TESTS()` , which returns `0` if all the tests are successful, or `1` otherwise. Note that `RUN_ALL_TESTS()` runs _all tests_ in your link unit -- they can be from different test cases, or even different source files.
+
+When invoked, the `RUN_ALL_TESTS()` macro:
+  1. Saves the state of all  Google Test flags.
+  1. Creates a test fixture object for the first test.
+  1. Initializes it via `SetUp()`.
+  1. Runs the test on the fixture object.
+  1. Cleans up the fixture via `TearDown()`.
+  1. Deletes the fixture.
+  1. Restores the state of all Google Test flags.
+  1. Repeats the above steps for the next test, until all tests have run.
+
+In addition, if the text fixture's constructor generates a fatal failure in
+step 2, there is no point for step 3 - 5 and they are thus skipped. Similarly,
+if step 3 generates a fatal failure, step 4 will be skipped.
+
+_Important_: You must not ignore the return value of `RUN_ALL_TESTS()`, or `gcc`
+will give you a compiler error. The rationale for this design is that the
+automated testing service determines whether a test has passed based on its
+exit code, not on its stdout/stderr output; thus your `main()` function must
+return the value of `RUN_ALL_TESTS()`.
+
+Also, you should call `RUN_ALL_TESTS()` only **once**. Calling it more than once
+conflicts with some advanced Google Test features (e.g. thread-safe death
+tests) and thus is not supported.
+
+_Availability_: Linux, Windows, Mac.
+
+# Writing the main() Function #
+
+You can start from this boilerplate:
+```
+#include "this/package/foo.h"
+#include "gtest/gtest.h"
+
+namespace {
+
+// The fixture for testing class Foo.
+class FooTest : public ::testing::Test {
+ protected:
+  // You can remove any or all of the following functions if its body
+  // is empty.
+
+  FooTest() {
+    // You can do set-up work for each test here.
+  }
+
+  virtual ~FooTest() {
+    // You can do clean-up work that doesn't throw exceptions here.
+  }
+
+  // If the constructor and destructor are not enough for setting up
+  // and cleaning up each test, you can define the following methods:
+
+  virtual void SetUp() {
+    // Code here will be called immediately after the constructor (right
+    // before each test).
+  }
+
+  virtual void TearDown() {
+    // Code here will be called immediately after each test (right
+    // before the destructor).
+  }
+
+  // Objects declared here can be used by all tests in the test case for Foo.
+};
+
+// Tests that the Foo::Bar() method does Abc.
+TEST_F(FooTest, MethodBarDoesAbc) {
+  const string input_filepath = "this/package/testdata/myinputfile.dat";
+  const string output_filepath = "this/package/testdata/myoutputfile.dat";
+  Foo f;
+  EXPECT_EQ(0, f.Bar(input_filepath, output_filepath));
+}
+
+// Tests that Foo does Xyz.
+TEST_F(FooTest, DoesXyz) {
+  // Exercises the Xyz feature of Foo.
+}
+
+}  // namespace
+
+int main(int argc, char **argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  return RUN_ALL_TESTS();
+}
+```
+
+The `::testing::InitGoogleTest()` function parses the command line for Google
+Test flags, and removes all recognized flags. This allows the user to control a
+test program's behavior via various flags, which we'll cover in [AdvancedGuide](V1_6_AdvancedGuide.md).
+You must call this function before calling `RUN_ALL_TESTS()`, or the flags
+won't be properly initialized.
+
+On Windows, `InitGoogleTest()` also works with wide strings, so it can be used
+in programs compiled in `UNICODE` mode as well.
+
+But maybe you think that writing all those main() functions is too much work? We agree with you completely and that's why Google Test provides a basic implementation of main(). If it fits your needs, then just link your test with gtest\_main library and you are good to go.
+
+## Important note for Visual C++ users ##
+If you put your tests into a library and your `main()` function is in a different library or in your .exe file, those tests will not run. The reason is a [bug](https://connect.microsoft.com/feedback/viewfeedback.aspx?FeedbackID=244410&siteid=210) in Visual C++. When you define your tests, Google Test creates certain static objects to register them. These objects are not referenced from elsewhere but their constructors are still supposed to run. When Visual C++ linker sees that nothing in the library is referenced from other places it throws the library out. You have to reference your library with tests from your main program to keep the linker from discarding it. Here is how to do it. Somewhere in your library code declare a function:
+```
+__declspec(dllexport) int PullInMyLibrary() { return 0; }
+```
+If you put your tests in a static library (not DLL) then `__declspec(dllexport)` is not required. Now, in your main program, write a code that invokes that function:
+```
+int PullInMyLibrary();
+static int dummy = PullInMyLibrary();
+```
+This will keep your tests referenced and will make them register themselves at startup.
+
+In addition, if you define your tests in a static library, add `/OPT:NOREF` to your main program linker options. If you use MSVC++ IDE, go to your .exe project properties/Configuration Properties/Linker/Optimization and set References setting to `Keep Unreferenced Data (/OPT:NOREF)`. This will keep Visual C++ linker from discarding individual symbols generated by your tests from the final executable.
+
+There is one more pitfall, though. If you use Google Test as a static library (that's how it is defined in gtest.vcproj) your tests must also reside in a static library. If you have to have them in a DLL, you _must_ change Google Test to build into a DLL as well. Otherwise your tests will not run correctly or will not run at all. The general conclusion here is: make your life easier - do not write your tests in libraries!
+
+# Where to Go from Here #
+
+Congratulations! You've learned the Google Test basics. You can start writing
+and running Google Test tests, read some [samples](V1_6_Samples.md), or continue with
+[AdvancedGuide](V1_6_AdvancedGuide.md), which describes many more useful Google Test features.
+
+# Known Limitations #
+
+Google Test is designed to be thread-safe.  The implementation is
+thread-safe on systems where the `pthreads` library is available.  It
+is currently _unsafe_ to use Google Test assertions from two threads
+concurrently on other systems (e.g. Windows).  In most tests this is
+not an issue as usually the assertions are done in the main thread. If
+you want to help, you can volunteer to implement the necessary
+synchronization primitives in `gtest-port.h` for your platform.
diff --git a/docs/V1_6_PumpManual.md b/docs/V1_6_PumpManual.md
new file mode 100755 (executable)
index 0000000..8184f15
--- /dev/null
@@ -0,0 +1,177 @@
+
+
+<b>P</b>ump is <b>U</b>seful for <b>M</b>eta <b>P</b>rogramming.
+
+# The Problem #
+
+Template and macro libraries often need to define many classes,
+functions, or macros that vary only (or almost only) in the number of
+arguments they take. It's a lot of repetitive, mechanical, and
+error-prone work.
+
+Variadic templates and variadic macros can alleviate the problem.
+However, while both are being considered by the C++ committee, neither
+is in the standard yet or widely supported by compilers.  Thus they
+are often not a good choice, especially when your code needs to be
+portable. And their capabilities are still limited.
+
+As a result, authors of such libraries often have to write scripts to
+generate their implementation. However, our experience is that it's
+tedious to write such scripts, which tend to reflect the structure of
+the generated code poorly and are often hard to read and edit. For
+example, a small change needed in the generated code may require some
+non-intuitive, non-trivial changes in the script. This is especially
+painful when experimenting with the code.
+
+# Our Solution #
+
+Pump (for Pump is Useful for Meta Programming, Pretty Useful for Meta
+Programming, or Practical Utility for Meta Programming, whichever you
+prefer) is a simple meta-programming tool for C++. The idea is that a
+programmer writes a `foo.pump` file which contains C++ code plus meta
+code that manipulates the C++ code. The meta code can handle
+iterations over a range, nested iterations, local meta variable
+definitions, simple arithmetic, and conditional expressions. You can
+view it as a small Domain-Specific Language. The meta language is
+designed to be non-intrusive (s.t. it won't confuse Emacs' C++ mode,
+for example) and concise, making Pump code intuitive and easy to
+maintain.
+
+## Highlights ##
+
+  * The implementation is in a single Python script and thus ultra portable: no build or installation is needed and it works cross platforms.
+  * Pump tries to be smart with respect to [Google's style guide](http://code.google.com/p/google-styleguide/): it breaks long lines (easy to have when they are generated) at acceptable places to fit within 80 columns and indent the continuation lines correctly.
+  * The format is human-readable and more concise than XML.
+  * The format works relatively well with Emacs' C++ mode.
+
+## Examples ##
+
+The following Pump code (where meta keywords start with `$`, `[[` and `]]` are meta brackets, and `$$` starts a meta comment that ends with the line):
+
+```
+$var n = 3     $$ Defines a meta variable n.
+$range i 0..n  $$ Declares the range of meta iterator i (inclusive).
+$for i [[
+               $$ Meta loop.
+// Foo$i does blah for $i-ary predicates.
+$range j 1..i
+template <size_t N $for j [[, typename A$j]]>
+class Foo$i {
+$if i == 0 [[
+  blah a;
+]] $elif i <= 2 [[
+  blah b;
+]] $else [[
+  blah c;
+]]
+};
+
+]]
+```
+
+will be translated by the Pump compiler to:
+
+```
+// Foo0 does blah for 0-ary predicates.
+template <size_t N>
+class Foo0 {
+  blah a;
+};
+
+// Foo1 does blah for 1-ary predicates.
+template <size_t N, typename A1>
+class Foo1 {
+  blah b;
+};
+
+// Foo2 does blah for 2-ary predicates.
+template <size_t N, typename A1, typename A2>
+class Foo2 {
+  blah b;
+};
+
+// Foo3 does blah for 3-ary predicates.
+template <size_t N, typename A1, typename A2, typename A3>
+class Foo3 {
+  blah c;
+};
+```
+
+In another example,
+
+```
+$range i 1..n
+Func($for i + [[a$i]]);
+$$ The text between i and [[ is the separator between iterations.
+```
+
+will generate one of the following lines (without the comments), depending on the value of `n`:
+
+```
+Func();              // If n is 0.
+Func(a1);            // If n is 1.
+Func(a1 + a2);       // If n is 2.
+Func(a1 + a2 + a3);  // If n is 3.
+// And so on...
+```
+
+## Constructs ##
+
+We support the following meta programming constructs:
+
+| `$var id = exp` | Defines a named constant value. `$id` is valid util the end of the current meta lexical block. |
+|:----------------|:-----------------------------------------------------------------------------------------------|
+| `$range id exp..exp` | Sets the range of an iteration variable, which can be reused in multiple loops later.          |
+| `$for id sep [[ code ]]` | Iteration. The range of `id` must have been defined earlier. `$id` is valid in `code`.         |
+| `$($)`          | Generates a single `$` character.                                                              |
+| `$id`           | Value of the named constant or iteration variable.                                             |
+| `$(exp)`        | Value of the expression.                                                                       |
+| `$if exp [[ code ]] else_branch` | Conditional.                                                                                   |
+| `[[ code ]]`    | Meta lexical block.                                                                            |
+| `cpp_code`      | Raw C++ code.                                                                                  |
+| `$$ comment`    | Meta comment.                                                                                  |
+
+**Note:** To give the user some freedom in formatting the Pump source
+code, Pump ignores a new-line character if it's right after `$for foo`
+or next to `[[` or `]]`. Without this rule you'll often be forced to write
+very long lines to get the desired output. Therefore sometimes you may
+need to insert an extra new-line in such places for a new-line to show
+up in your output.
+
+## Grammar ##
+
+```
+code ::= atomic_code*
+atomic_code ::= $var id = exp
+    | $var id = [[ code ]]
+    | $range id exp..exp
+    | $for id sep [[ code ]]
+    | $($)
+    | $id
+    | $(exp)
+    | $if exp [[ code ]] else_branch
+    | [[ code ]]
+    | cpp_code
+sep ::= cpp_code | empty_string
+else_branch ::= $else [[ code ]]
+    | $elif exp [[ code ]] else_branch
+    | empty_string
+exp ::= simple_expression_in_Python_syntax
+```
+
+## Code ##
+
+You can find the source code of Pump in [scripts/pump.py](../scripts/pump.py). It is still
+very unpolished and lacks automated tests, although it has been
+successfully used many times. If you find a chance to use it in your
+project, please let us know what you think!  We also welcome help on
+improving Pump.
+
+## Real Examples ##
+
+You can find real-world applications of Pump in [Google Test](http://www.google.com/codesearch?q=file%3A\.pump%24+package%3Ahttp%3A%2F%2Fgoogletest\.googlecode\.com) and [Google Mock](http://www.google.com/codesearch?q=file%3A\.pump%24+package%3Ahttp%3A%2F%2Fgooglemock\.googlecode\.com).  The source file `foo.h.pump` generates `foo.h`.
+
+## Tips ##
+
+  * If a meta variable is followed by a letter or digit, you can separate them using `[[]]`, which inserts an empty string. For example `Foo$j[[]]Helper` generate `Foo1Helper` when `j` is 1.
+  * To avoid extra-long Pump source lines, you can break a line anywhere you want by inserting `[[]]` followed by a new line. Since any new-line character next to `[[` or `]]` is ignored, the generated code won't contain this new line.
diff --git a/docs/V1_6_Samples.md b/docs/V1_6_Samples.md
new file mode 100755 (executable)
index 0000000..f21d200
--- /dev/null
@@ -0,0 +1,14 @@
+If you're like us, you'd like to look at some Google Test sample code.  The
+[samples folder](../samples) has a number of well-commented samples showing how to use a
+variety of Google Test features.
+
+  * [Sample #1](../samples/sample1_unittest.cc) shows the basic steps of using Google Test to test C++ functions.
+  * [Sample #2](../samples/sample2_unittest.cc) shows a more complex unit test for a class with multiple member functions.
+  * [Sample #3](../samples/sample3_unittest.cc) uses a test fixture.
+  * [Sample #4](../samples/sample4_unittest.cc) is another basic example of using Google Test.
+  * [Sample #5](../samples/sample5_unittest.cc) teaches how to reuse a test fixture in multiple test cases by deriving sub-fixtures from it.
+  * [Sample #6](../samples/sample6_unittest.cc) demonstrates type-parameterized tests.
+  * [Sample #7](../samples/sample7_unittest.cc) teaches the basics of value-parameterized tests.
+  * [Sample #8](../samples/sample8_unittest.cc) shows using `Combine()` in value-parameterized tests.
+  * [Sample #9](../samples/sample9_unittest.cc) shows use of the listener API to modify Google Test's console output and the use of its reflection API to inspect test results.
+  * [Sample #10](../samples/sample10_unittest.cc) shows use of the listener API to implement a primitive memory leak checker.
diff --git a/docs/V1_6_XcodeGuide.md b/docs/V1_6_XcodeGuide.md
new file mode 100755 (executable)
index 0000000..bf24bf5
--- /dev/null
@@ -0,0 +1,93 @@
+
+
+This guide will explain how to use the Google Testing Framework in your Xcode projects on Mac OS X. This tutorial begins by quickly explaining what to do for experienced users. After the quick start, the guide goes provides additional explanation about each step.
+
+# Quick Start #
+
+Here is the quick guide for using Google Test in your Xcode project.
+
+  1. Download the source from the [website](http://code.google.com/p/googletest) using this command: `svn checkout http://googletest.googlecode.com/svn/trunk/ googletest-read-only`
+  1. Open up the `gtest.xcodeproj` in the `googletest-read-only/xcode/` directory and build the gtest.framework.
+  1. Create a new "Shell Tool" target in your Xcode project called something like "UnitTests"
+  1. Add the gtest.framework to your project and add it to the "Link Binary with Libraries" build phase of "UnitTests"
+  1. Add your unit test source code to the "Compile Sources" build phase of "UnitTests"
+  1. Edit the "UnitTests" executable and add an environment variable named "DYLD\_FRAMEWORK\_PATH" with a value equal to the path to the framework containing the gtest.framework relative to the compiled executable.
+  1. Build and Go
+
+The following sections further explain each of the steps listed above in depth, describing in more detail how to complete it including some variations.
+
+# Get the Source #
+
+Currently, the gtest.framework discussed here isn't available in a tagged release of Google Test, it is only available in the trunk. As explained at the Google Test [site](http://code.google.com/p/googletest/source/checkout">svn), you can get the code from anonymous SVN with this command:
+
+```
+svn checkout http://googletest.googlecode.com/svn/trunk/ googletest-read-only
+```
+
+Alternatively, if you are working with Subversion in your own code base, you can add Google Test as an external dependency to your own Subversion repository. By following this approach, everyone that checks out your svn repository will also receive a copy of Google Test (a specific version, if you wish) without having to check it out explicitly. This makes the set up of your project simpler and reduces the copied code in the repository.
+
+To use `svn:externals`, decide where you would like to have the external source reside. You might choose to put the external source inside the trunk, because you want it to be part of the branch when you make a release. However, keeping it outside the trunk in a version-tagged directory called something like `third-party/googletest/1.0.1`, is another option. Once the location is established, use `svn propedit svn:externals _directory_` to set the svn:externals property on a directory in your repository. This directory won't contain the code, but be its versioned parent directory.
+
+The command `svn propedit` will bring up your Subversion editor, making editing the long, (potentially multi-line) property simpler. This same method can be used to check out a tagged branch, by using the appropriate URL (e.g. `http://googletest.googlecode.com/svn/tags/release-1.0.1`). Additionally, the svn:externals property allows the specification of a particular revision of the trunk with the `-r_##_` option (e.g. `externals/src/googletest -r60 http://googletest.googlecode.com/svn/trunk`).
+
+Here is an example of using the svn:externals properties on a trunk (read via `svn propget`) of a project. This value checks out a copy of Google Test into the `trunk/externals/src/googletest/` directory.
+
+```
+[Computer:svn] user$ svn propget svn:externals trunk
+externals/src/googletest http://googletest.googlecode.com/svn/trunk
+```
+
+# Add the Framework to Your Project #
+
+The next step is to build and add the gtest.framework to your own project. This guide describes two common ways below.
+
+  * **Option 1** --- The simplest way to add Google Test to your own project, is to open gtest.xcodeproj (found in the xcode/ directory of the Google Test trunk) and build the framework manually. Then, add the built framework into your project using the "Add->Existing Framework..." from the context menu or "Project->Add..." from the main menu. The gtest.framework is relocatable and contains the headers and object code that you'll need to make tests. This method requires rebuilding every time you upgrade Google Test in your project.
+  * **Option 2** --- If you are going to be living off the trunk of Google Test, incorporating its latest features into your unit tests (or are a Google Test developer yourself). You'll want to rebuild the framework every time the source updates. to do this, you'll need to add the gtest.xcodeproj file, not the framework itself, to your own Xcode project. Then, from the build products that are revealed by the project's disclosure triangle, you can find the gtest.framework, which can be added to your targets (discussed below).
+
+# Make a Test Target #
+
+To start writing tests, make a new "Shell Tool" target. This target template is available under BSD, Cocoa, or Carbon. Add your unit test source code to the "Compile Sources" build phase of the target.
+
+Next, you'll want to add gtest.framework in two different ways, depending upon which option you chose above.
+
+  * **Option 1** --- During compilation, Xcode will need to know that you are linking against the gtest.framework. Add the gtest.framework to the "Link Binary with Libraries" build phase of your test target. This will include the Google Test headers in your header search path, and will tell the linker where to find the library.
+  * **Option 2** --- If your working out of the trunk, you'll also want to add gtest.framework to your "Link Binary with Libraries" build phase of your test target. In addition, you'll  want to add the gtest.framework as a dependency to your unit test target. This way, Xcode will make sure that gtest.framework is up to date, every time your build your target. Finally, if you don't share build directories with Google Test, you'll have to copy the gtest.framework into your own build products directory using a "Run Script" build phase.
+
+# Set Up the Executable Run Environment #
+
+Since the unit test executable is a shell tool, it doesn't have a bundle with a `Contents/Frameworks` directory, in which to place gtest.framework. Instead, the dynamic linker must be told at runtime to search for the framework in another location. This can be accomplished by setting the "DYLD\_FRAMEWORK\_PATH" environment variable in the "Edit Active Executable ..." Arguments tab, under "Variables to be set in the environment:". The path for this value is the path (relative or absolute) of the directory containing the gtest.framework.
+
+If you haven't set up the DYLD\_FRAMEWORK\_PATH, correctly, you might get a message like this:
+
+```
+[Session started at 2008-08-15 06:23:57 -0600.]
+  dyld: Library not loaded: @loader_path/../Frameworks/gtest.framework/Versions/A/gtest
+    Referenced from: /Users/username/Documents/Sandbox/gtestSample/build/Debug/WidgetFrameworkTest
+    Reason: image not found
+```
+
+To correct this problem, got to the directory containing the executable named in "Referenced from:" value in the error message above. Then, with the terminal in this location, find the relative path to the directory containing the gtest.framework. That is the value you'll need to set as the DYLD\_FRAMEWORK\_PATH.
+
+# Build and Go #
+
+Now, when you click "Build and Go", the test will be executed. Dumping out something like this:
+
+```
+[Session started at 2008-08-06 06:36:13 -0600.]
+[==========] Running 2 tests from 1 test case.
+[----------] Global test environment set-up.
+[----------] 2 tests from WidgetInitializerTest
+[ RUN      ] WidgetInitializerTest.TestConstructor
+[       OK ] WidgetInitializerTest.TestConstructor
+[ RUN      ] WidgetInitializerTest.TestConversion
+[       OK ] WidgetInitializerTest.TestConversion
+[----------] Global test environment tear-down
+[==========] 2 tests from 1 test case ran.
+[  PASSED  ] 2 tests.
+
+The Debugger has exited with status 0.  
+```
+
+# Summary #
+
+Unit testing is a valuable way to ensure your data model stays valid even during rapid development or refactoring. The Google Testing Framework is a great unit testing framework for C and C++ which integrates well with an Xcode development environment.
\ No newline at end of file
diff --git a/docs/V1_7_AdvancedGuide.md b/docs/V1_7_AdvancedGuide.md
new file mode 100755 (executable)
index 0000000..dd4af8f
--- /dev/null
@@ -0,0 +1,2181 @@
+
+
+Now that you have read [Primer](V1_7_Primer.md) and learned how to write tests
+using Google Test, it's time to learn some new tricks. This document
+will show you more assertions as well as how to construct complex
+failure messages, propagate fatal failures, reuse and speed up your
+test fixtures, and use various flags with your tests.
+
+# More Assertions #
+
+This section covers some less frequently used, but still significant,
+assertions.
+
+## Explicit Success and Failure ##
+
+These three assertions do not actually test a value or expression. Instead,
+they generate a success or failure directly. Like the macros that actually
+perform a test, you may stream a custom failure message into the them.
+
+| `SUCCEED();` |
+|:-------------|
+
+Generates a success. This does NOT make the overall test succeed. A test is
+considered successful only if none of its assertions fail during its execution.
+
+Note: `SUCCEED()` is purely documentary and currently doesn't generate any
+user-visible output. However, we may add `SUCCEED()` messages to Google Test's
+output in the future.
+
+| `FAIL();`  | `ADD_FAILURE();` | `ADD_FAILURE_AT("`_file\_path_`", `_line\_number_`);` |
+|:-----------|:-----------------|:------------------------------------------------------|
+
+`FAIL()` generates a fatal failure, while `ADD_FAILURE()` and `ADD_FAILURE_AT()` generate a nonfatal
+failure. These are useful when control flow, rather than a Boolean expression,
+deteremines the test's success or failure. For example, you might want to write
+something like:
+
+```
+switch(expression) {
+  case 1: ... some checks ...
+  case 2: ... some other checks
+  ...
+  default: FAIL() << "We shouldn't get here.";
+}
+```
+
+_Availability_: Linux, Windows, Mac.
+
+## Exception Assertions ##
+
+These are for verifying that a piece of code throws (or does not
+throw) an exception of the given type:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_THROW(`_statement_, _exception\_type_`);`  | `EXPECT_THROW(`_statement_, _exception\_type_`);`  | _statement_ throws an exception of the given type  |
+| `ASSERT_ANY_THROW(`_statement_`);`                | `EXPECT_ANY_THROW(`_statement_`);`                | _statement_ throws an exception of any type        |
+| `ASSERT_NO_THROW(`_statement_`);`                 | `EXPECT_NO_THROW(`_statement_`);`                 | _statement_ doesn't throw any exception            |
+
+Examples:
+
+```
+ASSERT_THROW(Foo(5), bar_exception);
+
+EXPECT_NO_THROW({
+  int n = 5;
+  Bar(&n);
+});
+```
+
+_Availability_: Linux, Windows, Mac; since version 1.1.0.
+
+## Predicate Assertions for Better Error Messages ##
+
+Even though Google Test has a rich set of assertions, they can never be
+complete, as it's impossible (nor a good idea) to anticipate all the scenarios
+a user might run into. Therefore, sometimes a user has to use `EXPECT_TRUE()`
+to check a complex expression, for lack of a better macro. This has the problem
+of not showing you the values of the parts of the expression, making it hard to
+understand what went wrong. As a workaround, some users choose to construct the
+failure message by themselves, streaming it into `EXPECT_TRUE()`. However, this
+is awkward especially when the expression has side-effects or is expensive to
+evaluate.
+
+Google Test gives you three different options to solve this problem:
+
+### Using an Existing Boolean Function ###
+
+If you already have a function or a functor that returns `bool` (or a type
+that can be implicitly converted to `bool`), you can use it in a _predicate
+assertion_ to get the function arguments printed for free:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_PRED1(`_pred1, val1_`);`       | `EXPECT_PRED1(`_pred1, val1_`);` | _pred1(val1)_ returns true |
+| `ASSERT_PRED2(`_pred2, val1, val2_`);` | `EXPECT_PRED2(`_pred2, val1, val2_`);` |  _pred2(val1, val2)_ returns true |
+|  ...                | ...                    | ...          |
+
+In the above, _predn_ is an _n_-ary predicate function or functor, where
+_val1_, _val2_, ..., and _valn_ are its arguments. The assertion succeeds
+if the predicate returns `true` when applied to the given arguments, and fails
+otherwise. When the assertion fails, it prints the value of each argument. In
+either case, the arguments are evaluated exactly once.
+
+Here's an example. Given
+
+```
+// Returns true iff m and n have no common divisors except 1.
+bool MutuallyPrime(int m, int n) { ... }
+const int a = 3;
+const int b = 4;
+const int c = 10;
+```
+
+the assertion `EXPECT_PRED2(MutuallyPrime, a, b);` will succeed, while the
+assertion `EXPECT_PRED2(MutuallyPrime, b, c);` will fail with the message
+
+<pre>
+!MutuallyPrime(b, c) is false, where<br>
+b is 4<br>
+c is 10<br>
+</pre>
+
+**Notes:**
+
+  1. If you see a compiler error "no matching function to call" when using `ASSERT_PRED*` or `EXPECT_PRED*`, please see [this](V1_7_FAQ.md#the-compiler-complains-about-undefined-references-to-some-static-const-member-variables-but-i-did-define-them-in-the-class-body-whats-wrong) for how to resolve it.
+  1. Currently we only provide predicate assertions of arity <= 5. If you need a higher-arity assertion, let us know.
+
+_Availability_: Linux, Windows, Mac
+
+### Using a Function That Returns an AssertionResult ###
+
+While `EXPECT_PRED*()` and friends are handy for a quick job, the
+syntax is not satisfactory: you have to use different macros for
+different arities, and it feels more like Lisp than C++.  The
+`::testing::AssertionResult` class solves this problem.
+
+An `AssertionResult` object represents the result of an assertion
+(whether it's a success or a failure, and an associated message).  You
+can create an `AssertionResult` using one of these factory
+functions:
+
+```
+namespace testing {
+
+// Returns an AssertionResult object to indicate that an assertion has
+// succeeded.
+AssertionResult AssertionSuccess();
+
+// Returns an AssertionResult object to indicate that an assertion has
+// failed.
+AssertionResult AssertionFailure();
+
+}
+```
+
+You can then use the `<<` operator to stream messages to the
+`AssertionResult` object.
+
+To provide more readable messages in Boolean assertions
+(e.g. `EXPECT_TRUE()`), write a predicate function that returns
+`AssertionResult` instead of `bool`. For example, if you define
+`IsEven()` as:
+
+```
+::testing::AssertionResult IsEven(int n) {
+  if ((n % 2) == 0)
+    return ::testing::AssertionSuccess();
+  else
+    return ::testing::AssertionFailure() << n << " is odd";
+}
+```
+
+instead of:
+
+```
+bool IsEven(int n) {
+  return (n % 2) == 0;
+}
+```
+
+the failed assertion `EXPECT_TRUE(IsEven(Fib(4)))` will print:
+
+<pre>
+Value of: IsEven(Fib(4))<br>
+Actual: false (*3 is odd*)<br>
+Expected: true<br>
+</pre>
+
+instead of a more opaque
+
+<pre>
+Value of: IsEven(Fib(4))<br>
+Actual: false<br>
+Expected: true<br>
+</pre>
+
+If you want informative messages in `EXPECT_FALSE` and `ASSERT_FALSE`
+as well, and are fine with making the predicate slower in the success
+case, you can supply a success message:
+
+```
+::testing::AssertionResult IsEven(int n) {
+  if ((n % 2) == 0)
+    return ::testing::AssertionSuccess() << n << " is even";
+  else
+    return ::testing::AssertionFailure() << n << " is odd";
+}
+```
+
+Then the statement `EXPECT_FALSE(IsEven(Fib(6)))` will print
+
+<pre>
+Value of: IsEven(Fib(6))<br>
+Actual: true (8 is even)<br>
+Expected: false<br>
+</pre>
+
+_Availability_: Linux, Windows, Mac; since version 1.4.1.
+
+### Using a Predicate-Formatter ###
+
+If you find the default message generated by `(ASSERT|EXPECT)_PRED*` and
+`(ASSERT|EXPECT)_(TRUE|FALSE)` unsatisfactory, or some arguments to your
+predicate do not support streaming to `ostream`, you can instead use the
+following _predicate-formatter assertions_ to _fully_ customize how the
+message is formatted:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_PRED_FORMAT1(`_pred\_format1, val1_`);`        | `EXPECT_PRED_FORMAT1(`_pred\_format1, val1_`); | _pred\_format1(val1)_ is successful |
+| `ASSERT_PRED_FORMAT2(`_pred\_format2, val1, val2_`);` | `EXPECT_PRED_FORMAT2(`_pred\_format2, val1, val2_`);` | _pred\_format2(val1, val2)_ is successful |
+| `...`               | `...`                  | `...`        |
+
+The difference between this and the previous two groups of macros is that instead of
+a predicate, `(ASSERT|EXPECT)_PRED_FORMAT*` take a _predicate-formatter_
+(_pred\_formatn_), which is a function or functor with the signature:
+
+`::testing::AssertionResult PredicateFormattern(const char* `_expr1_`, const char* `_expr2_`, ... const char* `_exprn_`, T1 `_val1_`, T2 `_val2_`, ... Tn `_valn_`);`
+
+where _val1_, _val2_, ..., and _valn_ are the values of the predicate
+arguments, and _expr1_, _expr2_, ..., and _exprn_ are the corresponding
+expressions as they appear in the source code. The types `T1`, `T2`, ..., and
+`Tn` can be either value types or reference types. For example, if an
+argument has type `Foo`, you can declare it as either `Foo` or `const Foo&`,
+whichever is appropriate.
+
+A predicate-formatter returns a `::testing::AssertionResult` object to indicate
+whether the assertion has succeeded or not. The only way to create such an
+object is to call one of these factory functions:
+
+As an example, let's improve the failure message in the previous example, which uses `EXPECT_PRED2()`:
+
+```
+// Returns the smallest prime common divisor of m and n,
+// or 1 when m and n are mutually prime.
+int SmallestPrimeCommonDivisor(int m, int n) { ... }
+
+// A predicate-formatter for asserting that two integers are mutually prime.
+::testing::AssertionResult AssertMutuallyPrime(const char* m_expr,
+                                               const char* n_expr,
+                                               int m,
+                                               int n) {
+  if (MutuallyPrime(m, n))
+    return ::testing::AssertionSuccess();
+
+  return ::testing::AssertionFailure()
+      << m_expr << " and " << n_expr << " (" << m << " and " << n
+      << ") are not mutually prime, " << "as they have a common divisor "
+      << SmallestPrimeCommonDivisor(m, n);
+}
+```
+
+With this predicate-formatter, we can use
+
+```
+EXPECT_PRED_FORMAT2(AssertMutuallyPrime, b, c);
+```
+
+to generate the message
+
+<pre>
+b and c (4 and 10) are not mutually prime, as they have a common divisor 2.<br>
+</pre>
+
+As you may have realized, many of the assertions we introduced earlier are
+special cases of `(EXPECT|ASSERT)_PRED_FORMAT*`. In fact, most of them are
+indeed defined using `(EXPECT|ASSERT)_PRED_FORMAT*`.
+
+_Availability_: Linux, Windows, Mac.
+
+
+## Floating-Point Comparison ##
+
+Comparing floating-point numbers is tricky. Due to round-off errors, it is
+very unlikely that two floating-points will match exactly. Therefore,
+`ASSERT_EQ` 's naive comparison usually doesn't work. And since floating-points
+can have a wide value range, no single fixed error bound works. It's better to
+compare by a fixed relative error bound, except for values close to 0 due to
+the loss of precision there.
+
+In general, for floating-point comparison to make sense, the user needs to
+carefully choose the error bound. If they don't want or care to, comparing in
+terms of Units in the Last Place (ULPs) is a good default, and Google Test
+provides assertions to do this. Full details about ULPs are quite long; if you
+want to learn more, see
+[this article on float comparison](http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm).
+
+### Floating-Point Macros ###
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_FLOAT_EQ(`_expected, actual_`);`  | `EXPECT_FLOAT_EQ(`_expected, actual_`);` | the two `float` values are almost equal |
+| `ASSERT_DOUBLE_EQ(`_expected, actual_`);` | `EXPECT_DOUBLE_EQ(`_expected, actual_`);` | the two `double` values are almost equal |
+
+By "almost equal", we mean the two values are within 4 ULP's from each
+other.
+
+The following assertions allow you to choose the acceptable error bound:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_NEAR(`_val1, val2, abs\_error_`);` | `EXPECT_NEAR`_(val1, val2, abs\_error_`);` | the difference between _val1_ and _val2_ doesn't exceed the given absolute error |
+
+_Availability_: Linux, Windows, Mac.
+
+### Floating-Point Predicate-Format Functions ###
+
+Some floating-point operations are useful, but not that often used. In order
+to avoid an explosion of new macros, we provide them as predicate-format
+functions that can be used in predicate assertion macros (e.g.
+`EXPECT_PRED_FORMAT2`, etc).
+
+```
+EXPECT_PRED_FORMAT2(::testing::FloatLE, val1, val2);
+EXPECT_PRED_FORMAT2(::testing::DoubleLE, val1, val2);
+```
+
+Verifies that _val1_ is less than, or almost equal to, _val2_. You can
+replace `EXPECT_PRED_FORMAT2` in the above table with `ASSERT_PRED_FORMAT2`.
+
+_Availability_: Linux, Windows, Mac.
+
+## Windows HRESULT assertions ##
+
+These assertions test for `HRESULT` success or failure.
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_HRESULT_SUCCEEDED(`_expression_`);` | `EXPECT_HRESULT_SUCCEEDED(`_expression_`);` | _expression_ is a success `HRESULT` |
+| `ASSERT_HRESULT_FAILED(`_expression_`);`    | `EXPECT_HRESULT_FAILED(`_expression_`);`    | _expression_ is a failure `HRESULT` |
+
+The generated output contains the human-readable error message
+associated with the `HRESULT` code returned by _expression_.
+
+You might use them like this:
+
+```
+CComPtr shell;
+ASSERT_HRESULT_SUCCEEDED(shell.CoCreateInstance(L"Shell.Application"));
+CComVariant empty;
+ASSERT_HRESULT_SUCCEEDED(shell->ShellExecute(CComBSTR(url), empty, empty, empty, empty));
+```
+
+_Availability_: Windows.
+
+## Type Assertions ##
+
+You can call the function
+```
+::testing::StaticAssertTypeEq<T1, T2>();
+```
+to assert that types `T1` and `T2` are the same.  The function does
+nothing if the assertion is satisfied.  If the types are different,
+the function call will fail to compile, and the compiler error message
+will likely (depending on the compiler) show you the actual values of
+`T1` and `T2`.  This is mainly useful inside template code.
+
+_Caveat:_ When used inside a member function of a class template or a
+function template, `StaticAssertTypeEq<T1, T2>()` is effective _only if_
+the function is instantiated.  For example, given:
+```
+template <typename T> class Foo {
+ public:
+  void Bar() { ::testing::StaticAssertTypeEq<int, T>(); }
+};
+```
+the code:
+```
+void Test1() { Foo<bool> foo; }
+```
+will _not_ generate a compiler error, as `Foo<bool>::Bar()` is never
+actually instantiated.  Instead, you need:
+```
+void Test2() { Foo<bool> foo; foo.Bar(); }
+```
+to cause a compiler error.
+
+_Availability:_ Linux, Windows, Mac; since version 1.3.0.
+
+## Assertion Placement ##
+
+You can use assertions in any C++ function. In particular, it doesn't
+have to be a method of the test fixture class. The one constraint is
+that assertions that generate a fatal failure (`FAIL*` and `ASSERT_*`)
+can only be used in void-returning functions. This is a consequence of
+Google Test not using exceptions. By placing it in a non-void function
+you'll get a confusing compile error like
+`"error: void value not ignored as it ought to be"`.
+
+If you need to use assertions in a function that returns non-void, one option
+is to make the function return the value in an out parameter instead. For
+example, you can rewrite `T2 Foo(T1 x)` to `void Foo(T1 x, T2* result)`. You
+need to make sure that `*result` contains some sensible value even when the
+function returns prematurely. As the function now returns `void`, you can use
+any assertion inside of it.
+
+If changing the function's type is not an option, you should just use
+assertions that generate non-fatal failures, such as `ADD_FAILURE*` and
+`EXPECT_*`.
+
+_Note_: Constructors and destructors are not considered void-returning
+functions, according to the C++ language specification, and so you may not use
+fatal assertions in them. You'll get a compilation error if you try. A simple
+workaround is to transfer the entire body of the constructor or destructor to a
+private void-returning method. However, you should be aware that a fatal
+assertion failure in a constructor does not terminate the current test, as your
+intuition might suggest; it merely returns from the constructor early, possibly
+leaving your object in a partially-constructed state. Likewise, a fatal
+assertion failure in a destructor may leave your object in a
+partially-destructed state. Use assertions carefully in these situations!
+
+# Teaching Google Test How to Print Your Values #
+
+When a test assertion such as `EXPECT_EQ` fails, Google Test prints the
+argument values to help you debug.  It does this using a
+user-extensible value printer.
+
+This printer knows how to print built-in C++ types, native arrays, STL
+containers, and any type that supports the `<<` operator.  For other
+types, it prints the raw bytes in the value and hopes that you the
+user can figure it out.
+
+As mentioned earlier, the printer is _extensible_.  That means
+you can teach it to do a better job at printing your particular type
+than to dump the bytes.  To do that, define `<<` for your type:
+
+```
+#include <iostream>
+
+namespace foo {
+
+class Bar { ... };  // We want Google Test to be able to print instances of this.
+
+// It's important that the << operator is defined in the SAME
+// namespace that defines Bar.  C++'s look-up rules rely on that.
+::std::ostream& operator<<(::std::ostream& os, const Bar& bar) {
+  return os << bar.DebugString();  // whatever needed to print bar to os
+}
+
+}  // namespace foo
+```
+
+Sometimes, this might not be an option: your team may consider it bad
+style to have a `<<` operator for `Bar`, or `Bar` may already have a
+`<<` operator that doesn't do what you want (and you cannot change
+it).  If so, you can instead define a `PrintTo()` function like this:
+
+```
+#include <iostream>
+
+namespace foo {
+
+class Bar { ... };
+
+// It's important that PrintTo() is defined in the SAME
+// namespace that defines Bar.  C++'s look-up rules rely on that.
+void PrintTo(const Bar& bar, ::std::ostream* os) {
+  *os << bar.DebugString();  // whatever needed to print bar to os
+}
+
+}  // namespace foo
+```
+
+If you have defined both `<<` and `PrintTo()`, the latter will be used
+when Google Test is concerned.  This allows you to customize how the value
+appears in Google Test's output without affecting code that relies on the
+behavior of its `<<` operator.
+
+If you want to print a value `x` using Google Test's value printer
+yourself, just call `::testing::PrintToString(`_x_`)`, which
+returns an `std::string`:
+
+```
+vector<pair<Bar, int> > bar_ints = GetBarIntVector();
+
+EXPECT_TRUE(IsCorrectBarIntVector(bar_ints))
+    << "bar_ints = " << ::testing::PrintToString(bar_ints);
+```
+
+# Death Tests #
+
+In many applications, there are assertions that can cause application failure
+if a condition is not met. These sanity checks, which ensure that the program
+is in a known good state, are there to fail at the earliest possible time after
+some program state is corrupted. If the assertion checks the wrong condition,
+then the program may proceed in an erroneous state, which could lead to memory
+corruption, security holes, or worse. Hence it is vitally important to test
+that such assertion statements work as expected.
+
+Since these precondition checks cause the processes to die, we call such tests
+_death tests_. More generally, any test that checks that a program terminates
+(except by throwing an exception) in an expected fashion is also a death test.
+
+Note that if a piece of code throws an exception, we don't consider it "death"
+for the purpose of death tests, as the caller of the code could catch the exception
+and avoid the crash. If you want to verify exceptions thrown by your code,
+see [Exception Assertions](#exception-assertions).
+
+If you want to test `EXPECT_*()/ASSERT_*()` failures in your test code, see [Catching Failures](#catching-failures).
+
+## How to Write a Death Test ##
+
+Google Test has the following macros to support death tests:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_DEATH(`_statement, regex_`); | `EXPECT_DEATH(`_statement, regex_`); | _statement_ crashes with the given error |
+| `ASSERT_DEATH_IF_SUPPORTED(`_statement, regex_`); | `EXPECT_DEATH_IF_SUPPORTED(`_statement, regex_`); | if death tests are supported, verifies that _statement_ crashes with the given error; otherwise verifies nothing |
+| `ASSERT_EXIT(`_statement, predicate, regex_`); | `EXPECT_EXIT(`_statement, predicate, regex_`); |_statement_ exits with the given error and its exit code matches _predicate_ |
+
+where _statement_ is a statement that is expected to cause the process to
+die, _predicate_ is a function or function object that evaluates an integer
+exit status, and _regex_ is a regular expression that the stderr output of
+_statement_ is expected to match. Note that _statement_ can be _any valid
+statement_ (including _compound statement_) and doesn't have to be an
+expression.
+
+As usual, the `ASSERT` variants abort the current test function, while the
+`EXPECT` variants do not.
+
+**Note:** We use the word "crash" here to mean that the process
+terminates with a _non-zero_ exit status code.  There are two
+possibilities: either the process has called `exit()` or `_exit()`
+with a non-zero value, or it may be killed by a signal.
+
+This means that if _statement_ terminates the process with a 0 exit
+code, it is _not_ considered a crash by `EXPECT_DEATH`.  Use
+`EXPECT_EXIT` instead if this is the case, or if you want to restrict
+the exit code more precisely.
+
+A predicate here must accept an `int` and return a `bool`. The death test
+succeeds only if the predicate returns `true`. Google Test defines a few
+predicates that handle the most common cases:
+
+```
+::testing::ExitedWithCode(exit_code)
+```
+
+This expression is `true` if the program exited normally with the given exit
+code.
+
+```
+::testing::KilledBySignal(signal_number)  // Not available on Windows.
+```
+
+This expression is `true` if the program was killed by the given signal.
+
+The `*_DEATH` macros are convenient wrappers for `*_EXIT` that use a predicate
+that verifies the process' exit code is non-zero.
+
+Note that a death test only cares about three things:
+
+  1. does _statement_ abort or exit the process?
+  1. (in the case of `ASSERT_EXIT` and `EXPECT_EXIT`) does the exit status satisfy _predicate_?  Or (in the case of `ASSERT_DEATH` and `EXPECT_DEATH`) is the exit status non-zero?  And
+  1. does the stderr output match _regex_?
+
+In particular, if _statement_ generates an `ASSERT_*` or `EXPECT_*` failure, it will **not** cause the death test to fail, as Google Test assertions don't abort the process.
+
+To write a death test, simply use one of the above macros inside your test
+function. For example,
+
+```
+TEST(MyDeathTest, Foo) {
+  // This death test uses a compound statement.
+  ASSERT_DEATH({ int n = 5; Foo(&n); }, "Error on line .* of Foo()");
+}
+TEST(MyDeathTest, NormalExit) {
+  EXPECT_EXIT(NormalExit(), ::testing::ExitedWithCode(0), "Success");
+}
+TEST(MyDeathTest, KillMyself) {
+  EXPECT_EXIT(KillMyself(), ::testing::KilledBySignal(SIGKILL), "Sending myself unblockable signal");
+}
+```
+
+verifies that:
+
+  * calling `Foo(5)` causes the process to die with the given error message,
+  * calling `NormalExit()` causes the process to print `"Success"` to stderr and exit with exit code 0, and
+  * calling `KillMyself()` kills the process with signal `SIGKILL`.
+
+The test function body may contain other assertions and statements as well, if
+necessary.
+
+_Important:_ We strongly recommend you to follow the convention of naming your
+test case (not test) `*DeathTest` when it contains a death test, as
+demonstrated in the above example. The `Death Tests And Threads` section below
+explains why.
+
+If a test fixture class is shared by normal tests and death tests, you
+can use typedef to introduce an alias for the fixture class and avoid
+duplicating its code:
+```
+class FooTest : public ::testing::Test { ... };
+
+typedef FooTest FooDeathTest;
+
+TEST_F(FooTest, DoesThis) {
+  // normal test
+}
+
+TEST_F(FooDeathTest, DoesThat) {
+  // death test
+}
+```
+
+_Availability:_ Linux, Windows (requires MSVC 8.0 or above), Cygwin, and Mac (the latter three are supported since v1.3.0).  `(ASSERT|EXPECT)_DEATH_IF_SUPPORTED` are new in v1.4.0.
+
+## Regular Expression Syntax ##
+
+On POSIX systems (e.g. Linux, Cygwin, and Mac), Google Test uses the
+[POSIX extended regular expression](http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04)
+syntax in death tests. To learn about this syntax, you may want to read this [Wikipedia entry](http://en.wikipedia.org/wiki/Regular_expression#POSIX_Extended_Regular_Expressions).
+
+On Windows, Google Test uses its own simple regular expression
+implementation. It lacks many features you can find in POSIX extended
+regular expressions.  For example, we don't support union (`"x|y"`),
+grouping (`"(xy)"`), brackets (`"[xy]"`), and repetition count
+(`"x{5,7}"`), among others. Below is what we do support (Letter `A` denotes a
+literal character, period (`.`), or a single `\\` escape sequence; `x`
+and `y` denote regular expressions.):
+
+| `c` | matches any literal character `c` |
+|:----|:----------------------------------|
+| `\\d` | matches any decimal digit         |
+| `\\D` | matches any character that's not a decimal digit |
+| `\\f` | matches `\f`                      |
+| `\\n` | matches `\n`                      |
+| `\\r` | matches `\r`                      |
+| `\\s` | matches any ASCII whitespace, including `\n` |
+| `\\S` | matches any character that's not a whitespace |
+| `\\t` | matches `\t`                      |
+| `\\v` | matches `\v`                      |
+| `\\w` | matches any letter, `_`, or decimal digit |
+| `\\W` | matches any character that `\\w` doesn't match |
+| `\\c` | matches any literal character `c`, which must be a punctuation |
+| `\\.` | matches the `.` character         |
+| `.` | matches any single character except `\n` |
+| `A?` | matches 0 or 1 occurrences of `A` |
+| `A*` | matches 0 or many occurrences of `A` |
+| `A+` | matches 1 or many occurrences of `A` |
+| `^` | matches the beginning of a string (not that of each line) |
+| `$` | matches the end of a string (not that of each line) |
+| `xy` | matches `x` followed by `y`       |
+
+To help you determine which capability is available on your system,
+Google Test defines macro `GTEST_USES_POSIX_RE=1` when it uses POSIX
+extended regular expressions, or `GTEST_USES_SIMPLE_RE=1` when it uses
+the simple version.  If you want your death tests to work in both
+cases, you can either `#if` on these macros or use the more limited
+syntax only.
+
+## How It Works ##
+
+Under the hood, `ASSERT_EXIT()` spawns a new process and executes the
+death test statement in that process. The details of of how precisely
+that happens depend on the platform and the variable
+`::testing::GTEST_FLAG(death_test_style)` (which is initialized from the
+command-line flag `--gtest_death_test_style`).
+
+  * On POSIX systems, `fork()` (or `clone()` on Linux) is used to spawn the child, after which:
+    * If the variable's value is `"fast"`, the death test statement is immediately executed.
+    * If the variable's value is `"threadsafe"`, the child process re-executes the unit test binary just as it was originally invoked, but with some extra flags to cause just the single death test under consideration to be run.
+  * On Windows, the child is spawned using the `CreateProcess()` API, and re-executes the binary to cause just the single death test under consideration to be run - much like the `threadsafe` mode on POSIX.
+
+Other values for the variable are illegal and will cause the death test to
+fail. Currently, the flag's default value is `"fast"`. However, we reserve the
+right to change it in the future. Therefore, your tests should not depend on
+this.
+
+In either case, the parent process waits for the child process to complete, and checks that
+
+  1. the child's exit status satisfies the predicate, and
+  1. the child's stderr matches the regular expression.
+
+If the death test statement runs to completion without dying, the child
+process will nonetheless terminate, and the assertion fails.
+
+## Death Tests And Threads ##
+
+The reason for the two death test styles has to do with thread safety. Due to
+well-known problems with forking in the presence of threads, death tests should
+be run in a single-threaded context. Sometimes, however, it isn't feasible to
+arrange that kind of environment. For example, statically-initialized modules
+may start threads before main is ever reached. Once threads have been created,
+it may be difficult or impossible to clean them up.
+
+Google Test has three features intended to raise awareness of threading issues.
+
+  1. A warning is emitted if multiple threads are running when a death test is encountered.
+  1. Test cases with a name ending in "DeathTest" are run before all other tests.
+  1. It uses `clone()` instead of `fork()` to spawn the child process on Linux (`clone()` is not available on Cygwin and Mac), as `fork()` is more likely to cause the child to hang when the parent process has multiple threads.
+
+It's perfectly fine to create threads inside a death test statement; they are
+executed in a separate process and cannot affect the parent.
+
+## Death Test Styles ##
+
+The "threadsafe" death test style was introduced in order to help mitigate the
+risks of testing in a possibly multithreaded environment. It trades increased
+test execution time (potentially dramatically so) for improved thread safety.
+We suggest using the faster, default "fast" style unless your test has specific
+problems with it.
+
+You can choose a particular style of death tests by setting the flag
+programmatically:
+
+```
+::testing::FLAGS_gtest_death_test_style = "threadsafe";
+```
+
+You can do this in `main()` to set the style for all death tests in the
+binary, or in individual tests. Recall that flags are saved before running each
+test and restored afterwards, so you need not do that yourself. For example:
+
+```
+TEST(MyDeathTest, TestOne) {
+  ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+  // This test is run in the "threadsafe" style:
+  ASSERT_DEATH(ThisShouldDie(), "");
+}
+
+TEST(MyDeathTest, TestTwo) {
+  // This test is run in the "fast" style:
+  ASSERT_DEATH(ThisShouldDie(), "");
+}
+
+int main(int argc, char** argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  ::testing::FLAGS_gtest_death_test_style = "fast";
+  return RUN_ALL_TESTS();
+}
+```
+
+## Caveats ##
+
+The _statement_ argument of `ASSERT_EXIT()` can be any valid C++ statement.
+If it leaves the current function via a `return` statement or by throwing an exception,
+the death test is considered to have failed.  Some Google Test macros may return
+from the current function (e.g. `ASSERT_TRUE()`), so be sure to avoid them in _statement_.
+
+Since _statement_ runs in the child process, any in-memory side effect (e.g.
+modifying a variable, releasing memory, etc) it causes will _not_ be observable
+in the parent process. In particular, if you release memory in a death test,
+your program will fail the heap check as the parent process will never see the
+memory reclaimed. To solve this problem, you can
+
+  1. try not to free memory in a death test;
+  1. free the memory again in the parent process; or
+  1. do not use the heap checker in your program.
+
+Due to an implementation detail, you cannot place multiple death test
+assertions on the same line; otherwise, compilation will fail with an unobvious
+error message.
+
+Despite the improved thread safety afforded by the "threadsafe" style of death
+test, thread problems such as deadlock are still possible in the presence of
+handlers registered with `pthread_atfork(3)`.
+
+# Using Assertions in Sub-routines #
+
+## Adding Traces to Assertions ##
+
+If a test sub-routine is called from several places, when an assertion
+inside it fails, it can be hard to tell which invocation of the
+sub-routine the failure is from.  You can alleviate this problem using
+extra logging or custom failure messages, but that usually clutters up
+your tests. A better solution is to use the `SCOPED_TRACE` macro:
+
+| `SCOPED_TRACE(`_message_`);` |
+|:-----------------------------|
+
+where _message_ can be anything streamable to `std::ostream`. This
+macro will cause the current file name, line number, and the given
+message to be added in every failure message. The effect will be
+undone when the control leaves the current lexical scope.
+
+For example,
+
+```
+10: void Sub1(int n) {
+11:   EXPECT_EQ(1, Bar(n));
+12:   EXPECT_EQ(2, Bar(n + 1));
+13: }
+14:
+15: TEST(FooTest, Bar) {
+16:   {
+17:     SCOPED_TRACE("A");  // This trace point will be included in
+18:                         // every failure in this scope.
+19:     Sub1(1);
+20:   }
+21:   // Now it won't.
+22:   Sub1(9);
+23: }
+```
+
+could result in messages like these:
+
+```
+path/to/foo_test.cc:11: Failure
+Value of: Bar(n)
+Expected: 1
+  Actual: 2
+   Trace:
+path/to/foo_test.cc:17: A
+
+path/to/foo_test.cc:12: Failure
+Value of: Bar(n + 1)
+Expected: 2
+  Actual: 3
+```
+
+Without the trace, it would've been difficult to know which invocation
+of `Sub1()` the two failures come from respectively. (You could add an
+extra message to each assertion in `Sub1()` to indicate the value of
+`n`, but that's tedious.)
+
+Some tips on using `SCOPED_TRACE`:
+
+  1. With a suitable message, it's often enough to use `SCOPED_TRACE` at the beginning of a sub-routine, instead of at each call site.
+  1. When calling sub-routines inside a loop, make the loop iterator part of the message in `SCOPED_TRACE` such that you can know which iteration the failure is from.
+  1. Sometimes the line number of the trace point is enough for identifying the particular invocation of a sub-routine. In this case, you don't have to choose a unique message for `SCOPED_TRACE`. You can simply use `""`.
+  1. You can use `SCOPED_TRACE` in an inner scope when there is one in the outer scope. In this case, all active trace points will be included in the failure messages, in reverse order they are encountered.
+  1. The trace dump is clickable in Emacs' compilation buffer - hit return on a line number and you'll be taken to that line in the source file!
+
+_Availability:_ Linux, Windows, Mac.
+
+## Propagating Fatal Failures ##
+
+A common pitfall when using `ASSERT_*` and `FAIL*` is not understanding that
+when they fail they only abort the _current function_, not the entire test. For
+example, the following test will segfault:
+```
+void Subroutine() {
+  // Generates a fatal failure and aborts the current function.
+  ASSERT_EQ(1, 2);
+  // The following won't be executed.
+  ...
+}
+
+TEST(FooTest, Bar) {
+  Subroutine();
+  // The intended behavior is for the fatal failure
+  // in Subroutine() to abort the entire test.
+  // The actual behavior: the function goes on after Subroutine() returns.
+  int* p = NULL;
+  *p = 3; // Segfault!
+}
+```
+
+Since we don't use exceptions, it is technically impossible to
+implement the intended behavior here.  To alleviate this, Google Test
+provides two solutions.  You could use either the
+`(ASSERT|EXPECT)_NO_FATAL_FAILURE` assertions or the
+`HasFatalFailure()` function.  They are described in the following two
+subsections.
+
+### Asserting on Subroutines ###
+
+As shown above, if your test calls a subroutine that has an `ASSERT_*`
+failure in it, the test will continue after the subroutine
+returns. This may not be what you want.
+
+Often people want fatal failures to propagate like exceptions.  For
+that Google Test offers the following macros:
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_NO_FATAL_FAILURE(`_statement_`);` | `EXPECT_NO_FATAL_FAILURE(`_statement_`);` | _statement_ doesn't generate any new fatal failures in the current thread. |
+
+Only failures in the thread that executes the assertion are checked to
+determine the result of this type of assertions.  If _statement_
+creates new threads, failures in these threads are ignored.
+
+Examples:
+
+```
+ASSERT_NO_FATAL_FAILURE(Foo());
+
+int i;
+EXPECT_NO_FATAL_FAILURE({
+  i = Bar();
+});
+```
+
+_Availability:_ Linux, Windows, Mac. Assertions from multiple threads
+are currently not supported.
+
+### Checking for Failures in the Current Test ###
+
+`HasFatalFailure()` in the `::testing::Test` class returns `true` if an
+assertion in the current test has suffered a fatal failure. This
+allows functions to catch fatal failures in a sub-routine and return
+early.
+
+```
+class Test {
+ public:
+  ...
+  static bool HasFatalFailure();
+};
+```
+
+The typical usage, which basically simulates the behavior of a thrown
+exception, is:
+
+```
+TEST(FooTest, Bar) {
+  Subroutine();
+  // Aborts if Subroutine() had a fatal failure.
+  if (HasFatalFailure())
+    return;
+  // The following won't be executed.
+  ...
+}
+```
+
+If `HasFatalFailure()` is used outside of `TEST()` , `TEST_F()` , or a test
+fixture, you must add the `::testing::Test::` prefix, as in:
+
+```
+if (::testing::Test::HasFatalFailure())
+  return;
+```
+
+Similarly, `HasNonfatalFailure()` returns `true` if the current test
+has at least one non-fatal failure, and `HasFailure()` returns `true`
+if the current test has at least one failure of either kind.
+
+_Availability:_ Linux, Windows, Mac.  `HasNonfatalFailure()` and
+`HasFailure()` are available since version 1.4.0.
+
+# Logging Additional Information #
+
+In your test code, you can call `RecordProperty("key", value)` to log
+additional information, where `value` can be either a string or an `int`. The _last_ value recorded for a key will be emitted to the XML output
+if you specify one. For example, the test
+
+```
+TEST_F(WidgetUsageTest, MinAndMaxWidgets) {
+  RecordProperty("MaximumWidgets", ComputeMaxUsage());
+  RecordProperty("MinimumWidgets", ComputeMinUsage());
+}
+```
+
+will output XML like this:
+
+```
+...
+  <testcase name="MinAndMaxWidgets" status="run" time="6" classname="WidgetUsageTest"
+            MaximumWidgets="12"
+            MinimumWidgets="9" />
+...
+```
+
+_Note_:
+  * `RecordProperty()` is a static member of the `Test` class. Therefore it needs to be prefixed with `::testing::Test::` if used outside of the `TEST` body and the test fixture class.
+  * `key` must be a valid XML attribute name, and cannot conflict with the ones already used by Google Test (`name`, `status`, `time`, `classname`, `type_param`, and `value_param`).
+  * Calling `RecordProperty()` outside of the lifespan of a test is allowed. If it's called outside of a test but between a test case's `SetUpTestCase()` and `TearDownTestCase()` methods, it will be attributed to the XML element for the test case. If it's called outside of all test cases (e.g. in a test environment), it will be attributed to the top-level XML element.
+
+_Availability_: Linux, Windows, Mac.
+
+# Sharing Resources Between Tests in the Same Test Case #
+
+
+
+Google Test creates a new test fixture object for each test in order to make
+tests independent and easier to debug. However, sometimes tests use resources
+that are expensive to set up, making the one-copy-per-test model prohibitively
+expensive.
+
+If the tests don't change the resource, there's no harm in them sharing a
+single resource copy. So, in addition to per-test set-up/tear-down, Google Test
+also supports per-test-case set-up/tear-down. To use it:
+
+  1. In your test fixture class (say `FooTest` ), define as `static` some member variables to hold the shared resources.
+  1. In the same test fixture class, define a `static void SetUpTestCase()` function (remember not to spell it as **`SetupTestCase`** with a small `u`!) to set up the shared resources and a `static void TearDownTestCase()` function to tear them down.
+
+That's it! Google Test automatically calls `SetUpTestCase()` before running the
+_first test_ in the `FooTest` test case (i.e. before creating the first
+`FooTest` object), and calls `TearDownTestCase()` after running the _last test_
+in it (i.e. after deleting the last `FooTest` object). In between, the tests
+can use the shared resources.
+
+Remember that the test order is undefined, so your code can't depend on a test
+preceding or following another. Also, the tests must either not modify the
+state of any shared resource, or, if they do modify the state, they must
+restore the state to its original value before passing control to the next
+test.
+
+Here's an example of per-test-case set-up and tear-down:
+```
+class FooTest : public ::testing::Test {
+ protected:
+  // Per-test-case set-up.
+  // Called before the first test in this test case.
+  // Can be omitted if not needed.
+  static void SetUpTestCase() {
+    shared_resource_ = new ...;
+  }
+
+  // Per-test-case tear-down.
+  // Called after the last test in this test case.
+  // Can be omitted if not needed.
+  static void TearDownTestCase() {
+    delete shared_resource_;
+    shared_resource_ = NULL;
+  }
+
+  // You can define per-test set-up and tear-down logic as usual.
+  virtual void SetUp() { ... }
+  virtual void TearDown() { ... }
+
+  // Some expensive resource shared by all tests.
+  static T* shared_resource_;
+};
+
+T* FooTest::shared_resource_ = NULL;
+
+TEST_F(FooTest, Test1) {
+  ... you can refer to shared_resource here ...
+}
+TEST_F(FooTest, Test2) {
+  ... you can refer to shared_resource here ...
+}
+```
+
+_Availability:_ Linux, Windows, Mac.
+
+# Global Set-Up and Tear-Down #
+
+Just as you can do set-up and tear-down at the test level and the test case
+level, you can also do it at the test program level. Here's how.
+
+First, you subclass the `::testing::Environment` class to define a test
+environment, which knows how to set-up and tear-down:
+
+```
+class Environment {
+ public:
+  virtual ~Environment() {}
+  // Override this to define how to set up the environment.
+  virtual void SetUp() {}
+  // Override this to define how to tear down the environment.
+  virtual void TearDown() {}
+};
+```
+
+Then, you register an instance of your environment class with Google Test by
+calling the `::testing::AddGlobalTestEnvironment()` function:
+
+```
+Environment* AddGlobalTestEnvironment(Environment* env);
+```
+
+Now, when `RUN_ALL_TESTS()` is called, it first calls the `SetUp()` method of
+the environment object, then runs the tests if there was no fatal failures, and
+finally calls `TearDown()` of the environment object.
+
+It's OK to register multiple environment objects. In this case, their `SetUp()`
+will be called in the order they are registered, and their `TearDown()` will be
+called in the reverse order.
+
+Note that Google Test takes ownership of the registered environment objects.
+Therefore **do not delete them** by yourself.
+
+You should call `AddGlobalTestEnvironment()` before `RUN_ALL_TESTS()` is
+called, probably in `main()`. If you use `gtest_main`, you need to      call
+this before `main()` starts for it to take effect. One way to do this is to
+define a global variable like this:
+
+```
+::testing::Environment* const foo_env = ::testing::AddGlobalTestEnvironment(new FooEnvironment);
+```
+
+However, we strongly recommend you to write your own `main()` and call
+`AddGlobalTestEnvironment()` there, as relying on initialization of global
+variables makes the code harder to read and may cause problems when you
+register multiple environments from different translation units and the
+environments have dependencies among them (remember that the compiler doesn't
+guarantee the order in which global variables from different translation units
+are initialized).
+
+_Availability:_ Linux, Windows, Mac.
+
+
+# Value Parameterized Tests #
+
+_Value-parameterized tests_ allow you to test your code with different
+parameters without writing multiple copies of the same test.
+
+Suppose you write a test for your code and then realize that your code is affected by a presence of a Boolean command line flag.
+
+```
+TEST(MyCodeTest, TestFoo) {
+  // A code to test foo().
+}
+```
+
+Usually people factor their test code into a function with a Boolean parameter in such situations. The function sets the flag, then executes the testing code.
+
+```
+void TestFooHelper(bool flag_value) {
+  flag = flag_value;
+  // A code to test foo().
+}
+
+TEST(MyCodeTest, TestFoo) {
+  TestFooHelper(false);
+  TestFooHelper(true);
+}
+```
+
+But this setup has serious drawbacks. First, when a test assertion fails in your tests, it becomes unclear what value of the parameter caused it to fail. You can stream a clarifying message into your `EXPECT`/`ASSERT` statements, but it you'll have to do it with all of them. Second, you have to add one such helper function per test. What if you have ten tests? Twenty? A hundred?
+
+Value-parameterized tests will let you write your test only once and then easily instantiate and run it with an arbitrary number of parameter values.
+
+Here are some other situations when value-parameterized tests come handy:
+
+  * You want to test different implementations of an OO interface.
+  * You want to test your code over various inputs (a.k.a. data-driven testing). This feature is easy to abuse, so please exercise your good sense when doing it!
+
+## How to Write Value-Parameterized Tests ##
+
+To write value-parameterized tests, first you should define a fixture
+class.  It must be derived from both `::testing::Test` and
+`::testing::WithParamInterface<T>` (the latter is a pure interface),
+where `T` is the type of your parameter values.  For convenience, you
+can just derive the fixture class from `::testing::TestWithParam<T>`,
+which itself is derived from both `::testing::Test` and
+`::testing::WithParamInterface<T>`. `T` can be any copyable type. If
+it's a raw pointer, you are responsible for managing the lifespan of
+the pointed values.
+
+```
+class FooTest : public ::testing::TestWithParam<const char*> {
+  // You can implement all the usual fixture class members here.
+  // To access the test parameter, call GetParam() from class
+  // TestWithParam<T>.
+};
+
+// Or, when you want to add parameters to a pre-existing fixture class:
+class BaseTest : public ::testing::Test {
+  ...
+};
+class BarTest : public BaseTest,
+                public ::testing::WithParamInterface<const char*> {
+  ...
+};
+```
+
+Then, use the `TEST_P` macro to define as many test patterns using
+this fixture as you want.  The `_P` suffix is for "parameterized" or
+"pattern", whichever you prefer to think.
+
+```
+TEST_P(FooTest, DoesBlah) {
+  // Inside a test, access the test parameter with the GetParam() method
+  // of the TestWithParam<T> class:
+  EXPECT_TRUE(foo.Blah(GetParam()));
+  ...
+}
+
+TEST_P(FooTest, HasBlahBlah) {
+  ...
+}
+```
+
+Finally, you can use `INSTANTIATE_TEST_CASE_P` to instantiate the test
+case with any set of parameters you want. Google Test defines a number of
+functions for generating test parameters. They return what we call
+(surprise!) _parameter generators_. Here is a summary of them,
+which are all in the `testing` namespace:
+
+| `Range(begin, end[, step])` | Yields values `{begin, begin+step, begin+step+step, ...}`. The values do not include `end`. `step` defaults to 1. |
+|:----------------------------|:------------------------------------------------------------------------------------------------------------------|
+| `Values(v1, v2, ..., vN)`   | Yields values `{v1, v2, ..., vN}`.                                                                                |
+| `ValuesIn(container)` and `ValuesIn(begin, end)` | Yields values from a C-style array, an STL-style container, or an iterator range `[begin, end)`. `container`, `begin`, and `end` can be expressions whose values are determined at run time.  |
+| `Bool()`                    | Yields sequence `{false, true}`.                                                                                  |
+| `Combine(g1, g2, ..., gN)`  | Yields all combinations (the Cartesian product for the math savvy) of the values generated by the `N` generators. This is only available if your system provides the `<tr1/tuple>` header. If you are sure your system does, and Google Test disagrees, you can override it by defining `GTEST_HAS_TR1_TUPLE=1`. See comments in [include/gtest/internal/gtest-port.h](../include/gtest/internal/gtest-port.h) for more information. |
+
+For more details, see the comments at the definitions of these functions in the [source code](../include/gtest/gtest-param-test.h).
+
+The following statement will instantiate tests from the `FooTest` test case
+each with parameter values `"meeny"`, `"miny"`, and `"moe"`.
+
+```
+INSTANTIATE_TEST_CASE_P(InstantiationName,
+                        FooTest,
+                        ::testing::Values("meeny", "miny", "moe"));
+```
+
+To distinguish different instances of the pattern (yes, you can
+instantiate it more than once), the first argument to
+`INSTANTIATE_TEST_CASE_P` is a prefix that will be added to the actual
+test case name. Remember to pick unique prefixes for different
+instantiations. The tests from the instantiation above will have these
+names:
+
+  * `InstantiationName/FooTest.DoesBlah/0` for `"meeny"`
+  * `InstantiationName/FooTest.DoesBlah/1` for `"miny"`
+  * `InstantiationName/FooTest.DoesBlah/2` for `"moe"`
+  * `InstantiationName/FooTest.HasBlahBlah/0` for `"meeny"`
+  * `InstantiationName/FooTest.HasBlahBlah/1` for `"miny"`
+  * `InstantiationName/FooTest.HasBlahBlah/2` for `"moe"`
+
+You can use these names in [--gtest\_filter](#running-a-subset-of-the-tests).
+
+This statement will instantiate all tests from `FooTest` again, each
+with parameter values `"cat"` and `"dog"`:
+
+```
+const char* pets[] = {"cat", "dog"};
+INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest,
+                        ::testing::ValuesIn(pets));
+```
+
+The tests from the instantiation above will have these names:
+
+  * `AnotherInstantiationName/FooTest.DoesBlah/0` for `"cat"`
+  * `AnotherInstantiationName/FooTest.DoesBlah/1` for `"dog"`
+  * `AnotherInstantiationName/FooTest.HasBlahBlah/0` for `"cat"`
+  * `AnotherInstantiationName/FooTest.HasBlahBlah/1` for `"dog"`
+
+Please note that `INSTANTIATE_TEST_CASE_P` will instantiate _all_
+tests in the given test case, whether their definitions come before or
+_after_ the `INSTANTIATE_TEST_CASE_P` statement.
+
+You can see
+[these](../samples/sample7_unittest.cc)
+[files](../samples/sample8_unittest.cc) for more examples.
+
+_Availability_: Linux, Windows (requires MSVC 8.0 or above), Mac; since version 1.2.0.
+
+## Creating Value-Parameterized Abstract Tests ##
+
+In the above, we define and instantiate `FooTest` in the same source
+file. Sometimes you may want to define value-parameterized tests in a
+library and let other people instantiate them later. This pattern is
+known as <i>abstract tests</i>. As an example of its application, when you
+are designing an interface you can write a standard suite of abstract
+tests (perhaps using a factory function as the test parameter) that
+all implementations of the interface are expected to pass. When
+someone implements the interface, he can instantiate your suite to get
+all the interface-conformance tests for free.
+
+To define abstract tests, you should organize your code like this:
+
+  1. Put the definition of the parameterized test fixture class (e.g. `FooTest`) in a header file, say `foo_param_test.h`. Think of this as _declaring_ your abstract tests.
+  1. Put the `TEST_P` definitions in `foo_param_test.cc`, which includes `foo_param_test.h`. Think of this as _implementing_ your abstract tests.
+
+Once they are defined, you can instantiate them by including
+`foo_param_test.h`, invoking `INSTANTIATE_TEST_CASE_P()`, and linking
+with `foo_param_test.cc`. You can instantiate the same abstract test
+case multiple times, possibly in different source files.
+
+# Typed Tests #
+
+Suppose you have multiple implementations of the same interface and
+want to make sure that all of them satisfy some common requirements.
+Or, you may have defined several types that are supposed to conform to
+the same "concept" and you want to verify it.  In both cases, you want
+the same test logic repeated for different types.
+
+While you can write one `TEST` or `TEST_F` for each type you want to
+test (and you may even factor the test logic into a function template
+that you invoke from the `TEST`), it's tedious and doesn't scale:
+if you want _m_ tests over _n_ types, you'll end up writing _m\*n_
+`TEST`s.
+
+_Typed tests_ allow you to repeat the same test logic over a list of
+types.  You only need to write the test logic once, although you must
+know the type list when writing typed tests.  Here's how you do it:
+
+First, define a fixture class template.  It should be parameterized
+by a type.  Remember to derive it from `::testing::Test`:
+
+```
+template <typename T>
+class FooTest : public ::testing::Test {
+ public:
+  ...
+  typedef std::list<T> List;
+  static T shared_;
+  T value_;
+};
+```
+
+Next, associate a list of types with the test case, which will be
+repeated for each type in the list:
+
+```
+typedef ::testing::Types<char, int, unsigned int> MyTypes;
+TYPED_TEST_CASE(FooTest, MyTypes);
+```
+
+The `typedef` is necessary for the `TYPED_TEST_CASE` macro to parse
+correctly.  Otherwise the compiler will think that each comma in the
+type list introduces a new macro argument.
+
+Then, use `TYPED_TEST()` instead of `TEST_F()` to define a typed test
+for this test case.  You can repeat this as many times as you want:
+
+```
+TYPED_TEST(FooTest, DoesBlah) {
+  // Inside a test, refer to the special name TypeParam to get the type
+  // parameter.  Since we are inside a derived class template, C++ requires
+  // us to visit the members of FooTest via 'this'.
+  TypeParam n = this->value_;
+
+  // To visit static members of the fixture, add the 'TestFixture::'
+  // prefix.
+  n += TestFixture::shared_;
+
+  // To refer to typedefs in the fixture, add the 'typename TestFixture::'
+  // prefix.  The 'typename' is required to satisfy the compiler.
+  typename TestFixture::List values;
+  values.push_back(n);
+  ...
+}
+
+TYPED_TEST(FooTest, HasPropertyA) { ... }
+```
+
+You can see `samples/sample6_unittest.cc` for a complete example.
+
+_Availability:_ Linux, Windows (requires MSVC 8.0 or above), Mac;
+since version 1.1.0.
+
+# Type-Parameterized Tests #
+
+_Type-parameterized tests_ are like typed tests, except that they
+don't require you to know the list of types ahead of time.  Instead,
+you can define the test logic first and instantiate it with different
+type lists later.  You can even instantiate it more than once in the
+same program.
+
+If you are designing an interface or concept, you can define a suite
+of type-parameterized tests to verify properties that any valid
+implementation of the interface/concept should have.  Then, the author
+of each implementation can just instantiate the test suite with his
+type to verify that it conforms to the requirements, without having to
+write similar tests repeatedly.  Here's an example:
+
+First, define a fixture class template, as we did with typed tests:
+
+```
+template <typename T>
+class FooTest : public ::testing::Test {
+  ...
+};
+```
+
+Next, declare that you will define a type-parameterized test case:
+
+```
+TYPED_TEST_CASE_P(FooTest);
+```
+
+The `_P` suffix is for "parameterized" or "pattern", whichever you
+prefer to think.
+
+Then, use `TYPED_TEST_P()` to define a type-parameterized test.  You
+can repeat this as many times as you want:
+
+```
+TYPED_TEST_P(FooTest, DoesBlah) {
+  // Inside a test, refer to TypeParam to get the type parameter.
+  TypeParam n = 0;
+  ...
+}
+
+TYPED_TEST_P(FooTest, HasPropertyA) { ... }
+```
+
+Now the tricky part: you need to register all test patterns using the
+`REGISTER_TYPED_TEST_CASE_P` macro before you can instantiate them.
+The first argument of the macro is the test case name; the rest are
+the names of the tests in this test case:
+
+```
+REGISTER_TYPED_TEST_CASE_P(FooTest,
+                           DoesBlah, HasPropertyA);
+```
+
+Finally, you are free to instantiate the pattern with the types you
+want.  If you put the above code in a header file, you can `#include`
+it in multiple C++ source files and instantiate it multiple times.
+
+```
+typedef ::testing::Types<char, int, unsigned int> MyTypes;
+INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
+```
+
+To distinguish different instances of the pattern, the first argument
+to the `INSTANTIATE_TYPED_TEST_CASE_P` macro is a prefix that will be
+added to the actual test case name.  Remember to pick unique prefixes
+for different instances.
+
+In the special case where the type list contains only one type, you
+can write that type directly without `::testing::Types<...>`, like this:
+
+```
+INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
+```
+
+You can see `samples/sample6_unittest.cc` for a complete example.
+
+_Availability:_ Linux, Windows (requires MSVC 8.0 or above), Mac;
+since version 1.1.0.
+
+# Testing Private Code #
+
+If you change your software's internal implementation, your tests should not
+break as long as the change is not observable by users. Therefore, per the
+_black-box testing principle_, most of the time you should test your code
+through its public interfaces.
+
+If you still find yourself needing to test internal implementation code,
+consider if there's a better design that wouldn't require you to do so. If you
+absolutely have to test non-public interface code though, you can. There are
+two cases to consider:
+
+  * Static functions (_not_ the same as static member functions!) or unnamed namespaces, and
+  * Private or protected class members
+
+## Static Functions ##
+
+Both static functions and definitions/declarations in an unnamed namespace are
+only visible within the same translation unit. To test them, you can `#include`
+the entire `.cc` file being tested in your `*_test.cc` file. (`#include`ing `.cc`
+files is not a good way to reuse code - you should not do this in production
+code!)
+
+However, a better approach is to move the private code into the
+`foo::internal` namespace, where `foo` is the namespace your project normally
+uses, and put the private declarations in a `*-internal.h` file. Your
+production `.cc` files and your tests are allowed to include this internal
+header, but your clients are not. This way, you can fully test your internal
+implementation without leaking it to your clients.
+
+## Private Class Members ##
+
+Private class members are only accessible from within the class or by friends.
+To access a class' private members, you can declare your test fixture as a
+friend to the class and define accessors in your fixture. Tests using the
+fixture can then access the private members of your production class via the
+accessors in the fixture. Note that even though your fixture is a friend to
+your production class, your tests are not automatically friends to it, as they
+are technically defined in sub-classes of the fixture.
+
+Another way to test private members is to refactor them into an implementation
+class, which is then declared in a `*-internal.h` file. Your clients aren't
+allowed to include this header but your tests can. Such is called the Pimpl
+(Private Implementation) idiom.
+
+Or, you can declare an individual test as a friend of your class by adding this
+line in the class body:
+
+```
+FRIEND_TEST(TestCaseName, TestName);
+```
+
+For example,
+```
+// foo.h
+#include "gtest/gtest_prod.h"
+
+// Defines FRIEND_TEST.
+class Foo {
+  ...
+ private:
+  FRIEND_TEST(FooTest, BarReturnsZeroOnNull);
+  int Bar(void* x);
+};
+
+// foo_test.cc
+...
+TEST(FooTest, BarReturnsZeroOnNull) {
+  Foo foo;
+  EXPECT_EQ(0, foo.Bar(NULL));
+  // Uses Foo's private member Bar().
+}
+```
+
+Pay special attention when your class is defined in a namespace, as you should
+define your test fixtures and tests in the same namespace if you want them to
+be friends of your class. For example, if the code to be tested looks like:
+
+```
+namespace my_namespace {
+
+class Foo {
+  friend class FooTest;
+  FRIEND_TEST(FooTest, Bar);
+  FRIEND_TEST(FooTest, Baz);
+  ...
+  definition of the class Foo
+  ...
+};
+
+}  // namespace my_namespace
+```
+
+Your test code should be something like:
+
+```
+namespace my_namespace {
+class FooTest : public ::testing::Test {
+ protected:
+  ...
+};
+
+TEST_F(FooTest, Bar) { ... }
+TEST_F(FooTest, Baz) { ... }
+
+}  // namespace my_namespace
+```
+
+# Catching Failures #
+
+If you are building a testing utility on top of Google Test, you'll
+want to test your utility.  What framework would you use to test it?
+Google Test, of course.
+
+The challenge is to verify that your testing utility reports failures
+correctly.  In frameworks that report a failure by throwing an
+exception, you could catch the exception and assert on it.  But Google
+Test doesn't use exceptions, so how do we test that a piece of code
+generates an expected failure?
+
+`"gtest/gtest-spi.h"` contains some constructs to do this.  After
+`#include`ing this header, you can use
+
+| `EXPECT_FATAL_FAILURE(`_statement, substring_`);` |
+|:--------------------------------------------------|
+
+to assert that _statement_ generates a fatal (e.g. `ASSERT_*`) failure
+whose message contains the given _substring_, or use
+
+| `EXPECT_NONFATAL_FAILURE(`_statement, substring_`);` |
+|:-----------------------------------------------------|
+
+if you are expecting a non-fatal (e.g. `EXPECT_*`) failure.
+
+For technical reasons, there are some caveats:
+
+  1. You cannot stream a failure message to either macro.
+  1. _statement_ in `EXPECT_FATAL_FAILURE()` cannot reference local non-static variables or non-static members of `this` object.
+  1. _statement_ in `EXPECT_FATAL_FAILURE()` cannot return a value.
+
+_Note:_ Google Test is designed with threads in mind.  Once the
+synchronization primitives in `"gtest/internal/gtest-port.h"` have
+been implemented, Google Test will become thread-safe, meaning that
+you can then use assertions in multiple threads concurrently.  Before
+
+that, however, Google Test only supports single-threaded usage.  Once
+thread-safe, `EXPECT_FATAL_FAILURE()` and `EXPECT_NONFATAL_FAILURE()`
+will capture failures in the current thread only. If _statement_
+creates new threads, failures in these threads will be ignored.  If
+you want to capture failures from all threads instead, you should use
+the following macros:
+
+| `EXPECT_FATAL_FAILURE_ON_ALL_THREADS(`_statement, substring_`);` |
+|:-----------------------------------------------------------------|
+| `EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(`_statement, substring_`);` |
+
+# Getting the Current Test's Name #
+
+Sometimes a function may need to know the name of the currently running test.
+For example, you may be using the `SetUp()` method of your test fixture to set
+the golden file name based on which test is running. The `::testing::TestInfo`
+class has this information:
+
+```
+namespace testing {
+
+class TestInfo {
+ public:
+  // Returns the test case name and the test name, respectively.
+  //
+  // Do NOT delete or free the return value - it's managed by the
+  // TestInfo class.
+  const char* test_case_name() const;
+  const char* name() const;
+};
+
+}  // namespace testing
+```
+
+
+> To obtain a `TestInfo` object for the currently running test, call
+`current_test_info()` on the `UnitTest` singleton object:
+
+```
+// Gets information about the currently running test.
+// Do NOT delete the returned object - it's managed by the UnitTest class.
+const ::testing::TestInfo* const test_info =
+  ::testing::UnitTest::GetInstance()->current_test_info();
+printf("We are in test %s of test case %s.\n",
+       test_info->name(), test_info->test_case_name());
+```
+
+`current_test_info()` returns a null pointer if no test is running. In
+particular, you cannot find the test case name in `TestCaseSetUp()`,
+`TestCaseTearDown()` (where you know the test case name implicitly), or
+functions called from them.
+
+_Availability:_ Linux, Windows, Mac.
+
+# Extending Google Test by Handling Test Events #
+
+Google Test provides an <b>event listener API</b> to let you receive
+notifications about the progress of a test program and test
+failures. The events you can listen to include the start and end of
+the test program, a test case, or a test method, among others. You may
+use this API to augment or replace the standard console output,
+replace the XML output, or provide a completely different form of
+output, such as a GUI or a database. You can also use test events as
+checkpoints to implement a resource leak checker, for example.
+
+_Availability:_ Linux, Windows, Mac; since v1.4.0.
+
+## Defining Event Listeners ##
+
+To define a event listener, you subclass either
+[testing::TestEventListener](../include/gtest/gtest.h#L855)
+or [testing::EmptyTestEventListener](../include/gtest/gtest.h#L905).
+The former is an (abstract) interface, where <i>each pure virtual method<br>
+can be overridden to handle a test event</i> (For example, when a test
+starts, the `OnTestStart()` method will be called.). The latter provides
+an empty implementation of all methods in the interface, such that a
+subclass only needs to override the methods it cares about.
+
+When an event is fired, its context is passed to the handler function
+as an argument. The following argument types are used:
+  * [UnitTest](../include/gtest/gtest.h#L1007) reflects the state of the entire test program,
+  * [TestCase](../include/gtest/gtest.h#L689) has information about a test case, which can contain one or more tests,
+  * [TestInfo](../include/gtest/gtest.h#L599) contains the state of a test, and
+  * [TestPartResult](../include/gtest/gtest-test-part.h#L42) represents the result of a test assertion.
+
+An event handler function can examine the argument it receives to find
+out interesting information about the event and the test program's
+state.  Here's an example:
+
+```
+  class MinimalistPrinter : public ::testing::EmptyTestEventListener {
+    // Called before a test starts.
+    virtual void OnTestStart(const ::testing::TestInfo& test_info) {
+      printf("*** Test %s.%s starting.\n",
+             test_info.test_case_name(), test_info.name());
+    }
+
+    // Called after a failed assertion or a SUCCEED() invocation.
+    virtual void OnTestPartResult(
+        const ::testing::TestPartResult& test_part_result) {
+      printf("%s in %s:%d\n%s\n",
+             test_part_result.failed() ? "*** Failure" : "Success",
+             test_part_result.file_name(),
+             test_part_result.line_number(),
+             test_part_result.summary());
+    }
+
+    // Called after a test ends.
+    virtual void OnTestEnd(const ::testing::TestInfo& test_info) {
+      printf("*** Test %s.%s ending.\n",
+             test_info.test_case_name(), test_info.name());
+    }
+  };
+```
+
+## Using Event Listeners ##
+
+To use the event listener you have defined, add an instance of it to
+the Google Test event listener list (represented by class
+[TestEventListeners](../include/gtest/gtest.h#L929)
+- note the "s" at the end of the name) in your
+`main()` function, before calling `RUN_ALL_TESTS()`:
+```
+int main(int argc, char** argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  // Gets hold of the event listener list.
+  ::testing::TestEventListeners& listeners =
+      ::testing::UnitTest::GetInstance()->listeners();
+  // Adds a listener to the end.  Google Test takes the ownership.
+  listeners.Append(new MinimalistPrinter);
+  return RUN_ALL_TESTS();
+}
+```
+
+There's only one problem: the default test result printer is still in
+effect, so its output will mingle with the output from your minimalist
+printer. To suppress the default printer, just release it from the
+event listener list and delete it. You can do so by adding one line:
+```
+  ...
+  delete listeners.Release(listeners.default_result_printer());
+  listeners.Append(new MinimalistPrinter);
+  return RUN_ALL_TESTS();
+```
+
+Now, sit back and enjoy a completely different output from your
+tests. For more details, you can read this
+[sample](../samples/sample9_unittest.cc).
+
+You may append more than one listener to the list. When an `On*Start()`
+or `OnTestPartResult()` event is fired, the listeners will receive it in
+the order they appear in the list (since new listeners are added to
+the end of the list, the default text printer and the default XML
+generator will receive the event first). An `On*End()` event will be
+received by the listeners in the _reverse_ order. This allows output by
+listeners added later to be framed by output from listeners added
+earlier.
+
+## Generating Failures in Listeners ##
+
+You may use failure-raising macros (`EXPECT_*()`, `ASSERT_*()`,
+`FAIL()`, etc) when processing an event. There are some restrictions:
+
+  1. You cannot generate any failure in `OnTestPartResult()` (otherwise it will cause `OnTestPartResult()` to be called recursively).
+  1. A listener that handles `OnTestPartResult()` is not allowed to generate any failure.
+
+When you add listeners to the listener list, you should put listeners
+that handle `OnTestPartResult()` _before_ listeners that can generate
+failures. This ensures that failures generated by the latter are
+attributed to the right test by the former.
+
+We have a sample of failure-raising listener
+[here](../samples/sample10_unittest.cc).
+
+# Running Test Programs: Advanced Options #
+
+Google Test test programs are ordinary executables. Once built, you can run
+them directly and affect their behavior via the following environment variables
+and/or command line flags. For the flags to work, your programs must call
+`::testing::InitGoogleTest()` before calling `RUN_ALL_TESTS()`.
+
+To see a list of supported flags and their usage, please run your test
+program with the `--help` flag.  You can also use `-h`, `-?`, or `/?`
+for short.  This feature is added in version 1.3.0.
+
+If an option is specified both by an environment variable and by a
+flag, the latter takes precedence.  Most of the options can also be
+set/read in code: to access the value of command line flag
+`--gtest_foo`, write `::testing::GTEST_FLAG(foo)`.  A common pattern is
+to set the value of a flag before calling `::testing::InitGoogleTest()`
+to change the default value of the flag:
+```
+int main(int argc, char** argv) {
+  // Disables elapsed time by default.
+  ::testing::GTEST_FLAG(print_time) = false;
+
+  // This allows the user to override the flag on the command line.
+  ::testing::InitGoogleTest(&argc, argv);
+
+  return RUN_ALL_TESTS();
+}
+```
+
+## Selecting Tests ##
+
+This section shows various options for choosing which tests to run.
+
+### Listing Test Names ###
+
+Sometimes it is necessary to list the available tests in a program before
+running them so that a filter may be applied if needed. Including the flag
+`--gtest_list_tests` overrides all other flags and lists tests in the following
+format:
+```
+TestCase1.
+  TestName1
+  TestName2
+TestCase2.
+  TestName
+```
+
+None of the tests listed are actually run if the flag is provided. There is no
+corresponding environment variable for this flag.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Running a Subset of the Tests ###
+
+By default, a Google Test program runs all tests the user has defined.
+Sometimes, you want to run only a subset of the tests (e.g. for debugging or
+quickly verifying a change). If you set the `GTEST_FILTER` environment variable
+or the `--gtest_filter` flag to a filter string, Google Test will only run the
+tests whose full names (in the form of `TestCaseName.TestName`) match the
+filter.
+
+The format of a filter is a '`:`'-separated list of wildcard patterns (called
+the positive patterns) optionally followed by a '`-`' and another
+'`:`'-separated pattern list (called the negative patterns). A test matches the
+filter if and only if it matches any of the positive patterns but does not
+match any of the negative patterns.
+
+A pattern may contain `'*'` (matches any string) or `'?'` (matches any single
+character). For convenience, the filter `'*-NegativePatterns'` can be also
+written as `'-NegativePatterns'`.
+
+For example:
+
+  * `./foo_test` Has no flag, and thus runs all its tests.
+  * `./foo_test --gtest_filter=*` Also runs everything, due to the single match-everything `*` value.
+  * `./foo_test --gtest_filter=FooTest.*` Runs everything in test case `FooTest`.
+  * `./foo_test --gtest_filter=*Null*:*Constructor*` Runs any test whose full name contains either `"Null"` or `"Constructor"`.
+  * `./foo_test --gtest_filter=-*DeathTest.*` Runs all non-death tests.
+  * `./foo_test --gtest_filter=FooTest.*-FooTest.Bar` Runs everything in test case `FooTest` except `FooTest.Bar`.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Temporarily Disabling Tests ###
+
+If you have a broken test that you cannot fix right away, you can add the
+`DISABLED_` prefix to its name. This will exclude it from execution. This is
+better than commenting out the code or using `#if 0`, as disabled tests are
+still compiled (and thus won't rot).
+
+If you need to disable all tests in a test case, you can either add `DISABLED_`
+to the front of the name of each test, or alternatively add it to the front of
+the test case name.
+
+For example, the following tests won't be run by Google Test, even though they
+will still be compiled:
+
+```
+// Tests that Foo does Abc.
+TEST(FooTest, DISABLED_DoesAbc) { ... }
+
+class DISABLED_BarTest : public ::testing::Test { ... };
+
+// Tests that Bar does Xyz.
+TEST_F(DISABLED_BarTest, DoesXyz) { ... }
+```
+
+_Note:_ This feature should only be used for temporary pain-relief. You still
+have to fix the disabled tests at a later date. As a reminder, Google Test will
+print a banner warning you if a test program contains any disabled tests.
+
+_Tip:_ You can easily count the number of disabled tests you have
+using `grep`. This number can be used as a metric for improving your
+test quality.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Temporarily Enabling Disabled Tests ###
+
+To include [disabled tests](#temporarily-disabling-tests) in test
+execution, just invoke the test program with the
+`--gtest_also_run_disabled_tests` flag or set the
+`GTEST_ALSO_RUN_DISABLED_TESTS` environment variable to a value other
+than `0`.  You can combine this with the
+[--gtest\_filter](#running-a-subset-of-the-tests) flag to further select
+which disabled tests to run.
+
+_Availability:_ Linux, Windows, Mac; since version 1.3.0.
+
+## Repeating the Tests ##
+
+Once in a while you'll run into a test whose result is hit-or-miss. Perhaps it
+will fail only 1% of the time, making it rather hard to reproduce the bug under
+a debugger. This can be a major source of frustration.
+
+The `--gtest_repeat` flag allows you to repeat all (or selected) test methods
+in a program many times. Hopefully, a flaky test will eventually fail and give
+you a chance to debug. Here's how to use it:
+
+| `$ foo_test --gtest_repeat=1000` | Repeat foo\_test 1000 times and don't stop at failures. |
+|:---------------------------------|:--------------------------------------------------------|
+| `$ foo_test --gtest_repeat=-1`   | A negative count means repeating forever.               |
+| `$ foo_test --gtest_repeat=1000 --gtest_break_on_failure` | Repeat foo\_test 1000 times, stopping at the first failure. This is especially useful when running under a debugger: when the testfails, it will drop into the debugger and you can then inspect variables and stacks. |
+| `$ foo_test --gtest_repeat=1000 --gtest_filter=FooBar` | Repeat the tests whose name matches the filter 1000 times. |
+
+If your test program contains global set-up/tear-down code registered
+using `AddGlobalTestEnvironment()`, it will be repeated in each
+iteration as well, as the flakiness may be in it. You can also specify
+the repeat count by setting the `GTEST_REPEAT` environment variable.
+
+_Availability:_ Linux, Windows, Mac.
+
+## Shuffling the Tests ##
+
+You can specify the `--gtest_shuffle` flag (or set the `GTEST_SHUFFLE`
+environment variable to `1`) to run the tests in a program in a random
+order. This helps to reveal bad dependencies between tests.
+
+By default, Google Test uses a random seed calculated from the current
+time. Therefore you'll get a different order every time. The console
+output includes the random seed value, such that you can reproduce an
+order-related test failure later. To specify the random seed
+explicitly, use the `--gtest_random_seed=SEED` flag (or set the
+`GTEST_RANDOM_SEED` environment variable), where `SEED` is an integer
+between 0 and 99999. The seed value 0 is special: it tells Google Test
+to do the default behavior of calculating the seed from the current
+time.
+
+If you combine this with `--gtest_repeat=N`, Google Test will pick a
+different random seed and re-shuffle the tests in each iteration.
+
+_Availability:_ Linux, Windows, Mac; since v1.4.0.
+
+## Controlling Test Output ##
+
+This section teaches how to tweak the way test results are reported.
+
+### Colored Terminal Output ###
+
+Google Test can use colors in its terminal output to make it easier to spot
+the separation between tests, and whether tests passed.
+
+You can set the GTEST\_COLOR environment variable or set the `--gtest_color`
+command line flag to `yes`, `no`, or `auto` (the default) to enable colors,
+disable colors, or let Google Test decide. When the value is `auto`, Google
+Test will use colors if and only if the output goes to a terminal and (on
+non-Windows platforms) the `TERM` environment variable is set to `xterm` or
+`xterm-color`.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Suppressing the Elapsed Time ###
+
+By default, Google Test prints the time it takes to run each test.  To
+suppress that, run the test program with the `--gtest_print_time=0`
+command line flag.  Setting the `GTEST_PRINT_TIME` environment
+variable to `0` has the same effect.
+
+_Availability:_ Linux, Windows, Mac.  (In Google Test 1.3.0 and lower,
+the default behavior is that the elapsed time is **not** printed.)
+
+### Generating an XML Report ###
+
+Google Test can emit a detailed XML report to a file in addition to its normal
+textual output. The report contains the duration of each test, and thus can
+help you identify slow tests.
+
+To generate the XML report, set the `GTEST_OUTPUT` environment variable or the
+`--gtest_output` flag to the string `"xml:_path_to_output_file_"`, which will
+create the file at the given location. You can also just use the string
+`"xml"`, in which case the output can be found in the `test_detail.xml` file in
+the current directory.
+
+If you specify a directory (for example, `"xml:output/directory/"` on Linux or
+`"xml:output\directory\"` on Windows), Google Test will create the XML file in
+that directory, named after the test executable (e.g. `foo_test.xml` for test
+program `foo_test` or `foo_test.exe`). If the file already exists (perhaps left
+over from a previous run), Google Test will pick a different name (e.g.
+`foo_test_1.xml`) to avoid overwriting it.
+
+The report uses the format described here.  It is based on the
+`junitreport` Ant task and can be parsed by popular continuous build
+systems like [Jenkins](http://jenkins-ci.org/). Since that format
+was originally intended for Java, a little interpretation is required
+to make it apply to Google Test tests, as shown here:
+
+```
+<testsuites name="AllTests" ...>
+  <testsuite name="test_case_name" ...>
+    <testcase name="test_name" ...>
+      <failure message="..."/>
+      <failure message="..."/>
+      <failure message="..."/>
+    </testcase>
+  </testsuite>
+</testsuites>
+```
+
+  * The root `<testsuites>` element corresponds to the entire test program.
+  * `<testsuite>` elements correspond to Google Test test cases.
+  * `<testcase>` elements correspond to Google Test test functions.
+
+For instance, the following program
+
+```
+TEST(MathTest, Addition) { ... }
+TEST(MathTest, Subtraction) { ... }
+TEST(LogicTest, NonContradiction) { ... }
+```
+
+could generate this report:
+
+```
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuites tests="3" failures="1" errors="0" time="35" name="AllTests">
+  <testsuite name="MathTest" tests="2" failures="1" errors="0" time="15">
+    <testcase name="Addition" status="run" time="7" classname="">
+      <failure message="Value of: add(1, 1)&#x0A; Actual: 3&#x0A;Expected: 2" type=""/>
+      <failure message="Value of: add(1, -1)&#x0A; Actual: 1&#x0A;Expected: 0" type=""/>
+    </testcase>
+    <testcase name="Subtraction" status="run" time="5" classname="">
+    </testcase>
+  </testsuite>
+  <testsuite name="LogicTest" tests="1" failures="0" errors="0" time="5">
+    <testcase name="NonContradiction" status="run" time="5" classname="">
+    </testcase>
+  </testsuite>
+</testsuites>
+```
+
+Things to note:
+
+  * The `tests` attribute of a `<testsuites>` or `<testsuite>` element tells how many test functions the Google Test program or test case contains, while the `failures` attribute tells how many of them failed.
+  * The `time` attribute expresses the duration of the test, test case, or entire test program in milliseconds.
+  * Each `<failure>` element corresponds to a single failed Google Test assertion.
+  * Some JUnit concepts don't apply to Google Test, yet we have to conform to the DTD. Therefore you'll see some dummy elements and attributes in the report. You can safely ignore these parts.
+
+_Availability:_ Linux, Windows, Mac.
+
+## Controlling How Failures Are Reported ##
+
+### Turning Assertion Failures into Break-Points ###
+
+When running test programs under a debugger, it's very convenient if the
+debugger can catch an assertion failure and automatically drop into interactive
+mode. Google Test's _break-on-failure_ mode supports this behavior.
+
+To enable it, set the `GTEST_BREAK_ON_FAILURE` environment variable to a value
+other than `0` . Alternatively, you can use the `--gtest_break_on_failure`
+command line flag.
+
+_Availability:_ Linux, Windows, Mac.
+
+### Disabling Catching Test-Thrown Exceptions ###
+
+Google Test can be used either with or without exceptions enabled.  If
+a test throws a C++ exception or (on Windows) a structured exception
+(SEH), by default Google Test catches it, reports it as a test
+failure, and continues with the next test method.  This maximizes the
+coverage of a test run.  Also, on Windows an uncaught exception will
+cause a pop-up window, so catching the exceptions allows you to run
+the tests automatically.
+
+When debugging the test failures, however, you may instead want the
+exceptions to be handled by the debugger, such that you can examine
+the call stack when an exception is thrown.  To achieve that, set the
+`GTEST_CATCH_EXCEPTIONS` environment variable to `0`, or use the
+`--gtest_catch_exceptions=0` flag when running the tests.
+
+**Availability**: Linux, Windows, Mac.
+
+### Letting Another Testing Framework Drive ###
+
+If you work on a project that has already been using another testing
+framework and is not ready to completely switch to Google Test yet,
+you can get much of Google Test's benefit by using its assertions in
+your existing tests.  Just change your `main()` function to look
+like:
+
+```
+#include "gtest/gtest.h"
+
+int main(int argc, char** argv) {
+  ::testing::GTEST_FLAG(throw_on_failure) = true;
+  // Important: Google Test must be initialized.
+  ::testing::InitGoogleTest(&argc, argv);
+
+  ... whatever your existing testing framework requires ...
+}
+```
+
+With that, you can use Google Test assertions in addition to the
+native assertions your testing framework provides, for example:
+
+```
+void TestFooDoesBar() {
+  Foo foo;
+  EXPECT_LE(foo.Bar(1), 100);     // A Google Test assertion.
+  CPPUNIT_ASSERT(foo.IsEmpty());  // A native assertion.
+}
+```
+
+If a Google Test assertion fails, it will print an error message and
+throw an exception, which will be treated as a failure by your host
+testing framework.  If you compile your code with exceptions disabled,
+a failed Google Test assertion will instead exit your program with a
+non-zero code, which will also signal a test failure to your test
+runner.
+
+If you don't write `::testing::GTEST_FLAG(throw_on_failure) = true;` in
+your `main()`, you can alternatively enable this feature by specifying
+the `--gtest_throw_on_failure` flag on the command-line or setting the
+`GTEST_THROW_ON_FAILURE` environment variable to a non-zero value.
+
+Death tests are _not_ supported when other test framework is used to organize tests.
+
+_Availability:_ Linux, Windows, Mac; since v1.3.0.
+
+## Distributing Test Functions to Multiple Machines ##
+
+If you have more than one machine you can use to run a test program,
+you might want to run the test functions in parallel and get the
+result faster.  We call this technique _sharding_, where each machine
+is called a _shard_.
+
+Google Test is compatible with test sharding.  To take advantage of
+this feature, your test runner (not part of Google Test) needs to do
+the following:
+
+  1. Allocate a number of machines (shards) to run the tests.
+  1. On each shard, set the `GTEST_TOTAL_SHARDS` environment variable to the total number of shards.  It must be the same for all shards.
+  1. On each shard, set the `GTEST_SHARD_INDEX` environment variable to the index of the shard.  Different shards must be assigned different indices, which must be in the range `[0, GTEST_TOTAL_SHARDS - 1]`.
+  1. Run the same test program on all shards.  When Google Test sees the above two environment variables, it will select a subset of the test functions to run.  Across all shards, each test function in the program will be run exactly once.
+  1. Wait for all shards to finish, then collect and report the results.
+
+Your project may have tests that were written without Google Test and
+thus don't understand this protocol.  In order for your test runner to
+figure out which test supports sharding, it can set the environment
+variable `GTEST_SHARD_STATUS_FILE` to a non-existent file path.  If a
+test program supports sharding, it will create this file to
+acknowledge the fact (the actual contents of the file are not
+important at this time; although we may stick some useful information
+in it in the future.); otherwise it will not create it.
+
+Here's an example to make it clear.  Suppose you have a test program
+`foo_test` that contains the following 5 test functions:
+```
+TEST(A, V)
+TEST(A, W)
+TEST(B, X)
+TEST(B, Y)
+TEST(B, Z)
+```
+and you have 3 machines at your disposal.  To run the test functions in
+parallel, you would set `GTEST_TOTAL_SHARDS` to 3 on all machines, and
+set `GTEST_SHARD_INDEX` to 0, 1, and 2 on the machines respectively.
+Then you would run the same `foo_test` on each machine.
+
+Google Test reserves the right to change how the work is distributed
+across the shards, but here's one possible scenario:
+
+  * Machine #0 runs `A.V` and `B.X`.
+  * Machine #1 runs `A.W` and `B.Y`.
+  * Machine #2 runs `B.Z`.
+
+_Availability:_ Linux, Windows, Mac; since version 1.3.0.
+
+# Fusing Google Test Source Files #
+
+Google Test's implementation consists of ~30 files (excluding its own
+tests).  Sometimes you may want them to be packaged up in two files (a
+`.h` and a `.cc`) instead, such that you can easily copy them to a new
+machine and start hacking there.  For this we provide an experimental
+Python script `fuse_gtest_files.py` in the `scripts/` directory (since release 1.3.0).
+Assuming you have Python 2.4 or above installed on your machine, just
+go to that directory and run
+```
+python fuse_gtest_files.py OUTPUT_DIR
+```
+
+and you should see an `OUTPUT_DIR` directory being created with files
+`gtest/gtest.h` and `gtest/gtest-all.cc` in it.  These files contain
+everything you need to use Google Test.  Just copy them to anywhere
+you want and you are ready to write tests.  You can use the
+[scripts/test/Makefile](../scripts/test/Makefile)
+file as an example on how to compile your tests against them.
+
+# Where to Go from Here #
+
+Congratulations! You've now learned more advanced Google Test tools and are
+ready to tackle more complex testing tasks. If you want to dive even deeper, you
+can read the [Frequently-Asked Questions](V1_7_FAQ.md).
diff --git a/docs/V1_7_Documentation.md b/docs/V1_7_Documentation.md
new file mode 100755 (executable)
index 0000000..282697a
--- /dev/null
@@ -0,0 +1,14 @@
+This page lists all documentation wiki pages for Google Test **(the SVN trunk version)**
+-- **if you use a released version of Google Test, please read the
+documentation for that specific version instead.**
+
+  * [Primer](V1_7_Primer.md) -- start here if you are new to Google Test.
+  * [Samples](V1_7_Samples.md) -- learn from examples.
+  * [AdvancedGuide](V1_7_AdvancedGuide.md) -- learn more about Google Test.
+  * [XcodeGuide](V1_7_XcodeGuide.md) -- how to use Google Test in Xcode on Mac.
+  * [Frequently-Asked Questions](V1_7_FAQ.md) -- check here before asking a question on the mailing list.
+
+To contribute code to Google Test, read:
+
+  * [DevGuide](DevGuide.md) -- read this _before_ writing your first patch.
+  * [PumpManual](V1_7_PumpManual.md) -- how we generate some of Google Test's source files.
\ No newline at end of file
diff --git a/docs/V1_7_FAQ.md b/docs/V1_7_FAQ.md
new file mode 100755 (executable)
index 0000000..3dd914d
--- /dev/null
@@ -0,0 +1,1082 @@
+
+
+If you cannot find the answer to your question here, and you have read
+[Primer](V1_7_Primer.md) and [AdvancedGuide](V1_7_AdvancedGuide.md), send it to
+googletestframework@googlegroups.com.
+
+## Why should I use Google Test instead of my favorite C++ testing framework? ##
+
+First, let us say clearly that we don't want to get into the debate of
+which C++ testing framework is **the best**.  There exist many fine
+frameworks for writing C++ tests, and we have tremendous respect for
+the developers and users of them.  We don't think there is (or will
+be) a single best framework - you have to pick the right tool for the
+particular task you are tackling.
+
+We created Google Test because we couldn't find the right combination
+of features and conveniences in an existing framework to satisfy _our_
+needs.  The following is a list of things that _we_ like about Google
+Test.  We don't claim them to be unique to Google Test - rather, the
+combination of them makes Google Test the choice for us.  We hope this
+list can help you decide whether it is for you too.
+
+  * Google Test is designed to be portable: it doesn't require exceptions or RTTI; it works around various bugs in various compilers and environments; etc.  As a result, it works on Linux, Mac OS X, Windows and several embedded operating systems.
+  * Nonfatal assertions (`EXPECT_*`) have proven to be great time savers, as they allow a test to report multiple failures in a single edit-compile-test cycle.
+  * It's easy to write assertions that generate informative messages: you just use the stream syntax to append any additional information, e.g. `ASSERT_EQ(5, Foo(i)) << " where i = " << i;`.  It doesn't require a new set of macros or special functions.
+  * Google Test automatically detects your tests and doesn't require you to enumerate them in order to run them.
+  * Death tests are pretty handy for ensuring that your asserts in production code are triggered by the right conditions.
+  * `SCOPED_TRACE` helps you understand the context of an assertion failure when it comes from inside a sub-routine or loop.
+  * You can decide which tests to run using name patterns.  This saves time when you want to quickly reproduce a test failure.
+  * Google Test can generate XML test result reports that can be parsed by popular continuous build system like Hudson.
+  * Simple things are easy in Google Test, while hard things are possible: in addition to advanced features like [global test environments](V1_7_AdvancedGuide.md#global-set-up-and-tear-down) and tests parameterized by [values](V1_7_AdvancedGuide.md#value-parameterized-tests) or [types](V1_7_AdvancedGuide.md#typed-tests), Google Test supports various ways for the user to extend the framework -- if Google Test doesn't do something out of the box, chances are that a user can implement the feature using Google Test's public API, without changing Google Test itself.  In particular, you can:
+    * expand your testing vocabulary by defining [custom predicates](V1_7_AdvancedGuide.md#predicate-assertions-for-better-error-messages),
+    * teach Google Test how to [print your types](V1_7_AdvancedGuide.md#teaching-google-test-how-to-print-your-values),
+    * define your own testing macros or utilities and verify them using Google Test's [Service Provider Interface](V1_7_AdvancedGuide.md#catching-failures), and
+    * reflect on the test cases or change the test output format by intercepting the [test events](V1_7_AdvancedGuide.md#extending-google-test-by-handling-test-events).
+
+## I'm getting warnings when compiling Google Test.  Would you fix them? ##
+
+We strive to minimize compiler warnings Google Test generates.  Before releasing a new version, we test to make sure that it doesn't generate warnings when compiled using its CMake script on Windows, Linux, and Mac OS.
+
+Unfortunately, this doesn't mean you are guaranteed to see no warnings when compiling Google Test in your environment:
+
+  * You may be using a different compiler as we use, or a different version of the same compiler.  We cannot possibly test for all compilers.
+  * You may be compiling on a different platform as we do.
+  * Your project may be using different compiler flags as we do.
+
+It is not always possible to make Google Test warning-free for everyone.  Or, it may not be desirable if the warning is rarely enabled and fixing the violations makes the code more complex.
+
+If you see warnings when compiling Google Test, we suggest that you use the `-isystem` flag (assuming your are using GCC) to mark Google Test headers as system headers.  That'll suppress warnings from Google Test headers.
+
+## Why should not test case names and test names contain underscore? ##
+
+Underscore (`_`) is special, as C++ reserves the following to be used by
+the compiler and the standard library:
+
+  1. any identifier that starts with an `_` followed by an upper-case letter, and
+  1. any identifier that containers two consecutive underscores (i.e. `__`) _anywhere_ in its name.
+
+User code is _prohibited_ from using such identifiers.
+
+Now let's look at what this means for `TEST` and `TEST_F`.
+
+Currently `TEST(TestCaseName, TestName)` generates a class named
+`TestCaseName_TestName_Test`.  What happens if `TestCaseName` or `TestName`
+contains `_`?
+
+  1. If `TestCaseName` starts with an `_` followed by an upper-case letter (say, `_Foo`), we end up with `_Foo_TestName_Test`, which is reserved and thus invalid.
+  1. If `TestCaseName` ends with an `_` (say, `Foo_`), we get `Foo__TestName_Test`, which is invalid.
+  1. If `TestName` starts with an `_` (say, `_Bar`), we get `TestCaseName__Bar_Test`, which is invalid.
+  1. If `TestName` ends with an `_` (say, `Bar_`), we get `TestCaseName_Bar__Test`, which is invalid.
+
+So clearly `TestCaseName` and `TestName` cannot start or end with `_`
+(Actually, `TestCaseName` can start with `_` -- as long as the `_` isn't
+followed by an upper-case letter.  But that's getting complicated.  So
+for simplicity we just say that it cannot start with `_`.).
+
+It may seem fine for `TestCaseName` and `TestName` to contain `_` in the
+middle.  However, consider this:
+```
+TEST(Time, Flies_Like_An_Arrow) { ... }
+TEST(Time_Flies, Like_An_Arrow) { ... }
+```
+
+Now, the two `TEST`s will both generate the same class
+(`Time_Files_Like_An_Arrow_Test`).  That's not good.
+
+So for simplicity, we just ask the users to avoid `_` in `TestCaseName`
+and `TestName`.  The rule is more constraining than necessary, but it's
+simple and easy to remember.  It also gives Google Test some wiggle
+room in case its implementation needs to change in the future.
+
+If you violate the rule, there may not be immediately consequences,
+but your test may (just may) break with a new compiler (or a new
+version of the compiler you are using) or with a new version of Google
+Test.  Therefore it's best to follow the rule.
+
+## Why is it not recommended to install a pre-compiled copy of Google Test (for example, into /usr/local)? ##
+
+In the early days, we said that you could install
+compiled Google Test libraries on `*`nix systems using `make install`.
+Then every user of your machine can write tests without
+recompiling Google Test.
+
+This seemed like a good idea, but it has a
+got-cha: every user needs to compile his tests using the _same_ compiler
+flags used to compile the installed Google Test libraries; otherwise
+he may run into undefined behaviors (i.e. the tests can behave
+strangely and may even crash for no obvious reasons).
+
+Why?  Because C++ has this thing called the One-Definition Rule: if
+two C++ source files contain different definitions of the same
+class/function/variable, and you link them together, you violate the
+rule.  The linker may or may not catch the error (in many cases it's
+not required by the C++ standard to catch the violation).  If it
+doesn't, you get strange run-time behaviors that are unexpected and
+hard to debug.
+
+If you compile Google Test and your test code using different compiler
+flags, they may see different definitions of the same
+class/function/variable (e.g. due to the use of `#if` in Google Test).
+Therefore, for your sanity, we recommend to avoid installing pre-compiled
+Google Test libraries.  Instead, each project should compile
+Google Test itself such that it can be sure that the same flags are
+used for both Google Test and the tests.
+
+## How do I generate 64-bit binaries on Windows (using Visual Studio 2008)? ##
+
+(Answered by Trevor Robinson)
+
+Load the supplied Visual Studio solution file, either `msvc\gtest-md.sln` or
+`msvc\gtest.sln`. Go through the migration wizard to migrate the
+solution and project files to Visual Studio 2008. Select
+`Configuration Manager...` from the `Build` menu. Select `<New...>` from
+the `Active solution platform` dropdown.  Select `x64` from the new
+platform dropdown, leave `Copy settings from` set to `Win32` and
+`Create new project platforms` checked, then click `OK`. You now have
+`Win32` and `x64` platform configurations, selectable from the
+`Standard` toolbar, which allow you to toggle between building 32-bit or
+64-bit binaries (or both at once using Batch Build).
+
+In order to prevent build output files from overwriting one another,
+you'll need to change the `Intermediate Directory` settings for the
+newly created platform configuration across all the projects. To do
+this, multi-select (e.g. using shift-click) all projects (but not the
+solution) in the `Solution Explorer`. Right-click one of them and
+select `Properties`. In the left pane, select `Configuration Properties`,
+and from the `Configuration` dropdown, select `All Configurations`.
+Make sure the selected platform is `x64`. For the
+`Intermediate Directory` setting, change the value from
+`$(PlatformName)\$(ConfigurationName)` to
+`$(OutDir)\$(ProjectName)`. Click `OK` and then build the
+solution. When the build is complete, the 64-bit binaries will be in
+the `msvc\x64\Debug` directory.
+
+## Can I use Google Test on MinGW? ##
+
+We haven't tested this ourselves, but Per Abrahamsen reported that he
+was able to compile and install Google Test successfully when using
+MinGW from Cygwin.  You'll need to configure it with:
+
+`PATH/TO/configure CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin"`
+
+You should be able to replace the `-mno-cygwin` option with direct links
+to the real MinGW binaries, but we haven't tried that.
+
+Caveats:
+
+  * There are many warnings when compiling.
+  * `make check` will produce some errors as not all tests for Google Test itself are compatible with MinGW.
+
+We also have reports on successful cross compilation of Google Test
+MinGW binaries on Linux using
+[these instructions](http://wiki.wxwidgets.org/Cross-Compiling_Under_Linux#Cross-compiling_under_Linux_for_MS_Windows)
+on the WxWidgets site.
+
+Please contact `googletestframework@googlegroups.com` if you are
+interested in improving the support for MinGW.
+
+## Why does Google Test support EXPECT\_EQ(NULL, ptr) and ASSERT\_EQ(NULL, ptr) but not EXPECT\_NE(NULL, ptr) and ASSERT\_NE(NULL, ptr)? ##
+
+Due to some peculiarity of C++, it requires some non-trivial template
+meta programming tricks to support using `NULL` as an argument of the
+`EXPECT_XX()` and `ASSERT_XX()` macros. Therefore we only do it where
+it's most needed (otherwise we make the implementation of Google Test
+harder to maintain and more error-prone than necessary).
+
+The `EXPECT_EQ()` macro takes the _expected_ value as its first
+argument and the _actual_ value as the second. It's reasonable that
+someone wants to write `EXPECT_EQ(NULL, some_expression)`, and this
+indeed was requested several times. Therefore we implemented it.
+
+The need for `EXPECT_NE(NULL, ptr)` isn't nearly as strong. When the
+assertion fails, you already know that `ptr` must be `NULL`, so it
+doesn't add any information to print ptr in this case. That means
+`EXPECT_TRUE(ptr != NULL)` works just as well.
+
+If we were to support `EXPECT_NE(NULL, ptr)`, for consistency we'll
+have to support `EXPECT_NE(ptr, NULL)` as well, as unlike `EXPECT_EQ`,
+we don't have a convention on the order of the two arguments for
+`EXPECT_NE`. This means using the template meta programming tricks
+twice in the implementation, making it even harder to understand and
+maintain. We believe the benefit doesn't justify the cost.
+
+Finally, with the growth of Google Mock's [matcher](../../CookBook.md#using-matchers-in-google-test-assertions) library, we are
+encouraging people to use the unified `EXPECT_THAT(value, matcher)`
+syntax more often in tests. One significant advantage of the matcher
+approach is that matchers can be easily combined to form new matchers,
+while the `EXPECT_NE`, etc, macros cannot be easily
+combined. Therefore we want to invest more in the matchers than in the
+`EXPECT_XX()` macros.
+
+## Does Google Test support running tests in parallel? ##
+
+Test runners tend to be tightly coupled with the build/test
+environment, and Google Test doesn't try to solve the problem of
+running tests in parallel.  Instead, we tried to make Google Test work
+nicely with test runners.  For example, Google Test's XML report
+contains the time spent on each test, and its `gtest_list_tests` and
+`gtest_filter` flags can be used for splitting the execution of test
+methods into multiple processes.  These functionalities can help the
+test runner run the tests in parallel.
+
+## Why don't Google Test run the tests in different threads to speed things up? ##
+
+It's difficult to write thread-safe code.  Most tests are not written
+with thread-safety in mind, and thus may not work correctly in a
+multi-threaded setting.
+
+If you think about it, it's already hard to make your code work when
+you know what other threads are doing.  It's much harder, and
+sometimes even impossible, to make your code work when you don't know
+what other threads are doing (remember that test methods can be added,
+deleted, or modified after your test was written).  If you want to run
+the tests in parallel, you'd better run them in different processes.
+
+## Why aren't Google Test assertions implemented using exceptions? ##
+
+Our original motivation was to be able to use Google Test in projects
+that disable exceptions.  Later we realized some additional benefits
+of this approach:
+
+  1. Throwing in a destructor is undefined behavior in C++.  Not using exceptions means Google Test's assertions are safe to use in destructors.
+  1. The `EXPECT_*` family of macros will continue even after a failure, allowing multiple failures in a `TEST` to be reported in a single run. This is a popular feature, as in C++ the edit-compile-test cycle is usually quite long and being able to fixing more than one thing at a time is a blessing.
+  1. If assertions are implemented using exceptions, a test may falsely ignore a failure if it's caught by user code:
+```
+try { ... ASSERT_TRUE(...) ... }
+catch (...) { ... }
+```
+The above code will pass even if the `ASSERT_TRUE` throws.  While it's unlikely for someone to write this in a test, it's possible to run into this pattern when you write assertions in callbacks that are called by the code under test.
+
+The downside of not using exceptions is that `ASSERT_*` (implemented
+using `return`) will only abort the current function, not the current
+`TEST`.
+
+## Why do we use two different macros for tests with and without fixtures? ##
+
+Unfortunately, C++'s macro system doesn't allow us to use the same
+macro for both cases.  One possibility is to provide only one macro
+for tests with fixtures, and require the user to define an empty
+fixture sometimes:
+
+```
+class FooTest : public ::testing::Test {};
+
+TEST_F(FooTest, DoesThis) { ... }
+```
+or
+```
+typedef ::testing::Test FooTest;
+
+TEST_F(FooTest, DoesThat) { ... }
+```
+
+Yet, many people think this is one line too many. :-) Our goal was to
+make it really easy to write tests, so we tried to make simple tests
+trivial to create.  That means using a separate macro for such tests.
+
+We think neither approach is ideal, yet either of them is reasonable.
+In the end, it probably doesn't matter much either way.
+
+## Why don't we use structs as test fixtures? ##
+
+We like to use structs only when representing passive data.  This
+distinction between structs and classes is good for documenting the
+intent of the code's author.  Since test fixtures have logic like
+`SetUp()` and `TearDown()`, they are better defined as classes.
+
+## Why are death tests implemented as assertions instead of using a test runner? ##
+
+Our goal was to make death tests as convenient for a user as C++
+possibly allows.  In particular:
+
+  * The runner-style requires to split the information into two pieces: the definition of the death test itself, and the specification for the runner on how to run the death test and what to expect.  The death test would be written in C++, while the runner spec may or may not be.  A user needs to carefully keep the two in sync. `ASSERT_DEATH(statement, expected_message)` specifies all necessary information in one place, in one language, without boilerplate code. It is very declarative.
+  * `ASSERT_DEATH` has a similar syntax and error-reporting semantics as other Google Test assertions, and thus is easy to learn.
+  * `ASSERT_DEATH` can be mixed with other assertions and other logic at your will.  You are not limited to one death test per test method. For example, you can write something like:
+```
+    if (FooCondition()) {
+      ASSERT_DEATH(Bar(), "blah");
+    } else {
+      ASSERT_EQ(5, Bar());
+    }
+```
+If you prefer one death test per test method, you can write your tests in that style too, but we don't want to impose that on the users.  The fewer artificial limitations the better.
+  * `ASSERT_DEATH` can reference local variables in the current function, and you can decide how many death tests you want based on run-time information.  For example,
+```
+    const int count = GetCount();  // Only known at run time.
+    for (int i = 1; i <= count; i++) {
+      ASSERT_DEATH({
+        double* buffer = new double[i];
+        ... initializes buffer ...
+        Foo(buffer, i)
+      }, "blah blah");
+    }
+```
+The runner-based approach tends to be more static and less flexible, or requires more user effort to get this kind of flexibility.
+
+Another interesting thing about `ASSERT_DEATH` is that it calls `fork()`
+to create a child process to run the death test.  This is lightening
+fast, as `fork()` uses copy-on-write pages and incurs almost zero
+overhead, and the child process starts from the user-supplied
+statement directly, skipping all global and local initialization and
+any code leading to the given statement.  If you launch the child
+process from scratch, it can take seconds just to load everything and
+start running if the test links to many libraries dynamically.
+
+## My death test modifies some state, but the change seems lost after the death test finishes. Why? ##
+
+Death tests (`EXPECT_DEATH`, etc) are executed in a sub-process s.t. the
+expected crash won't kill the test program (i.e. the parent process). As a
+result, any in-memory side effects they incur are observable in their
+respective sub-processes, but not in the parent process. You can think of them
+as running in a parallel universe, more or less.
+
+## The compiler complains about "undefined references" to some static const member variables, but I did define them in the class body. What's wrong? ##
+
+If your class has a static data member:
+
+```
+// foo.h
+class Foo {
+  ...
+  static const int kBar = 100;
+};
+```
+
+You also need to define it _outside_ of the class body in `foo.cc`:
+
+```
+const int Foo::kBar;  // No initializer here.
+```
+
+Otherwise your code is **invalid C++**, and may break in unexpected ways. In
+particular, using it in Google Test comparison assertions (`EXPECT_EQ`, etc)
+will generate an "undefined reference" linker error.
+
+## I have an interface that has several implementations. Can I write a set of tests once and repeat them over all the implementations? ##
+
+Google Test doesn't yet have good support for this kind of tests, or
+data-driven tests in general. We hope to be able to make improvements in this
+area soon.
+
+## Can I derive a test fixture from another? ##
+
+Yes.
+
+Each test fixture has a corresponding and same named test case. This means only
+one test case can use a particular fixture. Sometimes, however, multiple test
+cases may want to use the same or slightly different fixtures. For example, you
+may want to make sure that all of a GUI library's test cases don't leak
+important system resources like fonts and brushes.
+
+In Google Test, you share a fixture among test cases by putting the shared
+logic in a base test fixture, then deriving from that base a separate fixture
+for each test case that wants to use this common logic. You then use `TEST_F()`
+to write tests using each derived fixture.
+
+Typically, your code looks like this:
+
+```
+// Defines a base test fixture.
+class BaseTest : public ::testing::Test {
+  protected:
+   ...
+};
+
+// Derives a fixture FooTest from BaseTest.
+class FooTest : public BaseTest {
+  protected:
+    virtual void SetUp() {
+      BaseTest::SetUp();  // Sets up the base fixture first.
+      ... additional set-up work ...
+    }
+    virtual void TearDown() {
+      ... clean-up work for FooTest ...
+      BaseTest::TearDown();  // Remember to tear down the base fixture
+                             // after cleaning up FooTest!
+    }
+    ... functions and variables for FooTest ...
+};
+
+// Tests that use the fixture FooTest.
+TEST_F(FooTest, Bar) { ... }
+TEST_F(FooTest, Baz) { ... }
+
+... additional fixtures derived from BaseTest ...
+```
+
+If necessary, you can continue to derive test fixtures from a derived fixture.
+Google Test has no limit on how deep the hierarchy can be.
+
+For a complete example using derived test fixtures, see
+[sample5](../samples/sample5_unittest.cc).
+
+## My compiler complains "void value not ignored as it ought to be." What does this mean? ##
+
+You're probably using an `ASSERT_*()` in a function that doesn't return `void`.
+`ASSERT_*()` can only be used in `void` functions.
+
+## My death test hangs (or seg-faults). How do I fix it? ##
+
+In Google Test, death tests are run in a child process and the way they work is
+delicate. To write death tests you really need to understand how they work.
+Please make sure you have read this.
+
+In particular, death tests don't like having multiple threads in the parent
+process. So the first thing you can try is to eliminate creating threads
+outside of `EXPECT_DEATH()`.
+
+Sometimes this is impossible as some library you must use may be creating
+threads before `main()` is even reached. In this case, you can try to minimize
+the chance of conflicts by either moving as many activities as possible inside
+`EXPECT_DEATH()` (in the extreme case, you want to move everything inside), or
+leaving as few things as possible in it. Also, you can try to set the death
+test style to `"threadsafe"`, which is safer but slower, and see if it helps.
+
+If you go with thread-safe death tests, remember that they rerun the test
+program from the beginning in the child process. Therefore make sure your
+program can run side-by-side with itself and is deterministic.
+
+In the end, this boils down to good concurrent programming. You have to make
+sure that there is no race conditions or dead locks in your program. No silver
+bullet - sorry!
+
+## Should I use the constructor/destructor of the test fixture or the set-up/tear-down function? ##
+
+The first thing to remember is that Google Test does not reuse the
+same test fixture object across multiple tests. For each `TEST_F`,
+Google Test will create a fresh test fixture object, _immediately_
+call `SetUp()`, run the test, call `TearDown()`, and then
+_immediately_ delete the test fixture object. Therefore, there is no
+need to write a `SetUp()` or `TearDown()` function if the constructor
+or destructor already does the job.
+
+You may still want to use `SetUp()/TearDown()` in the following cases:
+  * If the tear-down operation could throw an exception, you must use `TearDown()` as opposed to the destructor, as throwing in a destructor leads to undefined behavior and usually will kill your program right away. Note that many standard libraries (like STL) may throw when exceptions are enabled in the compiler. Therefore you should prefer `TearDown()` if you want to write portable tests that work with or without exceptions.
+  * The assertion macros throw an exception when flag `--gtest_throw_on_failure` is specified. Therefore, you shouldn't use Google Test assertions in a destructor if you plan to run your tests with this flag.
+  * In a constructor or destructor, you cannot make a virtual function call on this object. (You can call a method declared as virtual, but it will be statically bound.) Therefore, if you need to call a method that will be overriden in a derived class, you have to use `SetUp()/TearDown()`.
+
+## The compiler complains "no matching function to call" when I use ASSERT\_PREDn. How do I fix it? ##
+
+If the predicate function you use in `ASSERT_PRED*` or `EXPECT_PRED*` is
+overloaded or a template, the compiler will have trouble figuring out which
+overloaded version it should use. `ASSERT_PRED_FORMAT*` and
+`EXPECT_PRED_FORMAT*` don't have this problem.
+
+If you see this error, you might want to switch to
+`(ASSERT|EXPECT)_PRED_FORMAT*`, which will also give you a better failure
+message. If, however, that is not an option, you can resolve the problem by
+explicitly telling the compiler which version to pick.
+
+For example, suppose you have
+
+```
+bool IsPositive(int n) {
+  return n > 0;
+}
+bool IsPositive(double x) {
+  return x > 0;
+}
+```
+
+you will get a compiler error if you write
+
+```
+EXPECT_PRED1(IsPositive, 5);
+```
+
+However, this will work:
+
+```
+EXPECT_PRED1(*static_cast<bool (*)(int)>*(IsPositive), 5);
+```
+
+(The stuff inside the angled brackets for the `static_cast` operator is the
+type of the function pointer for the `int`-version of `IsPositive()`.)
+
+As another example, when you have a template function
+
+```
+template <typename T>
+bool IsNegative(T x) {
+  return x < 0;
+}
+```
+
+you can use it in a predicate assertion like this:
+
+```
+ASSERT_PRED1(IsNegative*<int>*, -5);
+```
+
+Things are more interesting if your template has more than one parameters. The
+following won't compile:
+
+```
+ASSERT_PRED2(*GreaterThan<int, int>*, 5, 0);
+```
+
+
+as the C++ pre-processor thinks you are giving `ASSERT_PRED2` 4 arguments,
+which is one more than expected. The workaround is to wrap the predicate
+function in parentheses:
+
+```
+ASSERT_PRED2(*(GreaterThan<int, int>)*, 5, 0);
+```
+
+
+## My compiler complains about "ignoring return value" when I call RUN\_ALL\_TESTS(). Why? ##
+
+Some people had been ignoring the return value of `RUN_ALL_TESTS()`. That is,
+instead of
+
+```
+return RUN_ALL_TESTS();
+```
+
+they write
+
+```
+RUN_ALL_TESTS();
+```
+
+This is wrong and dangerous. A test runner needs to see the return value of
+`RUN_ALL_TESTS()` in order to determine if a test has passed. If your `main()`
+function ignores it, your test will be considered successful even if it has a
+Google Test assertion failure. Very bad.
+
+To help the users avoid this dangerous bug, the implementation of
+`RUN_ALL_TESTS()` causes gcc to raise this warning, when the return value is
+ignored. If you see this warning, the fix is simple: just make sure its value
+is used as the return value of `main()`.
+
+## My compiler complains that a constructor (or destructor) cannot return a value. What's going on? ##
+
+Due to a peculiarity of C++, in order to support the syntax for streaming
+messages to an `ASSERT_*`, e.g.
+
+```
+ASSERT_EQ(1, Foo()) << "blah blah" << foo;
+```
+
+we had to give up using `ASSERT*` and `FAIL*` (but not `EXPECT*` and
+`ADD_FAILURE*`) in constructors and destructors. The workaround is to move the
+content of your constructor/destructor to a private void member function, or
+switch to `EXPECT_*()` if that works. This section in the user's guide explains
+it.
+
+## My set-up function is not called. Why? ##
+
+C++ is case-sensitive. It should be spelled as `SetUp()`.  Did you
+spell it as `Setup()`?
+
+Similarly, sometimes people spell `SetUpTestCase()` as `SetupTestCase()` and
+wonder why it's never called.
+
+## How do I jump to the line of a failure in Emacs directly? ##
+
+Google Test's failure message format is understood by Emacs and many other
+IDEs, like acme and XCode. If a Google Test message is in a compilation buffer
+in Emacs, then it's clickable. You can now hit `enter` on a message to jump to
+the corresponding source code, or use `C-x `` to jump to the next failure.
+
+## I have several test cases which share the same test fixture logic, do I have to define a new test fixture class for each of them? This seems pretty tedious. ##
+
+You don't have to. Instead of
+
+```
+class FooTest : public BaseTest {};
+
+TEST_F(FooTest, Abc) { ... }
+TEST_F(FooTest, Def) { ... }
+
+class BarTest : public BaseTest {};
+
+TEST_F(BarTest, Abc) { ... }
+TEST_F(BarTest, Def) { ... }
+```
+
+you can simply `typedef` the test fixtures:
+```
+typedef BaseTest FooTest;
+
+TEST_F(FooTest, Abc) { ... }
+TEST_F(FooTest, Def) { ... }
+
+typedef BaseTest BarTest;
+
+TEST_F(BarTest, Abc) { ... }
+TEST_F(BarTest, Def) { ... }
+```
+
+## The Google Test output is buried in a whole bunch of log messages. What do I do? ##
+
+The Google Test output is meant to be a concise and human-friendly report. If
+your test generates textual output itself, it will mix with the Google Test
+output, making it hard to read. However, there is an easy solution to this
+problem.
+
+Since most log messages go to stderr, we decided to let Google Test output go
+to stdout. This way, you can easily separate the two using redirection. For
+example:
+```
+./my_test > googletest_output.txt
+```
+
+## Why should I prefer test fixtures over global variables? ##
+
+There are several good reasons:
+  1. It's likely your test needs to change the states of its global variables. This makes it difficult to keep side effects from escaping one test and contaminating others, making debugging difficult. By using fixtures, each test has a fresh set of variables that's different (but with the same names). Thus, tests are kept independent of each other.
+  1. Global variables pollute the global namespace.
+  1. Test fixtures can be reused via subclassing, which cannot be done easily with global variables. This is useful if many test cases have something in common.
+
+## How do I test private class members without writing FRIEND\_TEST()s? ##
+
+You should try to write testable code, which means classes should be easily
+tested from their public interface. One way to achieve this is the Pimpl idiom:
+you move all private members of a class into a helper class, and make all
+members of the helper class public.
+
+You have several other options that don't require using `FRIEND_TEST`:
+  * Write the tests as members of the fixture class:
+```
+class Foo {
+  friend class FooTest;
+  ...
+};
+
+class FooTest : public ::testing::Test {
+ protected:
+  ...
+  void Test1() {...} // This accesses private members of class Foo.
+  void Test2() {...} // So does this one.
+};
+
+TEST_F(FooTest, Test1) {
+  Test1();
+}
+
+TEST_F(FooTest, Test2) {
+  Test2();
+}
+```
+  * In the fixture class, write accessors for the tested class' private members, then use the accessors in your tests:
+```
+class Foo {
+  friend class FooTest;
+  ...
+};
+
+class FooTest : public ::testing::Test {
+ protected:
+  ...
+  T1 get_private_member1(Foo* obj) {
+    return obj->private_member1_;
+  }
+};
+
+TEST_F(FooTest, Test1) {
+  ...
+  get_private_member1(x)
+  ...
+}
+```
+  * If the methods are declared **protected**, you can change their access level in a test-only subclass:
+```
+class YourClass {
+  ...
+ protected: // protected access for testability.
+  int DoSomethingReturningInt();
+  ...
+};
+
+// in the your_class_test.cc file:
+class TestableYourClass : public YourClass {
+  ...
+ public: using YourClass::DoSomethingReturningInt; // changes access rights
+  ...
+};
+
+TEST_F(YourClassTest, DoSomethingTest) {
+  TestableYourClass obj;
+  assertEquals(expected_value, obj.DoSomethingReturningInt());
+}
+```
+
+## How do I test private class static members without writing FRIEND\_TEST()s? ##
+
+We find private static methods clutter the header file.  They are
+implementation details and ideally should be kept out of a .h. So often I make
+them free functions instead.
+
+Instead of:
+```
+// foo.h
+class Foo {
+  ...
+ private:
+  static bool Func(int n);
+};
+
+// foo.cc
+bool Foo::Func(int n) { ... }
+
+// foo_test.cc
+EXPECT_TRUE(Foo::Func(12345));
+```
+
+You probably should better write:
+```
+// foo.h
+class Foo {
+  ...
+};
+
+// foo.cc
+namespace internal {
+  bool Func(int n) { ... }
+}
+
+// foo_test.cc
+namespace internal {
+  bool Func(int n);
+}
+
+EXPECT_TRUE(internal::Func(12345));
+```
+
+## I would like to run a test several times with different parameters. Do I need to write several similar copies of it? ##
+
+No. You can use a feature called [value-parameterized tests](V1_7_AdvancedGuide.md#Value_Parameterized_Tests) which
+lets you repeat your tests with different parameters, without defining it more than once.
+
+## How do I test a file that defines main()? ##
+
+To test a `foo.cc` file, you need to compile and link it into your unit test
+program. However, when the file contains a definition for the `main()`
+function, it will clash with the `main()` of your unit test, and will result in
+a build error.
+
+The right solution is to split it into three files:
+  1. `foo.h` which contains the declarations,
+  1. `foo.cc` which contains the definitions except `main()`, and
+  1. `foo_main.cc` which contains nothing but the definition of `main()`.
+
+Then `foo.cc` can be easily tested.
+
+If you are adding tests to an existing file and don't want an intrusive change
+like this, there is a hack: just include the entire `foo.cc` file in your unit
+test. For example:
+```
+// File foo_unittest.cc
+
+// The headers section
+...
+
+// Renames main() in foo.cc to make room for the unit test main()
+#define main FooMain
+
+#include "a/b/foo.cc"
+
+// The tests start here.
+...
+```
+
+
+However, please remember this is a hack and should only be used as the last
+resort.
+
+## What can the statement argument in ASSERT\_DEATH() be? ##
+
+`ASSERT_DEATH(_statement_, _regex_)` (or any death assertion macro) can be used
+wherever `_statement_` is valid. So basically `_statement_` can be any C++
+statement that makes sense in the current context. In particular, it can
+reference global and/or local variables, and can be:
+  * a simple function call (often the case),
+  * a complex expression, or
+  * a compound statement.
+
+> Some examples are shown here:
+
+```
+// A death test can be a simple function call.
+TEST(MyDeathTest, FunctionCall) {
+  ASSERT_DEATH(Xyz(5), "Xyz failed");
+}
+
+// Or a complex expression that references variables and functions.
+TEST(MyDeathTest, ComplexExpression) {
+  const bool c = Condition();
+  ASSERT_DEATH((c ? Func1(0) : object2.Method("test")),
+               "(Func1|Method) failed");
+}
+
+// Death assertions can be used any where in a function. In
+// particular, they can be inside a loop.
+TEST(MyDeathTest, InsideLoop) {
+  // Verifies that Foo(0), Foo(1), ..., and Foo(4) all die.
+  for (int i = 0; i < 5; i++) {
+    EXPECT_DEATH_M(Foo(i), "Foo has \\d+ errors",
+                   ::testing::Message() << "where i is " << i);
+  }
+}
+
+// A death assertion can contain a compound statement.
+TEST(MyDeathTest, CompoundStatement) {
+  // Verifies that at lease one of Bar(0), Bar(1), ..., and
+  // Bar(4) dies.
+  ASSERT_DEATH({
+    for (int i = 0; i < 5; i++) {
+      Bar(i);
+    }
+  },
+  "Bar has \\d+ errors");}
+```
+
+`googletest_unittest.cc` contains more examples if you are interested.
+
+## What syntax does the regular expression in ASSERT\_DEATH use? ##
+
+On POSIX systems, Google Test uses the POSIX Extended regular
+expression syntax
+(http://en.wikipedia.org/wiki/Regular_expression#POSIX_Extended_Regular_Expressions).
+On Windows, it uses a limited variant of regular expression
+syntax. For more details, see the
+[regular expression syntax](V1_7_AdvancedGuide.md#Regular_Expression_Syntax).
+
+## I have a fixture class Foo, but TEST\_F(Foo, Bar) gives me error "no matching function for call to Foo::Foo()". Why? ##
+
+Google Test needs to be able to create objects of your test fixture class, so
+it must have a default constructor. Normally the compiler will define one for
+you. However, there are cases where you have to define your own:
+  * If you explicitly declare a non-default constructor for class `Foo`, then you need to define a default constructor, even if it would be empty.
+  * If `Foo` has a const non-static data member, then you have to define the default constructor _and_ initialize the const member in the initializer list of the constructor. (Early versions of `gcc` doesn't force you to initialize the const member. It's a bug that has been fixed in `gcc 4`.)
+
+## Why does ASSERT\_DEATH complain about previous threads that were already joined? ##
+
+With the Linux pthread library, there is no turning back once you cross the
+line from single thread to multiple threads. The first time you create a
+thread, a manager thread is created in addition, so you get 3, not 2, threads.
+Later when the thread you create joins the main thread, the thread count
+decrements by 1, but the manager thread will never be killed, so you still have
+2 threads, which means you cannot safely run a death test.
+
+The new NPTL thread library doesn't suffer from this problem, as it doesn't
+create a manager thread. However, if you don't control which machine your test
+runs on, you shouldn't depend on this.
+
+## Why does Google Test require the entire test case, instead of individual tests, to be named FOODeathTest when it uses ASSERT\_DEATH? ##
+
+Google Test does not interleave tests from different test cases. That is, it
+runs all tests in one test case first, and then runs all tests in the next test
+case, and so on. Google Test does this because it needs to set up a test case
+before the first test in it is run, and tear it down afterwords. Splitting up
+the test case would require multiple set-up and tear-down processes, which is
+inefficient and makes the semantics unclean.
+
+If we were to determine the order of tests based on test name instead of test
+case name, then we would have a problem with the following situation:
+
+```
+TEST_F(FooTest, AbcDeathTest) { ... }
+TEST_F(FooTest, Uvw) { ... }
+
+TEST_F(BarTest, DefDeathTest) { ... }
+TEST_F(BarTest, Xyz) { ... }
+```
+
+Since `FooTest.AbcDeathTest` needs to run before `BarTest.Xyz`, and we don't
+interleave tests from different test cases, we need to run all tests in the
+`FooTest` case before running any test in the `BarTest` case. This contradicts
+with the requirement to run `BarTest.DefDeathTest` before `FooTest.Uvw`.
+
+## But I don't like calling my entire test case FOODeathTest when it contains both death tests and non-death tests. What do I do? ##
+
+You don't have to, but if you like, you may split up the test case into
+`FooTest` and `FooDeathTest`, where the names make it clear that they are
+related:
+
+```
+class FooTest : public ::testing::Test { ... };
+
+TEST_F(FooTest, Abc) { ... }
+TEST_F(FooTest, Def) { ... }
+
+typedef FooTest FooDeathTest;
+
+TEST_F(FooDeathTest, Uvw) { ... EXPECT_DEATH(...) ... }
+TEST_F(FooDeathTest, Xyz) { ... ASSERT_DEATH(...) ... }
+```
+
+## The compiler complains about "no match for 'operator<<'" when I use an assertion. What gives? ##
+
+If you use a user-defined type `FooType` in an assertion, you must make sure
+there is an `std::ostream& operator<<(std::ostream&, const FooType&)` function
+defined such that we can print a value of `FooType`.
+
+In addition, if `FooType` is declared in a name space, the `<<` operator also
+needs to be defined in the _same_ name space.
+
+## How do I suppress the memory leak messages on Windows? ##
+
+Since the statically initialized Google Test singleton requires allocations on
+the heap, the Visual C++ memory leak detector will report memory leaks at the
+end of the program run. The easiest way to avoid this is to use the
+`_CrtMemCheckpoint` and `_CrtMemDumpAllObjectsSince` calls to not report any
+statically initialized heap objects. See MSDN for more details and additional
+heap check/debug routines.
+
+## I am building my project with Google Test in Visual Studio and all I'm getting is a bunch of linker errors (or warnings). Help! ##
+
+You may get a number of the following linker error or warnings if you
+attempt to link your test project with the Google Test library when
+your project and the are not built using the same compiler settings.
+
+  * LNK2005: symbol already defined in object
+  * LNK4217: locally defined symbol 'symbol' imported in function 'function'
+  * LNK4049: locally defined symbol 'symbol' imported
+
+The Google Test project (gtest.vcproj) has the Runtime Library option
+set to /MT (use multi-threaded static libraries, /MTd for debug). If
+your project uses something else, for example /MD (use multi-threaded
+DLLs, /MDd for debug), you need to change the setting in the Google
+Test project to match your project's.
+
+To update this setting open the project properties in the Visual
+Studio IDE then select the branch Configuration Properties | C/C++ |
+Code Generation and change the option "Runtime Library".  You may also try
+using gtest-md.vcproj instead of gtest.vcproj.
+
+## I put my tests in a library and Google Test doesn't run them. What's happening? ##
+Have you read a
+[warning](V1_7_Primer.md#important-note-for-visual-c-users) on
+the Google Test Primer page?
+
+## I want to use Google Test with Visual Studio but don't know where to start. ##
+Many people are in your position and one of the posted his solution to
+our mailing list. Here is his link:
+http://hassanjamilahmad.blogspot.com/2009/07/gtest-starters-help.html.
+
+## I am seeing compile errors mentioning std::type\_traits when I try to use Google Test on Solaris. ##
+Google Test uses parts of the standard C++ library that SunStudio does not support.
+Our users reported success using alternative implementations. Try running the build after runing this commad:
+
+`export CC=cc CXX=CC CXXFLAGS='-library=stlport4'`
+
+## How can my code detect if it is running in a test? ##
+
+If you write code that sniffs whether it's running in a test and does
+different things accordingly, you are leaking test-only logic into
+production code and there is no easy way to ensure that the test-only
+code paths aren't run by mistake in production.  Such cleverness also
+leads to
+[Heisenbugs](http://en.wikipedia.org/wiki/Unusual_software_bug#Heisenbug).
+Therefore we strongly advise against the practice, and Google Test doesn't
+provide a way to do it.
+
+In general, the recommended way to cause the code to behave
+differently under test is [dependency injection](http://jamesshore.com/Blog/Dependency-Injection-Demystified.html).
+You can inject different functionality from the test and from the
+production code.  Since your production code doesn't link in the
+for-test logic at all, there is no danger in accidentally running it.
+
+However, if you _really_, _really_, _really_ have no choice, and if
+you follow the rule of ending your test program names with `_test`,
+you can use the _horrible_ hack of sniffing your executable name
+(`argv[0]` in `main()`) to know whether the code is under test.
+
+## Google Test defines a macro that clashes with one defined by another library. How do I deal with that? ##
+
+In C++, macros don't obey namespaces.  Therefore two libraries that
+both define a macro of the same name will clash if you `#include` both
+definitions.  In case a Google Test macro clashes with another
+library, you can force Google Test to rename its macro to avoid the
+conflict.
+
+Specifically, if both Google Test and some other code define macro
+`FOO`, you can add
+```
+  -DGTEST_DONT_DEFINE_FOO=1
+```
+to the compiler flags to tell Google Test to change the macro's name
+from `FOO` to `GTEST_FOO`. For example, with `-DGTEST_DONT_DEFINE_TEST=1`, you'll need to write
+```
+  GTEST_TEST(SomeTest, DoesThis) { ... }
+```
+instead of
+```
+  TEST(SomeTest, DoesThis) { ... }
+```
+in order to define a test.
+
+Currently, the following `TEST`, `FAIL`, `SUCCEED`, and the basic comparison assertion macros can have alternative names. You can see the full list of covered macros [here](http://www.google.com/codesearch?q=if+!GTEST_DONT_DEFINE_\w%2B+package:http://googletest\.googlecode\.com+file:/include/gtest/gtest.h). More information can be found in the "Avoiding Macro Name Clashes" section of the README file.
+
+
+## Is it OK if I have two separate `TEST(Foo, Bar)` test methods defined in different namespaces? ##
+
+Yes.
+
+The rule is **all test methods in the same test case must use the same fixture class**. This means that the following is **allowed** because both tests use the same fixture class (`::testing::Test`).
+
+```
+namespace foo {
+TEST(CoolTest, DoSomething) {
+  SUCCEED();
+}
+}  // namespace foo
+
+namespace bar {
+TEST(CoolTest, DoSomething) {
+  SUCCEED();
+}
+}  // namespace foo
+```
+
+However, the following code is **not allowed** and will produce a runtime error from Google Test because the test methods are using different test fixture classes with the same test case name.
+
+```
+namespace foo {
+class CoolTest : public ::testing::Test {};  // Fixture foo::CoolTest
+TEST_F(CoolTest, DoSomething) {
+  SUCCEED();
+}
+}  // namespace foo
+
+namespace bar {
+class CoolTest : public ::testing::Test {};  // Fixture: bar::CoolTest
+TEST_F(CoolTest, DoSomething) {
+  SUCCEED();
+}
+}  // namespace foo
+```
+
+## How do I build Google Testing Framework with Xcode 4? ##
+
+If you try to build Google Test's Xcode project with Xcode 4.0 or later, you may encounter an error message that looks like
+"Missing SDK in target gtest\_framework: /Developer/SDKs/MacOSX10.4u.sdk". That means that Xcode does not support the SDK the project is targeting. See the Xcode section in the [README](../../README.MD) file on how to resolve this.
+
+## My question is not covered in your FAQ! ##
+
+If you cannot find the answer to your question in this FAQ, there are
+some other resources you can use:
+
+  1. read other [wiki pages](http://code.google.com/p/googletest/w/list),
+  1. search the mailing list [archive](http://groups.google.com/group/googletestframework/topics),
+  1. ask it on [googletestframework@googlegroups.com](mailto:googletestframework@googlegroups.com) and someone will answer it (to prevent spam, we require you to join the [discussion group](http://groups.google.com/group/googletestframework) before you can post.).
+
+Please note that creating an issue in the
+[issue tracker](http://code.google.com/p/googletest/issues/list) is _not_
+a good way to get your answer, as it is monitored infrequently by a
+very small number of people.
+
+When asking a question, it's helpful to provide as much of the
+following information as possible (people cannot help you if there's
+not enough information in your question):
+
+  * the version (or the revision number if you check out from SVN directly) of Google Test you use (Google Test is under active development, so it's possible that your problem has been solved in a later version),
+  * your operating system,
+  * the name and version of your compiler,
+  * the complete command line flags you give to your compiler,
+  * the complete compiler error messages (if the question is about compilation),
+  * the _actual_ code (ideally, a minimal but complete program) that has the problem you encounter.
diff --git a/docs/V1_7_Primer.md b/docs/V1_7_Primer.md
new file mode 100755 (executable)
index 0000000..b1827c7
--- /dev/null
@@ -0,0 +1,501 @@
+
+
+# Introduction: Why Google C++ Testing Framework? #
+
+_Google C++ Testing Framework_ helps you write better C++ tests.
+
+No matter whether you work on Linux, Windows, or a Mac, if you write C++ code,
+Google Test can help you.
+
+So what makes a good test, and how does Google C++ Testing Framework fit in? We believe:
+  1. Tests should be _independent_ and _repeatable_. It's a pain to debug a test that succeeds or fails as a result of other tests.  Google C++ Testing Framework isolates the tests by running each of them on a different object. When a test fails, Google C++ Testing Framework allows you to run it in isolation for quick debugging.
+  1. Tests should be well _organized_ and reflect the structure of the tested code.  Google C++ Testing Framework groups related tests into test cases that can share data and subroutines. This common pattern is easy to recognize and makes tests easy to maintain. Such consistency is especially helpful when people switch projects and start to work on a new code base.
+  1. Tests should be _portable_ and _reusable_. The open-source community has a lot of code that is platform-neutral, its tests should also be platform-neutral.  Google C++ Testing Framework works on different OSes, with different compilers (gcc, MSVC, and others), with or without exceptions, so Google C++ Testing Framework tests can easily work with a variety of configurations.  (Note that the current release only contains build scripts for Linux - we are actively working on scripts for other platforms.)
+  1. When tests fail, they should provide as much _information_ about the problem as possible. Google C++ Testing Framework doesn't stop at the first test failure. Instead, it only stops the current test and continues with the next. You can also set up tests that report non-fatal failures after which the current test continues. Thus, you can detect and fix multiple bugs in a single run-edit-compile cycle.
+  1. The testing framework should liberate test writers from housekeeping chores and let them focus on the test _content_.  Google C++ Testing Framework automatically keeps track of all tests defined, and doesn't require the user to enumerate them in order to run them.
+  1. Tests should be _fast_. With Google C++ Testing Framework, you can reuse shared resources across tests and pay for the set-up/tear-down only once, without making tests depend on each other.
+
+Since Google C++ Testing Framework is based on the popular xUnit
+architecture, you'll feel right at home if you've used JUnit or PyUnit before.
+If not, it will take you about 10 minutes to learn the basics and get started.
+So let's go!
+
+_Note:_ We sometimes refer to Google C++ Testing Framework informally
+as _Google Test_.
+
+# Setting up a New Test Project #
+
+To write a test program using Google Test, you need to compile Google
+Test into a library and link your test with it.  We provide build
+files for some popular build systems: `msvc/` for Visual Studio,
+`xcode/` for Mac Xcode, `make/` for GNU make, `codegear/` for Borland
+C++ Builder, and the autotools script (deprecated) and
+`CMakeLists.txt` for CMake (recommended) in the Google Test root
+directory.  If your build system is not on this list, you can take a
+look at `make/Makefile` to learn how Google Test should be compiled
+(basically you want to compile `src/gtest-all.cc` with `GTEST_ROOT`
+and `GTEST_ROOT/include` in the header search path, where `GTEST_ROOT`
+is the Google Test root directory).
+
+Once you are able to compile the Google Test library, you should
+create a project or build target for your test program.  Make sure you
+have `GTEST_ROOT/include` in the header search path so that the
+compiler can find `"gtest/gtest.h"` when compiling your test.  Set up
+your test project to link with the Google Test library (for example,
+in Visual Studio, this is done by adding a dependency on
+`gtest.vcproj`).
+
+If you still have questions, take a look at how Google Test's own
+tests are built and use them as examples.
+
+# Basic Concepts #
+
+When using Google Test, you start by writing _assertions_, which are statements
+that check whether a condition is true. An assertion's result can be _success_,
+_nonfatal failure_, or _fatal failure_. If a fatal failure occurs, it aborts
+the current function; otherwise the program continues normally.
+
+_Tests_ use assertions to verify the tested code's behavior. If a test crashes
+or has a failed assertion, then it _fails_; otherwise it _succeeds_.
+
+A _test case_ contains one or many tests. You should group your tests into test
+cases that reflect the structure of the tested code. When multiple tests in a
+test case need to share common objects and subroutines, you can put them into a
+_test fixture_ class.
+
+A _test program_ can contain multiple test cases.
+
+We'll now explain how to write a test program, starting at the individual
+assertion level and building up to tests and test cases.
+
+# Assertions #
+
+Google Test assertions are macros that resemble function calls. You test a
+class or function by making assertions about its behavior. When an assertion
+fails, Google Test prints the assertion's source file and line number location,
+along with a failure message. You may also supply a custom failure message
+which will be appended to Google Test's message.
+
+The assertions come in pairs that test the same thing but have different
+effects on the current function. `ASSERT_*` versions generate fatal failures
+when they fail, and **abort the current function**. `EXPECT_*` versions generate
+nonfatal failures, which don't abort the current function. Usually `EXPECT_*`
+are preferred, as they allow more than one failures to be reported in a test.
+However, you should use `ASSERT_*` if it doesn't make sense to continue when
+the assertion in question fails.
+
+Since a failed `ASSERT_*` returns from the current function immediately,
+possibly skipping clean-up code that comes after it, it may cause a space leak.
+Depending on the nature of the leak, it may or may not be worth fixing - so
+keep this in mind if you get a heap checker error in addition to assertion
+errors.
+
+To provide a custom failure message, simply stream it into the macro using the
+`<<` operator, or a sequence of such operators. An example:
+```
+ASSERT_EQ(x.size(), y.size()) << "Vectors x and y are of unequal length";
+
+for (int i = 0; i < x.size(); ++i) {
+  EXPECT_EQ(x[i], y[i]) << "Vectors x and y differ at index " << i;
+}
+```
+
+Anything that can be streamed to an `ostream` can be streamed to an assertion
+macro--in particular, C strings and `string` objects. If a wide string
+(`wchar_t*`, `TCHAR*` in `UNICODE` mode on Windows, or `std::wstring`) is
+streamed to an assertion, it will be translated to UTF-8 when printed.
+
+## Basic Assertions ##
+
+These assertions do basic true/false condition testing.
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_TRUE(`_condition_`)`;  | `EXPECT_TRUE(`_condition_`)`;   | _condition_ is true |
+| `ASSERT_FALSE(`_condition_`)`; | `EXPECT_FALSE(`_condition_`)`;  | _condition_ is false |
+
+Remember, when they fail, `ASSERT_*` yields a fatal failure and
+returns from the current function, while `EXPECT_*` yields a nonfatal
+failure, allowing the function to continue running. In either case, an
+assertion failure means its containing test fails.
+
+_Availability_: Linux, Windows, Mac.
+
+## Binary Comparison ##
+
+This section describes assertions that compare two values.
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+|`ASSERT_EQ(`_expected_`, `_actual_`);`|`EXPECT_EQ(`_expected_`, `_actual_`);`| _expected_ `==` _actual_ |
+|`ASSERT_NE(`_val1_`, `_val2_`);`      |`EXPECT_NE(`_val1_`, `_val2_`);`      | _val1_ `!=` _val2_ |
+|`ASSERT_LT(`_val1_`, `_val2_`);`      |`EXPECT_LT(`_val1_`, `_val2_`);`      | _val1_ `<` _val2_ |
+|`ASSERT_LE(`_val1_`, `_val2_`);`      |`EXPECT_LE(`_val1_`, `_val2_`);`      | _val1_ `<=` _val2_ |
+|`ASSERT_GT(`_val1_`, `_val2_`);`      |`EXPECT_GT(`_val1_`, `_val2_`);`      | _val1_ `>` _val2_ |
+|`ASSERT_GE(`_val1_`, `_val2_`);`      |`EXPECT_GE(`_val1_`, `_val2_`);`      | _val1_ `>=` _val2_ |
+
+In the event of a failure, Google Test prints both _val1_ and _val2_
+. In `ASSERT_EQ*` and `EXPECT_EQ*` (and all other equality assertions
+we'll introduce later), you should put the expression you want to test
+in the position of _actual_, and put its expected value in _expected_,
+as Google Test's failure messages are optimized for this convention.
+
+Value arguments must be comparable by the assertion's comparison
+operator or you'll get a compiler error.  We used to require the
+arguments to support the `<<` operator for streaming to an `ostream`,
+but it's no longer necessary since v1.6.0 (if `<<` is supported, it
+will be called to print the arguments when the assertion fails;
+otherwise Google Test will attempt to print them in the best way it
+can. For more details and how to customize the printing of the
+arguments, see this Google Mock [recipe](../../googlemock/docs/CookBook.md#teaching-google-mock-how-to-print-your-values).).
+
+These assertions can work with a user-defined type, but only if you define the
+corresponding comparison operator (e.g. `==`, `<`, etc).  If the corresponding
+operator is defined, prefer using the `ASSERT_*()` macros because they will
+print out not only the result of the comparison, but the two operands as well.
+
+Arguments are always evaluated exactly once. Therefore, it's OK for the
+arguments to have side effects. However, as with any ordinary C/C++ function,
+the arguments' evaluation order is undefined (i.e. the compiler is free to
+choose any order) and your code should not depend on any particular argument
+evaluation order.
+
+`ASSERT_EQ()` does pointer equality on pointers. If used on two C strings, it
+tests if they are in the same memory location, not if they have the same value.
+Therefore, if you want to compare C strings (e.g. `const char*`) by value, use
+`ASSERT_STREQ()` , which will be described later on. In particular, to assert
+that a C string is `NULL`, use `ASSERT_STREQ(NULL, c_string)` . However, to
+compare two `string` objects, you should use `ASSERT_EQ`.
+
+Macros in this section work with both narrow and wide string objects (`string`
+and `wstring`).
+
+_Availability_: Linux, Windows, Mac.
+
+## String Comparison ##
+
+The assertions in this group compare two **C strings**. If you want to compare
+two `string` objects, use `EXPECT_EQ`, `EXPECT_NE`, and etc instead.
+
+| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
+|:--------------------|:-----------------------|:-------------|
+| `ASSERT_STREQ(`_expected\_str_`, `_actual\_str_`);`    | `EXPECT_STREQ(`_expected\_str_`, `_actual\_str_`);`     | the two C strings have the same content |
+| `ASSERT_STRNE(`_str1_`, `_str2_`);`    | `EXPECT_STRNE(`_str1_`, `_str2_`);`     | the two C strings have different content |
+| `ASSERT_STRCASEEQ(`_expected\_str_`, `_actual\_str_`);`| `EXPECT_STRCASEEQ(`_expected\_str_`, `_actual\_str_`);` | the two C strings have the same content, ignoring case |
+| `ASSERT_STRCASENE(`_str1_`, `_str2_`);`| `EXPECT_STRCASENE(`_str1_`, `_str2_`);` | the two C strings have different content, ignoring case |
+
+Note that "CASE" in an assertion name means that case is ignored.
+
+`*STREQ*` and `*STRNE*` also accept wide C strings (`wchar_t*`). If a
+comparison of two wide strings fails, their values will be printed as UTF-8
+narrow strings.
+
+A `NULL` pointer and an empty string are considered _different_.
+
+_Availability_: Linux, Windows, Mac.
+
+See also: For more string comparison tricks (substring, prefix, suffix, and
+regular expression matching, for example), see the [Advanced Google Test Guide](V1_7_AdvancedGuide.md).
+
+# Simple Tests #
+
+To create a test:
+  1. Use the `TEST()` macro to define and name a test function, These are ordinary C++ functions that don't return a value.
+  1. In this function, along with any valid C++ statements you want to include, use the various Google Test assertions to check values.
+  1. The test's result is determined by the assertions; if any assertion in the test fails (either fatally or non-fatally), or if the test crashes, the entire test fails. Otherwise, it succeeds.
+
+```
+TEST(test_case_name, test_name) {
+ ... test body ...
+}
+```
+
+
+`TEST()` arguments go from general to specific. The _first_ argument is the
+name of the test case, and the _second_ argument is the test's name within the
+test case. Both names must be valid C++ identifiers, and they should not contain underscore (`_`). A test's _full name_ consists of its containing test case and its
+individual name. Tests from different test cases can have the same individual
+name.
+
+For example, let's take a simple integer function:
+```
+int Factorial(int n); // Returns the factorial of n
+```
+
+A test case for this function might look like:
+```
+// Tests factorial of 0.
+TEST(FactorialTest, HandlesZeroInput) {
+  EXPECT_EQ(1, Factorial(0));
+}
+
+// Tests factorial of positive numbers.
+TEST(FactorialTest, HandlesPositiveInput) {
+  EXPECT_EQ(1, Factorial(1));
+  EXPECT_EQ(2, Factorial(2));
+  EXPECT_EQ(6, Factorial(3));
+  EXPECT_EQ(40320, Factorial(8));
+}
+```
+
+Google Test groups the test results by test cases, so logically-related tests
+should be in the same test case; in other words, the first argument to their
+`TEST()` should be the same. In the above example, we have two tests,
+`HandlesZeroInput` and `HandlesPositiveInput`, that belong to the same test
+case `FactorialTest`.
+
+_Availability_: Linux, Windows, Mac.
+
+# Test Fixtures: Using the Same Data Configuration for Multiple Tests #
+
+If you find yourself writing two or more tests that operate on similar data,
+you can use a _test fixture_. It allows you to reuse the same configuration of
+objects for several different tests.
+
+To create a fixture, just:
+  1. Derive a class from `::testing::Test` . Start its body with `protected:` or `public:` as we'll want to access fixture members from sub-classes.
+  1. Inside the class, declare any objects you plan to use.
+  1. If necessary, write a default constructor or `SetUp()` function to prepare the objects for each test. A common mistake is to spell `SetUp()` as `Setup()` with a small `u` - don't let that happen to you.
+  1. If necessary, write a destructor or `TearDown()` function to release any resources you allocated in `SetUp()` . To learn when you should use the constructor/destructor and when you should use `SetUp()/TearDown()`, read this [FAQ entry](V1_7_FAQ.md#should-i-use-the-constructordestructor-of-the-test-fixture-or-the-set-uptear-down-function).
+  1. If needed, define subroutines for your tests to share.
+
+When using a fixture, use `TEST_F()` instead of `TEST()` as it allows you to
+access objects and subroutines in the test fixture:
+```
+TEST_F(test_case_name, test_name) {
+ ... test body ...
+}
+```
+
+Like `TEST()`, the first argument is the test case name, but for `TEST_F()`
+this must be the name of the test fixture class. You've probably guessed: `_F`
+is for fixture.
+
+Unfortunately, the C++ macro system does not allow us to create a single macro
+that can handle both types of tests. Using the wrong macro causes a compiler
+error.
+
+Also, you must first define a test fixture class before using it in a
+`TEST_F()`, or you'll get the compiler error "`virtual outside class
+declaration`".
+
+For each test defined with `TEST_F()`, Google Test will:
+  1. Create a _fresh_ test fixture at runtime
+  1. Immediately initialize it via `SetUp()` ,
+  1. Run the test
+  1. Clean up by calling `TearDown()`
+  1. Delete the test fixture.  Note that different tests in the same test case have different test fixture objects, and Google Test always deletes a test fixture before it creates the next one. Google Test does not reuse the same test fixture for multiple tests. Any changes one test makes to the fixture do not affect other tests.
+
+As an example, let's write tests for a FIFO queue class named `Queue`, which
+has the following interface:
+```
+template <typename E> // E is the element type.
+class Queue {
+ public:
+  Queue();
+  void Enqueue(const E& element);
+  E* Dequeue(); // Returns NULL if the queue is empty.
+  size_t size() const;
+  ...
+};
+```
+
+First, define a fixture class. By convention, you should give it the name
+`FooTest` where `Foo` is the class being tested.
+```
+class QueueTest : public ::testing::Test {
+ protected:
+  virtual void SetUp() {
+    q1_.Enqueue(1);
+    q2_.Enqueue(2);
+    q2_.Enqueue(3);
+  }
+
+  // virtual void TearDown() {}
+
+  Queue<int> q0_;
+  Queue<int> q1_;
+  Queue<int> q2_;
+};
+```
+
+In this case, `TearDown()` is not needed since we don't have to clean up after
+each test, other than what's already done by the destructor.
+
+Now we'll write tests using `TEST_F()` and this fixture.
+```
+TEST_F(QueueTest, IsEmptyInitially) {
+  EXPECT_EQ(0, q0_.size());
+}
+
+TEST_F(QueueTest, DequeueWorks) {
+  int* n = q0_.Dequeue();
+  EXPECT_EQ(NULL, n);
+
+  n = q1_.Dequeue();
+  ASSERT_TRUE(n != NULL);
+  EXPECT_EQ(1, *n);
+  EXPECT_EQ(0, q1_.size());
+  delete n;
+
+  n = q2_.Dequeue();
+  ASSERT_TRUE(n != NULL);
+  EXPECT_EQ(2, *n);
+  EXPECT_EQ(1, q2_.size());
+  delete n;
+}
+```
+
+The above uses both `ASSERT_*` and `EXPECT_*` assertions. The rule of thumb is
+to use `EXPECT_*` when you want the test to continue to reveal more errors
+after the assertion failure, and use `ASSERT_*` when continuing after failure
+doesn't make sense. For example, the second assertion in the `Dequeue` test is
+`ASSERT_TRUE(n != NULL)`, as we need to dereference the pointer `n` later,
+which would lead to a segfault when `n` is `NULL`.
+
+When these tests run, the following happens:
+  1. Google Test constructs a `QueueTest` object (let's call it `t1` ).
+  1. `t1.SetUp()` initializes `t1` .
+  1. The first test ( `IsEmptyInitially` ) runs on `t1` .
+  1. `t1.TearDown()` cleans up after the test finishes.
+  1. `t1` is destructed.
+  1. The above steps are repeated on another `QueueTest` object, this time running the `DequeueWorks` test.
+
+_Availability_: Linux, Windows, Mac.
+
+_Note_: Google Test automatically saves all _Google Test_ flags when a test
+object is constructed, and restores them when it is destructed.
+
+# Invoking the Tests #
+
+`TEST()` and `TEST_F()` implicitly register their tests with Google Test. So, unlike with many other C++ testing frameworks, you don't have to re-list all your defined tests in order to run them.
+
+After defining your tests, you can run them with `RUN_ALL_TESTS()` , which returns `0` if all the tests are successful, or `1` otherwise. Note that `RUN_ALL_TESTS()` runs _all tests_ in your link unit -- they can be from different test cases, or even different source files.
+
+When invoked, the `RUN_ALL_TESTS()` macro:
+  1. Saves the state of all  Google Test flags.
+  1. Creates a test fixture object for the first test.
+  1. Initializes it via `SetUp()`.
+  1. Runs the test on the fixture object.
+  1. Cleans up the fixture via `TearDown()`.
+  1. Deletes the fixture.
+  1. Restores the state of all Google Test flags.
+  1. Repeats the above steps for the next test, until all tests have run.
+
+In addition, if the text fixture's constructor generates a fatal failure in
+step 2, there is no point for step 3 - 5 and they are thus skipped. Similarly,
+if step 3 generates a fatal failure, step 4 will be skipped.
+
+_Important_: You must not ignore the return value of `RUN_ALL_TESTS()`, or `gcc`
+will give you a compiler error. The rationale for this design is that the
+automated testing service determines whether a test has passed based on its
+exit code, not on its stdout/stderr output; thus your `main()` function must
+return the value of `RUN_ALL_TESTS()`.
+
+Also, you should call `RUN_ALL_TESTS()` only **once**. Calling it more than once
+conflicts with some advanced Google Test features (e.g. thread-safe death
+tests) and thus is not supported.
+
+_Availability_: Linux, Windows, Mac.
+
+# Writing the main() Function #
+
+You can start from this boilerplate:
+```
+#include "this/package/foo.h"
+#include "gtest/gtest.h"
+
+namespace {
+
+// The fixture for testing class Foo.
+class FooTest : public ::testing::Test {
+ protected:
+  // You can remove any or all of the following functions if its body
+  // is empty.
+
+  FooTest() {
+    // You can do set-up work for each test here.
+  }
+
+  virtual ~FooTest() {
+    // You can do clean-up work that doesn't throw exceptions here.
+  }
+
+  // If the constructor and destructor are not enough for setting up
+  // and cleaning up each test, you can define the following methods:
+
+  virtual void SetUp() {
+    // Code here will be called immediately after the constructor (right
+    // before each test).
+  }
+
+  virtual void TearDown() {
+    // Code here will be called immediately after each test (right
+    // before the destructor).
+  }
+
+  // Objects declared here can be used by all tests in the test case for Foo.
+};
+
+// Tests that the Foo::Bar() method does Abc.
+TEST_F(FooTest, MethodBarDoesAbc) {
+  const string input_filepath = "this/package/testdata/myinputfile.dat";
+  const string output_filepath = "this/package/testdata/myoutputfile.dat";
+  Foo f;
+  EXPECT_EQ(0, f.Bar(input_filepath, output_filepath));
+}
+
+// Tests that Foo does Xyz.
+TEST_F(FooTest, DoesXyz) {
+  // Exercises the Xyz feature of Foo.
+}
+
+}  // namespace
+
+int main(int argc, char **argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  return RUN_ALL_TESTS();
+}
+```
+
+The `::testing::InitGoogleTest()` function parses the command line for Google
+Test flags, and removes all recognized flags. This allows the user to control a
+test program's behavior via various flags, which we'll cover in [AdvancedGuide](V1_7_AdvancedGuide.md).
+You must call this function before calling `RUN_ALL_TESTS()`, or the flags
+won't be properly initialized.
+
+On Windows, `InitGoogleTest()` also works with wide strings, so it can be used
+in programs compiled in `UNICODE` mode as well.
+
+But maybe you think that writing all those main() functions is too much work? We agree with you completely and that's why Google Test provides a basic implementation of main(). If it fits your needs, then just link your test with gtest\_main library and you are good to go.
+
+## Important note for Visual C++ users ##
+If you put your tests into a library and your `main()` function is in a different library or in your .exe file, those tests will not run. The reason is a [bug](https://connect.microsoft.com/feedback/viewfeedback.aspx?FeedbackID=244410&siteid=210) in Visual C++. When you define your tests, Google Test creates certain static objects to register them. These objects are not referenced from elsewhere but their constructors are still supposed to run. When Visual C++ linker sees that nothing in the library is referenced from other places it throws the library out. You have to reference your library with tests from your main program to keep the linker from discarding it. Here is how to do it. Somewhere in your library code declare a function:
+```
+__declspec(dllexport) int PullInMyLibrary() { return 0; }
+```
+If you put your tests in a static library (not DLL) then `__declspec(dllexport)` is not required. Now, in your main program, write a code that invokes that function:
+```
+int PullInMyLibrary();
+static int dummy = PullInMyLibrary();
+```
+This will keep your tests referenced and will make them register themselves at startup.
+
+In addition, if you define your tests in a static library, add `/OPT:NOREF` to your main program linker options. If you use MSVC++ IDE, go to your .exe project properties/Configuration Properties/Linker/Optimization and set References setting to `Keep Unreferenced Data (/OPT:NOREF)`. This will keep Visual C++ linker from discarding individual symbols generated by your tests from the final executable.
+
+There is one more pitfall, though. If you use Google Test as a static library (that's how it is defined in gtest.vcproj) your tests must also reside in a static library. If you have to have them in a DLL, you _must_ change Google Test to build into a DLL as well. Otherwise your tests will not run correctly or will not run at all. The general conclusion here is: make your life easier - do not write your tests in libraries!
+
+# Where to Go from Here #
+
+Congratulations! You've learned the Google Test basics. You can start writing
+and running Google Test tests, read some [samples](V1_7_Samples.md), or continue with
+[AdvancedGuide](V1_7_AdvancedGuide.md), which describes many more useful Google Test features.
+
+# Known Limitations #
+
+Google Test is designed to be thread-safe.  The implementation is
+thread-safe on systems where the `pthreads` library is available.  It
+is currently _unsafe_ to use Google Test assertions from two threads
+concurrently on other systems (e.g. Windows).  In most tests this is
+not an issue as usually the assertions are done in the main thread. If
+you want to help, you can volunteer to implement the necessary
+synchronization primitives in `gtest-port.h` for your platform.
diff --git a/docs/V1_7_PumpManual.md b/docs/V1_7_PumpManual.md
new file mode 100755 (executable)
index 0000000..8184f15
--- /dev/null
@@ -0,0 +1,177 @@
+
+
+<b>P</b>ump is <b>U</b>seful for <b>M</b>eta <b>P</b>rogramming.
+
+# The Problem #
+
+Template and macro libraries often need to define many classes,
+functions, or macros that vary only (or almost only) in the number of
+arguments they take. It's a lot of repetitive, mechanical, and
+error-prone work.
+
+Variadic templates and variadic macros can alleviate the problem.
+However, while both are being considered by the C++ committee, neither
+is in the standard yet or widely supported by compilers.  Thus they
+are often not a good choice, especially when your code needs to be
+portable. And their capabilities are still limited.
+
+As a result, authors of such libraries often have to write scripts to
+generate their implementation. However, our experience is that it's
+tedious to write such scripts, which tend to reflect the structure of
+the generated code poorly and are often hard to read and edit. For
+example, a small change needed in the generated code may require some
+non-intuitive, non-trivial changes in the script. This is especially
+painful when experimenting with the code.
+
+# Our Solution #
+
+Pump (for Pump is Useful for Meta Programming, Pretty Useful for Meta
+Programming, or Practical Utility for Meta Programming, whichever you
+prefer) is a simple meta-programming tool for C++. The idea is that a
+programmer writes a `foo.pump` file which contains C++ code plus meta
+code that manipulates the C++ code. The meta code can handle
+iterations over a range, nested iterations, local meta variable
+definitions, simple arithmetic, and conditional expressions. You can
+view it as a small Domain-Specific Language. The meta language is
+designed to be non-intrusive (s.t. it won't confuse Emacs' C++ mode,
+for example) and concise, making Pump code intuitive and easy to
+maintain.
+
+## Highlights ##
+
+  * The implementation is in a single Python script and thus ultra portable: no build or installation is needed and it works cross platforms.
+  * Pump tries to be smart with respect to [Google's style guide](http://code.google.com/p/google-styleguide/): it breaks long lines (easy to have when they are generated) at acceptable places to fit within 80 columns and indent the continuation lines correctly.
+  * The format is human-readable and more concise than XML.
+  * The format works relatively well with Emacs' C++ mode.
+
+## Examples ##
+
+The following Pump code (where meta keywords start with `$`, `[[` and `]]` are meta brackets, and `$$` starts a meta comment that ends with the line):
+
+```
+$var n = 3     $$ Defines a meta variable n.
+$range i 0..n  $$ Declares the range of meta iterator i (inclusive).
+$for i [[
+               $$ Meta loop.
+// Foo$i does blah for $i-ary predicates.
+$range j 1..i
+template <size_t N $for j [[, typename A$j]]>
+class Foo$i {
+$if i == 0 [[
+  blah a;
+]] $elif i <= 2 [[
+  blah b;
+]] $else [[
+  blah c;
+]]
+};
+
+]]
+```
+
+will be translated by the Pump compiler to:
+
+```
+// Foo0 does blah for 0-ary predicates.
+template <size_t N>
+class Foo0 {
+  blah a;
+};
+
+// Foo1 does blah for 1-ary predicates.
+template <size_t N, typename A1>
+class Foo1 {
+  blah b;
+};
+
+// Foo2 does blah for 2-ary predicates.
+template <size_t N, typename A1, typename A2>
+class Foo2 {
+  blah b;
+};
+
+// Foo3 does blah for 3-ary predicates.
+template <size_t N, typename A1, typename A2, typename A3>
+class Foo3 {
+  blah c;
+};
+```
+
+In another example,
+
+```
+$range i 1..n
+Func($for i + [[a$i]]);
+$$ The text between i and [[ is the separator between iterations.
+```
+
+will generate one of the following lines (without the comments), depending on the value of `n`:
+
+```
+Func();              // If n is 0.
+Func(a1);            // If n is 1.
+Func(a1 + a2);       // If n is 2.
+Func(a1 + a2 + a3);  // If n is 3.
+// And so on...
+```
+
+## Constructs ##
+
+We support the following meta programming constructs:
+
+| `$var id = exp` | Defines a named constant value. `$id` is valid util the end of the current meta lexical block. |
+|:----------------|:-----------------------------------------------------------------------------------------------|
+| `$range id exp..exp` | Sets the range of an iteration variable, which can be reused in multiple loops later.          |
+| `$for id sep [[ code ]]` | Iteration. The range of `id` must have been defined earlier. `$id` is valid in `code`.         |
+| `$($)`          | Generates a single `$` character.                                                              |
+| `$id`           | Value of the named constant or iteration variable.                                             |
+| `$(exp)`        | Value of the expression.                                                                       |
+| `$if exp [[ code ]] else_branch` | Conditional.                                                                                   |
+| `[[ code ]]`    | Meta lexical block.                                                                            |
+| `cpp_code`      | Raw C++ code.                                                                                  |
+| `$$ comment`    | Meta comment.                                                                                  |
+
+**Note:** To give the user some freedom in formatting the Pump source
+code, Pump ignores a new-line character if it's right after `$for foo`
+or next to `[[` or `]]`. Without this rule you'll often be forced to write
+very long lines to get the desired output. Therefore sometimes you may
+need to insert an extra new-line in such places for a new-line to show
+up in your output.
+
+## Grammar ##
+
+```
+code ::= atomic_code*
+atomic_code ::= $var id = exp
+    | $var id = [[ code ]]
+    | $range id exp..exp
+    | $for id sep [[ code ]]
+    | $($)
+    | $id
+    | $(exp)
+    | $if exp [[ code ]] else_branch
+    | [[ code ]]
+    | cpp_code
+sep ::= cpp_code | empty_string
+else_branch ::= $else [[ code ]]
+    | $elif exp [[ code ]] else_branch
+    | empty_string
+exp ::= simple_expression_in_Python_syntax
+```
+
+## Code ##
+
+You can find the source code of Pump in [scripts/pump.py](../scripts/pump.py). It is still
+very unpolished and lacks automated tests, although it has been
+successfully used many times. If you find a chance to use it in your
+project, please let us know what you think!  We also welcome help on
+improving Pump.
+
+## Real Examples ##
+
+You can find real-world applications of Pump in [Google Test](http://www.google.com/codesearch?q=file%3A\.pump%24+package%3Ahttp%3A%2F%2Fgoogletest\.googlecode\.com) and [Google Mock](http://www.google.com/codesearch?q=file%3A\.pump%24+package%3Ahttp%3A%2F%2Fgooglemock\.googlecode\.com).  The source file `foo.h.pump` generates `foo.h`.
+
+## Tips ##
+
+  * If a meta variable is followed by a letter or digit, you can separate them using `[[]]`, which inserts an empty string. For example `Foo$j[[]]Helper` generate `Foo1Helper` when `j` is 1.
+  * To avoid extra-long Pump source lines, you can break a line anywhere you want by inserting `[[]]` followed by a new line. Since any new-line character next to `[[` or `]]` is ignored, the generated code won't contain this new line.
diff --git a/docs/V1_7_Samples.md b/docs/V1_7_Samples.md
new file mode 100755 (executable)
index 0000000..f21d200
--- /dev/null
@@ -0,0 +1,14 @@
+If you're like us, you'd like to look at some Google Test sample code.  The
+[samples folder](../samples) has a number of well-commented samples showing how to use a
+variety of Google Test features.
+
+  * [Sample #1](../samples/sample1_unittest.cc) shows the basic steps of using Google Test to test C++ functions.
+  * [Sample #2](../samples/sample2_unittest.cc) shows a more complex unit test for a class with multiple member functions.
+  * [Sample #3](../samples/sample3_unittest.cc) uses a test fixture.
+  * [Sample #4](../samples/sample4_unittest.cc) is another basic example of using Google Test.
+  * [Sample #5](../samples/sample5_unittest.cc) teaches how to reuse a test fixture in multiple test cases by deriving sub-fixtures from it.
+  * [Sample #6](../samples/sample6_unittest.cc) demonstrates type-parameterized tests.
+  * [Sample #7](../samples/sample7_unittest.cc) teaches the basics of value-parameterized tests.
+  * [Sample #8](../samples/sample8_unittest.cc) shows using `Combine()` in value-parameterized tests.
+  * [Sample #9](../samples/sample9_unittest.cc) shows use of the listener API to modify Google Test's console output and the use of its reflection API to inspect test results.
+  * [Sample #10](../samples/sample10_unittest.cc) shows use of the listener API to implement a primitive memory leak checker.
diff --git a/docs/V1_7_XcodeGuide.md b/docs/V1_7_XcodeGuide.md
new file mode 100755 (executable)
index 0000000..bf24bf5
--- /dev/null
@@ -0,0 +1,93 @@
+
+
+This guide will explain how to use the Google Testing Framework in your Xcode projects on Mac OS X. This tutorial begins by quickly explaining what to do for experienced users. After the quick start, the guide goes provides additional explanation about each step.
+
+# Quick Start #
+
+Here is the quick guide for using Google Test in your Xcode project.
+
+  1. Download the source from the [website](http://code.google.com/p/googletest) using this command: `svn checkout http://googletest.googlecode.com/svn/trunk/ googletest-read-only`
+  1. Open up the `gtest.xcodeproj` in the `googletest-read-only/xcode/` directory and build the gtest.framework.
+  1. Create a new "Shell Tool" target in your Xcode project called something like "UnitTests"
+  1. Add the gtest.framework to your project and add it to the "Link Binary with Libraries" build phase of "UnitTests"
+  1. Add your unit test source code to the "Compile Sources" build phase of "UnitTests"
+  1. Edit the "UnitTests" executable and add an environment variable named "DYLD\_FRAMEWORK\_PATH" with a value equal to the path to the framework containing the gtest.framework relative to the compiled executable.
+  1. Build and Go
+
+The following sections further explain each of the steps listed above in depth, describing in more detail how to complete it including some variations.
+
+# Get the Source #
+
+Currently, the gtest.framework discussed here isn't available in a tagged release of Google Test, it is only available in the trunk. As explained at the Google Test [site](http://code.google.com/p/googletest/source/checkout">svn), you can get the code from anonymous SVN with this command:
+
+```
+svn checkout http://googletest.googlecode.com/svn/trunk/ googletest-read-only
+```
+
+Alternatively, if you are working with Subversion in your own code base, you can add Google Test as an external dependency to your own Subversion repository. By following this approach, everyone that checks out your svn repository will also receive a copy of Google Test (a specific version, if you wish) without having to check it out explicitly. This makes the set up of your project simpler and reduces the copied code in the repository.
+
+To use `svn:externals`, decide where you would like to have the external source reside. You might choose to put the external source inside the trunk, because you want it to be part of the branch when you make a release. However, keeping it outside the trunk in a version-tagged directory called something like `third-party/googletest/1.0.1`, is another option. Once the location is established, use `svn propedit svn:externals _directory_` to set the svn:externals property on a directory in your repository. This directory won't contain the code, but be its versioned parent directory.
+
+The command `svn propedit` will bring up your Subversion editor, making editing the long, (potentially multi-line) property simpler. This same method can be used to check out a tagged branch, by using the appropriate URL (e.g. `http://googletest.googlecode.com/svn/tags/release-1.0.1`). Additionally, the svn:externals property allows the specification of a particular revision of the trunk with the `-r_##_` option (e.g. `externals/src/googletest -r60 http://googletest.googlecode.com/svn/trunk`).
+
+Here is an example of using the svn:externals properties on a trunk (read via `svn propget`) of a project. This value checks out a copy of Google Test into the `trunk/externals/src/googletest/` directory.
+
+```
+[Computer:svn] user$ svn propget svn:externals trunk
+externals/src/googletest http://googletest.googlecode.com/svn/trunk
+```
+
+# Add the Framework to Your Project #
+
+The next step is to build and add the gtest.framework to your own project. This guide describes two common ways below.
+
+  * **Option 1** --- The simplest way to add Google Test to your own project, is to open gtest.xcodeproj (found in the xcode/ directory of the Google Test trunk) and build the framework manually. Then, add the built framework into your project using the "Add->Existing Framework..." from the context menu or "Project->Add..." from the main menu. The gtest.framework is relocatable and contains the headers and object code that you'll need to make tests. This method requires rebuilding every time you upgrade Google Test in your project.
+  * **Option 2** --- If you are going to be living off the trunk of Google Test, incorporating its latest features into your unit tests (or are a Google Test developer yourself). You'll want to rebuild the framework every time the source updates. to do this, you'll need to add the gtest.xcodeproj file, not the framework itself, to your own Xcode project. Then, from the build products that are revealed by the project's disclosure triangle, you can find the gtest.framework, which can be added to your targets (discussed below).
+
+# Make a Test Target #
+
+To start writing tests, make a new "Shell Tool" target. This target template is available under BSD, Cocoa, or Carbon. Add your unit test source code to the "Compile Sources" build phase of the target.
+
+Next, you'll want to add gtest.framework in two different ways, depending upon which option you chose above.
+
+  * **Option 1** --- During compilation, Xcode will need to know that you are linking against the gtest.framework. Add the gtest.framework to the "Link Binary with Libraries" build phase of your test target. This will include the Google Test headers in your header search path, and will tell the linker where to find the library.
+  * **Option 2** --- If your working out of the trunk, you'll also want to add gtest.framework to your "Link Binary with Libraries" build phase of your test target. In addition, you'll  want to add the gtest.framework as a dependency to your unit test target. This way, Xcode will make sure that gtest.framework is up to date, every time your build your target. Finally, if you don't share build directories with Google Test, you'll have to copy the gtest.framework into your own build products directory using a "Run Script" build phase.
+
+# Set Up the Executable Run Environment #
+
+Since the unit test executable is a shell tool, it doesn't have a bundle with a `Contents/Frameworks` directory, in which to place gtest.framework. Instead, the dynamic linker must be told at runtime to search for the framework in another location. This can be accomplished by setting the "DYLD\_FRAMEWORK\_PATH" environment variable in the "Edit Active Executable ..." Arguments tab, under "Variables to be set in the environment:". The path for this value is the path (relative or absolute) of the directory containing the gtest.framework.
+
+If you haven't set up the DYLD\_FRAMEWORK\_PATH, correctly, you might get a message like this:
+
+```
+[Session started at 2008-08-15 06:23:57 -0600.]
+  dyld: Library not loaded: @loader_path/../Frameworks/gtest.framework/Versions/A/gtest
+    Referenced from: /Users/username/Documents/Sandbox/gtestSample/build/Debug/WidgetFrameworkTest
+    Reason: image not found
+```
+
+To correct this problem, got to the directory containing the executable named in "Referenced from:" value in the error message above. Then, with the terminal in this location, find the relative path to the directory containing the gtest.framework. That is the value you'll need to set as the DYLD\_FRAMEWORK\_PATH.
+
+# Build and Go #
+
+Now, when you click "Build and Go", the test will be executed. Dumping out something like this:
+
+```
+[Session started at 2008-08-06 06:36:13 -0600.]
+[==========] Running 2 tests from 1 test case.
+[----------] Global test environment set-up.
+[----------] 2 tests from WidgetInitializerTest
+[ RUN      ] WidgetInitializerTest.TestConstructor
+[       OK ] WidgetInitializerTest.TestConstructor
+[ RUN      ] WidgetInitializerTest.TestConversion
+[       OK ] WidgetInitializerTest.TestConversion
+[----------] Global test environment tear-down
+[==========] 2 tests from 1 test case ran.
+[  PASSED  ] 2 tests.
+
+The Debugger has exited with status 0.  
+```
+
+# Summary #
+
+Unit testing is a valuable way to ensure your data model stays valid even during rapid development or refactoring. The Google Testing Framework is a great unit testing framework for C and C++ which integrates well with an Xcode development environment.
\ No newline at end of file
diff --git a/docs/XcodeGuide.md b/docs/XcodeGuide.md
new file mode 100755 (executable)
index 0000000..bf24bf5
--- /dev/null
@@ -0,0 +1,93 @@
+
+
+This guide will explain how to use the Google Testing Framework in your Xcode projects on Mac OS X. This tutorial begins by quickly explaining what to do for experienced users. After the quick start, the guide goes provides additional explanation about each step.
+
+# Quick Start #
+
+Here is the quick guide for using Google Test in your Xcode project.
+
+  1. Download the source from the [website](http://code.google.com/p/googletest) using this command: `svn checkout http://googletest.googlecode.com/svn/trunk/ googletest-read-only`
+  1. Open up the `gtest.xcodeproj` in the `googletest-read-only/xcode/` directory and build the gtest.framework.
+  1. Create a new "Shell Tool" target in your Xcode project called something like "UnitTests"
+  1. Add the gtest.framework to your project and add it to the "Link Binary with Libraries" build phase of "UnitTests"
+  1. Add your unit test source code to the "Compile Sources" build phase of "UnitTests"
+  1. Edit the "UnitTests" executable and add an environment variable named "DYLD\_FRAMEWORK\_PATH" with a value equal to the path to the framework containing the gtest.framework relative to the compiled executable.
+  1. Build and Go
+
+The following sections further explain each of the steps listed above in depth, describing in more detail how to complete it including some variations.
+
+# Get the Source #
+
+Currently, the gtest.framework discussed here isn't available in a tagged release of Google Test, it is only available in the trunk. As explained at the Google Test [site](http://code.google.com/p/googletest/source/checkout">svn), you can get the code from anonymous SVN with this command:
+
+```
+svn checkout http://googletest.googlecode.com/svn/trunk/ googletest-read-only
+```
+
+Alternatively, if you are working with Subversion in your own code base, you can add Google Test as an external dependency to your own Subversion repository. By following this approach, everyone that checks out your svn repository will also receive a copy of Google Test (a specific version, if you wish) without having to check it out explicitly. This makes the set up of your project simpler and reduces the copied code in the repository.
+
+To use `svn:externals`, decide where you would like to have the external source reside. You might choose to put the external source inside the trunk, because you want it to be part of the branch when you make a release. However, keeping it outside the trunk in a version-tagged directory called something like `third-party/googletest/1.0.1`, is another option. Once the location is established, use `svn propedit svn:externals _directory_` to set the svn:externals property on a directory in your repository. This directory won't contain the code, but be its versioned parent directory.
+
+The command `svn propedit` will bring up your Subversion editor, making editing the long, (potentially multi-line) property simpler. This same method can be used to check out a tagged branch, by using the appropriate URL (e.g. `http://googletest.googlecode.com/svn/tags/release-1.0.1`). Additionally, the svn:externals property allows the specification of a particular revision of the trunk with the `-r_##_` option (e.g. `externals/src/googletest -r60 http://googletest.googlecode.com/svn/trunk`).
+
+Here is an example of using the svn:externals properties on a trunk (read via `svn propget`) of a project. This value checks out a copy of Google Test into the `trunk/externals/src/googletest/` directory.
+
+```
+[Computer:svn] user$ svn propget svn:externals trunk
+externals/src/googletest http://googletest.googlecode.com/svn/trunk
+```
+
+# Add the Framework to Your Project #
+
+The next step is to build and add the gtest.framework to your own project. This guide describes two common ways below.
+
+  * **Option 1** --- The simplest way to add Google Test to your own project, is to open gtest.xcodeproj (found in the xcode/ directory of the Google Test trunk) and build the framework manually. Then, add the built framework into your project using the "Add->Existing Framework..." from the context menu or "Project->Add..." from the main menu. The gtest.framework is relocatable and contains the headers and object code that you'll need to make tests. This method requires rebuilding every time you upgrade Google Test in your project.
+  * **Option 2** --- If you are going to be living off the trunk of Google Test, incorporating its latest features into your unit tests (or are a Google Test developer yourself). You'll want to rebuild the framework every time the source updates. to do this, you'll need to add the gtest.xcodeproj file, not the framework itself, to your own Xcode project. Then, from the build products that are revealed by the project's disclosure triangle, you can find the gtest.framework, which can be added to your targets (discussed below).
+
+# Make a Test Target #
+
+To start writing tests, make a new "Shell Tool" target. This target template is available under BSD, Cocoa, or Carbon. Add your unit test source code to the "Compile Sources" build phase of the target.
+
+Next, you'll want to add gtest.framework in two different ways, depending upon which option you chose above.
+
+  * **Option 1** --- During compilation, Xcode will need to know that you are linking against the gtest.framework. Add the gtest.framework to the "Link Binary with Libraries" build phase of your test target. This will include the Google Test headers in your header search path, and will tell the linker where to find the library.
+  * **Option 2** --- If your working out of the trunk, you'll also want to add gtest.framework to your "Link Binary with Libraries" build phase of your test target. In addition, you'll  want to add the gtest.framework as a dependency to your unit test target. This way, Xcode will make sure that gtest.framework is up to date, every time your build your target. Finally, if you don't share build directories with Google Test, you'll have to copy the gtest.framework into your own build products directory using a "Run Script" build phase.
+
+# Set Up the Executable Run Environment #
+
+Since the unit test executable is a shell tool, it doesn't have a bundle with a `Contents/Frameworks` directory, in which to place gtest.framework. Instead, the dynamic linker must be told at runtime to search for the framework in another location. This can be accomplished by setting the "DYLD\_FRAMEWORK\_PATH" environment variable in the "Edit Active Executable ..." Arguments tab, under "Variables to be set in the environment:". The path for this value is the path (relative or absolute) of the directory containing the gtest.framework.
+
+If you haven't set up the DYLD\_FRAMEWORK\_PATH, correctly, you might get a message like this:
+
+```
+[Session started at 2008-08-15 06:23:57 -0600.]
+  dyld: Library not loaded: @loader_path/../Frameworks/gtest.framework/Versions/A/gtest
+    Referenced from: /Users/username/Documents/Sandbox/gtestSample/build/Debug/WidgetFrameworkTest
+    Reason: image not found
+```
+
+To correct this problem, got to the directory containing the executable named in "Referenced from:" value in the error message above. Then, with the terminal in this location, find the relative path to the directory containing the gtest.framework. That is the value you'll need to set as the DYLD\_FRAMEWORK\_PATH.
+
+# Build and Go #
+
+Now, when you click "Build and Go", the test will be executed. Dumping out something like this:
+
+```
+[Session started at 2008-08-06 06:36:13 -0600.]
+[==========] Running 2 tests from 1 test case.
+[----------] Global test environment set-up.
+[----------] 2 tests from WidgetInitializerTest
+[ RUN      ] WidgetInitializerTest.TestConstructor
+[       OK ] WidgetInitializerTest.TestConstructor
+[ RUN      ] WidgetInitializerTest.TestConversion
+[       OK ] WidgetInitializerTest.TestConversion
+[----------] Global test environment tear-down
+[==========] 2 tests from 1 test case ran.
+[  PASSED  ] 2 tests.
+
+The Debugger has exited with status 0.  
+```
+
+# Summary #
+
+Unit testing is a valuable way to ensure your data model stays valid even during rapid development or refactoring. The Google Testing Framework is a great unit testing framework for C and C++ which integrates well with an Xcode development environment.
\ No newline at end of file
index a27883f..957a69c 100755 (executable)
@@ -51,6 +51,17 @@ GTEST_DECLARE_string_(death_test_style);
 
 #if GTEST_HAS_DEATH_TEST
 
+namespace internal {
+
+// Returns a Boolean value indicating whether the caller is currently
+// executing in the context of the death test child process.  Tools such as
+// Valgrind heap checkers may need this to modify their behavior in death
+// tests.  IMPORTANT: This is an internal utility.  Using it may break the
+// implementation of death tests.  User code MUST NOT use it.
+GTEST_API_ bool InDeathTestChild();
+
+}  // namespace internal
+
 // The following macros are useful for writing death tests.
 
 // Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
@@ -75,7 +86,7 @@ GTEST_DECLARE_string_(death_test_style);
 //   for (int i = 0; i < 5; i++) {
 //     EXPECT_DEATH(server.ProcessRequest(i),
 //                  "Invalid request .* in ProcessRequest()")
-//         << "Failed to die on request " << i);
+//                  << "Failed to die on request " << i;
 //   }
 //
 //   ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
@@ -245,10 +256,10 @@ class GTEST_API_ KilledBySignal {
 # ifdef NDEBUG
 
 #  define EXPECT_DEBUG_DEATH(statement, regex) \
-  do { statement; } while (::testing::internal::AlwaysFalse())
+  GTEST_EXECUTE_STATEMENT_(statement, regex)
 
 #  define ASSERT_DEBUG_DEATH(statement, regex) \
-  do { statement; } while (::testing::internal::AlwaysFalse())
+  GTEST_EXECUTE_STATEMENT_(statement, regex)
 
 # else
 
index 9b7142f..fe879bc 100755 (executable)
 
 #include <limits>
 
-#include "gtest/internal/gtest-string.h"
-#include "gtest/internal/gtest-internal.h"
+#include "gtest/internal/gtest-port.h"
+
+// Ensures that there is at least one operator<< in the global namespace.
+// See Message& operator<<(...) below for why.
+void operator<<(const testing::internal::Secret&, int);
 
 namespace testing {
 
@@ -87,15 +90,7 @@ class GTEST_API_ Message {
 
  public:
   // Constructs an empty Message.
-  // We allocate the stringstream separately because otherwise each use of
-  // ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's
-  // stack frame leading to huge stack frames in some cases; gcc does not reuse
-  // the stack space.
-  Message() : ss_(new ::std::stringstream) {
-    // By default, we want there to be enough precision when printing
-    // a double to a Message.
-    *ss_ << std::setprecision(std::numeric_limits<double>::digits10 + 2);
-  }
+  Message();
 
   // Copy constructor.
   Message(const Message& msg) : ss_(new ::std::stringstream) {  // NOLINT
@@ -118,7 +113,22 @@ class GTEST_API_ Message {
   // Streams a non-pointer value to this object.
   template <typename T>
   inline Message& operator <<(const T& val) {
-    ::GTestStreamToHelper(ss_.get(), val);
+    // Some libraries overload << for STL containers.  These
+    // overloads are defined in the global namespace instead of ::std.
+    //
+    // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
+    // overloads are visible in either the std namespace or the global
+    // namespace, but not other namespaces, including the testing
+    // namespace which Google Test's Message class is in.
+    //
+    // To allow STL containers (and other types that has a << operator
+    // defined in the global namespace) to be used in Google Test
+    // assertions, testing::Message must access the custom << operator
+    // from the global namespace.  With this using declaration,
+    // overloads of << defined in the global namespace and those
+    // visible via Koenig lookup are both exposed in this function.
+    using ::operator <<;
+    *ss_ << val;
     return *this;
   }
 
@@ -140,7 +150,7 @@ class GTEST_API_ Message {
     if (pointer == NULL) {
       *ss_ << "(null)";
     } else {
-      ::GTestStreamToHelper(ss_.get(), pointer);
+      *ss_ << pointer;
     }
     return *this;
   }
@@ -164,12 +174,8 @@ class GTEST_API_ Message {
 
   // These two overloads allow streaming a wide C string to a Message
   // using the UTF-8 encoding.
-  Message& operator <<(const wchar_t* wide_c_str) {
-    return *this << internal::String::ShowWideCString(wide_c_str);
-  }
-  Message& operator <<(wchar_t* wide_c_str) {
-    return *this << internal::String::ShowWideCString(wide_c_str);
-  }
+  Message& operator <<(const wchar_t* wide_c_str);
+  Message& operator <<(wchar_t* wide_c_str);
 
 #if GTEST_HAS_STD_WSTRING
   // Converts the given wide string to a narrow string using the UTF-8
@@ -183,13 +189,11 @@ class GTEST_API_ Message {
   Message& operator <<(const ::wstring& wstr);
 #endif  // GTEST_HAS_GLOBAL_WSTRING
 
-  // Gets the text streamed to this object so far as a String.
+  // Gets the text streamed to this object so far as an std::string.
   // Each '\0' character in the buffer is replaced with "\\0".
   //
   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-  internal::String GetString() const {
-    return internal::StringStreamToString(ss_.get());
-  }
+  std::string GetString() const;
 
  private:
 
@@ -199,16 +203,20 @@ class GTEST_API_ Message {
   // decide between class template specializations for T and T*, so a
   // tr1::type_traits-like is_pointer works, and we can overload on that.
   template <typename T>
-  inline void StreamHelper(internal::true_type /*dummy*/, T* pointer) {
+  inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) {
     if (pointer == NULL) {
       *ss_ << "(null)";
     } else {
-      ::GTestStreamToHelper(ss_.get(), pointer);
+      *ss_ << pointer;
     }
   }
   template <typename T>
-  inline void StreamHelper(internal::false_type /*dummy*/, const T& value) {
-    ::GTestStreamToHelper(ss_.get(), value);
+  inline void StreamHelper(internal::false_type /*is_pointer*/,
+                           const T& value) {
+    // See the comments in Message& operator <<(const T&) above for why
+    // we need this using statement.
+    using ::operator <<;
+    *ss_ << value;
   }
 #endif  // GTEST_OS_SYMBIAN
 
@@ -225,6 +233,18 @@ inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
   return os << sb.GetString();
 }
 
+namespace internal {
+
+// Converts a streamable value to an std::string.  A NULL pointer is
+// converted to "(null)".  When the input value is a ::string,
+// ::std::string, ::wstring, or ::std::wstring object, each NUL
+// character in it is replaced with "\\0".
+template <typename T>
+std::string StreamableToString(const T& streamable) {
+  return (Message() << streamable).GetString();
+}
+
+}  // namespace internal
 }  // namespace testing
 
 #endif  // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
index 6407cfd..038f9ba 100755 (executable)
@@ -1257,7 +1257,7 @@ inline internal::ParamGenerator<bool> Bool() {
 // Boolean flags:
 //
 // class FlagDependentTest
-//     : public testing::TestWithParam<tuple(bool, bool)> > {
+//     : public testing::TestWithParam<tuple<bool, bool> > {
 //   virtual void SetUp() {
 //     // Assigns external_flag_1 and external_flag_2 values from the tuple.
 //     tie(external_flag_1, external_flag_2) = GetParam();
@@ -1387,14 +1387,17 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
     static int AddToRegistry() { \
       ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
           GetTestCasePatternHolder<test_case_name>(\
-              #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
-                  #test_case_name, \
-                  #test_name, \
-                  new ::testing::internal::TestMetaFactory< \
-                      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
+              #test_case_name, \
+              ::testing::internal::CodeLocation(\
+                  __FILE__, __LINE__))->AddTestPattern(\
+                      #test_case_name, \
+                      #test_name, \
+                      new ::testing::internal::TestMetaFactory< \
+                          GTEST_TEST_CLASS_NAME_(\
+                              test_case_name, test_name)>()); \
       return 0; \
     } \
-    static int gtest_registering_dummy_; \
+    static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
     GTEST_DISALLOW_COPY_AND_ASSIGN_(\
         GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
   }; \
@@ -1403,16 +1406,36 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
       GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
   void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
 
-# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
+// The optional last argument to INSTANTIATE_TEST_CASE_P allows the user
+// to specify a function or functor that generates custom test name suffixes
+// based on the test parameters. The function should accept one argument of
+// type testing::TestParamInfo<class ParamType>, and return std::string.
+//
+// testing::PrintToStringParamName is a builtin test suffix generator that
+// returns the value of testing::PrintToString(GetParam()). It does not work
+// for std::string or C strings.
+//
+// Note: test names must be non-empty, unique, and may only contain ASCII
+// alphanumeric characters or underscore.
+
+# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
   ::testing::internal::ParamGenerator<test_case_name::ParamType> \
       gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
-  int gtest_##prefix##test_case_name##_dummy_ = \
+  ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
+      const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
+    return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
+        (__VA_ARGS__)(info); \
+  } \
+  int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
       ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
           GetTestCasePatternHolder<test_case_name>(\
-              #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\
-                  #prefix, \
-                  &gtest_##prefix##test_case_name##_EvalGenerator_, \
-                  __FILE__, __LINE__)
+              #test_case_name, \
+              ::testing::internal::CodeLocation(\
+                  __FILE__, __LINE__))->AddTestCaseInstantiation(\
+                      #prefix, \
+                      &gtest_##prefix##test_case_name##_EvalGenerator_, \
+                      &gtest_##prefix##test_case_name##_EvalGenerateName_, \
+                      __FILE__, __LINE__)
 
 }  // namespace testing
 
index 401cb51..3078d6d 100755 (executable)
@@ -414,7 +414,7 @@ inline internal::ParamGenerator<bool> Bool() {
 // Boolean flags:
 //
 // class FlagDependentTest
-//     : public testing::TestWithParam<tuple(bool, bool)> > {
+//     : public testing::TestWithParam<tuple<bool, bool> > {
 //   virtual void SetUp() {
 //     // Assigns external_flag_1 and external_flag_2 values from the tuple.
 //     tie(external_flag_1, external_flag_2) = GetParam();
@@ -453,14 +453,17 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
     static int AddToRegistry() { \
       ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
           GetTestCasePatternHolder<test_case_name>(\
-              #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
-                  #test_case_name, \
-                  #test_name, \
-                  new ::testing::internal::TestMetaFactory< \
-                      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
+              #test_case_name, \
+              ::testing::internal::CodeLocation(\
+                  __FILE__, __LINE__))->AddTestPattern(\
+                      #test_case_name, \
+                      #test_name, \
+                      new ::testing::internal::TestMetaFactory< \
+                          GTEST_TEST_CLASS_NAME_(\
+                              test_case_name, test_name)>()); \
       return 0; \
     } \
-    static int gtest_registering_dummy_; \
+    static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
     GTEST_DISALLOW_COPY_AND_ASSIGN_(\
         GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
   }; \
@@ -469,16 +472,36 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
       GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
   void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
 
-# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
+// The optional last argument to INSTANTIATE_TEST_CASE_P allows the user
+// to specify a function or functor that generates custom test name suffixes
+// based on the test parameters. The function should accept one argument of
+// type testing::TestParamInfo<class ParamType>, and return std::string.
+//
+// testing::PrintToStringParamName is a builtin test suffix generator that
+// returns the value of testing::PrintToString(GetParam()).
+//
+// Note: test names must be non-empty, unique, and may only contain ASCII
+// alphanumeric characters or underscore. Because PrintToString adds quotes
+// to std::string and C strings, it won't work for these types.
+
+# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
   ::testing::internal::ParamGenerator<test_case_name::ParamType> \
       gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
-  int gtest_##prefix##test_case_name##_dummy_ = \
+  ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
+      const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
+    return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
+        (__VA_ARGS__)(info); \
+  } \
+  int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
       ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
           GetTestCasePatternHolder<test_case_name>(\
-              #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\
-                  #prefix, \
-                  &gtest_##prefix##test_case_name##_EvalGenerator_, \
-                  __FILE__, __LINE__)
+              #test_case_name, \
+              ::testing::internal::CodeLocation(\
+                  __FILE__, __LINE__))->AddTestCaseInstantiation(\
+                      #prefix, \
+                      &gtest_##prefix##test_case_name##_EvalGenerator_, \
+                      &gtest_##prefix##test_case_name##_EvalGenerateName_, \
+                      __FILE__, __LINE__)
 
 }  // namespace testing
 
index 9cbab3f..8a33164 100755 (executable)
 #include "gtest/internal/gtest-port.h"
 #include "gtest/internal/gtest-internal.h"
 
+#if GTEST_HAS_STD_TUPLE_
+# include <tuple>
+#endif
+
 namespace testing {
 
 // Definitions in the 'internal' and 'internal2' name spaces are
@@ -250,6 +254,103 @@ void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
 namespace testing {
 namespace internal {
 
+// FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
+// value of type ToPrint that is an operand of a comparison assertion
+// (e.g. ASSERT_EQ).  OtherOperand is the type of the other operand in
+// the comparison, and is used to help determine the best way to
+// format the value.  In particular, when the value is a C string
+// (char pointer) and the other operand is an STL string object, we
+// want to format the C string as a string, since we know it is
+// compared by value with the string object.  If the value is a char
+// pointer but the other operand is not an STL string object, we don't
+// know whether the pointer is supposed to point to a NUL-terminated
+// string, and thus want to print it as a pointer to be safe.
+//
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+
+// The default case.
+template <typename ToPrint, typename OtherOperand>
+class FormatForComparison {
+ public:
+  static ::std::string Format(const ToPrint& value) {
+    return ::testing::PrintToString(value);
+  }
+};
+
+// Array.
+template <typename ToPrint, size_t N, typename OtherOperand>
+class FormatForComparison<ToPrint[N], OtherOperand> {
+ public:
+  static ::std::string Format(const ToPrint* value) {
+    return FormatForComparison<const ToPrint*, OtherOperand>::Format(value);
+  }
+};
+
+// By default, print C string as pointers to be safe, as we don't know
+// whether they actually point to a NUL-terminated string.
+
+#define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType)                \
+  template <typename OtherOperand>                                      \
+  class FormatForComparison<CharType*, OtherOperand> {                  \
+   public:                                                              \
+    static ::std::string Format(CharType* value) {                      \
+      return ::testing::PrintToString(static_cast<const void*>(value)); \
+    }                                                                   \
+  }
+
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
+
+#undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
+
+// If a C string is compared with an STL string object, we know it's meant
+// to point to a NUL-terminated string, and thus can print it as a string.
+
+#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
+  template <>                                                           \
+  class FormatForComparison<CharType*, OtherStringType> {               \
+   public:                                                              \
+    static ::std::string Format(CharType* value) {                      \
+      return ::testing::PrintToString(value);                           \
+    }                                                                   \
+  }
+
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
+
+#if GTEST_HAS_GLOBAL_STRING
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string);
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);
+#endif
+
+#if GTEST_HAS_GLOBAL_WSTRING
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring);
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring);
+#endif
+
+#if GTEST_HAS_STD_WSTRING
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
+#endif
+
+#undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
+
+// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
+// operand to be used in a failure message.  The type (but not value)
+// of the other operand may affect the format.  This allows us to
+// print a char* as a raw pointer when it is compared against another
+// char* or void*, and print it as a C string when it is compared
+// against an std::string object, for example.
+//
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+template <typename T1, typename T2>
+std::string FormatForComparisonFailureMessage(
+    const T1& value, const T2& /* other_operand */) {
+  return FormatForComparison<T1, T2>::Format(value);
+}
+
 // UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
 // value to the given ostream.  The caller must ensure that
 // 'ostream_ptr' is not NULL, or the behavior is undefined.
@@ -480,14 +581,16 @@ inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
 }
 #endif  // GTEST_HAS_STD_WSTRING
 
-#if GTEST_HAS_TR1_TUPLE
-// Overload for ::std::tr1::tuple.  Needed for printing function arguments,
-// which are packed as tuples.
-
+#if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
 // Helper function for printing a tuple.  T must be instantiated with
 // a tuple type.
 template <typename T>
 void PrintTupleTo(const T& t, ::std::ostream* os);
+#endif  // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
+
+#if GTEST_HAS_TR1_TUPLE
+// Overload for ::std::tr1::tuple.  Needed for printing function arguments,
+// which are packed as tuples.
 
 // Overloaded PrintTo() for tuples of various arities.  We support
 // tuples of up-to 10 fields.  The following implementation works
@@ -561,6 +664,13 @@ void PrintTo(
 }
 #endif  // GTEST_HAS_TR1_TUPLE
 
+#if GTEST_HAS_STD_TUPLE_
+template <typename... Types>
+void PrintTo(const ::std::tuple<Types...>& t, ::std::ostream* os) {
+  PrintTupleTo(t, os);
+}
+#endif  // GTEST_HAS_STD_TUPLE_
+
 // Overload for std::pair.
 template <typename T1, typename T2>
 void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
@@ -580,10 +690,7 @@ class UniversalPrinter {
  public:
   // MSVC warns about adding const to a function type, so we want to
   // disable the warning.
-#ifdef _MSC_VER
-# pragma warning(push)          // Saves the current warning state.
-# pragma warning(disable:4180)  // Temporarily disables warning 4180.
-#endif  // _MSC_VER
+  GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180)
 
   // Note: we deliberately don't call this PrintTo(), as that name
   // conflicts with ::testing::internal::PrintTo in the body of the
@@ -600,9 +707,7 @@ class UniversalPrinter {
     PrintTo(value, os);
   }
 
-#ifdef _MSC_VER
-# pragma warning(pop)           // Restores the warning state.
-#endif  // _MSC_VER
+  GTEST_DISABLE_MSC_WARNINGS_POP_()
 };
 
 // UniversalPrintArray(begin, len, os) prints an array of 'len'
@@ -630,9 +735,12 @@ void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
   }
 }
 // This overload prints a (const) char array compactly.
-GTEST_API_ void UniversalPrintArray(const char* begin,
-                                    size_t len,
-                                    ::std::ostream* os);
+GTEST_API_ void UniversalPrintArray(
+    const char* begin, size_t len, ::std::ostream* os);
+
+// This overload prints a (const) wchar_t array compactly.
+GTEST_API_ void UniversalPrintArray(
+    const wchar_t* begin, size_t len, ::std::ostream* os);
 
 // Implements printing an array type T[N].
 template <typename T, size_t N>
@@ -651,10 +759,7 @@ class UniversalPrinter<T&> {
  public:
   // MSVC warns about adding const to a function type, so we want to
   // disable the warning.
-#ifdef _MSC_VER
-# pragma warning(push)          // Saves the current warning state.
-# pragma warning(disable:4180)  // Temporarily disables warning 4180.
-#endif  // _MSC_VER
+  GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180)
 
   static void Print(const T& value, ::std::ostream* os) {
     // Prints the address of the value.  We use reinterpret_cast here
@@ -665,27 +770,78 @@ class UniversalPrinter<T&> {
     UniversalPrint(value, os);
   }
 
-#ifdef _MSC_VER
-# pragma warning(pop)           // Restores the warning state.
-#endif  // _MSC_VER
+  GTEST_DISABLE_MSC_WARNINGS_POP_()
 };
 
 // Prints a value tersely: for a reference type, the referenced value
 // (but not the address) is printed; for a (const) char pointer, the
 // NUL-terminated string (but not the pointer) is printed.
+
 template <typename T>
-void UniversalTersePrint(const T& value, ::std::ostream* os) {
-  UniversalPrint(value, os);
-}
-inline void UniversalTersePrint(const char* str, ::std::ostream* os) {
-  if (str == NULL) {
-    *os << "NULL";
-  } else {
-    UniversalPrint(string(str), os);
+class UniversalTersePrinter {
+ public:
+  static void Print(const T& value, ::std::ostream* os) {
+    UniversalPrint(value, os);
   }
-}
-inline void UniversalTersePrint(char* str, ::std::ostream* os) {
-  UniversalTersePrint(static_cast<const char*>(str), os);
+};
+template <typename T>
+class UniversalTersePrinter<T&> {
+ public:
+  static void Print(const T& value, ::std::ostream* os) {
+    UniversalPrint(value, os);
+  }
+};
+template <typename T, size_t N>
+class UniversalTersePrinter<T[N]> {
+ public:
+  static void Print(const T (&value)[N], ::std::ostream* os) {
+    UniversalPrinter<T[N]>::Print(value, os);
+  }
+};
+template <>
+class UniversalTersePrinter<const char*> {
+ public:
+  static void Print(const char* str, ::std::ostream* os) {
+    if (str == NULL) {
+      *os << "NULL";
+    } else {
+      UniversalPrint(string(str), os);
+    }
+  }
+};
+template <>
+class UniversalTersePrinter<char*> {
+ public:
+  static void Print(char* str, ::std::ostream* os) {
+    UniversalTersePrinter<const char*>::Print(str, os);
+  }
+};
+
+#if GTEST_HAS_STD_WSTRING
+template <>
+class UniversalTersePrinter<const wchar_t*> {
+ public:
+  static void Print(const wchar_t* str, ::std::ostream* os) {
+    if (str == NULL) {
+      *os << "NULL";
+    } else {
+      UniversalPrint(::std::wstring(str), os);
+    }
+  }
+};
+#endif
+
+template <>
+class UniversalTersePrinter<wchar_t*> {
+ public:
+  static void Print(wchar_t* str, ::std::ostream* os) {
+    UniversalTersePrinter<const wchar_t*>::Print(str, os);
+  }
+};
+
+template <typename T>
+void UniversalTersePrint(const T& value, ::std::ostream* os) {
+  UniversalTersePrinter<T>::Print(value, os);
 }
 
 // Prints a value using the type inferred by the compiler.  The
@@ -694,19 +850,71 @@ inline void UniversalTersePrint(char* str, ::std::ostream* os) {
 // NUL-terminated string.
 template <typename T>
 void UniversalPrint(const T& value, ::std::ostream* os) {
-  UniversalPrinter<T>::Print(value, os);
+  // A workarond for the bug in VC++ 7.1 that prevents us from instantiating
+  // UniversalPrinter with T directly.
+  typedef T T1;
+  UniversalPrinter<T1>::Print(value, os);
 }
 
-#if GTEST_HAS_TR1_TUPLE
 typedef ::std::vector<string> Strings;
 
+// TuplePolicy<TupleT> must provide:
+// - tuple_size
+//     size of tuple TupleT.
+// - get<size_t I>(const TupleT& t)
+//     static function extracting element I of tuple TupleT.
+// - tuple_element<size_t I>::type
+//     type of element I of tuple TupleT.
+template <typename TupleT>
+struct TuplePolicy;
+
+#if GTEST_HAS_TR1_TUPLE
+template <typename TupleT>
+struct TuplePolicy {
+  typedef TupleT Tuple;
+  static const size_t tuple_size = ::std::tr1::tuple_size<Tuple>::value;
+
+  template <size_t I>
+  struct tuple_element : ::std::tr1::tuple_element<I, Tuple> {};
+
+  template <size_t I>
+  static typename AddReference<
+      const typename ::std::tr1::tuple_element<I, Tuple>::type>::type get(
+      const Tuple& tuple) {
+    return ::std::tr1::get<I>(tuple);
+  }
+};
+template <typename TupleT>
+const size_t TuplePolicy<TupleT>::tuple_size;
+#endif  // GTEST_HAS_TR1_TUPLE
+
+#if GTEST_HAS_STD_TUPLE_
+template <typename... Types>
+struct TuplePolicy< ::std::tuple<Types...> > {
+  typedef ::std::tuple<Types...> Tuple;
+  static const size_t tuple_size = ::std::tuple_size<Tuple>::value;
+
+  template <size_t I>
+  struct tuple_element : ::std::tuple_element<I, Tuple> {};
+
+  template <size_t I>
+  static const typename ::std::tuple_element<I, Tuple>::type& get(
+      const Tuple& tuple) {
+    return ::std::get<I>(tuple);
+  }
+};
+template <typename... Types>
+const size_t TuplePolicy< ::std::tuple<Types...> >::tuple_size;
+#endif  // GTEST_HAS_STD_TUPLE_
+
+#if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
 // This helper template allows PrintTo() for tuples and
 // UniversalTersePrintTupleFieldsToStrings() to be defined by
 // induction on the number of tuple fields.  The idea is that
 // TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N
 // fields in tuple t, and can be defined in terms of
 // TuplePrefixPrinter<N - 1>.
-
+//
 // The inductive case.
 template <size_t N>
 struct TuplePrefixPrinter {
@@ -714,9 +922,14 @@ struct TuplePrefixPrinter {
   template <typename Tuple>
   static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
     TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os);
-    *os << ", ";
-    UniversalPrinter<typename ::std::tr1::tuple_element<N - 1, Tuple>::type>
-        ::Print(::std::tr1::get<N - 1>(t), os);
+    GTEST_INTENTIONAL_CONST_COND_PUSH_()
+    if (N > 1) {
+    GTEST_INTENTIONAL_CONST_COND_POP_()
+      *os << ", ";
+    }
+    UniversalPrinter<
+        typename TuplePolicy<Tuple>::template tuple_element<N - 1>::type>
+        ::Print(TuplePolicy<Tuple>::template get<N - 1>(t), os);
   }
 
   // Tersely prints the first N fields of a tuple to a string vector,
@@ -725,12 +938,12 @@ struct TuplePrefixPrinter {
   static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
     TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings);
     ::std::stringstream ss;
-    UniversalTersePrint(::std::tr1::get<N - 1>(t), &ss);
+    UniversalTersePrint(TuplePolicy<Tuple>::template get<N - 1>(t), &ss);
     strings->push_back(ss.str());
   }
 };
 
-// Base cases.
+// Base case.
 template <>
 struct TuplePrefixPrinter<0> {
   template <typename Tuple>
@@ -739,34 +952,13 @@ struct TuplePrefixPrinter<0> {
   template <typename Tuple>
   static void TersePrintPrefixToStrings(const Tuple&, Strings*) {}
 };
-// We have to specialize the entire TuplePrefixPrinter<> class
-// template here, even though the definition of
-// TersePrintPrefixToStrings() is the same as the generic version, as
-// Embarcadero (formerly CodeGear, formerly Borland) C++ doesn't
-// support specializing a method template of a class template.
-template <>
-struct TuplePrefixPrinter<1> {
-  template <typename Tuple>
-  static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
-    UniversalPrinter<typename ::std::tr1::tuple_element<0, Tuple>::type>::
-        Print(::std::tr1::get<0>(t), os);
-  }
 
-  template <typename Tuple>
-  static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
-    ::std::stringstream ss;
-    UniversalTersePrint(::std::tr1::get<0>(t), &ss);
-    strings->push_back(ss.str());
-  }
-};
-
-// Helper function for printing a tuple.  T must be instantiated with
-// a tuple type.
-template <typename T>
-void PrintTupleTo(const T& t, ::std::ostream* os) {
+// Helper function for printing a tuple.
+// Tuple must be either std::tr1::tuple or std::tuple type.
+template <typename Tuple>
+void PrintTupleTo(const Tuple& t, ::std::ostream* os) {
   *os << "(";
-  TuplePrefixPrinter< ::std::tr1::tuple_size<T>::value>::
-      PrintPrefixTo(t, os);
+  TuplePrefixPrinter<TuplePolicy<Tuple>::tuple_size>::PrintPrefixTo(t, os);
   *os << ")";
 }
 
@@ -776,21 +968,26 @@ void PrintTupleTo(const T& t, ::std::ostream* os) {
 template <typename Tuple>
 Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
   Strings result;
-  TuplePrefixPrinter< ::std::tr1::tuple_size<Tuple>::value>::
+  TuplePrefixPrinter<TuplePolicy<Tuple>::tuple_size>::
       TersePrintPrefixToStrings(value, &result);
   return result;
 }
-#endif  // GTEST_HAS_TR1_TUPLE
+#endif  // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
 
 }  // namespace internal
 
 template <typename T>
 ::std::string PrintToString(const T& value) {
   ::std::stringstream ss;
-  internal::UniversalTersePrint(value, &ss);
+  internal::UniversalTersePrinter<T>::Print(value, &ss);
   return ss.str();
 }
 
 }  // namespace testing
 
+// Include any custom printer added by the local installation.
+// We must include this header at the end to make sure it can use the
+// declarations from this file.
+#include "gtest/internal/custom/gtest-printers.h"
+
 #endif  // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
index b226e55..f63fa9a 100755 (executable)
@@ -223,7 +223,7 @@ class GTEST_API_ SingleFailureChecker {
         (substr));\
     {\
       ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
-          ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS,\
+          ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
           &gtest_failures);\
       if (::testing::internal::AlwaysTrue()) { statement; }\
     }\
index 8aeea14..77eb844 100755 (executable)
@@ -62,7 +62,7 @@ class GTEST_API_ TestPartResult {
                  int a_line_number,
                  const char* a_message)
       : type_(a_type),
-        file_name_(a_file_name),
+        file_name_(a_file_name == NULL ? "" : a_file_name),
         line_number_(a_line_number),
         summary_(ExtractSummary(a_message)),
         message_(a_message) {
@@ -73,7 +73,9 @@ class GTEST_API_ TestPartResult {
 
   // Gets the name of the source file where the test part took place, or
   // NULL if it's unknown.
-  const char* file_name() const { return file_name_.c_str(); }
+  const char* file_name() const {
+    return file_name_.empty() ? NULL : file_name_.c_str();
+  }
 
   // Gets the line in the source file where the test part took place,
   // or -1 if it's unknown.
@@ -96,21 +98,22 @@ class GTEST_API_ TestPartResult {
 
   // Returns true iff the test part fatally failed.
   bool fatally_failed() const { return type_ == kFatalFailure; }
+
  private:
   Type type_;
 
   // Gets the summary of the failure message by omitting the stack
   // trace in it.
-  static internal::String ExtractSummary(const char* message);
+  static std::string ExtractSummary(const char* message);
 
   // The name of the source file where the test part took place, or
-  // NULL if the source file is unknown.
-  internal::String file_name_;
+  // "" if the source file is unknown.
+  std::string file_name_;
   // The line in the source file where the test part took place, or -1
   // if the line number is unknown.
   int line_number_;
-  internal::String summary_;  // The test failure summary.
-  internal::String message_;  // The test failure message.
+  std::string summary_;  // The test failure summary.
+  std::string message_;  // The test failure message.
 };
 
 // Prints a TestPartResult object.
index fe1e83b..5f69d56 100755 (executable)
@@ -181,7 +181,8 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
           ::testing::internal::TemplateSel< \
               GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \
           GTEST_TYPE_PARAMS_(CaseName)>::Register(\
-              "", #CaseName, #TestName, 0); \
+              "", ::testing::internal::CodeLocation(__FILE__, __LINE__), \
+              #CaseName, #TestName, 0); \
   template <typename gtest_TypeParam_> \
   void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()
 
@@ -252,7 +253,10 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
       ::testing::internal::TypeParameterizedTestCase<CaseName, \
           GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
           ::testing::internal::TypeList< Types >::type>::Register(\
-              #Prefix, #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))
+              #Prefix, \
+              ::testing::internal::CodeLocation(__FILE__, __LINE__), \
+              &GTEST_TYPED_TEST_CASE_P_STATE_(CaseName), \
+              #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))
 
 #endif  // GTEST_HAS_TYPED_TEST_P
 
index cd01c7b..f846c5b 100755 (executable)
@@ -52,6 +52,7 @@
 #define GTEST_INCLUDE_GTEST_GTEST_H_
 
 #include <limits>
+#include <ostream>
 #include <vector>
 
 #include "gtest/internal/gtest-internal.h"
 // class ::string, which has the same interface as ::std::string, but
 // has a different implementation.
 //
-// The user can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
+// You can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
 // ::string is available AND is a distinct type to ::std::string, or
 // define it to 0 to indicate otherwise.
 //
-// If the user's ::std::string and ::string are the same class due to
-// aliasing, he should define GTEST_HAS_GLOBAL_STRING to 0.
+// If ::std::string and ::string are the same class on your platform
+// due to aliasing, you should define GTEST_HAS_GLOBAL_STRING to 0.
 //
-// If the user doesn't define GTEST_HAS_GLOBAL_STRING, it is defined
+// If you do not define GTEST_HAS_GLOBAL_STRING, it is defined
 // heuristically.
 
 namespace testing {
@@ -153,25 +154,15 @@ class ExecDeathTest;
 class NoExecDeathTest;
 class FinalSuccessChecker;
 class GTestFlagSaver;
+class StreamingListenerTest;
 class TestResultAccessor;
 class TestEventListenersAccessor;
 class TestEventRepeater;
+class UnitTestRecordPropertyTestHelper;
 class WindowsDeathTest;
 class UnitTestImpl* GetUnitTestImpl();
 void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
-                                    const String& message);
-
-// Converts a streamable value to a String.  A NULL pointer is
-// converted to "(null)".  When the input value is a ::string,
-// ::std::string, ::wstring, or ::std::wstring object, each NUL
-// character in it is replaced with "\\0".
-// Declared in gtest-internal.h but defined here, so that it has access
-// to the definition of the Message class, required by the ARM
-// compiler.
-template <typename T>
-String StreamableToString(const T& streamable) {
-  return (Message() << streamable).GetString();
-}
+                                    const std::string& message);
 
 }  // namespace internal
 
@@ -267,8 +258,31 @@ class GTEST_API_ AssertionResult {
   // Copy constructor.
   // Used in EXPECT_TRUE/FALSE(assertion_result).
   AssertionResult(const AssertionResult& other);
+
+  GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
+
   // Used in the EXPECT_TRUE/FALSE(bool_expression).
-  explicit AssertionResult(bool success) : success_(success) {}
+  //
+  // T must be contextually convertible to bool.
+  //
+  // The second parameter prevents this overload from being considered if
+  // the argument is implicitly convertible to AssertionResult. In that case
+  // we want AssertionResult's copy constructor to be used.
+  template <typename T>
+  explicit AssertionResult(
+      const T& success,
+      typename internal::EnableIf<
+          !internal::ImplicitlyConvertible<T, AssertionResult>::value>::type*
+          /*enabler*/ = NULL)
+      : success_(success) {}
+
+  GTEST_DISABLE_MSC_WARNINGS_POP_()
+
+  // Assignment operator.
+  AssertionResult& operator=(AssertionResult other) {
+    swap(other);
+    return *this;
+  }
 
   // Returns true iff the assertion succeeded.
   operator bool() const { return success_; }  // NOLINT
@@ -309,6 +323,9 @@ class GTEST_API_ AssertionResult {
     message_->append(a_message.GetString().c_str());
   }
 
+  // Swap the contents of this AssertionResult with other.
+  void swap(AssertionResult& other);
+
   // Stores result of the assertion predicate.
   bool success_;
   // Stores the message describing the condition in case the expectation
@@ -316,8 +333,6 @@ class GTEST_API_ AssertionResult {
   // Referenced via a pointer to avoid taking too much stack frame space
   // with test assertions.
   internal::scoped_ptr< ::std::string> message_;
-
-  GTEST_DISALLOW_ASSIGN_(AssertionResult);
 };
 
 // Makes a successful assertion result.
@@ -344,8 +359,8 @@ GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
 //
 //   class FooTest : public testing::Test {
 //    protected:
-//     virtual void SetUp() { ... }
-//     virtual void TearDown() { ... }
+//     void SetUp() override { ... }
+//     void TearDown() override { ... }
 //     ...
 //   };
 //
@@ -391,20 +406,21 @@ class GTEST_API_ Test {
   // non-fatal) failure.
   static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
 
-  // Logs a property for the current test.  Only the last value for a given
-  // key is remembered.
-  // These are public static so they can be called from utility functions
-  // that are not members of the test fixture.
-  // The arguments are const char* instead strings, as Google Test is used
-  // on platforms where string doesn't compile.
-  //
-  // Note that a driving consideration for these RecordProperty methods
-  // was to produce xml output suited to the Greenspan charting utility,
-  // which at present will only chart values that fit in a 32-bit int. It
-  // is the user's responsibility to restrict their values to 32-bit ints
-  // if they intend them to be used with Greenspan.
-  static void RecordProperty(const char* key, const char* value);
-  static void RecordProperty(const char* key, int value);
+  // Logs a property for the current test, test case, or for the entire
+  // invocation of the test program when used outside of the context of a
+  // test case.  Only the last value for a given key is remembered.  These
+  // are public static so they can be called from utility functions that are
+  // not members of the test fixture.  Calls to RecordProperty made during
+  // lifespan of the test (from the moment its constructor starts to the
+  // moment its destructor finishes) will be output in XML as attributes of
+  // the <testcase> element.  Properties recorded from fixture's
+  // SetUpTestCase or TearDownTestCase are logged as attributes of the
+  // corresponding <testsuite> element.  Calls to RecordProperty made in the
+  // global context (before or after invocation of RUN_ALL_TESTS and from
+  // SetUp/TearDown method of Environment objects registered with Google
+  // Test) will be output as attributes of the <testsuites> element.
+  static void RecordProperty(const std::string& key, const std::string& value);
+  static void RecordProperty(const std::string& key, int value);
 
  protected:
   // Creates a Test object.
@@ -436,20 +452,19 @@ class GTEST_API_ Test {
   // internal method to avoid clashing with names used in user TESTs.
   void DeleteSelf_() { delete this; }
 
-  // Uses a GTestFlagSaver to save and restore all Google Test flags.
-  const internal::GTestFlagSaver* const gtest_flag_saver_;
+  const internal::scoped_ptr< GTEST_FLAG_SAVER_ > gtest_flag_saver_;
 
-  // Often a user mis-spells SetUp() as Setup() and spends a long time
+  // Often a user misspells SetUp() as Setup() and spends a long time
   // wondering why it is never called by Google Test.  The declaration of
   // the following method is solely for catching such an error at
   // compile time:
   //
   //   - The return type is deliberately chosen to be not void, so it
-  //   will be a conflict if a user declares void Setup() in his test
-  //   fixture.
+  //   will be a conflict if void Setup() is declared in the user's
+  //   test fixture.
   //
   //   - This method is private, so it will be another compiler error
-  //   if a user calls it from his test fixture.
+  //   if the method is called from the user's test fixture.
   //
   // DO NOT OVERRIDE THIS FUNCTION.
   //
@@ -473,7 +488,7 @@ class TestProperty {
   // C'tor.  TestProperty does NOT have a default constructor.
   // Always use this constructor (with parameters) to create a
   // TestProperty object.
-  TestProperty(const char* a_key, const char* a_value) :
+  TestProperty(const std::string& a_key, const std::string& a_value) :
     key_(a_key), value_(a_value) {
   }
 
@@ -488,15 +503,15 @@ class TestProperty {
   }
 
   // Sets a new value, overriding the one supplied in the constructor.
-  void SetValue(const char* new_value) {
+  void SetValue(const std::string& new_value) {
     value_ = new_value;
   }
 
  private:
   // The key supplied by the user.
-  internal::String key_;
+  std::string key_;
   // The value supplied by the user.
-  internal::String value_;
+  std::string value_;
 };
 
 // The result of a single Test.  This includes a list of
@@ -547,6 +562,7 @@ class GTEST_API_ TestResult {
 
  private:
   friend class TestInfo;
+  friend class TestCase;
   friend class UnitTest;
   friend class internal::DefaultGlobalTestPartResultReporter;
   friend class internal::ExecDeathTest;
@@ -571,13 +587,16 @@ class GTEST_API_ TestResult {
   // a non-fatal failure if invalid (e.g., if it conflicts with reserved
   // key names). If a property is already recorded for the same key, the
   // value will be updated, rather than storing multiple values for the same
-  // key.
-  void RecordProperty(const TestProperty& test_property);
+  // key.  xml_element specifies the element for which the property is being
+  // recorded and is used for validation.
+  void RecordProperty(const std::string& xml_element,
+                      const TestProperty& test_property);
 
   // Adds a failure if the key is a reserved attribute of Google Test
   // testcase tags.  Returns true if the property is valid.
   // TODO(russr): Validate attribute names are legal and human readable.
-  static bool ValidateTestProperty(const TestProperty& test_property);
+  static bool ValidateTestProperty(const std::string& xml_element,
+                                   const TestProperty& test_property);
 
   // Adds a test part result to the list.
   void AddTestPartResult(const TestPartResult& test_part_result);
@@ -650,9 +669,15 @@ class GTEST_API_ TestInfo {
     return NULL;
   }
 
-  // Returns true if this test should run, that is if the test is not disabled
-  // (or it is disabled but the also_run_disabled_tests flag has been specified)
-  // and its full name matches the user-specified filter.
+  // Returns the file name where this test is defined.
+  const char* file() const { return location_.file.c_str(); }
+
+  // Returns the line where this test is defined.
+  int line() const { return location_.line; }
+
+  // Returns true if this test should run, that is if the test is not
+  // disabled (or it is disabled but the also_run_disabled_tests flag has
+  // been specified) and its full name matches the user-specified filter.
   //
   // Google Test allows the user to filter the tests by their full names.
   // The full name of a test Bar in test case Foo is defined as
@@ -668,21 +693,31 @@ class GTEST_API_ TestInfo {
   // contains the character 'A' or starts with "Foo.".
   bool should_run() const { return should_run_; }
 
+  // Returns true iff this test will appear in the XML report.
+  bool is_reportable() const {
+    // For now, the XML report includes all tests matching the filter.
+    // In the future, we may trim tests that are excluded because of
+    // sharding.
+    return matches_filter_;
+  }
+
   // Returns the result of the test.
   const TestResult* result() const { return &result_; }
 
  private:
-
 #if GTEST_HAS_DEATH_TEST
   friend class internal::DefaultDeathTestFactory;
 #endif  // GTEST_HAS_DEATH_TEST
   friend class Test;
   friend class TestCase;
   friend class internal::UnitTestImpl;
+  friend class internal::StreamingListenerTest;
   friend TestInfo* internal::MakeAndRegisterTestInfo(
-      const char* test_case_name, const char* name,
+      const char* test_case_name,
+      const char* name,
       const char* type_param,
       const char* value_param,
+      internal::CodeLocation code_location,
       internal::TypeId fixture_class_id,
       Test::SetUpTestCaseFunc set_up_tc,
       Test::TearDownTestCaseFunc tear_down_tc,
@@ -690,9 +725,11 @@ class GTEST_API_ TestInfo {
 
   // Constructs a TestInfo object. The newly constructed instance assumes
   // ownership of the factory object.
-  TestInfo(const char* test_case_name, const char* name,
-           const char* a_type_param,
-           const char* a_value_param,
+  TestInfo(const std::string& test_case_name,
+           const std::string& name,
+           const char* a_type_param,   // NULL if not a type-parameterized test
+           const char* a_value_param,  // NULL if not a value-parameterized test
+           internal::CodeLocation a_code_location,
            internal::TypeId fixture_class_id,
            internal::TestFactoryBase* factory);
 
@@ -719,6 +756,7 @@ class GTEST_API_ TestInfo {
   // Text representation of the value parameter, or NULL if this is not a
   // value-parameterized test.
   const internal::scoped_ptr<const ::std::string> value_param_;
+  internal::CodeLocation location_;
   const internal::TypeId fixture_class_id_;   // ID of the test fixture class
   bool should_run_;                 // True iff this test should run
   bool is_disabled_;                // True iff this test is disabled
@@ -778,9 +816,15 @@ class GTEST_API_ TestCase {
   // Gets the number of failed tests in this test case.
   int failed_test_count() const;
 
+  // Gets the number of disabled tests that will be reported in the XML report.
+  int reportable_disabled_test_count() const;
+
   // Gets the number of disabled tests in this test case.
   int disabled_test_count() const;
 
+  // Gets the number of tests to be printed in the XML report.
+  int reportable_test_count() const;
+
   // Get the number of tests in this test case that should run.
   int test_to_run_count() const;
 
@@ -800,6 +844,10 @@ class GTEST_API_ TestCase {
   // total_test_count() - 1. If i is not in that range, returns NULL.
   const TestInfo* GetTestInfo(int i) const;
 
+  // Returns the TestResult that holds test properties recorded during
+  // execution of SetUpTestCase and TearDownTestCase.
+  const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }
+
  private:
   friend class Test;
   friend class internal::UnitTestImpl;
@@ -852,11 +900,22 @@ class GTEST_API_ TestCase {
     return test_info->should_run() && test_info->result()->Failed();
   }
 
+  // Returns true iff the test is disabled and will be reported in the XML
+  // report.
+  static bool TestReportableDisabled(const TestInfo* test_info) {
+    return test_info->is_reportable() && test_info->is_disabled_;
+  }
+
   // Returns true iff test is disabled.
   static bool TestDisabled(const TestInfo* test_info) {
     return test_info->is_disabled_;
   }
 
+  // Returns true iff this test will appear in the XML report.
+  static bool TestReportable(const TestInfo* test_info) {
+    return test_info->is_reportable();
+  }
+
   // Returns true if the given test should run.
   static bool ShouldRunTest(const TestInfo* test_info) {
     return test_info->should_run();
@@ -869,7 +928,7 @@ class GTEST_API_ TestCase {
   void UnshuffleTests();
 
   // Name of the test case.
-  internal::String name_;
+  std::string name_;
   // Name of the parameter type, or NULL if this is not a typed or a
   // type-parameterized test.
   const internal::scoped_ptr<const ::std::string> type_param_;
@@ -888,13 +947,16 @@ class GTEST_API_ TestCase {
   bool should_run_;
   // Elapsed time, in milliseconds.
   TimeInMillis elapsed_time_;
+  // Holds test properties recorded during execution of SetUpTestCase and
+  // TearDownTestCase.
+  TestResult ad_hoc_test_result_;
 
   // We disallow copying TestCases.
   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
 };
 
 // An Environment object is capable of setting up and tearing down an
-// environment.  The user should subclass this to define his own
+// environment.  You should subclass this to define your own
 // environment(s).
 //
 // An Environment object does the set-up and tear-down in virtual
@@ -1107,11 +1169,13 @@ class GTEST_API_ UnitTest {
 
   // Returns the TestCase object for the test that's currently running,
   // or NULL if no test is running.
-  const TestCase* current_test_case() const;
+  const TestCase* current_test_case() const
+      GTEST_LOCK_EXCLUDED_(mutex_);
 
   // Returns the TestInfo object for the test that's currently running,
   // or NULL if no test is running.
-  const TestInfo* current_test_info() const;
+  const TestInfo* current_test_info() const
+      GTEST_LOCK_EXCLUDED_(mutex_);
 
   // Returns the random seed used at the start of the current test run.
   int random_seed() const;
@@ -1121,7 +1185,8 @@ class GTEST_API_ UnitTest {
   // value-parameterized tests and instantiate and register them.
   //
   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-  internal::ParameterizedTestCaseRegistry& parameterized_test_registry();
+  internal::ParameterizedTestCaseRegistry& parameterized_test_registry()
+      GTEST_LOCK_EXCLUDED_(mutex_);
 #endif  // GTEST_HAS_PARAM_TEST
 
   // Gets the number of successful test cases.
@@ -1143,15 +1208,25 @@ class GTEST_API_ UnitTest {
   // Gets the number of failed tests.
   int failed_test_count() const;
 
+  // Gets the number of disabled tests that will be reported in the XML report.
+  int reportable_disabled_test_count() const;
+
   // Gets the number of disabled tests.
   int disabled_test_count() const;
 
+  // Gets the number of tests to be printed in the XML report.
+  int reportable_test_count() const;
+
   // Gets the number of all tests.
   int total_test_count() const;
 
   // Gets the number of tests that should run.
   int test_to_run_count() const;
 
+  // Gets the time of the test program start, in ms from the start of the
+  // UNIX epoch.
+  TimeInMillis start_timestamp() const;
+
   // Gets the elapsed time, in milliseconds.
   TimeInMillis elapsed_time() const;
 
@@ -1166,6 +1241,10 @@ class GTEST_API_ UnitTest {
   // total_test_case_count() - 1. If i is not in that range, returns NULL.
   const TestCase* GetTestCase(int i) const;
 
+  // Returns the TestResult containing information on test failures and
+  // properties logged outside of individual test cases.
+  const TestResult& ad_hoc_test_result() const;
+
   // Returns the list of event listeners that can be used to track events
   // inside Google Test.
   TestEventListeners& listeners();
@@ -1189,12 +1268,16 @@ class GTEST_API_ UnitTest {
   void AddTestPartResult(TestPartResult::Type result_type,
                          const char* file_name,
                          int line_number,
-                         const internal::String& message,
-                         const internal::String& os_stack_trace);
+                         const std::string& message,
+                         const std::string& os_stack_trace)
+      GTEST_LOCK_EXCLUDED_(mutex_);
 
-  // Adds a TestProperty to the current TestResult object. If the result already
-  // contains a property with the same key, the value will be updated.
-  void RecordPropertyForCurrentTest(const char* key, const char* value);
+  // Adds a TestProperty to the current TestResult object when invoked from
+  // inside a test, to current TestCase's ad_hoc_test_result_ when invoked
+  // from SetUpTestCase or TearDownTestCase, or to the global property set
+  // when invoked elsewhere.  If the result already contains a property with
+  // the same key, the value will be updated.
+  void RecordProperty(const std::string& key, const std::string& value);
 
   // Gets the i-th test case among all the test cases. i can range from 0 to
   // total_test_case_count() - 1. If i is not in that range, returns NULL.
@@ -1209,11 +1292,13 @@ class GTEST_API_ UnitTest {
   friend class Test;
   friend class internal::AssertHelper;
   friend class internal::ScopedTrace;
+  friend class internal::StreamingListenerTest;
+  friend class internal::UnitTestRecordPropertyTestHelper;
   friend Environment* AddGlobalTestEnvironment(Environment* env);
   friend internal::UnitTestImpl* internal::GetUnitTestImpl();
   friend void internal::ReportFailureInUnknownLocation(
       TestPartResult::Type result_type,
-      const internal::String& message);
+      const std::string& message);
 
   // Creates an empty UnitTest.
   UnitTest();
@@ -1223,10 +1308,12 @@ class GTEST_API_ UnitTest {
 
   // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
   // Google Test trace stack.
-  void PushGTestTrace(const internal::TraceInfo& trace);
+  void PushGTestTrace(const internal::TraceInfo& trace)
+      GTEST_LOCK_EXCLUDED_(mutex_);
 
   // Pops a trace from the per-thread Google Test trace stack.
-  void PopGTestTrace();
+  void PopGTestTrace()
+      GTEST_LOCK_EXCLUDED_(mutex_);
 
   // Protects mutable state in *impl_.  This is mutable as some const
   // methods need to lock it too.
@@ -1281,60 +1368,42 @@ GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
 
 namespace internal {
 
-// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
-// operand to be used in a failure message.  The type (but not value)
-// of the other operand may affect the format.  This allows us to
-// print a char* as a raw pointer when it is compared against another
-// char*, and print it as a C string when it is compared against an
-// std::string object, for example.
-//
-// The default implementation ignores the type of the other operand.
-// Some specialized versions are used to handle formatting wide or
-// narrow C strings.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+// Separate the error generating code from the code path to reduce the stack
+// frame size of CmpHelperEQ. This helps reduce the overhead of some sanitizers
+// when calling EXPECT_* in a tight loop.
 template <typename T1, typename T2>
-String FormatForComparisonFailureMessage(const T1& value,
-                                         const T2& /* other_operand */) {
-  // C++Builder compiles this incorrectly if the namespace isn't explicitly
-  // given.
-  return ::testing::PrintToString(value);
+AssertionResult CmpHelperEQFailure(const char* lhs_expression,
+                                   const char* rhs_expression,
+                                   const T1& lhs, const T2& rhs) {
+  return EqFailure(lhs_expression,
+                   rhs_expression,
+                   FormatForComparisonFailureMessage(lhs, rhs),
+                   FormatForComparisonFailureMessage(rhs, lhs),
+                   false);
 }
 
 // The helper function for {ASSERT|EXPECT}_EQ.
 template <typename T1, typename T2>
-AssertionResult CmpHelperEQ(const char* expected_expression,
-                            const char* actual_expression,
-                            const T1& expected,
-                            const T2& actual) {
-#ifdef _MSC_VER
-# pragma warning(push)          // Saves the current warning state.
-# pragma warning(disable:4389)  // Temporarily disables warning on
-                               // signed/unsigned mismatch.
-#endif
-
-  if (expected == actual) {
+AssertionResult CmpHelperEQ(const char* lhs_expression,
+                            const char* rhs_expression,
+                            const T1& lhs,
+                            const T2& rhs) {
+GTEST_DISABLE_MSC_WARNINGS_PUSH_(4389 /* signed/unsigned mismatch */)
+  if (lhs == rhs) {
     return AssertionSuccess();
   }
+GTEST_DISABLE_MSC_WARNINGS_POP_()
 
-#ifdef _MSC_VER
-# pragma warning(pop)          // Restores the warning state.
-#endif
-
-  return EqFailure(expected_expression,
-                   actual_expression,
-                   FormatForComparisonFailureMessage(expected, actual),
-                   FormatForComparisonFailureMessage(actual, expected),
-                   false);
+  return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);
 }
 
 // With this overloaded version, we allow anonymous enums to be used
 // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
 // can be implicitly cast to BiggestInt.
-GTEST_API_ AssertionResult CmpHelperEQ(const char* expected_expression,
-                                       const char* actual_expression,
-                                       BiggestInt expected,
-                                       BiggestInt actual);
+GTEST_API_ AssertionResult CmpHelperEQ(const char* lhs_expression,
+                                       const char* rhs_expression,
+                                       BiggestInt lhs,
+                                       BiggestInt rhs);
 
 // The helper class for {ASSERT|EXPECT}_EQ.  The template argument
 // lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
@@ -1345,12 +1414,11 @@ class EqHelper {
  public:
   // This templatized version is for the general case.
   template <typename T1, typename T2>
-  static AssertionResult Compare(const char* expected_expression,
-                                 const char* actual_expression,
-                                 const T1& expected,
-                                 const T2& actual) {
-    return CmpHelperEQ(expected_expression, actual_expression, expected,
-                       actual);
+  static AssertionResult Compare(const char* lhs_expression,
+                                 const char* rhs_expression,
+                                 const T1& lhs,
+                                 const T2& rhs) {
+    return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
   }
 
   // With this overloaded version, we allow anonymous enums to be used
@@ -1359,12 +1427,11 @@ class EqHelper {
   //
   // Even though its body looks the same as the above version, we
   // cannot merge the two, as it will make anonymous enums unhappy.
-  static AssertionResult Compare(const char* expected_expression,
-                                 const char* actual_expression,
-                                 BiggestInt expected,
-                                 BiggestInt actual) {
-    return CmpHelperEQ(expected_expression, actual_expression, expected,
-                       actual);
+  static AssertionResult Compare(const char* lhs_expression,
+                                 const char* rhs_expression,
+                                 BiggestInt lhs,
+                                 BiggestInt rhs) {
+    return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
   }
 };
 
@@ -1379,40 +1446,52 @@ class EqHelper<true> {
   // EXPECT_EQ(false, a_bool).
   template <typename T1, typename T2>
   static AssertionResult Compare(
-      const char* expected_expression,
-      const char* actual_expression,
-      const T1& expected,
-      const T2& actual,
+      const char* lhs_expression,
+      const char* rhs_expression,
+      const T1& lhs,
+      const T2& rhs,
       // The following line prevents this overload from being considered if T2
       // is not a pointer type.  We need this because ASSERT_EQ(NULL, my_ptr)
       // expands to Compare("", "", NULL, my_ptr), which requires a conversion
       // to match the Secret* in the other overload, which would otherwise make
       // this template match better.
       typename EnableIf<!is_pointer<T2>::value>::type* = 0) {
-    return CmpHelperEQ(expected_expression, actual_expression, expected,
-                       actual);
+    return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
   }
 
   // This version will be picked when the second argument to ASSERT_EQ() is a
   // pointer, e.g. ASSERT_EQ(NULL, a_pointer).
   template <typename T>
   static AssertionResult Compare(
-      const char* expected_expression,
-      const char* actual_expression,
+      const char* lhs_expression,
+      const char* rhs_expression,
       // We used to have a second template parameter instead of Secret*.  That
       // template parameter would deduce to 'long', making this a better match
       // than the first overload even without the first overload's EnableIf.
       // Unfortunately, gcc with -Wconversion-null warns when "passing NULL to
       // non-pointer argument" (even a deduced integral argument), so the old
       // implementation caused warnings in user code.
-      Secret* /* expected (NULL) */,
-      T* actual) {
-    // We already know that 'expected' is a null pointer.
-    return CmpHelperEQ(expected_expression, actual_expression,
-                       static_cast<T*>(NULL), actual);
+      Secret* /* lhs (NULL) */,
+      T* rhs) {
+    // We already know that 'lhs' is a null pointer.
+    return CmpHelperEQ(lhs_expression, rhs_expression,
+                       static_cast<T*>(NULL), rhs);
   }
 };
 
+// Separate the error generating code from the code path to reduce the stack
+// frame size of CmpHelperOP. This helps reduce the overhead of some sanitizers
+// when calling EXPECT_OP in a tight loop.
+template <typename T1, typename T2>
+AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2,
+                                   const T1& val1, const T2& val2,
+                                   const char* op) {
+  return AssertionFailure()
+         << "Expected: (" << expr1 << ") " << op << " (" << expr2
+         << "), actual: " << FormatForComparisonFailureMessage(val1, val2)
+         << " vs " << FormatForComparisonFailureMessage(val2, val1);
+}
+
 // A macro for implementing the helper functions needed to implement
 // ASSERT_?? and EXPECT_??.  It is here just to avoid copy-and-paste
 // of similar code.
@@ -1423,6 +1502,7 @@ class EqHelper<true> {
 // with gcc 4.
 //
 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+
 #define GTEST_IMPL_CMP_HELPER_(op_name, op)\
 template <typename T1, typename T2>\
 AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
@@ -1430,10 +1510,7 @@ AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
   if (val1 op val2) {\
     return AssertionSuccess();\
   } else {\
-    return AssertionFailure() \
-        << "Expected: (" << expr1 << ") " #op " (" << expr2\
-        << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
-        << " vs " << FormatForComparisonFailureMessage(val2, val1);\
+    return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
   }\
 }\
 GTEST_API_ AssertionResult CmpHelper##op_name(\
@@ -1446,29 +1523,29 @@ GTEST_IMPL_CMP_HELPER_(NE, !=);
 // Implements the helper function for {ASSERT|EXPECT}_LE
 GTEST_IMPL_CMP_HELPER_(LE, <=);
 // Implements the helper function for {ASSERT|EXPECT}_LT
-GTEST_IMPL_CMP_HELPER_(LT, < );
+GTEST_IMPL_CMP_HELPER_(LT, <);
 // Implements the helper function for {ASSERT|EXPECT}_GE
 GTEST_IMPL_CMP_HELPER_(GE, >=);
 // Implements the helper function for {ASSERT|EXPECT}_GT
-GTEST_IMPL_CMP_HELPER_(GT, > );
+GTEST_IMPL_CMP_HELPER_(GT, >);
 
 #undef GTEST_IMPL_CMP_HELPER_
 
 // The helper function for {ASSERT|EXPECT}_STREQ.
 //
 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
-                                          const char* actual_expression,
-                                          const char* expected,
-                                          const char* actual);
+GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
+                                          const char* s2_expression,
+                                          const char* s1,
+                                          const char* s2);
 
 // The helper function for {ASSERT|EXPECT}_STRCASEEQ.
 //
 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
-                                              const char* actual_expression,
-                                              const char* expected,
-                                              const char* actual);
+GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression,
+                                              const char* s2_expression,
+                                              const char* s1,
+                                              const char* s2);
 
 // The helper function for {ASSERT|EXPECT}_STRNE.
 //
@@ -1490,10 +1567,10 @@ GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
 // Helper function for *_STREQ on wide strings.
 //
 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
-                                          const char* actual_expression,
-                                          const wchar_t* expected,
-                                          const wchar_t* actual);
+GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
+                                          const char* s2_expression,
+                                          const wchar_t* s1,
+                                          const wchar_t* s2);
 
 // Helper function for *_STRNE on wide strings.
 //
@@ -1551,28 +1628,28 @@ namespace internal {
 //
 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
 template <typename RawType>
-AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
-                                         const char* actual_expression,
-                                         RawType expected,
-                                         RawType actual) {
-  const FloatingPoint<RawType> lhs(expected), rhs(actual);
+AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
+                                         const char* rhs_expression,
+                                         RawType lhs_value,
+                                         RawType rhs_value) {
+  const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
 
   if (lhs.AlmostEquals(rhs)) {
     return AssertionSuccess();
   }
 
-  ::std::stringstream expected_ss;
-  expected_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
-              << expected;
+  ::std::stringstream lhs_ss;
+  lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
+         << lhs_value;
 
-  ::std::stringstream actual_ss;
-  actual_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
-            << actual;
+  ::std::stringstream rhs_ss;
+  rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
+         << rhs_value;
 
-  return EqFailure(expected_expression,
-                   actual_expression,
-                   StringStreamToString(&expected_ss),
-                   StringStreamToString(&actual_ss),
+  return EqFailure(lhs_expression,
+                   rhs_expression,
+                   StringStreamToString(&lhs_ss),
+                   StringStreamToString(&rhs_ss),
                    false);
 }
 
@@ -1614,9 +1691,9 @@ class GTEST_API_ AssertHelper {
         : type(t), file(srcfile), line(line_num), message(msg) { }
 
     TestPartResult::Type const type;
-    const char*        const file;
-    int                const line;
-    String             const message;
+    const char* const file;
+    int const line;
+    std::string const message;
 
    private:
     GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
@@ -1675,7 +1752,12 @@ class WithParamInterface {
   // references static data, to reduce the opportunity for incorrect uses
   // like writing 'WithParamInterface<bool>::GetParam()' for a test that
   // uses a fixture whose parameter type is int.
-  const ParamType& GetParam() const { return *parameter_; }
+  const ParamType& GetParam() const {
+    GTEST_CHECK_(parameter_ != NULL)
+        << "GetParam() can only be called inside a value-parameterized test "
+        << "-- did you intend to write TEST_P instead of TEST_F?";
+    return *parameter_;
+  }
 
  private:
   // Sets parameter value. The caller is responsible for making sure the value
@@ -1721,12 +1803,6 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 // usually want the fail-fast behavior of FAIL and ASSERT_*, but those
 // writing data-driven tests often find themselves using ADD_FAILURE
 // and EXPECT_* more.
-//
-// Examples:
-//
-//   EXPECT_TRUE(server.StatusIsOK());
-//   ASSERT_FALSE(server.HasPendingRequest(port))
-//       << "There are still pending requests " << "on port " << port;
 
 // Generates a nonfatal failure with a generic message.
 #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
@@ -1781,13 +1857,13 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 // AssertionResult. For more information on how to use AssertionResult with
 // these macros see comments on that class.
 #define EXPECT_TRUE(condition) \
-  GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
+  GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \
                       GTEST_NONFATAL_FAILURE_)
 #define EXPECT_FALSE(condition) \
   GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
                       GTEST_NONFATAL_FAILURE_)
 #define ASSERT_TRUE(condition) \
-  GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
+  GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \
                       GTEST_FATAL_FAILURE_)
 #define ASSERT_FALSE(condition) \
   GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
@@ -1799,12 +1875,12 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 
 // Macros for testing equalities and inequalities.
 //
-//    * {ASSERT|EXPECT}_EQ(expected, actual): Tests that expected == actual
-//    * {ASSERT|EXPECT}_NE(v1, v2):           Tests that v1 != v2
-//    * {ASSERT|EXPECT}_LT(v1, v2):           Tests that v1 < v2
-//    * {ASSERT|EXPECT}_LE(v1, v2):           Tests that v1 <= v2
-//    * {ASSERT|EXPECT}_GT(v1, v2):           Tests that v1 > v2
-//    * {ASSERT|EXPECT}_GE(v1, v2):           Tests that v1 >= v2
+//    * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2
+//    * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
+//    * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
+//    * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
+//    * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
+//    * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
 //
 // When they are not, Google Test prints both the tested expressions and
 // their actual values.  The values must be compatible built-in types,
@@ -1826,8 +1902,8 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 //   are related, not how their content is related.  To compare two C
 //   strings by content, use {ASSERT|EXPECT}_STR*().
 //
-//   3. {ASSERT|EXPECT}_EQ(expected, actual) is preferred to
-//   {ASSERT|EXPECT}_TRUE(expected == actual), as the former tells you
+//   3. {ASSERT|EXPECT}_EQ(v1, v2) is preferred to
+//   {ASSERT|EXPECT}_TRUE(v1 == v2), as the former tells you
 //   what the actual value is when it fails, and similarly for the
 //   other comparisons.
 //
@@ -1843,12 +1919,12 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 //   ASSERT_LT(i, array_size);
 //   ASSERT_GT(records.size(), 0) << "There is no record left.";
 
-#define EXPECT_EQ(expected, actual) \
+#define EXPECT_EQ(val1, val2) \
   EXPECT_PRED_FORMAT2(::testing::internal:: \
-                      EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
-                      expected, actual)
-#define EXPECT_NE(expected, actual) \
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)
+                      EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
+                      val1, val2)
+#define EXPECT_NE(val1, val2) \
+  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
 #define EXPECT_LE(val1, val2) \
   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
 #define EXPECT_LT(val1, val2) \
@@ -1858,10 +1934,10 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 #define EXPECT_GT(val1, val2) \
   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
 
-#define GTEST_ASSERT_EQ(expected, actual) \
+#define GTEST_ASSERT_EQ(val1, val2) \
   ASSERT_PRED_FORMAT2(::testing::internal:: \
-                      EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
-                      expected, actual)
+                      EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
+                      val1, val2)
 #define GTEST_ASSERT_NE(val1, val2) \
   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
 #define GTEST_ASSERT_LE(val1, val2) \
@@ -1900,7 +1976,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
 #endif
 
-// C String Comparisons.  All tests treat NULL and any non-NULL string
+// C-string Comparisons.  All tests treat NULL and any non-NULL string
 // as different.  Two NULLs are equal.
 //
 //    * {ASSERT|EXPECT}_STREQ(s1, s2):     Tests that s1 == s2
@@ -1916,29 +1992,29 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 //
 // These macros evaluate their arguments exactly once.
 
-#define EXPECT_STREQ(expected, actual) \
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
+#define EXPECT_STREQ(s1, s2) \
+  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
 #define EXPECT_STRNE(s1, s2) \
   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define EXPECT_STRCASEEQ(expected, actual) \
-  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
+#define EXPECT_STRCASEEQ(s1, s2) \
+  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
 #define EXPECT_STRCASENE(s1, s2)\
   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
 
-#define ASSERT_STREQ(expected, actual) \
-  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
+#define ASSERT_STREQ(s1, s2) \
+  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
 #define ASSERT_STRNE(s1, s2) \
   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define ASSERT_STRCASEEQ(expected, actual) \
-  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
+#define ASSERT_STRCASEEQ(s1, s2) \
+  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
 #define ASSERT_STRCASENE(s1, s2)\
   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
 
 // Macros for comparing floating-point numbers.
 //
-//    * {ASSERT|EXPECT}_FLOAT_EQ(expected, actual):
+//    * {ASSERT|EXPECT}_FLOAT_EQ(val1, val2):
 //         Tests that two float values are almost equal.
-//    * {ASSERT|EXPECT}_DOUBLE_EQ(expected, actual):
+//    * {ASSERT|EXPECT}_DOUBLE_EQ(val1, val2):
 //         Tests that two double values are almost equal.
 //    * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
 //         Tests that v1 and v2 are within the given distance to each other.
@@ -1948,21 +2024,21 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 // FloatingPoint template class in gtest-internal.h if you are
 // interested in the implementation details.
 
-#define EXPECT_FLOAT_EQ(expected, actual)\
+#define EXPECT_FLOAT_EQ(val1, val2)\
   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
-                      expected, actual)
+                      val1, val2)
 
-#define EXPECT_DOUBLE_EQ(expected, actual)\
+#define EXPECT_DOUBLE_EQ(val1, val2)\
   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
-                      expected, actual)
+                      val1, val2)
 
-#define ASSERT_FLOAT_EQ(expected, actual)\
+#define ASSERT_FLOAT_EQ(val1, val2)\
   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
-                      expected, actual)
+                      val1, val2)
 
-#define ASSERT_DOUBLE_EQ(expected, actual)\
+#define ASSERT_DOUBLE_EQ(val1, val2)\
   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
-                      expected, actual)
+                      val1, val2)
 
 #define EXPECT_NEAR(val1, val2, abs_error)\
   EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
@@ -2084,8 +2160,8 @@ bool StaticAssertTypeEq() {
 // The convention is to end the test case name with "Test".  For
 // example, a test case for the Foo class can be named FooTest.
 //
-// The user should put his test code between braces after using this
-// macro.  Example:
+// Test code should appear between braces after an invocation of
+// this macro.  Example:
 //
 //   TEST(FooTest, InitializesCorrectly) {
 //     Foo foo;
@@ -2141,15 +2217,20 @@ bool StaticAssertTypeEq() {
   GTEST_TEST_(test_fixture, test_name, test_fixture, \
               ::testing::internal::GetTypeId<test_fixture>())
 
-// Use this macro in main() to run all tests.  It returns 0 if all
+}  // namespace testing
+
+// Use this function in main() to run all tests.  It returns 0 if all
 // tests are successful, or 1 otherwise.
 //
 // RUN_ALL_TESTS() should be invoked after the command line has been
 // parsed by InitGoogleTest().
+//
+// This function was formerly a macro; thus, it is in the global
+// namespace and has an all-caps name.
+int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
 
-#define RUN_ALL_TESTS()\
-  (::testing::UnitTest::GetInstance()->Run())
-
-}  // namespace testing
+inline int RUN_ALL_TESTS() {
+  return ::testing::UnitTest::GetInstance()->Run();
+}
 
 #endif  // GTEST_INCLUDE_GTEST_GTEST_H_
index 3805f85..30ae712 100755 (executable)
@@ -27,7 +27,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-// This file is AUTOMATICALLY GENERATED on 09/24/2010 by command
+// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command
 // 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!
 //
 // Implements a family of generic predicate assertion macros.
@@ -98,7 +98,7 @@ AssertionResult AssertPred1Helper(const char* pred_text,
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, v1),\
+  GTEST_ASSERT_(pred_format(#v1, v1), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED1.  Don't use
@@ -144,7 +144,7 @@ AssertionResult AssertPred2Helper(const char* pred_text,
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2),\
+  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED2.  Don't use
@@ -197,7 +197,7 @@ AssertionResult AssertPred3Helper(const char* pred_text,
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3),\
+  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED3.  Don't use
@@ -257,7 +257,7 @@ AssertionResult AssertPred4Helper(const char* pred_text,
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4),\
+  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED4.  Don't use
@@ -324,7 +324,7 @@ AssertionResult AssertPred5Helper(const char* pred_text,
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5),\
+  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED5.  Don't use
diff --git a/include/gtest/internal/custom/gtest-port.h b/include/gtest/internal/custom/gtest-port.h
new file mode 100755 (executable)
index 0000000..7e744bd
--- /dev/null
@@ -0,0 +1,69 @@
+// Copyright 2015, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Injection point for custom user configurations.
+// The following macros can be defined:
+//
+//   Flag related macros:
+//     GTEST_FLAG(flag_name)
+//     GTEST_USE_OWN_FLAGFILE_FLAG_  - Define to 0 when the system provides its
+//                                     own flagfile flag parsing.
+//     GTEST_DECLARE_bool_(name)
+//     GTEST_DECLARE_int32_(name)
+//     GTEST_DECLARE_string_(name)
+//     GTEST_DEFINE_bool_(name, default_val, doc)
+//     GTEST_DEFINE_int32_(name, default_val, doc)
+//     GTEST_DEFINE_string_(name, default_val, doc)
+//
+//   Test filtering:
+//     GTEST_TEST_FILTER_ENV_VAR_ - The name of an environment variable that
+//                                  will be used if --GTEST_FLAG(test_filter)
+//                                  is not provided.
+//
+//   Logging:
+//     GTEST_LOG_(severity)
+//     GTEST_CHECK_(condition)
+//     Functions LogToStderr() and FlushInfoLog() have to be provided too.
+//
+//   Threading:
+//     GTEST_HAS_NOTIFICATION_ - Enabled if Notification is already provided.
+//     GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Enabled if Mutex and ThreadLocal are
+//                                         already provided.
+//     Must also provide GTEST_DECLARE_STATIC_MUTEX_(mutex) and
+//     GTEST_DEFINE_STATIC_MUTEX_(mutex)
+//
+//     GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
+//     GTEST_LOCK_EXCLUDED_(locks)
+//
+// ** Custom implementation starts here **
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
+
+#endif  // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
diff --git a/include/gtest/internal/custom/gtest-printers.h b/include/gtest/internal/custom/gtest-printers.h
new file mode 100755 (executable)
index 0000000..60c1ea0
--- /dev/null
@@ -0,0 +1,42 @@
+// Copyright 2015, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// This file provides an injection point for custom printers in a local
+// installation of gTest.
+// It will be included from gtest-printers.h and the overrides in this file
+// will be visible to everyone.
+// See documentation at gtest/gtest-printers.h for details on how to define a
+// custom printer.
+//
+// ** Custom implementation starts here **
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
+
+#endif  // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
diff --git a/include/gtest/internal/custom/gtest.h b/include/gtest/internal/custom/gtest.h
new file mode 100755 (executable)
index 0000000..c27412a
--- /dev/null
@@ -0,0 +1,41 @@
+// Copyright 2015, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Injection point for custom user configurations.
+// The following macros can be defined:
+//
+// GTEST_OS_STACK_TRACE_GETTER_  - The name of an implementation of
+//                                 OsStackTraceGetterInterface.
+//
+// ** Custom implementation starts here **
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
+
+#endif  // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
index 1d9f83b..2b3a78f 100755 (executable)
@@ -127,11 +127,11 @@ class GTEST_API_ DeathTest {
   // the last death test.
   static const char* LastMessage();
 
-  static void set_last_death_test_message(const String& message);
+  static void set_last_death_test_message(const std::string& message);
 
  private:
   // A string containing a description of the outcome of the last death test.
-  static String last_death_test_message_;
+  static std::string last_death_test_message_;
 
   GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
 };
@@ -217,12 +217,23 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
 // The symbol "fail" here expands to something into which a message
 // can be streamed.
 
+// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
+// NDEBUG mode. In this case we need the statements to be executed, the regex is
+// ignored, and the macro must accept a streamed message even though the message
+// is never printed.
+# define GTEST_EXECUTE_STATEMENT_(statement, regex) \
+  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+  if (::testing::internal::AlwaysTrue()) { \
+     GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
+  } else \
+    ::testing::Message()
+
 // A class representing the parsed contents of the
 // --gtest_internal_run_death_test flag, as it existed when
 // RUN_ALL_TESTS was called.
 class InternalRunDeathTestFlag {
  public:
-  InternalRunDeathTestFlag(const String& a_file,
+  InternalRunDeathTestFlag(const std::string& a_file,
                            int a_line,
                            int an_index,
                            int a_write_fd)
@@ -234,13 +245,13 @@ class InternalRunDeathTestFlag {
       posix::Close(write_fd_);
   }
 
-  String file() const { return file_; }
+  const std::string& file() const { return file_; }
   int line() const { return line_; }
   int index() const { return index_; }
   int write_fd() const { return write_fd_; }
 
  private:
-  String file_;
+  std::string file_;
   int line_;
   int index_;
   int write_fd_;
index b36b3cf..7a13b4b 100755 (executable)
@@ -61,11 +61,7 @@ class GTEST_API_ FilePath {
   FilePath() : pathname_("") { }
   FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
 
-  explicit FilePath(const char* pathname) : pathname_(pathname) {
-    Normalize();
-  }
-
-  explicit FilePath(const String& pathname) : pathname_(pathname) {
+  explicit FilePath(const std::string& pathname) : pathname_(pathname) {
     Normalize();
   }
 
@@ -78,7 +74,7 @@ class GTEST_API_ FilePath {
     pathname_ = rhs.pathname_;
   }
 
-  String ToString() const { return pathname_; }
+  const std::string& string() const { return pathname_; }
   const char* c_str() const { return pathname_.c_str(); }
 
   // Returns the current working directory, or "" if unsuccessful.
@@ -111,8 +107,8 @@ class GTEST_API_ FilePath {
                                          const FilePath& base_name,
                                          const char* extension);
 
-  // Returns true iff the path is NULL or "".
-  bool IsEmpty() const { return c_str() == NULL || *c_str() == '\0'; }
+  // Returns true iff the path is "".
+  bool IsEmpty() const { return pathname_.empty(); }
 
   // If input name has a trailing separator character, removes it and returns
   // the name, otherwise return the name string unmodified.
@@ -201,7 +197,7 @@ class GTEST_API_ FilePath {
   // separators. Returns NULL if no path separator was found.
   const char* FindLastPathSeparator() const;
 
-  String pathname_;
+  std::string pathname_;
 };  // class FilePath
 
 }  // namespace internal
index 7aa1197..ebd1cf6 100755 (executable)
 # include <unistd.h>
 #endif  // GTEST_OS_LINUX
 
+#if GTEST_HAS_EXCEPTIONS
+# include <stdexcept>
+#endif
+
 #include <ctype.h>
+#include <float.h>
 #include <string.h>
 #include <iomanip>
 #include <limits>
+#include <map>
 #include <set>
+#include <string>
+#include <vector>
 
+#include "gtest/gtest-message.h"
 #include "gtest/internal/gtest-string.h"
 #include "gtest/internal/gtest-filepath.h"
 #include "gtest/internal/gtest-type-util.h"
 #define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
 #define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
 
-// Google Test defines the testing::Message class to allow construction of
-// test messages via the << operator.  The idea is that anything
-// streamable to std::ostream can be streamed to a testing::Message.
-// This allows a user to use his own types in Google Test assertions by
-// overloading the << operator.
-//
-// util/gtl/stl_logging-inl.h overloads << for STL containers.  These
-// overloads cannot be defined in the std namespace, as that will be
-// undefined behavior.  Therefore, they are defined in the global
-// namespace instead.
-//
-// C++'s symbol lookup rule (i.e. Koenig lookup) says that these
-// overloads are visible in either the std namespace or the global
-// namespace, but not other namespaces, including the testing
-// namespace which Google Test's Message class is in.
-//
-// To allow STL containers (and other types that has a << operator
-// defined in the global namespace) to be used in Google Test assertions,
-// testing::Message must access the custom << operator from the global
-// namespace.  Hence this helper function.
-//
-// Note: Jeffrey Yasskin suggested an alternative fix by "using
-// ::operator<<;" in the definition of Message's operator<<.  That fix
-// doesn't require a helper function, but unfortunately doesn't
-// compile with MSVC.
-template <typename T>
-inline void GTestStreamToHelper(std::ostream* os, const T& val) {
-  *os << val;
-}
-
 class ProtocolMessage;
 namespace proto2 { class Message; }
 
@@ -121,18 +100,10 @@ class ScopedTrace;                     // Implements scoped trace.
 class TestInfoImpl;                    // Opaque implementation of TestInfo
 class UnitTestImpl;                    // Opaque implementation of UnitTest
 
-// How many times InitGoogleTest() has been called.
-extern int g_init_gtest_count;
-
 // The text used in failure messages to indicate the start of the
 // stack trace.
 GTEST_API_ extern const char kStackTraceMarker[];
 
-// A secret type that Google Test users don't know about.  It has no
-// definition on purpose.  Therefore it's impossible to create a
-// Secret object, which is what we want.
-class Secret;
-
 // Two overloaded helpers for checking at compile time whether an
 // expression is a null pointer literal (i.e. NULL or any 0-valued
 // compile-time integral constant).  Their return values have
@@ -163,8 +134,23 @@ char (&IsNullLiteralHelper(...))[2];  // NOLINT
 #endif  // GTEST_ELLIPSIS_NEEDS_POD_
 
 // Appends the user-supplied message to the Google-Test-generated message.
-GTEST_API_ String AppendUserMessage(const String& gtest_msg,
-                                    const Message& user_msg);
+GTEST_API_ std::string AppendUserMessage(
+    const std::string& gtest_msg, const Message& user_msg);
+
+#if GTEST_HAS_EXCEPTIONS
+
+// This exception is thrown by (and only by) a failed Google Test
+// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
+// are enabled).  We derive it from std::runtime_error, which is for
+// errors presumably detectable only at run time.  Since
+// std::runtime_error inherits from std::exception, many testing
+// frameworks know how to extract and print the message inside it.
+class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
+ public:
+  explicit GoogleTestFailureException(const TestPartResult& failure);
+};
+
+#endif  // GTEST_HAS_EXCEPTIONS
 
 // A helper class for creating scoped traces in user programs.
 class GTEST_API_ ScopedTrace {
@@ -185,76 +171,35 @@ class GTEST_API_ ScopedTrace {
                             // c'tor and d'tor.  Therefore it doesn't
                             // need to be used otherwise.
 
-// Converts a streamable value to a String.  A NULL pointer is
-// converted to "(null)".  When the input value is a ::string,
-// ::std::string, ::wstring, or ::std::wstring object, each NUL
-// character in it is replaced with "\\0".
-// Declared here but defined in gtest.h, so that it has access
-// to the definition of the Message class, required by the ARM
-// compiler.
-template <typename T>
-String StreamableToString(const T& streamable);
-
-// The Symbian compiler has a bug that prevents it from selecting the
-// correct overload of FormatForComparisonFailureMessage (see below)
-// unless we pass the first argument by reference.  If we do that,
-// however, Visual Age C++ 10.1 generates a compiler error.  Therefore
-// we only apply the work-around for Symbian.
-#if defined(__SYMBIAN32__)
-# define GTEST_CREF_WORKAROUND_ const&
-#else
-# define GTEST_CREF_WORKAROUND_
-#endif
-
-// When this operand is a const char* or char*, if the other operand
-// is a ::std::string or ::string, we print this operand as a C string
-// rather than a pointer (we do the same for wide strings); otherwise
-// we print it as a pointer to be safe.
-
-// This internal macro is used to avoid duplicated code.
-#define GTEST_FORMAT_IMPL_(operand2_type, operand1_printer)\
-inline String FormatForComparisonFailureMessage(\
-    operand2_type::value_type* GTEST_CREF_WORKAROUND_ str, \
-    const operand2_type& /*operand2*/) {\
-  return operand1_printer(str);\
-}\
-inline String FormatForComparisonFailureMessage(\
-    const operand2_type::value_type* GTEST_CREF_WORKAROUND_ str, \
-    const operand2_type& /*operand2*/) {\
-  return operand1_printer(str);\
-}
-
-GTEST_FORMAT_IMPL_(::std::string, String::ShowCStringQuoted)
-#if GTEST_HAS_STD_WSTRING
-GTEST_FORMAT_IMPL_(::std::wstring, String::ShowWideCStringQuoted)
-#endif  // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_GLOBAL_STRING
-GTEST_FORMAT_IMPL_(::string, String::ShowCStringQuoted)
-#endif  // GTEST_HAS_GLOBAL_STRING
-#if GTEST_HAS_GLOBAL_WSTRING
-GTEST_FORMAT_IMPL_(::wstring, String::ShowWideCStringQuoted)
-#endif  // GTEST_HAS_GLOBAL_WSTRING
-
-#undef GTEST_FORMAT_IMPL_
-
-// The next four overloads handle the case where the operand being
-// printed is a char/wchar_t pointer and the other operand is not a
-// string/wstring object.  In such cases, we just print the operand as
-// a pointer to be safe.
-#define GTEST_FORMAT_CHAR_PTR_IMPL_(CharType)                       \
-  template <typename T>                                             \
-  String FormatForComparisonFailureMessage(CharType* GTEST_CREF_WORKAROUND_ p, \
-                                           const T&) { \
-    return PrintToString(static_cast<const void*>(p));              \
-  }
-
-GTEST_FORMAT_CHAR_PTR_IMPL_(char)
-GTEST_FORMAT_CHAR_PTR_IMPL_(const char)
-GTEST_FORMAT_CHAR_PTR_IMPL_(wchar_t)
-GTEST_FORMAT_CHAR_PTR_IMPL_(const wchar_t)
-
-#undef GTEST_FORMAT_CHAR_PTR_IMPL_
+namespace edit_distance {
+// Returns the optimal edits to go from 'left' to 'right'.
+// All edits cost the same, with replace having lower priority than
+// add/remove.
+// Simple implementation of the Wagner–Fischer algorithm.
+// See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm
+enum EditType { kMatch, kAdd, kRemove, kReplace };
+GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
+    const std::vector<size_t>& left, const std::vector<size_t>& right);
+
+// Same as above, but the input is represented as strings.
+GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
+    const std::vector<std::string>& left,
+    const std::vector<std::string>& right);
+
+// Create a diff of the input strings in Unified diff format.
+GTEST_API_ std::string CreateUnifiedDiff(const std::vector<std::string>& left,
+                                         const std::vector<std::string>& right,
+                                         size_t context = 2);
+
+}  // namespace edit_distance
+
+// Calculate the diff between 'left' and 'right' and return it in unified diff
+// format.
+// If not null, stores in 'total_line_count' the total number of lines found
+// in left + right.
+GTEST_API_ std::string DiffStrings(const std::string& left,
+                                   const std::string& right,
+                                   size_t* total_line_count);
 
 // Constructs and returns the message for an equality assertion
 // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
@@ -273,12 +218,12 @@ GTEST_FORMAT_CHAR_PTR_IMPL_(const wchar_t)
 // be inserted into the message.
 GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
                                      const char* actual_expression,
-                                     const String& expected_value,
-                                     const String& actual_value,
+                                     const std::string& expected_value,
+                                     const std::string& actual_value,
                                      bool ignoring_case);
 
 // Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
-GTEST_API_ String GetBoolAssertionFailureMessage(
+GTEST_API_ std::string GetBoolAssertionFailureMessage(
     const AssertionResult& assertion_result,
     const char* expression_text,
     const char* actual_predicate_value,
@@ -353,7 +298,7 @@ class FloatingPoint {
   // bits.  Therefore, 4 should be enough for ordinary use.
   //
   // See the following article for more details on ULP:
-  // http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm.
+  // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
   static const size_t kMaxUlps = 4;
 
   // Constructs a FloatingPoint from a raw floating-point number.
@@ -380,6 +325,9 @@ class FloatingPoint {
     return ReinterpretBits(kExponentBitMask);
   }
 
+  // Returns the maximum representable finite floating-point number.
+  static RawType Max();
+
   // Non-static methods
 
   // Returns the bits that represents this number.
@@ -460,6 +408,13 @@ class FloatingPoint {
   FloatingPointUnion u_;
 };
 
+// We cannot use std::numeric_limits<T>::max() as it clashes with the max()
+// macro defined by <windows.h>.
+template <>
+inline float FloatingPoint<float>::Max() { return FLT_MAX; }
+template <>
+inline double FloatingPoint<double>::Max() { return DBL_MAX; }
+
 // Typedefs the instances of the FloatingPoint template class that we
 // care to use.
 typedef FloatingPoint<float> Float;
@@ -546,6 +501,13 @@ GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
 typedef void (*SetUpTestCaseFunc)();
 typedef void (*TearDownTestCaseFunc)();
 
+struct CodeLocation {
+  CodeLocation(const string& a_file, int a_line) : file(a_file), line(a_line) {}
+
+  string file;
+  int line;
+};
+
 // Creates a new TestInfo object and registers it with Google Test;
 // returns the created object.
 //
@@ -554,9 +516,10 @@ typedef void (*TearDownTestCaseFunc)();
 //   test_case_name:   name of the test case
 //   name:             name of the test
 //   type_param        the name of the test's type parameter, or NULL if
-//                     this is not  a typed or a type-parameterized test.
+//                     this is not a typed or a type-parameterized test.
 //   value_param       text representation of the test's value parameter,
 //                     or NULL if this is not a type-parameterized test.
+//   code_location:    code location where the test is defined
 //   fixture_class_id: ID of the test fixture class
 //   set_up_tc:        pointer to the function that sets up the test case
 //   tear_down_tc:     pointer to the function that tears down the test case
@@ -564,9 +527,11 @@ typedef void (*TearDownTestCaseFunc)();
 //                     The newly created TestInfo instance will assume
 //                     ownership of the factory object.
 GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
-    const char* test_case_name, const char* name,
+    const char* test_case_name,
+    const char* name,
     const char* type_param,
     const char* value_param,
+    CodeLocation code_location,
     TypeId fixture_class_id,
     SetUpTestCaseFunc set_up_tc,
     TearDownTestCaseFunc tear_down_tc,
@@ -596,10 +561,21 @@ class GTEST_API_ TypedTestCasePState {
       fflush(stderr);
       posix::Abort();
     }
-    defined_test_names_.insert(test_name);
+    registered_tests_.insert(
+        ::std::make_pair(test_name, CodeLocation(file, line)));
     return true;
   }
 
+  bool TestExists(const std::string& test_name) const {
+    return registered_tests_.count(test_name) > 0;
+  }
+
+  const CodeLocation& GetCodeLocation(const std::string& test_name) const {
+    RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name);
+    GTEST_CHECK_(it != registered_tests_.end());
+    return it->second;
+  }
+
   // Verifies that registered_tests match the test names in
   // defined_test_names_; returns registered_tests if successful, or
   // aborts the program otherwise.
@@ -607,8 +583,10 @@ class GTEST_API_ TypedTestCasePState {
       const char* file, int line, const char* registered_tests);
 
  private:
+  typedef ::std::map<std::string, CodeLocation> RegisteredTestsMap;
+
   bool registered_;
-  ::std::set<const char*> defined_test_names_;
+  RegisteredTestsMap registered_tests_;
 };
 
 // Skips to the first non-space char after the first comma in 'str';
@@ -624,11 +602,16 @@ inline const char* SkipComma(const char* str) {
 
 // Returns the prefix of 'str' before the first comma in it; returns
 // the entire string if it contains no comma.
-inline String GetPrefixUntilComma(const char* str) {
+inline std::string GetPrefixUntilComma(const char* str) {
   const char* comma = strchr(str, ',');
-  return comma == NULL ? String(str) : String(str, comma - str);
+  return comma == NULL ? str : std::string(str, comma);
 }
 
+// Splits a given string on a given delimiter, populating a given
+// vector with the fields.
+void SplitString(const ::std::string& str, char delimiter,
+                 ::std::vector< ::std::string>* dest);
+
 // TypeParameterizedTest<Fixture, TestSel, Types>::Register()
 // registers a list of type-parameterized tests with Google Test.  The
 // return value is insignificant - we just need to return something
@@ -643,8 +626,10 @@ class TypeParameterizedTest {
   // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,
   // Types).  Valid values for 'index' are [0, N - 1] where N is the
   // length of Types.
-  static bool Register(const char* prefix, const char* case_name,
-                       const char* test_names, int index) {
+  static bool Register(const char* prefix,
+                       CodeLocation code_location,
+                       const char* case_name, const char* test_names,
+                       int index) {
     typedef typename Types::Head Type;
     typedef Fixture<Type> FixtureClass;
     typedef typename GTEST_BIND_(TestSel, Type) TestClass;
@@ -652,11 +637,12 @@ class TypeParameterizedTest {
     // First, registers the first type-parameterized test in the type
     // list.
     MakeAndRegisterTestInfo(
-        String::Format("%s%s%s/%d", prefix, prefix[0] == '\0' ? "" : "/",
-                       case_name, index).c_str(),
-        GetPrefixUntilComma(test_names).c_str(),
+        (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/"
+         + StreamableToString(index)).c_str(),
+        StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(),
         GetTypeName<Type>().c_str(),
         NULL,  // No value parameter.
+        code_location,
         GetTypeId<FixtureClass>(),
         TestClass::SetUpTestCase,
         TestClass::TearDownTestCase,
@@ -664,7 +650,7 @@ class TypeParameterizedTest {
 
     // Next, recurses (at compile time) with the tail of the type list.
     return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>
-        ::Register(prefix, case_name, test_names, index + 1);
+        ::Register(prefix, code_location, case_name, test_names, index + 1);
   }
 };
 
@@ -672,8 +658,9 @@ class TypeParameterizedTest {
 template <GTEST_TEMPLATE_ Fixture, class TestSel>
 class TypeParameterizedTest<Fixture, TestSel, Types0> {
  public:
-  static bool Register(const char* /*prefix*/, const char* /*case_name*/,
-                       const char* /*test_names*/, int /*index*/) {
+  static bool Register(const char* /*prefix*/, CodeLocation,
+                       const char* /*case_name*/, const char* /*test_names*/,
+                       int /*index*/) {
     return true;
   }
 };
@@ -685,17 +672,31 @@ class TypeParameterizedTest<Fixture, TestSel, Types0> {
 template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
 class TypeParameterizedTestCase {
  public:
-  static bool Register(const char* prefix, const char* case_name,
-                       const char* test_names) {
+  static bool Register(const char* prefix, CodeLocation code_location,
+                       const TypedTestCasePState* state,
+                       const char* case_name, const char* test_names) {
+    std::string test_name = StripTrailingSpaces(
+        GetPrefixUntilComma(test_names));
+    if (!state->TestExists(test_name)) {
+      fprintf(stderr, "Failed to get code location for test %s.%s at %s.",
+              case_name, test_name.c_str(),
+              FormatFileLocation(code_location.file.c_str(),
+                                 code_location.line).c_str());
+      fflush(stderr);
+      posix::Abort();
+    }
+    const CodeLocation& test_location = state->GetCodeLocation(test_name);
+
     typedef typename Tests::Head Head;
 
     // First, register the first test in 'Test' for each type in 'Types'.
     TypeParameterizedTest<Fixture, Head, Types>::Register(
-        prefix, case_name, test_names, 0);
+        prefix, test_location, case_name, test_names, 0);
 
     // Next, recurses (at compile time) with the tail of the test list.
     return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>
-        ::Register(prefix, case_name, SkipComma(test_names));
+        ::Register(prefix, code_location, state,
+                   case_name, SkipComma(test_names));
   }
 };
 
@@ -703,15 +704,16 @@ class TypeParameterizedTestCase {
 template <GTEST_TEMPLATE_ Fixture, typename Types>
 class TypeParameterizedTestCase<Fixture, Templates0, Types> {
  public:
-  static bool Register(const char* /*prefix*/, const char* /*case_name*/,
-                       const char* /*test_names*/) {
+  static bool Register(const char* /*prefix*/, CodeLocation,
+                       const TypedTestCasePState* /*state*/,
+                       const char* /*case_name*/, const char* /*test_names*/) {
     return true;
   }
 };
 
 #endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
 
-// Returns the current OS stack trace as a String.
+// Returns the current OS stack trace as an std::string.
 //
 // The maximum number of stack frames to be included is specified by
 // the gtest_stack_trace_depth flag.  The skip_count parameter
@@ -721,8 +723,8 @@ class TypeParameterizedTestCase<Fixture, Templates0, Types> {
 // For example, if Foo() calls Bar(), which in turn calls
 // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
 // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
-GTEST_API_ String GetCurrentOsStackTraceExceptTop(UnitTest* unit_test,
-                                                  int skip_count);
+GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(
+    UnitTest* unit_test, int skip_count);
 
 // Helpers for suppressing warnings on unreachable code or constant
 // condition.
@@ -797,13 +799,19 @@ struct RemoveConst<const T> { typedef T type; };  // NOLINT
 // MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above
 // definition to fail to remove the const in 'const int[3]' and 'const
 // char[3][4]'.  The following specialization works around the bug.
-// However, it causes trouble with GCC and thus needs to be
-// conditionally compiled.
-#if defined(_MSC_VER) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
 template <typename T, size_t N>
 struct RemoveConst<const T[N]> {
   typedef typename RemoveConst<T>::type type[N];
 };
+
+#if defined(_MSC_VER) && _MSC_VER < 1400
+// This is the only specialization that allows VC++ 7.1 to remove const in
+// 'const int[3] and 'const int[3][4]'.  However, it causes trouble with GCC
+// and thus needs to be conditionally compiled.
+template <typename T, size_t N>
+struct RemoveConst<T[N]> {
+  typedef typename RemoveConst<T>::type type[N];
+};
 #endif
 
 // A handy wrapper around RemoveConst that works when the argument
@@ -852,7 +860,7 @@ class ImplicitlyConvertible {
   // MakeFrom() is an expression whose type is From.  We cannot simply
   // use From(), as the type From may not have a public default
   // constructor.
-  static From MakeFrom();
+  static typename AddReference<From>::type MakeFrom();
 
   // These two functions are overloaded.  Given an expression
   // Helper(x), the compiler will pick the first version if x can be
@@ -870,25 +878,20 @@ class ImplicitlyConvertible {
   // We have to put the 'public' section after the 'private' section,
   // or MSVC refuses to compile the code.
  public:
-  // MSVC warns about implicitly converting from double to int for
-  // possible loss of data, so we need to temporarily disable the
-  // warning.
-#ifdef _MSC_VER
-# pragma warning(push)          // Saves the current warning state.
-# pragma warning(disable:4244)  // Temporarily disables warning 4244.
-
-  static const bool value =
-      sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
-# pragma warning(pop)           // Restores the warning state.
-#elif defined(__BORLANDC__)
+#if defined(__BORLANDC__)
   // C++Builder cannot use member overload resolution during template
   // instantiation.  The simplest workaround is to use its C++0x type traits
   // functions (C++Builder 2009 and above only).
   static const bool value = __is_convertible(From, To);
 #else
+  // MSVC warns about implicitly converting from double to int for
+  // possible loss of data, so we need to temporarily disable the
+  // warning.
+  GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244)
   static const bool value =
       sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
-#endif  // _MSV_VER
+  GTEST_DISABLE_MSC_WARNINGS_POP_()
+#endif  // __BORLANDC__
 };
 template <typename From, typename To>
 const bool ImplicitlyConvertible<From, To>::value;
@@ -1014,11 +1017,10 @@ void CopyArray(const T* from, size_t size, U* to) {
 
 // The relation between an NativeArray object (see below) and the
 // native array it represents.
-enum RelationToSource {
-  kReference,  // The NativeArray references the native array.
-  kCopy        // The NativeArray makes a copy of the native array and
-               // owns the copy.
-};
+// We use 2 different structs to allow non-copyable types to be used, as long
+// as RelationToSourceReference() is passed.
+struct RelationToSourceReference {};
+struct RelationToSourceCopy {};
 
 // Adapts a native array to a read-only STL-style container.  Instead
 // of the complete STL container concept, this adaptor only implements
@@ -1036,22 +1038,23 @@ class NativeArray {
   typedef Element* iterator;
   typedef const Element* const_iterator;
 
-  // Constructs from a native array.
-  NativeArray(const Element* array, size_t count, RelationToSource relation) {
-    Init(array, count, relation);
+  // Constructs from a native array. References the source.
+  NativeArray(const Element* array, size_t count, RelationToSourceReference) {
+    InitRef(array, count);
+  }
+
+  // Constructs from a native array. Copies the source.
+  NativeArray(const Element* array, size_t count, RelationToSourceCopy) {
+    InitCopy(array, count);
   }
 
   // Copy constructor.
   NativeArray(const NativeArray& rhs) {
-    Init(rhs.array_, rhs.size_, rhs.relation_to_source_);
+    (this->*rhs.clone_)(rhs.array_, rhs.size_);
   }
 
   ~NativeArray() {
-    // Ensures that the user doesn't instantiate NativeArray with a
-    // const or reference type.
-    static_cast<void>(StaticAssertTypeEqHelper<Element,
-        GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>());
-    if (relation_to_source_ == kCopy)
+    if (clone_ != &NativeArray::InitRef)
       delete[] array_;
   }
 
@@ -1065,23 +1068,30 @@ class NativeArray {
   }
 
  private:
-  // Initializes this object; makes a copy of the input array if
-  // 'relation' is kCopy.
-  void Init(const Element* array, size_t a_size, RelationToSource relation) {
-    if (relation == kReference) {
-      array_ = array;
-    } else {
-      Element* const copy = new Element[a_size];
-      CopyArray(array, a_size, copy);
-      array_ = copy;
-    }
+  enum {
+    kCheckTypeIsNotConstOrAReference = StaticAssertTypeEqHelper<
+        Element, GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>::value,
+  };
+
+  // Initializes this object with a copy of the input.
+  void InitCopy(const Element* array, size_t a_size) {
+    Element* const copy = new Element[a_size];
+    CopyArray(array, a_size, copy);
+    array_ = copy;
     size_ = a_size;
-    relation_to_source_ = relation;
+    clone_ = &NativeArray::InitCopy;
+  }
+
+  // Initializes this object with a reference of the input.
+  void InitRef(const Element* array, size_t a_size) {
+    array_ = array;
+    size_ = a_size;
+    clone_ = &NativeArray::InitRef;
   }
 
   const Element* array_;
   size_t size_;
-  RelationToSource relation_to_source_;
+  void (NativeArray::*clone_)(const Element*, size_t);
 
   GTEST_DISALLOW_ASSIGN_(NativeArray);
 };
@@ -1216,6 +1226,7 @@ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
   ::test_info_ =\
     ::testing::internal::MakeAndRegisterTestInfo(\
         #test_case_name, #test_name, NULL, NULL, \
+        ::testing::internal::CodeLocation(__FILE__, __LINE__), \
         (parent_id), \
         parent_class::SetUpTestCase, \
         parent_class::TearDownTestCase, \
@@ -1224,3 +1235,4 @@ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
 
 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
+
index 57147b4..3602942 100755 (executable)
@@ -105,25 +105,35 @@ class linked_ptr_internal {
   // framework.
 
   // Join an existing circle.
-  // L < g_linked_ptr_mutex
-  void join(linked_ptr_internal const* ptr) {
+  void join(linked_ptr_internal const* ptr)
+      GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
     MutexLock lock(&g_linked_ptr_mutex);
 
     linked_ptr_internal const* p = ptr;
-    while (p->next_ != ptr) p = p->next_;
+    while (p->next_ != ptr) {
+      assert(p->next_ != this &&
+             "Trying to join() a linked ring we are already in. "
+             "Is GMock thread safety enabled?");
+      p = p->next_;
+    }
     p->next_ = this;
     next_ = ptr;
   }
 
   // Leave whatever circle we're part of.  Returns true if we were the
   // last member of the circle.  Once this is done, you can join() another.
-  // L < g_linked_ptr_mutex
-  bool depart() {
+  bool depart()
+      GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
     MutexLock lock(&g_linked_ptr_mutex);
 
     if (next_ == this) return true;
     linked_ptr_internal const* p = next_;
-    while (p->next_ != this) p = p->next_;
+    while (p->next_ != this) {
+      assert(p->next_ != next_ &&
+             "Trying to depart() a linked ring we are not in. "
+             "Is GMock thread safety enabled?");
+      p = p->next_;
+    }
     p->next_ = next_;
     return false;
   }
index 2582675..4d1d81d 100755 (executable)
@@ -40,7 +40,7 @@
 // and at most 10 arguments in Combine. Please contact
 // googletestframework@googlegroups.com if you need more.
 // Please note that the number of arguments to Combine is limited
-// by the maximum arity of the implementation of tr1::tuple which is
+// by the maximum arity of the implementation of tuple which is
 // currently set at 10.
 
 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
@@ -79,7 +79,10 @@ class ValueArray1 {
   explicit ValueArray1(T1 v1) : v1_(v1) {}
 
   template <typename T>
-  operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }
+  operator ParamGenerator<T>() const {
+    const T array[] = {static_cast<T>(v1_)};
+    return ValuesIn(array);
+  }
 
  private:
   // No implementation - assignment is unsupported.
@@ -95,7 +98,7 @@ class ValueArray2 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_)};
     return ValuesIn(array);
   }
 
@@ -114,7 +117,8 @@ class ValueArray3 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_)};
     return ValuesIn(array);
   }
 
@@ -135,7 +139,8 @@ class ValueArray4 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_)};
     return ValuesIn(array);
   }
 
@@ -157,7 +162,8 @@ class ValueArray5 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_)};
     return ValuesIn(array);
   }
 
@@ -181,7 +187,9 @@ class ValueArray6 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_)};
     return ValuesIn(array);
   }
 
@@ -206,7 +214,9 @@ class ValueArray7 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_)};
     return ValuesIn(array);
   }
 
@@ -233,7 +243,9 @@ class ValueArray8 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_)};
     return ValuesIn(array);
   }
 
@@ -261,7 +273,10 @@ class ValueArray9 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_)};
     return ValuesIn(array);
   }
 
@@ -290,7 +305,10 @@ class ValueArray10 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_)};
     return ValuesIn(array);
   }
 
@@ -321,7 +339,10 @@ class ValueArray11 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_)};
     return ValuesIn(array);
   }
 
@@ -353,8 +374,11 @@ class ValueArray12 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_)};
     return ValuesIn(array);
   }
 
@@ -388,8 +412,11 @@ class ValueArray13 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_)};
     return ValuesIn(array);
   }
 
@@ -424,8 +451,11 @@ class ValueArray14 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_)};
     return ValuesIn(array);
   }
 
@@ -461,8 +491,12 @@ class ValueArray15 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_)};
     return ValuesIn(array);
   }
 
@@ -501,8 +535,12 @@ class ValueArray16 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_)};
     return ValuesIn(array);
   }
 
@@ -542,8 +580,12 @@ class ValueArray17 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_)};
     return ValuesIn(array);
   }
 
@@ -584,8 +626,13 @@ class ValueArray18 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_)};
     return ValuesIn(array);
   }
 
@@ -627,8 +674,13 @@ class ValueArray19 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_)};
     return ValuesIn(array);
   }
 
@@ -672,8 +724,13 @@ class ValueArray20 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_)};
     return ValuesIn(array);
   }
 
@@ -719,8 +776,14 @@ class ValueArray21 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_)};
     return ValuesIn(array);
   }
 
@@ -767,8 +830,14 @@ class ValueArray22 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_)};
     return ValuesIn(array);
   }
 
@@ -817,9 +886,14 @@ class ValueArray23 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_,
-        v23_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_)};
     return ValuesIn(array);
   }
 
@@ -869,9 +943,15 @@ class ValueArray24 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_)};
     return ValuesIn(array);
   }
 
@@ -922,9 +1002,15 @@ class ValueArray25 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_)};
     return ValuesIn(array);
   }
 
@@ -977,9 +1063,15 @@ class ValueArray26 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_)};
     return ValuesIn(array);
   }
 
@@ -1034,9 +1126,16 @@ class ValueArray27 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_)};
     return ValuesIn(array);
   }
 
@@ -1092,9 +1191,16 @@ class ValueArray28 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_)};
     return ValuesIn(array);
   }
 
@@ -1151,9 +1257,16 @@ class ValueArray29 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_)};
     return ValuesIn(array);
   }
 
@@ -1212,9 +1325,17 @@ class ValueArray30 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_)};
     return ValuesIn(array);
   }
 
@@ -1275,9 +1396,17 @@ class ValueArray31 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_)};
     return ValuesIn(array);
   }
 
@@ -1339,9 +1468,17 @@ class ValueArray32 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_)};
     return ValuesIn(array);
   }
 
@@ -1405,9 +1542,18 @@ class ValueArray33 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_)};
     return ValuesIn(array);
   }
 
@@ -1472,9 +1618,18 @@ class ValueArray34 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_)};
     return ValuesIn(array);
   }
 
@@ -1540,10 +1695,18 @@ class ValueArray35 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_,
-        v35_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_)};
     return ValuesIn(array);
   }
 
@@ -1611,10 +1774,19 @@ class ValueArray36 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_)};
     return ValuesIn(array);
   }
 
@@ -1684,10 +1856,19 @@ class ValueArray37 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_)};
     return ValuesIn(array);
   }
 
@@ -1758,10 +1939,19 @@ class ValueArray38 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_)};
     return ValuesIn(array);
   }
 
@@ -1833,10 +2023,20 @@ class ValueArray39 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_)};
     return ValuesIn(array);
   }
 
@@ -1910,10 +2110,20 @@ class ValueArray40 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_)};
     return ValuesIn(array);
   }
 
@@ -1989,10 +2199,20 @@ class ValueArray41 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_)};
     return ValuesIn(array);
   }
 
@@ -2069,10 +2289,21 @@ class ValueArray42 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_)};
     return ValuesIn(array);
   }
 
@@ -2150,10 +2381,21 @@ class ValueArray43 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_)};
     return ValuesIn(array);
   }
 
@@ -2233,10 +2475,21 @@ class ValueArray44 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_)};
     return ValuesIn(array);
   }
 
@@ -2317,10 +2570,22 @@ class ValueArray45 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
+        static_cast<T>(v45_)};
     return ValuesIn(array);
   }
 
@@ -2403,10 +2668,22 @@ class ValueArray46 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
+        static_cast<T>(v45_), static_cast<T>(v46_)};
     return ValuesIn(array);
   }
 
@@ -2491,11 +2768,22 @@ class ValueArray47 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_,
-        v47_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
+        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_)};
     return ValuesIn(array);
   }
 
@@ -2581,11 +2869,23 @@ class ValueArray48 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
-        v48_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
+        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
+        static_cast<T>(v48_)};
     return ValuesIn(array);
   }
 
@@ -2672,11 +2972,23 @@ class ValueArray49 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
-        v48_, v49_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
+        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
+        static_cast<T>(v48_), static_cast<T>(v49_)};
     return ValuesIn(array);
   }
 
@@ -2764,11 +3076,23 @@ class ValueArray50 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
-        v48_, v49_, v50_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
+        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
+        static_cast<T>(v48_), static_cast<T>(v49_), static_cast<T>(v50_)};
     return ValuesIn(array);
   }
 
@@ -2836,9 +3160,9 @@ class ValueArray50 {
 //
 template <typename T1, typename T2>
 class CartesianProductGenerator2
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2> > {
+    : public ParamGeneratorInterface< ::testing::tuple<T1, T2> > {
  public:
-  typedef ::std::tr1::tuple<T1, T2> ParamType;
+  typedef ::testing::tuple<T1, T2> ParamType;
 
   CartesianProductGenerator2(const ParamGenerator<T1>& g1,
       const ParamGenerator<T2>& g2)
@@ -2951,9 +3275,9 @@ class CartesianProductGenerator2
 
 template <typename T1, typename T2, typename T3>
 class CartesianProductGenerator3
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3> > {
+    : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3> > {
  public:
-  typedef ::std::tr1::tuple<T1, T2, T3> ParamType;
+  typedef ::testing::tuple<T1, T2, T3> ParamType;
 
   CartesianProductGenerator3(const ParamGenerator<T1>& g1,
       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)
@@ -3083,9 +3407,9 @@ class CartesianProductGenerator3
 
 template <typename T1, typename T2, typename T3, typename T4>
 class CartesianProductGenerator4
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4> > {
+    : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4> > {
  public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4> ParamType;
+  typedef ::testing::tuple<T1, T2, T3, T4> ParamType;
 
   CartesianProductGenerator4(const ParamGenerator<T1>& g1,
       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
@@ -3234,9 +3558,9 @@ class CartesianProductGenerator4
 
 template <typename T1, typename T2, typename T3, typename T4, typename T5>
 class CartesianProductGenerator5
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5> > {
+    : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5> > {
  public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5> ParamType;
+  typedef ::testing::tuple<T1, T2, T3, T4, T5> ParamType;
 
   CartesianProductGenerator5(const ParamGenerator<T1>& g1,
       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
@@ -3402,10 +3726,10 @@ class CartesianProductGenerator5
 template <typename T1, typename T2, typename T3, typename T4, typename T5,
     typename T6>
 class CartesianProductGenerator6
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
+    : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5,
         T6> > {
  public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> ParamType;
+  typedef ::testing::tuple<T1, T2, T3, T4, T5, T6> ParamType;
 
   CartesianProductGenerator6(const ParamGenerator<T1>& g1,
       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
@@ -3588,10 +3912,10 @@ class CartesianProductGenerator6
 template <typename T1, typename T2, typename T3, typename T4, typename T5,
     typename T6, typename T7>
 class CartesianProductGenerator7
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
+    : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
         T7> > {
  public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;
+  typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;
 
   CartesianProductGenerator7(const ParamGenerator<T1>& g1,
       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
@@ -3791,10 +4115,10 @@ class CartesianProductGenerator7
 template <typename T1, typename T2, typename T3, typename T4, typename T5,
     typename T6, typename T7, typename T8>
 class CartesianProductGenerator8
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
+    : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
         T7, T8> > {
  public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;
+  typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;
 
   CartesianProductGenerator8(const ParamGenerator<T1>& g1,
       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
@@ -4013,10 +4337,10 @@ class CartesianProductGenerator8
 template <typename T1, typename T2, typename T3, typename T4, typename T5,
     typename T6, typename T7, typename T8, typename T9>
 class CartesianProductGenerator9
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
+    : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
         T7, T8, T9> > {
  public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;
+  typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;
 
   CartesianProductGenerator9(const ParamGenerator<T1>& g1,
       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
@@ -4252,10 +4576,10 @@ class CartesianProductGenerator9
 template <typename T1, typename T2, typename T3, typename T4, typename T5,
     typename T6, typename T7, typename T8, typename T9, typename T10>
 class CartesianProductGenerator10
-    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
+    : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
         T7, T8, T9, T10> > {
  public:
-  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;
+  typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;
 
   CartesianProductGenerator10(const ParamGenerator<T1>& g1,
       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
@@ -4517,8 +4841,8 @@ class CartesianProductHolder2 {
 CartesianProductHolder2(const Generator1& g1, const Generator2& g2)
       : g1_(g1), g2_(g2) {}
   template <typename T1, typename T2>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2> >(
+  operator ParamGenerator< ::testing::tuple<T1, T2> >() const {
+    return ParamGenerator< ::testing::tuple<T1, T2> >(
         new CartesianProductGenerator2<T1, T2>(
         static_cast<ParamGenerator<T1> >(g1_),
         static_cast<ParamGenerator<T2> >(g2_)));
@@ -4539,8 +4863,8 @@ CartesianProductHolder3(const Generator1& g1, const Generator2& g2,
     const Generator3& g3)
       : g1_(g1), g2_(g2), g3_(g3) {}
   template <typename T1, typename T2, typename T3>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >(
+  operator ParamGenerator< ::testing::tuple<T1, T2, T3> >() const {
+    return ParamGenerator< ::testing::tuple<T1, T2, T3> >(
         new CartesianProductGenerator3<T1, T2, T3>(
         static_cast<ParamGenerator<T1> >(g1_),
         static_cast<ParamGenerator<T2> >(g2_),
@@ -4564,8 +4888,8 @@ CartesianProductHolder4(const Generator1& g1, const Generator2& g2,
     const Generator3& g3, const Generator4& g4)
       : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
   template <typename T1, typename T2, typename T3, typename T4>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >(
+  operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4> >() const {
+    return ParamGenerator< ::testing::tuple<T1, T2, T3, T4> >(
         new CartesianProductGenerator4<T1, T2, T3, T4>(
         static_cast<ParamGenerator<T1> >(g1_),
         static_cast<ParamGenerator<T2> >(g2_),
@@ -4591,8 +4915,8 @@ CartesianProductHolder5(const Generator1& g1, const Generator2& g2,
     const Generator3& g3, const Generator4& g4, const Generator5& g5)
       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
   template <typename T1, typename T2, typename T3, typename T4, typename T5>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >(
+  operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5> >() const {
+    return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5> >(
         new CartesianProductGenerator5<T1, T2, T3, T4, T5>(
         static_cast<ParamGenerator<T1> >(g1_),
         static_cast<ParamGenerator<T2> >(g2_),
@@ -4622,8 +4946,8 @@ CartesianProductHolder6(const Generator1& g1, const Generator2& g2,
       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
   template <typename T1, typename T2, typename T3, typename T4, typename T5,
       typename T6>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >(
+  operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6> >() const {
+    return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6> >(
         new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>(
         static_cast<ParamGenerator<T1> >(g1_),
         static_cast<ParamGenerator<T2> >(g2_),
@@ -4655,9 +4979,9 @@ CartesianProductHolder7(const Generator1& g1, const Generator2& g2,
       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
   template <typename T1, typename T2, typename T3, typename T4, typename T5,
       typename T6, typename T7>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
+  operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6,
       T7> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> >(
+    return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> >(
         new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>(
         static_cast<ParamGenerator<T1> >(g1_),
         static_cast<ParamGenerator<T2> >(g2_),
@@ -4693,9 +5017,9 @@ CartesianProductHolder8(const Generator1& g1, const Generator2& g2,
           g8_(g8) {}
   template <typename T1, typename T2, typename T3, typename T4, typename T5,
       typename T6, typename T7, typename T8>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7,
+  operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7,
       T8> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(
+    return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(
         new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>(
         static_cast<ParamGenerator<T1> >(g1_),
         static_cast<ParamGenerator<T2> >(g2_),
@@ -4734,9 +5058,9 @@ CartesianProductHolder9(const Generator1& g1, const Generator2& g2,
           g9_(g9) {}
   template <typename T1, typename T2, typename T3, typename T4, typename T5,
       typename T6, typename T7, typename T8, typename T9>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
+  operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
       T9> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
+    return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
         T9> >(
         new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
         static_cast<ParamGenerator<T1> >(g1_),
@@ -4778,10 +5102,10 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
           g9_(g9), g10_(g10) {}
   template <typename T1, typename T2, typename T3, typename T4, typename T5,
       typename T6, typename T7, typename T8, typename T9, typename T10>
-  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
-      T9, T10> >() const {
-    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
-        T9, T10> >(
+  operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9,
+      T10> >() const {
+    return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9,
+        T10> >(
         new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
             T10>(
         static_cast<ParamGenerator<T1> >(g1_),
index dbe9386..5c7c47a 100755 (executable)
@@ -39,7 +39,7 @@ $var maxtuple = 10  $$ Maximum number of Combine arguments we want to support.
 // and at most $maxtuple arguments in Combine. Please contact
 // googletestframework@googlegroups.com if you need more.
 // Please note that the number of arguments to Combine is limited
-// by the maximum arity of the implementation of tr1::tuple which is
+// by the maximum arity of the implementation of tuple which is
 // currently set at $maxtuple.
 
 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
@@ -72,33 +72,18 @@ internal::ParamGenerator<typename Container::value_type> ValuesIn(
 namespace internal {
 
 // Used in the Values() function to provide polymorphic capabilities.
-template <typename T1>
-class ValueArray1 {
- public:
-  explicit ValueArray1(T1 v1) : v1_(v1) {}
-
-  template <typename T>
-  operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }
-
- private:
-  // No implementation - assignment is unsupported.
-  void operator=(const ValueArray1& other);
-
-  const T1 v1_;
-};
-
-$range i 2..n
+$range i 1..n
 $for i [[
 $range j 1..i
 
 template <$for j, [[typename T$j]]>
 class ValueArray$i {
  public:
-  ValueArray$i($for j, [[T$j v$j]]) : $for j, [[v$(j)_(v$j)]] {}
+  $if i==1 [[explicit ]]ValueArray$i($for j, [[T$j v$j]]) : $for j, [[v$(j)_(v$j)]] {}
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {$for j, [[v$(j)_]]};
+    const T array[] = {$for j, [[static_cast<T>(v$(j)_)]]};
     return ValuesIn(array);
   }
 
@@ -128,9 +113,9 @@ $range k 2..i
 
 template <$for j, [[typename T$j]]>
 class CartesianProductGenerator$i
-    : public ParamGeneratorInterface< ::std::tr1::tuple<$for j, [[T$j]]> > {
+    : public ParamGeneratorInterface< ::testing::tuple<$for j, [[T$j]]> > {
  public:
-  typedef ::std::tr1::tuple<$for j, [[T$j]]> ParamType;
+  typedef ::testing::tuple<$for j, [[T$j]]> ParamType;
 
   CartesianProductGenerator$i($for j, [[const ParamGenerator<T$j>& g$j]])
       : $for j, [[g$(j)_(g$j)]] {}
@@ -269,8 +254,8 @@ class CartesianProductHolder$i {
 CartesianProductHolder$i($for j, [[const Generator$j& g$j]])
       : $for j, [[g$(j)_(g$j)]] {}
   template <$for j, [[typename T$j]]>
-  operator ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >() const {
-    return ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >(
+  operator ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >() const {
+    return ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >(
         new CartesianProductGenerator$i<$for j, [[T$j]]>(
 $for j,[[
 
index 0ef9718..82cab9b 100755 (executable)
 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
 
+#include <ctype.h>
+
 #include <iterator>
+#include <set>
 #include <utility>
 #include <vector>
 
 #if GTEST_HAS_PARAM_TEST
 
 namespace testing {
+
+// Input to a parameterized test name generator, describing a test parameter.
+// Consists of the parameter value and the integer parameter index.
+template <class ParamType>
+struct TestParamInfo {
+  TestParamInfo(const ParamType& a_param, size_t an_index) :
+    param(a_param),
+    index(an_index) {}
+  ParamType param;
+  size_t index;
+};
+
+// A builtin parameterized test name generator which returns the result of
+// testing::PrintToString.
+struct PrintToStringParamName {
+  template <class ParamType>
+  std::string operator()(const TestParamInfo<ParamType>& info) const {
+    return PrintToString(info.param);
+  }
+};
+
 namespace internal {
 
 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
@@ -58,7 +82,7 @@ namespace internal {
 // TEST_P macro is used to define two tests with the same name
 // but in different namespaces.
 GTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name,
-                                          const char* file, int line);
+                                          CodeLocation code_location);
 
 template <typename> class ParamGeneratorInterface;
 template <typename> class ParamGenerator;
@@ -206,7 +230,7 @@ class RangeGenerator : public ParamGeneratorInterface<T> {
       return base_;
     }
     virtual void Advance() {
-      value_ = value_ + step_;
+      value_ = static_cast<T>(value_ + step_);
       index_++;
     }
     virtual ParamIteratorInterface<T>* Clone() const {
@@ -243,7 +267,7 @@ class RangeGenerator : public ParamGeneratorInterface<T> {
                                const T& end,
                                const IncrementT& step) {
     int end_index = 0;
-    for (T i = begin; i < end; i = i + step)
+    for (T i = begin; i < end; i = static_cast<T>(i + step))
       end_index++;
     return end_index;
   }
@@ -347,6 +371,37 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
 
 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
 //
+// Default parameterized test name generator, returns a string containing the
+// integer test parameter index.
+template <class ParamType>
+std::string DefaultParamName(const TestParamInfo<ParamType>& info) {
+  Message name_stream;
+  name_stream << info.index;
+  return name_stream.GetString();
+}
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
+// Parameterized test name overload helpers, which help the
+// INSTANTIATE_TEST_CASE_P macro choose between the default parameterized
+// test name generator and user param name generator.
+template <class ParamType, class ParamNameGenFunctor>
+ParamNameGenFunctor GetParamNameGen(ParamNameGenFunctor func) {
+  return func;
+}
+
+template <class ParamType>
+struct ParamNameGenFunc {
+  typedef std::string Type(const TestParamInfo<ParamType>&);
+};
+
+template <class ParamType>
+typename ParamNameGenFunc<ParamType>::Type *GetParamNameGen() {
+  return DefaultParamName;
+}
+
+// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
+//
 // Stores a parameter value and later creates tests parameterized with that
 // value.
 template <class TestClass>
@@ -449,9 +504,11 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
   typedef typename TestCase::ParamType ParamType;
   // A function that returns an instance of appropriate generator type.
   typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
+  typedef typename ParamNameGenFunc<ParamType>::Type ParamNameGeneratorFunc;
 
-  explicit ParameterizedTestCaseInfo(const char* name)
-      : test_case_name_(name) {}
+  explicit ParameterizedTestCaseInfo(
+      const char* name, CodeLocation code_location)
+      : test_case_name_(name), code_location_(code_location) {}
 
   // Test case base name for display purposes.
   virtual const string& GetTestCaseName() const { return test_case_name_; }
@@ -474,9 +531,11 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
   // about a generator.
   int AddTestCaseInstantiation(const string& instantiation_name,
                                GeneratorCreationFunc* func,
-                               const char* /* file */,
-                               int /* line */) {
-    instantiations_.push_back(::std::make_pair(instantiation_name, func));
+                               ParamNameGeneratorFunc* name_func,
+                               const char* file,
+                               int line) {
+    instantiations_.push_back(
+        InstantiationInfo(instantiation_name, func, name_func, file, line));
     return 0;  // Return value used only to run this method in namespace scope.
   }
   // UnitTest class invokes this method to register tests in this test case
@@ -491,25 +550,45 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
       for (typename InstantiationContainer::iterator gen_it =
                instantiations_.begin(); gen_it != instantiations_.end();
                ++gen_it) {
-        const string& instantiation_name = gen_it->first;
-        ParamGenerator<ParamType> generator((*gen_it->second)());
+        const string& instantiation_name = gen_it->name;
+        ParamGenerator<ParamType> generator((*gen_it->generator)());
+        ParamNameGeneratorFunc* name_func = gen_it->name_func;
+        const char* file = gen_it->file;
+        int line = gen_it->line;
 
-        Message test_case_name_stream;
+        string test_case_name;
         if ( !instantiation_name.empty() )
-          test_case_name_stream << instantiation_name << "/";
-        test_case_name_stream << test_info->test_case_base_name;
+          test_case_name = instantiation_name + "/";
+        test_case_name += test_info->test_case_base_name;
 
-        int i = 0;
+        size_t i = 0;
+        std::set<std::string> test_param_names;
         for (typename ParamGenerator<ParamType>::iterator param_it =
                  generator.begin();
              param_it != generator.end(); ++param_it, ++i) {
           Message test_name_stream;
-          test_name_stream << test_info->test_base_name << "/" << i;
+
+          std::string param_name = name_func(
+              TestParamInfo<ParamType>(*param_it, i));
+
+          GTEST_CHECK_(IsValidParamName(param_name))
+              << "Parameterized test name '" << param_name
+              << "' is invalid, in " << file
+              << " line " << line << std::endl;
+
+          GTEST_CHECK_(test_param_names.count(param_name) == 0)
+              << "Duplicate parameterized test name '" << param_name
+              << "', in " << file << " line " << line << std::endl;
+
+          test_param_names.insert(param_name);
+
+          test_name_stream << test_info->test_base_name << "/" << param_name;
           MakeAndRegisterTestInfo(
-              test_case_name_stream.GetString().c_str(),
+              test_case_name.c_str(),
               test_name_stream.GetString().c_str(),
               NULL,  // No type parameter.
               PrintToString(*param_it).c_str(),
+              code_location_,
               GetTestCaseTypeId(),
               TestCase::SetUpTestCase,
               TestCase::TearDownTestCase,
@@ -535,12 +614,45 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
     const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
   };
   typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;
-  // Keeps pairs of <Instantiation name, Sequence generator creation function>
-  // received from INSTANTIATE_TEST_CASE_P macros.
-  typedef ::std::vector<std::pair<string, GeneratorCreationFunc*> >
-      InstantiationContainer;
+  // Records data received from INSTANTIATE_TEST_CASE_P macros:
+  //  <Instantiation name, Sequence generator creation function,
+  //     Name generator function, Source file, Source line>
+  struct InstantiationInfo {
+      InstantiationInfo(const std::string &name_in,
+                        GeneratorCreationFunc* generator_in,
+                        ParamNameGeneratorFunc* name_func_in,
+                        const char* file_in,
+                        int line_in)
+          : name(name_in),
+            generator(generator_in),
+            name_func(name_func_in),
+            file(file_in),
+            line(line_in) {}
+
+      std::string name;
+      GeneratorCreationFunc* generator;
+      ParamNameGeneratorFunc* name_func;
+      const char* file;
+      int line;
+  };
+  typedef ::std::vector<InstantiationInfo> InstantiationContainer;
+
+  static bool IsValidParamName(const std::string& name) {
+    // Check for empty string
+    if (name.empty())
+      return false;
+
+    // Check for invalid characters
+    for (std::string::size_type index = 0; index < name.size(); ++index) {
+      if (!isalnum(name[index]) && name[index] != '_')
+        return false;
+    }
+
+    return true;
+  }
 
   const string test_case_name_;
+  CodeLocation code_location_;
   TestInfoContainer tests_;
   InstantiationContainer instantiations_;
 
@@ -568,8 +680,7 @@ class ParameterizedTestCaseRegistry {
   template <class TestCase>
   ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(
       const char* test_case_name,
-      const char* file,
-      int line) {
+      CodeLocation code_location) {
     ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL;
     for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
          it != test_case_infos_.end(); ++it) {
@@ -578,7 +689,7 @@ class ParameterizedTestCaseRegistry {
           // Complain about incorrect usage of Google Test facilities
           // and terminate the program since we cannot guaranty correct
           // test case setup and tear-down in this case.
-          ReportInvalidTestCaseType(test_case_name,  file, line);
+          ReportInvalidTestCaseType(test_case_name, code_location);
           posix::Abort();
         } else {
           // At this point we are sure that the object we found is of the same
@@ -591,7 +702,8 @@ class ParameterizedTestCaseRegistry {
       }
     }
     if (typed_test_info == NULL) {
-      typed_test_info = new ParameterizedTestCaseInfo<TestCase>(test_case_name);
+      typed_test_info = new ParameterizedTestCaseInfo<TestCase>(
+          test_case_name, code_location);
       test_case_infos_.push_back(typed_test_info);
     }
     return typed_test_info;
diff --git a/include/gtest/internal/gtest-port-arch.h b/include/gtest/internal/gtest-port-arch.h
new file mode 100755 (executable)
index 0000000..74ab949
--- /dev/null
@@ -0,0 +1,93 @@
+// Copyright 2015, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The Google C++ Testing Framework (Google Test)
+//
+// This header file defines the GTEST_OS_* macro.
+// It is separate from gtest-port.h so that custom/gtest-port.h can include it.
+
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
+
+// Determines the platform on which Google Test is compiled.
+#ifdef __CYGWIN__
+# define GTEST_OS_CYGWIN 1
+#elif defined __SYMBIAN32__
+# define GTEST_OS_SYMBIAN 1
+#elif defined _WIN32
+# define GTEST_OS_WINDOWS 1
+# ifdef _WIN32_WCE
+#  define GTEST_OS_WINDOWS_MOBILE 1
+# elif defined(__MINGW__) || defined(__MINGW32__)
+#  define GTEST_OS_WINDOWS_MINGW 1
+# elif defined(WINAPI_FAMILY)
+#  include <winapifamily.h>
+#  if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+#   define GTEST_OS_WINDOWS_DESKTOP 1
+#  elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
+#   define GTEST_OS_WINDOWS_PHONE 1
+#  elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+#   define GTEST_OS_WINDOWS_RT 1
+#  else
+    // WINAPI_FAMILY defined but no known partition matched.
+    // Default to desktop.
+#   define GTEST_OS_WINDOWS_DESKTOP 1
+#  endif
+# else
+#  define GTEST_OS_WINDOWS_DESKTOP 1
+# endif  // _WIN32_WCE
+#elif defined __APPLE__
+# define GTEST_OS_MAC 1
+# if TARGET_OS_IPHONE
+#  define GTEST_OS_IOS 1
+# endif
+#elif defined __FreeBSD__
+# define GTEST_OS_FREEBSD 1
+#elif defined __linux__
+# define GTEST_OS_LINUX 1
+# if defined __ANDROID__
+#  define GTEST_OS_LINUX_ANDROID 1
+# endif
+#elif defined __MVS__
+# define GTEST_OS_ZOS 1
+#elif defined(__sun) && defined(__SVR4)
+# define GTEST_OS_SOLARIS 1
+#elif defined(_AIX)
+# define GTEST_OS_AIX 1
+#elif defined(__hpux)
+# define GTEST_OS_HPUX 1
+#elif defined __native_client__
+# define GTEST_OS_NACL 1
+#elif defined __OpenBSD__
+# define GTEST_OS_OPENBSD 1
+#elif defined __QNX__
+# define GTEST_OS_QNX 1
+#endif  // __CYGWIN__
+
+#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
index 157b47f..0094ed5 100755 (executable)
 // Authors: wan@google.com (Zhanyong Wan)
 //
 // Low-level types and utilities for porting Google Test to various
-// platforms.  They are subject to change without notice.  DO NOT USE
-// THEM IN USER CODE.
+// platforms.  All macros ending with _ and symbols defined in an
+// internal namespace are subject to change without notice.  Code
+// outside Google Test MUST NOT USE THEM DIRECTLY.  Macros that don't
+// end with _ are part of Google Test's public API and can be used by
+// code outside Google Test.
+//
+// This file is fundamental to Google Test.  All other Google Test source
+// files are expected to #include this.  Therefore, it cannot #include
+// any other Google Test header.
 
 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
 
-// The user can define the following macros in the build script to
-// control Google Test's behavior.  If the user doesn't define a macro
-// in this list, Google Test will define it.
+// Environment-describing macros
+// -----------------------------
+//
+// Google Test can be used in many different environments.  Macros in
+// this section tell Google Test what kind of environment it is being
+// used in, such that Google Test can provide environment-specific
+// features and implementations.
+//
+// Google Test tries to automatically detect the properties of its
+// environment, so users usually don't need to worry about these
+// macros.  However, the automatic detection is not perfect.
+// Sometimes it's necessary for a user to define some of the following
+// macros in the build script to override Google Test's decisions.
+//
+// If the user doesn't define a macro in the list, Google Test will
+// provide a default definition.  After this header is #included, all
+// macros in this list will be defined to either 1 or 0.
+//
+// Notes to maintainers:
+//   - Each macro here is a user-tweakable knob; do not grow the list
+//     lightly.
+//   - Use #if to key off these macros.  Don't use #ifdef or "#if
+//     defined(...)", which will not work as these macros are ALWAYS
+//     defined.
 //
 //   GTEST_HAS_CLONE          - Define it to 1/0 to indicate that clone(2)
 //                              is/isn't available.
 //                              Test's own tr1 tuple implementation should be
 //                              used.  Unused when the user sets
 //                              GTEST_HAS_TR1_TUPLE to 0.
+//   GTEST_LANG_CXX11         - Define it to 1/0 to indicate that Google Test
+//                              is building in C++11/C++98 mode.
 //   GTEST_LINKED_AS_SHARED_LIBRARY
 //                            - Define to 1 when compiling tests that use
 //                              Google Test as a shared library (known as
 //                            - Define to 1 when compiling Google Test itself
 //                              as a shared library.
 
-// This header defines the following utilities:
+// Platform-indicating macros
+// --------------------------
+//
+// Macros indicating the platform on which Google Test is being used
+// (a macro is defined to 1 if compiled on the given platform;
+// otherwise UNDEFINED -- it's never defined to 0.).  Google Test
+// defines these macros automatically.  Code outside Google Test MUST
+// NOT define them.
 //
-// Macros indicating the current platform (defined to 1 if compiled on
-// the given platform; otherwise undefined):
 //   GTEST_OS_AIX      - IBM AIX
 //   GTEST_OS_CYGWIN   - Cygwin
+//   GTEST_OS_FREEBSD  - FreeBSD
 //   GTEST_OS_HPUX     - HP-UX
 //   GTEST_OS_LINUX    - Linux
 //     GTEST_OS_LINUX_ANDROID - Google Android
 //   GTEST_OS_MAC      - Mac OS X
+//     GTEST_OS_IOS    - iOS
 //   GTEST_OS_NACL     - Google Native Client (NaCl)
+//   GTEST_OS_OPENBSD  - OpenBSD
+//   GTEST_OS_QNX      - QNX
 //   GTEST_OS_SOLARIS  - Sun Solaris
 //   GTEST_OS_SYMBIAN  - Symbian
 //   GTEST_OS_WINDOWS  - Windows (Desktop, MinGW, or Mobile)
 //     GTEST_OS_WINDOWS_DESKTOP  - Windows Desktop
 //     GTEST_OS_WINDOWS_MINGW    - MinGW
 //     GTEST_OS_WINDOWS_MOBILE   - Windows Mobile
+//     GTEST_OS_WINDOWS_PHONE    - Windows Phone
+//     GTEST_OS_WINDOWS_RT       - Windows Store App/WinRT
 //   GTEST_OS_ZOS      - z/OS
 //
 // Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
 // googletestframework@googlegroups.com (patches for fixing them are
 // even more welcome!).
 //
-// Note that it is possible that none of the GTEST_OS_* macros are defined.
+// It is possible that none of the GTEST_OS_* macros are defined.
+
+// Feature-indicating macros
+// -------------------------
+//
+// Macros indicating which Google Test features are available (a macro
+// is defined to 1 if the corresponding feature is supported;
+// otherwise UNDEFINED -- it's never defined to 0.).  Google Test
+// defines these macros automatically.  Code outside Google Test MUST
+// NOT define them.
+//
+// These macros are public so that portable tests can be written.
+// Such tests typically surround code using a feature with an #if
+// which controls that code.  For example:
+//
+// #if GTEST_HAS_DEATH_TEST
+//   EXPECT_DEATH(DoSomethingDeadly());
+// #endif
 //
-// Macros indicating available Google Test features (defined to 1 if
-// the corresponding feature is supported; otherwise undefined):
 //   GTEST_HAS_COMBINE      - the Combine() function (for value-parameterized
 //                            tests)
 //   GTEST_HAS_DEATH_TEST   - death tests
 //   GTEST_HAS_PARAM_TEST   - value-parameterized tests
 //   GTEST_HAS_TYPED_TEST   - typed tests
 //   GTEST_HAS_TYPED_TEST_P - type-parameterized tests
+//   GTEST_IS_THREADSAFE    - Google Test is thread-safe.
 //   GTEST_USES_POSIX_RE    - enhanced POSIX regex is used. Do not confuse with
 //                            GTEST_HAS_POSIX_RE (see above) which users can
 //                            define themselves.
 //   GTEST_USES_SIMPLE_RE   - our own simple regex is used;
 //                            the above two are mutually exclusive.
 //   GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
+
+// Misc public macros
+// ------------------
+//
+//   GTEST_FLAG(flag_name)  - references the variable corresponding to
+//                            the given Google Test flag.
+
+// Internal utilities
+// ------------------
+//
+// The following macros and utilities are for Google Test's INTERNAL
+// use only.  Code outside Google Test MUST NOT USE THEM DIRECTLY.
 //
 // Macros for basic C++ coding:
 //   GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
 //   GTEST_DISALLOW_ASSIGN_   - disables operator=.
 //   GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
 //   GTEST_MUST_USE_RESULT_   - declares that a function's result must be used.
+//   GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is
+//                                        suppressed (constant conditional).
+//   GTEST_INTENTIONAL_CONST_COND_POP_  - finish code section where MSVC C4127
+//                                        is suppressed.
+//
+// C++11 feature wrappers:
+//
+//   testing::internal::move  - portability wrapper for std::move.
 //
 // Synchronization:
 //   Mutex, MutexLock, ThreadLocal, GetThreadCount()
-//                  - synchronization primitives.
-//   GTEST_IS_THREADSAFE - defined to 1 to indicate that the above
-//                         synchronization primitives have real implementations
-//                         and Google Test is thread-safe; or 0 otherwise.
+//                            - synchronization primitives.
 //
 // Template meta programming:
 //   is_pointer     - as in TR1; needed on Symbian and IBM XL C/C++ only.
 //   BiggestInt     - the biggest signed integer type.
 //
 // Command-line utilities:
-//   GTEST_FLAG()       - references a flag.
 //   GTEST_DECLARE_*()  - declares a flag.
 //   GTEST_DEFINE_*()   - defines a flag.
-//   GetArgvs()         - returns the command line as a vector of strings.
+//   GetInjectableArgvs() - returns the command line as a vector of strings.
 //
 // Environment variable utilities:
 //   GetEnv()             - gets the value of an environment variable.
 # include <sys/stat.h>
 #endif  // !_WIN32_WCE
 
+#if defined __APPLE__
+# include <AvailabilityMacros.h>
+# include <TargetConditionals.h>
+#endif
+
+#include <algorithm>  // NOLINT
 #include <iostream>  // NOLINT
 #include <sstream>  // NOLINT
 #include <string>  // NOLINT
+#include <utility>
+#include <vector>  // NOLINT
+
+#include "gtest/internal/gtest-port-arch.h"
+#include "gtest/internal/custom/gtest-port.h"
+
+#if !defined(GTEST_DEV_EMAIL_)
+# define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
+# define GTEST_FLAG_PREFIX_ "gtest_"
+# define GTEST_FLAG_PREFIX_DASH_ "gtest-"
+# define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
+# define GTEST_NAME_ "Google Test"
+# define GTEST_PROJECT_URL_ "https://github.com/google/googletest/"
+#endif  // !defined(GTEST_DEV_EMAIL_)
 
-#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
-#define GTEST_FLAG_PREFIX_ "gtest_"
-#define GTEST_FLAG_PREFIX_DASH_ "gtest-"
-#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
-#define GTEST_NAME_ "Google Test"
-#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
+#if !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
+# define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest"
+#endif  // !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
 
 // Determines the version of gcc that is used to compile this.
 #ifdef __GNUC__
     (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
 #endif  // __GNUC__
 
-// Determines the platform on which Google Test is compiled.
-#ifdef __CYGWIN__
-# define GTEST_OS_CYGWIN 1
-#elif defined __SYMBIAN32__
-# define GTEST_OS_SYMBIAN 1
-#elif defined _WIN32
-# define GTEST_OS_WINDOWS 1
-# ifdef _WIN32_WCE
-#  define GTEST_OS_WINDOWS_MOBILE 1
-# elif defined(__MINGW__) || defined(__MINGW32__)
-#  define GTEST_OS_WINDOWS_MINGW 1
+// Macros for disabling Microsoft Visual C++ warnings.
+//
+//   GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385)
+//   /* code that triggers warnings C4800 and C4385 */
+//   GTEST_DISABLE_MSC_WARNINGS_POP_()
+#if _MSC_VER >= 1500
+# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \
+    __pragma(warning(push))                        \
+    __pragma(warning(disable: warnings))
+# define GTEST_DISABLE_MSC_WARNINGS_POP_()          \
+    __pragma(warning(pop))
+#else
+// Older versions of MSVC don't have __pragma.
+# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
+# define GTEST_DISABLE_MSC_WARNINGS_POP_()
+#endif
+
+#ifndef GTEST_LANG_CXX11
+// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
+// -std={c,gnu}++{0x,11} is passed.  The C++11 standard specifies a
+// value for __cplusplus, and recent versions of clang, gcc, and
+// probably other compilers set that too in C++11 mode.
+# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
+// Compiling in at least C++11 mode.
+#  define GTEST_LANG_CXX11 1
 # else
-#  define GTEST_OS_WINDOWS_DESKTOP 1
-# endif  // _WIN32_WCE
-#elif defined __APPLE__
-# define GTEST_OS_MAC 1
-#elif defined __linux__
-# define GTEST_OS_LINUX 1
-# ifdef ANDROID
-#  define GTEST_OS_LINUX_ANDROID 1
-# endif  // ANDROID
-#elif defined __MVS__
-# define GTEST_OS_ZOS 1
-#elif defined(__sun) && defined(__SVR4)
-# define GTEST_OS_SOLARIS 1
-#elif defined(_AIX)
-# define GTEST_OS_AIX 1
-#elif defined(__hpux)
-# define GTEST_OS_HPUX 1
-#elif defined __native_client__
-# define GTEST_OS_NACL 1
-#endif  // __CYGWIN__
+#  define GTEST_LANG_CXX11 0
+# endif
+#endif
+
+// Distinct from C++11 language support, some environments don't provide
+// proper C++11 library support. Notably, it's possible to build in
+// C++11 mode when targeting Mac OS X 10.6, which has an old libstdc++
+// with no C++11 support.
+//
+// libstdc++ has sufficient C++11 support as of GCC 4.6.0, __GLIBCXX__
+// 20110325, but maintenance releases in the 4.4 and 4.5 series followed
+// this date, so check for those versions by their date stamps.
+// https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning
+#if GTEST_LANG_CXX11 && \
+    (!defined(__GLIBCXX__) || ( \
+        __GLIBCXX__ >= 20110325ul &&  /* GCC >= 4.6.0 */ \
+        /* Blacklist of patch releases of older branches: */ \
+        __GLIBCXX__ != 20110416ul &&  /* GCC 4.4.6 */ \
+        __GLIBCXX__ != 20120313ul &&  /* GCC 4.4.7 */ \
+        __GLIBCXX__ != 20110428ul &&  /* GCC 4.5.3 */ \
+        __GLIBCXX__ != 20120702ul))   /* GCC 4.5.4 */
+# define GTEST_STDLIB_CXX11 1
+#endif
+
+// Only use C++11 library features if the library provides them.
+#if GTEST_STDLIB_CXX11
+# define GTEST_HAS_STD_BEGIN_AND_END_ 1
+# define GTEST_HAS_STD_FORWARD_LIST_ 1
+# define GTEST_HAS_STD_FUNCTION_ 1
+# define GTEST_HAS_STD_INITIALIZER_LIST_ 1
+# define GTEST_HAS_STD_MOVE_ 1
+# define GTEST_HAS_STD_SHARED_PTR_ 1
+# define GTEST_HAS_STD_TYPE_TRAITS_ 1
+# define GTEST_HAS_STD_UNIQUE_PTR_ 1
+#endif
+
+// C++11 specifies that <tuple> provides std::tuple.
+// Some platforms still might not have it, however.
+#if GTEST_LANG_CXX11
+# define GTEST_HAS_STD_TUPLE_ 1
+# if defined(__clang__)
+// Inspired by http://clang.llvm.org/docs/LanguageExtensions.html#__has_include
+#  if defined(__has_include) && !__has_include(<tuple>)
+#   undef GTEST_HAS_STD_TUPLE_
+#  endif
+# elif defined(_MSC_VER)
+// Inspired by boost/config/stdlib/dinkumware.hpp
+#  if defined(_CPPLIB_VER) && _CPPLIB_VER < 520
+#   undef GTEST_HAS_STD_TUPLE_
+#  endif
+# elif defined(__GLIBCXX__)
+// Inspired by boost/config/stdlib/libstdcpp3.hpp,
+// http://gcc.gnu.org/gcc-4.2/changes.html and
+// http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt01ch01.html#manual.intro.status.standard.200x
+#  if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
+#   undef GTEST_HAS_STD_TUPLE_
+#  endif
+# endif
+#endif
 
 // Brings in definitions for functions used in the testing::internal::posix
 // namespace (read, write, close, chdir, isatty, stat). We do not currently
 // use them on Windows Mobile.
-#if !GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
+# if !GTEST_OS_WINDOWS_MOBILE
+#  include <direct.h>
+#  include <io.h>
+# endif
+// In order to avoid having to include <windows.h>, use forward declaration
+// assuming CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
+// This assumption is verified by
+// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
+struct _RTL_CRITICAL_SECTION;
+#else
 // This assumes that non-Windows OSes provide unistd.h. For OSes where this
 // is not the case, we need to include headers that provide the functions
 // mentioned above.
 # include <unistd.h>
-# if !GTEST_OS_NACL
-// TODO(vladl@google.com): Remove this condition when Native Client SDK adds
-// strings.h (tracked in
-// http://code.google.com/p/nativeclient/issues/detail?id=1175).
-#  include <strings.h>  // Native Client doesn't provide strings.h.
-# endif
-#elif !GTEST_OS_WINDOWS_MOBILE
-# include <direct.h>
-# include <io.h>
+# include <strings.h>
+#endif  // GTEST_OS_WINDOWS
+
+#if GTEST_OS_LINUX_ANDROID
+// Used to define __ANDROID_API__ matching the target NDK API level.
+#  include <android/api-level.h>  // NOLINT
 #endif
 
 // Defines this to true iff Google Test can use POSIX regular expressions.
 #ifndef GTEST_HAS_POSIX_RE
-# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
+# if GTEST_OS_LINUX_ANDROID
+// On Android, <regex.h> is only available starting with Gingerbread.
+#  define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
+# else
+#  define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
+# endif
 #endif
 
-#if GTEST_HAS_POSIX_RE
+#if GTEST_USES_PCRE
+// The appropriate headers have already been included.
+
+#elif GTEST_HAS_POSIX_RE
 
 // On some platforms, <regex.h> needs someone to define size_t, and
 // won't compile otherwise.  We can #include it here as we already
 // simple regex implementation instead.
 # define GTEST_USES_SIMPLE_RE 1
 
-#endif  // GTEST_HAS_POSIX_RE
+#endif  // GTEST_USES_PCRE
 
 #ifndef GTEST_HAS_EXCEPTIONS
 // The user didn't tell us whether exceptions are enabled, so we need
 #   define _HAS_EXCEPTIONS 1
 #  endif  // _HAS_EXCEPTIONS
 #  define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
+# elif defined(__clang__)
+// clang defines __EXCEPTIONS iff exceptions are enabled before clang 220714,
+// but iff cleanups are enabled after that. In Obj-C++ files, there can be
+// cleanups for ObjC exceptions which also need cleanups, even if C++ exceptions
+// are disabled. clang has __has_feature(cxx_exceptions) which checks for C++
+// exceptions starting at clang r206352, but which checked for cleanups prior to
+// that. To reliably check for C++ exception availability with clang, check for
+// __EXCEPTIONS && __has_feature(cxx_exceptions).
+#  define GTEST_HAS_EXCEPTIONS (__EXCEPTIONS && __has_feature(cxx_exceptions))
 # elif defined(__GNUC__) && __EXCEPTIONS
 // gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
 #  define GTEST_HAS_EXCEPTIONS 1
 # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
 
 #  ifdef __GXX_RTTI
-#   define GTEST_HAS_RTTI 1
+// When building against STLport with the Android NDK and with
+// -frtti -fno-exceptions, the build fails at link time with undefined
+// references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
+// so disable RTTI when detected.
+#   if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
+       !defined(__EXCEPTIONS)
+#    define GTEST_HAS_RTTI 0
+#   else
+#    define GTEST_HAS_RTTI 1
+#   endif  // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
 #  else
 #   define GTEST_HAS_RTTI 0
 #  endif  // __GXX_RTTI
 
+// Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
+// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
+// first version with C++ support.
+# elif defined(__clang__)
+
+#  define GTEST_HAS_RTTI __has_feature(cxx_rtti)
+
 // Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
 // both the typeid and dynamic_cast features are present.
 # elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
 
 // Determines whether Google Test can use the pthreads library.
 #ifndef GTEST_HAS_PTHREAD
-// The user didn't tell us explicitly, so we assume pthreads support is
-// available on Linux and Mac.
+// The user didn't tell us explicitly, so we make reasonable assumptions about
+// which platforms have pthreads support.
 //
 // To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
 // to your compiler flags.
-# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX)
+# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \
+    || GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NACL)
 #endif  // GTEST_HAS_PTHREAD
 
 #if GTEST_HAS_PTHREAD
 # include <time.h>  // NOLINT
 #endif
 
+// Determines if hash_map/hash_set are available.
+// Only used for testing against those containers.
+#if !defined(GTEST_HAS_HASH_MAP_)
+# if _MSC_VER
+#  define GTEST_HAS_HASH_MAP_ 1  // Indicates that hash_map is available.
+#  define GTEST_HAS_HASH_SET_ 1  // Indicates that hash_set is available.
+# endif  // _MSC_VER
+#endif  // !defined(GTEST_HAS_HASH_MAP_)
+
 // Determines whether Google Test can use tr1/tuple.  You can define
 // this macro to 0 to prevent Google Test from using tuple (any
 // feature depending on tuple with be disabled in this mode).
 #ifndef GTEST_HAS_TR1_TUPLE
+# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)
+// STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>.
+#  define GTEST_HAS_TR1_TUPLE 0
+# else
 // The user didn't tell us not to do it, so we assume it's OK.
-# define GTEST_HAS_TR1_TUPLE 1
+#  define GTEST_HAS_TR1_TUPLE 1
+# endif
 #endif  // GTEST_HAS_TR1_TUPLE
 
 // Determines whether Google Test's own tr1 tuple implementation
 // The user didn't tell us, so we need to figure it out.
 
 // We use our own TR1 tuple if we aren't sure the user has an
-// implementation of it already.  At this time, GCC 4.0.0+ and MSVC
-// 2010 are the only mainstream compilers that come with a TR1 tuple
-// implementation.  NVIDIA's CUDA NVCC compiler pretends to be GCC by
-// defining __GNUC__ and friends, but cannot compile GCC's tuple
-// implementation.  MSVC 2008 (9.0) provides TR1 tuple in a 323 MB
-// Feature Pack download, which we cannot assume the user has.
-# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \
-    || _MSC_VER >= 1600
+// implementation of it already.  At this time, libstdc++ 4.0.0+ and
+// MSVC 2010 are the only mainstream standard libraries that come
+// with a TR1 tuple implementation.  NVIDIA's CUDA NVCC compiler
+// pretends to be GCC by defining __GNUC__ and friends, but cannot
+// compile GCC's tuple implementation.  MSVC 2008 (9.0) provides TR1
+// tuple in a 323 MB Feature Pack download, which we cannot assume the
+// user has.  QNX's QCC compiler is a modified GCC but it doesn't
+// support TR1 tuple.  libc++ only provides std::tuple, in C++11 mode,
+// and it can be used with some compilers that define __GNUC__.
+# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
+      && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
+#  define GTEST_ENV_HAS_TR1_TUPLE_ 1
+# endif
+
+// C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used
+// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6
+// can build with clang but need to use gcc4.2's libstdc++).
+# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
+#  define GTEST_ENV_HAS_STD_TUPLE_ 1
+# endif
+
+# if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_
 #  define GTEST_USE_OWN_TR1_TUPLE 0
 # else
 #  define GTEST_USE_OWN_TR1_TUPLE 1
 
 // To avoid conditional compilation everywhere, we make it
 // gtest-port.h's responsibility to #include the header implementing
-// tr1/tuple.
+// tuple.
+#if GTEST_HAS_STD_TUPLE_
+# include <tuple>  // IWYU pragma: export
+# define GTEST_TUPLE_NAMESPACE_ ::std
+#endif  // GTEST_HAS_STD_TUPLE_
+
+// We include tr1::tuple even if std::tuple is available to define printers for
+// them.
 #if GTEST_HAS_TR1_TUPLE
+# ifndef GTEST_TUPLE_NAMESPACE_
+#  define GTEST_TUPLE_NAMESPACE_ ::std::tr1
+# endif  // GTEST_TUPLE_NAMESPACE_
 
 # if GTEST_USE_OWN_TR1_TUPLE
-#  include "gtest/internal/gtest-tuple.h"
+#  include "gtest/internal/gtest-tuple.h"  // IWYU pragma: export  // NOLINT
+# elif GTEST_ENV_HAS_STD_TUPLE_
+#  include <tuple>
+// C++11 puts its tuple into the ::std namespace rather than
+// ::std::tr1.  gtest expects tuple to live in ::std::tr1, so put it there.
+// This causes undefined behavior, but supported compilers react in
+// the way we intend.
+namespace std {
+namespace tr1 {
+using ::std::get;
+using ::std::make_tuple;
+using ::std::tuple;
+using ::std::tuple_element;
+using ::std::tuple_size;
+}
+}
+
 # elif GTEST_OS_SYMBIAN
 
 // On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
 // This prevents <boost/tr1/detail/config.hpp>, which defines
 // BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
 #  define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
-#  include <tuple>
+#  include <tuple>  // IWYU pragma: export  // NOLINT
 
 # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
 // GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header.  This does
 # else
 // If the compiler is not GCC 4.0+, we assume the user is using a
 // spec-conforming TR1 implementation.
-#  include <tuple>  // NOLINT
+#  include <tuple>  // IWYU pragma: export  // NOLINT
 # endif  // GTEST_USE_OWN_TR1_TUPLE
 
 #endif  // GTEST_HAS_TR1_TUPLE
 // The user didn't tell us, so we need to figure it out.
 
 # if GTEST_OS_LINUX && !defined(__ia64__)
-#  define GTEST_HAS_CLONE 1
+#  if GTEST_OS_LINUX_ANDROID
+// On Android, clone() is only available on ARM starting with Gingerbread.
+#    if defined(__arm__) && __ANDROID_API__ >= 9
+#     define GTEST_HAS_CLONE 1
+#    else
+#     define GTEST_HAS_CLONE 0
+#    endif
+#  else
+#   define GTEST_HAS_CLONE 1
+#  endif
 # else
 #  define GTEST_HAS_CLONE 0
 # endif  // GTEST_OS_LINUX && !defined(__ia64__)
 #ifndef GTEST_HAS_STREAM_REDIRECTION
 // By default, we assume that stream redirection is supported on all
 // platforms except known mobile ones.
-# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN
+# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || \
+    GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
 #  define GTEST_HAS_STREAM_REDIRECTION 0
 # else
 #  define GTEST_HAS_STREAM_REDIRECTION 1
 // Google Test does not support death tests for VC 7.1 and earlier as
 // abort() in a VC 7.1 application compiled as GUI in debug config
 // pops up a dialog window that cannot be suppressed programmatically.
-#if (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
+#if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
+     (GTEST_OS_MAC && !GTEST_OS_IOS) || \
      (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
-     GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX)
+     GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
+     GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD)
 # define GTEST_HAS_DEATH_TEST 1
-# include <vector>  // NOLINT
 #endif
 
 // We don't support MSVC 7.1 with exceptions disabled now.  Therefore
 // compiler the variable/parameter does not have to be used.
 #if defined(__GNUC__) && !defined(COMPILER_ICC)
 # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
-#else
+#elif defined(__clang__)
+# if __has_attribute(unused)
+#  define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
+# endif
+#endif
+#ifndef GTEST_ATTRIBUTE_UNUSED_
 # define GTEST_ATTRIBUTE_UNUSED_
 #endif
 
 # define GTEST_MUST_USE_RESULT_
 #endif  // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
 
+// MS C++ compiler emits warning when a conditional expression is compile time
+// constant. In some contexts this warning is false positive and needs to be
+// suppressed. Use the following two macros in such cases:
+//
+// GTEST_INTENTIONAL_CONST_COND_PUSH_()
+// while (true) {
+// GTEST_INTENTIONAL_CONST_COND_POP_()
+// }
+# define GTEST_INTENTIONAL_CONST_COND_PUSH_() \
+    GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127)
+# define GTEST_INTENTIONAL_CONST_COND_POP_() \
+    GTEST_DISABLE_MSC_WARNINGS_POP_()
+
 // Determine whether the compiler supports Microsoft's Structured Exception
 // Handling.  This is supported by several Windows compilers but generally
 // does not exist on any other system.
 #  define GTEST_HAS_SEH 0
 # endif
 
+#define GTEST_IS_THREADSAFE \
+    (GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ \
+     || (GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT) \
+     || GTEST_HAS_PTHREAD)
+
 #endif  // GTEST_HAS_SEH
 
 #ifdef _MSC_VER
-
 # if GTEST_LINKED_AS_SHARED_LIBRARY
 #  define GTEST_API_ __declspec(dllimport)
 # elif GTEST_CREATE_SHARED_LIBRARY
 #  define GTEST_API_ __declspec(dllexport)
 # endif
-
-#endif  // _MSC_VER
+#elif __GNUC__ >= 4 || defined(__clang__)
+# define GTEST_API_ __attribute__((visibility ("default")))
+#endif // _MSC_VER
 
 #ifndef GTEST_API_
 # define GTEST_API_
 # define GTEST_NO_INLINE_
 #endif
 
+// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
+#if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)
+# define GTEST_HAS_CXXABI_H_ 1
+#else
+# define GTEST_HAS_CXXABI_H_ 0
+#endif
+
+// A function level attribute to disable checking for use of uninitialized
+// memory when built with MemorySanitizer.
+#if defined(__clang__)
+# if __has_feature(memory_sanitizer)
+#  define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ \
+       __attribute__((no_sanitize_memory))
+# else
+#  define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
+# endif  // __has_feature(memory_sanitizer)
+#else
+# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
+#endif  // __clang__
+
+// A function level attribute to disable AddressSanitizer instrumentation.
+#if defined(__clang__)
+# if __has_feature(address_sanitizer)
+#  define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \
+       __attribute__((no_sanitize_address))
+# else
+#  define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
+# endif  // __has_feature(address_sanitizer)
+#else
+# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
+#endif  // __clang__
+
+// A function level attribute to disable ThreadSanitizer instrumentation.
+#if defined(__clang__)
+# if __has_feature(thread_sanitizer)
+#  define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ \
+       __attribute__((no_sanitize_thread))
+# else
+#  define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
+# endif  // __has_feature(thread_sanitizer)
+#else
+# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
+#endif  // __clang__
+
 namespace testing {
 
 class Message;
 
+#if defined(GTEST_TUPLE_NAMESPACE_)
+// Import tuple and friends into the ::testing namespace.
+// It is part of our interface, having them in ::testing allows us to change
+// their types as needed.
+using GTEST_TUPLE_NAMESPACE_::get;
+using GTEST_TUPLE_NAMESPACE_::make_tuple;
+using GTEST_TUPLE_NAMESPACE_::tuple;
+using GTEST_TUPLE_NAMESPACE_::tuple_size;
+using GTEST_TUPLE_NAMESPACE_::tuple_element;
+#endif  // defined(GTEST_TUPLE_NAMESPACE_)
+
 namespace internal {
 
-class String;
+// A secret type that Google Test users don't know about.  It has no
+// definition on purpose.  Therefore it's impossible to create a
+// Secret object, which is what we want.
+class Secret;
 
 // The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time
 // expression is true. For example, you could use it to verify the
 // size of a static array:
 //
-//   GTEST_COMPILE_ASSERT_(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES,
-//                         content_type_names_incorrect_size);
+//   GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES,
+//                         names_incorrect_size);
 //
 // or to make sure a struct is smaller than a certain size:
 //
@@ -692,16 +1022,22 @@ class String;
 // the expression is false, most compilers will issue a warning/error
 // containing the name of the variable.
 
+#if GTEST_LANG_CXX11
+# define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg)
+#else  // !GTEST_LANG_CXX11
 template <bool>
-struct CompileAssert {
+  struct CompileAssert {
 };
 
-#define GTEST_COMPILE_ASSERT_(expr, msg) \
-  typedef ::testing::internal::CompileAssert<(bool(expr))> \
-      msg[bool(expr) ? 1 : -1]
+# define GTEST_COMPILE_ASSERT_(expr, msg) \
+  typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
+      msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
+#endif  // !GTEST_LANG_CXX11
 
 // Implementation details of GTEST_COMPILE_ASSERT_:
 //
+// (In C++11, we simply use static_assert instead of the following)
+//
 // - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
 //   elements (and thus is invalid) when the expression is false.
 //
@@ -748,7 +1084,12 @@ template <typename T1, typename T2>
 struct StaticAssertTypeEqHelper;
 
 template <typename T>
-struct StaticAssertTypeEqHelper<T, T> {};
+struct StaticAssertTypeEqHelper<T, T> {
+  enum { value = true };
+};
+
+// Evaluates to the number of elements in 'array'.
+#define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0]))
 
 #if GTEST_HAS_GLOBAL_STRING
 typedef ::string string;
@@ -796,6 +1137,12 @@ class scoped_ptr {
       ptr_ = p;
     }
   }
+
+  friend void swap(scoped_ptr& a, scoped_ptr& b) {
+    using std::swap;
+    swap(a.ptr_, b.ptr_);
+  }
+
  private:
   T* ptr_;
 
@@ -858,10 +1205,9 @@ class GTEST_API_ RE {
  private:
   void Init(const char* regex);
 
-  // We use a const char* instead of a string, as Google Test may be used
-  // where string is not available.  We also do not use Google Test's own
-  // String type here, in order to simplify dependencies between the
-  // files.
+  // We use a const char* instead of an std::string, as Google Test used to be
+  // used where std::string is not available.  TODO(wan@google.com): change to
+  // std::string.
   const char* pattern_;
   bool is_valid_;
 
@@ -920,13 +1266,18 @@ class GTEST_API_ GTestLog {
   GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
 };
 
-#define GTEST_LOG_(severity) \
+#if !defined(GTEST_LOG_)
+
+# define GTEST_LOG_(severity) \
     ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
                                   __FILE__, __LINE__).GetStream()
 
 inline void LogToStderr() {}
 inline void FlushInfoLog() { fflush(NULL); }
 
+#endif  // !defined(GTEST_LOG_)
+
+#if !defined(GTEST_CHECK_)
 // INTERNAL IMPLEMENTATION - DO NOT USE.
 //
 // GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
@@ -941,12 +1292,13 @@ inline void FlushInfoLog() { fflush(NULL); }
 //    condition itself, plus additional message streamed into it, if any,
 //    and then it aborts the program. It aborts the program irrespective of
 //    whether it is built in the debug mode or not.
-#define GTEST_CHECK_(condition) \
+# define GTEST_CHECK_(condition) \
     GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
     if (::testing::internal::IsTrue(condition)) \
       ; \
     else \
       GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
+#endif  // !defined(GTEST_CHECK_)
 
 // An all-mode assert to verify that the given POSIX-style function
 // call returns 0 (indicating success).  Known limitation: this
@@ -958,6 +1310,15 @@ inline void FlushInfoLog() { fflush(NULL); }
     GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
                       << gtest_error
 
+#if GTEST_HAS_STD_MOVE_
+using std::move;
+#else  // GTEST_HAS_STD_MOVE_
+template <typename T>
+const T& move(const T& t) {
+  return t;
+}
+#endif  // GTEST_HAS_STD_MOVE_
+
 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
 //
 // Use ImplicitCast_ as a safe version of static_cast for upcasting in
@@ -1008,7 +1369,9 @@ inline To DownCast_(From* f) {  // so we only accept pointers
   // for compile-time type checking, and has no overhead in an
   // optimized build at run-time, as it will be optimized away
   // completely.
+  GTEST_INTENTIONAL_CONST_COND_PUSH_()
   if (false) {
+  GTEST_INTENTIONAL_CONST_COND_POP_()
     const To to = NULL;
     ::testing::internal::ImplicitCast_<From*>(to);
   }
@@ -1029,6 +1392,11 @@ template <class Derived, class Base>
 Derived* CheckedDowncastToActualType(Base* base) {
 #if GTEST_HAS_RTTI
   GTEST_CHECK_(typeid(*base) == typeid(Derived));
+#endif
+
+#if GTEST_HAS_DOWNCAST_
+  return ::down_cast<Derived*>(base);
+#elif GTEST_HAS_RTTI
   return dynamic_cast<Derived*>(base);  // NOLINT
 #else
   return static_cast<Derived*>(base);  // Poor man's downcast.
@@ -1044,30 +1412,39 @@ Derived* CheckedDowncastToActualType(Base* base) {
 //   GetCapturedStderr - stops capturing stderr and returns the captured string.
 //
 GTEST_API_ void CaptureStdout();
-GTEST_API_ String GetCapturedStdout();
+GTEST_API_ std::string GetCapturedStdout();
 GTEST_API_ void CaptureStderr();
-GTEST_API_ String GetCapturedStderr();
+GTEST_API_ std::string GetCapturedStderr();
 
 #endif  // GTEST_HAS_STREAM_REDIRECTION
 
+// Returns a path to temporary directory.
+GTEST_API_ std::string TempDir();
+
+// Returns the size (in bytes) of a file.
+GTEST_API_ size_t GetFileSize(FILE* file);
+
+// Reads the entire content of a file as a string.
+GTEST_API_ std::string ReadEntireFile(FILE* file);
+
+// All command line arguments.
+GTEST_API_ const ::std::vector<testing::internal::string>& GetArgvs();
 
 #if GTEST_HAS_DEATH_TEST
 
-// A copy of all command line arguments.  Set by InitGoogleTest().
-extern ::std::vector<String> g_argvs;
+const ::std::vector<testing::internal::string>& GetInjectableArgvs();
+void SetInjectableArgvs(const ::std::vector<testing::internal::string>*
+                             new_argvs);
 
-// GTEST_HAS_DEATH_TEST implies we have ::std::string.
-const ::std::vector<String>& GetArgvs();
 
 #endif  // GTEST_HAS_DEATH_TEST
 
 // Defines synchronization primitives.
-
-#if GTEST_HAS_PTHREAD
-
-// Sleeps for (roughly) n milli-seconds.  This function is only for
-// testing Google Test's own constructs.  Don't use it in user tests,
-// either directly or indirectly.
+#if GTEST_IS_THREADSAFE
+# if GTEST_HAS_PTHREAD
+// Sleeps for (roughly) n milliseconds.  This function is only for testing
+// Google Test's own constructs.  Don't use it in user tests, either
+// directly or indirectly.
 inline void SleepMilliseconds(int n) {
   const timespec time = {
     0,                  // 0 seconds.
@@ -1075,7 +1452,13 @@ inline void SleepMilliseconds(int n) {
   };
   nanosleep(&time, NULL);
 }
+# endif  // GTEST_HAS_PTHREAD
 
+# if GTEST_HAS_NOTIFICATION_
+// Notification has already been imported into the namespace.
+// Nothing to do here.
+
+# elif GTEST_HAS_PTHREAD
 // Allows a controller thread to pause execution of newly created
 // threads until notified.  Instances of this class must be created
 // and destroyed in the controller thread.
@@ -1084,25 +1467,96 @@ inline void SleepMilliseconds(int n) {
 // use it in user tests, either directly or indirectly.
 class Notification {
  public:
-  Notification() : notified_(false) {}
+  Notification() : notified_(false) {
+    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
+  }
+  ~Notification() {
+    pthread_mutex_destroy(&mutex_);
+  }
 
   // Notifies all threads created with this notification to start. Must
   // be called from the controller thread.
-  void Notify() { notified_ = true; }
+  void Notify() {
+    pthread_mutex_lock(&mutex_);
+    notified_ = true;
+    pthread_mutex_unlock(&mutex_);
+  }
 
   // Blocks until the controller thread notifies. Must be called from a test
   // thread.
   void WaitForNotification() {
-    while(!notified_) {
+    for (;;) {
+      pthread_mutex_lock(&mutex_);
+      const bool notified = notified_;
+      pthread_mutex_unlock(&mutex_);
+      if (notified)
+        break;
       SleepMilliseconds(10);
     }
   }
 
  private:
-  volatile bool notified_;
+  pthread_mutex_t mutex_;
+  bool notified_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
+};
+
+# elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
+
+GTEST_API_ void SleepMilliseconds(int n);
+
+// Provides leak-safe Windows kernel handle ownership.
+// Used in death tests and in threading support.
+class GTEST_API_ AutoHandle {
+ public:
+  // Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to
+  // avoid including <windows.h> in this header file. Including <windows.h> is
+  // undesirable because it defines a lot of symbols and macros that tend to
+  // conflict with client code. This assumption is verified by
+  // WindowsTypesTest.HANDLEIsVoidStar.
+  typedef void* Handle;
+  AutoHandle();
+  explicit AutoHandle(Handle handle);
+
+  ~AutoHandle();
+
+  Handle Get() const;
+  void Reset();
+  void Reset(Handle handle);
+
+ private:
+  // Returns true iff the handle is a valid handle object that can be closed.
+  bool IsCloseable() const;
+
+  Handle handle_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
+};
+
+// Allows a controller thread to pause execution of newly created
+// threads until notified.  Instances of this class must be created
+// and destroyed in the controller thread.
+//
+// This class is only for testing Google Test's own constructs. Do not
+// use it in user tests, either directly or indirectly.
+class GTEST_API_ Notification {
+ public:
+  Notification();
+  void Notify();
+  void WaitForNotification();
+
+ private:
+  AutoHandle event_;
 
   GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
 };
+# endif  // GTEST_HAS_NOTIFICATION_
+
+// On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD
+// defined, but we don't want to use MinGW's pthreads implementation, which
+// has conformance problems with some versions of the POSIX standard.
+# if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW
 
 // As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
 // Consequently, it cannot select a correct instantiation of ThreadWithParam
@@ -1141,10 +1595,9 @@ extern "C" inline void* ThreadFuncWithCLinkage(void* thread) {
 template <typename T>
 class ThreadWithParam : public ThreadWithParamBase {
  public:
-  typedef void (*UserThreadFunc)(T);
+  typedef void UserThreadFunc(T);
 
-  ThreadWithParam(
-      UserThreadFunc func, T param, Notification* thread_can_start)
+  ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
       : func_(func),
         param_(param),
         thread_can_start_(thread_can_start),
@@ -1171,7 +1624,7 @@ class ThreadWithParam : public ThreadWithParamBase {
   }
 
  private:
-  const UserThreadFunc func_;  // User-supplied thread function.
+  UserThreadFunc* const func_;  // User-supplied thread function.
   const T param_;  // User-supplied parameter to the thread function.
   // When non-NULL, used to block execution until the controller thread
   // notifies.
@@ -1181,47 +1634,316 @@ class ThreadWithParam : public ThreadWithParamBase {
 
   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
 };
+# endif  // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD ||
+         // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
+
+# if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
+// Mutex and ThreadLocal have already been imported into the namespace.
+// Nothing to do here.
+
+# elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
 
-// MutexBase and Mutex implement mutex on pthreads-based platforms. They
-// are used in conjunction with class MutexLock:
+// Mutex implements mutex on Windows platforms.  It is used in conjunction
+// with class MutexLock:
 //
 //   Mutex mutex;
 //   ...
-//   MutexLock lock(&mutex);  // Acquires the mutex and releases it at the end
-//                            // of the current scope.
-//
-// MutexBase implements behavior for both statically and dynamically
-// allocated mutexes.  Do not use MutexBase directly.  Instead, write
-// the following to define a static mutex:
+//   MutexLock lock(&mutex);  // Acquires the mutex and releases it at the
+//                            // end of the current scope.
 //
+// A static Mutex *must* be defined or declared using one of the following
+// macros:
 //   GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);
+//   GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
 //
-// You can forward declare a static mutex like this:
+// (A non-static Mutex is defined/declared in the usual way).
+class GTEST_API_ Mutex {
+ public:
+  enum MutexType { kStatic = 0, kDynamic = 1 };
+  // We rely on kStaticMutex being 0 as it is to what the linker initializes
+  // type_ in static mutexes.  critical_section_ will be initialized lazily
+  // in ThreadSafeLazyInit().
+  enum StaticConstructorSelector { kStaticMutex = 0 };
+
+  // This constructor intentionally does nothing.  It relies on type_ being
+  // statically initialized to 0 (effectively setting it to kStatic) and on
+  // ThreadSafeLazyInit() to lazily initialize the rest of the members.
+  explicit Mutex(StaticConstructorSelector /*dummy*/) {}
+
+  Mutex();
+  ~Mutex();
+
+  void Lock();
+
+  void Unlock();
+
+  // Does nothing if the current thread holds the mutex. Otherwise, crashes
+  // with high probability.
+  void AssertHeld();
+
+ private:
+  // Initializes owner_thread_id_ and critical_section_ in static mutexes.
+  void ThreadSafeLazyInit();
+
+  // Per http://blogs.msdn.com/b/oldnewthing/archive/2004/02/23/78395.aspx,
+  // we assume that 0 is an invalid value for thread IDs.
+  unsigned int owner_thread_id_;
+
+  // For static mutexes, we rely on these members being initialized to zeros
+  // by the linker.
+  MutexType type_;
+  long critical_section_init_phase_;  // NOLINT
+  _RTL_CRITICAL_SECTION* critical_section_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
+};
+
+# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
+    extern ::testing::internal::Mutex mutex
+
+# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
+    ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex)
+
+// We cannot name this class MutexLock because the ctor declaration would
+// conflict with a macro named MutexLock, which is defined on some
+// platforms. That macro is used as a defensive measure to prevent against
+// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
+// "MutexLock l(&mu)".  Hence the typedef trick below.
+class GTestMutexLock {
+ public:
+  explicit GTestMutexLock(Mutex* mutex)
+      : mutex_(mutex) { mutex_->Lock(); }
+
+  ~GTestMutexLock() { mutex_->Unlock(); }
+
+ private:
+  Mutex* const mutex_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
+};
+
+typedef GTestMutexLock MutexLock;
+
+// Base class for ValueHolder<T>.  Allows a caller to hold and delete a value
+// without knowing its type.
+class ThreadLocalValueHolderBase {
+ public:
+  virtual ~ThreadLocalValueHolderBase() {}
+};
+
+// Provides a way for a thread to send notifications to a ThreadLocal
+// regardless of its parameter type.
+class ThreadLocalBase {
+ public:
+  // Creates a new ValueHolder<T> object holding a default value passed to
+  // this ThreadLocal<T>'s constructor and returns it.  It is the caller's
+  // responsibility not to call this when the ThreadLocal<T> instance already
+  // has a value on the current thread.
+  virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0;
+
+ protected:
+  ThreadLocalBase() {}
+  virtual ~ThreadLocalBase() {}
+
+ private:
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocalBase);
+};
+
+// Maps a thread to a set of ThreadLocals that have values instantiated on that
+// thread and notifies them when the thread exits.  A ThreadLocal instance is
+// expected to persist until all threads it has values on have terminated.
+class GTEST_API_ ThreadLocalRegistry {
+ public:
+  // Registers thread_local_instance as having value on the current thread.
+  // Returns a value that can be used to identify the thread from other threads.
+  static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
+      const ThreadLocalBase* thread_local_instance);
+
+  // Invoked when a ThreadLocal instance is destroyed.
+  static void OnThreadLocalDestroyed(
+      const ThreadLocalBase* thread_local_instance);
+};
+
+class GTEST_API_ ThreadWithParamBase {
+ public:
+  void Join();
+
+ protected:
+  class Runnable {
+   public:
+    virtual ~Runnable() {}
+    virtual void Run() = 0;
+  };
+
+  ThreadWithParamBase(Runnable *runnable, Notification* thread_can_start);
+  virtual ~ThreadWithParamBase();
+
+ private:
+  AutoHandle thread_;
+};
+
+// Helper class for testing Google Test's multi-threading constructs.
+template <typename T>
+class ThreadWithParam : public ThreadWithParamBase {
+ public:
+  typedef void UserThreadFunc(T);
+
+  ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
+      : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {
+  }
+  virtual ~ThreadWithParam() {}
+
+ private:
+  class RunnableImpl : public Runnable {
+   public:
+    RunnableImpl(UserThreadFunc* func, T param)
+        : func_(func),
+          param_(param) {
+    }
+    virtual ~RunnableImpl() {}
+    virtual void Run() {
+      func_(param_);
+    }
+
+   private:
+    UserThreadFunc* const func_;
+    const T param_;
+
+    GTEST_DISALLOW_COPY_AND_ASSIGN_(RunnableImpl);
+  };
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
+};
+
+// Implements thread-local storage on Windows systems.
 //
-//   GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
+//   // Thread 1
+//   ThreadLocal<int> tl(100);  // 100 is the default value for each thread.
 //
-// To create a dynamic mutex, just define an object of type Mutex.
+//   // Thread 2
+//   tl.set(150);  // Changes the value for thread 2 only.
+//   EXPECT_EQ(150, tl.get());
+//
+//   // Thread 1
+//   EXPECT_EQ(100, tl.get());  // In thread 1, tl has the original value.
+//   tl.set(200);
+//   EXPECT_EQ(200, tl.get());
+//
+// The template type argument T must have a public copy constructor.
+// In addition, the default ThreadLocal constructor requires T to have
+// a public default constructor.
+//
+// The users of a TheadLocal instance have to make sure that all but one
+// threads (including the main one) using that instance have exited before
+// destroying it. Otherwise, the per-thread objects managed for them by the
+// ThreadLocal instance are not guaranteed to be destroyed on all platforms.
+//
+// Google Test only uses global ThreadLocal objects.  That means they
+// will die after main() has returned.  Therefore, no per-thread
+// object managed by Google Test will be leaked as long as all threads
+// using Google Test have exited when main() returns.
+template <typename T>
+class ThreadLocal : public ThreadLocalBase {
+ public:
+  ThreadLocal() : default_factory_(new DefaultValueHolderFactory()) {}
+  explicit ThreadLocal(const T& value)
+      : default_factory_(new InstanceValueHolderFactory(value)) {}
+
+  ~ThreadLocal() { ThreadLocalRegistry::OnThreadLocalDestroyed(this); }
+
+  T* pointer() { return GetOrCreateValue(); }
+  const T* pointer() const { return GetOrCreateValue(); }
+  const T& get() const { return *pointer(); }
+  void set(const T& value) { *pointer() = value; }
+
+ private:
+  // Holds a value of T.  Can be deleted via its base class without the caller
+  // knowing the type of T.
+  class ValueHolder : public ThreadLocalValueHolderBase {
+   public:
+    ValueHolder() : value_() {}
+    explicit ValueHolder(const T& value) : value_(value) {}
+
+    T* pointer() { return &value_; }
+
+   private:
+    T value_;
+    GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
+  };
+
+
+  T* GetOrCreateValue() const {
+    return static_cast<ValueHolder*>(
+        ThreadLocalRegistry::GetValueOnCurrentThread(this))->pointer();
+  }
+
+  virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const {
+    return default_factory_->MakeNewHolder();
+  }
+
+  class ValueHolderFactory {
+   public:
+    ValueHolderFactory() {}
+    virtual ~ValueHolderFactory() {}
+    virtual ValueHolder* MakeNewHolder() const = 0;
+
+   private:
+    GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
+  };
+
+  class DefaultValueHolderFactory : public ValueHolderFactory {
+   public:
+    DefaultValueHolderFactory() {}
+    virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); }
+
+   private:
+    GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
+  };
+
+  class InstanceValueHolderFactory : public ValueHolderFactory {
+   public:
+    explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
+    virtual ValueHolder* MakeNewHolder() const {
+      return new ValueHolder(value_);
+    }
+
+   private:
+    const T value_;  // The value for each thread.
+
+    GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
+  };
+
+  scoped_ptr<ValueHolderFactory> default_factory_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
+};
+
+# elif GTEST_HAS_PTHREAD
+
+// MutexBase and Mutex implement mutex on pthreads-based platforms.
 class MutexBase {
  public:
   // Acquires this mutex.
   void Lock() {
     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
     owner_ = pthread_self();
+    has_owner_ = true;
   }
 
   // Releases this mutex.
   void Unlock() {
-    // We don't protect writing to owner_ here, as it's the caller's
-    // responsibility to ensure that the current thread holds the
+    // Since the lock is being released the owner_ field should no longer be
+    // considered valid. We don't protect writing to has_owner_ here, as it's
+    // the caller's responsibility to ensure that the current thread holds the
     // mutex when this is called.
-    owner_ = 0;
+    has_owner_ = false;
     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
   }
 
   // Does nothing if the current thread holds the mutex. Otherwise, crashes
   // with high probability.
   void AssertHeld() const {
-    GTEST_CHECK_(owner_ == pthread_self())
+    GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
         << "The current thread is not holding the mutex @" << this;
   }
 
@@ -1232,16 +1954,23 @@ class MutexBase {
   // have to be public.
  public:
   pthread_mutex_t mutex_;  // The underlying pthread mutex.
-  pthread_t owner_;  // The thread holding the mutex; 0 means no one holds it.
+  // has_owner_ indicates whether the owner_ field below contains a valid thread
+  // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All
+  // accesses to the owner_ field should be protected by a check of this field.
+  // An alternative might be to memset() owner_ to all zeros, but there's no
+  // guarantee that a zero'd pthread_t is necessarily invalid or even different
+  // from pthread_self().
+  bool has_owner_;
+  pthread_t owner_;  // The thread holding the mutex.
 };
 
 // Forward-declares a static mutex.
-# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
-    extern ::testing::internal::MutexBase mutex
+#  define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
+     extern ::testing::internal::MutexBase mutex
 
 // Defines and statically (i.e. at link time) initializes a static mutex.
-# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
-    ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, 0 }
+#  define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
+     ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false, pthread_t() }
 
 // The Mutex class can only be used for mutexes created at runtime. It
 // shares its API with MutexBase otherwise.
@@ -1249,7 +1978,7 @@ class Mutex : public MutexBase {
  public:
   Mutex() {
     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
-    owner_ = 0;
+    has_owner_ = false;
   }
   ~Mutex() {
     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
@@ -1259,9 +1988,11 @@ class Mutex : public MutexBase {
   GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
 };
 
-// We cannot name this class MutexLock as the ctor declaration would
+// We cannot name this class MutexLock because the ctor declaration would
 // conflict with a macro named MutexLock, which is defined on some
-// platforms.  Hence the typedef trick below.
+// platforms. That macro is used as a defensive measure to prevent against
+// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
+// "MutexLock l(&mu)".  Hence the typedef trick below.
 class GTestMutexLock {
  public:
   explicit GTestMutexLock(MutexBase* mutex)
@@ -1295,41 +2026,14 @@ extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
 }
 
 // Implements thread-local storage on pthreads-based systems.
-//
-//   // Thread 1
-//   ThreadLocal<int> tl(100);  // 100 is the default value for each thread.
-//
-//   // Thread 2
-//   tl.set(150);  // Changes the value for thread 2 only.
-//   EXPECT_EQ(150, tl.get());
-//
-//   // Thread 1
-//   EXPECT_EQ(100, tl.get());  // In thread 1, tl has the original value.
-//   tl.set(200);
-//   EXPECT_EQ(200, tl.get());
-//
-// The template type argument T must have a public copy constructor.
-// In addition, the default ThreadLocal constructor requires T to have
-// a public default constructor.
-//
-// An object managed for a thread by a ThreadLocal instance is deleted
-// when the thread exits.  Or, if the ThreadLocal instance dies in
-// that thread, when the ThreadLocal dies.  It's the user's
-// responsibility to ensure that all other threads using a ThreadLocal
-// have exited when it dies, or the per-thread objects for those
-// threads will not be deleted.
-//
-// Google Test only uses global ThreadLocal objects.  That means they
-// will die after main() has returned.  Therefore, no per-thread
-// object managed by Google Test will be leaked as long as all threads
-// using Google Test have exited when main() returns.
 template <typename T>
 class ThreadLocal {
  public:
-  ThreadLocal() : key_(CreateKey()),
-                  default_() {}
-  explicit ThreadLocal(const T& value) : key_(CreateKey()),
-                                         default_(value) {}
+  ThreadLocal()
+      : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {}
+  explicit ThreadLocal(const T& value)
+      : key_(CreateKey()),
+        default_factory_(new InstanceValueHolderFactory(value)) {}
 
   ~ThreadLocal() {
     // Destroys the managed object for the current thread, if any.
@@ -1349,6 +2053,7 @@ class ThreadLocal {
   // Holds a value of type T.
   class ValueHolder : public ThreadLocalValueHolderBase {
    public:
+    ValueHolder() : value_() {}
     explicit ValueHolder(const T& value) : value_(value) {}
 
     T* pointer() { return &value_; }
@@ -1374,22 +2079,54 @@ class ThreadLocal {
       return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
     }
 
-    ValueHolder* const new_holder = new ValueHolder(default_);
+    ValueHolder* const new_holder = default_factory_->MakeNewHolder();
     ThreadLocalValueHolderBase* const holder_base = new_holder;
     GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
     return new_holder->pointer();
   }
 
+  class ValueHolderFactory {
+   public:
+    ValueHolderFactory() {}
+    virtual ~ValueHolderFactory() {}
+    virtual ValueHolder* MakeNewHolder() const = 0;
+
+   private:
+    GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
+  };
+
+  class DefaultValueHolderFactory : public ValueHolderFactory {
+   public:
+    DefaultValueHolderFactory() {}
+    virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); }
+
+   private:
+    GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
+  };
+
+  class InstanceValueHolderFactory : public ValueHolderFactory {
+   public:
+    explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
+    virtual ValueHolder* MakeNewHolder() const {
+      return new ValueHolder(value_);
+    }
+
+   private:
+    const T value_;  // The value for each thread.
+
+    GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
+  };
+
   // A key pthreads uses for looking up per-thread values.
   const pthread_key_t key_;
-  const T default_;  // The default value for each thread.
+  scoped_ptr<ValueHolderFactory> default_factory_;
 
   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
 };
 
-# define GTEST_IS_THREADSAFE 1
+# endif  // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
 
-#else  // GTEST_HAS_PTHREAD
+#else  // GTEST_IS_THREADSAFE
 
 // A dummy implementation of synchronization primitives (mutex, lock,
 // and thread-local variable).  Necessary for compiling Google Test where
@@ -1399,6 +2136,8 @@ class ThreadLocal {
 class Mutex {
  public:
   Mutex() {}
+  void Lock() {}
+  void Unlock() {}
   void AssertHeld() const {}
 };
 
@@ -1407,6 +2146,11 @@ class Mutex {
 
 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
 
+// We cannot name this class MutexLock because the ctor declaration would
+// conflict with a macro named MutexLock, which is defined on some
+// platforms. That macro is used as a defensive measure to prevent against
+// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
+// "MutexLock l(&mu)".  Hence the typedef trick below.
 class GTestMutexLock {
  public:
   explicit GTestMutexLock(Mutex*) {}  // NOLINT
@@ -1427,11 +2171,7 @@ class ThreadLocal {
   T value_;
 };
 
-// The above synchronization primitives have dummy implementations.
-// Therefore Google Test is not thread-safe.
-# define GTEST_IS_THREADSAFE 0
-
-#endif  // GTEST_HAS_PTHREAD
+#endif  // GTEST_IS_THREADSAFE
 
 // Returns the number of threads running in the process, or 0 to indicate that
 // we cannot detect it.
@@ -1529,6 +2269,10 @@ inline bool IsUpper(char ch) {
 inline bool IsXDigit(char ch) {
   return isxdigit(static_cast<unsigned char>(ch)) != 0;
 }
+inline bool IsXDigit(wchar_t ch) {
+  const unsigned char low_byte = static_cast<unsigned char>(ch);
+  return ch == low_byte && isxdigit(low_byte) != 0;
+}
 
 inline char ToLower(char ch) {
   return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
@@ -1537,6 +2281,13 @@ inline char ToUpper(char ch) {
   return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
 }
 
+inline std::string StripTrailingSpaces(std::string str) {
+  std::string::iterator it = str.end();
+  while (it != str.begin() && IsSpace(*--it))
+    it = str.erase(it);
+  return str;
+}
+
 // The testing::internal::posix namespace holds wrappers for common
 // POSIX functions.  These wrappers hide the differences between
 // Windows/MSVC and POSIX systems.  Since some compilers define these
@@ -1600,11 +2351,7 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
 
 // Functions deprecated by MSVC 8.0.
 
-#ifdef _MSC_VER
-// Temporarily disable warning 4996 (deprecated function).
-# pragma warning(push)
-# pragma warning(disable:4996)
-#endif
+GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* deprecated function */)
 
 inline const char* StrNCpy(char* dest, const char* src, size_t n) {
   return strncpy(dest, src, n);
@@ -1614,7 +2361,7 @@ inline const char* StrNCpy(char* dest, const char* src, size_t n) {
 // StrError() aren't needed on Windows CE at this time and thus not
 // defined there.
 
-#if !GTEST_OS_WINDOWS_MOBILE
+#if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
 inline int ChDir(const char* dir) { return chdir(dir); }
 #endif
 inline FILE* FOpen(const char* path, const char* mode) {
@@ -1638,8 +2385,9 @@ inline int Close(int fd) { return close(fd); }
 inline const char* StrError(int errnum) { return strerror(errnum); }
 #endif
 inline const char* GetEnv(const char* name) {
-#if GTEST_OS_WINDOWS_MOBILE
+#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE | GTEST_OS_WINDOWS_RT
   // We are on Windows CE, which has no environment variables.
+  static_cast<void>(name);  // To prevent 'unused argument' warning.
   return NULL;
 #elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
   // Environment variables which we programmatically clear will be set to the
@@ -1651,9 +2399,7 @@ inline const char* GetEnv(const char* name) {
 #endif
 }
 
-#ifdef _MSC_VER
-# pragma warning(pop)  // Restores the warning state.
-#endif
+GTEST_DISABLE_MSC_WARNINGS_POP_()
 
 #if GTEST_OS_WINDOWS_MOBILE
 // Windows CE has no C library. The abort() function is used in
@@ -1666,6 +2412,23 @@ inline void Abort() { abort(); }
 
 }  // namespace posix
 
+// MSVC "deprecates" snprintf and issues warnings wherever it is used.  In
+// order to avoid these warnings, we need to use _snprintf or _snprintf_s on
+// MSVC-based platforms.  We map the GTEST_SNPRINTF_ macro to the appropriate
+// function in order to achieve that.  We use macro definition here because
+// snprintf is a variadic function.
+#if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
+// MSVC 2005 and above support variadic macros.
+# define GTEST_SNPRINTF_(buffer, size, format, ...) \
+     _snprintf_s(buffer, size, size, format, __VA_ARGS__)
+#elif defined(_MSC_VER)
+// Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't
+// complain about _snprintf.
+# define GTEST_SNPRINTF_ _snprintf
+#else
+# define GTEST_SNPRINTF_ snprintf
+#endif
+
 // The maximum number a BiggestInt can represent.  This definition
 // works no matter BiggestInt is represented in one's complement or
 // two's complement.
@@ -1718,7 +2481,6 @@ class TypeWithSize<4> {
 template <>
 class TypeWithSize<8> {
  public:
-
 #if GTEST_OS_WINDOWS
   typedef __int64 Int;
   typedef unsigned __int64 UInt;
@@ -1738,14 +2500,23 @@ typedef TypeWithSize<8>::Int TimeInMillis;  // Represents time in milliseconds.
 // Utilities for command line flags and environment variables.
 
 // Macro for referencing flags.
-#define GTEST_FLAG(name) FLAGS_gtest_##name
+#if !defined(GTEST_FLAG)
+# define GTEST_FLAG(name) FLAGS_gtest_##name
+#endif  // !defined(GTEST_FLAG)
+
+#if !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
+# define GTEST_USE_OWN_FLAGFILE_FLAG_ 1
+#endif  // !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
+
+#if !defined(GTEST_DECLARE_bool_)
+# define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver
 
 // Macros for declaring flags.
-#define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
-#define GTEST_DECLARE_int32_(name) \
+# define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
+# define GTEST_DECLARE_int32_(name) \
     GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
 #define GTEST_DECLARE_string_(name) \
-    GTEST_API_ extern ::testing::internal::String GTEST_FLAG(name)
+    GTEST_API_ extern ::std::string GTEST_FLAG(name)
 
 // Macros for defining flags.
 #define GTEST_DEFINE_bool_(name, default_val, doc) \
@@ -1753,7 +2524,15 @@ typedef TypeWithSize<8>::Int TimeInMillis;  // Represents time in milliseconds.
 #define GTEST_DEFINE_int32_(name, default_val, doc) \
     GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
 #define GTEST_DEFINE_string_(name, default_val, doc) \
-    GTEST_API_ ::testing::internal::String GTEST_FLAG(name) = (default_val)
+    GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
+
+#endif  // !defined(GTEST_DECLARE_bool_)
+
+// Thread annotations
+#if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
+# define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
+# define GTEST_LOCK_EXCLUDED_(locks)
+#endif  // !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
 
 // Parses 'str' for a 32-bit signed integer.  If successful, writes the result
 // to *value and returns true; otherwise leaves *value unchanged and returns
@@ -1767,7 +2546,7 @@ bool ParseInt32(const Message& src_text, const char* str, Int32* value);
 // corresponding to the given Google Test flag.
 bool BoolFromGTestEnv(const char* flag, bool default_val);
 GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
-const char* StringFromGTestEnv(const char* flag, const char* default_val);
+std::string StringFromGTestEnv(const char* flag, const char* default_val);
 
 }  // namespace internal
 }  // namespace testing
index dc3a07b..97f1a7f 100755 (executable)
 #endif
 
 #include <string.h>
-#include "gtest/internal/gtest-port.h"
-
 #include <string>
 
+#include "gtest/internal/gtest-port.h"
+
 namespace testing {
 namespace internal {
 
-// String - a UTF-8 string class.
-//
-// For historic reasons, we don't use std::string.
-//
-// TODO(wan@google.com): replace this class with std::string or
-// implement it in terms of the latter.
-//
-// Note that String can represent both NULL and the empty string,
-// while std::string cannot represent NULL.
-//
-// NULL and the empty string are considered different.  NULL is less
-// than anything (including the empty string) except itself.
-//
-// This class only provides minimum functionality necessary for
-// implementing Google Test.  We do not intend to implement a full-fledged
-// string class here.
-//
-// Since the purpose of this class is to provide a substitute for
-// std::string on platforms where it cannot be used, we define a copy
-// constructor and assignment operators such that we don't need
-// conditional compilation in a lot of places.
-//
-// In order to make the representation efficient, the d'tor of String
-// is not virtual.  Therefore DO NOT INHERIT FROM String.
+// String - an abstract class holding static string utilities.
 class GTEST_API_ String {
  public:
   // Static utility methods
 
-  // Returns the input enclosed in double quotes if it's not NULL;
-  // otherwise returns "(null)".  For example, "\"Hello\"" is returned
-  // for input "Hello".
-  //
-  // This is useful for printing a C string in the syntax of a literal.
-  //
-  // Known issue: escape sequences are not handled yet.
-  static String ShowCStringQuoted(const char* c_str);
-
   // Clones a 0-terminated C string, allocating memory using new.  The
   // caller is responsible for deleting the return value using
   // delete[].  Returns the cloned string, or NULL if the input is
@@ -137,11 +105,7 @@ class GTEST_API_ String {
   // NULL will be converted to "(null)".  If an error occurred during
   // the conversion, "(failed to convert from wide string)" is
   // returned.
-  static String ShowWideCString(const wchar_t* wide_c_str);
-
-  // Similar to ShowWideCString(), except that this function encloses
-  // the converted string in double quotes.
-  static String ShowWideCStringQuoted(const wchar_t* wide_c_str);
+  static std::string ShowWideCString(const wchar_t* wide_c_str);
 
   // Compares two wide C strings.  Returns true iff they have the same
   // content.
@@ -175,174 +139,27 @@ class GTEST_API_ String {
   static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
                                                const wchar_t* rhs);
 
-  // Formats a list of arguments to a String, using the same format
-  // spec string as for printf.
-  //
-  // We do not use the StringPrintf class as it is not universally
-  // available.
-  //
-  // The result is limited to 4096 characters (including the tailing
-  // 0).  If 4096 characters are not enough to format the input,
-  // "<buffer exceeded>" is returned.
-  static String Format(const char* format, ...);
-
-  // C'tors
-
-  // The default c'tor constructs a NULL string.
-  String() : c_str_(NULL), length_(0) {}
-
-  // Constructs a String by cloning a 0-terminated C string.
-  String(const char* a_c_str) {  // NOLINT
-    if (a_c_str == NULL) {
-      c_str_ = NULL;
-      length_ = 0;
-    } else {
-      ConstructNonNull(a_c_str, strlen(a_c_str));
-    }
-  }
+  // Returns true iff the given string ends with the given suffix, ignoring
+  // case. Any string is considered to end with an empty suffix.
+  static bool EndsWithCaseInsensitive(
+      const std::string& str, const std::string& suffix);
 
-  // Constructs a String by copying a given number of chars from a
-  // buffer.  E.g. String("hello", 3) creates the string "hel",
-  // String("a\0bcd", 4) creates "a\0bc", String(NULL, 0) creates "",
-  // and String(NULL, 1) results in access violation.
-  String(const char* buffer, size_t a_length) {
-    ConstructNonNull(buffer, a_length);
-  }
+  // Formats an int value as "%02d".
+  static std::string FormatIntWidth2(int value);  // "%02d" for width == 2
 
-  // The copy c'tor creates a new copy of the string.  The two
-  // String objects do not share content.
-  String(const String& str) : c_str_(NULL), length_(0) { *this = str; }
+  // Formats an int value as "%X".
+  static std::string FormatHexInt(int value);
 
-  // D'tor.  String is intended to be a final class, so the d'tor
-  // doesn't need to be virtual.
-  ~String() { delete[] c_str_; }
-
-  // Allows a String to be implicitly converted to an ::std::string or
-  // ::string, and vice versa.  Converting a String containing a NULL
-  // pointer to ::std::string or ::string is undefined behavior.
-  // Converting a ::std::string or ::string containing an embedded NUL
-  // character to a String will result in the prefix up to the first
-  // NUL character.
-  String(const ::std::string& str) {
-    ConstructNonNull(str.c_str(), str.length());
-  }
-
-  operator ::std::string() const { return ::std::string(c_str(), length()); }
-
-#if GTEST_HAS_GLOBAL_STRING
-  String(const ::string& str) {
-    ConstructNonNull(str.c_str(), str.length());
-  }
-
-  operator ::string() const { return ::string(c_str(), length()); }
-#endif  // GTEST_HAS_GLOBAL_STRING
-
-  // Returns true iff this is an empty string (i.e. "").
-  bool empty() const { return (c_str() != NULL) && (length() == 0); }
-
-  // Compares this with another String.
-  // Returns < 0 if this is less than rhs, 0 if this is equal to rhs, or > 0
-  // if this is greater than rhs.
-  int Compare(const String& rhs) const;
-
-  // Returns true iff this String equals the given C string.  A NULL
-  // string and a non-NULL string are considered not equal.
-  bool operator==(const char* a_c_str) const { return Compare(a_c_str) == 0; }
-
-  // Returns true iff this String is less than the given String.  A
-  // NULL string is considered less than "".
-  bool operator<(const String& rhs) const { return Compare(rhs) < 0; }
-
-  // Returns true iff this String doesn't equal the given C string.  A NULL
-  // string and a non-NULL string are considered not equal.
-  bool operator!=(const char* a_c_str) const { return !(*this == a_c_str); }
-
-  // Returns true iff this String ends with the given suffix.  *Any*
-  // String is considered to end with a NULL or empty suffix.
-  bool EndsWith(const char* suffix) const;
-
-  // Returns true iff this String ends with the given suffix, not considering
-  // case. Any String is considered to end with a NULL or empty suffix.
-  bool EndsWithCaseInsensitive(const char* suffix) const;
-
-  // Returns the length of the encapsulated string, or 0 if the
-  // string is NULL.
-  size_t length() const { return length_; }
-
-  // Gets the 0-terminated C string this String object represents.
-  // The String object still owns the string.  Therefore the caller
-  // should NOT delete the return value.
-  const char* c_str() const { return c_str_; }
-
-  // Assigns a C string to this object.  Self-assignment works.
-  const String& operator=(const char* a_c_str) {
-    return *this = String(a_c_str);
-  }
-
-  // Assigns a String object to this object.  Self-assignment works.
-  const String& operator=(const String& rhs) {
-    if (this != &rhs) {
-      delete[] c_str_;
-      if (rhs.c_str() == NULL) {
-        c_str_ = NULL;
-        length_ = 0;
-      } else {
-        ConstructNonNull(rhs.c_str(), rhs.length());
-      }
-    }
-
-    return *this;
-  }
+  // Formats a byte as "%02X".
+  static std::string FormatByte(unsigned char value);
 
  private:
-  // Constructs a non-NULL String from the given content.  This
-  // function can only be called when c_str_ has not been allocated.
-  // ConstructNonNull(NULL, 0) results in an empty string ("").
-  // ConstructNonNull(NULL, non_zero) is undefined behavior.
-  void ConstructNonNull(const char* buffer, size_t a_length) {
-    char* const str = new char[a_length + 1];
-    memcpy(str, buffer, a_length);
-    str[a_length] = '\0';
-    c_str_ = str;
-    length_ = a_length;
-  }
-
-  const char* c_str_;
-  size_t length_;
+  String();  // Not meant to be instantiated.
 };  // class String
 
-// Streams a String to an ostream.  Each '\0' character in the String
-// is replaced with "\\0".
-inline ::std::ostream& operator<<(::std::ostream& os, const String& str) {
-  if (str.c_str() == NULL) {
-    os << "(null)";
-  } else {
-    const char* const c_str = str.c_str();
-    for (size_t i = 0; i != str.length(); i++) {
-      if (c_str[i] == '\0') {
-        os << "\\0";
-      } else {
-        os << c_str[i];
-      }
-    }
-  }
-  return os;
-}
-
-// Gets the content of the stringstream's buffer as a String.  Each '\0'
+// Gets the content of the stringstream's buffer as an std::string.  Each '\0'
 // character in the buffer is replaced with "\\0".
-GTEST_API_ String StringStreamToString(::std::stringstream* stream);
-
-// Converts a streamable value to a String.  A NULL pointer is
-// converted to "(null)".  When the input value is a ::string,
-// ::std::string, ::wstring, or ::std::wstring object, each NUL
-// character in it is replaced with "\\0".
-
-// Declared here but defined in gtest.h, so that it has access
-// to the definition of the Message class, required by the ARM
-// compiler.
-template <typename T>
-String StreamableToString(const T& streamable);
+GTEST_API_ std::string StringStreamToString(::std::stringstream* stream);
 
 }  // namespace internal
 }  // namespace testing
index d1af50e..e9b4053 100755 (executable)
@@ -1,4 +1,6 @@
-// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
+// This file was GENERATED by command:
+//     pump.py gtest-tuple.h.pump
+// DO NOT EDIT BY HAND!!!
 
 // Copyright 2009 Google Inc.
 // All Rights Reserved.
    private:
 #endif
 
+// Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that conflict
+// with our own definitions. Therefore using our own tuple does not work on
+// those compilers.
+#if defined(_MSC_VER) && _MSC_VER >= 1600  /* 1600 is Visual Studio 2010 */
+# error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \
+GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers."
+#endif
+
 // GTEST_n_TUPLE_(T) is the type of an n-tuple.
 #define GTEST_0_TUPLE_(T) tuple<>
 #define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
@@ -140,34 +150,54 @@ template <bool kIndexValid, int kIndex, class Tuple>
 struct TupleElement;
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 0, GTEST_10_TUPLE_(T)> { typedef T0 type; };
+struct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {
+  typedef T0 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 1, GTEST_10_TUPLE_(T)> { typedef T1 type; };
+struct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {
+  typedef T1 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 2, GTEST_10_TUPLE_(T)> { typedef T2 type; };
+struct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {
+  typedef T2 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 3, GTEST_10_TUPLE_(T)> { typedef T3 type; };
+struct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {
+  typedef T3 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 4, GTEST_10_TUPLE_(T)> { typedef T4 type; };
+struct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {
+  typedef T4 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 5, GTEST_10_TUPLE_(T)> { typedef T5 type; };
+struct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {
+  typedef T5 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 6, GTEST_10_TUPLE_(T)> { typedef T6 type; };
+struct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {
+  typedef T6 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 7, GTEST_10_TUPLE_(T)> { typedef T7 type; };
+struct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {
+  typedef T7 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 8, GTEST_10_TUPLE_(T)> { typedef T8 type; };
+struct TupleElement<true, 8, GTEST_10_TUPLE_(T) > {
+  typedef T8 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 9, GTEST_10_TUPLE_(T)> { typedef T9 type; };
+struct TupleElement<true, 9, GTEST_10_TUPLE_(T) > {
+  typedef T9 type;
+};
 
 }  // namespace gtest_internal
 
@@ -708,37 +738,59 @@ inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
 template <typename Tuple> struct tuple_size;
 
 template <GTEST_0_TYPENAMES_(T)>
-struct tuple_size<GTEST_0_TUPLE_(T)> { static const int value = 0; };
+struct tuple_size<GTEST_0_TUPLE_(T) > {
+  static const int value = 0;
+};
 
 template <GTEST_1_TYPENAMES_(T)>
-struct tuple_size<GTEST_1_TUPLE_(T)> { static const int value = 1; };
+struct tuple_size<GTEST_1_TUPLE_(T) > {
+  static const int value = 1;
+};
 
 template <GTEST_2_TYPENAMES_(T)>
-struct tuple_size<GTEST_2_TUPLE_(T)> { static const int value = 2; };
+struct tuple_size<GTEST_2_TUPLE_(T) > {
+  static const int value = 2;
+};
 
 template <GTEST_3_TYPENAMES_(T)>
-struct tuple_size<GTEST_3_TUPLE_(T)> { static const int value = 3; };
+struct tuple_size<GTEST_3_TUPLE_(T) > {
+  static const int value = 3;
+};
 
 template <GTEST_4_TYPENAMES_(T)>
-struct tuple_size<GTEST_4_TUPLE_(T)> { static const int value = 4; };
+struct tuple_size<GTEST_4_TUPLE_(T) > {
+  static const int value = 4;
+};
 
 template <GTEST_5_TYPENAMES_(T)>
-struct tuple_size<GTEST_5_TUPLE_(T)> { static const int value = 5; };
+struct tuple_size<GTEST_5_TUPLE_(T) > {
+  static const int value = 5;
+};
 
 template <GTEST_6_TYPENAMES_(T)>
-struct tuple_size<GTEST_6_TUPLE_(T)> { static const int value = 6; };
+struct tuple_size<GTEST_6_TUPLE_(T) > {
+  static const int value = 6;
+};
 
 template <GTEST_7_TYPENAMES_(T)>
-struct tuple_size<GTEST_7_TUPLE_(T)> { static const int value = 7; };
+struct tuple_size<GTEST_7_TUPLE_(T) > {
+  static const int value = 7;
+};
 
 template <GTEST_8_TYPENAMES_(T)>
-struct tuple_size<GTEST_8_TUPLE_(T)> { static const int value = 8; };
+struct tuple_size<GTEST_8_TUPLE_(T) > {
+  static const int value = 8;
+};
 
 template <GTEST_9_TYPENAMES_(T)>
-struct tuple_size<GTEST_9_TUPLE_(T)> { static const int value = 9; };
+struct tuple_size<GTEST_9_TUPLE_(T) > {
+  static const int value = 9;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct tuple_size<GTEST_10_TUPLE_(T)> { static const int value = 10; };
+struct tuple_size<GTEST_10_TUPLE_(T) > {
+  static const int value = 10;
+};
 
 template <int k, class Tuple>
 struct tuple_element {
@@ -922,8 +974,8 @@ template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
 inline bool operator==(const GTEST_10_TUPLE_(T)& t,
                        const GTEST_10_TUPLE_(U)& u) {
   return gtest_internal::SameSizeTuplePrefixComparator<
-      tuple_size<GTEST_10_TUPLE_(T)>::value,
-      tuple_size<GTEST_10_TUPLE_(U)>::value>::Eq(t, u);
+      tuple_size<GTEST_10_TUPLE_(T) >::value,
+      tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u);
 }
 
 template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
index ef51909..429ddfe 100755 (executable)
@@ -52,6 +52,14 @@ $$ This meta comment fixes auto-indentation in Emacs. }}
    private:
 #endif
 
+// Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that conflict
+// with our own definitions. Therefore using our own tuple does not work on
+// those compilers.
+#if defined(_MSC_VER) && _MSC_VER >= 1600  /* 1600 is Visual Studio 2010 */
+# error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \
+GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers."
+#endif
+
 
 $range i 0..n-1
 $range j 0..n
@@ -118,8 +126,9 @@ struct TupleElement;
 
 $for i [[
 template <GTEST_$(n)_TYPENAMES_(T)>
-struct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T)> [[]]
-{ typedef T$i type; };
+struct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T) > {
+  typedef T$i type;
+};
 
 
 ]]
@@ -220,7 +229,9 @@ template <typename Tuple> struct tuple_size;
 
 $for j [[
 template <GTEST_$(j)_TYPENAMES_(T)>
-struct tuple_size<GTEST_$(j)_TUPLE_(T)> { static const int value = $j; };
+struct tuple_size<GTEST_$(j)_TUPLE_(T) > {
+  static const int value = $j;
+};
 
 
 ]]
@@ -302,8 +313,8 @@ template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
 inline bool operator==(const GTEST_$(n)_TUPLE_(T)& t,
                        const GTEST_$(n)_TUPLE_(U)& u) {
   return gtest_internal::SameSizeTuplePrefixComparator<
-      tuple_size<GTEST_$(n)_TUPLE_(T)>::value,
-      tuple_size<GTEST_$(n)_TUPLE_(U)>::value>::Eq(t, u);
+      tuple_size<GTEST_$(n)_TUPLE_(T) >::value,
+      tuple_size<GTEST_$(n)_TUPLE_(U) >::value>::Eq(t, u);
 }
 
 template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
index b7b01b0..e46f7cf 100755 (executable)
 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
 
 #include "gtest/internal/gtest-port.h"
-#include "gtest/internal/gtest-string.h"
 
 // #ifdef __GNUC__ is too general here.  It is possible to use gcc without using
 // libstdc++ (which is where cxxabi.h comes from).
-# ifdef __GLIBCXX__
+# if GTEST_HAS_CXXABI_H_
 #  include <cxxabi.h>
 # elif defined(__HP_aCC)
 #  include <acxx_demangle.h>
-# endif  // __GLIBCXX__
+# endif  // GTEST_HASH_CXXABI_H_
 
 namespace testing {
 namespace internal {
@@ -62,24 +61,24 @@ namespace internal {
 // NB: This function is also used in Google Mock, so don't move it inside of
 // the typed-test-only section below.
 template <typename T>
-String GetTypeName() {
+std::string GetTypeName() {
 # if GTEST_HAS_RTTI
 
   const char* const name = typeid(T).name();
-#  if defined(__GLIBCXX__) || defined(__HP_aCC)
+#  if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
   int status = 0;
   // gcc's implementation of typeid(T).name() mangles the type name,
   // so we have to demangle it.
-#   ifdef __GLIBCXX__
+#   if GTEST_HAS_CXXABI_H_
   using abi::__cxa_demangle;
-#   endif // __GLIBCXX__
+#   endif  // GTEST_HAS_CXXABI_H_
   char* const readable_name = __cxa_demangle(name, 0, 0, &status);
-  const String name_str(status == 0 ? readable_name : name);
+  const std::string name_str(status == 0 ? readable_name : name);
   free(readable_name);
   return name_str;
 #  else
   return name;
-#  endif  // __GLIBCXX__ || __HP_aCC
+#  endif  // GTEST_HAS_CXXABI_H_ || __HP_aCC
 
 # else
 
@@ -3300,7 +3299,9 @@ struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
 // INSTANTIATE_TYPED_TEST_CASE_P().
 
 template <typename T>
-struct TypeList { typedef Types1<T> type; };
+struct TypeList {
+  typedef Types1<T> type;
+};
 
 template <typename T1, typename T2, typename T3, typename T4, typename T5,
     typename T6, typename T7, typename T8, typename T9, typename T10,
index 27f331d..251fdf0 100755 (executable)
@@ -43,15 +43,14 @@ $var n = 50  $$ Maximum length of type lists we want to support.
 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
 
 #include "gtest/internal/gtest-port.h"
-#include "gtest/internal/gtest-string.h"
 
 // #ifdef __GNUC__ is too general here.  It is possible to use gcc without using
 // libstdc++ (which is where cxxabi.h comes from).
-# ifdef __GLIBCXX__
+# if GTEST_HAS_CXXABI_H_
 #  include <cxxabi.h>
 # elif defined(__HP_aCC)
 #  include <acxx_demangle.h>
-# endif  // __GLIBCXX__
+# endif  // GTEST_HASH_CXXABI_H_
 
 namespace testing {
 namespace internal {
@@ -60,24 +59,24 @@ namespace internal {
 // NB: This function is also used in Google Mock, so don't move it inside of
 // the typed-test-only section below.
 template <typename T>
-String GetTypeName() {
+std::string GetTypeName() {
 # if GTEST_HAS_RTTI
 
   const char* const name = typeid(T).name();
-#  if defined(__GLIBCXX__) || defined(__HP_aCC)
+#  if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
   int status = 0;
   // gcc's implementation of typeid(T).name() mangles the type name,
   // so we have to demangle it.
-#   ifdef __GLIBCXX__
+#   if GTEST_HAS_CXXABI_H_
   using abi::__cxa_demangle;
-#   endif // __GLIBCXX__
+#   endif  // GTEST_HAS_CXXABI_H_
   char* const readable_name = __cxa_demangle(name, 0, 0, &status);
-  const String name_str(status == 0 ? readable_name : name);
+  const std::string name_str(status == 0 ? readable_name : name);
   free(readable_name);
   return name_str;
 #  else
   return name;
-#  endif  // __GLIBCXX__ || __HP_aCC
+#  endif  // GTEST_HAS_CXXABI_H_ || __HP_aCC
 
 # else
 
@@ -279,7 +278,9 @@ struct Templates<$for j, [[T$j]]$for k[[, NoneT]]> {
 // INSTANTIATE_TYPED_TEST_CASE_P().
 
 template <typename T>
-struct TypeList { typedef Types1<T> type; };
+struct TypeList {
+  typedef Types1<T> type;
+};
 
 
 $range i 1..n
diff --git a/lib/.dirstamp b/lib/.dirstamp
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/lib/libgtest.la b/lib/libgtest.la
deleted file mode 100644 (file)
index e5ae619..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# libgtest.la - a libtool library file
-# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='libgtest.so.0'
-
-# Names of this library.
-library_names='libgtest.so.0.0.0 libgtest.so.0 libgtest.so'
-
-# The name of the static archive.
-old_library='libgtest.a'
-
-# Linker flags that can not go in dependency_libs.
-inherited_linker_flags=' -pthread'
-
-# Libraries that this one depends upon.
-dependency_libs=''
-
-# Names of additional weak libraries provided by this library
-weak_library_names=''
-
-# Version information for libgtest.
-current=0
-age=0
-revision=0
-
-# Is this an already installed library?
-installed=no
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=no
-
-# Files to dlopen/dlpreopen
-dlopen=''
-dlpreopen=''
-
-# Directory that this library needs to be installed in:
-libdir='/usr/local/lib'
diff --git a/lib/libgtest_main.la b/lib/libgtest_main.la
deleted file mode 100644 (file)
index e88db7a..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# libgtest_main.la - a libtool library file
-# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='libgtest_main.so.0'
-
-# Names of this library.
-library_names='libgtest_main.so.0.0.0 libgtest_main.so.0 libgtest_main.so'
-
-# The name of the static archive.
-old_library='libgtest_main.a'
-
-# Linker flags that can not go in dependency_libs.
-inherited_linker_flags=' -pthread'
-
-# Libraries that this one depends upon.
-dependency_libs=' /home/dahyeong/git_/osp/external/gtest/lib/libgtest.la'
-
-# Names of additional weak libraries provided by this library
-weak_library_names=''
-
-# Version information for libgtest_main.
-current=0
-age=0
-revision=0
-
-# Is this an already installed library?
-installed=no
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=no
-
-# Files to dlopen/dlpreopen
-dlopen=''
-dlpreopen=''
-
-# Directory that this library needs to be installed in:
-libdir='/usr/local/lib'
-relink_command="(cd /home/dahyeong/git_/osp/external/gtest; /bin/bash /home/dahyeong/git_/osp/external/gtest/libtool  --tag CXX --mode=relink g++ -pthread -DGTEST_HAS_PTHREAD=1 -g -O2 -o lib/libgtest_main.la -rpath /usr/local/lib src/gtest_main.lo lib/libgtest.la @inst_prefix_dir@)"
diff --git a/libtool b/libtool
deleted file mode 100755 (executable)
index 51fec4f..0000000
--- a/libtool
+++ /dev/null
@@ -1,9063 +0,0 @@
-#! /bin/bash
-
-# libtool - Provide generalized library-building support services.
-# Generated automatically by config.status (gtest) 1.6.0
-# Libtool was configured on host dahyeong-Samsung-DeskTop-System:
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
-# obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-
-# The names of the tagged configurations supported by this script.
-available_tags="CXX "
-
-# ### BEGIN LIBTOOL CONFIG
-
-# Which release of libtool.m4 was used?
-macro_version=2.2.6b
-macro_revision=1.3017
-
-# Whether or not to build shared libraries.
-build_libtool_libs=yes
-
-# Whether or not to build static libraries.
-build_old_libs=yes
-
-# What type of objects to build.
-pic_mode=default
-
-# Whether or not to optimize for fast installation.
-fast_install=yes
-
-# The host system.
-host_alias=
-host=i686-pc-linux-gnu
-host_os=linux-gnu
-
-# The build system.
-build_alias=
-build=i686-pc-linux-gnu
-build_os=linux-gnu
-
-# A sed program that does not truncate output.
-SED="/bin/sed"
-
-# Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="$SED -e 1s/^X//"
-
-# A grep program that handles long lines.
-GREP="/bin/grep"
-
-# An ERE matcher.
-EGREP="/bin/grep -E"
-
-# A literal string matcher.
-FGREP="/bin/grep -F"
-
-# A BSD- or MS-compatible name lister.
-NM="/usr/bin/nm -B"
-
-# Whether we need soft or hard links.
-LN_S="ln -s"
-
-# What is the maximum length of a command?
-max_cmd_len=1572864
-
-# Object file suffix (normally "o").
-objext=o
-
-# Executable file suffix (normally "").
-exeext=
-
-# whether the shell understands "unset".
-lt_unset=unset
-
-# turn spaces into newlines.
-SP2NL="tr \\040 \\012"
-
-# turn newlines into spaces.
-NL2SP="tr \\015\\012 \\040\\040"
-
-# How to create reloadable object files.
-reload_flag=" -r"
-reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
-
-# An object symbol dumper.
-OBJDUMP="objdump"
-
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method="pass_all"
-
-# Command to use when deplibs_check_method == "file_magic".
-file_magic_cmd="\$MAGIC_CMD"
-
-# The archiver.
-AR="ar"
-AR_FLAGS="cru"
-
-# A symbol stripping program.
-STRIP="strip"
-
-# Commands used to install an old-style archive.
-RANLIB="ranlib"
-old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
-old_postuninstall_cmds=""
-
-# A C compiler.
-LTCC="gcc"
-
-# LTCC compiler flags.
-LTCFLAGS="-g -O2"
-
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe="sed -n -e 's/^.*[   ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[       ][      ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
-
-# Transform the output of nm in a proper C declaration.
-global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
-
-# Transform the output of nm in a C name address pair.
-global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/  {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/  {\"\\2\", (void *) \\&\\2},/p'"
-
-# Transform the output of nm in a C name address pair when lib prefix is needed.
-global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\) \$/  {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/  {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/  {\"lib\\2\", (void *) \\&\\2},/p'"
-
-# The name of the directory that contains temporary libtool files.
-objdir=.libs
-
-# Shell to use when invoking shell scripts.
-SHELL="/bin/bash"
-
-# An echo program that does not interpret backslashes.
-ECHO="echo"
-
-# Used to examine libraries when file_magic_cmd begins with "file".
-MAGIC_CMD=file
-
-# Must we lock files when doing compilation?
-need_locks="no"
-
-# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
-DSYMUTIL=""
-
-# Tool to change global to local symbols on Mac OS X.
-NMEDIT=""
-
-# Tool to manipulate fat objects and archives on Mac OS X.
-LIPO=""
-
-# ldd/readelf like tool for Mach-O binaries on Mac OS X.
-OTOOL=""
-
-# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
-OTOOL64=""
-
-# Old archive suffix (normally "a").
-libext=a
-
-# Shared library suffix (normally ".so").
-shrext_cmds=".so"
-
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=""
-
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at link time.
-variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-
-# Do we need the "lib" prefix for modules?
-need_lib_prefix=no
-
-# Do we need a version for libraries?
-need_version=no
-
-# Library versioning type.
-version_type=linux
-
-# Shared library runtime path variable.
-runpath_var=LD_RUN_PATH
-
-# Shared library path variable.
-shlibpath_var=LD_LIBRARY_PATH
-
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=no
-
-# Format of library name prefix.
-libname_spec="lib\$name"
-
-# List of archive names.  First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME
-library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
-
-# The coded name of the library, if different from the real name.
-soname_spec="\${libname}\${release}\${shared_ext}\$major"
-
-# Command to use after installation of a shared archive.
-postinstall_cmds=""
-
-# Command to use after uninstallation of a shared archive.
-postuninstall_cmds=""
-
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
-
-# As "finish_cmds", except a single script fragment to be evaled but
-# not shown.
-finish_eval=""
-
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=yes
-
-# Compile-time system search path for libraries.
-sys_lib_search_path_spec="/usr/lib/gcc/i686-linux-gnu/4.6.1 /usr/lib/i386-linux-gnu /usr/lib /lib/i386-linux-gnu /lib"
-
-# Run-time system search path for libraries.
-sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/nvidia-current /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/local/lib /usr/lib/nvidia-settings "
-
-# Whether dlopen is supported.
-dlopen_support=unknown
-
-# Whether dlopen of programs is supported.
-dlopen_self=unknown
-
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=unknown
-
-# Commands to strip libraries.
-old_striplib="strip --strip-debug"
-striplib="strip --strip-unneeded"
-
-
-# The linker used to build libraries.
-LD="/usr/bin/ld"
-
-# Commands used to build an old-style archive.
-old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
-
-# A language specific compiler.
-CC="gcc"
-
-# Is the compiler the GNU compiler?
-with_gcc=yes
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=" -fno-builtin"
-
-# How to pass a linker flag through the compiler.
-wl="-Wl,"
-
-# Additional compiler flags for building library objects.
-pic_flag=" -fPIC -DPIC"
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag="-static"
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o="yes"
-
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=no
-
-# Whether or not to disallow shared libs when runtime libs are static.
-allow_libtool_libs_with_static_runtimes=no
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec="\${wl}--export-dynamic"
-
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
-
-# Whether the compiler copes with passing no objects directly.
-compiler_needs_object="no"
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=""
-
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=""
-
-# Commands used to build a shared archive.
-archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
-archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
-           cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
-           echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
-           \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
-
-# Commands used to build a loadable module if different from building
-# a shared archive.
-module_cmds=""
-module_expsym_cmds=""
-
-# Whether we are building with GNU ld or not.
-with_gnu_ld="yes"
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=""
-
-# Flag that enforces no undefined symbols.
-no_undefined_flag=""
-
-# Flag to hardcode $libdir into a binary during linking.
-# This must work even if $libdir does not exist
-hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
-
-# If ld is used when linking, flag to hardcode $libdir into a binary
-# during linking.  This must work even if $libdir does not exist.
-hardcode_libdir_flag_spec_ld=""
-
-# Whether we need a single "-rpath" flag with a separated argument.
-hardcode_libdir_separator=""
-
-# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
-# DIR into the resulting binary.
-hardcode_direct=no
-
-# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
-# DIR into the resulting binary and the resulting library dependency is
-# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
-# library is relocated.
-hardcode_direct_absolute=no
-
-# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
-# into the resulting binary.
-hardcode_minus_L=no
-
-# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
-# into the resulting binary.
-hardcode_shlibpath_var=unsupported
-
-# Set to "yes" if building a shared library automatically hardcodes DIR
-# into the library and all subsequent libraries and executables linked
-# against it.
-hardcode_automatic=no
-
-# Set to yes if linker adds runtime paths of dependent libraries
-# to runtime path list.
-inherit_rpath=no
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=no
-
-# Fix the shell variable $srcfile for the compiler.
-fix_srcfile_path=""
-
-# Set to "yes" if exported symbols are required.
-always_export_symbols=no
-
-# The commands to list exported symbols.
-export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
-
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
-
-# Symbols that must always be exported.
-include_expsyms=""
-
-# Commands necessary for linking programs (against libraries) with templates.
-prelink_cmds=""
-
-# Specify filename containing input files.
-file_list_spec=""
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=immediate
-
-# The directories searched by this compiler when creating a shared library.
-compiler_lib_search_dirs=""
-
-# Dependencies to place before and after the objects being linked to
-# create a shared library.
-predep_objects=""
-postdep_objects=""
-predeps=""
-postdeps=""
-
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=""
-
-# ### END LIBTOOL CONFIG
-
-# Generated from ltmain.m4sh.
-
-# ltmain.sh (GNU libtool) 2.2.6b
-# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
-# This is free software; see the source for copying conditions.  There is NO
-# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-# GNU Libtool is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# Usage: $progname [OPTION]... [MODE-ARG]...
-#
-# Provide generalized library-building support services.
-#
-#     --config             show all configuration variables
-#     --debug              enable verbose shell tracing
-# -n, --dry-run            display commands without modifying any files
-#     --features           display basic configuration information and exit
-#     --mode=MODE          use operation mode MODE
-#     --preserve-dup-deps  don't remove duplicate dependency libraries
-#     --quiet, --silent    don't print informational messages
-#     --tag=TAG            use configuration variables from tag TAG
-# -v, --verbose            print informational messages (default)
-#     --version            print version information
-# -h, --help               print short or long help message
-#
-# MODE must be one of the following:
-#
-#       clean              remove files from the build directory
-#       compile            compile a source file into a libtool object
-#       execute            automatically set library path, then run a program
-#       finish             complete the installation of libtool libraries
-#       install            install libraries or executables
-#       link               create a library or an executable
-#       uninstall          remove libraries from an installed directory
-#
-# MODE-ARGS vary depending on the MODE.
-# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
-#
-# When reporting a bug, please describe a test case to reproduce it and
-# include the following information:
-#
-#       host-triplet:  $host
-#       shell:         $SHELL
-#       compiler:              $LTCC
-#       compiler flags:                $LTCFLAGS
-#       linker:                $LD (gnu? $with_gnu_ld)
-#       $progname:             (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
-#       automake:              $automake_version
-#       autoconf:              $autoconf_version
-#
-# Report bugs to <bug-libtool@gnu.org>.
-
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION="2.2.6b Debian-2.2.6b-2ubuntu1"
-TIMESTAMP=""
-package_revision=1.3017
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# NLS nuisances: We save the old values to restore during execute mode.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-lt_user_locale=
-lt_safe_locale=
-for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
-do
-  eval "if test \"\${$lt_var+set}\" = set; then
-          save_$lt_var=\$$lt_var
-          $lt_var=C
-         export $lt_var
-         lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
-         lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
-       fi"
-done
-
-$lt_unset CDPATH
-
-
-
-
-
-: ${CP="cp -f"}
-: ${ECHO="echo"}
-: ${EGREP="/bin/grep -E"}
-: ${FGREP="/bin/grep -F"}
-: ${GREP="/bin/grep"}
-: ${LN_S="ln -s"}
-: ${MAKE="make"}
-: ${MKDIR="mkdir"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
-: ${SED="/bin/sed"}
-: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
-: ${Xsed="$SED -e 1s/^X//"}
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
-EXIT_SKIP=77     # $? = 77 is used to indicate a skipped test to automake.
-
-exit_status=$EXIT_SUCCESS
-
-# Make sure IFS has a sensible default
-lt_nl='
-'
-IFS="  $lt_nl"
-
-dirname="s,/[^/]*$,,"
-basename="s,^.*/,,"
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
-
-# Generated shell functions inserted here.
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result="${1##*/}"
-}
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-  func_basename_result="${1##*/}"
-}
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-func_stripname ()
-{
-  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-  # positional parameters, so assign one to ordinary parameter first.
-  func_stripname_result=${3}
-  func_stripname_result=${func_stripname_result#"${1}"}
-  func_stripname_result=${func_stripname_result%"${2}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=${1%%=*}
-  func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  case ${1} in
-    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-    *)    func_lo2o_result=${1} ;;
-  esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=$(( $* ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=${#1}
-}
-
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1+=\$2"
-}
-# Generated shell functions inserted here.
-
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
-
-# The name of this program:
-# In the unlikely event $progname began with a '-', it would play havoc with
-# func_echo (imagine progname=-n), so we prepend ./ in that case:
-func_dirname_and_basename "$progpath"
-progname=$func_basename_result
-case $progname in
-  -*) progname=./$progname ;;
-esac
-
-# Make sure we have an absolute path for reexecution:
-case $progpath in
-  [\\/]*|[A-Za-z]:\\*) ;;
-  *[\\/]*)
-     progdir=$func_dirname_result
-     progdir=`cd "$progdir" && pwd`
-     progpath="$progdir/$progname"
-     ;;
-  *)
-     save_IFS="$IFS"
-     IFS=:
-     for progdir in $PATH; do
-       IFS="$save_IFS"
-       test -x "$progdir/$progname" && break
-     done
-     IFS="$save_IFS"
-     test -n "$progdir" || progdir=`pwd`
-     progpath="$progdir/$progname"
-     ;;
-esac
-
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Re-`\' parameter expansions in output of double_quote_subst that were
-# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
-# in input to double_quote_subst, that '$' was protected from expansion.
-# Since each input `\' is now two `\'s, look for any number of runs of
-# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
-bs='\\'
-bs2='\\\\'
-bs4='\\\\\\\\'
-dollar='\$'
-sed_double_backslash="\
-  s/$bs4/&\\
-/g
-  s/^$bs2$dollar/$bs&/
-  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
-  s/\n//g"
-
-# Standard options:
-opt_dry_run=false
-opt_help=false
-opt_quiet=false
-opt_verbose=false
-opt_warning=:
-
-# func_echo arg...
-# Echo program name prefixed message, along with the current mode
-# name if it has been set yet.
-func_echo ()
-{
-    $ECHO "$progname${mode+: }$mode: $*"
-}
-
-# func_verbose arg...
-# Echo program name prefixed message in verbose mode only.
-func_verbose ()
-{
-    $opt_verbose && func_echo ${1+"$@"}
-
-    # A bug in bash halts the script if the last line of a function
-    # fails when set -e is in force, so we need another command to
-    # work around that:
-    :
-}
-
-# func_error arg...
-# Echo program name prefixed message to standard error.
-func_error ()
-{
-    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
-}
-
-# func_warning arg...
-# Echo program name prefixed warning message to standard error.
-func_warning ()
-{
-    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
-
-    # bash bug again:
-    :
-}
-
-# func_fatal_error arg...
-# Echo program name prefixed message to standard error, and exit.
-func_fatal_error ()
-{
-    func_error ${1+"$@"}
-    exit $EXIT_FAILURE
-}
-
-# func_fatal_help arg...
-# Echo program name prefixed message to standard error, followed by
-# a help hint, and exit.
-func_fatal_help ()
-{
-    func_error ${1+"$@"}
-    func_fatal_error "$help"
-}
-help="Try \`$progname --help' for more information."  ## default
-
-
-# func_grep expression filename
-# Check whether EXPRESSION matches any line of FILENAME, without output.
-func_grep ()
-{
-    $GREP "$1" "$2" >/dev/null 2>&1
-}
-
-
-# func_mkdir_p directory-path
-# Make sure the entire path to DIRECTORY-PATH is available.
-func_mkdir_p ()
-{
-    my_directory_path="$1"
-    my_dir_list=
-
-    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
-
-      # Protect directory names starting with `-'
-      case $my_directory_path in
-        -*) my_directory_path="./$my_directory_path" ;;
-      esac
-
-      # While some portion of DIR does not yet exist...
-      while test ! -d "$my_directory_path"; do
-        # ...make a list in topmost first order.  Use a colon delimited
-       # list incase some portion of path contains whitespace.
-        my_dir_list="$my_directory_path:$my_dir_list"
-
-        # If the last portion added has no slash in it, the list is done
-        case $my_directory_path in */*) ;; *) break ;; esac
-
-        # ...otherwise throw away the child directory and loop
-        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
-      done
-      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
-
-      save_mkdir_p_IFS="$IFS"; IFS=':'
-      for my_dir in $my_dir_list; do
-       IFS="$save_mkdir_p_IFS"
-        # mkdir can fail with a `File exist' error if two processes
-        # try to create one of the directories concurrently.  Don't
-        # stop in that case!
-        $MKDIR "$my_dir" 2>/dev/null || :
-      done
-      IFS="$save_mkdir_p_IFS"
-
-      # Bail out if we (or some other process) failed to create a directory.
-      test -d "$my_directory_path" || \
-        func_fatal_error "Failed to create \`$1'"
-    fi
-}
-
-
-# func_mktempdir [string]
-# Make a temporary directory that won't clash with other running
-# libtool processes, and avoids race conditions if possible.  If
-# given, STRING is the basename for that directory.
-func_mktempdir ()
-{
-    my_template="${TMPDIR-/tmp}/${1-$progname}"
-
-    if test "$opt_dry_run" = ":"; then
-      # Return a directory name, but don't create it in dry-run mode
-      my_tmpdir="${my_template}-$$"
-    else
-
-      # If mktemp works, use that first and foremost
-      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
-
-      if test ! -d "$my_tmpdir"; then
-        # Failing that, at least try and use $RANDOM to avoid a race
-        my_tmpdir="${my_template}-${RANDOM-0}$$"
-
-        save_mktempdir_umask=`umask`
-        umask 0077
-        $MKDIR "$my_tmpdir"
-        umask $save_mktempdir_umask
-      fi
-
-      # If we're not in dry-run mode, bomb out on failure
-      test -d "$my_tmpdir" || \
-        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
-    fi
-
-    $ECHO "X$my_tmpdir" | $Xsed
-}
-
-
-# func_quote_for_eval arg
-# Aesthetically quote ARG to be evaled later.
-# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
-# is double-quoted, suitable for a subsequent eval, whereas
-# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
-# which are still active within double quotes backslashified.
-func_quote_for_eval ()
-{
-    case $1 in
-      *[\\\`\"\$]*)
-       func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
-      *)
-        func_quote_for_eval_unquoted_result="$1" ;;
-    esac
-
-    case $func_quote_for_eval_unquoted_result in
-      # Double-quote args containing shell metacharacters to delay
-      # word splitting, command substitution and and variable
-      # expansion for a subsequent eval.
-      # Many Bourne shells cannot handle close brackets correctly
-      # in scan sets, so we specify it separately.
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
-        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
-        ;;
-      *)
-        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
-    esac
-}
-
-
-# func_quote_for_expand arg
-# Aesthetically quote ARG to be evaled later; same as above,
-# but do not quote variable references.
-func_quote_for_expand ()
-{
-    case $1 in
-      *[\\\`\"]*)
-       my_arg=`$ECHO "X$1" | $Xsed \
-           -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
-      *)
-        my_arg="$1" ;;
-    esac
-
-    case $my_arg in
-      # Double-quote args containing shell metacharacters to delay
-      # word splitting and command substitution for a subsequent eval.
-      # Many Bourne shells cannot handle close brackets correctly
-      # in scan sets, so we specify it separately.
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
-        my_arg="\"$my_arg\""
-        ;;
-    esac
-
-    func_quote_for_expand_result="$my_arg"
-}
-
-
-# func_show_eval cmd [fail_exp]
-# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
-# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it.
-func_show_eval ()
-{
-    my_cmd="$1"
-    my_fail_exp="${2-:}"
-
-    ${opt_silent-false} || {
-      func_quote_for_expand "$my_cmd"
-      eval "func_echo $func_quote_for_expand_result"
-    }
-
-    if ${opt_dry_run-false}; then :; else
-      eval "$my_cmd"
-      my_status=$?
-      if test "$my_status" -eq 0; then :; else
-       eval "(exit $my_status); $my_fail_exp"
-      fi
-    fi
-}
-
-
-# func_show_eval_locale cmd [fail_exp]
-# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
-# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it.  Use the saved locale for evaluation.
-func_show_eval_locale ()
-{
-    my_cmd="$1"
-    my_fail_exp="${2-:}"
-
-    ${opt_silent-false} || {
-      func_quote_for_expand "$my_cmd"
-      eval "func_echo $func_quote_for_expand_result"
-    }
-
-    if ${opt_dry_run-false}; then :; else
-      eval "$lt_user_locale
-           $my_cmd"
-      my_status=$?
-      eval "$lt_safe_locale"
-      if test "$my_status" -eq 0; then :; else
-       eval "(exit $my_status); $my_fail_exp"
-      fi
-    fi
-}
-
-
-
-
-
-# func_version
-# Echo version message to standard output and exit.
-func_version ()
-{
-    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
-        s/^# //
-       s/^# *$//
-        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
-        p
-     }' < "$progpath"
-     exit $?
-}
-
-# func_usage
-# Echo short help message to standard output and exit.
-func_usage ()
-{
-    $SED -n '/^# Usage:/,/# -h/ {
-        s/^# //
-       s/^# *$//
-       s/\$progname/'$progname'/
-       p
-    }' < "$progpath"
-    $ECHO
-    $ECHO "run \`$progname --help | more' for full usage"
-    exit $?
-}
-
-# func_help
-# Echo long help message to standard output and exit.
-func_help ()
-{
-    $SED -n '/^# Usage:/,/# Report bugs to/ {
-        s/^# //
-       s/^# *$//
-       s*\$progname*'$progname'*
-       s*\$host*'"$host"'*
-       s*\$SHELL*'"$SHELL"'*
-       s*\$LTCC*'"$LTCC"'*
-       s*\$LTCFLAGS*'"$LTCFLAGS"'*
-       s*\$LD*'"$LD"'*
-       s/\$with_gnu_ld/'"$with_gnu_ld"'/
-       s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
-       s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
-       p
-     }' < "$progpath"
-    exit $?
-}
-
-# func_missing_arg argname
-# Echo program name prefixed message to standard error and set global
-# exit_cmd.
-func_missing_arg ()
-{
-    func_error "missing argument for $1"
-    exit_cmd=exit
-}
-
-exit_cmd=:
-
-
-
-
-
-# Check that we have a working $ECHO.
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell, and then maybe $ECHO will work.
-  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-$*
-EOF
-  exit $EXIT_SUCCESS
-fi
-
-magic="%%%MAGIC variable%%%"
-magic_exe="%%%MAGIC EXE variable%%%"
-
-# Global variables.
-# $mode is unset
-nonopt=
-execute_dlfiles=
-preserve_args=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-extracted_archives=
-extracted_serial=0
-
-opt_dry_run=false
-opt_duplicate_deps=false
-opt_silent=false
-opt_debug=:
-
-# If this variable is set in any of the actions, the command in it
-# will be execed at the end.  This prevents here-documents from being
-# left over by shells.
-exec_cmd=
-
-# func_fatal_configuration arg...
-# Echo program name prefixed message to standard error, followed by
-# a configuration failure hint, and exit.
-func_fatal_configuration ()
-{
-    func_error ${1+"$@"}
-    func_error "See the $PACKAGE documentation for more information."
-    func_fatal_error "Fatal configuration error."
-}
-
-
-# func_config
-# Display the configuration for all the tags in this script.
-func_config ()
-{
-    re_begincf='^# ### BEGIN LIBTOOL'
-    re_endcf='^# ### END LIBTOOL'
-
-    # Default configuration.
-    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
-
-    # Now print the configurations for the tags.
-    for tagname in $taglist; do
-      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
-    done
-
-    exit $?
-}
-
-# func_features
-# Display the features supported by this script.
-func_features ()
-{
-    $ECHO "host: $host"
-    if test "$build_libtool_libs" = yes; then
-      $ECHO "enable shared libraries"
-    else
-      $ECHO "disable shared libraries"
-    fi
-    if test "$build_old_libs" = yes; then
-      $ECHO "enable static libraries"
-    else
-      $ECHO "disable static libraries"
-    fi
-
-    exit $?
-}
-
-# func_enable_tag tagname
-# Verify that TAGNAME is valid, and either flag an error and exit, or
-# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
-# variable here.
-func_enable_tag ()
-{
-  # Global variable:
-  tagname="$1"
-
-  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
-  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
-  sed_extractcf="/$re_begincf/,/$re_endcf/p"
-
-  # Validate tagname.
-  case $tagname in
-    *[!-_A-Za-z0-9,/]*)
-      func_fatal_error "invalid tag name: $tagname"
-      ;;
-  esac
-
-  # Don't test for the "default" C tag, as we know it's
-  # there but not specially marked.
-  case $tagname in
-    CC) ;;
-    *)
-      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
-       taglist="$taglist $tagname"
-
-       # Evaluate the configuration.  Be careful to quote the path
-       # and the sed script, to avoid splitting on whitespace, but
-       # also don't use non-portable quotes within backquotes within
-       # quotes we have to do it in 2 steps:
-       extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
-       eval "$extractedcf"
-      else
-       func_error "ignoring unknown tag $tagname"
-      fi
-      ;;
-  esac
-}
-
-# Parse options once, thoroughly.  This comes as soon as possible in
-# the script to make things like `libtool --version' happen quickly.
-{
-
-  # Shorthand for --mode=foo, only valid as the first argument
-  case $1 in
-  clean|clea|cle|cl)
-    shift; set dummy --mode clean ${1+"$@"}; shift
-    ;;
-  compile|compil|compi|comp|com|co|c)
-    shift; set dummy --mode compile ${1+"$@"}; shift
-    ;;
-  execute|execut|execu|exec|exe|ex|e)
-    shift; set dummy --mode execute ${1+"$@"}; shift
-    ;;
-  finish|finis|fini|fin|fi|f)
-    shift; set dummy --mode finish ${1+"$@"}; shift
-    ;;
-  install|instal|insta|inst|ins|in|i)
-    shift; set dummy --mode install ${1+"$@"}; shift
-    ;;
-  link|lin|li|l)
-    shift; set dummy --mode link ${1+"$@"}; shift
-    ;;
-  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
-    shift; set dummy --mode uninstall ${1+"$@"}; shift
-    ;;
-  esac
-
-  # Parse non-mode specific arguments:
-  while test "$#" -gt 0; do
-    opt="$1"
-    shift
-
-    case $opt in
-      --config)                func_config                                     ;;
-
-      --debug)         preserve_args="$preserve_args $opt"
-                       func_echo "enabling shell trace mode"
-                       opt_debug='set -x'
-                       $opt_debug
-                       ;;
-
-      -dlopen)         test "$#" -eq 0 && func_missing_arg "$opt" && break
-                       execute_dlfiles="$execute_dlfiles $1"
-                       shift
-                       ;;
-
-      --dry-run | -n)  opt_dry_run=:                                   ;;
-      --features)       func_features                                  ;;
-      --finish)                mode="finish"                                   ;;
-
-      --mode)          test "$#" -eq 0 && func_missing_arg "$opt" && break
-                       case $1 in
-                         # Valid mode arguments:
-                         clean)        ;;
-                         compile)      ;;
-                         execute)      ;;
-                         finish)       ;;
-                         install)      ;;
-                         link)         ;;
-                         relink)       ;;
-                         uninstall)    ;;
-
-                         # Catch anything else as an error
-                         *) func_error "invalid argument for $opt"
-                            exit_cmd=exit
-                            break
-                            ;;
-                       esac
-
-                       mode="$1"
-                       shift
-                       ;;
-
-      --preserve-dup-deps)
-                       opt_duplicate_deps=:                            ;;
-
-      --quiet|--silent)        preserve_args="$preserve_args $opt"
-                       opt_silent=:
-                       ;;
-
-      --verbose| -v)   preserve_args="$preserve_args $opt"
-                       opt_silent=false
-                       ;;
-
-      --tag)           test "$#" -eq 0 && func_missing_arg "$opt" && break
-                       preserve_args="$preserve_args $opt $1"
-                       func_enable_tag "$1"    # tagname is set here
-                       shift
-                       ;;
-
-      # Separate optargs to long options:
-      -dlopen=*|--mode=*|--tag=*)
-                       func_opt_split "$opt"
-                       set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
-                       shift
-                       ;;
-
-      -\?|-h)          func_usage                                      ;;
-      --help)          opt_help=:                                      ;;
-      --version)       func_version                                    ;;
-
-      -*)              func_fatal_help "unrecognized option \`$opt'"   ;;
-
-      *)               nonopt="$opt"
-                       break
-                       ;;
-    esac
-  done
-
-
-  case $host in
-    *cygwin* | *mingw* | *pw32* | *cegcc*)
-      # don't eliminate duplications in $postdeps and $predeps
-      opt_duplicate_compiler_generated_deps=:
-      ;;
-    *)
-      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
-      ;;
-  esac
-
-  # Having warned about all mis-specified options, bail out if
-  # anything was wrong.
-  $exit_cmd $EXIT_FAILURE
-}
-
-# func_check_version_match
-# Ensure that we are using m4 macros, and libtool script from the same
-# release of libtool.
-func_check_version_match ()
-{
-  if test "$package_revision" != "$macro_revision"; then
-    if test "$VERSION" != "$macro_version"; then
-      if test -z "$macro_version"; then
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from an older release.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      else
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      fi
-    else
-      cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
-$progname: but the definition of this LT_INIT comes from revision $macro_revision.
-$progname: You should recreate aclocal.m4 with macros from revision $package_revision
-$progname: of $PACKAGE $VERSION and run autoconf again.
-_LT_EOF
-    fi
-
-    exit $EXIT_MISMATCH
-  fi
-}
-
-
-## ----------- ##
-##    Main.    ##
-## ----------- ##
-
-$opt_help || {
-  # Sanity checks first:
-  func_check_version_match
-
-  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-    func_fatal_configuration "not configured to build any kind of library"
-  fi
-
-  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
-
-
-  # Darwin sucks
-  eval std_shrext=\"$shrext_cmds\"
-
-
-  # Only execute mode is allowed to have -dlopen flags.
-  if test -n "$execute_dlfiles" && test "$mode" != execute; then
-    func_error "unrecognized option \`-dlopen'"
-    $ECHO "$help" 1>&2
-    exit $EXIT_FAILURE
-  fi
-
-  # Change the help message to a mode-specific one.
-  generic_help="$help"
-  help="Try \`$progname --help --mode=$mode' for more information."
-}
-
-
-# func_lalib_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_lalib_p ()
-{
-    test -f "$1" &&
-      $SED -e 4q "$1" 2>/dev/null \
-        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
-}
-
-# func_lalib_unsafe_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
-# This function implements the same check as func_lalib_p without
-# resorting to external programs.  To this end, it redirects stdin and
-# closes it afterwards, without saving the original file descriptor.
-# As a safety measure, use it only where a negative result would be
-# fatal anyway.  Works if `file' does not exist.
-func_lalib_unsafe_p ()
-{
-    lalib_p=no
-    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
-       for lalib_p_l in 1 2 3 4
-       do
-           read lalib_p_line
-           case "$lalib_p_line" in
-               \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
-           esac
-       done
-       exec 0<&5 5<&-
-    fi
-    test "$lalib_p" = yes
-}
-
-# func_ltwrapper_script_p file
-# True iff FILE is a libtool wrapper script
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_script_p ()
-{
-    func_lalib_p "$1"
-}
-
-# func_ltwrapper_executable_p file
-# True iff FILE is a libtool wrapper executable
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_executable_p ()
-{
-    func_ltwrapper_exec_suffix=
-    case $1 in
-    *.exe) ;;
-    *) func_ltwrapper_exec_suffix=.exe ;;
-    esac
-    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
-}
-
-# func_ltwrapper_scriptname file
-# Assumes file is an ltwrapper_executable
-# uses $file to determine the appropriate filename for a
-# temporary ltwrapper_script.
-func_ltwrapper_scriptname ()
-{
-    func_ltwrapper_scriptname_result=""
-    if func_ltwrapper_executable_p "$1"; then
-       func_dirname_and_basename "$1" "" "."
-       func_stripname '' '.exe' "$func_basename_result"
-       func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
-    fi
-}
-
-# func_ltwrapper_p file
-# True iff FILE is a libtool wrapper script or wrapper executable
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_p ()
-{
-    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
-}
-
-
-# func_execute_cmds commands fail_cmd
-# Execute tilde-delimited COMMANDS.
-# If FAIL_CMD is given, eval that upon failure.
-# FAIL_CMD may read-access the current command in variable CMD!
-func_execute_cmds ()
-{
-    $opt_debug
-    save_ifs=$IFS; IFS='~'
-    for cmd in $1; do
-      IFS=$save_ifs
-      eval cmd=\"$cmd\"
-      func_show_eval "$cmd" "${2-:}"
-    done
-    IFS=$save_ifs
-}
-
-
-# func_source file
-# Source FILE, adding directory component if necessary.
-# Note that it is not necessary on cygwin/mingw to append a dot to
-# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
-# behavior happens only for exec(3), not for open(2)!  Also, sourcing
-# `FILE.' does not work on cygwin managed mounts.
-func_source ()
-{
-    $opt_debug
-    case $1 in
-    */* | *\\*)        . "$1" ;;
-    *)         . "./$1" ;;
-    esac
-}
-
-
-# func_infer_tag arg
-# Infer tagged configuration to use if any are available and
-# if one wasn't chosen via the "--tag" command line option.
-# Only attempt this if the compiler in the base compile
-# command doesn't match the default compiler.
-# arg is usually of the form 'gcc ...'
-func_infer_tag ()
-{
-    $opt_debug
-    if test -n "$available_tags" && test -z "$tagname"; then
-      CC_quoted=
-      for arg in $CC; do
-        func_quote_for_eval "$arg"
-       CC_quoted="$CC_quoted $func_quote_for_eval_result"
-      done
-      case $@ in
-      # Blanks in the command may have been stripped by the calling shell,
-      # but not from the CC environment variable when configure was run.
-      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
-      # Blanks at the start of $base_compile will cause this to fail
-      # if we don't check for them as well.
-      *)
-       for z in $available_tags; do
-         if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
-           # Evaluate the configuration.
-           eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
-           CC_quoted=
-           for arg in $CC; do
-             # Double-quote args containing other shell metacharacters.
-             func_quote_for_eval "$arg"
-             CC_quoted="$CC_quoted $func_quote_for_eval_result"
-           done
-           case "$@ " in
-             " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
-             # The compiler in the base compile command matches
-             # the one in the tagged configuration.
-             # Assume this is the tagged configuration we want.
-             tagname=$z
-             break
-             ;;
-           esac
-         fi
-       done
-       # If $tagname still isn't set, then no tagged configuration
-       # was found and let the user know that the "--tag" command
-       # line option must be used.
-       if test -z "$tagname"; then
-         func_echo "unable to infer tagged configuration"
-         func_fatal_error "specify a tag with \`--tag'"
-#      else
-#        func_verbose "using $tagname tagged configuration"
-       fi
-       ;;
-      esac
-    fi
-}
-
-
-
-# func_write_libtool_object output_name pic_name nonpic_name
-# Create a libtool object file (analogous to a ".la" file),
-# but don't create it if we're doing a dry run.
-func_write_libtool_object ()
-{
-    write_libobj=${1}
-    if test "$build_libtool_libs" = yes; then
-      write_lobj=\'${2}\'
-    else
-      write_lobj=none
-    fi
-
-    if test "$build_old_libs" = yes; then
-      write_oldobj=\'${3}\'
-    else
-      write_oldobj=none
-    fi
-
-    $opt_dry_run || {
-      cat >${write_libobj}T <<EOF
-# $write_libobj - a libtool object file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-pic_object=$write_lobj
-
-# Name of the non-PIC object
-non_pic_object=$write_oldobj
-
-EOF
-      $MV "${write_libobj}T" "${write_libobj}"
-    }
-}
-
-# func_mode_compile arg...
-func_mode_compile ()
-{
-    $opt_debug
-    # Get the compilation command and the source file.
-    base_compile=
-    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
-    suppress_opt=yes
-    suppress_output=
-    arg_mode=normal
-    libobj=
-    later=
-    pie_flag=
-
-    for arg
-    do
-      case $arg_mode in
-      arg  )
-       # do not "continue".  Instead, add this to base_compile
-       lastarg="$arg"
-       arg_mode=normal
-       ;;
-
-      target )
-       libobj="$arg"
-       arg_mode=normal
-       continue
-       ;;
-
-      normal )
-       # Accept any command-line options.
-       case $arg in
-       -o)
-         test -n "$libobj" && \
-           func_fatal_error "you cannot specify \`-o' more than once"
-         arg_mode=target
-         continue
-         ;;
-
-       -pie | -fpie | -fPIE)
-          pie_flag="$pie_flag $arg"
-         continue
-         ;;
-
-       -shared | -static | -prefer-pic | -prefer-non-pic)
-         later="$later $arg"
-         continue
-         ;;
-
-       -no-suppress)
-         suppress_opt=no
-         continue
-         ;;
-
-       -Xcompiler)
-         arg_mode=arg  #  the next one goes into the "base_compile" arg list
-         continue      #  The current "srcfile" will either be retained or
-         ;;            #  replaced later.  I would guess that would be a bug.
-
-       -Wc,*)
-         func_stripname '-Wc,' '' "$arg"
-         args=$func_stripname_result
-         lastarg=
-         save_ifs="$IFS"; IFS=','
-         for arg in $args; do
-           IFS="$save_ifs"
-           func_quote_for_eval "$arg"
-           lastarg="$lastarg $func_quote_for_eval_result"
-         done
-         IFS="$save_ifs"
-         func_stripname ' ' '' "$lastarg"
-         lastarg=$func_stripname_result
-
-         # Add the arguments to base_compile.
-         base_compile="$base_compile $lastarg"
-         continue
-         ;;
-
-       *)
-         # Accept the current argument as the source file.
-         # The previous "srcfile" becomes the current argument.
-         #
-         lastarg="$srcfile"
-         srcfile="$arg"
-         ;;
-       esac  #  case $arg
-       ;;
-      esac    #  case $arg_mode
-
-      # Aesthetically quote the previous argument.
-      func_quote_for_eval "$lastarg"
-      base_compile="$base_compile $func_quote_for_eval_result"
-    done # for arg
-
-    case $arg_mode in
-    arg)
-      func_fatal_error "you must specify an argument for -Xcompile"
-      ;;
-    target)
-      func_fatal_error "you must specify a target with \`-o'"
-      ;;
-    *)
-      # Get the name of the library object.
-      test -z "$libobj" && {
-       func_basename "$srcfile"
-       libobj="$func_basename_result"
-      }
-      ;;
-    esac
-
-    # Recognize several different file suffixes.
-    # If the user specifies -o file.o, it is replaced with file.lo
-    case $libobj in
-    *.[cCFSifmso] | \
-    *.ada | *.adb | *.ads | *.asm | \
-    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
-    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
-      func_xform "$libobj"
-      libobj=$func_xform_result
-      ;;
-    esac
-
-    case $libobj in
-    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
-    *)
-      func_fatal_error "cannot determine name of library object from \`$libobj'"
-      ;;
-    esac
-
-    func_infer_tag $base_compile
-
-    for arg in $later; do
-      case $arg in
-      -shared)
-       test "$build_libtool_libs" != yes && \
-         func_fatal_configuration "can not build a shared library"
-       build_old_libs=no
-       continue
-       ;;
-
-      -static)
-       build_libtool_libs=no
-       build_old_libs=yes
-       continue
-       ;;
-
-      -prefer-pic)
-       pic_mode=yes
-       continue
-       ;;
-
-      -prefer-non-pic)
-       pic_mode=no
-       continue
-       ;;
-      esac
-    done
-
-    func_quote_for_eval "$libobj"
-    test "X$libobj" != "X$func_quote_for_eval_result" \
-      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'   &()|`$[]' \
-      && func_warning "libobj name \`$libobj' may not contain shell special characters."
-    func_dirname_and_basename "$obj" "/" ""
-    objname="$func_basename_result"
-    xdir="$func_dirname_result"
-    lobj=${xdir}$objdir/$objname
-
-    test -z "$base_compile" && \
-      func_fatal_help "you must specify a compilation command"
-
-    # Delete any leftover library objects.
-    if test "$build_old_libs" = yes; then
-      removelist="$obj $lobj $libobj ${libobj}T"
-    else
-      removelist="$lobj $libobj ${libobj}T"
-    fi
-
-    # On Cygwin there's no "real" PIC flag so we must build both object types
-    case $host_os in
-    cygwin* | mingw* | pw32* | os2* | cegcc*)
-      pic_mode=default
-      ;;
-    esac
-    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
-      # non-PIC code in shared libraries is not supported
-      pic_mode=default
-    fi
-
-    # Calculate the filename of the output object if compiler does
-    # not support -o with -c
-    if test "$compiler_c_o" = no; then
-      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
-      lockfile="$output_obj.lock"
-    else
-      output_obj=
-      need_locks=no
-      lockfile=
-    fi
-
-    # Lock this critical section if it is needed
-    # We use this script file to make the link, it avoids creating a new file
-    if test "$need_locks" = yes; then
-      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
-       func_echo "Waiting for $lockfile to be removed"
-       sleep 2
-      done
-    elif test "$need_locks" = warn; then
-      if test -f "$lockfile"; then
-       $ECHO "\
-*** ERROR, $lockfile exists and contains:
-`cat $lockfile 2>/dev/null`
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-       $opt_dry_run || $RM $removelist
-       exit $EXIT_FAILURE
-      fi
-      removelist="$removelist $output_obj"
-      $ECHO "$srcfile" > "$lockfile"
-    fi
-
-    $opt_dry_run || $RM $removelist
-    removelist="$removelist $lockfile"
-    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
-
-    if test -n "$fix_srcfile_path"; then
-      eval srcfile=\"$fix_srcfile_path\"
-    fi
-    func_quote_for_eval "$srcfile"
-    qsrcfile=$func_quote_for_eval_result
-
-    # Only build a PIC object if we are building libtool libraries.
-    if test "$build_libtool_libs" = yes; then
-      # Without this assignment, base_compile gets emptied.
-      fbsd_hideous_sh_bug=$base_compile
-
-      if test "$pic_mode" != no; then
-       command="$base_compile $qsrcfile $pic_flag"
-      else
-       # Don't build PIC code
-       command="$base_compile $qsrcfile"
-      fi
-
-      func_mkdir_p "$xdir$objdir"
-
-      if test -z "$output_obj"; then
-       # Place PIC objects in $objdir
-       command="$command -o $lobj"
-      fi
-
-      func_show_eval_locale "$command" \
-          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
-
-      if test "$need_locks" = warn &&
-        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
-       $ECHO "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-       $opt_dry_run || $RM $removelist
-       exit $EXIT_FAILURE
-      fi
-
-      # Just move the object if needed, then go on to compile the next one
-      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
-       func_show_eval '$MV "$output_obj" "$lobj"' \
-         'error=$?; $opt_dry_run || $RM $removelist; exit $error'
-      fi
-
-      # Allow error messages only from the first compilation.
-      if test "$suppress_opt" = yes; then
-       suppress_output=' >/dev/null 2>&1'
-      fi
-    fi
-
-    # Only build a position-dependent object if we build old libraries.
-    if test "$build_old_libs" = yes; then
-      if test "$pic_mode" != yes; then
-       # Don't build PIC code
-       command="$base_compile $qsrcfile$pie_flag"
-      else
-       command="$base_compile $qsrcfile $pic_flag"
-      fi
-      if test "$compiler_c_o" = yes; then
-       command="$command -o $obj"
-      fi
-
-      # Suppress compiler output if we already did a PIC compilation.
-      command="$command$suppress_output"
-      func_show_eval_locale "$command" \
-        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
-
-      if test "$need_locks" = warn &&
-        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
-       $ECHO "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-       $opt_dry_run || $RM $removelist
-       exit $EXIT_FAILURE
-      fi
-
-      # Just move the object if needed
-      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
-       func_show_eval '$MV "$output_obj" "$obj"' \
-         'error=$?; $opt_dry_run || $RM $removelist; exit $error'
-      fi
-    fi
-
-    $opt_dry_run || {
-      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
-
-      # Unlock the critical section if it was locked
-      if test "$need_locks" != no; then
-       removelist=$lockfile
-        $RM "$lockfile"
-      fi
-    }
-
-    exit $EXIT_SUCCESS
-}
-
-$opt_help || {
-test "$mode" = compile && func_mode_compile ${1+"$@"}
-}
-
-func_mode_help ()
-{
-    # We need to display help for each of the modes.
-    case $mode in
-      "")
-        # Generic help is extracted from the usage comments
-        # at the start of this file.
-        func_help
-        ;;
-
-      clean)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
-
-Remove files from the build directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, object or program, all the files associated
-with it are deleted. Otherwise, only FILE itself is deleted using RM."
-        ;;
-
-      compile)
-      $ECHO \
-"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-This mode accepts the following additional options:
-
-  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
-  -no-suppress      do not suppress compiler output for multiple passes
-  -prefer-pic       try to building PIC objects only
-  -prefer-non-pic   try to building non-PIC objects only
-  -shared           do not build a \`.o' file suitable for static linking
-  -static           only build a \`.o' file suitable for static linking
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
-        ;;
-
-      execute)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
-  -dlopen FILE      add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments."
-        ;;
-
-      finish)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges.  Use
-the \`--dry-run' option if you just want to see what would be executed."
-        ;;
-
-      install)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command.  The first component should be
-either the \`install' or \`cp' program.
-
-The following components of INSTALL-COMMAND are treated specially:
-
-  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized)."
-        ;;
-
-      link)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
-  -all-static       do not do any dynamic linking at all
-  -avoid-version    do not add a version suffix if possible
-  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
-  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
-  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
-  -export-symbols SYMFILE
-                    try to export only the symbols listed in SYMFILE
-  -export-symbols-regex REGEX
-                    try to export only the symbols matching REGEX
-  -LLIBDIR          search LIBDIR for required installed libraries
-  -lNAME            OUTPUT-FILE requires the installed library libNAME
-  -module           build a library that can dlopened
-  -no-fast-install  disable the fast-install mode
-  -no-install       link a not-installable executable
-  -no-undefined     declare that a library does not refer to external symbols
-  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
-  -objectlist FILE  Use a list of object files found in FILE to specify objects
-  -precious-files-regex REGEX
-                    don't remove output files matching REGEX
-  -release RELEASE  specify package release information
-  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
-  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
-  -shared           only do dynamic linking of libtool libraries
-  -shrext SUFFIX    override the standard shared library file extension
-  -static           do not do any dynamic linking of uninstalled libtool libraries
-  -static-libtool-libs
-                    do not do any dynamic linking of libtool libraries
-  -version-info CURRENT[:REVISION[:AGE]]
-                    specify library version info [each variable defaults to 0]
-  -weak LIBNAME     declare that the target provides the LIBNAME interface
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename.  Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
-required, except when creating a convenience library.
-
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
-is created, otherwise an executable program is created."
-        ;;
-
-      uninstall)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM."
-        ;;
-
-      *)
-        func_fatal_help "invalid operation mode \`$mode'"
-        ;;
-    esac
-
-    $ECHO
-    $ECHO "Try \`$progname --help' for more information about other modes."
-
-    exit $?
-}
-
-  # Now that we've collected a possible --mode arg, show help if necessary
-  $opt_help && func_mode_help
-
-
-# func_mode_execute arg...
-func_mode_execute ()
-{
-    $opt_debug
-    # The first argument is the command name.
-    cmd="$nonopt"
-    test -z "$cmd" && \
-      func_fatal_help "you must specify a COMMAND"
-
-    # Handle -dlopen flags immediately.
-    for file in $execute_dlfiles; do
-      test -f "$file" \
-       || func_fatal_help "\`$file' is not a file"
-
-      dir=
-      case $file in
-      *.la)
-       # Check to see that this really is a libtool archive.
-       func_lalib_unsafe_p "$file" \
-         || func_fatal_help "\`$lib' is not a valid libtool archive"
-
-       # Read the libtool library.
-       dlname=
-       library_names=
-       func_source "$file"
-
-       # Skip this library if it cannot be dlopened.
-       if test -z "$dlname"; then
-         # Warn if it was a shared library.
-         test -n "$library_names" && \
-           func_warning "\`$file' was not linked with \`-export-dynamic'"
-         continue
-       fi
-
-       func_dirname "$file" "" "."
-       dir="$func_dirname_result"
-
-       if test -f "$dir/$objdir/$dlname"; then
-         dir="$dir/$objdir"
-       else
-         if test ! -f "$dir/$dlname"; then
-           func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
-         fi
-       fi
-       ;;
-
-      *.lo)
-       # Just add the directory containing the .lo file.
-       func_dirname "$file" "" "."
-       dir="$func_dirname_result"
-       ;;
-
-      *)
-       func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
-       continue
-       ;;
-      esac
-
-      # Get the absolute pathname.
-      absdir=`cd "$dir" && pwd`
-      test -n "$absdir" && dir="$absdir"
-
-      # Now add the directory to shlibpath_var.
-      if eval "test -z \"\$$shlibpath_var\""; then
-       eval "$shlibpath_var=\"\$dir\""
-      else
-       eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
-      fi
-    done
-
-    # This variable tells wrapper scripts just to set shlibpath_var
-    # rather than running their programs.
-    libtool_execute_magic="$magic"
-
-    # Check if any of the arguments is a wrapper script.
-    args=
-    for file
-    do
-      case $file in
-      -*) ;;
-      *)
-       # Do a test to see if this is really a libtool program.
-       if func_ltwrapper_script_p "$file"; then
-         func_source "$file"
-         # Transform arg to wrapped name.
-         file="$progdir/$program"
-       elif func_ltwrapper_executable_p "$file"; then
-         func_ltwrapper_scriptname "$file"
-         func_source "$func_ltwrapper_scriptname_result"
-         # Transform arg to wrapped name.
-         file="$progdir/$program"
-       fi
-       ;;
-      esac
-      # Quote arguments (to preserve shell metacharacters).
-      func_quote_for_eval "$file"
-      args="$args $func_quote_for_eval_result"
-    done
-
-    if test "X$opt_dry_run" = Xfalse; then
-      if test -n "$shlibpath_var"; then
-       # Export the shlibpath_var.
-       eval "export $shlibpath_var"
-      fi
-
-      # Restore saved environment variables
-      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
-      do
-       eval "if test \"\${save_$lt_var+set}\" = set; then
-                $lt_var=\$save_$lt_var; export $lt_var
-             else
-               $lt_unset $lt_var
-             fi"
-      done
-
-      # Now prepare to actually exec the command.
-      exec_cmd="\$cmd$args"
-    else
-      # Display what would be done.
-      if test -n "$shlibpath_var"; then
-       eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
-       $ECHO "export $shlibpath_var"
-      fi
-      $ECHO "$cmd$args"
-      exit $EXIT_SUCCESS
-    fi
-}
-
-test "$mode" = execute && func_mode_execute ${1+"$@"}
-
-
-# func_mode_finish arg...
-func_mode_finish ()
-{
-    $opt_debug
-    libdirs="$nonopt"
-    admincmds=
-
-    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
-      for dir
-      do
-       libdirs="$libdirs $dir"
-      done
-
-      for libdir in $libdirs; do
-       if test -n "$finish_cmds"; then
-         # Do each command in the finish commands.
-         func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
-'"$cmd"'"'
-       fi
-       if test -n "$finish_eval"; then
-         # Do the single finish_eval.
-         eval cmds=\"$finish_eval\"
-         $opt_dry_run || eval "$cmds" || admincmds="$admincmds
-       $cmds"
-       fi
-      done
-    fi
-
-    # Exit here if they wanted silent mode.
-    $opt_silent && exit $EXIT_SUCCESS
-
-    $ECHO "X----------------------------------------------------------------------" | $Xsed
-    $ECHO "Libraries have been installed in:"
-    for libdir in $libdirs; do
-      $ECHO "   $libdir"
-    done
-    $ECHO
-    $ECHO "If you ever happen to want to link against installed libraries"
-    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
-    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
-    $ECHO "flag during linking and do at least one of the following:"
-    if test -n "$shlibpath_var"; then
-      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
-      $ECHO "     during execution"
-    fi
-    if test -n "$runpath_var"; then
-      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
-      $ECHO "     during linking"
-    fi
-    if test -n "$hardcode_libdir_flag_spec"; then
-      libdir=LIBDIR
-      eval flag=\"$hardcode_libdir_flag_spec\"
-
-      $ECHO "   - use the \`$flag' linker flag"
-    fi
-    if test -n "$admincmds"; then
-      $ECHO "   - have your system administrator run these commands:$admincmds"
-    fi
-    if test -f /etc/ld.so.conf; then
-      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
-    fi
-    $ECHO
-
-    $ECHO "See any operating system documentation about shared libraries for"
-    case $host in
-      solaris2.[6789]|solaris2.1[0-9])
-        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
-       $ECHO "pages."
-       ;;
-      *)
-        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
-        ;;
-    esac
-    $ECHO "X----------------------------------------------------------------------" | $Xsed
-    exit $EXIT_SUCCESS
-}
-
-test "$mode" = finish && func_mode_finish ${1+"$@"}
-
-
-# func_mode_install arg...
-func_mode_install ()
-{
-    $opt_debug
-    # There may be an optional sh(1) argument at the beginning of
-    # install_prog (especially on Windows NT).
-    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
-       # Allow the use of GNU shtool's install command.
-       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
-      # Aesthetically quote it.
-      func_quote_for_eval "$nonopt"
-      install_prog="$func_quote_for_eval_result "
-      arg=$1
-      shift
-    else
-      install_prog=
-      arg=$nonopt
-    fi
-
-    # The real first argument should be the name of the installation program.
-    # Aesthetically quote it.
-    func_quote_for_eval "$arg"
-    install_prog="$install_prog$func_quote_for_eval_result"
-
-    # We need to accept at least all the BSD install flags.
-    dest=
-    files=
-    opts=
-    prev=
-    install_type=
-    isdir=no
-    stripme=
-    for arg
-    do
-      if test -n "$dest"; then
-       files="$files $dest"
-       dest=$arg
-       continue
-      fi
-
-      case $arg in
-      -d) isdir=yes ;;
-      -f)
-       case " $install_prog " in
-       *[\\\ /]cp\ *) ;;
-       *) prev=$arg ;;
-       esac
-       ;;
-      -g | -m | -o)
-       prev=$arg
-       ;;
-      -s)
-       stripme=" -s"
-       continue
-       ;;
-      -*)
-       ;;
-      *)
-       # If the previous option needed an argument, then skip it.
-       if test -n "$prev"; then
-         prev=
-       else
-         dest=$arg
-         continue
-       fi
-       ;;
-      esac
-
-      # Aesthetically quote the argument.
-      func_quote_for_eval "$arg"
-      install_prog="$install_prog $func_quote_for_eval_result"
-    done
-
-    test -z "$install_prog" && \
-      func_fatal_help "you must specify an install program"
-
-    test -n "$prev" && \
-      func_fatal_help "the \`$prev' option requires an argument"
-
-    if test -z "$files"; then
-      if test -z "$dest"; then
-       func_fatal_help "no file or destination specified"
-      else
-       func_fatal_help "you must specify a destination"
-      fi
-    fi
-
-    # Strip any trailing slash from the destination.
-    func_stripname '' '/' "$dest"
-    dest=$func_stripname_result
-
-    # Check to see that the destination is a directory.
-    test -d "$dest" && isdir=yes
-    if test "$isdir" = yes; then
-      destdir="$dest"
-      destname=
-    else
-      func_dirname_and_basename "$dest" "" "."
-      destdir="$func_dirname_result"
-      destname="$func_basename_result"
-
-      # Not a directory, so check to see that there is only one file specified.
-      set dummy $files; shift
-      test "$#" -gt 1 && \
-       func_fatal_help "\`$dest' is not a directory"
-    fi
-    case $destdir in
-    [\\/]* | [A-Za-z]:[\\/]*) ;;
-    *)
-      for file in $files; do
-       case $file in
-       *.lo) ;;
-       *)
-         func_fatal_help "\`$destdir' must be an absolute directory name"
-         ;;
-       esac
-      done
-      ;;
-    esac
-
-    # This variable tells wrapper scripts just to set variables rather
-    # than running their programs.
-    libtool_install_magic="$magic"
-
-    staticlibs=
-    future_libdirs=
-    current_libdirs=
-    for file in $files; do
-
-      # Do each installation.
-      case $file in
-      *.$libext)
-       # Do the static libraries later.
-       staticlibs="$staticlibs $file"
-       ;;
-
-      *.la)
-       # Check to see that this really is a libtool archive.
-       func_lalib_unsafe_p "$file" \
-         || func_fatal_help "\`$file' is not a valid libtool archive"
-
-       library_names=
-       old_library=
-       relink_command=
-       func_source "$file"
-
-       # Add the libdir to current_libdirs if it is the destination.
-       if test "X$destdir" = "X$libdir"; then
-         case "$current_libdirs " in
-         *" $libdir "*) ;;
-         *) current_libdirs="$current_libdirs $libdir" ;;
-         esac
-       else
-         # Note the libdir as a future libdir.
-         case "$future_libdirs " in
-         *" $libdir "*) ;;
-         *) future_libdirs="$future_libdirs $libdir" ;;
-         esac
-       fi
-
-       func_dirname "$file" "/" ""
-       dir="$func_dirname_result"
-       dir="$dir$objdir"
-
-       if test -n "$relink_command"; then
-         # Determine the prefix the user has applied to our future dir.
-         inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
-
-         # Don't allow the user to place us outside of our expected
-         # location b/c this prevents finding dependent libraries that
-         # are installed to the same prefix.
-         # At present, this check doesn't affect windows .dll's that
-         # are installed into $libdir/../bin (currently, that works fine)
-         # but it's something to keep an eye on.
-         test "$inst_prefix_dir" = "$destdir" && \
-           func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
-
-         if test -n "$inst_prefix_dir"; then
-           # Stick the inst_prefix_dir data into the link command.
-           relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
-         else
-           relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
-         fi
-
-         func_warning "relinking \`$file'"
-         func_show_eval "$relink_command" \
-           'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
-       fi
-
-       # See the names of the shared library.
-       set dummy $library_names; shift
-       if test -n "$1"; then
-         realname="$1"
-         shift
-
-         srcname="$realname"
-         test -n "$relink_command" && srcname="$realname"T
-
-         # Install the shared library and build the symlinks.
-         func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
-             'exit $?'
-         tstripme="$stripme"
-         case $host_os in
-         cygwin* | mingw* | pw32* | cegcc*)
-           case $realname in
-           *.dll.a)
-             tstripme=""
-             ;;
-           esac
-           ;;
-         esac
-         if test -n "$tstripme" && test -n "$striplib"; then
-           func_show_eval "$striplib $destdir/$realname" 'exit $?'
-         fi
-
-         if test "$#" -gt 0; then
-           # Delete the old symlinks, and create new ones.
-           # Try `ln -sf' first, because the `ln' binary might depend on
-           # the symlink we replace!  Solaris /bin/ln does not understand -f,
-           # so we also need to try rm && ln -s.
-           for linkname
-           do
-             test "$linkname" != "$realname" \
-               && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
-           done
-         fi
-
-         # Do each command in the postinstall commands.
-         lib="$destdir/$realname"
-         func_execute_cmds "$postinstall_cmds" 'exit $?'
-       fi
-
-       # Install the pseudo-library for information purposes.
-       func_basename "$file"
-       name="$func_basename_result"
-       instname="$dir/$name"i
-       func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
-
-       # Maybe install the static library, too.
-       test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
-       ;;
-
-      *.lo)
-       # Install (i.e. copy) a libtool object.
-
-       # Figure out destination file name, if it wasn't already specified.
-       if test -n "$destname"; then
-         destfile="$destdir/$destname"
-       else
-         func_basename "$file"
-         destfile="$func_basename_result"
-         destfile="$destdir/$destfile"
-       fi
-
-       # Deduce the name of the destination old-style object file.
-       case $destfile in
-       *.lo)
-         func_lo2o "$destfile"
-         staticdest=$func_lo2o_result
-         ;;
-       *.$objext)
-         staticdest="$destfile"
-         destfile=
-         ;;
-       *)
-         func_fatal_help "cannot copy a libtool object to \`$destfile'"
-         ;;
-       esac
-
-       # Install the libtool object if requested.
-       test -n "$destfile" && \
-         func_show_eval "$install_prog $file $destfile" 'exit $?'
-
-       # Install the old object if enabled.
-       if test "$build_old_libs" = yes; then
-         # Deduce the name of the old-style object file.
-         func_lo2o "$file"
-         staticobj=$func_lo2o_result
-         func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
-       fi
-       exit $EXIT_SUCCESS
-       ;;
-
-      *)
-       # Figure out destination file name, if it wasn't already specified.
-       if test -n "$destname"; then
-         destfile="$destdir/$destname"
-       else
-         func_basename "$file"
-         destfile="$func_basename_result"
-         destfile="$destdir/$destfile"
-       fi
-
-       # If the file is missing, and there is a .exe on the end, strip it
-       # because it is most likely a libtool script we actually want to
-       # install
-       stripped_ext=""
-       case $file in
-         *.exe)
-           if test ! -f "$file"; then
-             func_stripname '' '.exe' "$file"
-             file=$func_stripname_result
-             stripped_ext=".exe"
-           fi
-           ;;
-       esac
-
-       # Do a test to see if this is really a libtool program.
-       case $host in
-       *cygwin* | *mingw*)
-           if func_ltwrapper_executable_p "$file"; then
-             func_ltwrapper_scriptname "$file"
-             wrapper=$func_ltwrapper_scriptname_result
-           else
-             func_stripname '' '.exe' "$file"
-             wrapper=$func_stripname_result
-           fi
-           ;;
-       *)
-           wrapper=$file
-           ;;
-       esac
-       if func_ltwrapper_script_p "$wrapper"; then
-         notinst_deplibs=
-         relink_command=
-
-         func_source "$wrapper"
-
-         # Check the variables that should have been set.
-         test -z "$generated_by_libtool_version" && \
-           func_fatal_error "invalid libtool wrapper script \`$wrapper'"
-
-         finalize=yes
-         for lib in $notinst_deplibs; do
-           # Check to see that each library is installed.
-           libdir=
-           if test -f "$lib"; then
-             func_source "$lib"
-           fi
-           libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
-           if test -n "$libdir" && test ! -f "$libfile"; then
-             func_warning "\`$lib' has not been installed in \`$libdir'"
-             finalize=no
-           fi
-         done
-
-         relink_command=
-         func_source "$wrapper"
-
-         outputname=
-         if test "$fast_install" = no && test -n "$relink_command"; then
-           $opt_dry_run || {
-             if test "$finalize" = yes; then
-               tmpdir=`func_mktempdir`
-               func_basename "$file$stripped_ext"
-               file="$func_basename_result"
-               outputname="$tmpdir/$file"
-               # Replace the output file specification.
-               relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
-
-               $opt_silent || {
-                 func_quote_for_expand "$relink_command"
-                 eval "func_echo $func_quote_for_expand_result"
-               }
-               if eval "$relink_command"; then :
-                 else
-                 func_error "error: relink \`$file' with the above command before installing it"
-                 $opt_dry_run || ${RM}r "$tmpdir"
-                 continue
-               fi
-               file="$outputname"
-             else
-               func_warning "cannot relink \`$file'"
-             fi
-           }
-         else
-           # Install the binary that we compiled earlier.
-           file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
-         fi
-       fi
-
-       # remove .exe since cygwin /usr/bin/install will append another
-       # one anyway
-       case $install_prog,$host in
-       */usr/bin/install*,*cygwin*)
-         case $file:$destfile in
-         *.exe:*.exe)
-           # this is ok
-           ;;
-         *.exe:*)
-           destfile=$destfile.exe
-           ;;
-         *:*.exe)
-           func_stripname '' '.exe' "$destfile"
-           destfile=$func_stripname_result
-           ;;
-         esac
-         ;;
-       esac
-       func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
-       $opt_dry_run || if test -n "$outputname"; then
-         ${RM}r "$tmpdir"
-       fi
-       ;;
-      esac
-    done
-
-    for file in $staticlibs; do
-      func_basename "$file"
-      name="$func_basename_result"
-
-      # Set up the ranlib parameters.
-      oldlib="$destdir/$name"
-
-      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
-
-      if test -n "$stripme" && test -n "$old_striplib"; then
-       func_show_eval "$old_striplib $oldlib" 'exit $?'
-      fi
-
-      # Do each command in the postinstall commands.
-      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
-    done
-
-    test -n "$future_libdirs" && \
-      func_warning "remember to run \`$progname --finish$future_libdirs'"
-
-    if test -n "$current_libdirs"; then
-      # Maybe just do a dry run.
-      $opt_dry_run && current_libdirs=" -n$current_libdirs"
-      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
-    else
-      exit $EXIT_SUCCESS
-    fi
-}
-
-test "$mode" = install && func_mode_install ${1+"$@"}
-
-
-# func_generate_dlsyms outputname originator pic_p
-# Extract symbols from dlprefiles and create ${outputname}S.o with
-# a dlpreopen symbol table.
-func_generate_dlsyms ()
-{
-    $opt_debug
-    my_outputname="$1"
-    my_originator="$2"
-    my_pic_p="${3-no}"
-    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
-    my_dlsyms=
-
-    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-      if test -n "$NM" && test -n "$global_symbol_pipe"; then
-       my_dlsyms="${my_outputname}S.c"
-      else
-       func_error "not configured to extract global symbols from dlpreopened files"
-      fi
-    fi
-
-    if test -n "$my_dlsyms"; then
-      case $my_dlsyms in
-      "") ;;
-      *.c)
-       # Discover the nlist of each of the dlfiles.
-       nlist="$output_objdir/${my_outputname}.nm"
-
-       func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
-
-       # Parse the name list into a source file.
-       func_verbose "creating $output_objdir/$my_dlsyms"
-
-       $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
-/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
-/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
-
-#ifdef __cplusplus
-extern \"C\" {
-#endif
-
-/* External symbol declarations for the compiler. */\
-"
-
-       if test "$dlself" = yes; then
-         func_verbose "generating symbol list for \`$output'"
-
-         $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
-
-         # Add our own program objects to the symbol list.
-         progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-         for progfile in $progfiles; do
-           func_verbose "extracting global C symbols from \`$progfile'"
-           $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
-         done
-
-         if test -n "$exclude_expsyms"; then
-           $opt_dry_run || {
-             eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
-             eval '$MV "$nlist"T "$nlist"'
-           }
-         fi
-
-         if test -n "$export_symbols_regex"; then
-           $opt_dry_run || {
-             eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
-             eval '$MV "$nlist"T "$nlist"'
-           }
-         fi
-
-         # Prepare the list of exported symbols
-         if test -z "$export_symbols"; then
-           export_symbols="$output_objdir/$outputname.exp"
-           $opt_dry_run || {
-             $RM $export_symbols
-             eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
-             case $host in
-             *cygwin* | *mingw* | *cegcc* )
-                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
-                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
-               ;;
-             esac
-           }
-         else
-           $opt_dry_run || {
-             eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
-             eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
-             eval '$MV "$nlist"T "$nlist"'
-             case $host in
-               *cygwin | *mingw* | *cegcc* )
-                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
-                 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
-                 ;;
-             esac
-           }
-         fi
-       fi
-
-       for dlprefile in $dlprefiles; do
-         func_verbose "extracting global C symbols from \`$dlprefile'"
-         func_basename "$dlprefile"
-         name="$func_basename_result"
-         $opt_dry_run || {
-           eval '$ECHO ": $name " >> "$nlist"'
-           eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
-         }
-       done
-
-       $opt_dry_run || {
-         # Make sure we have at least an empty file.
-         test -f "$nlist" || : > "$nlist"
-
-         if test -n "$exclude_expsyms"; then
-           $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
-           $MV "$nlist"T "$nlist"
-         fi
-
-         # Try sorting and uniquifying the output.
-         if $GREP -v "^: " < "$nlist" |
-             if sort -k 3 </dev/null >/dev/null 2>&1; then
-               sort -k 3
-             else
-               sort +2
-             fi |
-             uniq > "$nlist"S; then
-           :
-         else
-           $GREP -v "^: " < "$nlist" > "$nlist"S
-         fi
-
-         if test -f "$nlist"S; then
-           eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
-         else
-           $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
-         fi
-
-         $ECHO >> "$output_objdir/$my_dlsyms" "\
-
-/* The mapping between symbol names and symbols.  */
-typedef struct {
-  const char *name;
-  void *address;
-} lt_dlsymlist;
-"
-         case $host in
-         *cygwin* | *mingw* | *cegcc* )
-           $ECHO >> "$output_objdir/$my_dlsyms" "\
-/* DATA imports from DLLs on WIN32 con't be const, because
-   runtime relocations are performed -- see ld's documentation
-   on pseudo-relocs.  */"
-           lt_dlsym_const= ;;
-         *osf5*)
-           echo >> "$output_objdir/$my_dlsyms" "\
-/* This system does not cope well with relocations in const data */"
-           lt_dlsym_const= ;;
-         *)
-           lt_dlsym_const=const ;;
-         esac
-
-         $ECHO >> "$output_objdir/$my_dlsyms" "\
-extern $lt_dlsym_const lt_dlsymlist
-lt_${my_prefix}_LTX_preloaded_symbols[];
-$lt_dlsym_const lt_dlsymlist
-lt_${my_prefix}_LTX_preloaded_symbols[] =
-{\
-  { \"$my_originator\", (void *) 0 },"
-
-         case $need_lib_prefix in
-         no)
-           eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
-           ;;
-         *)
-           eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
-           ;;
-         esac
-         $ECHO >> "$output_objdir/$my_dlsyms" "\
-  {0, (void *) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
-  return lt_${my_prefix}_LTX_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif\
-"
-       } # !$opt_dry_run
-
-       pic_flag_for_symtable=
-       case "$compile_command " in
-       *" -static "*) ;;
-       *)
-         case $host in
-         # compiling the symbol table file with pic_flag works around
-         # a FreeBSD bug that causes programs to crash when -lm is
-         # linked before any other PIC object.  But we must not use
-         # pic_flag when linking with -static.  The problem exists in
-         # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
-         *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
-           pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
-         *-*-hpux*)
-           pic_flag_for_symtable=" $pic_flag"  ;;
-         *)
-           if test "X$my_pic_p" != Xno; then
-             pic_flag_for_symtable=" $pic_flag"
-           fi
-           ;;
-         esac
-         ;;
-       esac
-       symtab_cflags=
-       for arg in $LTCFLAGS; do
-         case $arg in
-         -pie | -fpie | -fPIE) ;;
-         *) symtab_cflags="$symtab_cflags $arg" ;;
-         esac
-       done
-
-       # Now compile the dynamic symbol file.
-       func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
-
-       # Clean up the generated files.
-       func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
-
-       # Transform the symbol file into the correct name.
-       symfileobj="$output_objdir/${my_outputname}S.$objext"
-       case $host in
-       *cygwin* | *mingw* | *cegcc* )
-         if test -f "$output_objdir/$my_outputname.def"; then
-           compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
-           finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
-         else
-           compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-           finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-         fi
-         ;;
-       *)
-         compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-         finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-         ;;
-       esac
-       ;;
-      *)
-       func_fatal_error "unknown suffix for \`$my_dlsyms'"
-       ;;
-      esac
-    else
-      # We keep going just in case the user didn't refer to
-      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
-      # really was required.
-
-      # Nullify the symbol file.
-      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
-      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
-    fi
-}
-
-# func_win32_libid arg
-# return the library type of file 'arg'
-#
-# Need a lot of goo to handle *both* DLLs and import libs
-# Has to be a shell function in order to 'eat' the argument
-# that is supplied when $file_magic_command is called.
-func_win32_libid ()
-{
-  $opt_debug
-  win32_libid_type="unknown"
-  win32_fileres=`file -L $1 2>/dev/null`
-  case $win32_fileres in
-  *ar\ archive\ import\ library*) # definitely import
-    win32_libid_type="x86 archive import"
-    ;;
-  *ar\ archive*) # could be an import, or static
-    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
-       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
-      win32_nmres=`eval $NM -f posix -A $1 |
-       $SED -n -e '
-           1,100{
-               / I /{
-                   s,.*,import,
-                   p
-                   q
-               }
-           }'`
-      case $win32_nmres in
-      import*)  win32_libid_type="x86 archive import";;
-      *)        win32_libid_type="x86 archive static";;
-      esac
-    fi
-    ;;
-  *DLL*)
-    win32_libid_type="x86 DLL"
-    ;;
-  *executable*) # but shell scripts are "executable" too...
-    case $win32_fileres in
-    *MS\ Windows\ PE\ Intel*)
-      win32_libid_type="x86 DLL"
-      ;;
-    esac
-    ;;
-  esac
-  $ECHO "$win32_libid_type"
-}
-
-
-
-# func_extract_an_archive dir oldlib
-func_extract_an_archive ()
-{
-    $opt_debug
-    f_ex_an_ar_dir="$1"; shift
-    f_ex_an_ar_oldlib="$1"
-    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
-    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
-     :
-    else
-      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
-    fi
-}
-
-
-# func_extract_archives gentop oldlib ...
-func_extract_archives ()
-{
-    $opt_debug
-    my_gentop="$1"; shift
-    my_oldlibs=${1+"$@"}
-    my_oldobjs=""
-    my_xlib=""
-    my_xabs=""
-    my_xdir=""
-
-    for my_xlib in $my_oldlibs; do
-      # Extract the objects.
-      case $my_xlib in
-       [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
-       *) my_xabs=`pwd`"/$my_xlib" ;;
-      esac
-      func_basename "$my_xlib"
-      my_xlib="$func_basename_result"
-      my_xlib_u=$my_xlib
-      while :; do
-        case " $extracted_archives " in
-       *" $my_xlib_u "*)
-         func_arith $extracted_serial + 1
-         extracted_serial=$func_arith_result
-         my_xlib_u=lt$extracted_serial-$my_xlib ;;
-       *) break ;;
-       esac
-      done
-      extracted_archives="$extracted_archives $my_xlib_u"
-      my_xdir="$my_gentop/$my_xlib_u"
-
-      func_mkdir_p "$my_xdir"
-
-      case $host in
-      *-darwin*)
-       func_verbose "Extracting $my_xabs"
-       # Do not bother doing anything if just a dry run
-       $opt_dry_run || {
-         darwin_orig_dir=`pwd`
-         cd $my_xdir || exit $?
-         darwin_archive=$my_xabs
-         darwin_curdir=`pwd`
-         darwin_base_archive=`basename "$darwin_archive"`
-         darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
-         if test -n "$darwin_arches"; then
-           darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
-           darwin_arch=
-           func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
-           for darwin_arch in  $darwin_arches ; do
-             func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-             $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
-             cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-             func_extract_an_archive "`pwd`" "${darwin_base_archive}"
-             cd "$darwin_curdir"
-             $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
-           done # $darwin_arches
-            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
-           darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
-           darwin_file=
-           darwin_files=
-           for darwin_file in $darwin_filelist; do
-             darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
-             $LIPO -create -output "$darwin_file" $darwin_files
-           done # $darwin_filelist
-           $RM -rf unfat-$$
-           cd "$darwin_orig_dir"
-         else
-           cd $darwin_orig_dir
-           func_extract_an_archive "$my_xdir" "$my_xabs"
-         fi # $darwin_arches
-       } # !$opt_dry_run
-       ;;
-      *)
-        func_extract_an_archive "$my_xdir" "$my_xabs"
-       ;;
-      esac
-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
-    done
-
-    func_extract_archives_result="$my_oldobjs"
-}
-
-
-
-# func_emit_wrapper_part1 [arg=no]
-#
-# Emit the first part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part1 ()
-{
-       func_emit_wrapper_part1_arg1=no
-       if test -n "$1" ; then
-         func_emit_wrapper_part1_arg1=$1
-       fi
-
-       $ECHO "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='${SED} -e 1s/^X//'
-sed_quote_subst='$sed_quote_subst'
-
-# Be Bourne compatible
-if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '\${1+\"\$@\"}'='\"\$@\"'
-  setopt NO_GLOB_SUBST
-else
-  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
-  # install mode needs the following variables:
-  generated_by_libtool_version='$macro_version'
-  notinst_deplibs='$notinst_deplibs'
-else
-  # When we are sourced in execute mode, \$file and \$ECHO are already set.
-  if test \"\$libtool_execute_magic\" != \"$magic\"; then
-    ECHO=\"$qecho\"
-    file=\"\$0\"
-    # Make sure echo works.
-    if test \"X\$1\" = X--no-reexec; then
-      # Discard the --no-reexec flag, and continue.
-      shift
-    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
-      # Yippee, \$ECHO works!
-      :
-    else
-      # Restart under the correct shell, and then maybe \$ECHO will work.
-      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
-    fi
-  fi\
-"
-       $ECHO "\
-
-  # Find the directory that this script lives in.
-  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
-  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
-  # Follow symbolic links until we get to the real thisdir.
-  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
-  while test -n \"\$file\"; do
-    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
-
-    # If there was a directory component, then change thisdir.
-    if test \"x\$destdir\" != \"x\$file\"; then
-      case \"\$destdir\" in
-      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
-      *) thisdir=\"\$thisdir/\$destdir\" ;;
-      esac
-    fi
-
-    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
-    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
-  done
-"
-}
-# end: func_emit_wrapper_part1
-
-# func_emit_wrapper_part2 [arg=no]
-#
-# Emit the second part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part2 ()
-{
-       func_emit_wrapper_part2_arg1=no
-       if test -n "$1" ; then
-         func_emit_wrapper_part2_arg1=$1
-       fi
-
-       $ECHO "\
-
-  # Usually 'no', except on cygwin/mingw when embedded into
-  # the cwrapper.
-  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
-  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
-    # special case for '.'
-    if test \"\$thisdir\" = \".\"; then
-      thisdir=\`pwd\`
-    fi
-    # remove .libs from thisdir
-    case \"\$thisdir\" in
-    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
-    $objdir )   thisdir=. ;;
-    esac
-  fi
-
-  # Try to get the absolute directory name.
-  absdir=\`cd \"\$thisdir\" && pwd\`
-  test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
-       if test "$fast_install" = yes; then
-         $ECHO "\
-  program=lt-'$outputname'$exeext
-  progdir=\"\$thisdir/$objdir\"
-
-  if test ! -f \"\$progdir/\$program\" ||
-     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
-       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
-    file=\"\$\$-\$program\"
-
-    if test ! -d \"\$progdir\"; then
-      $MKDIR \"\$progdir\"
-    else
-      $RM \"\$progdir/\$file\"
-    fi"
-
-         $ECHO "\
-
-    # relink executable if necessary
-    if test -n \"\$relink_command\"; then
-      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
-      else
-       $ECHO \"\$relink_command_output\" >&2
-       $RM \"\$progdir/\$file\"
-       exit 1
-      fi
-    fi
-
-    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
-    { $RM \"\$progdir/\$program\";
-      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
-    $RM \"\$progdir/\$file\"
-  fi"
-       else
-         $ECHO "\
-  program='$outputname'
-  progdir=\"\$thisdir/$objdir\"
-"
-       fi
-
-       $ECHO "\
-
-  if test -f \"\$progdir/\$program\"; then"
-
-       # Export our shlibpath_var if we have one.
-       if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
-         $ECHO "\
-    # Add our own library path to $shlibpath_var
-    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
-    # Some systems cannot cope with colon-terminated $shlibpath_var
-    # The second colon is a workaround for a bug in BeOS R4 sed
-    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
-
-    export $shlibpath_var
-"
-       fi
-
-       # fixup the dll searchpath if we need to.
-       if test -n "$dllsearchpath"; then
-         $ECHO "\
-    # Add the dll search path components to the executable PATH
-    PATH=$dllsearchpath:\$PATH
-"
-       fi
-
-       $ECHO "\
-    if test \"\$libtool_execute_magic\" != \"$magic\"; then
-      # Run the actual program with our arguments.
-"
-       case $host in
-       # Backslashes separate directories on plain windows
-       *-*-mingw | *-*-os2* | *-cegcc*)
-         $ECHO "\
-      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
-         ;;
-
-       *)
-         $ECHO "\
-      exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
-         ;;
-       esac
-       $ECHO "\
-      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
-      exit 1
-    fi
-  else
-    # The program doesn't exist.
-    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
-    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
-    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
-    exit 1
-  fi
-fi\
-"
-}
-# end: func_emit_wrapper_part2
-
-
-# func_emit_wrapper [arg=no]
-#
-# Emit a libtool wrapper script on stdout.
-# Don't directly open a file because we may want to
-# incorporate the script contents within a cygwin/mingw
-# wrapper executable.  Must ONLY be called from within
-# func_mode_link because it depends on a number of variables
-# set therein.
-#
-# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
-# variable will take.  If 'yes', then the emitted script
-# will assume that the directory in which it is stored is
-# the $objdir directory.  This is a cygwin/mingw-specific
-# behavior.
-func_emit_wrapper ()
-{
-       func_emit_wrapper_arg1=no
-       if test -n "$1" ; then
-         func_emit_wrapper_arg1=$1
-       fi
-
-       # split this up so that func_emit_cwrapperexe_src
-       # can call each part independently.
-       func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
-       func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
-}
-
-
-# func_to_host_path arg
-#
-# Convert paths to host format when used with build tools.
-# Intended for use with "native" mingw (where libtool itself
-# is running under the msys shell), or in the following cross-
-# build environments:
-#    $build          $host
-#    mingw (msys)    mingw  [e.g. native]
-#    cygwin          mingw
-#    *nix + wine     mingw
-# where wine is equipped with the `winepath' executable.
-# In the native mingw case, the (msys) shell automatically
-# converts paths for any non-msys applications it launches,
-# but that facility isn't available from inside the cwrapper.
-# Similar accommodations are necessary for $host mingw and
-# $build cygwin.  Calling this function does no harm for other
-# $host/$build combinations not listed above.
-#
-# ARG is the path (on $build) that should be converted to
-# the proper representation for $host. The result is stored
-# in $func_to_host_path_result.
-func_to_host_path ()
-{
-  func_to_host_path_result="$1"
-  if test -n "$1" ; then
-    case $host in
-      *mingw* )
-        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-        case $build in
-          *mingw* ) # actually, msys
-            # awkward: cmd appends spaces to result
-            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
-            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
-              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
-            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          *cygwin* )
-            func_to_host_path_tmp1=`cygpath -w "$1"`
-            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          * )
-            # Unfortunately, winepath does not exit with a non-zero
-            # error code, so we are forced to check the contents of
-            # stdout. On the other hand, if the command is not
-            # found, the shell will set an exit code of 127 and print
-            # *an error message* to stdout. So we must check for both
-            # error code of zero AND non-empty stdout, which explains
-            # the odd construction:
-            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
-            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
-              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-                $SED -e "$lt_sed_naive_backslashify"`
-            else
-              # Allow warning below.
-              func_to_host_path_result=""
-            fi
-            ;;
-        esac
-        if test -z "$func_to_host_path_result" ; then
-          func_error "Could not determine host path corresponding to"
-          func_error "  '$1'"
-          func_error "Continuing, but uninstalled executables may not work."
-          # Fallback:
-          func_to_host_path_result="$1"
-        fi
-        ;;
-    esac
-  fi
-}
-# end: func_to_host_path
-
-# func_to_host_pathlist arg
-#
-# Convert pathlists to host format when used with build tools.
-# See func_to_host_path(), above. This function supports the
-# following $build/$host combinations (but does no harm for
-# combinations not listed here):
-#    $build          $host
-#    mingw (msys)    mingw  [e.g. native]
-#    cygwin          mingw
-#    *nix + wine     mingw
-#
-# Path separators are also converted from $build format to
-# $host format. If ARG begins or ends with a path separator
-# character, it is preserved (but converted to $host format)
-# on output.
-#
-# ARG is a pathlist (on $build) that should be converted to
-# the proper representation on $host. The result is stored
-# in $func_to_host_pathlist_result.
-func_to_host_pathlist ()
-{
-  func_to_host_pathlist_result="$1"
-  if test -n "$1" ; then
-    case $host in
-      *mingw* )
-        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-        # Remove leading and trailing path separator characters from
-        # ARG. msys behavior is inconsistent here, cygpath turns them
-        # into '.;' and ';.', and winepath ignores them completely.
-        func_to_host_pathlist_tmp2="$1"
-        # Once set for this call, this variable should not be
-        # reassigned. It is used in tha fallback case.
-        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
-          $SED -e 's|^:*||' -e 's|:*$||'`
-        case $build in
-          *mingw* ) # Actually, msys.
-            # Awkward: cmd appends spaces to result.
-            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
-            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
-              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
-            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          *cygwin* )
-            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
-            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          * )
-            # unfortunately, winepath doesn't convert pathlists
-            func_to_host_pathlist_result=""
-            func_to_host_pathlist_oldIFS=$IFS
-            IFS=:
-            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
-              IFS=$func_to_host_pathlist_oldIFS
-              if test -n "$func_to_host_pathlist_f" ; then
-                func_to_host_path "$func_to_host_pathlist_f"
-                if test -n "$func_to_host_path_result" ; then
-                  if test -z "$func_to_host_pathlist_result" ; then
-                    func_to_host_pathlist_result="$func_to_host_path_result"
-                  else
-                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
-                  fi
-                fi
-              fi
-              IFS=:
-            done
-            IFS=$func_to_host_pathlist_oldIFS
-            ;;
-        esac
-        if test -z "$func_to_host_pathlist_result" ; then
-          func_error "Could not determine the host path(s) corresponding to"
-          func_error "  '$1'"
-          func_error "Continuing, but uninstalled executables may not work."
-          # Fallback. This may break if $1 contains DOS-style drive
-          # specifications. The fix is not to complicate the expression
-          # below, but for the user to provide a working wine installation
-          # with winepath so that path translation in the cross-to-mingw
-          # case works properly.
-          lt_replace_pathsep_nix_to_dos="s|:|;|g"
-          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
-            $SED -e "$lt_replace_pathsep_nix_to_dos"`
-        fi
-        # Now, add the leading and trailing path separators back
-        case "$1" in
-          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
-            ;;
-        esac
-        case "$1" in
-          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
-            ;;
-        esac
-        ;;
-    esac
-  fi
-}
-# end: func_to_host_pathlist
-
-# func_emit_cwrapperexe_src
-# emit the source code for a wrapper executable on stdout
-# Must ONLY be called from within func_mode_link because
-# it depends on a number of variable set therein.
-func_emit_cwrapperexe_src ()
-{
-       cat <<EOF
-
-/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
-   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-
-   The $output program cannot be directly executed until all the libtool
-   libraries that it depends on are installed.
-
-   This wrapper executable should never be moved out of the build directory.
-   If it is, it will not operate correctly.
-
-   Currently, it simply execs the wrapper *script* "$SHELL $output",
-   but could eventually absorb all of the scripts functionality and
-   exec $objdir/$outputname directly.
-*/
-EOF
-           cat <<"EOF"
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef _MSC_VER
-# include <direct.h>
-# include <process.h>
-# include <io.h>
-# define setmode _setmode
-#else
-# include <unistd.h>
-# include <stdint.h>
-# ifdef __CYGWIN__
-#  include <io.h>
-#  define HAVE_SETENV
-#  ifdef __STRICT_ANSI__
-char *realpath (const char *, char *);
-int putenv (char *);
-int setenv (const char *, const char *, int);
-#  endif
-# endif
-#endif
-#include <malloc.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#if defined(PATH_MAX)
-# define LT_PATHMAX PATH_MAX
-#elif defined(MAXPATHLEN)
-# define LT_PATHMAX MAXPATHLEN
-#else
-# define LT_PATHMAX 1024
-#endif
-
-#ifndef S_IXOTH
-# define S_IXOTH 0
-#endif
-#ifndef S_IXGRP
-# define S_IXGRP 0
-#endif
-
-#ifdef _MSC_VER
-# define S_IXUSR _S_IEXEC
-# define stat _stat
-# ifndef _INTPTR_T_DEFINED
-#  define intptr_t int
-# endif
-#endif
-
-#ifndef DIR_SEPARATOR
-# define DIR_SEPARATOR '/'
-# define PATH_SEPARATOR ':'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
-  defined (__OS2__)
-# define HAVE_DOS_BASED_FILE_SYSTEM
-# define FOPEN_WB "wb"
-# ifndef DIR_SEPARATOR_2
-#  define DIR_SEPARATOR_2 '\\'
-# endif
-# ifndef PATH_SEPARATOR_2
-#  define PATH_SEPARATOR_2 ';'
-# endif
-#endif
-
-#ifndef DIR_SEPARATOR_2
-# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
-#else /* DIR_SEPARATOR_2 */
-# define IS_DIR_SEPARATOR(ch) \
-       (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
-#endif /* DIR_SEPARATOR_2 */
-
-#ifndef PATH_SEPARATOR_2
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
-#else /* PATH_SEPARATOR_2 */
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
-#endif /* PATH_SEPARATOR_2 */
-
-#ifdef __CYGWIN__
-# define FOPEN_WB "wb"
-#endif
-
-#ifndef FOPEN_WB
-# define FOPEN_WB "w"
-#endif
-#ifndef _O_BINARY
-# define _O_BINARY 0
-#endif
-
-#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
-#define XFREE(stale) do { \
-  if (stale) { free ((void *) stale); stale = 0; } \
-} while (0)
-
-#undef LTWRAPPER_DEBUGPRINTF
-#if defined DEBUGWRAPPER
-# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
-static void
-ltwrapper_debugprintf (const char *fmt, ...)
-{
-    va_list args;
-    va_start (args, fmt);
-    (void) vfprintf (stderr, fmt, args);
-    va_end (args);
-}
-#else
-# define LTWRAPPER_DEBUGPRINTF(args)
-#endif
-
-const char *program_name = NULL;
-
-void *xmalloc (size_t num);
-char *xstrdup (const char *string);
-const char *base_name (const char *name);
-char *find_executable (const char *wrapper);
-char *chase_symlinks (const char *pathspec);
-int make_executable (const char *path);
-int check_executable (const char *path);
-char *strendzap (char *str, const char *pat);
-void lt_fatal (const char *message, ...);
-void lt_setenv (const char *name, const char *value);
-char *lt_extend_str (const char *orig_value, const char *add, int to_end);
-void lt_opt_process_env_set (const char *arg);
-void lt_opt_process_env_prepend (const char *arg);
-void lt_opt_process_env_append (const char *arg);
-int lt_split_name_value (const char *arg, char** name, char** value);
-void lt_update_exe_path (const char *name, const char *value);
-void lt_update_lib_path (const char *name, const char *value);
-
-static const char *script_text_part1 =
-EOF
-
-           func_emit_wrapper_part1 yes |
-               $SED -e 's/\([\\"]\)/\\\1/g' \
-                    -e 's/^/  "/' -e 's/$/\\n"/'
-           echo ";"
-           cat <<EOF
-
-static const char *script_text_part2 =
-EOF
-           func_emit_wrapper_part2 yes |
-               $SED -e 's/\([\\"]\)/\\\1/g' \
-                    -e 's/^/  "/' -e 's/$/\\n"/'
-           echo ";"
-
-           cat <<EOF
-const char * MAGIC_EXE = "$magic_exe";
-const char * LIB_PATH_VARNAME = "$shlibpath_var";
-EOF
-
-           if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
-              func_to_host_pathlist "$temp_rpath"
-             cat <<EOF
-const char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
-EOF
-           else
-             cat <<"EOF"
-const char * LIB_PATH_VALUE   = "";
-EOF
-           fi
-
-           if test -n "$dllsearchpath"; then
-              func_to_host_pathlist "$dllsearchpath:"
-             cat <<EOF
-const char * EXE_PATH_VARNAME = "PATH";
-const char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
-EOF
-           else
-             cat <<"EOF"
-const char * EXE_PATH_VARNAME = "";
-const char * EXE_PATH_VALUE   = "";
-EOF
-           fi
-
-           if test "$fast_install" = yes; then
-             cat <<EOF
-const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
-EOF
-           else
-             cat <<EOF
-const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
-EOF
-           fi
-
-
-           cat <<"EOF"
-
-#define LTWRAPPER_OPTION_PREFIX         "--lt-"
-#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
-
-static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
-static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
-
-static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
-
-static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
-static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
-  /* argument is putenv-style "foo=bar", value of foo is set to bar */
-
-static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
-static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
-  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
-
-static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
-static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
-  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
-
-int
-main (int argc, char *argv[])
-{
-  char **newargz;
-  int  newargc;
-  char *tmp_pathspec;
-  char *actual_cwrapper_path;
-  char *actual_cwrapper_name;
-  char *target_name;
-  char *lt_argv_zero;
-  intptr_t rval = 127;
-
-  int i;
-
-  program_name = (char *) xstrdup (base_name (argv[0]));
-  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
-  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
-
-  /* very simple arg parsing; don't want to rely on getopt */
-  for (i = 1; i < argc; i++)
-    {
-      if (strcmp (argv[i], dumpscript_opt) == 0)
-       {
-EOF
-           case "$host" in
-             *mingw* | *cygwin* )
-               # make stdout use "unix" line endings
-               echo "          setmode(1,_O_BINARY);"
-               ;;
-             esac
-
-           cat <<"EOF"
-         printf ("%s", script_text_part1);
-         printf ("%s", script_text_part2);
-         return 0;
-       }
-    }
-
-  newargz = XMALLOC (char *, argc + 1);
-  tmp_pathspec = find_executable (argv[0]);
-  if (tmp_pathspec == NULL)
-    lt_fatal ("Couldn't find %s", argv[0]);
-  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
-                         tmp_pathspec));
-
-  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
-  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
-                         actual_cwrapper_path));
-  XFREE (tmp_pathspec);
-
-  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
-  strendzap (actual_cwrapper_path, actual_cwrapper_name);
-
-  /* wrapper name transforms */
-  strendzap (actual_cwrapper_name, ".exe");
-  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
-  XFREE (actual_cwrapper_name);
-  actual_cwrapper_name = tmp_pathspec;
-  tmp_pathspec = 0;
-
-  /* target_name transforms -- use actual target program name; might have lt- prefix */
-  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
-  strendzap (target_name, ".exe");
-  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
-  XFREE (target_name);
-  target_name = tmp_pathspec;
-  tmp_pathspec = 0;
-
-  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
-                         target_name));
-EOF
-
-           cat <<EOF
-  newargz[0] =
-    XMALLOC (char, (strlen (actual_cwrapper_path) +
-                   strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
-  strcpy (newargz[0], actual_cwrapper_path);
-  strcat (newargz[0], "$objdir");
-  strcat (newargz[0], "/");
-EOF
-
-           cat <<"EOF"
-  /* stop here, and copy so we don't have to do this twice */
-  tmp_pathspec = xstrdup (newargz[0]);
-
-  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
-  strcat (newargz[0], actual_cwrapper_name);
-
-  /* DO want the lt- prefix here if it exists, so use target_name */
-  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
-  XFREE (tmp_pathspec);
-  tmp_pathspec = NULL;
-EOF
-
-           case $host_os in
-             mingw*)
-           cat <<"EOF"
-  {
-    char* p;
-    while ((p = strchr (newargz[0], '\\')) != NULL)
-      {
-       *p = '/';
-      }
-    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
-      {
-       *p = '/';
-      }
-  }
-EOF
-           ;;
-           esac
-
-           cat <<"EOF"
-  XFREE (target_name);
-  XFREE (actual_cwrapper_path);
-  XFREE (actual_cwrapper_name);
-
-  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
-  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
-  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
-  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
-
-  newargc=0;
-  for (i = 1; i < argc; i++)
-    {
-      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
-        {
-          if (argv[i][env_set_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_set_opt_len + 1;
-              lt_opt_process_env_set (p);
-            }
-          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_set (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_set_opt);
-          continue;
-        }
-      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
-        {
-          if (argv[i][env_prepend_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_prepend_opt_len + 1;
-              lt_opt_process_env_prepend (p);
-            }
-          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_prepend_opt);
-          continue;
-        }
-      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
-        {
-          if (argv[i][env_append_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_append_opt_len + 1;
-              lt_opt_process_env_append (p);
-            }
-          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_append (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_append_opt);
-          continue;
-        }
-      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
-        {
-          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
-             namespace, but it is not one of the ones we know about and
-             have already dealt with, above (inluding dump-script), then
-             report an error. Otherwise, targets might begin to believe
-             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
-             namespace. The first time any user complains about this, we'll
-             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
-             or a configure.ac-settable value.
-           */
-          lt_fatal ("Unrecognized option in %s namespace: '%s'",
-                    ltwrapper_option_prefix, argv[i]);
-        }
-      /* otherwise ... */
-      newargz[++newargc] = xstrdup (argv[i]);
-    }
-  newargz[++newargc] = NULL;
-
-  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
-  for (i = 0; i < newargc; i++)
-    {
-      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
-    }
-
-EOF
-
-           case $host_os in
-             mingw*)
-               cat <<"EOF"
-  /* execv doesn't actually work on mingw as expected on unix */
-  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
-  if (rval == -1)
-    {
-      /* failed to start process */
-      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
-      return 127;
-    }
-  return rval;
-EOF
-               ;;
-             *)
-               cat <<"EOF"
-  execv (lt_argv_zero, newargz);
-  return rval; /* =127, but avoids unused variable warning */
-EOF
-               ;;
-           esac
-
-           cat <<"EOF"
-}
-
-void *
-xmalloc (size_t num)
-{
-  void *p = (void *) malloc (num);
-  if (!p)
-    lt_fatal ("Memory exhausted");
-
-  return p;
-}
-
-char *
-xstrdup (const char *string)
-{
-  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
-                         string) : NULL;
-}
-
-const char *
-base_name (const char *name)
-{
-  const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-  /* Skip over the disk name in MSDOS pathnames. */
-  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
-    name += 2;
-#endif
-
-  for (base = name; *name; name++)
-    if (IS_DIR_SEPARATOR (*name))
-      base = name + 1;
-  return base;
-}
-
-int
-check_executable (const char *path)
-{
-  struct stat st;
-
-  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
-                         path ? (*path ? path : "EMPTY!") : "NULL!"));
-  if ((!path) || (!*path))
-    return 0;
-
-  if ((stat (path, &st) >= 0)
-      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
-    return 1;
-  else
-    return 0;
-}
-
-int
-make_executable (const char *path)
-{
-  int rval = 0;
-  struct stat st;
-
-  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
-                         path ? (*path ? path : "EMPTY!") : "NULL!"));
-  if ((!path) || (!*path))
-    return 0;
-
-  if (stat (path, &st) >= 0)
-    {
-      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
-    }
-  return rval;
-}
-
-/* Searches for the full path of the wrapper.  Returns
-   newly allocated full path name if found, NULL otherwise
-   Does not chase symlinks, even on platforms that support them.
-*/
-char *
-find_executable (const char *wrapper)
-{
-  int has_slash = 0;
-  const char *p;
-  const char *p_next;
-  /* static buffer for getcwd */
-  char tmp[LT_PATHMAX + 1];
-  int tmp_len;
-  char *concat_name;
-
-  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
-                         wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
-
-  if ((wrapper == NULL) || (*wrapper == '\0'))
-    return NULL;
-
-  /* Absolute path? */
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
-    {
-      concat_name = xstrdup (wrapper);
-      if (check_executable (concat_name))
-       return concat_name;
-      XFREE (concat_name);
-    }
-  else
-    {
-#endif
-      if (IS_DIR_SEPARATOR (wrapper[0]))
-       {
-         concat_name = xstrdup (wrapper);
-         if (check_executable (concat_name))
-           return concat_name;
-         XFREE (concat_name);
-       }
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-    }
-#endif
-
-  for (p = wrapper; *p; p++)
-    if (*p == '/')
-      {
-       has_slash = 1;
-       break;
-      }
-  if (!has_slash)
-    {
-      /* no slashes; search PATH */
-      const char *path = getenv ("PATH");
-      if (path != NULL)
-       {
-         for (p = path; *p; p = p_next)
-           {
-             const char *q;
-             size_t p_len;
-             for (q = p; *q; q++)
-               if (IS_PATH_SEPARATOR (*q))
-                 break;
-             p_len = q - p;
-             p_next = (*q == '\0' ? q : q + 1);
-             if (p_len == 0)
-               {
-                 /* empty path: current directory */
-                 if (getcwd (tmp, LT_PATHMAX) == NULL)
-                   lt_fatal ("getcwd failed");
-                 tmp_len = strlen (tmp);
-                 concat_name =
-                   XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
-                 memcpy (concat_name, tmp, tmp_len);
-                 concat_name[tmp_len] = '/';
-                 strcpy (concat_name + tmp_len + 1, wrapper);
-               }
-             else
-               {
-                 concat_name =
-                   XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
-                 memcpy (concat_name, p, p_len);
-                 concat_name[p_len] = '/';
-                 strcpy (concat_name + p_len + 1, wrapper);
-               }
-             if (check_executable (concat_name))
-               return concat_name;
-             XFREE (concat_name);
-           }
-       }
-      /* not found in PATH; assume curdir */
-    }
-  /* Relative path | not found in path: prepend cwd */
-  if (getcwd (tmp, LT_PATHMAX) == NULL)
-    lt_fatal ("getcwd failed");
-  tmp_len = strlen (tmp);
-  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
-  memcpy (concat_name, tmp, tmp_len);
-  concat_name[tmp_len] = '/';
-  strcpy (concat_name + tmp_len + 1, wrapper);
-
-  if (check_executable (concat_name))
-    return concat_name;
-  XFREE (concat_name);
-  return NULL;
-}
-
-char *
-chase_symlinks (const char *pathspec)
-{
-#ifndef S_ISLNK
-  return xstrdup (pathspec);
-#else
-  char buf[LT_PATHMAX];
-  struct stat s;
-  char *tmp_pathspec = xstrdup (pathspec);
-  char *p;
-  int has_symlinks = 0;
-  while (strlen (tmp_pathspec) && !has_symlinks)
-    {
-      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
-                             tmp_pathspec));
-      if (lstat (tmp_pathspec, &s) == 0)
-       {
-         if (S_ISLNK (s.st_mode) != 0)
-           {
-             has_symlinks = 1;
-             break;
-           }
-
-         /* search backwards for last DIR_SEPARATOR */
-         p = tmp_pathspec + strlen (tmp_pathspec) - 1;
-         while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
-           p--;
-         if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
-           {
-             /* no more DIR_SEPARATORS left */
-             break;
-           }
-         *p = '\0';
-       }
-      else
-       {
-         char *errstr = strerror (errno);
-         lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
-       }
-    }
-  XFREE (tmp_pathspec);
-
-  if (!has_symlinks)
-    {
-      return xstrdup (pathspec);
-    }
-
-  tmp_pathspec = realpath (pathspec, buf);
-  if (tmp_pathspec == 0)
-    {
-      lt_fatal ("Could not follow symlinks for %s", pathspec);
-    }
-  return xstrdup (tmp_pathspec);
-#endif
-}
-
-char *
-strendzap (char *str, const char *pat)
-{
-  size_t len, patlen;
-
-  assert (str != NULL);
-  assert (pat != NULL);
-
-  len = strlen (str);
-  patlen = strlen (pat);
-
-  if (patlen <= len)
-    {
-      str += len - patlen;
-      if (strcmp (str, pat) == 0)
-       *str = '\0';
-    }
-  return str;
-}
-
-static void
-lt_error_core (int exit_status, const char *mode,
-              const char *message, va_list ap)
-{
-  fprintf (stderr, "%s: %s: ", program_name, mode);
-  vfprintf (stderr, message, ap);
-  fprintf (stderr, ".\n");
-
-  if (exit_status >= 0)
-    exit (exit_status);
-}
-
-void
-lt_fatal (const char *message, ...)
-{
-  va_list ap;
-  va_start (ap, message);
-  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
-  va_end (ap);
-}
-
-void
-lt_setenv (const char *name, const char *value)
-{
-  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
-  {
-#ifdef HAVE_SETENV
-    /* always make a copy, for consistency with !HAVE_SETENV */
-    char *str = xstrdup (value);
-    setenv (name, str, 1);
-#else
-    int len = strlen (name) + 1 + strlen (value) + 1;
-    char *str = XMALLOC (char, len);
-    sprintf (str, "%s=%s", name, value);
-    if (putenv (str) != EXIT_SUCCESS)
-      {
-        XFREE (str);
-      }
-#endif
-  }
-}
-
-char *
-lt_extend_str (const char *orig_value, const char *add, int to_end)
-{
-  char *new_value;
-  if (orig_value && *orig_value)
-    {
-      int orig_value_len = strlen (orig_value);
-      int add_len = strlen (add);
-      new_value = XMALLOC (char, add_len + orig_value_len + 1);
-      if (to_end)
-        {
-          strcpy (new_value, orig_value);
-          strcpy (new_value + orig_value_len, add);
-        }
-      else
-        {
-          strcpy (new_value, add);
-          strcpy (new_value + add_len, orig_value);
-        }
-    }
-  else
-    {
-      new_value = xstrdup (add);
-    }
-  return new_value;
-}
-
-int
-lt_split_name_value (const char *arg, char** name, char** value)
-{
-  const char *p;
-  int len;
-  if (!arg || !*arg)
-    return 1;
-
-  p = strchr (arg, (int)'=');
-
-  if (!p)
-    return 1;
-
-  *value = xstrdup (++p);
-
-  len = strlen (arg) - strlen (*value);
-  *name = XMALLOC (char, len);
-  strncpy (*name, arg, len-1);
-  (*name)[len - 1] = '\0';
-
-  return 0;
-}
-
-void
-lt_opt_process_env_set (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
-    }
-
-  lt_setenv (name, value);
-  XFREE (name);
-  XFREE (value);
-}
-
-void
-lt_opt_process_env_prepend (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-  char *new_value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
-    }
-
-  new_value = lt_extend_str (getenv (name), value, 0);
-  lt_setenv (name, new_value);
-  XFREE (new_value);
-  XFREE (name);
-  XFREE (value);
-}
-
-void
-lt_opt_process_env_append (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-  char *new_value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
-    }
-
-  new_value = lt_extend_str (getenv (name), value, 1);
-  lt_setenv (name, new_value);
-  XFREE (new_value);
-  XFREE (name);
-  XFREE (value);
-}
-
-void
-lt_update_exe_path (const char *name, const char *value)
-{
-  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
-
-  if (name && *name && value && *value)
-    {
-      char *new_value = lt_extend_str (getenv (name), value, 0);
-      /* some systems can't cope with a ':'-terminated path #' */
-      int len = strlen (new_value);
-      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
-        {
-          new_value[len-1] = '\0';
-        }
-      lt_setenv (name, new_value);
-      XFREE (new_value);
-    }
-}
-
-void
-lt_update_lib_path (const char *name, const char *value)
-{
-  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
-
-  if (name && *name && value && *value)
-    {
-      char *new_value = lt_extend_str (getenv (name), value, 0);
-      lt_setenv (name, new_value);
-      XFREE (new_value);
-    }
-}
-
-
-EOF
-}
-# end: func_emit_cwrapperexe_src
-
-# func_mode_link arg...
-func_mode_link ()
-{
-    $opt_debug
-    case $host in
-    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-      # It is impossible to link a dll without this setting, and
-      # we shouldn't force the makefile maintainer to figure out
-      # which system we are compiling for in order to pass an extra
-      # flag for every libtool invocation.
-      # allow_undefined=no
-
-      # FIXME: Unfortunately, there are problems with the above when trying
-      # to make a dll which has undefined symbols, in which case not
-      # even a static library is built.  For now, we need to specify
-      # -no-undefined on the libtool link line when we can be certain
-      # that all symbols are satisfied, otherwise we get a static library.
-      allow_undefined=yes
-      ;;
-    *)
-      allow_undefined=yes
-      ;;
-    esac
-    libtool_args=$nonopt
-    base_compile="$nonopt $@"
-    compile_command=$nonopt
-    finalize_command=$nonopt
-
-    compile_rpath=
-    finalize_rpath=
-    compile_shlibpath=
-    finalize_shlibpath=
-    convenience=
-    old_convenience=
-    deplibs=
-    old_deplibs=
-    compiler_flags=
-    linker_flags=
-    dllsearchpath=
-    lib_search_path=`pwd`
-    inst_prefix_dir=
-    new_inherited_linker_flags=
-
-    avoid_version=no
-    dlfiles=
-    dlprefiles=
-    dlself=no
-    export_dynamic=no
-    export_symbols=
-    export_symbols_regex=
-    generated=
-    libobjs=
-    ltlibs=
-    module=no
-    no_install=no
-    objs=
-    non_pic_objects=
-    precious_files_regex=
-    prefer_static_libs=no
-    preload=no
-    prev=
-    prevarg=
-    release=
-    rpath=
-    xrpath=
-    perm_rpath=
-    temp_rpath=
-    thread_safe=no
-    vinfo=
-    vinfo_number=no
-    weak_libs=
-    single_module="${wl}-single_module"
-    func_infer_tag $base_compile
-
-    # We need to know -static, to get the right output filenames.
-    for arg
-    do
-      case $arg in
-      -shared)
-       test "$build_libtool_libs" != yes && \
-         func_fatal_configuration "can not build a shared library"
-       build_old_libs=no
-       break
-       ;;
-      -all-static | -static | -static-libtool-libs)
-       case $arg in
-       -all-static)
-         if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
-           func_warning "complete static linking is impossible in this configuration"
-         fi
-         if test -n "$link_static_flag"; then
-           dlopen_self=$dlopen_self_static
-         fi
-         prefer_static_libs=yes
-         ;;
-       -static)
-         if test -z "$pic_flag" && test -n "$link_static_flag"; then
-           dlopen_self=$dlopen_self_static
-         fi
-         prefer_static_libs=built
-         ;;
-       -static-libtool-libs)
-         if test -z "$pic_flag" && test -n "$link_static_flag"; then
-           dlopen_self=$dlopen_self_static
-         fi
-         prefer_static_libs=yes
-         ;;
-       esac
-       build_libtool_libs=no
-       build_old_libs=yes
-       break
-       ;;
-      esac
-    done
-
-    # See if our shared archives depend on static archives.
-    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
-    # Go through the arguments, transforming them on the way.
-    while test "$#" -gt 0; do
-      arg="$1"
-      shift
-      func_quote_for_eval "$arg"
-      qarg=$func_quote_for_eval_unquoted_result
-      func_append libtool_args " $func_quote_for_eval_result"
-
-      # If the previous option needs an argument, assign it.
-      if test -n "$prev"; then
-       case $prev in
-       output)
-         func_append compile_command " @OUTPUT@"
-         func_append finalize_command " @OUTPUT@"
-         ;;
-       esac
-
-       case $prev in
-       dlfiles|dlprefiles)
-         if test "$preload" = no; then
-           # Add the symbol object into the linking commands.
-           func_append compile_command " @SYMFILE@"
-           func_append finalize_command " @SYMFILE@"
-           preload=yes
-         fi
-         case $arg in
-         *.la | *.lo) ;;  # We handle these cases below.
-         force)
-           if test "$dlself" = no; then
-             dlself=needless
-             export_dynamic=yes
-           fi
-           prev=
-           continue
-           ;;
-         self)
-           if test "$prev" = dlprefiles; then
-             dlself=yes
-           elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
-             dlself=yes
-           else
-             dlself=needless
-             export_dynamic=yes
-           fi
-           prev=
-           continue
-           ;;
-         *)
-           if test "$prev" = dlfiles; then
-             dlfiles="$dlfiles $arg"
-           else
-             dlprefiles="$dlprefiles $arg"
-           fi
-           prev=
-           continue
-           ;;
-         esac
-         ;;
-       expsyms)
-         export_symbols="$arg"
-         test -f "$arg" \
-           || func_fatal_error "symbol file \`$arg' does not exist"
-         prev=
-         continue
-         ;;
-       expsyms_regex)
-         export_symbols_regex="$arg"
-         prev=
-         continue
-         ;;
-       framework)
-         case $host in
-           *-*-darwin*)
-             case "$deplibs " in
-               *" $qarg.ltframework "*) ;;
-               *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
-                  ;;
-             esac
-             ;;
-         esac
-         prev=
-         continue
-         ;;
-       inst_prefix)
-         inst_prefix_dir="$arg"
-         prev=
-         continue
-         ;;
-       objectlist)
-         if test -f "$arg"; then
-           save_arg=$arg
-           moreargs=
-           for fil in `cat "$save_arg"`
-           do
-#            moreargs="$moreargs $fil"
-             arg=$fil
-             # A libtool-controlled object.
-
-             # Check to see that this really is a libtool object.
-             if func_lalib_unsafe_p "$arg"; then
-               pic_object=
-               non_pic_object=
-
-               # Read the .lo file
-               func_source "$arg"
-
-               if test -z "$pic_object" ||
-                  test -z "$non_pic_object" ||
-                  test "$pic_object" = none &&
-                  test "$non_pic_object" = none; then
-                 func_fatal_error "cannot find name of object for \`$arg'"
-               fi
-
-               # Extract subdirectory from the argument.
-               func_dirname "$arg" "/" ""
-               xdir="$func_dirname_result"
-
-               if test "$pic_object" != none; then
-                 # Prepend the subdirectory the object is found in.
-                 pic_object="$xdir$pic_object"
-
-                 if test "$prev" = dlfiles; then
-                   if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-                     dlfiles="$dlfiles $pic_object"
-                     prev=
-                     continue
-                   else
-                     # If libtool objects are unsupported, then we need to preload.
-                     prev=dlprefiles
-                   fi
-                 fi
-
-                 # CHECK ME:  I think I busted this.  -Ossama
-                 if test "$prev" = dlprefiles; then
-                   # Preload the old-style object.
-                   dlprefiles="$dlprefiles $pic_object"
-                   prev=
-                 fi
-
-                 # A PIC object.
-                 func_append libobjs " $pic_object"
-                 arg="$pic_object"
-               fi
-
-               # Non-PIC object.
-               if test "$non_pic_object" != none; then
-                 # Prepend the subdirectory the object is found in.
-                 non_pic_object="$xdir$non_pic_object"
-
-                 # A standard non-PIC object
-                 func_append non_pic_objects " $non_pic_object"
-                 if test -z "$pic_object" || test "$pic_object" = none ; then
-                   arg="$non_pic_object"
-                 fi
-               else
-                 # If the PIC object exists, use it instead.
-                 # $xdir was prepended to $pic_object above.
-                 non_pic_object="$pic_object"
-                 func_append non_pic_objects " $non_pic_object"
-               fi
-             else
-               # Only an error if not doing a dry-run.
-               if $opt_dry_run; then
-                 # Extract subdirectory from the argument.
-                 func_dirname "$arg" "/" ""
-                 xdir="$func_dirname_result"
-
-                 func_lo2o "$arg"
-                 pic_object=$xdir$objdir/$func_lo2o_result
-                 non_pic_object=$xdir$func_lo2o_result
-                 func_append libobjs " $pic_object"
-                 func_append non_pic_objects " $non_pic_object"
-               else
-                 func_fatal_error "\`$arg' is not a valid libtool object"
-               fi
-             fi
-           done
-         else
-           func_fatal_error "link input file \`$arg' does not exist"
-         fi
-         arg=$save_arg
-         prev=
-         continue
-         ;;
-       precious_regex)
-         precious_files_regex="$arg"
-         prev=
-         continue
-         ;;
-       release)
-         release="-$arg"
-         prev=
-         continue
-         ;;
-       rpath | xrpath)
-         # We need an absolute path.
-         case $arg in
-         [\\/]* | [A-Za-z]:[\\/]*) ;;
-         *)
-           func_fatal_error "only absolute run-paths are allowed"
-           ;;
-         esac
-         if test "$prev" = rpath; then
-           case "$rpath " in
-           *" $arg "*) ;;
-           *) rpath="$rpath $arg" ;;
-           esac
-         else
-           case "$xrpath " in
-           *" $arg "*) ;;
-           *) xrpath="$xrpath $arg" ;;
-           esac
-         fi
-         prev=
-         continue
-         ;;
-       shrext)
-         shrext_cmds="$arg"
-         prev=
-         continue
-         ;;
-       weak)
-         weak_libs="$weak_libs $arg"
-         prev=
-         continue
-         ;;
-       xcclinker)
-         linker_flags="$linker_flags $qarg"
-         compiler_flags="$compiler_flags $qarg"
-         prev=
-         func_append compile_command " $qarg"
-         func_append finalize_command " $qarg"
-         continue
-         ;;
-       xcompiler)
-         compiler_flags="$compiler_flags $qarg"
-         prev=
-         func_append compile_command " $qarg"
-         func_append finalize_command " $qarg"
-         continue
-         ;;
-       xlinker)
-         linker_flags="$linker_flags $qarg"
-         compiler_flags="$compiler_flags $wl$qarg"
-         prev=
-         func_append compile_command " $wl$qarg"
-         func_append finalize_command " $wl$qarg"
-         continue
-         ;;
-       *)
-         eval "$prev=\"\$arg\""
-         prev=
-         continue
-         ;;
-       esac
-      fi # test -n "$prev"
-
-      prevarg="$arg"
-
-      case $arg in
-      -all-static)
-       if test -n "$link_static_flag"; then
-         # See comment for -static flag below, for more details.
-         func_append compile_command " $link_static_flag"
-         func_append finalize_command " $link_static_flag"
-       fi
-       continue
-       ;;
-
-      -allow-undefined)
-       # FIXME: remove this flag sometime in the future.
-       func_fatal_error "\`-allow-undefined' must not be used because it is the default"
-       ;;
-
-      -avoid-version)
-       avoid_version=yes
-       continue
-       ;;
-
-      -dlopen)
-       prev=dlfiles
-       continue
-       ;;
-
-      -dlpreopen)
-       prev=dlprefiles
-       continue
-       ;;
-
-      -export-dynamic)
-       export_dynamic=yes
-       continue
-       ;;
-
-      -export-symbols | -export-symbols-regex)
-       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
-         func_fatal_error "more than one -exported-symbols argument is not allowed"
-       fi
-       if test "X$arg" = "X-export-symbols"; then
-         prev=expsyms
-       else
-         prev=expsyms_regex
-       fi
-       continue
-       ;;
-
-      -framework)
-       prev=framework
-       continue
-       ;;
-
-      -inst-prefix-dir)
-       prev=inst_prefix
-       continue
-       ;;
-
-      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
-      # so, if we see these flags be careful not to treat them like -L
-      -L[A-Z][A-Z]*:*)
-       case $with_gcc/$host in
-       no/*-*-irix* | /*-*-irix*)
-         func_append compile_command " $arg"
-         func_append finalize_command " $arg"
-         ;;
-       esac
-       continue
-       ;;
-
-      -L*)
-       func_stripname '-L' '' "$arg"
-       dir=$func_stripname_result
-       if test -z "$dir"; then
-         if test "$#" -gt 0; then
-           func_fatal_error "require no space between \`-L' and \`$1'"
-         else
-           func_fatal_error "need path for \`-L' option"
-         fi
-       fi
-       # We need an absolute path.
-       case $dir in
-       [\\/]* | [A-Za-z]:[\\/]*) ;;
-       *)
-         absdir=`cd "$dir" && pwd`
-         test -z "$absdir" && \
-           func_fatal_error "cannot determine absolute directory name of \`$dir'"
-         dir="$absdir"
-         ;;
-       esac
-       case "$deplibs " in
-       *" -L$dir "*) ;;
-       *)
-         deplibs="$deplibs -L$dir"
-         lib_search_path="$lib_search_path $dir"
-         ;;
-       esac
-       case $host in
-       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-         testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
-         case :$dllsearchpath: in
-         *":$dir:"*) ;;
-         ::) dllsearchpath=$dir;;
-         *) dllsearchpath="$dllsearchpath:$dir";;
-         esac
-         case :$dllsearchpath: in
-         *":$testbindir:"*) ;;
-         ::) dllsearchpath=$testbindir;;
-         *) dllsearchpath="$dllsearchpath:$testbindir";;
-         esac
-         ;;
-       esac
-       continue
-       ;;
-
-      -l*)
-       if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
-         case $host in
-         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
-           # These systems don't actually have a C or math library (as such)
-           continue
-           ;;
-         *-*-os2*)
-           # These systems don't actually have a C library (as such)
-           test "X$arg" = "X-lc" && continue
-           ;;
-         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
-           # Do not include libc due to us having libc/libc_r.
-           test "X$arg" = "X-lc" && continue
-           ;;
-         *-*-rhapsody* | *-*-darwin1.[012])
-           # Rhapsody C and math libraries are in the System framework
-           deplibs="$deplibs System.ltframework"
-           continue
-           ;;
-         *-*-sco3.2v5* | *-*-sco5v6*)
-           # Causes problems with __ctype
-           test "X$arg" = "X-lc" && continue
-           ;;
-         *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
-           # Compiler inserts libc in the correct place for threads to work
-           test "X$arg" = "X-lc" && continue
-           ;;
-         esac
-       elif test "X$arg" = "X-lc_r"; then
-        case $host in
-        *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
-          # Do not include libc_r directly, use -pthread flag.
-          continue
-          ;;
-        esac
-       fi
-       deplibs="$deplibs $arg"
-       continue
-       ;;
-
-      -module)
-       module=yes
-       continue
-       ;;
-
-      # Tru64 UNIX uses -model [arg] to determine the layout of C++
-      # classes, name mangling, and exception handling.
-      # Darwin uses the -arch flag to determine output architecture.
-      -model|-arch|-isysroot)
-       compiler_flags="$compiler_flags $arg"
-       func_append compile_command " $arg"
-       func_append finalize_command " $arg"
-       prev=xcompiler
-       continue
-       ;;
-
-      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
-       compiler_flags="$compiler_flags $arg"
-       func_append compile_command " $arg"
-       func_append finalize_command " $arg"
-       case "$new_inherited_linker_flags " in
-           *" $arg "*) ;;
-           * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
-       esac
-       continue
-       ;;
-
-      -multi_module)
-       single_module="${wl}-multi_module"
-       continue
-       ;;
-
-      -no-fast-install)
-       fast_install=no
-       continue
-       ;;
-
-      -no-install)
-       case $host in
-       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
-         # The PATH hackery in wrapper scripts is required on Windows
-         # and Darwin in order for the loader to find any dlls it needs.
-         func_warning "\`-no-install' is ignored for $host"
-         func_warning "assuming \`-no-fast-install' instead"
-         fast_install=no
-         ;;
-       *) no_install=yes ;;
-       esac
-       continue
-       ;;
-
-      -no-undefined)
-       allow_undefined=no
-       continue
-       ;;
-
-      -objectlist)
-       prev=objectlist
-       continue
-       ;;
-
-      -o) prev=output ;;
-
-      -precious-files-regex)
-       prev=precious_regex
-       continue
-       ;;
-
-      -release)
-       prev=release
-       continue
-       ;;
-
-      -rpath)
-       prev=rpath
-       continue
-       ;;
-
-      -R)
-       prev=xrpath
-       continue
-       ;;
-
-      -R*)
-       func_stripname '-R' '' "$arg"
-       dir=$func_stripname_result
-       # We need an absolute path.
-       case $dir in
-       [\\/]* | [A-Za-z]:[\\/]*) ;;
-       *)
-         func_fatal_error "only absolute run-paths are allowed"
-         ;;
-       esac
-       case "$xrpath " in
-       *" $dir "*) ;;
-       *) xrpath="$xrpath $dir" ;;
-       esac
-       continue
-       ;;
-
-      -shared)
-       # The effects of -shared are defined in a previous loop.
-       continue
-       ;;
-
-      -shrext)
-       prev=shrext
-       continue
-       ;;
-
-      -static | -static-libtool-libs)
-       # The effects of -static are defined in a previous loop.
-       # We used to do the same as -all-static on platforms that
-       # didn't have a PIC flag, but the assumption that the effects
-       # would be equivalent was wrong.  It would break on at least
-       # Digital Unix and AIX.
-       continue
-       ;;
-
-      -thread-safe)
-       thread_safe=yes
-       continue
-       ;;
-
-      -version-info)
-       prev=vinfo
-       continue
-       ;;
-
-      -version-number)
-       prev=vinfo
-       vinfo_number=yes
-       continue
-       ;;
-
-      -weak)
-        prev=weak
-       continue
-       ;;
-
-      -Wc,*)
-       func_stripname '-Wc,' '' "$arg"
-       args=$func_stripname_result
-       arg=
-       save_ifs="$IFS"; IFS=','
-       for flag in $args; do
-         IFS="$save_ifs"
-          func_quote_for_eval "$flag"
-         arg="$arg $wl$func_quote_for_eval_result"
-         compiler_flags="$compiler_flags $func_quote_for_eval_result"
-       done
-       IFS="$save_ifs"
-       func_stripname ' ' '' "$arg"
-       arg=$func_stripname_result
-       ;;
-
-      -Wl,*)
-       func_stripname '-Wl,' '' "$arg"
-       args=$func_stripname_result
-       arg=
-       save_ifs="$IFS"; IFS=','
-       for flag in $args; do
-         IFS="$save_ifs"
-          func_quote_for_eval "$flag"
-         arg="$arg $wl$func_quote_for_eval_result"
-         compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
-         linker_flags="$linker_flags $func_quote_for_eval_result"
-       done
-       IFS="$save_ifs"
-       func_stripname ' ' '' "$arg"
-       arg=$func_stripname_result
-       ;;
-
-      -Xcompiler)
-       prev=xcompiler
-       continue
-       ;;
-
-      -Xlinker)
-       prev=xlinker
-       continue
-       ;;
-
-      -XCClinker)
-       prev=xcclinker
-       continue
-       ;;
-
-      # -msg_* for osf cc
-      -msg_*)
-       func_quote_for_eval "$arg"
-       arg="$func_quote_for_eval_result"
-       ;;
-
-      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
-      # -r[0-9][0-9]* specifies the processor on the SGI compiler
-      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
-      # +DA*, +DD* enable 64-bit mode on the HP compiler
-      # -q* pass through compiler args for the IBM compiler
-      # -m*, -t[45]*, -txscale* pass through architecture-specific
-      # compiler args for GCC
-      # -F/path gives path to uninstalled frameworks, gcc on darwin
-      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
-      # @file GCC response files
-      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
-        func_quote_for_eval "$arg"
-       arg="$func_quote_for_eval_result"
-        func_append compile_command " $arg"
-        func_append finalize_command " $arg"
-        compiler_flags="$compiler_flags $arg"
-        continue
-        ;;
-
-      # Some other compiler flag.
-      -* | +*)
-        func_quote_for_eval "$arg"
-       arg="$func_quote_for_eval_result"
-       ;;
-
-      *.$objext)
-       # A standard object.
-       objs="$objs $arg"
-       ;;
-
-      *.lo)
-       # A libtool-controlled object.
-
-       # Check to see that this really is a libtool object.
-       if func_lalib_unsafe_p "$arg"; then
-         pic_object=
-         non_pic_object=
-
-         # Read the .lo file
-         func_source "$arg"
-
-         if test -z "$pic_object" ||
-            test -z "$non_pic_object" ||
-            test "$pic_object" = none &&
-            test "$non_pic_object" = none; then
-           func_fatal_error "cannot find name of object for \`$arg'"
-         fi
-
-         # Extract subdirectory from the argument.
-         func_dirname "$arg" "/" ""
-         xdir="$func_dirname_result"
-
-         if test "$pic_object" != none; then
-           # Prepend the subdirectory the object is found in.
-           pic_object="$xdir$pic_object"
-
-           if test "$prev" = dlfiles; then
-             if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-               dlfiles="$dlfiles $pic_object"
-               prev=
-               continue
-             else
-               # If libtool objects are unsupported, then we need to preload.
-               prev=dlprefiles
-             fi
-           fi
-
-           # CHECK ME:  I think I busted this.  -Ossama
-           if test "$prev" = dlprefiles; then
-             # Preload the old-style object.
-             dlprefiles="$dlprefiles $pic_object"
-             prev=
-           fi
-
-           # A PIC object.
-           func_append libobjs " $pic_object"
-           arg="$pic_object"
-         fi
-
-         # Non-PIC object.
-         if test "$non_pic_object" != none; then
-           # Prepend the subdirectory the object is found in.
-           non_pic_object="$xdir$non_pic_object"
-
-           # A standard non-PIC object
-           func_append non_pic_objects " $non_pic_object"
-           if test -z "$pic_object" || test "$pic_object" = none ; then
-             arg="$non_pic_object"
-           fi
-         else
-           # If the PIC object exists, use it instead.
-           # $xdir was prepended to $pic_object above.
-           non_pic_object="$pic_object"
-           func_append non_pic_objects " $non_pic_object"
-         fi
-       else
-         # Only an error if not doing a dry-run.
-         if $opt_dry_run; then
-           # Extract subdirectory from the argument.
-           func_dirname "$arg" "/" ""
-           xdir="$func_dirname_result"
-
-           func_lo2o "$arg"
-           pic_object=$xdir$objdir/$func_lo2o_result
-           non_pic_object=$xdir$func_lo2o_result
-           func_append libobjs " $pic_object"
-           func_append non_pic_objects " $non_pic_object"
-         else
-           func_fatal_error "\`$arg' is not a valid libtool object"
-         fi
-       fi
-       ;;
-
-      *.$libext)
-       # An archive.
-       deplibs="$deplibs $arg"
-       old_deplibs="$old_deplibs $arg"
-       continue
-       ;;
-
-      *.la)
-       # A libtool-controlled library.
-
-       if test "$prev" = dlfiles; then
-         # This library was specified with -dlopen.
-         dlfiles="$dlfiles $arg"
-         prev=
-       elif test "$prev" = dlprefiles; then
-         # The library was specified with -dlpreopen.
-         dlprefiles="$dlprefiles $arg"
-         prev=
-       else
-         deplibs="$deplibs $arg"
-       fi
-       continue
-       ;;
-
-      # Some other compiler argument.
-      *)
-       # Unknown arguments in both finalize_command and compile_command need
-       # to be aesthetically quoted because they are evaled later.
-       func_quote_for_eval "$arg"
-       arg="$func_quote_for_eval_result"
-       ;;
-      esac # arg
-
-      # Now actually substitute the argument into the commands.
-      if test -n "$arg"; then
-       func_append compile_command " $arg"
-       func_append finalize_command " $arg"
-      fi
-    done # argument parsing loop
-
-    test -n "$prev" && \
-      func_fatal_help "the \`$prevarg' option requires an argument"
-
-    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
-      eval arg=\"$export_dynamic_flag_spec\"
-      func_append compile_command " $arg"
-      func_append finalize_command " $arg"
-    fi
-
-    oldlibs=
-    # calculate the name of the file, without its directory
-    func_basename "$output"
-    outputname="$func_basename_result"
-    libobjs_save="$libobjs"
-
-    if test -n "$shlibpath_var"; then
-      # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
-    else
-      shlib_search_path=
-    fi
-    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
-    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
-
-    func_dirname "$output" "/" ""
-    output_objdir="$func_dirname_result$objdir"
-    # Create the object directory.
-    func_mkdir_p "$output_objdir"
-
-    # Determine the type of output
-    case $output in
-    "")
-      func_fatal_help "you must specify an output file"
-      ;;
-    *.$libext) linkmode=oldlib ;;
-    *.lo | *.$objext) linkmode=obj ;;
-    *.la) linkmode=lib ;;
-    *) linkmode=prog ;; # Anything else should be a program.
-    esac
-
-    specialdeplibs=
-
-    libs=
-    # Find all interdependent deplibs by searching for libraries
-    # that are linked more than once (e.g. -la -lb -la)
-    for deplib in $deplibs; do
-      if $opt_duplicate_deps ; then
-       case "$libs " in
-       *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-       esac
-      fi
-      libs="$libs $deplib"
-    done
-
-    if test "$linkmode" = lib; then
-      libs="$predeps $libs $compiler_lib_search_path $postdeps"
-
-      # Compute libraries that are listed more than once in $predeps
-      # $postdeps and mark them as special (i.e., whose duplicates are
-      # not to be eliminated).
-      pre_post_deps=
-      if $opt_duplicate_compiler_generated_deps; then
-       for pre_post_dep in $predeps $postdeps; do
-         case "$pre_post_deps " in
-         *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
-         esac
-         pre_post_deps="$pre_post_deps $pre_post_dep"
-       done
-      fi
-      pre_post_deps=
-    fi
-
-    deplibs=
-    newdependency_libs=
-    newlib_search_path=
-    need_relink=no # whether we're linking any uninstalled libtool libraries
-    notinst_deplibs= # not-installed libtool libraries
-    notinst_path= # paths that contain not-installed libtool libraries
-
-    case $linkmode in
-    lib)
-       passes="conv dlpreopen link"
-       for file in $dlfiles $dlprefiles; do
-         case $file in
-         *.la) ;;
-         *)
-           func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
-           ;;
-         esac
-       done
-       ;;
-    prog)
-       compile_deplibs=
-       finalize_deplibs=
-       alldeplibs=no
-       newdlfiles=
-       newdlprefiles=
-       passes="conv scan dlopen dlpreopen link"
-       ;;
-    *)  passes="conv"
-       ;;
-    esac
-
-    for pass in $passes; do
-      # The preopen pass in lib mode reverses $deplibs; put it back here
-      # so that -L comes before libs that need it for instance...
-      if test "$linkmode,$pass" = "lib,link"; then
-       ## FIXME: Find the place where the list is rebuilt in the wrong
-       ##        order, and fix it there properly
-        tmp_deplibs=
-       for deplib in $deplibs; do
-         tmp_deplibs="$deplib $tmp_deplibs"
-       done
-       deplibs="$tmp_deplibs"
-      fi
-
-      if test "$linkmode,$pass" = "lib,link" ||
-        test "$linkmode,$pass" = "prog,scan"; then
-       libs="$deplibs"
-       deplibs=
-      fi
-      if test "$linkmode" = prog; then
-       case $pass in
-       dlopen) libs="$dlfiles" ;;
-       dlpreopen) libs="$dlprefiles" ;;
-       link)
-         libs="$deplibs %DEPLIBS%"
-         test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
-         ;;
-       esac
-      fi
-      if test "$linkmode,$pass" = "lib,dlpreopen"; then
-       # Collect and forward deplibs of preopened libtool libs
-       for lib in $dlprefiles; do
-         # Ignore non-libtool-libs
-         dependency_libs=
-         case $lib in
-         *.la) func_source "$lib" ;;
-         esac
-
-         # Collect preopened libtool deplibs, except any this library
-         # has declared as weak libs
-         for deplib in $dependency_libs; do
-            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
-           case " $weak_libs " in
-           *" $deplib_base "*) ;;
-           *) deplibs="$deplibs $deplib" ;;
-           esac
-         done
-       done
-       libs="$dlprefiles"
-      fi
-      if test "$pass" = dlopen; then
-       # Collect dlpreopened libraries
-       save_deplibs="$deplibs"
-       deplibs=
-      fi
-
-      for deplib in $libs; do
-       lib=
-       found=no
-       case $deplib in
-       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
-         if test "$linkmode,$pass" = "prog,link"; then
-           compile_deplibs="$deplib $compile_deplibs"
-           finalize_deplibs="$deplib $finalize_deplibs"
-         else
-           compiler_flags="$compiler_flags $deplib"
-           if test "$linkmode" = lib ; then
-               case "$new_inherited_linker_flags " in
-                   *" $deplib "*) ;;
-                   * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
-               esac
-           fi
-         fi
-         continue
-         ;;
-       -l*)
-         if test "$linkmode" != lib && test "$linkmode" != prog; then
-           func_warning "\`-l' is ignored for archives/objects"
-           continue
-         fi
-         func_stripname '-l' '' "$deplib"
-         name=$func_stripname_result
-         if test "$linkmode" = lib; then
-           searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
-         else
-           searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
-         fi
-         for searchdir in $searchdirs; do
-           for search_ext in .la $std_shrext .so .a; do
-             # Search the libtool library
-             lib="$searchdir/lib${name}${search_ext}"
-             if test -f "$lib"; then
-               if test "$search_ext" = ".la"; then
-                 found=yes
-               else
-                 found=no
-               fi
-               break 2
-             fi
-           done
-         done
-         if test "$found" != yes; then
-           # deplib doesn't seem to be a libtool library
-           if test "$linkmode,$pass" = "prog,link"; then
-             compile_deplibs="$deplib $compile_deplibs"
-             finalize_deplibs="$deplib $finalize_deplibs"
-           else
-             deplibs="$deplib $deplibs"
-             test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
-           fi
-           continue
-         else # deplib is a libtool library
-           # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
-           # We need to do some special things here, and not later.
-           if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-             case " $predeps $postdeps " in
-             *" $deplib "*)
-               if func_lalib_p "$lib"; then
-                 library_names=
-                 old_library=
-                 func_source "$lib"
-                 for l in $old_library $library_names; do
-                   ll="$l"
-                 done
-                 if test "X$ll" = "X$old_library" ; then # only static version available
-                   found=no
-                   func_dirname "$lib" "" "."
-                   ladir="$func_dirname_result"
-                   lib=$ladir/$old_library
-                   if test "$linkmode,$pass" = "prog,link"; then
-                     compile_deplibs="$deplib $compile_deplibs"
-                     finalize_deplibs="$deplib $finalize_deplibs"
-                   else
-                     deplibs="$deplib $deplibs"
-                     test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
-                   fi
-                   continue
-                 fi
-               fi
-               ;;
-             *) ;;
-             esac
-           fi
-         fi
-         ;; # -l
-       *.ltframework)
-         if test "$linkmode,$pass" = "prog,link"; then
-           compile_deplibs="$deplib $compile_deplibs"
-           finalize_deplibs="$deplib $finalize_deplibs"
-         else
-           deplibs="$deplib $deplibs"
-           if test "$linkmode" = lib ; then
-               case "$new_inherited_linker_flags " in
-                   *" $deplib "*) ;;
-                   * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
-               esac
-           fi
-         fi
-         continue
-         ;;
-       -L*)
-         case $linkmode in
-         lib)
-           deplibs="$deplib $deplibs"
-           test "$pass" = conv && continue
-           newdependency_libs="$deplib $newdependency_libs"
-           func_stripname '-L' '' "$deplib"
-           newlib_search_path="$newlib_search_path $func_stripname_result"
-           ;;
-         prog)
-           if test "$pass" = conv; then
-             deplibs="$deplib $deplibs"
-             continue
-           fi
-           if test "$pass" = scan; then
-             deplibs="$deplib $deplibs"
-           else
-             compile_deplibs="$deplib $compile_deplibs"
-             finalize_deplibs="$deplib $finalize_deplibs"
-           fi
-           func_stripname '-L' '' "$deplib"
-           newlib_search_path="$newlib_search_path $func_stripname_result"
-           ;;
-         *)
-           func_warning "\`-L' is ignored for archives/objects"
-           ;;
-         esac # linkmode
-         continue
-         ;; # -L
-       -R*)
-         if test "$pass" = link; then
-           func_stripname '-R' '' "$deplib"
-           dir=$func_stripname_result
-           # Make sure the xrpath contains only unique directories.
-           case "$xrpath " in
-           *" $dir "*) ;;
-           *) xrpath="$xrpath $dir" ;;
-           esac
-         fi
-         deplibs="$deplib $deplibs"
-         continue
-         ;;
-       *.la) lib="$deplib" ;;
-       *.$libext)
-         if test "$pass" = conv; then
-           deplibs="$deplib $deplibs"
-           continue
-         fi
-         case $linkmode in
-         lib)
-           # Linking convenience modules into shared libraries is allowed,
-           # but linking other static libraries is non-portable.
-           case " $dlpreconveniencelibs " in
-           *" $deplib "*) ;;
-           *)
-             valid_a_lib=no
-             case $deplibs_check_method in
-               match_pattern*)
-                 set dummy $deplibs_check_method; shift
-                 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-                 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
-                   | $EGREP "$match_pattern_regex" > /dev/null; then
-                   valid_a_lib=yes
-                 fi
-               ;;
-               pass_all)
-                 valid_a_lib=yes
-               ;;
-             esac
-             if test "$valid_a_lib" != yes; then
-               $ECHO
-               $ECHO "*** Warning: Trying to link with static lib archive $deplib."
-               $ECHO "*** I have the capability to make that library automatically link in when"
-               $ECHO "*** you link to this library.  But I can only do this if you have a"
-               $ECHO "*** shared version of the library, which you do not appear to have"
-               $ECHO "*** because the file extensions .$libext of this argument makes me believe"
-               $ECHO "*** that it is just a static archive that I should not use here."
-             else
-               $ECHO
-               $ECHO "*** Warning: Linking the shared library $output against the"
-               $ECHO "*** static library $deplib is not portable!"
-               deplibs="$deplib $deplibs"
-             fi
-             ;;
-           esac
-           continue
-           ;;
-         prog)
-           if test "$pass" != link; then
-             deplibs="$deplib $deplibs"
-           else
-             compile_deplibs="$deplib $compile_deplibs"
-             finalize_deplibs="$deplib $finalize_deplibs"
-           fi
-           continue
-           ;;
-         esac # linkmode
-         ;; # *.$libext
-       *.lo | *.$objext)
-         if test "$pass" = conv; then
-           deplibs="$deplib $deplibs"
-         elif test "$linkmode" = prog; then
-           if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
-             # If there is no dlopen support or we're linking statically,
-             # we need to preload.
-             newdlprefiles="$newdlprefiles $deplib"
-             compile_deplibs="$deplib $compile_deplibs"
-             finalize_deplibs="$deplib $finalize_deplibs"
-           else
-             newdlfiles="$newdlfiles $deplib"
-           fi
-         fi
-         continue
-         ;;
-       %DEPLIBS%)
-         alldeplibs=yes
-         continue
-         ;;
-       esac # case $deplib
-
-       if test "$found" = yes || test -f "$lib"; then :
-       else
-         func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
-       fi
-
-       # Check to see that this really is a libtool archive.
-       func_lalib_unsafe_p "$lib" \
-         || func_fatal_error "\`$lib' is not a valid libtool archive"
-
-       func_dirname "$lib" "" "."
-       ladir="$func_dirname_result"
-
-       dlname=
-       dlopen=
-       dlpreopen=
-       libdir=
-       library_names=
-       old_library=
-       inherited_linker_flags=
-       # If the library was installed with an old release of libtool,
-       # it will not redefine variables installed, or shouldnotlink
-       installed=yes
-       shouldnotlink=no
-       avoidtemprpath=
-
-
-       # Read the .la file
-       func_source "$lib"
-
-       # Convert "-framework foo" to "foo.ltframework"
-       if test -n "$inherited_linker_flags"; then
-         tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
-         for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
-           case " $new_inherited_linker_flags " in
-             *" $tmp_inherited_linker_flag "*) ;;
-             *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
-           esac
-         done
-       fi
-       dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-       if test "$linkmode,$pass" = "lib,link" ||
-          test "$linkmode,$pass" = "prog,scan" ||
-          { test "$linkmode" != prog && test "$linkmode" != lib; }; then
-         test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
-         test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
-       fi
-
-       if test "$pass" = conv; then
-         # Only check for convenience libraries
-         deplibs="$lib $deplibs"
-         if test -z "$libdir"; then
-           if test -z "$old_library"; then
-             func_fatal_error "cannot find name of link library for \`$lib'"
-           fi
-           # It is a libtool convenience library, so add in its objects.
-           convenience="$convenience $ladir/$objdir/$old_library"
-           old_convenience="$old_convenience $ladir/$objdir/$old_library"
-           tmp_libs=
-           for deplib in $dependency_libs; do
-             deplibs="$deplib $deplibs"
-             if $opt_duplicate_deps ; then
-               case "$tmp_libs " in
-               *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-               esac
-             fi
-             tmp_libs="$tmp_libs $deplib"
-           done
-         elif test "$linkmode" != prog && test "$linkmode" != lib; then
-           func_fatal_error "\`$lib' is not a convenience library"
-         fi
-         continue
-       fi # $pass = conv
-
-
-       # Get the name of the library we link against.
-       linklib=
-       for l in $old_library $library_names; do
-         linklib="$l"
-       done
-       if test -z "$linklib"; then
-         func_fatal_error "cannot find name of link library for \`$lib'"
-       fi
-
-       # This library was specified with -dlopen.
-       if test "$pass" = dlopen; then
-         if test -z "$libdir"; then
-           func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
-         fi
-         if test -z "$dlname" ||
-            test "$dlopen_support" != yes ||
-            test "$build_libtool_libs" = no; then
-           # If there is no dlname, no dlopen support or we're linking
-           # statically, we need to preload.  We also need to preload any
-           # dependent libraries so libltdl's deplib preloader doesn't
-           # bomb out in the load deplibs phase.
-           dlprefiles="$dlprefiles $lib $dependency_libs"
-         else
-           newdlfiles="$newdlfiles $lib"
-         fi
-         continue
-       fi # $pass = dlopen
-
-       # We need an absolute path.
-       case $ladir in
-       [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
-       *)
-         abs_ladir=`cd "$ladir" && pwd`
-         if test -z "$abs_ladir"; then
-           func_warning "cannot determine absolute directory name of \`$ladir'"
-           func_warning "passing it literally to the linker, although it might fail"
-           abs_ladir="$ladir"
-         fi
-         ;;
-       esac
-       func_basename "$lib"
-       laname="$func_basename_result"
-
-       # Find the relevant object directory and library name.
-       if test "X$installed" = Xyes; then
-         if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-           func_warning "library \`$lib' was moved."
-           dir="$ladir"
-           absdir="$abs_ladir"
-           libdir="$abs_ladir"
-         else
-           dir="$libdir"
-           absdir="$libdir"
-         fi
-         test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
-       else
-         if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-           dir="$ladir"
-           absdir="$abs_ladir"
-           # Remove this search path later
-           notinst_path="$notinst_path $abs_ladir"
-         else
-           dir="$ladir/$objdir"
-           absdir="$abs_ladir/$objdir"
-           # Remove this search path later
-           notinst_path="$notinst_path $abs_ladir"
-         fi
-       fi # $installed = yes
-       func_stripname 'lib' '.la' "$laname"
-       name=$func_stripname_result
-
-       # This library was specified with -dlpreopen.
-       if test "$pass" = dlpreopen; then
-         if test -z "$libdir" && test "$linkmode" = prog; then
-           func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
-         fi
-         # Prefer using a static library (so that no silly _DYNAMIC symbols
-         # are required to link).
-         if test -n "$old_library"; then
-           newdlprefiles="$newdlprefiles $dir/$old_library"
-           # Keep a list of preopened convenience libraries to check
-           # that they are being used correctly in the link pass.
-           test -z "$libdir" && \
-               dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
-         # Otherwise, use the dlname, so that lt_dlopen finds it.
-         elif test -n "$dlname"; then
-           newdlprefiles="$newdlprefiles $dir/$dlname"
-         else
-           newdlprefiles="$newdlprefiles $dir/$linklib"
-         fi
-       fi # $pass = dlpreopen
-
-       if test -z "$libdir"; then
-         # Link the convenience library
-         if test "$linkmode" = lib; then
-           deplibs="$dir/$old_library $deplibs"
-         elif test "$linkmode,$pass" = "prog,link"; then
-           compile_deplibs="$dir/$old_library $compile_deplibs"
-           finalize_deplibs="$dir/$old_library $finalize_deplibs"
-         else
-           deplibs="$lib $deplibs" # used for prog,scan pass
-         fi
-         continue
-       fi
-
-
-       if test "$linkmode" = prog && test "$pass" != link; then
-         newlib_search_path="$newlib_search_path $ladir"
-         deplibs="$lib $deplibs"
-
-         linkalldeplibs=no
-         if test "$link_all_deplibs" != no || test -z "$library_names" ||
-            test "$build_libtool_libs" = no; then
-           linkalldeplibs=yes
-         fi
-
-         tmp_libs=
-         for deplib in $dependency_libs; do
-           case $deplib in
-           -L*) func_stripname '-L' '' "$deplib"
-                newlib_search_path="$newlib_search_path $func_stripname_result"
-                ;;
-           esac
-           # Need to link against all dependency_libs?
-           if test "$linkalldeplibs" = yes; then
-             deplibs="$deplib $deplibs"
-           else
-             # Need to hardcode shared library paths
-             # or/and link against static libraries
-             newdependency_libs="$deplib $newdependency_libs"
-           fi
-           if $opt_duplicate_deps ; then
-             case "$tmp_libs " in
-             *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-             esac
-           fi
-           tmp_libs="$tmp_libs $deplib"
-         done # for deplib
-         continue
-       fi # $linkmode = prog...
-
-       if test "$linkmode,$pass" = "prog,link"; then
-         if test -n "$library_names" &&
-            { { test "$prefer_static_libs" = no ||
-                test "$prefer_static_libs,$installed" = "built,yes"; } ||
-              test -z "$old_library"; }; then
-           # We need to hardcode the library path
-           if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
-             # Make sure the rpath contains only unique directories.
-             case "$temp_rpath:" in
-             *"$absdir:"*) ;;
-             *) temp_rpath="$temp_rpath$absdir:" ;;
-             esac
-           fi
-
-           # Hardcode the library path.
-           # Skip directories that are in the system default run-time
-           # search path.
-           case " $sys_lib_dlsearch_path " in
-           *" $absdir "*) ;;
-           *)
-             case "$compile_rpath " in
-             *" $absdir "*) ;;
-             *) compile_rpath="$compile_rpath $absdir"
-             esac
-             ;;
-           esac
-           case " $sys_lib_dlsearch_path " in
-           *" $libdir "*) ;;
-           *)
-             case "$finalize_rpath " in
-             *" $libdir "*) ;;
-             *) finalize_rpath="$finalize_rpath $libdir"
-             esac
-             ;;
-           esac
-         fi # $linkmode,$pass = prog,link...
-
-         if test "$alldeplibs" = yes &&
-            { test "$deplibs_check_method" = pass_all ||
-              { test "$build_libtool_libs" = yes &&
-                test -n "$library_names"; }; }; then
-           # We only need to search for static libraries
-           continue
-         fi
-       fi
-
-       link_static=no # Whether the deplib will be linked statically
-       use_static_libs=$prefer_static_libs
-       if test "$use_static_libs" = built && test "$installed" = yes; then
-         use_static_libs=no
-       fi
-       if test -n "$library_names" &&
-          { test "$use_static_libs" = no || test -z "$old_library"; }; then
-         case $host in
-         *cygwin* | *mingw* | *cegcc*)
-             # No point in relinking DLLs because paths are not encoded
-             notinst_deplibs="$notinst_deplibs $lib"
-             need_relink=no
-           ;;
-         *)
-           if test "$installed" = no; then
-             notinst_deplibs="$notinst_deplibs $lib"
-             need_relink=yes
-           fi
-           ;;
-         esac
-         # This is a shared library
-
-         # Warn about portability, can't link against -module's on some
-         # systems (darwin).  Don't bleat about dlopened modules though!
-         dlopenmodule=""
-         for dlpremoduletest in $dlprefiles; do
-           if test "X$dlpremoduletest" = "X$lib"; then
-             dlopenmodule="$dlpremoduletest"
-             break
-           fi
-         done
-         if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
-           $ECHO
-           if test "$linkmode" = prog; then
-             $ECHO "*** Warning: Linking the executable $output against the loadable module"
-           else
-             $ECHO "*** Warning: Linking the shared library $output against the loadable module"
-           fi
-           $ECHO "*** $linklib is not portable!"
-         fi
-         if test "$linkmode" = lib &&
-            test "$hardcode_into_libs" = yes; then
-           # Hardcode the library path.
-           # Skip directories that are in the system default run-time
-           # search path.
-           case " $sys_lib_dlsearch_path " in
-           *" $absdir "*) ;;
-           *)
-             case "$compile_rpath " in
-             *" $absdir "*) ;;
-             *) compile_rpath="$compile_rpath $absdir"
-             esac
-             ;;
-           esac
-           case " $sys_lib_dlsearch_path " in
-           *" $libdir "*) ;;
-           *)
-             case "$finalize_rpath " in
-             *" $libdir "*) ;;
-             *) finalize_rpath="$finalize_rpath $libdir"
-             esac
-             ;;
-           esac
-         fi
-
-         if test -n "$old_archive_from_expsyms_cmds"; then
-           # figure out the soname
-           set dummy $library_names
-           shift
-           realname="$1"
-           shift
-           libname=`eval "\\$ECHO \"$libname_spec\""`
-           # use dlname if we got it. it's perfectly good, no?
-           if test -n "$dlname"; then
-             soname="$dlname"
-           elif test -n "$soname_spec"; then
-             # bleh windows
-             case $host in
-             *cygwin* | mingw* | *cegcc*)
-               func_arith $current - $age
-               major=$func_arith_result
-               versuffix="-$major"
-               ;;
-             esac
-             eval soname=\"$soname_spec\"
-           else
-             soname="$realname"
-           fi
-
-           # Make a new name for the extract_expsyms_cmds to use
-           soroot="$soname"
-           func_basename "$soroot"
-           soname="$func_basename_result"
-           func_stripname 'lib' '.dll' "$soname"
-           newlib=libimp-$func_stripname_result.a
-
-           # If the library has no export list, then create one now
-           if test -f "$output_objdir/$soname-def"; then :
-           else
-             func_verbose "extracting exported symbol list from \`$soname'"
-             func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
-           fi
-
-           # Create $newlib
-           if test -f "$output_objdir/$newlib"; then :; else
-             func_verbose "generating import library for \`$soname'"
-             func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
-           fi
-           # make sure the library variables are pointing to the new library
-           dir=$output_objdir
-           linklib=$newlib
-         fi # test -n "$old_archive_from_expsyms_cmds"
-
-         if test "$linkmode" = prog || test "$mode" != relink; then
-           add_shlibpath=
-           add_dir=
-           add=
-           lib_linked=yes
-           case $hardcode_action in
-           immediate | unsupported)
-             if test "$hardcode_direct" = no; then
-               add="$dir/$linklib"
-               case $host in
-                 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
-                 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
-                 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
-                   *-*-unixware7*) add_dir="-L$dir" ;;
-                 *-*-darwin* )
-                   # if the lib is a (non-dlopened) module then we can not
-                   # link against it, someone is ignoring the earlier warnings
-                   if /usr/bin/file -L $add 2> /dev/null |
-                        $GREP ": [^:]* bundle" >/dev/null ; then
-                     if test "X$dlopenmodule" != "X$lib"; then
-                       $ECHO "*** Warning: lib $linklib is a module, not a shared library"
-                       if test -z "$old_library" ; then
-                         $ECHO
-                         $ECHO "*** And there doesn't seem to be a static archive available"
-                         $ECHO "*** The link will probably fail, sorry"
-                       else
-                         add="$dir/$old_library"
-                       fi
-                     elif test -n "$old_library"; then
-                       add="$dir/$old_library"
-                     fi
-                   fi
-               esac
-             elif test "$hardcode_minus_L" = no; then
-               case $host in
-               *-*-sunos*) add_shlibpath="$dir" ;;
-               esac
-               add_dir="-L$dir"
-               add="-l$name"
-             elif test "$hardcode_shlibpath_var" = no; then
-               add_shlibpath="$dir"
-               add="-l$name"
-             else
-               lib_linked=no
-             fi
-             ;;
-           relink)
-             if test "$hardcode_direct" = yes &&
-                test "$hardcode_direct_absolute" = no; then
-               add="$dir/$linklib"
-             elif test "$hardcode_minus_L" = yes; then
-               add_dir="-L$dir"
-               # Try looking first in the location we're being installed to.
-               if test -n "$inst_prefix_dir"; then
-                 case $libdir in
-                   [\\/]*)
-                     add_dir="$add_dir -L$inst_prefix_dir$libdir"
-                     ;;
-                 esac
-               fi
-               add="-l$name"
-             elif test "$hardcode_shlibpath_var" = yes; then
-               add_shlibpath="$dir"
-               add="-l$name"
-             else
-               lib_linked=no
-             fi
-             ;;
-           *) lib_linked=no ;;
-           esac
-
-           if test "$lib_linked" != yes; then
-             func_fatal_configuration "unsupported hardcode properties"
-           fi
-
-           if test -n "$add_shlibpath"; then
-             case :$compile_shlibpath: in
-             *":$add_shlibpath:"*) ;;
-             *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
-             esac
-           fi
-           if test "$linkmode" = prog; then
-             test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
-             test -n "$add" && compile_deplibs="$add $compile_deplibs"
-           else
-             test -n "$add_dir" && deplibs="$add_dir $deplibs"
-             test -n "$add" && deplibs="$add $deplibs"
-             if test "$hardcode_direct" != yes &&
-                test "$hardcode_minus_L" != yes &&
-                test "$hardcode_shlibpath_var" = yes; then
-               case :$finalize_shlibpath: in
-               *":$libdir:"*) ;;
-               *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
-               esac
-             fi
-           fi
-         fi
-
-         if test "$linkmode" = prog || test "$mode" = relink; then
-           add_shlibpath=
-           add_dir=
-           add=
-           # Finalize command for both is simple: just hardcode it.
-           if test "$hardcode_direct" = yes &&
-              test "$hardcode_direct_absolute" = no; then
-             add="$libdir/$linklib"
-           elif test "$hardcode_minus_L" = yes; then
-             add_dir="-L$libdir"
-             add="-l$name"
-           elif test "$hardcode_shlibpath_var" = yes; then
-             case :$finalize_shlibpath: in
-             *":$libdir:"*) ;;
-             *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
-             esac
-             add="-l$name"
-           elif test "$hardcode_automatic" = yes; then
-             if test -n "$inst_prefix_dir" &&
-                test -f "$inst_prefix_dir$libdir/$linklib" ; then
-               add="$inst_prefix_dir$libdir/$linklib"
-             else
-               add="$libdir/$linklib"
-             fi
-           else
-             # We cannot seem to hardcode it, guess we'll fake it.
-             add_dir="-L$libdir"
-             # Try looking first in the location we're being installed to.
-             if test -n "$inst_prefix_dir"; then
-               case $libdir in
-                 [\\/]*)
-                   add_dir="$add_dir -L$inst_prefix_dir$libdir"
-                   ;;
-               esac
-             fi
-             add="-l$name"
-           fi
-
-           if test "$linkmode" = prog; then
-             test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
-             test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
-           else
-             test -n "$add_dir" && deplibs="$add_dir $deplibs"
-             test -n "$add" && deplibs="$add $deplibs"
-           fi
-         fi
-       elif test "$linkmode" = prog; then
-         # Here we assume that one of hardcode_direct or hardcode_minus_L
-         # is not unsupported.  This is valid on all known static and
-         # shared platforms.
-         if test "$hardcode_direct" != unsupported; then
-           test -n "$old_library" && linklib="$old_library"
-           compile_deplibs="$dir/$linklib $compile_deplibs"
-           finalize_deplibs="$dir/$linklib $finalize_deplibs"
-         else
-           compile_deplibs="-l$name -L$dir $compile_deplibs"
-           finalize_deplibs="-l$name -L$dir $finalize_deplibs"
-         fi
-       elif test "$build_libtool_libs" = yes; then
-         # Not a shared library
-         if test "$deplibs_check_method" != pass_all; then
-           # We're trying link a shared library against a static one
-           # but the system doesn't support it.
-
-           # Just print a warning and add the library to dependency_libs so
-           # that the program can be linked against the static library.
-           $ECHO
-           $ECHO "*** Warning: This system can not link to static lib archive $lib."
-           $ECHO "*** I have the capability to make that library automatically link in when"
-           $ECHO "*** you link to this library.  But I can only do this if you have a"
-           $ECHO "*** shared version of the library, which you do not appear to have."
-           if test "$module" = yes; then
-             $ECHO "*** But as you try to build a module library, libtool will still create "
-             $ECHO "*** a static module, that should work as long as the dlopening application"
-             $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
-             if test -z "$global_symbol_pipe"; then
-               $ECHO
-               $ECHO "*** However, this would only work if libtool was able to extract symbol"
-               $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
-               $ECHO "*** not find such a program.  So, this module is probably useless."
-               $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
-             fi
-             if test "$build_old_libs" = no; then
-               build_libtool_libs=module
-               build_old_libs=yes
-             else
-               build_libtool_libs=no
-             fi
-           fi
-         else
-           deplibs="$dir/$old_library $deplibs"
-           link_static=yes
-         fi
-       fi # link shared/static library?
-
-       if test "$linkmode" = lib; then
-         if test -n "$dependency_libs" &&
-            { test "$hardcode_into_libs" != yes ||
-              test "$build_old_libs" = yes ||
-              test "$link_static" = yes; }; then
-           # Extract -R from dependency_libs
-           temp_deplibs=
-           for libdir in $dependency_libs; do
-             case $libdir in
-             -R*) func_stripname '-R' '' "$libdir"
-                  temp_xrpath=$func_stripname_result
-                  case " $xrpath " in
-                  *" $temp_xrpath "*) ;;
-                  *) xrpath="$xrpath $temp_xrpath";;
-                  esac;;
-             *) temp_deplibs="$temp_deplibs $libdir";;
-             esac
-           done
-           dependency_libs="$temp_deplibs"
-         fi
-
-         newlib_search_path="$newlib_search_path $absdir"
-         # Link against this library
-         test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
-         # ... and its dependency_libs
-         tmp_libs=
-         for deplib in $dependency_libs; do
-           newdependency_libs="$deplib $newdependency_libs"
-           if $opt_duplicate_deps ; then
-             case "$tmp_libs " in
-             *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-             esac
-           fi
-           tmp_libs="$tmp_libs $deplib"
-         done
-
-         if test "$link_all_deplibs" != no; then
-           # Add the search paths of all dependency libraries
-           for deplib in $dependency_libs; do
-             path=
-             case $deplib in
-             -L*) path="$deplib" ;;
-             *.la)
-               func_dirname "$deplib" "" "."
-               dir="$func_dirname_result"
-               # We need an absolute path.
-               case $dir in
-               [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
-               *)
-                 absdir=`cd "$dir" && pwd`
-                 if test -z "$absdir"; then
-                   func_warning "cannot determine absolute directory name of \`$dir'"
-                   absdir="$dir"
-                 fi
-                 ;;
-               esac
-               if $GREP "^installed=no" $deplib > /dev/null; then
-               case $host in
-               *-*-darwin*)
-                 depdepl=
-                 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
-                 if test -n "$deplibrary_names" ; then
-                   for tmp in $deplibrary_names ; do
-                     depdepl=$tmp
-                   done
-                   if test -f "$absdir/$objdir/$depdepl" ; then
-                     depdepl="$absdir/$objdir/$depdepl"
-                     darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
-                      if test -z "$darwin_install_name"; then
-                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
-                      fi
-                     compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
-                     linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
-                     path=
-                   fi
-                 fi
-                 ;;
-               *)
-                 path="-L$absdir/$objdir"
-                 ;;
-               esac
-               else
-                 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
-                 test -z "$libdir" && \
-                   func_fatal_error "\`$deplib' is not a valid libtool archive"
-                 test "$absdir" != "$libdir" && \
-                   func_warning "\`$deplib' seems to be moved"
-
-                 path="-L$absdir"
-               fi
-               ;;
-             esac
-             case " $deplibs " in
-             *" $path "*) ;;
-             *) deplibs="$path $deplibs" ;;
-             esac
-           done
-         fi # link_all_deplibs != no
-       fi # linkmode = lib
-      done # for deplib in $libs
-      if test "$pass" = link; then
-       if test "$linkmode" = "prog"; then
-         compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
-         finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
-       else
-         compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-       fi
-      fi
-      dependency_libs="$newdependency_libs"
-      if test "$pass" = dlpreopen; then
-       # Link the dlpreopened libraries before other libraries
-       for deplib in $save_deplibs; do
-         deplibs="$deplib $deplibs"
-       done
-      fi
-      if test "$pass" != dlopen; then
-       if test "$pass" != conv; then
-         # Make sure lib_search_path contains only unique directories.
-         lib_search_path=
-         for dir in $newlib_search_path; do
-           case "$lib_search_path " in
-           *" $dir "*) ;;
-           *) lib_search_path="$lib_search_path $dir" ;;
-           esac
-         done
-         newlib_search_path=
-       fi
-
-       if test "$linkmode,$pass" != "prog,link"; then
-         vars="deplibs"
-       else
-         vars="compile_deplibs finalize_deplibs"
-       fi
-       for var in $vars dependency_libs; do
-         # Add libraries to $var in reverse order
-         eval tmp_libs=\"\$$var\"
-         new_libs=
-         for deplib in $tmp_libs; do
-           # FIXME: Pedantically, this is the right thing to do, so
-           #        that some nasty dependency loop isn't accidentally
-           #        broken:
-           #new_libs="$deplib $new_libs"
-           # Pragmatically, this seems to cause very few problems in
-           # practice:
-           case $deplib in
-           -L*) new_libs="$deplib $new_libs" ;;
-           -R*) ;;
-           *)
-             # And here is the reason: when a library appears more
-             # than once as an explicit dependence of a library, or
-             # is implicitly linked in more than once by the
-             # compiler, it is considered special, and multiple
-             # occurrences thereof are not removed.  Compare this
-             # with having the same library being listed as a
-             # dependency of multiple other libraries: in this case,
-             # we know (pedantically, we assume) the library does not
-             # need to be listed more than once, so we keep only the
-             # last copy.  This is not always right, but it is rare
-             # enough that we require users that really mean to play
-             # such unportable linking tricks to link the library
-             # using -Wl,-lname, so that libtool does not consider it
-             # for duplicate removal.
-             case " $specialdeplibs " in
-             *" $deplib "*) new_libs="$deplib $new_libs" ;;
-             *)
-               case " $new_libs " in
-               *" $deplib "*) ;;
-               *) new_libs="$deplib $new_libs" ;;
-               esac
-               ;;
-             esac
-             ;;
-           esac
-         done
-         tmp_libs=
-         for deplib in $new_libs; do
-           case $deplib in
-           -L*)
-             case " $tmp_libs " in
-             *" $deplib "*) ;;
-             *) tmp_libs="$tmp_libs $deplib" ;;
-             esac
-             ;;
-           *) tmp_libs="$tmp_libs $deplib" ;;
-           esac
-         done
-         eval $var=\"$tmp_libs\"
-       done # for var
-      fi
-      # Last step: remove runtime libs from dependency_libs
-      # (they stay in deplibs)
-      tmp_libs=
-      for i in $dependency_libs ; do
-       case " $predeps $postdeps $compiler_lib_search_path " in
-       *" $i "*)
-         i=""
-         ;;
-       esac
-       if test -n "$i" ; then
-         tmp_libs="$tmp_libs $i"
-       fi
-      done
-      dependency_libs=$tmp_libs
-    done # for pass
-    if test "$linkmode" = prog; then
-      dlfiles="$newdlfiles"
-    fi
-    if test "$linkmode" = prog || test "$linkmode" = lib; then
-      dlprefiles="$newdlprefiles"
-    fi
-
-    case $linkmode in
-    oldlib)
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-       func_warning "\`-dlopen' is ignored for archives"
-      fi
-
-      case " $deplibs" in
-      *\ -l* | *\ -L*)
-       func_warning "\`-l' and \`-L' are ignored for archives" ;;
-      esac
-
-      test -n "$rpath" && \
-       func_warning "\`-rpath' is ignored for archives"
-
-      test -n "$xrpath" && \
-       func_warning "\`-R' is ignored for archives"
-
-      test -n "$vinfo" && \
-       func_warning "\`-version-info/-version-number' is ignored for archives"
-
-      test -n "$release" && \
-       func_warning "\`-release' is ignored for archives"
-
-      test -n "$export_symbols$export_symbols_regex" && \
-       func_warning "\`-export-symbols' is ignored for archives"
-
-      # Now set the variables for building old libraries.
-      build_libtool_libs=no
-      oldlibs="$output"
-      objs="$objs$old_deplibs"
-      ;;
-
-    lib)
-      # Make sure we only generate libraries of the form `libNAME.la'.
-      case $outputname in
-      lib*)
-       func_stripname 'lib' '.la' "$outputname"
-       name=$func_stripname_result
-       eval shared_ext=\"$shrext_cmds\"
-       eval libname=\"$libname_spec\"
-       ;;
-      *)
-       test "$module" = no && \
-         func_fatal_help "libtool library \`$output' must begin with \`lib'"
-
-       if test "$need_lib_prefix" != no; then
-         # Add the "lib" prefix for modules if required
-         func_stripname '' '.la' "$outputname"
-         name=$func_stripname_result
-         eval shared_ext=\"$shrext_cmds\"
-         eval libname=\"$libname_spec\"
-       else
-         func_stripname '' '.la' "$outputname"
-         libname=$func_stripname_result
-       fi
-       ;;
-      esac
-
-      if test -n "$objs"; then
-       if test "$deplibs_check_method" != pass_all; then
-         func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
-       else
-         $ECHO
-         $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
-         $ECHO "*** objects $objs is not portable!"
-         libobjs="$libobjs $objs"
-       fi
-      fi
-
-      test "$dlself" != no && \
-       func_warning "\`-dlopen self' is ignored for libtool libraries"
-
-      set dummy $rpath
-      shift
-      test "$#" -gt 1 && \
-       func_warning "ignoring multiple \`-rpath's for a libtool library"
-
-      install_libdir="$1"
-
-      oldlibs=
-      if test -z "$rpath"; then
-       if test "$build_libtool_libs" = yes; then
-         # Building a libtool convenience library.
-         # Some compilers have problems with a `.al' extension so
-         # convenience libraries should have the same extension an
-         # archive normally would.
-         oldlibs="$output_objdir/$libname.$libext $oldlibs"
-         build_libtool_libs=convenience
-         build_old_libs=yes
-       fi
-
-       test -n "$vinfo" && \
-         func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
-
-       test -n "$release" && \
-         func_warning "\`-release' is ignored for convenience libraries"
-      else
-
-       # Parse the version information argument.
-       save_ifs="$IFS"; IFS=':'
-       set dummy $vinfo 0 0 0
-       shift
-       IFS="$save_ifs"
-
-       test -n "$7" && \
-         func_fatal_help "too many parameters to \`-version-info'"
-
-       # convert absolute version numbers to libtool ages
-       # this retains compatibility with .la files and attempts
-       # to make the code below a bit more comprehensible
-
-       case $vinfo_number in
-       yes)
-         number_major="$1"
-         number_minor="$2"
-         number_revision="$3"
-         #
-         # There are really only two kinds -- those that
-         # use the current revision as the major version
-         # and those that subtract age and use age as
-         # a minor version.  But, then there is irix
-         # which has an extra 1 added just for fun
-         #
-         case $version_type in
-         darwin|linux|osf|windows|none)
-           func_arith $number_major + $number_minor
-           current=$func_arith_result
-           age="$number_minor"
-           revision="$number_revision"
-           ;;
-         freebsd-aout|freebsd-elf|sunos)
-           current="$number_major"
-           revision="$number_minor"
-           age="0"
-           ;;
-         irix|nonstopux)
-           func_arith $number_major + $number_minor
-           current=$func_arith_result
-           age="$number_minor"
-           revision="$number_minor"
-           lt_irix_increment=no
-           ;;
-         *)
-           func_fatal_configuration "$modename: unknown library version type \`$version_type'"
-           ;;
-         esac
-         ;;
-       no)
-         current="$1"
-         revision="$2"
-         age="$3"
-         ;;
-       esac
-
-       # Check that each of the things are valid numbers.
-       case $current in
-       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-       *)
-         func_error "CURRENT \`$current' must be a nonnegative integer"
-         func_fatal_error "\`$vinfo' is not valid version information"
-         ;;
-       esac
-
-       case $revision in
-       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-       *)
-         func_error "REVISION \`$revision' must be a nonnegative integer"
-         func_fatal_error "\`$vinfo' is not valid version information"
-         ;;
-       esac
-
-       case $age in
-       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-       *)
-         func_error "AGE \`$age' must be a nonnegative integer"
-         func_fatal_error "\`$vinfo' is not valid version information"
-         ;;
-       esac
-
-       if test "$age" -gt "$current"; then
-         func_error "AGE \`$age' is greater than the current interface number \`$current'"
-         func_fatal_error "\`$vinfo' is not valid version information"
-       fi
-
-       # Calculate the version variables.
-       major=
-       versuffix=
-       verstring=
-       case $version_type in
-       none) ;;
-
-       darwin)
-         # Like Linux, but with the current version available in
-         # verstring for coding it into the library header
-         func_arith $current - $age
-         major=.$func_arith_result
-         versuffix="$major.$age.$revision"
-         # Darwin ld doesn't like 0 for these options...
-         func_arith $current + 1
-         minor_current=$func_arith_result
-         xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
-         verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
-         ;;
-
-       freebsd-aout)
-         major=".$current"
-         versuffix=".$current.$revision";
-         ;;
-
-       freebsd-elf)
-         major=".$current"
-         versuffix=".$current"
-         ;;
-
-       irix | nonstopux)
-         if test "X$lt_irix_increment" = "Xno"; then
-           func_arith $current - $age
-         else
-           func_arith $current - $age + 1
-         fi
-         major=$func_arith_result
-
-         case $version_type in
-           nonstopux) verstring_prefix=nonstopux ;;
-           *)         verstring_prefix=sgi ;;
-         esac
-         verstring="$verstring_prefix$major.$revision"
-
-         # Add in all the interfaces that we are compatible with.
-         loop=$revision
-         while test "$loop" -ne 0; do
-           func_arith $revision - $loop
-           iface=$func_arith_result
-           func_arith $loop - 1
-           loop=$func_arith_result
-           verstring="$verstring_prefix$major.$iface:$verstring"
-         done
-
-         # Before this point, $major must not contain `.'.
-         major=.$major
-         versuffix="$major.$revision"
-         ;;
-
-       linux)
-         func_arith $current - $age
-         major=.$func_arith_result
-         versuffix="$major.$age.$revision"
-         ;;
-
-       osf)
-         func_arith $current - $age
-         major=.$func_arith_result
-         versuffix=".$current.$age.$revision"
-         verstring="$current.$age.$revision"
-
-         # Add in all the interfaces that we are compatible with.
-         loop=$age
-         while test "$loop" -ne 0; do
-           func_arith $current - $loop
-           iface=$func_arith_result
-           func_arith $loop - 1
-           loop=$func_arith_result
-           verstring="$verstring:${iface}.0"
-         done
-
-         # Make executables depend on our current version.
-         verstring="$verstring:${current}.0"
-         ;;
-
-       qnx)
-         major=".$current"
-         versuffix=".$current"
-         ;;
-
-       sunos)
-         major=".$current"
-         versuffix=".$current.$revision"
-         ;;
-
-       windows)
-         # Use '-' rather than '.', since we only want one
-         # extension on DOS 8.3 filesystems.
-         func_arith $current - $age
-         major=$func_arith_result
-         versuffix="-$major"
-         ;;
-
-       *)
-         func_fatal_configuration "unknown library version type \`$version_type'"
-         ;;
-       esac
-
-       # Clear the version info if we defaulted, and they specified a release.
-       if test -z "$vinfo" && test -n "$release"; then
-         major=
-         case $version_type in
-         darwin)
-           # we can't check for "0.0" in archive_cmds due to quoting
-           # problems, so we reset it completely
-           verstring=
-           ;;
-         *)
-           verstring="0.0"
-           ;;
-         esac
-         if test "$need_version" = no; then
-           versuffix=
-         else
-           versuffix=".0.0"
-         fi
-       fi
-
-       # Remove version info from name if versioning should be avoided
-       if test "$avoid_version" = yes && test "$need_version" = no; then
-         major=
-         versuffix=
-         verstring=""
-       fi
-
-       # Check to see if the archive will have undefined symbols.
-       if test "$allow_undefined" = yes; then
-         if test "$allow_undefined_flag" = unsupported; then
-           func_warning "undefined symbols not allowed in $host shared libraries"
-           build_libtool_libs=no
-           build_old_libs=yes
-         fi
-       else
-         # Don't allow undefined symbols.
-         allow_undefined_flag="$no_undefined_flag"
-       fi
-
-      fi
-
-      func_generate_dlsyms "$libname" "$libname" "yes"
-      libobjs="$libobjs $symfileobj"
-      test "X$libobjs" = "X " && libobjs=
-
-      if test "$mode" != relink; then
-       # Remove our outputs, but don't remove object files since they
-       # may have been created when compiling PIC objects.
-       removelist=
-       tempremovelist=`$ECHO "$output_objdir/*"`
-       for p in $tempremovelist; do
-         case $p in
-           *.$objext | *.gcno)
-              ;;
-           $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
-              if test "X$precious_files_regex" != "X"; then
-                if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
-                then
-                  continue
-                fi
-              fi
-              removelist="$removelist $p"
-              ;;
-           *) ;;
-         esac
-       done
-       test -n "$removelist" && \
-         func_show_eval "${RM}r \$removelist"
-      fi
-
-      # Now set the variables for building old libraries.
-      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
-       oldlibs="$oldlibs $output_objdir/$libname.$libext"
-
-       # Transform .lo files to .o files.
-       oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
-      fi
-
-      # Eliminate all temporary directories.
-      #for path in $notinst_path; do
-      #        lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
-      #        deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
-      #        dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
-      #done
-
-      if test -n "$xrpath"; then
-       # If the user specified any rpath flags, then add them.
-       temp_xrpath=
-       for libdir in $xrpath; do
-         temp_xrpath="$temp_xrpath -R$libdir"
-         case "$finalize_rpath " in
-         *" $libdir "*) ;;
-         *) finalize_rpath="$finalize_rpath $libdir" ;;
-         esac
-       done
-       if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
-         dependency_libs="$temp_xrpath $dependency_libs"
-       fi
-      fi
-
-      # Make sure dlfiles contains only unique files that won't be dlpreopened
-      old_dlfiles="$dlfiles"
-      dlfiles=
-      for lib in $old_dlfiles; do
-       case " $dlprefiles $dlfiles " in
-       *" $lib "*) ;;
-       *) dlfiles="$dlfiles $lib" ;;
-       esac
-      done
-
-      # Make sure dlprefiles contains only unique files
-      old_dlprefiles="$dlprefiles"
-      dlprefiles=
-      for lib in $old_dlprefiles; do
-       case "$dlprefiles " in
-       *" $lib "*) ;;
-       *) dlprefiles="$dlprefiles $lib" ;;
-       esac
-      done
-
-      if test "$build_libtool_libs" = yes; then
-       if test -n "$rpath"; then
-         case $host in
-         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
-           # these systems don't actually have a c library (as such)!
-           ;;
-         *-*-rhapsody* | *-*-darwin1.[012])
-           # Rhapsody C library is in the System framework
-           deplibs="$deplibs System.ltframework"
-           ;;
-         *-*-netbsd*)
-           # Don't link with libc until the a.out ld.so is fixed.
-           ;;
-         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
-           # Do not include libc due to us having libc/libc_r.
-           ;;
-         *-*-sco3.2v5* | *-*-sco5v6*)
-           # Causes problems with __ctype
-           ;;
-         *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
-           # Compiler inserts libc in the correct place for threads to work
-           ;;
-         *)
-           # Add libc to deplibs on all other systems if necessary.
-           if test "$build_libtool_need_lc" = "yes"; then
-             deplibs="$deplibs -lc"
-           fi
-           ;;
-         esac
-       fi
-
-       # Transform deplibs into only deplibs that can be linked in shared.
-       name_save=$name
-       libname_save=$libname
-       release_save=$release
-       versuffix_save=$versuffix
-       major_save=$major
-       # I'm not sure if I'm treating the release correctly.  I think
-       # release should show up in the -l (ie -lgmp5) so we don't want to
-       # add it in twice.  Is that correct?
-       release=""
-       versuffix=""
-       major=""
-       newdeplibs=
-       droppeddeps=no
-       case $deplibs_check_method in
-       pass_all)
-         # Don't check for shared/static.  Everything works.
-         # This might be a little naive.  We might want to check
-         # whether the library exists or not.  But this is on
-         # osf3 & osf4 and I'm not really sure... Just
-         # implementing what was already the behavior.
-         newdeplibs=$deplibs
-         ;;
-       test_compile)
-         # This code stresses the "libraries are programs" paradigm to its
-         # limits. Maybe even breaks it.  We compile a program, linking it
-         # against the deplibs as a proxy for the library.  Then we can check
-         # whether they linked in statically or dynamically with ldd.
-         $opt_dry_run || $RM conftest.c
-         cat > conftest.c <<EOF
-         int main() { return 0; }
-EOF
-         $opt_dry_run || $RM conftest
-         if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
-           ldd_output=`ldd conftest`
-           for i in $deplibs; do
-             case $i in
-             -l*)
-               func_stripname -l '' "$i"
-               name=$func_stripname_result
-               if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-                 case " $predeps $postdeps " in
-                 *" $i "*)
-                   newdeplibs="$newdeplibs $i"
-                   i=""
-                   ;;
-                 esac
-               fi
-               if test -n "$i" ; then
-                 libname=`eval "\\$ECHO \"$libname_spec\""`
-                 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
-                 set dummy $deplib_matches; shift
-                 deplib_match=$1
-                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-                   newdeplibs="$newdeplibs $i"
-                 else
-                   droppeddeps=yes
-                   $ECHO
-                   $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-                   $ECHO "*** I have the capability to make that library automatically link in when"
-                   $ECHO "*** you link to this library.  But I can only do this if you have a"
-                   $ECHO "*** shared version of the library, which I believe you do not have"
-                   $ECHO "*** because a test_compile did reveal that the linker did not use it for"
-                   $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
-                 fi
-               fi
-               ;;
-             *)
-               newdeplibs="$newdeplibs $i"
-               ;;
-             esac
-           done
-         else
-           # Error occurred in the first compile.  Let's try to salvage
-           # the situation: Compile a separate program for each library.
-           for i in $deplibs; do
-             case $i in
-             -l*)
-               func_stripname -l '' "$i"
-               name=$func_stripname_result
-               $opt_dry_run || $RM conftest
-               if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
-                 ldd_output=`ldd conftest`
-                 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-                   case " $predeps $postdeps " in
-                   *" $i "*)
-                     newdeplibs="$newdeplibs $i"
-                     i=""
-                     ;;
-                   esac
-                 fi
-                 if test -n "$i" ; then
-                   libname=`eval "\\$ECHO \"$libname_spec\""`
-                   deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
-                   set dummy $deplib_matches; shift
-                   deplib_match=$1
-                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-                     newdeplibs="$newdeplibs $i"
-                   else
-                     droppeddeps=yes
-                     $ECHO
-                     $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-                     $ECHO "*** I have the capability to make that library automatically link in when"
-                     $ECHO "*** you link to this library.  But I can only do this if you have a"
-                     $ECHO "*** shared version of the library, which you do not appear to have"
-                     $ECHO "*** because a test_compile did reveal that the linker did not use this one"
-                     $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
-                   fi
-                 fi
-               else
-                 droppeddeps=yes
-                 $ECHO
-                 $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
-                 $ECHO "*** make it link in!  You will probably need to install it or some"
-                 $ECHO "*** library that it depends on before this library will be fully"
-                 $ECHO "*** functional.  Installing it before continuing would be even better."
-               fi
-               ;;
-             *)
-               newdeplibs="$newdeplibs $i"
-               ;;
-             esac
-           done
-         fi
-         ;;
-       file_magic*)
-         set dummy $deplibs_check_method; shift
-         file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-         for a_deplib in $deplibs; do
-           case $a_deplib in
-           -l*)
-             func_stripname -l '' "$a_deplib"
-             name=$func_stripname_result
-             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-               case " $predeps $postdeps " in
-               *" $a_deplib "*)
-                 newdeplibs="$newdeplibs $a_deplib"
-                 a_deplib=""
-                 ;;
-               esac
-             fi
-             if test -n "$a_deplib" ; then
-               libname=`eval "\\$ECHO \"$libname_spec\""`
-               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-                 for potent_lib in $potential_libs; do
-                     # Follow soft links.
-                     if ls -lLd "$potent_lib" 2>/dev/null |
-                        $GREP " -> " >/dev/null; then
-                       continue
-                     fi
-                     # The statement above tries to avoid entering an
-                     # endless loop below, in case of cyclic links.
-                     # We might still enter an endless loop, since a link
-                     # loop can be closed while we follow links,
-                     # but so what?
-                     potlib="$potent_lib"
-                     while test -h "$potlib" 2>/dev/null; do
-                       potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
-                       case $potliblink in
-                       [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
-                       *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
-                       esac
-                     done
-                     if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
-                        $SED -e 10q |
-                        $EGREP "$file_magic_regex" > /dev/null; then
-                       newdeplibs="$newdeplibs $a_deplib"
-                       a_deplib=""
-                       break 2
-                     fi
-                 done
-               done
-             fi
-             if test -n "$a_deplib" ; then
-               droppeddeps=yes
-               $ECHO
-               $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-               $ECHO "*** I have the capability to make that library automatically link in when"
-               $ECHO "*** you link to this library.  But I can only do this if you have a"
-               $ECHO "*** shared version of the library, which you do not appear to have"
-               $ECHO "*** because I did check the linker path looking for a file starting"
-               if test -z "$potlib" ; then
-                 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
-               else
-                 $ECHO "*** with $libname and none of the candidates passed a file format test"
-                 $ECHO "*** using a file magic. Last file checked: $potlib"
-               fi
-             fi
-             ;;
-           *)
-             # Add a -L argument.
-             newdeplibs="$newdeplibs $a_deplib"
-             ;;
-           esac
-         done # Gone through all deplibs.
-         ;;
-       match_pattern*)
-         set dummy $deplibs_check_method; shift
-         match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-         for a_deplib in $deplibs; do
-           case $a_deplib in
-           -l*)
-             func_stripname -l '' "$a_deplib"
-             name=$func_stripname_result
-             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-               case " $predeps $postdeps " in
-               *" $a_deplib "*)
-                 newdeplibs="$newdeplibs $a_deplib"
-                 a_deplib=""
-                 ;;
-               esac
-             fi
-             if test -n "$a_deplib" ; then
-               libname=`eval "\\$ECHO \"$libname_spec\""`
-               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-                 for potent_lib in $potential_libs; do
-                   potlib="$potent_lib" # see symlink-check above in file_magic test
-                   if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
-                      $EGREP "$match_pattern_regex" > /dev/null; then
-                     newdeplibs="$newdeplibs $a_deplib"
-                     a_deplib=""
-                     break 2
-                   fi
-                 done
-               done
-             fi
-             if test -n "$a_deplib" ; then
-               droppeddeps=yes
-               $ECHO
-               $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-               $ECHO "*** I have the capability to make that library automatically link in when"
-               $ECHO "*** you link to this library.  But I can only do this if you have a"
-               $ECHO "*** shared version of the library, which you do not appear to have"
-               $ECHO "*** because I did check the linker path looking for a file starting"
-               if test -z "$potlib" ; then
-                 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
-               else
-                 $ECHO "*** with $libname and none of the candidates passed a file format test"
-                 $ECHO "*** using a regex pattern. Last file checked: $potlib"
-               fi
-             fi
-             ;;
-           *)
-             # Add a -L argument.
-             newdeplibs="$newdeplibs $a_deplib"
-             ;;
-           esac
-         done # Gone through all deplibs.
-         ;;
-       none | unknown | *)
-         newdeplibs=""
-         tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
-             -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
-         if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-           for i in $predeps $postdeps ; do
-             # can't use Xsed below, because $i might contain '/'
-             tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
-           done
-         fi
-         if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[      ]//g' |
-            $GREP . >/dev/null; then
-           $ECHO
-           if test "X$deplibs_check_method" = "Xnone"; then
-             $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
-           else
-             $ECHO "*** Warning: inter-library dependencies are not known to be supported."
-           fi
-           $ECHO "*** All declared inter-library dependencies are being dropped."
-           droppeddeps=yes
-         fi
-         ;;
-       esac
-       versuffix=$versuffix_save
-       major=$major_save
-       release=$release_save
-       libname=$libname_save
-       name=$name_save
-
-       case $host in
-       *-*-rhapsody* | *-*-darwin1.[012])
-         # On Rhapsody replace the C library with the System framework
-         newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
-         ;;
-       esac
-
-       if test "$droppeddeps" = yes; then
-         if test "$module" = yes; then
-           $ECHO
-           $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
-           $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
-           $ECHO "*** a static module, that should work as long as the dlopening"
-           $ECHO "*** application is linked with the -dlopen flag."
-           if test -z "$global_symbol_pipe"; then
-             $ECHO
-             $ECHO "*** However, this would only work if libtool was able to extract symbol"
-             $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
-             $ECHO "*** not find such a program.  So, this module is probably useless."
-             $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
-           fi
-           if test "$build_old_libs" = no; then
-             oldlibs="$output_objdir/$libname.$libext"
-             build_libtool_libs=module
-             build_old_libs=yes
-           else
-             build_libtool_libs=no
-           fi
-         else
-           $ECHO "*** The inter-library dependencies that have been dropped here will be"
-           $ECHO "*** automatically added whenever a program is linked with this library"
-           $ECHO "*** or is declared to -dlopen it."
-
-           if test "$allow_undefined" = no; then
-             $ECHO
-             $ECHO "*** Since this library must not contain undefined symbols,"
-             $ECHO "*** because either the platform does not support them or"
-             $ECHO "*** it was explicitly requested with -no-undefined,"
-             $ECHO "*** libtool will only create a static version of it."
-             if test "$build_old_libs" = no; then
-               oldlibs="$output_objdir/$libname.$libext"
-               build_libtool_libs=module
-               build_old_libs=yes
-             else
-               build_libtool_libs=no
-             fi
-           fi
-         fi
-       fi
-       # Done checking deplibs!
-       deplibs=$newdeplibs
-      fi
-      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
-      case $host in
-       *-*-darwin*)
-         newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-         new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-         deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-         ;;
-      esac
-
-      # move library search paths that coincide with paths to not yet
-      # installed libraries to the beginning of the library search list
-      new_libs=
-      for path in $notinst_path; do
-       case " $new_libs " in
-       *" -L$path/$objdir "*) ;;
-       *)
-         case " $deplibs " in
-         *" -L$path/$objdir "*)
-           new_libs="$new_libs -L$path/$objdir" ;;
-         esac
-         ;;
-       esac
-      done
-      for deplib in $deplibs; do
-       case $deplib in
-       -L*)
-         case " $new_libs " in
-         *" $deplib "*) ;;
-         *) new_libs="$new_libs $deplib" ;;
-         esac
-         ;;
-       *) new_libs="$new_libs $deplib" ;;
-       esac
-      done
-      deplibs="$new_libs"
-
-      # All the library-specific variables (install_libdir is set above).
-      library_names=
-      old_library=
-      dlname=
-
-      # Test again, we may have decided not to build it any more
-      if test "$build_libtool_libs" = yes; then
-       if test "$hardcode_into_libs" = yes; then
-         # Hardcode the library paths
-         hardcode_libdirs=
-         dep_rpath=
-         rpath="$finalize_rpath"
-         test "$mode" != relink && rpath="$compile_rpath$rpath"
-         for libdir in $rpath; do
-           if test -n "$hardcode_libdir_flag_spec"; then
-             if test -n "$hardcode_libdir_separator"; then
-               if test -z "$hardcode_libdirs"; then
-                 hardcode_libdirs="$libdir"
-               else
-                 # Just accumulate the unique libdirs.
-                 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-                 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-                   ;;
-                 *)
-                   hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-                   ;;
-                 esac
-               fi
-             else
-               eval flag=\"$hardcode_libdir_flag_spec\"
-               dep_rpath="$dep_rpath $flag"
-             fi
-           elif test -n "$runpath_var"; then
-             case "$perm_rpath " in
-             *" $libdir "*) ;;
-             *) perm_rpath="$perm_rpath $libdir" ;;
-             esac
-           fi
-         done
-         # Substitute the hardcoded libdirs into the rpath.
-         if test -n "$hardcode_libdir_separator" &&
-            test -n "$hardcode_libdirs"; then
-           libdir="$hardcode_libdirs"
-           if test -n "$hardcode_libdir_flag_spec_ld"; then
-             eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
-           else
-             eval dep_rpath=\"$hardcode_libdir_flag_spec\"
-           fi
-         fi
-         if test -n "$runpath_var" && test -n "$perm_rpath"; then
-           # We should set the runpath_var.
-           rpath=
-           for dir in $perm_rpath; do
-             rpath="$rpath$dir:"
-           done
-           eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
-         fi
-         test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
-       fi
-
-       shlibpath="$finalize_shlibpath"
-       test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
-       if test -n "$shlibpath"; then
-         eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
-       fi
-
-       # Get the real and link names of the library.
-       eval shared_ext=\"$shrext_cmds\"
-       eval library_names=\"$library_names_spec\"
-       set dummy $library_names
-       shift
-       realname="$1"
-       shift
-
-       if test -n "$soname_spec"; then
-         eval soname=\"$soname_spec\"
-       else
-         soname="$realname"
-       fi
-       if test -z "$dlname"; then
-         dlname=$soname
-       fi
-
-       lib="$output_objdir/$realname"
-       linknames=
-       for link
-       do
-         linknames="$linknames $link"
-       done
-
-       # Use standard objects if they are pic
-       test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-       test "X$libobjs" = "X " && libobjs=
-
-       delfiles=
-       if test -n "$export_symbols" && test -n "$include_expsyms"; then
-         $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
-         export_symbols="$output_objdir/$libname.uexp"
-         delfiles="$delfiles $export_symbols"
-       fi
-
-       orig_export_symbols=
-       case $host_os in
-       cygwin* | mingw* | cegcc*)
-         if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
-           # exporting using user supplied symfile
-           if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
-             # and it's NOT already a .def file. Must figure out
-             # which of the given symbols are data symbols and tag
-             # them as such. So, trigger use of export_symbols_cmds.
-             # export_symbols gets reassigned inside the "prepare
-             # the list of exported symbols" if statement, so the
-             # include_expsyms logic still works.
-             orig_export_symbols="$export_symbols"
-             export_symbols=
-             always_export_symbols=yes
-           fi
-         fi
-         ;;
-       esac
-
-       # Prepare the list of exported symbols
-       if test -z "$export_symbols"; then
-         if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
-           func_verbose "generating symbol list for \`$libname.la'"
-           export_symbols="$output_objdir/$libname.exp"
-           $opt_dry_run || $RM $export_symbols
-           cmds=$export_symbols_cmds
-           save_ifs="$IFS"; IFS='~'
-           for cmd in $cmds; do
-             IFS="$save_ifs"
-             eval cmd=\"$cmd\"
-             func_len " $cmd"
-             len=$func_len_result
-             if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-               func_show_eval "$cmd" 'exit $?'
-               skipped_export=false
-             else
-               # The command line is too long to execute in one step.
-               func_verbose "using reloadable object file for export list..."
-               skipped_export=:
-               # Break out early, otherwise skipped_export may be
-               # set to false by a later but shorter cmd.
-               break
-             fi
-           done
-           IFS="$save_ifs"
-           if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
-             func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
-             func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
-           fi
-         fi
-       fi
-
-       if test -n "$export_symbols" && test -n "$include_expsyms"; then
-         tmp_export_symbols="$export_symbols"
-         test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-         $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
-       fi
-
-       if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
-         # The given exports_symbols file has to be filtered, so filter it.
-         func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
-         # FIXME: $output_objdir/$libname.filter potentially contains lots of
-         # 's' commands which not all seds can handle. GNU sed should be fine
-         # though. Also, the filter scales superlinearly with the number of
-         # global variables. join(1) would be nice here, but unfortunately
-         # isn't a blessed tool.
-         $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-         delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
-         export_symbols=$output_objdir/$libname.def
-         $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
-       fi
-
-       tmp_deplibs=
-       for test_deplib in $deplibs; do
-         case " $convenience " in
-         *" $test_deplib "*) ;;
-         *)
-           tmp_deplibs="$tmp_deplibs $test_deplib"
-           ;;
-         esac
-       done
-       deplibs="$tmp_deplibs"
-
-       if test -n "$convenience"; then
-         if test -n "$whole_archive_flag_spec" &&
-           test "$compiler_needs_object" = yes &&
-           test -z "$libobjs"; then
-           # extract the archives, so we have objects to list.
-           # TODO: could optimize this to just extract one archive.
-           whole_archive_flag_spec=
-         fi
-         if test -n "$whole_archive_flag_spec"; then
-           save_libobjs=$libobjs
-           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
-           test "X$libobjs" = "X " && libobjs=
-         else
-           gentop="$output_objdir/${outputname}x"
-           generated="$generated $gentop"
-
-           func_extract_archives $gentop $convenience
-           libobjs="$libobjs $func_extract_archives_result"
-           test "X$libobjs" = "X " && libobjs=
-         fi
-       fi
-
-       if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
-         eval flag=\"$thread_safe_flag_spec\"
-         linker_flags="$linker_flags $flag"
-       fi
-
-       # Make a backup of the uninstalled library when relinking
-       if test "$mode" = relink; then
-         $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
-       fi
-
-       # Do each of the archive commands.
-       if test "$module" = yes && test -n "$module_cmds" ; then
-         if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
-           eval test_cmds=\"$module_expsym_cmds\"
-           cmds=$module_expsym_cmds
-         else
-           eval test_cmds=\"$module_cmds\"
-           cmds=$module_cmds
-         fi
-       else
-         if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
-           eval test_cmds=\"$archive_expsym_cmds\"
-           cmds=$archive_expsym_cmds
-         else
-           eval test_cmds=\"$archive_cmds\"
-           cmds=$archive_cmds
-         fi
-       fi
-
-       if test "X$skipped_export" != "X:" &&
-          func_len " $test_cmds" &&
-          len=$func_len_result &&
-          test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-         :
-       else
-         # The command line is too long to link in one step, link piecewise
-         # or, if using GNU ld and skipped_export is not :, use a linker
-         # script.
-
-         # Save the value of $output and $libobjs because we want to
-         # use them later.  If we have whole_archive_flag_spec, we
-         # want to use save_libobjs as it was before
-         # whole_archive_flag_spec was expanded, because we can't
-         # assume the linker understands whole_archive_flag_spec.
-         # This may have to be revisited, in case too many
-         # convenience libraries get linked in and end up exceeding
-         # the spec.
-         if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
-           save_libobjs=$libobjs
-         fi
-         save_output=$output
-         output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
-
-         # Clear the reloadable object creation command queue and
-         # initialize k to one.
-         test_cmds=
-         concat_cmds=
-         objlist=
-         last_robj=
-         k=1
-
-         if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
-           output=${output_objdir}/${output_la}.lnkscript
-           func_verbose "creating GNU ld script: $output"
-           $ECHO 'INPUT (' > $output
-           for obj in $save_libobjs
-           do
-             $ECHO "$obj" >> $output
-           done
-           $ECHO ')' >> $output
-           delfiles="$delfiles $output"
-         elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
-           output=${output_objdir}/${output_la}.lnk
-           func_verbose "creating linker input file list: $output"
-           : > $output
-           set x $save_libobjs
-           shift
-           firstobj=
-           if test "$compiler_needs_object" = yes; then
-             firstobj="$1 "
-             shift
-           fi
-           for obj
-           do
-             $ECHO "$obj" >> $output
-           done
-           delfiles="$delfiles $output"
-           output=$firstobj\"$file_list_spec$output\"
-         else
-           if test -n "$save_libobjs"; then
-             func_verbose "creating reloadable object files..."
-             output=$output_objdir/$output_la-${k}.$objext
-             eval test_cmds=\"$reload_cmds\"
-             func_len " $test_cmds"
-             len0=$func_len_result
-             len=$len0
-
-             # Loop over the list of objects to be linked.
-             for obj in $save_libobjs
-             do
-               func_len " $obj"
-               func_arith $len + $func_len_result
-               len=$func_arith_result
-               if test "X$objlist" = X ||
-                  test "$len" -lt "$max_cmd_len"; then
-                 func_append objlist " $obj"
-               else
-                 # The command $test_cmds is almost too long, add a
-                 # command to the queue.
-                 if test "$k" -eq 1 ; then
-                   # The first file doesn't have a previous command to add.
-                   eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
-                 else
-                   # All subsequent reloadable object files will link in
-                   # the last one created.
-                   eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
-                 fi
-                 last_robj=$output_objdir/$output_la-${k}.$objext
-                 func_arith $k + 1
-                 k=$func_arith_result
-                 output=$output_objdir/$output_la-${k}.$objext
-                 objlist=$obj
-                 func_len " $last_robj"
-                 func_arith $len0 + $func_len_result
-                 len=$func_arith_result
-               fi
-             done
-             # Handle the remaining objects by creating one last
-             # reloadable object file.  All subsequent reloadable object
-             # files will link in the last one created.
-             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-             eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
-             if test -n "$last_robj"; then
-               eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
-             fi
-             delfiles="$delfiles $output"
-
-           else
-             output=
-           fi
-
-           if ${skipped_export-false}; then
-             func_verbose "generating symbol list for \`$libname.la'"
-             export_symbols="$output_objdir/$libname.exp"
-             $opt_dry_run || $RM $export_symbols
-             libobjs=$output
-             # Append the command to create the export file.
-             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-             eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
-             if test -n "$last_robj"; then
-               eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
-             fi
-           fi
-
-           test -n "$save_libobjs" &&
-             func_verbose "creating a temporary reloadable object file: $output"
-
-           # Loop through the commands generated above and execute them.
-           save_ifs="$IFS"; IFS='~'
-           for cmd in $concat_cmds; do
-             IFS="$save_ifs"
-             $opt_silent || {
-                 func_quote_for_expand "$cmd"
-                 eval "func_echo $func_quote_for_expand_result"
-             }
-             $opt_dry_run || eval "$cmd" || {
-               lt_exit=$?
-
-               # Restore the uninstalled library and exit
-               if test "$mode" = relink; then
-                 ( cd "$output_objdir" && \
-                   $RM "${realname}T" && \
-                   $MV "${realname}U" "$realname" )
-               fi
-
-               exit $lt_exit
-             }
-           done
-           IFS="$save_ifs"
-
-           if test -n "$export_symbols_regex" && ${skipped_export-false}; then
-             func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
-             func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
-           fi
-         fi
-
-          if ${skipped_export-false}; then
-           if test -n "$export_symbols" && test -n "$include_expsyms"; then
-             tmp_export_symbols="$export_symbols"
-             test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-             $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
-           fi
-
-           if test -n "$orig_export_symbols"; then
-             # The given exports_symbols file has to be filtered, so filter it.
-             func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
-             # FIXME: $output_objdir/$libname.filter potentially contains lots of
-             # 's' commands which not all seds can handle. GNU sed should be fine
-             # though. Also, the filter scales superlinearly with the number of
-             # global variables. join(1) would be nice here, but unfortunately
-             # isn't a blessed tool.
-             $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-             delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
-             export_symbols=$output_objdir/$libname.def
-             $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
-           fi
-         fi
-
-         libobjs=$output
-         # Restore the value of output.
-         output=$save_output
-
-         if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
-           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
-           test "X$libobjs" = "X " && libobjs=
-         fi
-         # Expand the library linking commands again to reset the
-         # value of $libobjs for piecewise linking.
-
-         # Do each of the archive commands.
-         if test "$module" = yes && test -n "$module_cmds" ; then
-           if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
-             cmds=$module_expsym_cmds
-           else
-             cmds=$module_cmds
-           fi
-         else
-           if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
-             cmds=$archive_expsym_cmds
-           else
-             cmds=$archive_cmds
-           fi
-         fi
-       fi
-
-       if test -n "$delfiles"; then
-         # Append the command to remove temporary files to $cmds.
-         eval cmds=\"\$cmds~\$RM $delfiles\"
-       fi
-
-       # Add any objects from preloaded convenience libraries
-       if test -n "$dlprefiles"; then
-         gentop="$output_objdir/${outputname}x"
-         generated="$generated $gentop"
-
-         func_extract_archives $gentop $dlprefiles
-         libobjs="$libobjs $func_extract_archives_result"
-         test "X$libobjs" = "X " && libobjs=
-       fi
-
-       save_ifs="$IFS"; IFS='~'
-       for cmd in $cmds; do
-         IFS="$save_ifs"
-         eval cmd=\"$cmd\"
-         $opt_silent || {
-           func_quote_for_expand "$cmd"
-           eval "func_echo $func_quote_for_expand_result"
-         }
-         $opt_dry_run || eval "$cmd" || {
-           lt_exit=$?
-
-           # Restore the uninstalled library and exit
-           if test "$mode" = relink; then
-             ( cd "$output_objdir" && \
-               $RM "${realname}T" && \
-               $MV "${realname}U" "$realname" )
-           fi
-
-           exit $lt_exit
-         }
-       done
-       IFS="$save_ifs"
-
-       # Restore the uninstalled library and exit
-       if test "$mode" = relink; then
-         $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
-
-         if test -n "$convenience"; then
-           if test -z "$whole_archive_flag_spec"; then
-             func_show_eval '${RM}r "$gentop"'
-           fi
-         fi
-
-         exit $EXIT_SUCCESS
-       fi
-
-       # Create links to the real library.
-       for linkname in $linknames; do
-         if test "$realname" != "$linkname"; then
-           func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
-         fi
-       done
-
-       # If -module or -export-dynamic was specified, set the dlname.
-       if test "$module" = yes || test "$export_dynamic" = yes; then
-         # On all known operating systems, these are identical.
-         dlname="$soname"
-       fi
-      fi
-      ;;
-
-    obj)
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-       func_warning "\`-dlopen' is ignored for objects"
-      fi
-
-      case " $deplibs" in
-      *\ -l* | *\ -L*)
-       func_warning "\`-l' and \`-L' are ignored for objects" ;;
-      esac
-
-      test -n "$rpath" && \
-       func_warning "\`-rpath' is ignored for objects"
-
-      test -n "$xrpath" && \
-       func_warning "\`-R' is ignored for objects"
-
-      test -n "$vinfo" && \
-       func_warning "\`-version-info' is ignored for objects"
-
-      test -n "$release" && \
-       func_warning "\`-release' is ignored for objects"
-
-      case $output in
-      *.lo)
-       test -n "$objs$old_deplibs" && \
-         func_fatal_error "cannot build library object \`$output' from non-libtool objects"
-
-       libobj=$output
-       func_lo2o "$libobj"
-       obj=$func_lo2o_result
-       ;;
-      *)
-       libobj=
-       obj="$output"
-       ;;
-      esac
-
-      # Delete the old objects.
-      $opt_dry_run || $RM $obj $libobj
-
-      # Objects from convenience libraries.  This assumes
-      # single-version convenience libraries.  Whenever we create
-      # different ones for PIC/non-PIC, this we'll have to duplicate
-      # the extraction.
-      reload_conv_objs=
-      gentop=
-      # reload_cmds runs $LD directly, so let us get rid of
-      # -Wl from whole_archive_flag_spec and hope we can get by with
-      # turning comma into space..
-      wl=
-
-      if test -n "$convenience"; then
-       if test -n "$whole_archive_flag_spec"; then
-         eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
-         reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
-       else
-         gentop="$output_objdir/${obj}x"
-         generated="$generated $gentop"
-
-         func_extract_archives $gentop $convenience
-         reload_conv_objs="$reload_objs $func_extract_archives_result"
-       fi
-      fi
-
-      # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
-
-      output="$obj"
-      func_execute_cmds "$reload_cmds" 'exit $?'
-
-      # Exit if we aren't doing a library object file.
-      if test -z "$libobj"; then
-       if test -n "$gentop"; then
-         func_show_eval '${RM}r "$gentop"'
-       fi
-
-       exit $EXIT_SUCCESS
-      fi
-
-      if test "$build_libtool_libs" != yes; then
-       if test -n "$gentop"; then
-         func_show_eval '${RM}r "$gentop"'
-       fi
-
-       # Create an invalid libtool object if no PIC, so that we don't
-       # accidentally link it into a program.
-       # $show "echo timestamp > $libobj"
-       # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
-       exit $EXIT_SUCCESS
-      fi
-
-      if test -n "$pic_flag" || test "$pic_mode" != default; then
-       # Only do commands if we really have different PIC objects.
-       reload_objs="$libobjs $reload_conv_objs"
-       output="$libobj"
-       func_execute_cmds "$reload_cmds" 'exit $?'
-      fi
-
-      if test -n "$gentop"; then
-       func_show_eval '${RM}r "$gentop"'
-      fi
-
-      exit $EXIT_SUCCESS
-      ;;
-
-    prog)
-      case $host in
-       *cygwin*) func_stripname '' '.exe' "$output"
-                 output=$func_stripname_result.exe;;
-      esac
-      test -n "$vinfo" && \
-       func_warning "\`-version-info' is ignored for programs"
-
-      test -n "$release" && \
-       func_warning "\`-release' is ignored for programs"
-
-      test "$preload" = yes \
-        && test "$dlopen_support" = unknown \
-       && test "$dlopen_self" = unknown \
-       && test "$dlopen_self_static" = unknown && \
-         func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
-
-      case $host in
-      *-*-rhapsody* | *-*-darwin1.[012])
-       # On Rhapsody replace the C library is the System framework
-       compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
-       finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
-       ;;
-      esac
-
-      case $host in
-      *-*-darwin*)
-       # Don't allow lazy linking, it breaks C++ global constructors
-       # But is supposedly fixed on 10.4 or later (yay!).
-       if test "$tagname" = CXX ; then
-         case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
-           10.[0123])
-             compile_command="$compile_command ${wl}-bind_at_load"
-             finalize_command="$finalize_command ${wl}-bind_at_load"
-           ;;
-         esac
-       fi
-       # Time to change all our "foo.ltframework" stuff back to "-framework foo"
-       compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-       finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-       ;;
-      esac
-
-
-      # move library search paths that coincide with paths to not yet
-      # installed libraries to the beginning of the library search list
-      new_libs=
-      for path in $notinst_path; do
-       case " $new_libs " in
-       *" -L$path/$objdir "*) ;;
-       *)
-         case " $compile_deplibs " in
-         *" -L$path/$objdir "*)
-           new_libs="$new_libs -L$path/$objdir" ;;
-         esac
-         ;;
-       esac
-      done
-      for deplib in $compile_deplibs; do
-       case $deplib in
-       -L*)
-         case " $new_libs " in
-         *" $deplib "*) ;;
-         *) new_libs="$new_libs $deplib" ;;
-         esac
-         ;;
-       *) new_libs="$new_libs $deplib" ;;
-       esac
-      done
-      compile_deplibs="$new_libs"
-
-
-      compile_command="$compile_command $compile_deplibs"
-      finalize_command="$finalize_command $finalize_deplibs"
-
-      if test -n "$rpath$xrpath"; then
-       # If the user specified any rpath flags, then add them.
-       for libdir in $rpath $xrpath; do
-         # This is the magic to use -rpath.
-         case "$finalize_rpath " in
-         *" $libdir "*) ;;
-         *) finalize_rpath="$finalize_rpath $libdir" ;;
-         esac
-       done
-      fi
-
-      # Now hardcode the library paths
-      rpath=
-      hardcode_libdirs=
-      for libdir in $compile_rpath $finalize_rpath; do
-       if test -n "$hardcode_libdir_flag_spec"; then
-         if test -n "$hardcode_libdir_separator"; then
-           if test -z "$hardcode_libdirs"; then
-             hardcode_libdirs="$libdir"
-           else
-             # Just accumulate the unique libdirs.
-             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-               ;;
-             *)
-               hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-               ;;
-             esac
-           fi
-         else
-           eval flag=\"$hardcode_libdir_flag_spec\"
-           rpath="$rpath $flag"
-         fi
-       elif test -n "$runpath_var"; then
-         case "$perm_rpath " in
-         *" $libdir "*) ;;
-         *) perm_rpath="$perm_rpath $libdir" ;;
-         esac
-       fi
-       case $host in
-       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-         testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
-         case :$dllsearchpath: in
-         *":$libdir:"*) ;;
-         ::) dllsearchpath=$libdir;;
-         *) dllsearchpath="$dllsearchpath:$libdir";;
-         esac
-         case :$dllsearchpath: in
-         *":$testbindir:"*) ;;
-         ::) dllsearchpath=$testbindir;;
-         *) dllsearchpath="$dllsearchpath:$testbindir";;
-         esac
-         ;;
-       esac
-      done
-      # Substitute the hardcoded libdirs into the rpath.
-      if test -n "$hardcode_libdir_separator" &&
-        test -n "$hardcode_libdirs"; then
-       libdir="$hardcode_libdirs"
-       eval rpath=\" $hardcode_libdir_flag_spec\"
-      fi
-      compile_rpath="$rpath"
-
-      rpath=
-      hardcode_libdirs=
-      for libdir in $finalize_rpath; do
-       if test -n "$hardcode_libdir_flag_spec"; then
-         if test -n "$hardcode_libdir_separator"; then
-           if test -z "$hardcode_libdirs"; then
-             hardcode_libdirs="$libdir"
-           else
-             # Just accumulate the unique libdirs.
-             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-               ;;
-             *)
-               hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-               ;;
-             esac
-           fi
-         else
-           eval flag=\"$hardcode_libdir_flag_spec\"
-           rpath="$rpath $flag"
-         fi
-       elif test -n "$runpath_var"; then
-         case "$finalize_perm_rpath " in
-         *" $libdir "*) ;;
-         *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
-         esac
-       fi
-      done
-      # Substitute the hardcoded libdirs into the rpath.
-      if test -n "$hardcode_libdir_separator" &&
-        test -n "$hardcode_libdirs"; then
-       libdir="$hardcode_libdirs"
-       eval rpath=\" $hardcode_libdir_flag_spec\"
-      fi
-      finalize_rpath="$rpath"
-
-      if test -n "$libobjs" && test "$build_old_libs" = yes; then
-       # Transform all the library objects into standard objects.
-       compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-       finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-      fi
-
-      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
-
-      # template prelinking step
-      if test -n "$prelink_cmds"; then
-       func_execute_cmds "$prelink_cmds" 'exit $?'
-      fi
-
-      wrappers_required=yes
-      case $host in
-      *cygwin* | *mingw* )
-        if test "$build_libtool_libs" != yes; then
-          wrappers_required=no
-        fi
-        ;;
-      *cegcc)
-        # Disable wrappers for cegcc, we are cross compiling anyway.
-        wrappers_required=no
-        ;;
-      *)
-        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
-          wrappers_required=no
-        fi
-        ;;
-      esac
-      if test "$wrappers_required" = no; then
-       # Replace the output file specification.
-       compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
-       link_command="$compile_command$compile_rpath"
-
-       # We have no uninstalled library dependencies, so finalize right now.
-       exit_status=0
-       func_show_eval "$link_command" 'exit_status=$?'
-
-       # Delete the generated files.
-       if test -f "$output_objdir/${outputname}S.${objext}"; then
-         func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
-       fi
-
-       exit $exit_status
-      fi
-
-      if test -n "$compile_shlibpath$finalize_shlibpath"; then
-       compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
-      fi
-      if test -n "$finalize_shlibpath"; then
-       finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
-      fi
-
-      compile_var=
-      finalize_var=
-      if test -n "$runpath_var"; then
-       if test -n "$perm_rpath"; then
-         # We should set the runpath_var.
-         rpath=
-         for dir in $perm_rpath; do
-           rpath="$rpath$dir:"
-         done
-         compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
-       fi
-       if test -n "$finalize_perm_rpath"; then
-         # We should set the runpath_var.
-         rpath=
-         for dir in $finalize_perm_rpath; do
-           rpath="$rpath$dir:"
-         done
-         finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
-       fi
-      fi
-
-      if test "$no_install" = yes; then
-       # We don't need to create a wrapper script.
-       link_command="$compile_var$compile_command$compile_rpath"
-       # Replace the output file specification.
-       link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
-       # Delete the old output file.
-       $opt_dry_run || $RM $output
-       # Link the executable and exit
-       func_show_eval "$link_command" 'exit $?'
-       exit $EXIT_SUCCESS
-      fi
-
-      if test "$hardcode_action" = relink; then
-       # Fast installation is not supported
-       link_command="$compile_var$compile_command$compile_rpath"
-       relink_command="$finalize_var$finalize_command$finalize_rpath"
-
-       func_warning "this platform does not like uninstalled shared libraries"
-       func_warning "\`$output' will be relinked during installation"
-      else
-       if test "$fast_install" != no; then
-         link_command="$finalize_var$compile_command$finalize_rpath"
-         if test "$fast_install" = yes; then
-           relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
-         else
-           # fast_install is set to needless
-           relink_command=
-         fi
-       else
-         link_command="$compile_var$compile_command$compile_rpath"
-         relink_command="$finalize_var$finalize_command$finalize_rpath"
-       fi
-      fi
-
-      # Replace the output file specification.
-      link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-
-      # Delete the old output files.
-      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
-
-      func_show_eval "$link_command" 'exit $?'
-
-      # Now create the wrapper script.
-      func_verbose "creating $output"
-
-      # Quote the relink command for shipping.
-      if test -n "$relink_command"; then
-       # Preserve any variables that may affect compiler behavior
-       for var in $variables_saved_for_relink; do
-         if eval test -z \"\${$var+set}\"; then
-           relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
-         elif eval var_value=\$$var; test -z "$var_value"; then
-           relink_command="$var=; export $var; $relink_command"
-         else
-           func_quote_for_eval "$var_value"
-           relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
-         fi
-       done
-       relink_command="(cd `pwd`; $relink_command)"
-       relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
-      fi
-
-      # Quote $ECHO for shipping.
-      if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
-       case $progpath in
-       [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
-       *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
-       esac
-       qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
-      else
-       qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
-      fi
-
-      # Only actually do things if not in dry run mode.
-      $opt_dry_run || {
-       # win32 will think the script is a binary if it has
-       # a .exe suffix, so we strip it off here.
-       case $output in
-         *.exe) func_stripname '' '.exe' "$output"
-                output=$func_stripname_result ;;
-       esac
-       # test for cygwin because mv fails w/o .exe extensions
-       case $host in
-         *cygwin*)
-           exeext=.exe
-           func_stripname '' '.exe' "$outputname"
-           outputname=$func_stripname_result ;;
-         *) exeext= ;;
-       esac
-       case $host in
-         *cygwin* | *mingw* )
-           func_dirname_and_basename "$output" "" "."
-           output_name=$func_basename_result
-           output_path=$func_dirname_result
-           cwrappersource="$output_path/$objdir/lt-$output_name.c"
-           cwrapper="$output_path/$output_name.exe"
-           $RM $cwrappersource $cwrapper
-           trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
-
-           func_emit_cwrapperexe_src > $cwrappersource
-
-           # The wrapper executable is built using the $host compiler,
-           # because it contains $host paths and files. If cross-
-           # compiling, it, like the target executable, must be
-           # executed on the $host or under an emulation environment.
-           $opt_dry_run || {
-             $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
-             $STRIP $cwrapper
-           }
-
-           # Now, create the wrapper script for func_source use:
-           func_ltwrapper_scriptname $cwrapper
-           $RM $func_ltwrapper_scriptname_result
-           trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
-           $opt_dry_run || {
-             # note: this script will not be executed, so do not chmod.
-             if test "x$build" = "x$host" ; then
-               $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
-             else
-               func_emit_wrapper no > $func_ltwrapper_scriptname_result
-             fi
-           }
-         ;;
-         * )
-           $RM $output
-           trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
-
-           func_emit_wrapper no > $output
-           chmod +x $output
-         ;;
-       esac
-      }
-      exit $EXIT_SUCCESS
-      ;;
-    esac
-
-    # See if we need to build an old-fashioned archive.
-    for oldlib in $oldlibs; do
-
-      if test "$build_libtool_libs" = convenience; then
-       oldobjs="$libobjs_save $symfileobj"
-       addlibs="$convenience"
-       build_libtool_libs=no
-      else
-       if test "$build_libtool_libs" = module; then
-         oldobjs="$libobjs_save"
-         build_libtool_libs=no
-       else
-         oldobjs="$old_deplibs $non_pic_objects"
-         if test "$preload" = yes && test -f "$symfileobj"; then
-           oldobjs="$oldobjs $symfileobj"
-         fi
-       fi
-       addlibs="$old_convenience"
-      fi
-
-      if test -n "$addlibs"; then
-       gentop="$output_objdir/${outputname}x"
-       generated="$generated $gentop"
-
-       func_extract_archives $gentop $addlibs
-       oldobjs="$oldobjs $func_extract_archives_result"
-      fi
-
-      # Do each command in the archive commands.
-      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
-       cmds=$old_archive_from_new_cmds
-      else
-
-       # Add any objects from preloaded convenience libraries
-       if test -n "$dlprefiles"; then
-         gentop="$output_objdir/${outputname}x"
-         generated="$generated $gentop"
-
-         func_extract_archives $gentop $dlprefiles
-         oldobjs="$oldobjs $func_extract_archives_result"
-       fi
-
-       # POSIX demands no paths to be encoded in archives.  We have
-       # to avoid creating archives with duplicate basenames if we
-       # might have to extract them afterwards, e.g., when creating a
-       # static archive out of a convenience library, or when linking
-       # the entirety of a libtool archive into another (currently
-       # not supported by libtool).
-       if (for obj in $oldobjs
-           do
-             func_basename "$obj"
-             $ECHO "$func_basename_result"
-           done | sort | sort -uc >/dev/null 2>&1); then
-         :
-       else
-         $ECHO "copying selected object files to avoid basename conflicts..."
-         gentop="$output_objdir/${outputname}x"
-         generated="$generated $gentop"
-         func_mkdir_p "$gentop"
-         save_oldobjs=$oldobjs
-         oldobjs=
-         counter=1
-         for obj in $save_oldobjs
-         do
-           func_basename "$obj"
-           objbase="$func_basename_result"
-           case " $oldobjs " in
-           " ") oldobjs=$obj ;;
-           *[\ /]"$objbase "*)
-             while :; do
-               # Make sure we don't pick an alternate name that also
-               # overlaps.
-               newobj=lt$counter-$objbase
-               func_arith $counter + 1
-               counter=$func_arith_result
-               case " $oldobjs " in
-               *[\ /]"$newobj "*) ;;
-               *) if test ! -f "$gentop/$newobj"; then break; fi ;;
-               esac
-             done
-             func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
-             oldobjs="$oldobjs $gentop/$newobj"
-             ;;
-           *) oldobjs="$oldobjs $obj" ;;
-           esac
-         done
-       fi
-       eval cmds=\"$old_archive_cmds\"
-
-       func_len " $cmds"
-       len=$func_len_result
-       if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-         cmds=$old_archive_cmds
-       else
-         # the command line is too long to link in one step, link in parts
-         func_verbose "using piecewise archive linking..."
-         save_RANLIB=$RANLIB
-         RANLIB=:
-         objlist=
-         concat_cmds=
-         save_oldobjs=$oldobjs
-         oldobjs=
-         # Is there a better way of finding the last object in the list?
-         for obj in $save_oldobjs
-         do
-           last_oldobj=$obj
-         done
-         eval test_cmds=\"$old_archive_cmds\"
-         func_len " $test_cmds"
-         len0=$func_len_result
-         len=$len0
-         for obj in $save_oldobjs
-         do
-           func_len " $obj"
-           func_arith $len + $func_len_result
-           len=$func_arith_result
-           func_append objlist " $obj"
-           if test "$len" -lt "$max_cmd_len"; then
-             :
-           else
-             # the above command should be used before it gets too long
-             oldobjs=$objlist
-             if test "$obj" = "$last_oldobj" ; then
-               RANLIB=$save_RANLIB
-             fi
-             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-             eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
-             objlist=
-             len=$len0
-           fi
-         done
-         RANLIB=$save_RANLIB
-         oldobjs=$objlist
-         if test "X$oldobjs" = "X" ; then
-           eval cmds=\"\$concat_cmds\"
-         else
-           eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
-         fi
-       fi
-      fi
-      func_execute_cmds "$cmds" 'exit $?'
-    done
-
-    test -n "$generated" && \
-      func_show_eval "${RM}r$generated"
-
-    # Now create the libtool archive.
-    case $output in
-    *.la)
-      old_library=
-      test "$build_old_libs" = yes && old_library="$libname.$libext"
-      func_verbose "creating $output"
-
-      # Preserve any variables that may affect compiler behavior
-      for var in $variables_saved_for_relink; do
-       if eval test -z \"\${$var+set}\"; then
-         relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
-       elif eval var_value=\$$var; test -z "$var_value"; then
-         relink_command="$var=; export $var; $relink_command"
-       else
-         func_quote_for_eval "$var_value"
-         relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
-       fi
-      done
-      # Quote the link command for shipping.
-      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
-      relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
-      if test "$hardcode_automatic" = yes ; then
-       relink_command=
-      fi
-
-      # Only create the output if not a dry run.
-      $opt_dry_run || {
-       for installed in no yes; do
-         if test "$installed" = yes; then
-           if test -z "$install_libdir"; then
-             break
-           fi
-           output="$output_objdir/$outputname"i
-           # Replace all uninstalled libtool libraries with the installed ones
-           newdependency_libs=
-           for deplib in $dependency_libs; do
-             case $deplib in
-             *.la)
-               func_basename "$deplib"
-               name="$func_basename_result"
-               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
-               test -z "$libdir" && \
-                 func_fatal_error "\`$deplib' is not a valid libtool archive"
-               newdependency_libs="$newdependency_libs $libdir/$name"
-               ;;
-             *) newdependency_libs="$newdependency_libs $deplib" ;;
-             esac
-           done
-           dependency_libs="$newdependency_libs"
-           newdlfiles=
-
-           for lib in $dlfiles; do
-             case $lib in
-             *.la)
-               func_basename "$lib"
-               name="$func_basename_result"
-               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
-               test -z "$libdir" && \
-                 func_fatal_error "\`$lib' is not a valid libtool archive"
-               newdlfiles="$newdlfiles $libdir/$name"
-               ;;
-             *) newdlfiles="$newdlfiles $lib" ;;
-             esac
-           done
-           dlfiles="$newdlfiles"
-           newdlprefiles=
-           for lib in $dlprefiles; do
-             case $lib in
-             *.la)
-               # Only pass preopened files to the pseudo-archive (for
-               # eventual linking with the app. that links it) if we
-               # didn't already link the preopened objects directly into
-               # the library:
-               func_basename "$lib"
-               name="$func_basename_result"
-               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
-               test -z "$libdir" && \
-                 func_fatal_error "\`$lib' is not a valid libtool archive"
-               newdlprefiles="$newdlprefiles $libdir/$name"
-               ;;
-             esac
-           done
-           dlprefiles="$newdlprefiles"
-         else
-           newdlfiles=
-           for lib in $dlfiles; do
-             case $lib in
-               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
-               *) abs=`pwd`"/$lib" ;;
-             esac
-             newdlfiles="$newdlfiles $abs"
-           done
-           dlfiles="$newdlfiles"
-           newdlprefiles=
-           for lib in $dlprefiles; do
-             case $lib in
-               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
-               *) abs=`pwd`"/$lib" ;;
-             esac
-             newdlprefiles="$newdlprefiles $abs"
-           done
-           dlprefiles="$newdlprefiles"
-         fi
-         $RM $output
-         # place dlname in correct position for cygwin
-         tdlname=$dlname
-         case $host,$output,$installed,$module,$dlname in
-           *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
-         esac
-         $ECHO > $output "\
-# $outputname - a libtool library file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='$tdlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Linker flags that can not go in dependency_libs.
-inherited_linker_flags='$new_inherited_linker_flags'
-
-# Libraries that this one depends upon.
-dependency_libs='$dependency_libs'
-
-# Names of additional weak libraries provided by this library
-weak_library_names='$weak_libs'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Is this an already installed library?
-installed=$installed
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=$module
-
-# Files to dlopen/dlpreopen
-dlopen='$dlfiles'
-dlpreopen='$dlprefiles'
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'"
-         if test "$installed" = no && test "$need_relink" = yes; then
-           $ECHO >> $output "\
-relink_command=\"$relink_command\""
-         fi
-       done
-      }
-
-      # Do a symbolic link so that the libtool archive can be found in
-      # LD_LIBRARY_PATH before the program is installed.
-      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
-      ;;
-    esac
-    exit $EXIT_SUCCESS
-}
-
-{ test "$mode" = link || test "$mode" = relink; } &&
-    func_mode_link ${1+"$@"}
-
-
-# func_mode_uninstall arg...
-func_mode_uninstall ()
-{
-    $opt_debug
-    RM="$nonopt"
-    files=
-    rmforce=
-    exit_status=0
-
-    # This variable tells wrapper scripts just to set variables rather
-    # than running their programs.
-    libtool_install_magic="$magic"
-
-    for arg
-    do
-      case $arg in
-      -f) RM="$RM $arg"; rmforce=yes ;;
-      -*) RM="$RM $arg" ;;
-      *) files="$files $arg" ;;
-      esac
-    done
-
-    test -z "$RM" && \
-      func_fatal_help "you must specify an RM program"
-
-    rmdirs=
-
-    origobjdir="$objdir"
-    for file in $files; do
-      func_dirname "$file" "" "."
-      dir="$func_dirname_result"
-      if test "X$dir" = X.; then
-       objdir="$origobjdir"
-      else
-       objdir="$dir/$origobjdir"
-      fi
-      func_basename "$file"
-      name="$func_basename_result"
-      test "$mode" = uninstall && objdir="$dir"
-
-      # Remember objdir for removal later, being careful to avoid duplicates
-      if test "$mode" = clean; then
-       case " $rmdirs " in
-         *" $objdir "*) ;;
-         *) rmdirs="$rmdirs $objdir" ;;
-       esac
-      fi
-
-      # Don't error if the file doesn't exist and rm -f was used.
-      if { test -L "$file"; } >/dev/null 2>&1 ||
-        { test -h "$file"; } >/dev/null 2>&1 ||
-        test -f "$file"; then
-       :
-      elif test -d "$file"; then
-       exit_status=1
-       continue
-      elif test "$rmforce" = yes; then
-       continue
-      fi
-
-      rmfiles="$file"
-
-      case $name in
-      *.la)
-       # Possibly a libtool archive, so verify it.
-       if func_lalib_p "$file"; then
-         func_source $dir/$name
-
-         # Delete the libtool libraries and symlinks.
-         for n in $library_names; do
-           rmfiles="$rmfiles $objdir/$n"
-         done
-         test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
-
-         case "$mode" in
-         clean)
-           case "  $library_names " in
-           # "  " in the beginning catches empty $dlname
-           *" $dlname "*) ;;
-           *) rmfiles="$rmfiles $objdir/$dlname" ;;
-           esac
-           test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
-           ;;
-         uninstall)
-           if test -n "$library_names"; then
-             # Do each command in the postuninstall commands.
-             func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
-           fi
-
-           if test -n "$old_library"; then
-             # Do each command in the old_postuninstall commands.
-             func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
-           fi
-           # FIXME: should reinstall the best remaining shared library.
-           ;;
-         esac
-       fi
-       ;;
-
-      *.lo)
-       # Possibly a libtool object, so verify it.
-       if func_lalib_p "$file"; then
-
-         # Read the .lo file
-         func_source $dir/$name
-
-         # Add PIC object to the list of files to remove.
-         if test -n "$pic_object" &&
-            test "$pic_object" != none; then
-           rmfiles="$rmfiles $dir/$pic_object"
-         fi
-
-         # Add non-PIC object to the list of files to remove.
-         if test -n "$non_pic_object" &&
-            test "$non_pic_object" != none; then
-           rmfiles="$rmfiles $dir/$non_pic_object"
-         fi
-       fi
-       ;;
-
-      *)
-       if test "$mode" = clean ; then
-         noexename=$name
-         case $file in
-         *.exe)
-           func_stripname '' '.exe' "$file"
-           file=$func_stripname_result
-           func_stripname '' '.exe' "$name"
-           noexename=$func_stripname_result
-           # $file with .exe has already been added to rmfiles,
-           # add $file without .exe
-           rmfiles="$rmfiles $file"
-           ;;
-         esac
-         # Do a test to see if this is a libtool program.
-         if func_ltwrapper_p "$file"; then
-           if func_ltwrapper_executable_p "$file"; then
-             func_ltwrapper_scriptname "$file"
-             relink_command=
-             func_source $func_ltwrapper_scriptname_result
-             rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
-           else
-             relink_command=
-             func_source $dir/$noexename
-           fi
-
-           # note $name still contains .exe if it was in $file originally
-           # as does the version of $file that was added into $rmfiles
-           rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
-           if test "$fast_install" = yes && test -n "$relink_command"; then
-             rmfiles="$rmfiles $objdir/lt-$name"
-           fi
-           if test "X$noexename" != "X$name" ; then
-             rmfiles="$rmfiles $objdir/lt-${noexename}.c"
-           fi
-         fi
-       fi
-       ;;
-      esac
-      func_show_eval "$RM $rmfiles" 'exit_status=1'
-    done
-    objdir="$origobjdir"
-
-    # Try to remove the ${objdir}s in the directories where we deleted files
-    for dir in $rmdirs; do
-      if test -d "$dir"; then
-       func_show_eval "rmdir $dir >/dev/null 2>&1"
-      fi
-    done
-
-    exit $exit_status
-}
-
-{ test "$mode" = uninstall || test "$mode" = clean; } &&
-    func_mode_uninstall ${1+"$@"}
-
-test -z "$mode" && {
-  help="$generic_help"
-  func_fatal_help "you must specify a MODE"
-}
-
-test -z "$exec_cmd" && \
-  func_fatal_help "invalid operation mode \`$mode'"
-
-if test -n "$exec_cmd"; then
-  eval exec "$exec_cmd"
-  exit $EXIT_FAILURE
-fi
-
-exit $exit_status
-
-
-# The TAGs below are defined such that we never get into a situation
-# in which we disable both kinds of libraries.  Given conflicting
-# choices, we go for a static library, that is the most portable,
-# since we can't tell whether shared libraries were disabled because
-# the user asked for that or because the platform doesn't support
-# them.  This is particularly important on AIX, because we don't
-# support having both static and shared libraries enabled at the same
-# time on that platform, so we default to a shared-only configuration.
-# If a disable-shared tag is given, we'll fallback to a static-only
-# configuration.  But we'll never go from static-only to shared-only.
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-build_libtool_libs=no
-build_old_libs=yes
-# ### END LIBTOOL TAG CONFIG: disable-shared
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
-# ### END LIBTOOL TAG CONFIG: disable-static
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
-# vi:sw=2
-
-
-# ### BEGIN LIBTOOL TAG CONFIG: CXX
-
-# The linker used to build libraries.
-LD="/usr/bin/ld"
-
-# Commands used to build an old-style archive.
-old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
-
-# A language specific compiler.
-CC="g++"
-
-# Is the compiler the GNU compiler?
-with_gcc=yes
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=" -fno-builtin"
-
-# How to pass a linker flag through the compiler.
-wl="-Wl,"
-
-# Additional compiler flags for building library objects.
-pic_flag=" -fPIC -DPIC"
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag="-static"
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o="yes"
-
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=no
-
-# Whether or not to disallow shared libs when runtime libs are static.
-allow_libtool_libs_with_static_runtimes=no
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec="\${wl}--export-dynamic"
-
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
-
-# Whether the compiler copes with passing no objects directly.
-compiler_needs_object="no"
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=""
-
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=""
-
-# Commands used to build a shared archive.
-archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
-archive_expsym_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib"
-
-# Commands used to build a loadable module if different from building
-# a shared archive.
-module_cmds=""
-module_expsym_cmds=""
-
-# Whether we are building with GNU ld or not.
-with_gnu_ld="yes"
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=""
-
-# Flag that enforces no undefined symbols.
-no_undefined_flag=""
-
-# Flag to hardcode $libdir into a binary during linking.
-# This must work even if $libdir does not exist
-hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
-
-# If ld is used when linking, flag to hardcode $libdir into a binary
-# during linking.  This must work even if $libdir does not exist.
-hardcode_libdir_flag_spec_ld=""
-
-# Whether we need a single "-rpath" flag with a separated argument.
-hardcode_libdir_separator=""
-
-# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
-# DIR into the resulting binary.
-hardcode_direct=no
-
-# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
-# DIR into the resulting binary and the resulting library dependency is
-# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
-# library is relocated.
-hardcode_direct_absolute=no
-
-# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
-# into the resulting binary.
-hardcode_minus_L=no
-
-# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
-# into the resulting binary.
-hardcode_shlibpath_var=unsupported
-
-# Set to "yes" if building a shared library automatically hardcodes DIR
-# into the library and all subsequent libraries and executables linked
-# against it.
-hardcode_automatic=no
-
-# Set to yes if linker adds runtime paths of dependent libraries
-# to runtime path list.
-inherit_rpath=no
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=no
-
-# Fix the shell variable $srcfile for the compiler.
-fix_srcfile_path=""
-
-# Set to "yes" if exported symbols are required.
-always_export_symbols=no
-
-# The commands to list exported symbols.
-export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
-
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
-
-# Symbols that must always be exported.
-include_expsyms=""
-
-# Commands necessary for linking programs (against libraries) with templates.
-prelink_cmds=""
-
-# Specify filename containing input files.
-file_list_spec=""
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=immediate
-
-# The directories searched by this compiler when creating a shared library.
-compiler_lib_search_dirs="/usr/lib/gcc/i686-linux-gnu/4.6.1 /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../../lib /lib/i386-linux-gnu /lib/../lib /usr/lib/i386-linux-gnu /usr/lib/../lib /usr/lib/gcc/i686-linux-gnu/4.6.1/../../.."
-
-# Dependencies to place before and after the objects being linked to
-# create a shared library.
-predep_objects="/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crti.o /usr/lib/gcc/i686-linux-gnu/4.6.1/crtbeginS.o"
-postdep_objects="/usr/lib/gcc/i686-linux-gnu/4.6.1/crtendS.o /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crtn.o"
-predeps=""
-postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
-
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path="-L/usr/lib/gcc/i686-linux-gnu/4.6.1 -L/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu -L/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../../lib -L/lib/i386-linux-gnu -L/lib/../lib -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/i686-linux-gnu/4.6.1/../../.."
-
-# ### END LIBTOOL TAG CONFIG: CXX
index 5b27b6a..9ac7449 100755 (executable)
@@ -20,10 +20,12 @@ GTEST_DIR = ..
 USER_DIR = ../samples
 
 # Flags passed to the preprocessor.
-CPPFLAGS += -I$(GTEST_DIR)/include
+# Set Google Test's header directory as a system directory, such that
+# the compiler doesn't generate warnings in Google Test headers.
+CPPFLAGS += -isystem $(GTEST_DIR)/include
 
 # Flags passed to the C++ compiler.
-CXXFLAGS += -g -Wall -Wextra
+CXXFLAGS += -g -Wall -Wextra -pthread
 
 # All tests produced by this Makefile.  Remember to add new tests you
 # created to the list.
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 0819953..b16b1e8
@@ -1,6 +1,6 @@
 Name:       gtest
 Summary:    Google Test Framework
-Version:    1.2.1.0
+Version:    1.8.0
 Release:    0
 License:    BSD-3-Clause
 Group:      Development/Testing
diff --git a/samples/.dirstamp b/samples/.dirstamp
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/samples/libsamples.la b/samples/libsamples.la
deleted file mode 100644 (file)
index 0d102f4..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# libsamples.la - a libtool library file
-# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname=''
-
-# Names of this library.
-library_names=''
-
-# The name of the static archive.
-old_library='libsamples.a'
-
-# Linker flags that can not go in dependency_libs.
-inherited_linker_flags=' -pthread'
-
-# Libraries that this one depends upon.
-dependency_libs=''
-
-# Names of additional weak libraries provided by this library
-weak_library_names=''
-
-# Version information for libsamples.
-current=
-age=
-revision=
-
-# Is this an already installed library?
-installed=no
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=no
-
-# Files to dlopen/dlpreopen
-dlopen=''
-dlpreopen=''
-
-# Directory that this library needs to be installed in:
-libdir=''
diff --git a/samples/sample1.lo b/samples/sample1.lo
deleted file mode 100644 (file)
index e80d86a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# samples/sample1.lo - a libtool object file
-# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-pic_object='.libs/sample1.o'
-
-# Name of the non-PIC object
-non_pic_object='sample1.o'
-
diff --git a/samples/sample1.o b/samples/sample1.o
deleted file mode 100644 (file)
index 3391a3d..0000000
Binary files a/samples/sample1.o and /dev/null differ
index 2813d04..0051cd5 100755 (executable)
@@ -89,8 +89,7 @@ class LeakChecker : public EmptyTestEventListener {
     // You can generate a failure in any event handler except
     // OnTestPartResult. Just use an appropriate Google Test assertion to do
     // it.
-    EXPECT_TRUE(difference <= 0)
-        << "Leaked " << difference << " unit(s) of Water!";
+    EXPECT_LE(difference, 0) << "Leaked " << difference << " unit(s) of Water!";
   }
 
   int initially_allocated_;
index a8a7c79..aefc4f1 100755 (executable)
@@ -81,7 +81,7 @@ TEST(FactorialTest, Negative) {
   // test case.
   EXPECT_EQ(1, Factorial(-5));
   EXPECT_EQ(1, Factorial(-1));
-  EXPECT_TRUE(Factorial(-10) > 0);
+  EXPECT_GT(Factorial(-10), 0);
 
   // <TechnicalDetails>
   //
index 5b57e60..cb485c7 100755 (executable)
@@ -44,7 +44,6 @@ class MyString {
   const MyString& operator=(const MyString& rhs);
 
  public:
-
   // Clones a 0-terminated C string, allocating memory using new.
   static const char* CloneCString(const char* a_c_string);
 
diff --git a/samples/sample2.lo b/samples/sample2.lo
deleted file mode 100644 (file)
index e099472..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# samples/sample2.lo - a libtool object file
-# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-pic_object='.libs/sample2.o'
-
-# Name of the non-PIC object
-non_pic_object='sample2.o'
-
diff --git a/samples/sample2.o b/samples/sample2.o
deleted file mode 100644 (file)
index 27c0c6b..0000000
Binary files a/samples/sample2.o and /dev/null differ
index 3792fa5..4fa19b7 100755 (executable)
@@ -79,7 +79,7 @@ const char kHelloString[] = "Hello, world!";
 // Tests the c'tor that accepts a C string.
 TEST(MyString, ConstructorFromCString) {
   const MyString s(kHelloString);
-  EXPECT_TRUE(strcmp(s.c_string(), kHelloString) == 0);
+  EXPECT_EQ(0, strcmp(s.c_string(), kHelloString));
   EXPECT_EQ(sizeof(kHelloString)/sizeof(kHelloString[0]) - 1,
             s.Length());
 }
@@ -88,7 +88,7 @@ TEST(MyString, ConstructorFromCString) {
 TEST(MyString, CopyConstructor) {
   const MyString s1(kHelloString);
   const MyString s2 = s1;
-  EXPECT_TRUE(strcmp(s2.c_string(), kHelloString) == 0);
+  EXPECT_EQ(0, strcmp(s2.c_string(), kHelloString));
 }
 
 // Tests the Set method.
@@ -96,12 +96,12 @@ TEST(MyString, Set) {
   MyString s;
 
   s.Set(kHelloString);
-  EXPECT_TRUE(strcmp(s.c_string(), kHelloString) == 0);
+  EXPECT_EQ(0, strcmp(s.c_string(), kHelloString));
 
   // Set should work when the input pointer is the same as the one
   // already in the MyString object.
   s.Set(s.c_string());
-  EXPECT_TRUE(strcmp(s.c_string(), kHelloString) == 0);
+  EXPECT_EQ(0, strcmp(s.c_string(), kHelloString));
 
   // Can we set the MyString to NULL?
   s.Set(NULL);
index 46369a0..7e3084d 100755 (executable)
@@ -60,7 +60,7 @@ class QueueNode {
  private:
   // Creates a node with a given element value.  The next pointer is
   // set to NULL.
-  QueueNode(const E& an_element) : element_(an_element), next_(NULL) {}
+  explicit QueueNode(const E& an_element) : element_(an_element), next_(NULL) {}
 
   // We disable the default assignment operator and copy c'tor.
   const QueueNode& operator = (const QueueNode&);
@@ -72,8 +72,7 @@ class QueueNode {
 
 template <typename E>  // E is the element type.
 class Queue {
-public:
-
+ public:
   // Creates an empty queue.
   Queue() : head_(NULL), last_(NULL), size_(0) {}
 
@@ -168,6 +167,6 @@ public:
   // We disallow copying a queue.
   Queue(const Queue&);
   const Queue& operator = (const Queue&);
- };
+};
 
 #endif  // GTEST_SAMPLES_SAMPLE3_INL_H_
diff --git a/samples/sample4.lo b/samples/sample4.lo
deleted file mode 100644 (file)
index 892ebad..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# samples/sample4.lo - a libtool object file
-# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-pic_object='.libs/sample4.o'
-
-# Name of the non-PIC object
-non_pic_object='sample4.o'
-
diff --git a/samples/sample4.o b/samples/sample4.o
deleted file mode 100644 (file)
index 875fd4c..0000000
Binary files a/samples/sample4.o and /dev/null differ
index e7cab01..43d8e57 100755 (executable)
@@ -101,7 +101,7 @@ TEST_F(IntegerFunctionTest, Factorial) {
   // Tests factorial of negative numbers.
   EXPECT_EQ(1, Factorial(-5));
   EXPECT_EQ(1, Factorial(-1));
-  EXPECT_TRUE(Factorial(-10) > 0);
+  EXPECT_GT(Factorial(-10), 0);
 
   // Tests factorial of 0.
   EXPECT_EQ(1, Factorial(0));
@@ -117,20 +117,20 @@ TEST_F(IntegerFunctionTest, Factorial) {
 // Tests IsPrime()
 TEST_F(IntegerFunctionTest, IsPrime) {
   // Tests negative input.
-  EXPECT_TRUE(!IsPrime(-1));
-  EXPECT_TRUE(!IsPrime(-2));
-  EXPECT_TRUE(!IsPrime(INT_MIN));
+  EXPECT_FALSE(IsPrime(-1));
+  EXPECT_FALSE(IsPrime(-2));
+  EXPECT_FALSE(IsPrime(INT_MIN));
 
   // Tests some trivial cases.
-  EXPECT_TRUE(!IsPrime(0));
-  EXPECT_TRUE(!IsPrime(1));
+  EXPECT_FALSE(IsPrime(0));
+  EXPECT_FALSE(IsPrime(1));
   EXPECT_TRUE(IsPrime(2));
   EXPECT_TRUE(IsPrime(3));
 
   // Tests positive input.
-  EXPECT_TRUE(!IsPrime(4));
+  EXPECT_FALSE(IsPrime(4));
   EXPECT_TRUE(IsPrime(5));
-  EXPECT_TRUE(!IsPrime(6));
+  EXPECT_FALSE(IsPrime(6));
   EXPECT_TRUE(IsPrime(23));
 }
 
index 5ad2e2c..7274334 100755 (executable)
@@ -90,7 +90,7 @@ using ::testing::Combine;
 // PreCalculatedPrimeTable disabled. We do this by defining fixture which will
 // accept different combinations of parameters for instantiating a
 // HybridPrimeTable instance.
-class PrimeTableTest : public TestWithParam< ::std::tr1::tuple<bool, int> > {
+class PrimeTableTest : public TestWithParam< ::testing::tuple<bool, int> > {
  protected:
   virtual void SetUp() {
     // This can be written as
@@ -101,8 +101,8 @@ class PrimeTableTest : public TestWithParam< ::std::tr1::tuple<bool, int> > {
     //
     // once the Google C++ Style Guide allows use of ::std::tr1::tie.
     //
-    bool force_on_the_fly = ::std::tr1::get<0>(GetParam());
-    int max_precalculated = ::std::tr1::get<1>(GetParam());
+    bool force_on_the_fly = ::testing::get<0>(GetParam());
+    int max_precalculated = ::testing::get<1>(GetParam());
     table_ = new HybridPrimeTable(force_on_the_fly, max_precalculated);
   }
   virtual void TearDown() {
diff --git a/scripts/common.py b/scripts/common.py
new file mode 100755 (executable)
index 0000000..3c0347a
--- /dev/null
@@ -0,0 +1,83 @@
+# Copyright 2013 Google Inc. All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Shared utilities for writing scripts for Google Test/Mock."""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+
+import os
+import re
+
+
+# Matches the line from 'svn info .' output that describes what SVN
+# path the current local directory corresponds to.  For example, in
+# a googletest SVN workspace's trunk/test directory, the output will be:
+#
+# URL: https://googletest.googlecode.com/svn/trunk/test
+_SVN_INFO_URL_RE = re.compile(r'^URL: https://(\w+)\.googlecode\.com/svn(.*)')
+
+
+def GetCommandOutput(command):
+  """Runs the shell command and returns its stdout as a list of lines."""
+
+  f = os.popen(command, 'r')
+  lines = [line.strip() for line in f.readlines()]
+  f.close()
+  return lines
+
+
+def GetSvnInfo():
+  """Returns the project name and the current SVN workspace's root path."""
+
+  for line in GetCommandOutput('svn info .'):
+    m = _SVN_INFO_URL_RE.match(line)
+    if m:
+      project = m.group(1)  # googletest or googlemock
+      rel_path = m.group(2)
+      root = os.path.realpath(rel_path.count('/') * '../')
+      return project, root
+
+  return None, None
+
+
+def GetSvnTrunk():
+  """Returns the current SVN workspace's trunk root path."""
+
+  _, root = GetSvnInfo()
+  return root + '/trunk' if root else None
+
+
+def IsInGTestSvn():
+  project, _ = GetSvnInfo()
+  return project == 'googletest'
+
+
+def IsInGMockSvn():
+  project, _ = GetSvnInfo()
+  return project == 'googlemock'
index 57ef72f..3f3e9f3 100755 (executable)
@@ -60,7 +60,10 @@ __author__ = 'wan@google.com (Zhanyong Wan)'
 
 import os
 import re
-import sets
+try:
+  from sets import Set as set  # For Python 2.3 compatibility
+except ImportError:
+  pass
 import sys
 
 # We assume that this file is in the scripts/ directory in the Google
@@ -90,10 +93,10 @@ def VerifyFileExists(directory, relative_path):
   """
 
   if not os.path.isfile(os.path.join(directory, relative_path)):
-    print 'ERROR: Cannot find %s in directory %s.' % (relative_path,
-                                                      directory)
-    print ('Please either specify a valid project root directory '
-           'or omit it on the command line.')
+    print('ERROR: Cannot find %s in directory %s.' % (relative_path,
+                                                      directory))
+    print('Please either specify a valid project root directory '
+          'or omit it on the command line.')
     sys.exit(1)
 
 
@@ -119,11 +122,11 @@ def VerifyOutputFile(output_dir, relative_path):
     # TODO(wan@google.com): The following user-interaction doesn't
     # work with automated processes.  We should provide a way for the
     # Makefile to force overwriting the files.
-    print ('%s already exists in directory %s - overwrite it? (y/N) ' %
-           (relative_path, output_dir))
+    print('%s already exists in directory %s - overwrite it? (y/N) ' %
+          (relative_path, output_dir))
     answer = sys.stdin.readline().strip()
     if answer not in ['y', 'Y']:
-      print 'ABORTED.'
+      print('ABORTED.')
       sys.exit(1)
 
   # Makes sure the directory holding the output file exists; creates
@@ -146,8 +149,8 @@ def ValidateOutputDir(output_dir):
 def FuseGTestH(gtest_root, output_dir):
   """Scans folder gtest_root to generate gtest/gtest.h in output_dir."""
 
-  output_file = file(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')
-  processed_files = sets.Set()  # Holds all gtest headers we've processed.
+  output_file = open(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')
+  processed_files = set()  # Holds all gtest headers we've processed.
 
   def ProcessFile(gtest_header_path):
     """Processes the given gtest header file."""
@@ -159,7 +162,7 @@ def FuseGTestH(gtest_root, output_dir):
     processed_files.add(gtest_header_path)
 
     # Reads each line in the given gtest header.
-    for line in file(os.path.join(gtest_root, gtest_header_path), 'r'):
+    for line in open(os.path.join(gtest_root, gtest_header_path), 'r'):
       m = INCLUDE_GTEST_FILE_REGEX.match(line)
       if m:
         # It's '#include "gtest/..."' - let's process it recursively.
@@ -175,7 +178,7 @@ def FuseGTestH(gtest_root, output_dir):
 def FuseGTestAllCcToFile(gtest_root, output_file):
   """Scans folder gtest_root to generate gtest/gtest-all.cc in output_file."""
 
-  processed_files = sets.Set()
+  processed_files = set()
 
   def ProcessFile(gtest_source_file):
     """Processes the given gtest source file."""
@@ -187,7 +190,7 @@ def FuseGTestAllCcToFile(gtest_root, output_file):
     processed_files.add(gtest_source_file)
 
     # Reads each line in the given gtest source file.
-    for line in file(os.path.join(gtest_root, gtest_source_file), 'r'):
+    for line in open(os.path.join(gtest_root, gtest_source_file), 'r'):
       m = INCLUDE_GTEST_FILE_REGEX.match(line)
       if m:
         if 'include/' + m.group(1) == GTEST_SPI_H_SEED:
@@ -218,7 +221,7 @@ def FuseGTestAllCcToFile(gtest_root, output_file):
 def FuseGTestAllCc(gtest_root, output_dir):
   """Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir."""
 
-  output_file = file(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')
+  output_file = open(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')
   FuseGTestAllCcToFile(gtest_root, output_file)
   output_file.close()
 
@@ -242,7 +245,7 @@ def main():
     # fuse_gtest_files.py GTEST_ROOT_DIR OUTPUT_DIR
     FuseGTest(sys.argv[1], sys.argv[2])
   else:
-    print __doc__
+    print(__doc__)
     sys.exit(1)
 
 
index d35b4f0..3e7ab04 100755 (executable)
@@ -117,7 +117,7 @@ def HeaderPreamble(n):
 
 // Makes sure this header is not included before gtest.h.
 #ifndef GTEST_INCLUDE_GTEST_GTEST_H_
-#error Do not include gtest_pred_impl.h directly.  Include gtest.h instead.
+# error Do not include gtest_pred_impl.h directly.  Include gtest.h instead.
 #endif  // GTEST_INCLUDE_GTEST_GTEST_H_
 
 // This header implements a family of generic predicate assertion
@@ -256,7 +256,7 @@ AssertionResult AssertPred%(n)sHelper(const char* pred_text""" % DEFS
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT%(n)s.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT%(n)s_(pred_format, %(vs)s, on_failure)\\
-  GTEST_ASSERT_(pred_format(%(vts)s, %(vs)s),\\
+  GTEST_ASSERT_(pred_format(%(vts)s, %(vs)s), \\
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED%(n)s.  Don't use
diff --git a/scripts/gtest-config b/scripts/gtest-config
deleted file mode 100755 (executable)
index 29ccf81..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-#!/bin/sh
-
-# These variables are automatically filled in by the configure script.
-name="gtest"
-version="1.6.0"
-
-show_usage()
-{
-  echo "Usage: gtest-config [OPTIONS...]"
-}
-
-show_help()
-{
-  show_usage
-  cat <<\EOF
-
-The `gtest-config' script provides access to the necessary compile and linking
-flags to connect with Google C++ Testing Framework, both in a build prior to
-installation, and on the system proper after installation. The installation
-overrides may be issued in combination with any other queries, but will only
-affect installation queries if called on a built but not installed gtest. The
-installation queries may not be issued with any other types of queries, and
-only one installation query may be made at a time. The version queries and
-compiler flag queries may be combined as desired but not mixed. Different
-version queries are always combined with logical "and" semantics, and only the
-last of any particular query is used while all previous ones ignored. All
-versions must be specified as a sequence of numbers separated by periods.
-Compiler flag queries output the union of the sets of flags when combined.
-
- Examples:
-  gtest-config --min-version=1.0 || echo "Insufficient Google Test version."
-
-  g++ $(gtest-config --cppflags --cxxflags) -o foo.o -c foo.cpp
-  g++ $(gtest-config --ldflags --libs) -o foo foo.o
-
-  # When using a built but not installed Google Test:
-  g++ $(../../my_gtest_build/scripts/gtest-config ...) ...
-
-  # When using an installed Google Test, but with installation overrides:
-  export GTEST_PREFIX="/opt"
-  g++ $(gtest-config --libdir="/opt/lib64" ...) ...
-
- Help:
-  --usage                    brief usage information
-  --help                     display this help message
-
- Installation Overrides:
-  --prefix=<dir>             overrides the installation prefix
-  --exec-prefix=<dir>        overrides the executable installation prefix
-  --libdir=<dir>             overrides the library installation prefix
-  --includedir=<dir>         overrides the header file installation prefix
-
- Installation Queries:
-  --prefix                   installation prefix
-  --exec-prefix              executable installation prefix
-  --libdir                   library installation directory
-  --includedir               header file installation directory
-  --version                  the version of the Google Test installation
-
- Version Queries:
-  --min-version=VERSION      return 0 if the version is at least VERSION
-  --exact-version=VERSION    return 0 if the version is exactly VERSION
-  --max-version=VERSION      return 0 if the version is at most VERSION
-
- Compilation Flag Queries:
-  --cppflags                 compile flags specific to the C-like preprocessors
-  --cxxflags                 compile flags appropriate for C++ programs
-  --ldflags                  linker flags
-  --libs                     libraries for linking
-
-EOF
-}
-
-# This function bounds our version with a min and a max. It uses some clever
-# POSIX-compliant variable expansion to portably do all the work in the shell
-# and avoid any dependency on a particular "sed" or "awk" implementation.
-# Notable is that it will only ever compare the first 3 components of versions.
-# Further components will be cleanly stripped off. All versions must be
-# unadorned, so "v1.0" will *not* work. The minimum version must be in $1, and
-# the max in $2. TODO(chandlerc@google.com): If this ever breaks, we should
-# investigate expanding this via autom4te from AS_VERSION_COMPARE rather than
-# continuing to maintain our own shell version.
-check_versions()
-{
-  major_version=${version%%.*}
-  minor_version="0"
-  point_version="0"
-  if test "${version#*.}" != "${version}"; then
-    minor_version=${version#*.}
-    minor_version=${minor_version%%.*}
-  fi
-  if test "${version#*.*.}" != "${version}"; then
-    point_version=${version#*.*.}
-    point_version=${point_version%%.*}
-  fi
-
-  min_version="$1"
-  min_major_version=${min_version%%.*}
-  min_minor_version="0"
-  min_point_version="0"
-  if test "${min_version#*.}" != "${min_version}"; then
-    min_minor_version=${min_version#*.}
-    min_minor_version=${min_minor_version%%.*}
-  fi
-  if test "${min_version#*.*.}" != "${min_version}"; then
-    min_point_version=${min_version#*.*.}
-    min_point_version=${min_point_version%%.*}
-  fi
-
-  max_version="$2"
-  max_major_version=${max_version%%.*}
-  max_minor_version="0"
-  max_point_version="0"
-  if test "${max_version#*.}" != "${max_version}"; then
-    max_minor_version=${max_version#*.}
-    max_minor_version=${max_minor_version%%.*}
-  fi
-  if test "${max_version#*.*.}" != "${max_version}"; then
-    max_point_version=${max_version#*.*.}
-    max_point_version=${max_point_version%%.*}
-  fi
-
-  test $(($major_version)) -lt $(($min_major_version)) && exit 1
-  if test $(($major_version)) -eq $(($min_major_version)); then
-    test $(($minor_version)) -lt $(($min_minor_version)) && exit 1
-    if test $(($minor_version)) -eq $(($min_minor_version)); then
-      test $(($point_version)) -lt $(($min_point_version)) && exit 1
-    fi
-  fi
-
-  test $(($major_version)) -gt $(($max_major_version)) && exit 1
-  if test $(($major_version)) -eq $(($max_major_version)); then
-    test $(($minor_version)) -gt $(($max_minor_version)) && exit 1
-    if test $(($minor_version)) -eq $(($max_minor_version)); then
-      test $(($point_version)) -gt $(($max_point_version)) && exit 1
-    fi
-  fi
-
-  exit 0
-}
-
-# Show the usage line when no arguments are specified.
-if test $# -eq 0; then
-  show_usage
-  exit 1
-fi
-
-while test $# -gt 0; do
-  case $1 in
-    --usage)          show_usage;         exit 0;;
-    --help)           show_help;          exit 0;;
-
-    # Installation overrides
-    --prefix=*)       GTEST_PREFIX=${1#--prefix=};;
-    --exec-prefix=*)  GTEST_EXEC_PREFIX=${1#--exec-prefix=};;
-    --libdir=*)       GTEST_LIBDIR=${1#--libdir=};;
-    --includedir=*)   GTEST_INCLUDEDIR=${1#--includedir=};;
-
-    # Installation queries
-    --prefix|--exec-prefix|--libdir|--includedir|--version)
-      if test -n "${do_query}"; then
-        show_usage
-        exit 1
-      fi
-      do_query=${1#--}
-      ;;
-
-    # Version checking
-    --min-version=*)
-      do_check_versions=yes
-      min_version=${1#--min-version=}
-      ;;
-    --max-version=*)
-      do_check_versions=yes
-      max_version=${1#--max-version=}
-      ;;
-    --exact-version=*)
-      do_check_versions=yes
-      exact_version=${1#--exact-version=}
-      ;;
-
-    # Compiler flag output
-    --cppflags)       echo_cppflags=yes;;
-    --cxxflags)       echo_cxxflags=yes;;
-    --ldflags)        echo_ldflags=yes;;
-    --libs)           echo_libs=yes;;
-
-    # Everything else is an error
-    *)                show_usage;         exit 1;;
-  esac
-  shift
-done
-
-# These have defaults filled in by the configure script but can also be
-# overridden by environment variables or command line parameters.
-prefix="${GTEST_PREFIX:-/usr/local}"
-exec_prefix="${GTEST_EXEC_PREFIX:-${prefix}}"
-libdir="${GTEST_LIBDIR:-${exec_prefix}/lib}"
-includedir="${GTEST_INCLUDEDIR:-${prefix}/include}"
-
-# We try and detect if our binary is not located at its installed location. If
-# it's not, we provide variables pointing to the source and build tree rather
-# than to the install tree. This allows building against a just-built gtest
-# rather than an installed gtest.
-bindir="${exec_prefix}/bin"
-this_relative_bindir=`dirname $0`
-this_bindir=`cd ${this_relative_bindir}; pwd -P`
-if test "${this_bindir}" = "${this_bindir%${bindir}}"; then
-  # The path to the script doesn't end in the bindir sequence from Autoconf,
-  # assume that we are in a build tree.
-  build_dir=`dirname ${this_bindir}`
-  src_dir=`cd ${this_bindir}/..; pwd -P`
-
-  # TODO(chandlerc@google.com): This is a dangerous dependency on libtool, we
-  # should work to remove it, and/or remove libtool altogether, replacing it
-  # with direct references to the library and a link path.
-  gtest_libs="${build_dir}/lib/libgtest.la -pthread "
-  gtest_ldflags=""
-
-  # We provide hooks to include from either the source or build dir, where the
-  # build dir is always preferred. This will potentially allow us to write
-  # build rules for generated headers and have them automatically be preferred
-  # over provided versions.
-  gtest_cppflags="-I${build_dir}/include -I${src_dir}/include"
-  gtest_cxxflags="-pthread"
-else
-  # We're using an installed gtest, although it may be staged under some
-  # prefix. Assume (as our own libraries do) that we can resolve the prefix,
-  # and are present in the dynamic link paths.
-  gtest_ldflags="-L${libdir}"
-  gtest_libs="-l${name} -pthread "
-  gtest_cppflags="-I${includedir}"
-  gtest_cxxflags="-pthread"
-fi
-
-# Do an installation query if requested.
-if test -n "$do_query"; then
-  case $do_query in
-    prefix)           echo $prefix;       exit 0;;
-    exec-prefix)      echo $exec_prefix;  exit 0;;
-    libdir)           echo $libdir;       exit 0;;
-    includedir)       echo $includedir;   exit 0;;
-    version)          echo $version;      exit 0;;
-    *)                show_usage;         exit 1;;
-  esac
-fi
-
-# Do a version check if requested.
-if test "$do_check_versions" = "yes"; then
-  # Make sure we didn't receive a bad combination of parameters.
-  test "$echo_cppflags" = "yes" && show_usage && exit 1
-  test "$echo_cxxflags" = "yes" && show_usage && exit 1
-  test "$echo_ldflags" = "yes"  && show_usage && exit 1
-  test "$echo_libs" = "yes"     && show_usage && exit 1
-
-  if test "$exact_version" != ""; then
-    check_versions $exact_version $exact_version
-    # unreachable
-  else
-    check_versions ${min_version:-0.0.0} ${max_version:-9999.9999.9999}
-    # unreachable
-  fi
-fi
-
-# Do the output in the correct order so that these can be used in-line of
-# a compiler invocation.
-output=""
-test "$echo_cppflags" = "yes" && output="$output $gtest_cppflags"
-test "$echo_cxxflags" = "yes" && output="$output $gtest_cxxflags"
-test "$echo_ldflags" = "yes"  && output="$output $gtest_ldflags"
-test "$echo_libs" = "yes"     && output="$output $gtest_libs"
-echo $output
-
-exit 0
index 9c72638..780f843 100755 (executable)
@@ -209,7 +209,7 @@ if test "${this_bindir}" = "${this_bindir%${bindir}}"; then
   # The path to the script doesn't end in the bindir sequence from Autoconf,
   # assume that we are in a build tree.
   build_dir=`dirname ${this_bindir}`
-  src_dir=`cd ${this_bindir}/@top_srcdir@; pwd -P`
+  src_dir=`cd ${this_bindir}; cd @top_srcdir@; pwd -P`
 
   # TODO(chandlerc@google.com): This is a dangerous dependency on libtool, we
   # should work to remove it, and/or remove libtool altogether, replacing it
index 8afe808..5efb653 100755 (executable)
@@ -704,14 +704,14 @@ def RunCode(env, code_node, output):
     RunAtomicCode(env, atomic_code, output)
 
 
-def IsComment(cur_line):
+def IsSingleLineComment(cur_line):
   return '//' in cur_line
 
 
-def IsInPreprocessorDirevative(prev_lines, cur_line):
+def IsInPreprocessorDirective(prev_lines, cur_line):
   if cur_line.lstrip().startswith('#'):
     return True
-  return prev_lines != [] and prev_lines[-1].endswith('\\')
+  return prev_lines and prev_lines[-1].endswith('\\')
 
 
 def WrapComment(line, output):
@@ -768,7 +768,7 @@ def WrapCode(line, line_concat, output):
     output.append(prefix + cur_line.strip())
 
 
-def WrapPreprocessorDirevative(line, output):
+def WrapPreprocessorDirective(line, output):
   WrapCode(line, ' \\', output)
 
 
@@ -776,29 +776,37 @@ def WrapPlainCode(line, output):
   WrapCode(line, '', output)
 
 
-def IsHeaderGuardOrInclude(line):
+def IsMultiLineIWYUPragma(line):
+  return re.search(r'/\* IWYU pragma: ', line)
+
+
+def IsHeaderGuardIncludeOrOneLineIWYUPragma(line):
   return (re.match(r'^#(ifndef|define|endif\s*//)\s*[\w_]+\s*$', line) or
-          re.match(r'^#include\s', line))
+          re.match(r'^#include\s', line) or
+          # Don't break IWYU pragmas, either; that causes iwyu.py problems.
+          re.search(r'// IWYU pragma: ', line))
 
 
 def WrapLongLine(line, output):
   line = line.rstrip()
   if len(line) <= 80:
     output.append(line)
-  elif IsComment(line):
-    if IsHeaderGuardOrInclude(line):
-      # The style guide made an exception to allow long header guard lines
-      # and includes.
+  elif IsSingleLineComment(line):
+    if IsHeaderGuardIncludeOrOneLineIWYUPragma(line):
+      # The style guide made an exception to allow long header guard lines,
+      # includes and IWYU pragmas.
       output.append(line)
     else:
       WrapComment(line, output)
-  elif IsInPreprocessorDirevative(output, line):
-    if IsHeaderGuardOrInclude(line):
-      # The style guide made an exception to allow long header guard lines
-      # and includes.
+  elif IsInPreprocessorDirective(output, line):
+    if IsHeaderGuardIncludeOrOneLineIWYUPragma(line):
+      # The style guide made an exception to allow long header guard lines,
+      # includes and IWYU pragmas.
       output.append(line)
     else:
-      WrapPreprocessorDirevative(line, output)
+      WrapPreprocessorDirective(line, output)
+  elif IsMultiLineIWYUPragma(line):
+    output.append(line)
   else:
     WrapPlainCode(line, output)
 
diff --git a/scripts/release_docs.py b/scripts/release_docs.py
new file mode 100755 (executable)
index 0000000..1291347
--- /dev/null
@@ -0,0 +1,158 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Google Inc. All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Script for branching Google Test/Mock wiki pages for a new version.
+
+SYNOPSIS
+       release_docs.py NEW_RELEASE_VERSION
+
+       Google Test and Google Mock's external user documentation is in
+       interlinked wiki files.  When we release a new version of
+       Google Test or Google Mock, we need to branch the wiki files
+       such that users of a specific version of Google Test/Mock can
+       look up documenation relevant for that version.  This script
+       automates that process by:
+
+         - branching the current wiki pages (which document the
+           behavior of the SVN trunk head) to pages for the specified
+           version (e.g. branching FAQ.wiki to V2_6_FAQ.wiki when
+           NEW_RELEASE_VERSION is 2.6);
+         - updating the links in the branched files to point to the branched
+           version (e.g. a link in V2_6_FAQ.wiki that pointed to
+           Primer.wiki#Anchor will now point to V2_6_Primer.wiki#Anchor).
+
+       NOTE: NEW_RELEASE_VERSION must be a NEW version number for
+       which the wiki pages don't yet exist; otherwise you'll get SVN
+       errors like "svn: Path 'V1_7_PumpManual.wiki' is not a
+       directory" when running the script.
+
+EXAMPLE
+       $ cd PATH/TO/GTEST_SVN_WORKSPACE/trunk
+       $ scripts/release_docs.py 2.6  # create wiki pages for v2.6
+       $ svn status                   # verify the file list
+       $ svn diff                     # verify the file contents
+       $ svn commit -m "release wiki pages for v2.6"
+"""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import re
+import sys
+
+import common
+
+
+# Wiki pages that shouldn't be branched for every gtest/gmock release.
+GTEST_UNVERSIONED_WIKIS = ['DevGuide.wiki']
+GMOCK_UNVERSIONED_WIKIS = [
+    'DesignDoc.wiki',
+    'DevGuide.wiki',
+    'KnownIssues.wiki'
+    ]
+
+
+def DropWikiSuffix(wiki_filename):
+  """Removes the .wiki suffix (if any) from the given filename."""
+
+  return (wiki_filename[:-len('.wiki')] if wiki_filename.endswith('.wiki')
+          else wiki_filename)
+
+
+class WikiBrancher(object):
+  """Branches ..."""
+
+  def __init__(self, dot_version):
+    self.project, svn_root_path = common.GetSvnInfo()
+    if self.project not in ('googletest', 'googlemock'):
+      sys.exit('This script must be run in a gtest or gmock SVN workspace.')
+    self.wiki_dir = svn_root_path + '/wiki'
+    # Turn '2.6' to 'V2_6_'.
+    self.version_prefix = 'V' + dot_version.replace('.', '_') + '_'
+    self.files_to_branch = self.GetFilesToBranch()
+    page_names = [DropWikiSuffix(f) for f in self.files_to_branch]
+    # A link to Foo.wiki is in one of the following forms:
+    #   [Foo words]
+    #   [Foo#Anchor words]
+    #   [http://code.google.com/.../wiki/Foo words]
+    #   [http://code.google.com/.../wiki/Foo#Anchor words]
+    # We want to replace 'Foo' with 'V2_6_Foo' in the above cases.
+    self.search_for_re = re.compile(
+        # This regex matches either
+        #   [Foo
+        # or
+        #   /wiki/Foo
+        # followed by a space or a #, where Foo is the name of an
+        # unversioned wiki page.
+        r'(\[|/wiki/)(%s)([ #])' % '|'.join(page_names))
+    self.replace_with = r'\1%s\2\3' % (self.version_prefix,)
+
+  def GetFilesToBranch(self):
+    """Returns a list of .wiki file names that need to be branched."""
+
+    unversioned_wikis = (GTEST_UNVERSIONED_WIKIS if self.project == 'googletest'
+                         else GMOCK_UNVERSIONED_WIKIS)
+    return [f for f in os.listdir(self.wiki_dir)
+            if (f.endswith('.wiki') and
+                not re.match(r'^V\d', f) and  # Excluded versioned .wiki files.
+                f not in unversioned_wikis)]
+
+  def BranchFiles(self):
+    """Branches the .wiki files needed to be branched."""
+
+    print 'Branching %d .wiki files:' % (len(self.files_to_branch),)
+    os.chdir(self.wiki_dir)
+    for f in self.files_to_branch:
+      command = 'svn cp %s %s%s' % (f, self.version_prefix, f)
+      print command
+      os.system(command)
+
+  def UpdateLinksInBranchedFiles(self):
+
+    for f in self.files_to_branch:
+      source_file = os.path.join(self.wiki_dir, f)
+      versioned_file = os.path.join(self.wiki_dir, self.version_prefix + f)
+      print 'Updating links in %s.' % (versioned_file,)
+      text = file(source_file, 'r').read()
+      new_text = self.search_for_re.sub(self.replace_with, text)
+      file(versioned_file, 'w').write(new_text)
+
+
+def main():
+  if len(sys.argv) != 2:
+    sys.exit(__doc__)
+
+  brancher = WikiBrancher(sys.argv[1])
+  brancher.BranchFiles()
+  brancher.UpdateLinksInBranchedFiles()
+
+
+if __name__ == '__main__':
+  main()
diff --git a/scripts/upload.py b/scripts/upload.py
new file mode 100755 (executable)
index 0000000..6e6f9a1
--- /dev/null
@@ -0,0 +1,1387 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Tool for uploading diffs from a version control system to the codereview app.
+
+Usage summary: upload.py [options] [-- diff_options]
+
+Diff options are passed to the diff command of the underlying system.
+
+Supported version control systems:
+  Git
+  Mercurial
+  Subversion
+
+It is important for Git/Mercurial users to specify a tree/node/branch to diff
+against by using the '--rev' option.
+"""
+# This code is derived from appcfg.py in the App Engine SDK (open source),
+# and from ASPN recipe #146306.
+
+import cookielib
+import getpass
+import logging
+import md5
+import mimetypes
+import optparse
+import os
+import re
+import socket
+import subprocess
+import sys
+import urllib
+import urllib2
+import urlparse
+
+try:
+  import readline
+except ImportError:
+  pass
+
+# The logging verbosity:
+#  0: Errors only.
+#  1: Status messages.
+#  2: Info logs.
+#  3: Debug logs.
+verbosity = 1
+
+# Max size of patch or base file.
+MAX_UPLOAD_SIZE = 900 * 1024
+
+
+def GetEmail(prompt):
+  """Prompts the user for their email address and returns it.
+
+  The last used email address is saved to a file and offered up as a suggestion
+  to the user. If the user presses enter without typing in anything the last
+  used email address is used. If the user enters a new address, it is saved
+  for next time we prompt.
+
+  """
+  last_email_file_name = os.path.expanduser("~/.last_codereview_email_address")
+  last_email = ""
+  if os.path.exists(last_email_file_name):
+    try:
+      last_email_file = open(last_email_file_name, "r")
+      last_email = last_email_file.readline().strip("\n")
+      last_email_file.close()
+      prompt += " [%s]" % last_email
+    except IOError, e:
+      pass
+  email = raw_input(prompt + ": ").strip()
+  if email:
+    try:
+      last_email_file = open(last_email_file_name, "w")
+      last_email_file.write(email)
+      last_email_file.close()
+    except IOError, e:
+      pass
+  else:
+    email = last_email
+  return email
+
+
+def StatusUpdate(msg):
+  """Print a status message to stdout.
+
+  If 'verbosity' is greater than 0, print the message.
+
+  Args:
+    msg: The string to print.
+  """
+  if verbosity > 0:
+    print msg
+
+
+def ErrorExit(msg):
+  """Print an error message to stderr and exit."""
+  print >>sys.stderr, msg
+  sys.exit(1)
+
+
+class ClientLoginError(urllib2.HTTPError):
+  """Raised to indicate there was an error authenticating with ClientLogin."""
+
+  def __init__(self, url, code, msg, headers, args):
+    urllib2.HTTPError.__init__(self, url, code, msg, headers, None)
+    self.args = args
+    self.reason = args["Error"]
+
+
+class AbstractRpcServer(object):
+  """Provides a common interface for a simple RPC server."""
+
+  def __init__(self, host, auth_function, host_override=None, extra_headers={},
+               save_cookies=False):
+    """Creates a new HttpRpcServer.
+
+    Args:
+      host: The host to send requests to.
+      auth_function: A function that takes no arguments and returns an
+        (email, password) tuple when called. Will be called if authentication
+        is required.
+      host_override: The host header to send to the server (defaults to host).
+      extra_headers: A dict of extra headers to append to every request.
+      save_cookies: If True, save the authentication cookies to local disk.
+        If False, use an in-memory cookiejar instead.  Subclasses must
+        implement this functionality.  Defaults to False.
+    """
+    self.host = host
+    self.host_override = host_override
+    self.auth_function = auth_function
+    self.authenticated = False
+    self.extra_headers = extra_headers
+    self.save_cookies = save_cookies
+    self.opener = self._GetOpener()
+    if self.host_override:
+      logging.info("Server: %s; Host: %s", self.host, self.host_override)
+    else:
+      logging.info("Server: %s", self.host)
+
+  def _GetOpener(self):
+    """Returns an OpenerDirector for making HTTP requests.
+
+    Returns:
+      A urllib2.OpenerDirector object.
+    """
+    raise NotImplementedError()
+
+  def _CreateRequest(self, url, data=None):
+    """Creates a new urllib request."""
+    logging.debug("Creating request for: '%s' with payload:\n%s", url, data)
+    req = urllib2.Request(url, data=data)
+    if self.host_override:
+      req.add_header("Host", self.host_override)
+    for key, value in self.extra_headers.iteritems():
+      req.add_header(key, value)
+    return req
+
+  def _GetAuthToken(self, email, password):
+    """Uses ClientLogin to authenticate the user, returning an auth token.
+
+    Args:
+      email:    The user's email address
+      password: The user's password
+
+    Raises:
+      ClientLoginError: If there was an error authenticating with ClientLogin.
+      HTTPError: If there was some other form of HTTP error.
+
+    Returns:
+      The authentication token returned by ClientLogin.
+    """
+    account_type = "GOOGLE"
+    if self.host.endswith(".google.com"):
+      # Needed for use inside Google.
+      account_type = "HOSTED"
+    req = self._CreateRequest(
+        url="https://www.google.com/accounts/ClientLogin",
+        data=urllib.urlencode({
+            "Email": email,
+            "Passwd": password,
+            "service": "ah",
+            "source": "rietveld-codereview-upload",
+            "accountType": account_type,
+        }),
+    )
+    try:
+      response = self.opener.open(req)
+      response_body = response.read()
+      response_dict = dict(x.split("=")
+                           for x in response_body.split("\n") if x)
+      return response_dict["Auth"]
+    except urllib2.HTTPError, e:
+      if e.code == 403:
+        body = e.read()
+        response_dict = dict(x.split("=", 1) for x in body.split("\n") if x)
+        raise ClientLoginError(req.get_full_url(), e.code, e.msg,
+                               e.headers, response_dict)
+      else:
+        raise
+
+  def _GetAuthCookie(self, auth_token):
+    """Fetches authentication cookies for an authentication token.
+
+    Args:
+      auth_token: The authentication token returned by ClientLogin.
+
+    Raises:
+      HTTPError: If there was an error fetching the authentication cookies.
+    """
+    # This is a dummy value to allow us to identify when we're successful.
+    continue_location = "http://localhost/"
+    args = {"continue": continue_location, "auth": auth_token}
+    req = self._CreateRequest("http://%s/_ah/login?%s" %
+                              (self.host, urllib.urlencode(args)))
+    try:
+      response = self.opener.open(req)
+    except urllib2.HTTPError, e:
+      response = e
+    if (response.code != 302 or
+        response.info()["location"] != continue_location):
+      raise urllib2.HTTPError(req.get_full_url(), response.code, response.msg,
+                              response.headers, response.fp)
+    self.authenticated = True
+
+  def _Authenticate(self):
+    """Authenticates the user.
+
+    The authentication process works as follows:
+     1) We get a username and password from the user
+     2) We use ClientLogin to obtain an AUTH token for the user
+        (see http://code.google.com/apis/accounts/AuthForInstalledApps.html).
+     3) We pass the auth token to /_ah/login on the server to obtain an
+        authentication cookie. If login was successful, it tries to redirect
+        us to the URL we provided.
+
+    If we attempt to access the upload API without first obtaining an
+    authentication cookie, it returns a 401 response and directs us to
+    authenticate ourselves with ClientLogin.
+    """
+    for i in range(3):
+      credentials = self.auth_function()
+      try:
+        auth_token = self._GetAuthToken(credentials[0], credentials[1])
+      except ClientLoginError, e:
+        if e.reason == "BadAuthentication":
+          print >>sys.stderr, "Invalid username or password."
+          continue
+        if e.reason == "CaptchaRequired":
+          print >>sys.stderr, (
+              "Please go to\n"
+              "https://www.google.com/accounts/DisplayUnlockCaptcha\n"
+              "and verify you are a human.  Then try again.")
+          break
+        if e.reason == "NotVerified":
+          print >>sys.stderr, "Account not verified."
+          break
+        if e.reason == "TermsNotAgreed":
+          print >>sys.stderr, "User has not agreed to TOS."
+          break
+        if e.reason == "AccountDeleted":
+          print >>sys.stderr, "The user account has been deleted."
+          break
+        if e.reason == "AccountDisabled":
+          print >>sys.stderr, "The user account has been disabled."
+          break
+        if e.reason == "ServiceDisabled":
+          print >>sys.stderr, ("The user's access to the service has been "
+                               "disabled.")
+          break
+        if e.reason == "ServiceUnavailable":
+          print >>sys.stderr, "The service is not available; try again later."
+          break
+        raise
+      self._GetAuthCookie(auth_token)
+      return
+
+  def Send(self, request_path, payload=None,
+           content_type="application/octet-stream",
+           timeout=None,
+           **kwargs):
+    """Sends an RPC and returns the response.
+
+    Args:
+      request_path: The path to send the request to, eg /api/appversion/create.
+      payload: The body of the request, or None to send an empty request.
+      content_type: The Content-Type header to use.
+      timeout: timeout in seconds; default None i.e. no timeout.
+        (Note: for large requests on OS X, the timeout doesn't work right.)
+      kwargs: Any keyword arguments are converted into query string parameters.
+
+    Returns:
+      The response body, as a string.
+    """
+    # TODO: Don't require authentication.  Let the server say
+    # whether it is necessary.
+    if not self.authenticated:
+      self._Authenticate()
+
+    old_timeout = socket.getdefaulttimeout()
+    socket.setdefaulttimeout(timeout)
+    try:
+      tries = 0
+      while True:
+        tries += 1
+        args = dict(kwargs)
+        url = "http://%s%s" % (self.host, request_path)
+        if args:
+          url += "?" + urllib.urlencode(args)
+        req = self._CreateRequest(url=url, data=payload)
+        req.add_header("Content-Type", content_type)
+        try:
+          f = self.opener.open(req)
+          response = f.read()
+          f.close()
+          return response
+        except urllib2.HTTPError, e:
+          if tries > 3:
+            raise
+          elif e.code == 401:
+            self._Authenticate()
+##           elif e.code >= 500 and e.code < 600:
+##             # Server Error - try again.
+##             continue
+          else:
+            raise
+    finally:
+      socket.setdefaulttimeout(old_timeout)
+
+
+class HttpRpcServer(AbstractRpcServer):
+  """Provides a simplified RPC-style interface for HTTP requests."""
+
+  def _Authenticate(self):
+    """Save the cookie jar after authentication."""
+    super(HttpRpcServer, self)._Authenticate()
+    if self.save_cookies:
+      StatusUpdate("Saving authentication cookies to %s" % self.cookie_file)
+      self.cookie_jar.save()
+
+  def _GetOpener(self):
+    """Returns an OpenerDirector that supports cookies and ignores redirects.
+
+    Returns:
+      A urllib2.OpenerDirector object.
+    """
+    opener = urllib2.OpenerDirector()
+    opener.add_handler(urllib2.ProxyHandler())
+    opener.add_handler(urllib2.UnknownHandler())
+    opener.add_handler(urllib2.HTTPHandler())
+    opener.add_handler(urllib2.HTTPDefaultErrorHandler())
+    opener.add_handler(urllib2.HTTPSHandler())
+    opener.add_handler(urllib2.HTTPErrorProcessor())
+    if self.save_cookies:
+      self.cookie_file = os.path.expanduser("~/.codereview_upload_cookies")
+      self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file)
+      if os.path.exists(self.cookie_file):
+        try:
+          self.cookie_jar.load()
+          self.authenticated = True
+          StatusUpdate("Loaded authentication cookies from %s" %
+                       self.cookie_file)
+        except (cookielib.LoadError, IOError):
+          # Failed to load cookies - just ignore them.
+          pass
+      else:
+        # Create an empty cookie file with mode 600
+        fd = os.open(self.cookie_file, os.O_CREAT, 0600)
+        os.close(fd)
+      # Always chmod the cookie file
+      os.chmod(self.cookie_file, 0600)
+    else:
+      # Don't save cookies across runs of update.py.
+      self.cookie_jar = cookielib.CookieJar()
+    opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar))
+    return opener
+
+
+parser = optparse.OptionParser(usage="%prog [options] [-- diff_options]")
+parser.add_option("-y", "--assume_yes", action="store_true",
+                  dest="assume_yes", default=False,
+                  help="Assume that the answer to yes/no questions is 'yes'.")
+# Logging
+group = parser.add_option_group("Logging options")
+group.add_option("-q", "--quiet", action="store_const", const=0,
+                 dest="verbose", help="Print errors only.")
+group.add_option("-v", "--verbose", action="store_const", const=2,
+                 dest="verbose", default=1,
+                 help="Print info level logs (default).")
+group.add_option("--noisy", action="store_const", const=3,
+                 dest="verbose", help="Print all logs.")
+# Review server
+group = parser.add_option_group("Review server options")
+group.add_option("-s", "--server", action="store", dest="server",
+                 default="codereview.appspot.com",
+                 metavar="SERVER",
+                 help=("The server to upload to. The format is host[:port]. "
+                       "Defaults to 'codereview.appspot.com'."))
+group.add_option("-e", "--email", action="store", dest="email",
+                 metavar="EMAIL", default=None,
+                 help="The username to use. Will prompt if omitted.")
+group.add_option("-H", "--host", action="store", dest="host",
+                 metavar="HOST", default=None,
+                 help="Overrides the Host header sent with all RPCs.")
+group.add_option("--no_cookies", action="store_false",
+                 dest="save_cookies", default=True,
+                 help="Do not save authentication cookies to local disk.")
+# Issue
+group = parser.add_option_group("Issue options")
+group.add_option("-d", "--description", action="store", dest="description",
+                 metavar="DESCRIPTION", default=None,
+                 help="Optional description when creating an issue.")
+group.add_option("-f", "--description_file", action="store",
+                 dest="description_file", metavar="DESCRIPTION_FILE",
+                 default=None,
+                 help="Optional path of a file that contains "
+                      "the description when creating an issue.")
+group.add_option("-r", "--reviewers", action="store", dest="reviewers",
+                 metavar="REVIEWERS", default=None,
+                 help="Add reviewers (comma separated email addresses).")
+group.add_option("--cc", action="store", dest="cc",
+                 metavar="CC", default=None,
+                 help="Add CC (comma separated email addresses).")
+# Upload options
+group = parser.add_option_group("Patch options")
+group.add_option("-m", "--message", action="store", dest="message",
+                 metavar="MESSAGE", default=None,
+                 help="A message to identify the patch. "
+                      "Will prompt if omitted.")
+group.add_option("-i", "--issue", type="int", action="store",
+                 metavar="ISSUE", default=None,
+                 help="Issue number to which to add. Defaults to new issue.")
+group.add_option("--download_base", action="store_true",
+                 dest="download_base", default=False,
+                 help="Base files will be downloaded by the server "
+                 "(side-by-side diffs may not work on files with CRs).")
+group.add_option("--rev", action="store", dest="revision",
+                 metavar="REV", default=None,
+                 help="Branch/tree/revision to diff against (used by DVCS).")
+group.add_option("--send_mail", action="store_true",
+                 dest="send_mail", default=False,
+                 help="Send notification email to reviewers.")
+
+
+def GetRpcServer(options):
+  """Returns an instance of an AbstractRpcServer.
+
+  Returns:
+    A new AbstractRpcServer, on which RPC calls can be made.
+  """
+
+  rpc_server_class = HttpRpcServer
+
+  def GetUserCredentials():
+    """Prompts the user for a username and password."""
+    email = options.email
+    if email is None:
+      email = GetEmail("Email (login for uploading to %s)" % options.server)
+    password = getpass.getpass("Password for %s: " % email)
+    return (email, password)
+
+  # If this is the dev_appserver, use fake authentication.
+  host = (options.host or options.server).lower()
+  if host == "localhost" or host.startswith("localhost:"):
+    email = options.email
+    if email is None:
+      email = "test@example.com"
+      logging.info("Using debug user %s.  Override with --email" % email)
+    server = rpc_server_class(
+        options.server,
+        lambda: (email, "password"),
+        host_override=options.host,
+        extra_headers={"Cookie":
+                       'dev_appserver_login="%s:False"' % email},
+        save_cookies=options.save_cookies)
+    # Don't try to talk to ClientLogin.
+    server.authenticated = True
+    return server
+
+  return rpc_server_class(options.server, GetUserCredentials,
+                          host_override=options.host,
+                          save_cookies=options.save_cookies)
+
+
+def EncodeMultipartFormData(fields, files):
+  """Encode form fields for multipart/form-data.
+
+  Args:
+    fields: A sequence of (name, value) elements for regular form fields.
+    files: A sequence of (name, filename, value) elements for data to be
+           uploaded as files.
+  Returns:
+    (content_type, body) ready for httplib.HTTP instance.
+
+  Source:
+    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306
+  """
+  BOUNDARY = '-M-A-G-I-C---B-O-U-N-D-A-R-Y-'
+  CRLF = '\r\n'
+  lines = []
+  for (key, value) in fields:
+    lines.append('--' + BOUNDARY)
+    lines.append('Content-Disposition: form-data; name="%s"' % key)
+    lines.append('')
+    lines.append(value)
+  for (key, filename, value) in files:
+    lines.append('--' + BOUNDARY)
+    lines.append('Content-Disposition: form-data; name="%s"; filename="%s"' %
+             (key, filename))
+    lines.append('Content-Type: %s' % GetContentType(filename))
+    lines.append('')
+    lines.append(value)
+  lines.append('--' + BOUNDARY + '--')
+  lines.append('')
+  body = CRLF.join(lines)
+  content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
+  return content_type, body
+
+
+def GetContentType(filename):
+  """Helper to guess the content-type from the filename."""
+  return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
+
+
+# Use a shell for subcommands on Windows to get a PATH search.
+use_shell = sys.platform.startswith("win")
+
+def RunShellWithReturnCode(command, print_output=False,
+                           universal_newlines=True):
+  """Executes a command and returns the output from stdout and the return code.
+
+  Args:
+    command: Command to execute.
+    print_output: If True, the output is printed to stdout.
+                  If False, both stdout and stderr are ignored.
+    universal_newlines: Use universal_newlines flag (default: True).
+
+  Returns:
+    Tuple (output, return code)
+  """
+  logging.info("Running %s", command)
+  p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+                       shell=use_shell, universal_newlines=universal_newlines)
+  if print_output:
+    output_array = []
+    while True:
+      line = p.stdout.readline()
+      if not line:
+        break
+      print line.strip("\n")
+      output_array.append(line)
+    output = "".join(output_array)
+  else:
+    output = p.stdout.read()
+  p.wait()
+  errout = p.stderr.read()
+  if print_output and errout:
+    print >>sys.stderr, errout
+  p.stdout.close()
+  p.stderr.close()
+  return output, p.returncode
+
+
+def RunShell(command, silent_ok=False, universal_newlines=True,
+             print_output=False):
+  data, retcode = RunShellWithReturnCode(command, print_output,
+                                         universal_newlines)
+  if retcode:
+    ErrorExit("Got error status from %s:\n%s" % (command, data))
+  if not silent_ok and not data:
+    ErrorExit("No output from %s" % command)
+  return data
+
+
+class VersionControlSystem(object):
+  """Abstract base class providing an interface to the VCS."""
+
+  def __init__(self, options):
+    """Constructor.
+
+    Args:
+      options: Command line options.
+    """
+    self.options = options
+
+  def GenerateDiff(self, args):
+    """Return the current diff as a string.
+
+    Args:
+      args: Extra arguments to pass to the diff command.
+    """
+    raise NotImplementedError(
+        "abstract method -- subclass %s must override" % self.__class__)
+
+  def GetUnknownFiles(self):
+    """Return a list of files unknown to the VCS."""
+    raise NotImplementedError(
+        "abstract method -- subclass %s must override" % self.__class__)
+
+  def CheckForUnknownFiles(self):
+    """Show an "are you sure?" prompt if there are unknown files."""
+    unknown_files = self.GetUnknownFiles()
+    if unknown_files:
+      print "The following files are not added to version control:"
+      for line in unknown_files:
+        print line
+      prompt = "Are you sure to continue?(y/N) "
+      answer = raw_input(prompt).strip()
+      if answer != "y":
+        ErrorExit("User aborted")
+
+  def GetBaseFile(self, filename):
+    """Get the content of the upstream version of a file.
+
+    Returns:
+      A tuple (base_content, new_content, is_binary, status)
+        base_content: The contents of the base file.
+        new_content: For text files, this is empty.  For binary files, this is
+          the contents of the new file, since the diff output won't contain
+          information to reconstruct the current file.
+        is_binary: True iff the file is binary.
+        status: The status of the file.
+    """
+
+    raise NotImplementedError(
+        "abstract method -- subclass %s must override" % self.__class__)
+
+
+  def GetBaseFiles(self, diff):
+    """Helper that calls GetBase file for each file in the patch.
+
+    Returns:
+      A dictionary that maps from filename to GetBaseFile's tuple.  Filenames
+      are retrieved based on lines that start with "Index:" or
+      "Property changes on:".
+    """
+    files = {}
+    for line in diff.splitlines(True):
+      if line.startswith('Index:') or line.startswith('Property changes on:'):
+        unused, filename = line.split(':', 1)
+        # On Windows if a file has property changes its filename uses '\'
+        # instead of '/'.
+        filename = filename.strip().replace('\\', '/')
+        files[filename] = self.GetBaseFile(filename)
+    return files
+
+
+  def UploadBaseFiles(self, issue, rpc_server, patch_list, patchset, options,
+                      files):
+    """Uploads the base files (and if necessary, the current ones as well)."""
+
+    def UploadFile(filename, file_id, content, is_binary, status, is_base):
+      """Uploads a file to the server."""
+      file_too_large = False
+      if is_base:
+        type = "base"
+      else:
+        type = "current"
+      if len(content) > MAX_UPLOAD_SIZE:
+        print ("Not uploading the %s file for %s because it's too large." %
+               (type, filename))
+        file_too_large = True
+        content = ""
+      checksum = md5.new(content).hexdigest()
+      if options.verbose > 0 and not file_too_large:
+        print "Uploading %s file for %s" % (type, filename)
+      url = "/%d/upload_content/%d/%d" % (int(issue), int(patchset), file_id)
+      form_fields = [("filename", filename),
+                     ("status", status),
+                     ("checksum", checksum),
+                     ("is_binary", str(is_binary)),
+                     ("is_current", str(not is_base)),
+                    ]
+      if file_too_large:
+        form_fields.append(("file_too_large", "1"))
+      if options.email:
+        form_fields.append(("user", options.email))
+      ctype, body = EncodeMultipartFormData(form_fields,
+                                            [("data", filename, content)])
+      response_body = rpc_server.Send(url, body,
+                                      content_type=ctype)
+      if not response_body.startswith("OK"):
+        StatusUpdate("  --> %s" % response_body)
+        sys.exit(1)
+
+    patches = dict()
+    [patches.setdefault(v, k) for k, v in patch_list]
+    for filename in patches.keys():
+      base_content, new_content, is_binary, status = files[filename]
+      file_id_str = patches.get(filename)
+      if file_id_str.find("nobase") != -1:
+        base_content = None
+        file_id_str = file_id_str[file_id_str.rfind("_") + 1:]
+      file_id = int(file_id_str)
+      if base_content != None:
+        UploadFile(filename, file_id, base_content, is_binary, status, True)
+      if new_content != None:
+        UploadFile(filename, file_id, new_content, is_binary, status, False)
+
+  def IsImage(self, filename):
+    """Returns true if the filename has an image extension."""
+    mimetype =  mimetypes.guess_type(filename)[0]
+    if not mimetype:
+      return False
+    return mimetype.startswith("image/")
+
+
+class SubversionVCS(VersionControlSystem):
+  """Implementation of the VersionControlSystem interface for Subversion."""
+
+  def __init__(self, options):
+    super(SubversionVCS, self).__init__(options)
+    if self.options.revision:
+      match = re.match(r"(\d+)(:(\d+))?", self.options.revision)
+      if not match:
+        ErrorExit("Invalid Subversion revision %s." % self.options.revision)
+      self.rev_start = match.group(1)
+      self.rev_end = match.group(3)
+    else:
+      self.rev_start = self.rev_end = None
+    # Cache output from "svn list -r REVNO dirname".
+    # Keys: dirname, Values: 2-tuple (ouput for start rev and end rev).
+    self.svnls_cache = {}
+    # SVN base URL is required to fetch files deleted in an older revision.
+    # Result is cached to not guess it over and over again in GetBaseFile().
+    required = self.options.download_base or self.options.revision is not None
+    self.svn_base = self._GuessBase(required)
+
+  def GuessBase(self, required):
+    """Wrapper for _GuessBase."""
+    return self.svn_base
+
+  def _GuessBase(self, required):
+    """Returns the SVN base URL.
+
+    Args:
+      required: If true, exits if the url can't be guessed, otherwise None is
+        returned.
+    """
+    info = RunShell(["svn", "info"])
+    for line in info.splitlines():
+      words = line.split()
+      if len(words) == 2 and words[0] == "URL:":
+        url = words[1]
+        scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
+        username, netloc = urllib.splituser(netloc)
+        if username:
+          logging.info("Removed username from base URL")
+        if netloc.endswith("svn.python.org"):
+          if netloc == "svn.python.org":
+            if path.startswith("/projects/"):
+              path = path[9:]
+          elif netloc != "pythondev@svn.python.org":
+            ErrorExit("Unrecognized Python URL: %s" % url)
+          base = "http://svn.python.org/view/*checkout*%s/" % path
+          logging.info("Guessed Python base = %s", base)
+        elif netloc.endswith("svn.collab.net"):
+          if path.startswith("/repos/"):
+            path = path[6:]
+          base = "http://svn.collab.net/viewvc/*checkout*%s/" % path
+          logging.info("Guessed CollabNet base = %s", base)
+        elif netloc.endswith(".googlecode.com"):
+          path = path + "/"
+          base = urlparse.urlunparse(("http", netloc, path, params,
+                                      query, fragment))
+          logging.info("Guessed Google Code base = %s", base)
+        else:
+          path = path + "/"
+          base = urlparse.urlunparse((scheme, netloc, path, params,
+                                      query, fragment))
+          logging.info("Guessed base = %s", base)
+        return base
+    if required:
+      ErrorExit("Can't find URL in output from svn info")
+    return None
+
+  def GenerateDiff(self, args):
+    cmd = ["svn", "diff"]
+    if self.options.revision:
+      cmd += ["-r", self.options.revision]
+    cmd.extend(args)
+    data = RunShell(cmd)
+    count = 0
+    for line in data.splitlines():
+      if line.startswith("Index:") or line.startswith("Property changes on:"):
+        count += 1
+        logging.info(line)
+    if not count:
+      ErrorExit("No valid patches found in output from svn diff")
+    return data
+
+  def _CollapseKeywords(self, content, keyword_str):
+    """Collapses SVN keywords."""
+    # svn cat translates keywords but svn diff doesn't. As a result of this
+    # behavior patching.PatchChunks() fails with a chunk mismatch error.
+    # This part was originally written by the Review Board development team
+    # who had the same problem (http://reviews.review-board.org/r/276/).
+    # Mapping of keywords to known aliases
+    svn_keywords = {
+      # Standard keywords
+      'Date':                ['Date', 'LastChangedDate'],
+      'Revision':            ['Revision', 'LastChangedRevision', 'Rev'],
+      'Author':              ['Author', 'LastChangedBy'],
+      'HeadURL':             ['HeadURL', 'URL'],
+      'Id':                  ['Id'],
+
+      # Aliases
+      'LastChangedDate':     ['LastChangedDate', 'Date'],
+      'LastChangedRevision': ['LastChangedRevision', 'Rev', 'Revision'],
+      'LastChangedBy':       ['LastChangedBy', 'Author'],
+      'URL':                 ['URL', 'HeadURL'],
+    }
+
+    def repl(m):
+       if m.group(2):
+         return "$%s::%s$" % (m.group(1), " " * len(m.group(3)))
+       return "$%s$" % m.group(1)
+    keywords = [keyword
+                for name in keyword_str.split(" ")
+                for keyword in svn_keywords.get(name, [])]
+    return re.sub(r"\$(%s):(:?)([^\$]+)\$" % '|'.join(keywords), repl, content)
+
+  def GetUnknownFiles(self):
+    status = RunShell(["svn", "status", "--ignore-externals"], silent_ok=True)
+    unknown_files = []
+    for line in status.split("\n"):
+      if line and line[0] == "?":
+        unknown_files.append(line)
+    return unknown_files
+
+  def ReadFile(self, filename):
+    """Returns the contents of a file."""
+    file = open(filename, 'rb')
+    result = ""
+    try:
+      result = file.read()
+    finally:
+      file.close()
+    return result
+
+  def GetStatus(self, filename):
+    """Returns the status of a file."""
+    if not self.options.revision:
+      status = RunShell(["svn", "status", "--ignore-externals", filename])
+      if not status:
+        ErrorExit("svn status returned no output for %s" % filename)
+      status_lines = status.splitlines()
+      # If file is in a cl, the output will begin with
+      # "\n--- Changelist 'cl_name':\n".  See
+      # http://svn.collab.net/repos/svn/trunk/notes/changelist-design.txt
+      if (len(status_lines) == 3 and
+          not status_lines[0] and
+          status_lines[1].startswith("--- Changelist")):
+        status = status_lines[2]
+      else:
+        status = status_lines[0]
+    # If we have a revision to diff against we need to run "svn list"
+    # for the old and the new revision and compare the results to get
+    # the correct status for a file.
+    else:
+      dirname, relfilename = os.path.split(filename)
+      if dirname not in self.svnls_cache:
+        cmd = ["svn", "list", "-r", self.rev_start, dirname or "."]
+        out, returncode = RunShellWithReturnCode(cmd)
+        if returncode:
+          ErrorExit("Failed to get status for %s." % filename)
+        old_files = out.splitlines()
+        args = ["svn", "list"]
+        if self.rev_end:
+          args += ["-r", self.rev_end]
+        cmd = args + [dirname or "."]
+        out, returncode = RunShellWithReturnCode(cmd)
+        if returncode:
+          ErrorExit("Failed to run command %s" % cmd)
+        self.svnls_cache[dirname] = (old_files, out.splitlines())
+      old_files, new_files = self.svnls_cache[dirname]
+      if relfilename in old_files and relfilename not in new_files:
+        status = "D   "
+      elif relfilename in old_files and relfilename in new_files:
+        status = "M   "
+      else:
+        status = "A   "
+    return status
+
+  def GetBaseFile(self, filename):
+    status = self.GetStatus(filename)
+    base_content = None
+    new_content = None
+
+    # If a file is copied its status will be "A  +", which signifies
+    # "addition-with-history".  See "svn st" for more information.  We need to
+    # upload the original file or else diff parsing will fail if the file was
+    # edited.
+    if status[0] == "A" and status[3] != "+":
+      # We'll need to upload the new content if we're adding a binary file
+      # since diff's output won't contain it.
+      mimetype = RunShell(["svn", "propget", "svn:mime-type", filename],
+                          silent_ok=True)
+      base_content = ""
+      is_binary = mimetype and not mimetype.startswith("text/")
+      if is_binary and self.IsImage(filename):
+        new_content = self.ReadFile(filename)
+    elif (status[0] in ("M", "D", "R") or
+          (status[0] == "A" and status[3] == "+") or  # Copied file.
+          (status[0] == " " and status[1] == "M")):  # Property change.
+      args = []
+      if self.options.revision:
+        url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start)
+      else:
+        # Don't change filename, it's needed later.
+        url = filename
+        args += ["-r", "BASE"]
+      cmd = ["svn"] + args + ["propget", "svn:mime-type", url]
+      mimetype, returncode = RunShellWithReturnCode(cmd)
+      if returncode:
+        # File does not exist in the requested revision.
+        # Reset mimetype, it contains an error message.
+        mimetype = ""
+      get_base = False
+      is_binary = mimetype and not mimetype.startswith("text/")
+      if status[0] == " ":
+        # Empty base content just to force an upload.
+        base_content = ""
+      elif is_binary:
+        if self.IsImage(filename):
+          get_base = True
+          if status[0] == "M":
+            if not self.rev_end:
+              new_content = self.ReadFile(filename)
+            else:
+              url = "%s/%s@%s" % (self.svn_base, filename, self.rev_end)
+              new_content = RunShell(["svn", "cat", url],
+                                     universal_newlines=True, silent_ok=True)
+        else:
+          base_content = ""
+      else:
+        get_base = True
+
+      if get_base:
+        if is_binary:
+          universal_newlines = False
+        else:
+          universal_newlines = True
+        if self.rev_start:
+          # "svn cat -r REV delete_file.txt" doesn't work. cat requires
+          # the full URL with "@REV" appended instead of using "-r" option.
+          url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start)
+          base_content = RunShell(["svn", "cat", url],
+                                  universal_newlines=universal_newlines,
+                                  silent_ok=True)
+        else:
+          base_content = RunShell(["svn", "cat", filename],
+                                  universal_newlines=universal_newlines,
+                                  silent_ok=True)
+        if not is_binary:
+          args = []
+          if self.rev_start:
+            url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start)
+          else:
+            url = filename
+            args += ["-r", "BASE"]
+          cmd = ["svn"] + args + ["propget", "svn:keywords", url]
+          keywords, returncode = RunShellWithReturnCode(cmd)
+          if keywords and not returncode:
+            base_content = self._CollapseKeywords(base_content, keywords)
+    else:
+      StatusUpdate("svn status returned unexpected output: %s" % status)
+      sys.exit(1)
+    return base_content, new_content, is_binary, status[0:5]
+
+
+class GitVCS(VersionControlSystem):
+  """Implementation of the VersionControlSystem interface for Git."""
+
+  def __init__(self, options):
+    super(GitVCS, self).__init__(options)
+    # Map of filename -> hash of base file.
+    self.base_hashes = {}
+
+  def GenerateDiff(self, extra_args):
+    # This is more complicated than svn's GenerateDiff because we must convert
+    # the diff output to include an svn-style "Index:" line as well as record
+    # the hashes of the base files, so we can upload them along with our diff.
+    if self.options.revision:
+      extra_args = [self.options.revision] + extra_args
+    gitdiff = RunShell(["git", "diff", "--full-index"] + extra_args)
+    svndiff = []
+    filecount = 0
+    filename = None
+    for line in gitdiff.splitlines():
+      match = re.match(r"diff --git a/(.*) b/.*$", line)
+      if match:
+        filecount += 1
+        filename = match.group(1)
+        svndiff.append("Index: %s\n" % filename)
+      else:
+        # The "index" line in a git diff looks like this (long hashes elided):
+        #   index 82c0d44..b2cee3f 100755
+        # We want to save the left hash, as that identifies the base file.
+        match = re.match(r"index (\w+)\.\.", line)
+        if match:
+          self.base_hashes[filename] = match.group(1)
+      svndiff.append(line + "\n")
+    if not filecount:
+      ErrorExit("No valid patches found in output from git diff")
+    return "".join(svndiff)
+
+  def GetUnknownFiles(self):
+    status = RunShell(["git", "ls-files", "--exclude-standard", "--others"],
+                      silent_ok=True)
+    return status.splitlines()
+
+  def GetBaseFile(self, filename):
+    hash = self.base_hashes[filename]
+    base_content = None
+    new_content = None
+    is_binary = False
+    if hash == "0" * 40:  # All-zero hash indicates no base file.
+      status = "A"
+      base_content = ""
+    else:
+      status = "M"
+      base_content, returncode = RunShellWithReturnCode(["git", "show", hash])
+      if returncode:
+        ErrorExit("Got error status from 'git show %s'" % hash)
+    return (base_content, new_content, is_binary, status)
+
+
+class MercurialVCS(VersionControlSystem):
+  """Implementation of the VersionControlSystem interface for Mercurial."""
+
+  def __init__(self, options, repo_dir):
+    super(MercurialVCS, self).__init__(options)
+    # Absolute path to repository (we can be in a subdir)
+    self.repo_dir = os.path.normpath(repo_dir)
+    # Compute the subdir
+    cwd = os.path.normpath(os.getcwd())
+    assert cwd.startswith(self.repo_dir)
+    self.subdir = cwd[len(self.repo_dir):].lstrip(r"\/")
+    if self.options.revision:
+      self.base_rev = self.options.revision
+    else:
+      self.base_rev = RunShell(["hg", "parent", "-q"]).split(':')[1].strip()
+
+  def _GetRelPath(self, filename):
+    """Get relative path of a file according to the current directory,
+    given its logical path in the repo."""
+    assert filename.startswith(self.subdir), filename
+    return filename[len(self.subdir):].lstrip(r"\/")
+
+  def GenerateDiff(self, extra_args):
+    # If no file specified, restrict to the current subdir
+    extra_args = extra_args or ["."]
+    cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args
+    data = RunShell(cmd, silent_ok=True)
+    svndiff = []
+    filecount = 0
+    for line in data.splitlines():
+      m = re.match("diff --git a/(\S+) b/(\S+)", line)
+      if m:
+        # Modify line to make it look like as it comes from svn diff.
+        # With this modification no changes on the server side are required
+        # to make upload.py work with Mercurial repos.
+        # NOTE: for proper handling of moved/copied files, we have to use
+        # the second filename.
+        filename = m.group(2)
+        svndiff.append("Index: %s" % filename)
+        svndiff.append("=" * 67)
+        filecount += 1
+        logging.info(line)
+      else:
+        svndiff.append(line)
+    if not filecount:
+      ErrorExit("No valid patches found in output from hg diff")
+    return "\n".join(svndiff) + "\n"
+
+  def GetUnknownFiles(self):
+    """Return a list of files unknown to the VCS."""
+    args = []
+    status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."],
+        silent_ok=True)
+    unknown_files = []
+    for line in status.splitlines():
+      st, fn = line.split(" ", 1)
+      if st == "?":
+        unknown_files.append(fn)
+    return unknown_files
+
+  def GetBaseFile(self, filename):
+    # "hg status" and "hg cat" both take a path relative to the current subdir
+    # rather than to the repo root, but "hg diff" has given us the full path
+    # to the repo root.
+    base_content = ""
+    new_content = None
+    is_binary = False
+    oldrelpath = relpath = self._GetRelPath(filename)
+    # "hg status -C" returns two lines for moved/copied files, one otherwise
+    out = RunShell(["hg", "status", "-C", "--rev", self.base_rev, relpath])
+    out = out.splitlines()
+    # HACK: strip error message about missing file/directory if it isn't in
+    # the working copy
+    if out[0].startswith('%s: ' % relpath):
+      out = out[1:]
+    if len(out) > 1:
+      # Moved/copied => considered as modified, use old filename to
+      # retrieve base contents
+      oldrelpath = out[1].strip()
+      status = "M"
+    else:
+      status, _ = out[0].split(' ', 1)
+    if status != "A":
+      base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
+        silent_ok=True)
+      is_binary = "\0" in base_content  # Mercurial's heuristic
+    if status != "R":
+      new_content = open(relpath, "rb").read()
+      is_binary = is_binary or "\0" in new_content
+    if is_binary and base_content:
+      # Fetch again without converting newlines
+      base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
+        silent_ok=True, universal_newlines=False)
+    if not is_binary or not self.IsImage(relpath):
+      new_content = None
+    return base_content, new_content, is_binary, status
+
+
+# NOTE: The SplitPatch function is duplicated in engine.py, keep them in sync.
+def SplitPatch(data):
+  """Splits a patch into separate pieces for each file.
+
+  Args:
+    data: A string containing the output of svn diff.
+
+  Returns:
+    A list of 2-tuple (filename, text) where text is the svn diff output
+      pertaining to filename.
+  """
+  patches = []
+  filename = None
+  diff = []
+  for line in data.splitlines(True):
+    new_filename = None
+    if line.startswith('Index:'):
+      unused, new_filename = line.split(':', 1)
+      new_filename = new_filename.strip()
+    elif line.startswith('Property changes on:'):
+      unused, temp_filename = line.split(':', 1)
+      # When a file is modified, paths use '/' between directories, however
+      # when a property is modified '\' is used on Windows.  Make them the same
+      # otherwise the file shows up twice.
+      temp_filename = temp_filename.strip().replace('\\', '/')
+      if temp_filename != filename:
+        # File has property changes but no modifications, create a new diff.
+        new_filename = temp_filename
+    if new_filename:
+      if filename and diff:
+        patches.append((filename, ''.join(diff)))
+      filename = new_filename
+      diff = [line]
+      continue
+    if diff is not None:
+      diff.append(line)
+  if filename and diff:
+    patches.append((filename, ''.join(diff)))
+  return patches
+
+
+def UploadSeparatePatches(issue, rpc_server, patchset, data, options):
+  """Uploads a separate patch for each file in the diff output.
+
+  Returns a list of [patch_key, filename] for each file.
+  """
+  patches = SplitPatch(data)
+  rv = []
+  for patch in patches:
+    if len(patch[1]) > MAX_UPLOAD_SIZE:
+      print ("Not uploading the patch for " + patch[0] +
+             " because the file is too large.")
+      continue
+    form_fields = [("filename", patch[0])]
+    if not options.download_base:
+      form_fields.append(("content_upload", "1"))
+    files = [("data", "data.diff", patch[1])]
+    ctype, body = EncodeMultipartFormData(form_fields, files)
+    url = "/%d/upload_patch/%d" % (int(issue), int(patchset))
+    print "Uploading patch for " + patch[0]
+    response_body = rpc_server.Send(url, body, content_type=ctype)
+    lines = response_body.splitlines()
+    if not lines or lines[0] != "OK":
+      StatusUpdate("  --> %s" % response_body)
+      sys.exit(1)
+    rv.append([lines[1], patch[0]])
+  return rv
+
+
+def GuessVCS(options):
+  """Helper to guess the version control system.
+
+  This examines the current directory, guesses which VersionControlSystem
+  we're using, and returns an instance of the appropriate class.  Exit with an
+  error if we can't figure it out.
+
+  Returns:
+    A VersionControlSystem instance. Exits if the VCS can't be guessed.
+  """
+  # Mercurial has a command to get the base directory of a repository
+  # Try running it, but don't die if we don't have hg installed.
+  # NOTE: we try Mercurial first as it can sit on top of an SVN working copy.
+  try:
+    out, returncode = RunShellWithReturnCode(["hg", "root"])
+    if returncode == 0:
+      return MercurialVCS(options, out.strip())
+  except OSError, (errno, message):
+    if errno != 2:  # ENOENT -- they don't have hg installed.
+      raise
+
+  # Subversion has a .svn in all working directories.
+  if os.path.isdir('.svn'):
+    logging.info("Guessed VCS = Subversion")
+    return SubversionVCS(options)
+
+  # Git has a command to test if you're in a git tree.
+  # Try running it, but don't die if we don't have git installed.
+  try:
+    out, returncode = RunShellWithReturnCode(["git", "rev-parse",
+                                              "--is-inside-work-tree"])
+    if returncode == 0:
+      return GitVCS(options)
+  except OSError, (errno, message):
+    if errno != 2:  # ENOENT -- they don't have git installed.
+      raise
+
+  ErrorExit(("Could not guess version control system. "
+             "Are you in a working copy directory?"))
+
+
+def RealMain(argv, data=None):
+  """The real main function.
+
+  Args:
+    argv: Command line arguments.
+    data: Diff contents. If None (default) the diff is generated by
+      the VersionControlSystem implementation returned by GuessVCS().
+
+  Returns:
+    A 2-tuple (issue id, patchset id).
+    The patchset id is None if the base files are not uploaded by this
+    script (applies only to SVN checkouts).
+  """
+  logging.basicConfig(format=("%(asctime).19s %(levelname)s %(filename)s:"
+                              "%(lineno)s %(message)s "))
+  os.environ['LC_ALL'] = 'C'
+  options, args = parser.parse_args(argv[1:])
+  global verbosity
+  verbosity = options.verbose
+  if verbosity >= 3:
+    logging.getLogger().setLevel(logging.DEBUG)
+  elif verbosity >= 2:
+    logging.getLogger().setLevel(logging.INFO)
+  vcs = GuessVCS(options)
+  if isinstance(vcs, SubversionVCS):
+    # base field is only allowed for Subversion.
+    # Note: Fetching base files may become deprecated in future releases.
+    base = vcs.GuessBase(options.download_base)
+  else:
+    base = None
+  if not base and options.download_base:
+    options.download_base = True
+    logging.info("Enabled upload of base file")
+  if not options.assume_yes:
+    vcs.CheckForUnknownFiles()
+  if data is None:
+    data = vcs.GenerateDiff(args)
+  files = vcs.GetBaseFiles(data)
+  if verbosity >= 1:
+    print "Upload server:", options.server, "(change with -s/--server)"
+  if options.issue:
+    prompt = "Message describing this patch set: "
+  else:
+    prompt = "New issue subject: "
+  message = options.message or raw_input(prompt).strip()
+  if not message:
+    ErrorExit("A non-empty message is required")
+  rpc_server = GetRpcServer(options)
+  form_fields = [("subject", message)]
+  if base:
+    form_fields.append(("base", base))
+  if options.issue:
+    form_fields.append(("issue", str(options.issue)))
+  if options.email:
+    form_fields.append(("user", options.email))
+  if options.reviewers:
+    for reviewer in options.reviewers.split(','):
+      if "@" in reviewer and not reviewer.split("@")[1].count(".") == 1:
+        ErrorExit("Invalid email address: %s" % reviewer)
+    form_fields.append(("reviewers", options.reviewers))
+  if options.cc:
+    for cc in options.cc.split(','):
+      if "@" in cc and not cc.split("@")[1].count(".") == 1:
+        ErrorExit("Invalid email address: %s" % cc)
+    form_fields.append(("cc", options.cc))
+  description = options.description
+  if options.description_file:
+    if options.description:
+      ErrorExit("Can't specify description and description_file")
+    file = open(options.description_file, 'r')
+    description = file.read()
+    file.close()
+  if description:
+    form_fields.append(("description", description))
+  # Send a hash of all the base file so the server can determine if a copy
+  # already exists in an earlier patchset.
+  base_hashes = ""
+  for file, info in files.iteritems():
+    if not info[0] is None:
+      checksum = md5.new(info[0]).hexdigest()
+      if base_hashes:
+        base_hashes += "|"
+      base_hashes += checksum + ":" + file
+  form_fields.append(("base_hashes", base_hashes))
+  # If we're uploading base files, don't send the email before the uploads, so
+  # that it contains the file status.
+  if options.send_mail and options.download_base:
+    form_fields.append(("send_mail", "1"))
+  if not options.download_base:
+    form_fields.append(("content_upload", "1"))
+  if len(data) > MAX_UPLOAD_SIZE:
+    print "Patch is large, so uploading file patches separately."
+    uploaded_diff_file = []
+    form_fields.append(("separate_patches", "1"))
+  else:
+    uploaded_diff_file = [("data", "data.diff", data)]
+  ctype, body = EncodeMultipartFormData(form_fields, uploaded_diff_file)
+  response_body = rpc_server.Send("/upload", body, content_type=ctype)
+  patchset = None
+  if not options.download_base or not uploaded_diff_file:
+    lines = response_body.splitlines()
+    if len(lines) >= 2:
+      msg = lines[0]
+      patchset = lines[1].strip()
+      patches = [x.split(" ", 1) for x in lines[2:]]
+    else:
+      msg = response_body
+  else:
+    msg = response_body
+  StatusUpdate(msg)
+  if not response_body.startswith("Issue created.") and \
+  not response_body.startswith("Issue updated."):
+    sys.exit(0)
+  issue = msg[msg.rfind("/")+1:]
+
+  if not uploaded_diff_file:
+    result = UploadSeparatePatches(issue, rpc_server, patchset, data, options)
+    if not options.download_base:
+      patches = result
+
+  if not options.download_base:
+    vcs.UploadBaseFiles(issue, rpc_server, patches, patchset, options, files)
+    if options.send_mail:
+      rpc_server.Send("/" + issue + "/mail", payload="")
+  return issue, patchset
+
+
+def main():
+  try:
+    RealMain(sys.argv)
+  except KeyboardInterrupt:
+    print
+    StatusUpdate("Interrupted.")
+    sys.exit(1)
+
+
+if __name__ == "__main__":
+  main()
diff --git a/scripts/upload_gtest.py b/scripts/upload_gtest.py
new file mode 100755 (executable)
index 0000000..be19ae8
--- /dev/null
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+#
+# Copyright 2009, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""upload_gtest.py v0.1.0 -- uploads a Google Test patch for review.
+
+This simple wrapper passes all command line flags and
+--cc=googletestframework@googlegroups.com to upload.py.
+
+USAGE: upload_gtest.py [options for upload.py]
+"""
+
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
+import os
+import sys
+
+CC_FLAG = '--cc='
+GTEST_GROUP = 'googletestframework@googlegroups.com'
+
+
+def main():
+  # Finds the path to upload.py, assuming it is in the same directory
+  # as this file.
+  my_dir = os.path.dirname(os.path.abspath(__file__))
+  upload_py_path = os.path.join(my_dir, 'upload.py')
+
+  # Adds Google Test discussion group to the cc line if it's not there
+  # already.
+  upload_py_argv = [upload_py_path]
+  found_cc_flag = False
+  for arg in sys.argv[1:]:
+    if arg.startswith(CC_FLAG):
+      found_cc_flag = True
+      cc_line = arg[len(CC_FLAG):]
+      cc_list = [addr for addr in cc_line.split(',') if addr]
+      if GTEST_GROUP not in cc_list:
+        cc_list.append(GTEST_GROUP)
+      upload_py_argv.append(CC_FLAG + ','.join(cc_list))
+    else:
+      upload_py_argv.append(arg)
+
+  if not found_cc_flag:
+    upload_py_argv.append(CC_FLAG + GTEST_GROUP)
+
+  # Invokes upload.py with the modified command line flags.
+  os.execv(upload_py_path, upload_py_argv)
+
+
+if __name__ == '__main__':
+  main()
diff --git a/src/.libs/gtest-all.o b/src/.libs/gtest-all.o
deleted file mode 100644 (file)
index 0d9951c..0000000
Binary files a/src/.libs/gtest-all.o and /dev/null differ
diff --git a/src/.libs/gtest_main.o b/src/.libs/gtest_main.o
deleted file mode 100644 (file)
index f813f60..0000000
Binary files a/src/.libs/gtest_main.o and /dev/null differ
diff --git a/src/gtest-all.o b/src/gtest-all.o
deleted file mode 100644 (file)
index d5a45eb..0000000
Binary files a/src/gtest-all.o and /dev/null differ
index 8b2e413..a01a369 100755 (executable)
@@ -33,6 +33,7 @@
 
 #include "gtest/gtest-death-test.h"
 #include "gtest/internal/gtest-port.h"
+#include "gtest/internal/custom/gtest.h"
 
 #if GTEST_HAS_DEATH_TEST
 
 # include <errno.h>
 # include <fcntl.h>
 # include <limits.h>
+
+# if GTEST_OS_LINUX
+#  include <signal.h>
+# endif  // GTEST_OS_LINUX
+
 # include <stdarg.h>
 
 # if GTEST_OS_WINDOWS
 #  include <sys/wait.h>
 # endif  // GTEST_OS_WINDOWS
 
+# if GTEST_OS_QNX
+#  include <spawn.h>
+# endif  // GTEST_OS_QNX
+
 #endif  // GTEST_HAS_DEATH_TEST
 
 #include "gtest/gtest-message.h"
@@ -59,9 +69,9 @@
 
 // Indicates that this translation unit is part of Google Test's
 // implementation.  It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error.  This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
+// included, or there will be a compiler error.  This trick exists to
+// prevent the accidental inclusion of gtest-internal-inl.h in the
+// user's code.
 #define GTEST_IMPLEMENTATION_ 1
 #include "src/gtest-internal-inl.h"
 #undef GTEST_IMPLEMENTATION_
@@ -100,13 +110,44 @@ GTEST_DEFINE_string_(
     "Indicates the file, line number, temporal index of "
     "the single death test to run, and a file descriptor to "
     "which a success code may be sent, all separated by "
-    "colons.  This flag is specified if and only if the current "
+    "the '|' characters.  This flag is specified if and only if the current "
     "process is a sub-process launched for running a thread-safe "
     "death test.  FOR INTERNAL USE ONLY.");
 }  // namespace internal
 
 #if GTEST_HAS_DEATH_TEST
 
+namespace internal {
+
+// Valid only for fast death tests. Indicates the code is running in the
+// child process of a fast style death test.
+# if !GTEST_OS_WINDOWS
+static bool g_in_fast_death_test_child = false;
+# endif
+
+// Returns a Boolean value indicating whether the caller is currently
+// executing in the context of the death test child process.  Tools such as
+// Valgrind heap checkers may need this to modify their behavior in death
+// tests.  IMPORTANT: This is an internal utility.  Using it may break the
+// implementation of death tests.  User code MUST NOT use it.
+bool InDeathTestChild() {
+# if GTEST_OS_WINDOWS
+
+  // On Windows, death tests are thread-safe regardless of the value of the
+  // death_test_style flag.
+  return !GTEST_FLAG(internal_run_death_test).empty();
+
+# else
+
+  if (GTEST_FLAG(death_test_style) == "threadsafe")
+    return !GTEST_FLAG(internal_run_death_test).empty();
+  else
+    return g_in_fast_death_test_child;
+#endif
+}
+
+}  // namespace internal
+
 // ExitedWithCode constructor.
 ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
 }
@@ -131,6 +172,14 @@ KilledBySignal::KilledBySignal(int signum) : signum_(signum) {
 
 // KilledBySignal function-call operator.
 bool KilledBySignal::operator()(int exit_status) const {
+#  if defined(GTEST_KILLED_BY_SIGNAL_OVERRIDE_)
+  {
+    bool result;
+    if (GTEST_KILLED_BY_SIGNAL_OVERRIDE_(signum_, exit_status, &result)) {
+      return result;
+    }
+  }
+#  endif  // defined(GTEST_KILLED_BY_SIGNAL_OVERRIDE_)
   return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_;
 }
 # endif  // !GTEST_OS_WINDOWS
@@ -141,7 +190,7 @@ namespace internal {
 
 // Generates a textual description of a given exit code, in the format
 // specified by wait(2).
-static String ExitSummary(int exit_code) {
+static std::string ExitSummary(int exit_code) {
   Message m;
 
 # if GTEST_OS_WINDOWS
@@ -176,7 +225,7 @@ bool ExitedUnsuccessfully(int exit_status) {
 // one thread running, or cannot determine the number of threads, prior
 // to executing the given statement.  It is the responsibility of the
 // caller not to pass a thread_count of 1.
-static String DeathTestThreadWarning(size_t thread_count) {
+static std::string DeathTestThreadWarning(size_t thread_count) {
   Message msg;
   msg << "Death tests use fork(), which is unsafe particularly"
       << " in a threaded context. For this test, " << GTEST_NAME_ << " ";
@@ -210,7 +259,7 @@ enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
 // message is propagated back to the parent process.  Otherwise, the
 // message is simply printed to stderr.  In either case, the program
 // then exits with status 1.
-void DeathTestAbort(const String& message) {
+void DeathTestAbort(const std::string& message) {
   // On a POSIX system, this function may be called from a threadsafe-style
   // death test child process, which operates on a very small stack.  Use
   // the heap for any additional non-minuscule memory requirements.
@@ -234,9 +283,10 @@ void DeathTestAbort(const String& message) {
 # define GTEST_DEATH_TEST_CHECK_(expression) \
   do { \
     if (!::testing::internal::IsTrue(expression)) { \
-      DeathTestAbort(::testing::internal::String::Format( \
-          "CHECK failed: File %s, line %d: %s", \
-          __FILE__, __LINE__, #expression)); \
+      DeathTestAbort( \
+          ::std::string("CHECK failed: File ") + __FILE__ +  ", line " \
+          + ::testing::internal::StreamableToString(__LINE__) + ": " \
+          + #expression); \
     } \
   } while (::testing::internal::AlwaysFalse())
 
@@ -254,15 +304,16 @@ void DeathTestAbort(const String& message) {
       gtest_retval = (expression); \
     } while (gtest_retval == -1 && errno == EINTR); \
     if (gtest_retval == -1) { \
-      DeathTestAbort(::testing::internal::String::Format( \
-          "CHECK failed: File %s, line %d: %s != -1", \
-          __FILE__, __LINE__, #expression)); \
+      DeathTestAbort( \
+          ::std::string("CHECK failed: File ") + __FILE__ + ", line " \
+          + ::testing::internal::StreamableToString(__LINE__) + ": " \
+          + #expression + " != -1"); \
     } \
   } while (::testing::internal::AlwaysFalse())
 
 // Returns the message describing the last system error in errno.
-String GetLastErrnoDescription() {
-    return String(errno == 0 ? "" : posix::StrError(errno));
+std::string GetLastErrnoDescription() {
+    return errno == 0 ? "" : posix::StrError(errno);
 }
 
 // This is called from a death test parent process to read a failure
@@ -312,11 +363,11 @@ const char* DeathTest::LastMessage() {
   return last_death_test_message_.c_str();
 }
 
-void DeathTest::set_last_death_test_message(const String& message) {
+void DeathTest::set_last_death_test_message(const std::string& message) {
   last_death_test_message_ = message;
 }
 
-String DeathTest::last_death_test_message_;
+std::string DeathTest::last_death_test_message_;
 
 // Provides cross platform implementation for some death functionality.
 class DeathTestImpl : public DeathTest {
@@ -491,7 +542,7 @@ bool DeathTestImpl::Passed(bool status_ok) {
   if (!spawned())
     return false;
 
-  const String error_message = GetCapturedStderr();
+  const std::string error_message = GetCapturedStderr();
 
   bool success = false;
   Message buffer;
@@ -673,22 +724,19 @@ DeathTest::TestRole WindowsDeathTest::AssumeRole() {
       FALSE,   // The initial state is non-signalled.
       NULL));  // The even is unnamed.
   GTEST_DEATH_TEST_CHECK_(event_handle_.Get() != NULL);
-  const String filter_flag = String::Format("--%s%s=%s.%s",
-                                            GTEST_FLAG_PREFIX_, kFilterFlag,
-                                            info->test_case_name(),
-                                            info->name());
-  const String internal_flag = String::Format(
-    "--%s%s=%s|%d|%d|%u|%Iu|%Iu",
-      GTEST_FLAG_PREFIX_,
-      kInternalRunDeathTestFlag,
-      file_, line_,
-      death_test_index,
-      static_cast<unsigned int>(::GetCurrentProcessId()),
-      // size_t has the same with as pointers on both 32-bit and 64-bit
+  const std::string filter_flag =
+      std::string("--") + GTEST_FLAG_PREFIX_ + kFilterFlag + "=" +
+      info->test_case_name() + "." + info->name();
+  const std::string internal_flag =
+      std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag +
+      "=" + file_ + "|" + StreamableToString(line_) + "|" +
+      StreamableToString(death_test_index) + "|" +
+      StreamableToString(static_cast<unsigned int>(::GetCurrentProcessId())) +
+      // size_t has the same width as pointers on both 32-bit and 64-bit
       // Windows platforms.
       // See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx.
-      reinterpret_cast<size_t>(write_handle),
-      reinterpret_cast<size_t>(event_handle_.Get()));
+      "|" + StreamableToString(reinterpret_cast<size_t>(write_handle)) +
+      "|" + StreamableToString(reinterpret_cast<size_t>(event_handle_.Get()));
 
   char executable_path[_MAX_PATH + 1];  // NOLINT
   GTEST_DEATH_TEST_CHECK_(
@@ -696,10 +744,9 @@ DeathTest::TestRole WindowsDeathTest::AssumeRole() {
                                             executable_path,
                                             _MAX_PATH));
 
-  String command_line = String::Format("%s %s \"%s\"",
-                                       ::GetCommandLineA(),
-                                       filter_flag.c_str(),
-                                       internal_flag.c_str());
+  std::string command_line =
+      std::string(::GetCommandLineA()) + " " + filter_flag + " \"" +
+      internal_flag + "\"";
 
   DeathTest::set_last_death_test_message("");
 
@@ -816,6 +863,7 @@ DeathTest::TestRole NoExecDeathTest::AssumeRole() {
     // Event forwarding to the listeners of event listener API mush be shut
     // down in death test subprocesses.
     GetUnitTestImpl()->listeners()->SuppressEventForwarding();
+    g_in_fast_death_test_child = true;
     return EXECUTE_TEST;
   } else {
     GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
@@ -835,6 +883,16 @@ class ExecDeathTest : public ForkingDeathTest {
       ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { }
   virtual TestRole AssumeRole();
  private:
+  static ::std::vector<testing::internal::string>
+  GetArgvsForDeathTestChildProcess() {
+    ::std::vector<testing::internal::string> args = GetInjectableArgvs();
+#  if defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_)
+    ::std::vector<testing::internal::string> extra_args =
+        GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_();
+    args.insert(args.end(), extra_args.begin(), extra_args.end());
+#  endif  // defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_)
+    return args;
+  }
   // The name of the file in which the death test is located.
   const char* const file_;
   // The line number on which the death test is located.
@@ -869,6 +927,7 @@ class Arguments {
   char* const* Argv() {
     return &args_[0];
   }
+
  private:
   std::vector<char*> args_;
 };
@@ -894,6 +953,7 @@ extern "C" char** environ;
 inline char** GetEnviron() { return environ; }
 #  endif  // GTEST_OS_MAC
 
+#  if !GTEST_OS_QNX
 // The main function for a threadsafe-style death test child process.
 // This function is called in a clone()-ed process and thus must avoid
 // any potentially unsafe operations like malloc or libc functions.
@@ -908,9 +968,8 @@ static int ExecDeathTestChildMain(void* child_arg) {
       UnitTest::GetInstance()->original_working_dir();
   // We can safely call chdir() as it's a direct system call.
   if (chdir(original_dir) != 0) {
-    DeathTestAbort(String::Format("chdir(\"%s\") failed: %s",
-                                  original_dir,
-                                  GetLastErrnoDescription().c_str()));
+    DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " +
+                   GetLastErrnoDescription());
     return EXIT_FAILURE;
   }
 
@@ -920,12 +979,12 @@ static int ExecDeathTestChildMain(void* child_arg) {
   // invoke the test program via a valid path that contains at least
   // one path separator.
   execve(args->argv[0], args->argv, GetEnviron());
-  DeathTestAbort(String::Format("execve(%s, ...) in %s failed: %s",
-                                args->argv[0],
-                                original_dir,
-                                GetLastErrnoDescription().c_str()));
+  DeathTestAbort(std::string("execve(") + args->argv[0] + ", ...) in " +
+                 original_dir + " failed: " +
+                 GetLastErrnoDescription());
   return EXIT_FAILURE;
 }
+#  endif  // !GTEST_OS_QNX
 
 // Two utility routines that together determine the direction the stack
 // grows.
@@ -936,25 +995,77 @@ static int ExecDeathTestChildMain(void* child_arg) {
 // GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining
 // StackLowerThanAddress into StackGrowsDown, which then doesn't give
 // correct answer.
-bool StackLowerThanAddress(const void* ptr) GTEST_NO_INLINE_;
-bool StackLowerThanAddress(const void* ptr) {
+void StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_;
+void StackLowerThanAddress(const void* ptr, bool* result) {
   int dummy;
-  return &dummy < ptr;
+  *result = (&dummy < ptr);
 }
 
+// Make sure AddressSanitizer does not tamper with the stack here.
+GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
 bool StackGrowsDown() {
   int dummy;
-  return StackLowerThanAddress(&dummy);
+  bool result;
+  StackLowerThanAddress(&dummy, &result);
+  return result;
 }
 
-// A threadsafe implementation of fork(2) for threadsafe-style death tests
-// that uses clone(2).  It dies with an error message if anything goes
-// wrong.
-static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
+// Spawns a child process with the same executable as the current process in
+// a thread-safe manner and instructs it to run the death test.  The
+// implementation uses fork(2) + exec.  On systems where clone(2) is
+// available, it is used instead, being slightly more thread-safe.  On QNX,
+// fork supports only single-threaded environments, so this function uses
+// spawn(2) there instead.  The function dies with an error message if
+// anything goes wrong.
+static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
   ExecDeathTestArgs args = { argv, close_fd };
   pid_t child_pid = -1;
 
-#  if GTEST_HAS_CLONE
+#  if GTEST_OS_QNX
+  // Obtains the current directory and sets it to be closed in the child
+  // process.
+  const int cwd_fd = open(".", O_RDONLY);
+  GTEST_DEATH_TEST_CHECK_(cwd_fd != -1);
+  GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(cwd_fd, F_SETFD, FD_CLOEXEC));
+  // We need to execute the test program in the same environment where
+  // it was originally invoked.  Therefore we change to the original
+  // working directory first.
+  const char* const original_dir =
+      UnitTest::GetInstance()->original_working_dir();
+  // We can safely call chdir() as it's a direct system call.
+  if (chdir(original_dir) != 0) {
+    DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " +
+                   GetLastErrnoDescription());
+    return EXIT_FAILURE;
+  }
+
+  int fd_flags;
+  // Set close_fd to be closed after spawn.
+  GTEST_DEATH_TEST_CHECK_SYSCALL_(fd_flags = fcntl(close_fd, F_GETFD));
+  GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(close_fd, F_SETFD,
+                                        fd_flags | FD_CLOEXEC));
+  struct inheritance inherit = {0};
+  // spawn is a system call.
+  child_pid = spawn(args.argv[0], 0, NULL, &inherit, args.argv, GetEnviron());
+  // Restores the current working directory.
+  GTEST_DEATH_TEST_CHECK_(fchdir(cwd_fd) != -1);
+  GTEST_DEATH_TEST_CHECK_SYSCALL_(close(cwd_fd));
+
+#  else   // GTEST_OS_QNX
+#   if GTEST_OS_LINUX
+  // When a SIGPROF signal is received while fork() or clone() are executing,
+  // the process may hang. To avoid this, we ignore SIGPROF here and re-enable
+  // it after the call to fork()/clone() is complete.
+  struct sigaction saved_sigprof_action;
+  struct sigaction ignore_sigprof_action;
+  memset(&ignore_sigprof_action, 0, sizeof(ignore_sigprof_action));
+  sigemptyset(&ignore_sigprof_action.sa_mask);
+  ignore_sigprof_action.sa_handler = SIG_IGN;
+  GTEST_DEATH_TEST_CHECK_SYSCALL_(sigaction(
+      SIGPROF, &ignore_sigprof_action, &saved_sigprof_action));
+#   endif  // GTEST_OS_LINUX
+
+#   if GTEST_HAS_CLONE
   const bool use_fork = GTEST_FLAG(death_test_use_fork);
 
   if (!use_fork) {
@@ -964,21 +1075,37 @@ static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
     void* const stack = mmap(NULL, stack_size, PROT_READ | PROT_WRITE,
                              MAP_ANON | MAP_PRIVATE, -1, 0);
     GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED);
+
+    // Maximum stack alignment in bytes:  For a downward-growing stack, this
+    // amount is subtracted from size of the stack space to get an address
+    // that is within the stack space and is aligned on all systems we care
+    // about.  As far as I know there is no ABI with stack alignment greater
+    // than 64.  We assume stack and stack_size already have alignment of
+    // kMaxStackAlignment.
+    const size_t kMaxStackAlignment = 64;
     void* const stack_top =
-        static_cast<char*>(stack) + (stack_grows_down ? stack_size : 0);
+        static_cast<char*>(stack) +
+            (stack_grows_down ? stack_size - kMaxStackAlignment : 0);
+    GTEST_DEATH_TEST_CHECK_(stack_size > kMaxStackAlignment &&
+        reinterpret_cast<intptr_t>(stack_top) % kMaxStackAlignment == 0);
 
     child_pid = clone(&ExecDeathTestChildMain, stack_top, SIGCHLD, &args);
 
     GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);
   }
-#  else
+#   else
   const bool use_fork = true;
-#  endif  // GTEST_HAS_CLONE
+#   endif  // GTEST_HAS_CLONE
 
   if (use_fork && (child_pid = fork()) == 0) {
       ExecDeathTestChildMain(&args);
       _exit(0);
   }
+#  endif  // GTEST_OS_QNX
+#  if GTEST_OS_LINUX
+  GTEST_DEATH_TEST_CHECK_SYSCALL_(
+      sigaction(SIGPROF, &saved_sigprof_action, NULL));
+#  endif  // GTEST_OS_LINUX
 
   GTEST_DEATH_TEST_CHECK_(child_pid != -1);
   return child_pid;
@@ -1006,16 +1133,16 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
   // it be closed when the child process does an exec:
   GTEST_DEATH_TEST_CHECK_(fcntl(pipe_fd[1], F_SETFD, 0) != -1);
 
-  const String filter_flag =
-      String::Format("--%s%s=%s.%s",
-                     GTEST_FLAG_PREFIX_, kFilterFlag,
-                     info->test_case_name(), info->name());
-  const String internal_flag =
-      String::Format("--%s%s=%s|%d|%d|%d",
-                     GTEST_FLAG_PREFIX_, kInternalRunDeathTestFlag,
-                     file_, line_, death_test_index, pipe_fd[1]);
+  const std::string filter_flag =
+      std::string("--") + GTEST_FLAG_PREFIX_ + kFilterFlag + "="
+      + info->test_case_name() + "." + info->name();
+  const std::string internal_flag =
+      std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + "="
+      + file_ + "|" + StreamableToString(line_) + "|"
+      + StreamableToString(death_test_index) + "|"
+      + StreamableToString(pipe_fd[1]);
   Arguments args;
-  args.AddArguments(GetArgvs());
+  args.AddArguments(GetArgvsForDeathTestChildProcess());
   args.AddArgument(filter_flag.c_str());
   args.AddArgument(internal_flag.c_str());
 
@@ -1026,7 +1153,7 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
   // is necessary.
   FlushInfoLog();
 
-  const pid_t child_pid = ExecDeathTestFork(args.Argv(), pipe_fd[0]);
+  const pid_t child_pid = ExecDeathTestSpawnChild(args.Argv(), pipe_fd[0]);
   GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
   set_child_pid(child_pid);
   set_read_fd(pipe_fd[0]);
@@ -1052,9 +1179,10 @@ bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,
 
   if (flag != NULL) {
     if (death_test_index > flag->index()) {
-      DeathTest::set_last_death_test_message(String::Format(
-          "Death test count (%d) somehow exceeded expected maximum (%d)",
-          death_test_index, flag->index()));
+      DeathTest::set_last_death_test_message(
+          "Death test count (" + StreamableToString(death_test_index)
+          + ") somehow exceeded expected maximum ("
+          + StreamableToString(flag->index()) + ")");
       return false;
     }
 
@@ -1083,35 +1211,15 @@ bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,
 # endif  // GTEST_OS_WINDOWS
 
   else {  // NOLINT - this is more readable than unbalanced brackets inside #if.
-    DeathTest::set_last_death_test_message(String::Format(
-        "Unknown death test style \"%s\" encountered",
-        GTEST_FLAG(death_test_style).c_str()));
+    DeathTest::set_last_death_test_message(
+        "Unknown death test style \"" + GTEST_FLAG(death_test_style)
+        + "\" encountered");
     return false;
   }
 
   return true;
 }
 
-// Splits a given string on a given delimiter, populating a given
-// vector with the fields.  GTEST_HAS_DEATH_TEST implies that we have
-// ::std::string, so we can use it here.
-static void SplitString(const ::std::string& str, char delimiter,
-                        ::std::vector< ::std::string>* dest) {
-  ::std::vector< ::std::string> parsed;
-  ::std::string::size_type pos = 0;
-  while (::testing::internal::AlwaysTrue()) {
-    const ::std::string::size_type colon = str.find(delimiter, pos);
-    if (colon == ::std::string::npos) {
-      parsed.push_back(str.substr(pos));
-      break;
-    } else {
-      parsed.push_back(str.substr(pos, colon - pos));
-      pos = colon + 1;
-    }
-  }
-  dest->swap(parsed);
-}
-
 # if GTEST_OS_WINDOWS
 // Recreates the pipe and event handles from the provided parameters,
 // signals the event, and returns a file descriptor wrapped around the pipe
@@ -1123,8 +1231,8 @@ int GetStatusFileDescriptor(unsigned int parent_process_id,
                                                    FALSE,  // Non-inheritable.
                                                    parent_process_id));
   if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) {
-    DeathTestAbort(String::Format("Unable to open parent process %u",
-                                  parent_process_id));
+    DeathTestAbort("Unable to open parent process " +
+                   StreamableToString(parent_process_id));
   }
 
   // TODO(vladl@google.com): Replace the following check with a
@@ -1144,9 +1252,10 @@ int GetStatusFileDescriptor(unsigned int parent_process_id,
                                  // DUPLICATE_SAME_ACCESS is used.
                          FALSE,  // Request non-inheritable handler.
                          DUPLICATE_SAME_ACCESS)) {
-    DeathTestAbort(String::Format(
-        "Unable to duplicate the pipe handle %Iu from the parent process %u",
-        write_handle_as_size_t, parent_process_id));
+    DeathTestAbort("Unable to duplicate the pipe handle " +
+                   StreamableToString(write_handle_as_size_t) +
+                   " from the parent process " +
+                   StreamableToString(parent_process_id));
   }
 
   const HANDLE event_handle = reinterpret_cast<HANDLE>(event_handle_as_size_t);
@@ -1157,17 +1266,18 @@ int GetStatusFileDescriptor(unsigned int parent_process_id,
                          0x0,
                          FALSE,
                          DUPLICATE_SAME_ACCESS)) {
-    DeathTestAbort(String::Format(
-        "Unable to duplicate the event handle %Iu from the parent process %u",
-        event_handle_as_size_t, parent_process_id));
+    DeathTestAbort("Unable to duplicate the event handle " +
+                   StreamableToString(event_handle_as_size_t) +
+                   " from the parent process " +
+                   StreamableToString(parent_process_id));
   }
 
   const int write_fd =
       ::_open_osfhandle(reinterpret_cast<intptr_t>(dup_write_handle), O_APPEND);
   if (write_fd == -1) {
-    DeathTestAbort(String::Format(
-        "Unable to convert pipe handle %Iu to a file descriptor",
-        write_handle_as_size_t));
+    DeathTestAbort("Unable to convert pipe handle " +
+                   StreamableToString(write_handle_as_size_t) +
+                   " to a file descriptor");
   }
 
   // Signals the parent that the write end of the pipe has been acquired
@@ -1204,9 +1314,8 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
       || !ParseNaturalNumber(fields[3], &parent_process_id)
       || !ParseNaturalNumber(fields[4], &write_handle_as_size_t)
       || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) {
-    DeathTestAbort(String::Format(
-        "Bad --gtest_internal_run_death_test flag: %s",
-        GTEST_FLAG(internal_run_death_test).c_str()));
+    DeathTestAbort("Bad --gtest_internal_run_death_test flag: " +
+                   GTEST_FLAG(internal_run_death_test));
   }
   write_fd = GetStatusFileDescriptor(parent_process_id,
                                      write_handle_as_size_t,
@@ -1217,9 +1326,8 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
       || !ParseNaturalNumber(fields[1], &line)
       || !ParseNaturalNumber(fields[2], &index)
       || !ParseNaturalNumber(fields[3], &write_fd)) {
-    DeathTestAbort(String::Format(
-        "Bad --gtest_internal_run_death_test flag: %s",
-        GTEST_FLAG(internal_run_death_test).c_str()));
+    DeathTestAbort("Bad --gtest_internal_run_death_test flag: "
+        + GTEST_FLAG(internal_run_death_test));
   }
 
 # endif  // GTEST_OS_WINDOWS
index 91b2571..0292dc1 100755 (executable)
@@ -29,6 +29,7 @@
 //
 // Authors: keith.ray@gmail.com (Keith Ray)
 
+#include "gtest/gtest-message.h"
 #include "gtest/internal/gtest-filepath.h"
 #include "gtest/internal/gtest-port.h"
 
@@ -39,8 +40,8 @@
 #elif GTEST_OS_WINDOWS
 # include <direct.h>
 # include <io.h>
-#elif GTEST_OS_SYMBIAN || GTEST_OS_NACL
-// Symbian OpenC and NaCl have PATH_MAX in sys/syslimits.h
+#elif GTEST_OS_SYMBIAN
+// Symbian OpenC has PATH_MAX in sys/syslimits.h
 # include <sys/syslimits.h>
 #else
 # include <limits.h>
@@ -69,7 +70,6 @@ namespace internal {
 // of them.
 const char kPathSeparator = '\\';
 const char kAlternatePathSeparator = '/';
-const char kPathSeparatorString[] = "\\";
 const char kAlternatePathSeparatorString[] = "/";
 # if GTEST_OS_WINDOWS_MOBILE
 // Windows CE doesn't have a current directory. You should not use
@@ -83,7 +83,6 @@ const char kCurrentDirectoryString[] = ".\\";
 # endif  // GTEST_OS_WINDOWS_MOBILE
 #else
 const char kPathSeparator = '/';
-const char kPathSeparatorString[] = "/";
 const char kCurrentDirectoryString[] = "./";
 #endif  // GTEST_OS_WINDOWS
 
@@ -98,7 +97,7 @@ static bool IsPathSeparator(char c) {
 
 // Returns the current working directory, or "" if unsuccessful.
 FilePath FilePath::GetCurrentDir() {
-#if GTEST_OS_WINDOWS_MOBILE
+#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
   // Windows CE doesn't have a current directory, so we just return
   // something reasonable.
   return FilePath(kCurrentDirectoryString);
@@ -107,7 +106,14 @@ FilePath FilePath::GetCurrentDir() {
   return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
 #else
   char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
-  return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
+  char* result = getcwd(cwd, sizeof(cwd));
+# if GTEST_OS_NACL
+  // getcwd will likely fail in NaCl due to the sandbox, so return something
+  // reasonable. The user may have provided a shim implementation for getcwd,
+  // however, so fallback only when failure is detected.
+  return FilePath(result == NULL ? kCurrentDirectoryString : cwd);
+# endif  // GTEST_OS_NACL
+  return FilePath(result == NULL ? "" : cwd);
 #endif  // GTEST_OS_WINDOWS_MOBILE
 }
 
@@ -116,9 +122,10 @@ FilePath FilePath::GetCurrentDir() {
 // FilePath("dir/file"). If a case-insensitive extension is not
 // found, returns a copy of the original FilePath.
 FilePath FilePath::RemoveExtension(const char* extension) const {
-  String dot_extension(String::Format(".%s", extension));
-  if (pathname_.EndsWithCaseInsensitive(dot_extension.c_str())) {
-    return FilePath(String(pathname_.c_str(), pathname_.length() - 4));
+  const std::string dot_extension = std::string(".") + extension;
+  if (String::EndsWithCaseInsensitive(pathname_, dot_extension)) {
+    return FilePath(pathname_.substr(
+        0, pathname_.length() - dot_extension.length()));
   }
   return *this;
 }
@@ -147,7 +154,7 @@ const char* FilePath::FindLastPathSeparator() const {
 // On Windows platform, '\' is the path separator, otherwise it is '/'.
 FilePath FilePath::RemoveDirectoryName() const {
   const char* const last_sep = FindLastPathSeparator();
-  return last_sep ? FilePath(String(last_sep + 1)) : *this;
+  return last_sep ? FilePath(last_sep + 1) : *this;
 }
 
 // RemoveFileName returns the directory path with the filename removed.
@@ -158,9 +165,9 @@ FilePath FilePath::RemoveDirectoryName() const {
 // On Windows platform, '\' is the path separator, otherwise it is '/'.
 FilePath FilePath::RemoveFileName() const {
   const char* const last_sep = FindLastPathSeparator();
-  String dir;
+  std::string dir;
   if (last_sep) {
-    dir = String(c_str(), last_sep + 1 - c_str());
+    dir = std::string(c_str(), last_sep + 1 - c_str());
   } else {
     dir = kCurrentDirectoryString;
   }
@@ -177,11 +184,12 @@ FilePath FilePath::MakeFileName(const FilePath& directory,
                                 const FilePath& base_name,
                                 int number,
                                 const char* extension) {
-  String file;
+  std::string file;
   if (number == 0) {
-    file = String::Format("%s.%s", base_name.c_str(), extension);
+    file = base_name.string() + "." + extension;
   } else {
-    file = String::Format("%s_%d.%s", base_name.c_str(), number, extension);
+    file = base_name.string() + "_" + StreamableToString(number)
+        + "." + extension;
   }
   return ConcatPaths(directory, FilePath(file));
 }
@@ -193,8 +201,7 @@ FilePath FilePath::ConcatPaths(const FilePath& directory,
   if (directory.IsEmpty())
     return relative_path;
   const FilePath dir(directory.RemoveTrailingPathSeparator());
-  return FilePath(String::Format("%s%c%s", dir.c_str(), kPathSeparator,
-                                 relative_path.c_str()));
+  return FilePath(dir.string() + kPathSeparator + relative_path.string());
 }
 
 // Returns true if pathname describes something findable in the file-system,
@@ -338,7 +345,7 @@ bool FilePath::CreateFolder() const {
 // On Windows platform, uses \ as the separator, other platforms use /.
 FilePath FilePath::RemoveTrailingPathSeparator() const {
   return IsDirectory()
-      ? FilePath(String(pathname_.c_str(), pathname_.length() - 1))
+      ? FilePath(pathname_.substr(0, pathname_.length() - 1))
       : *this;
 }
 
index 65a2101..ed8a682 100755 (executable)
@@ -40,7 +40,7 @@
 // GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is
 // part of Google Test's implementation; otherwise it's undefined.
 #if !GTEST_IMPLEMENTATION_
-// A user is trying to include this from his code - just say no.
+// If this file is included from the user's code, just say no.
 # error "gtest-internal-inl.h is part of Google Test's internal implementation."
 # error "It must not be included except by Google Test itself."
 #endif  // GTEST_IMPLEMENTATION_
 
 #include "gtest/internal/gtest-port.h"
 
+#if GTEST_CAN_STREAM_RESULTS_
+# include <arpa/inet.h>  // NOLINT
+# include <netdb.h>  // NOLINT
+#endif
+
 #if GTEST_OS_WINDOWS
 # include <windows.h>  // NOLINT
 #endif  // GTEST_OS_WINDOWS
@@ -95,6 +100,7 @@ const char kShuffleFlag[] = "shuffle";
 const char kStackTraceDepthFlag[] = "stack_trace_depth";
 const char kStreamResultToFlag[] = "stream_result_to";
 const char kThrowOnFailureFlag[] = "throw_on_failure";
+const char kFlagfileFlag[] = "flagfile";
 
 // A valid random seed must be in [1, kMaxRandomSeed].
 const int kMaxRandomSeed = 99999;
@@ -112,6 +118,12 @@ GTEST_API_ bool ShouldUseColor(bool stdout_is_tty);
 // Formats the given time in milliseconds as seconds.
 GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms);
 
+// Converts the given time in milliseconds to a date string in the ISO 8601
+// format, without the timezone information.  N.B.: due to the use the
+// non-reentrant localtime() function, this function is not thread safe.  Do
+// not use it in any code that can be called from multiple threads.
+GTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms);
+
 // Parses a string for an Int32 flag, in the form of "--flag=value".
 //
 // On success, stores the value of the flag in *value, and returns
@@ -190,37 +202,35 @@ class GTestFlagSaver {
     GTEST_FLAG(stream_result_to) = stream_result_to_;
     GTEST_FLAG(throw_on_failure) = throw_on_failure_;
   }
+
  private:
   // Fields for saving the original values of flags.
   bool also_run_disabled_tests_;
   bool break_on_failure_;
   bool catch_exceptions_;
-  String color_;
-  String death_test_style_;
+  std::string color_;
+  std::string death_test_style_;
   bool death_test_use_fork_;
-  String filter_;
-  String internal_run_death_test_;
+  std::string filter_;
+  std::string internal_run_death_test_;
   bool list_tests_;
-  String output_;
+  std::string output_;
   bool print_time_;
-  bool pretty_;
   internal::Int32 random_seed_;
   internal::Int32 repeat_;
   bool shuffle_;
   internal::Int32 stack_trace_depth_;
-  String stream_result_to_;
+  std::string stream_result_to_;
   bool throw_on_failure_;
 } GTEST_ATTRIBUTE_UNUSED_;
 
 // Converts a Unicode code point to a narrow string in UTF-8 encoding.
 // code_point parameter is of type UInt32 because wchar_t may not be
 // wide enough to contain a code point.
-// The output buffer str must containt at least 32 characters.
-// The function returns the address of the output buffer.
 // If the code_point is not a valid Unicode code point
-// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be output
-// as '(Invalid Unicode 0xXXXXXXXX)'.
-GTEST_API_ char* CodePointToUtf8(UInt32 code_point, char* str);
+// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted
+// to "(Invalid Unicode 0xXXXXXXXX)".
+GTEST_API_ std::string CodePointToUtf8(UInt32 code_point);
 
 // Converts a wide string to a narrow string in UTF-8 encoding.
 // The wide string is assumed to have the following encoding:
@@ -235,7 +245,7 @@ GTEST_API_ char* CodePointToUtf8(UInt32 code_point, char* str);
 // as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
 // and contains invalid UTF-16 surrogate pairs, values in those pairs
 // will be encoded as individual Unicode characters from Basic Normal Plane.
-GTEST_API_ String WideStringToUtf8(const wchar_t* str, int num_chars);
+GTEST_API_ std::string WideStringToUtf8(const wchar_t* str, int num_chars);
 
 // Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
 // if the variable is present. If a file already exists at this location, this
@@ -339,16 +349,15 @@ class TestPropertyKeyIs {
   // Constructor.
   //
   // TestPropertyKeyIs has NO default constructor.
-  explicit TestPropertyKeyIs(const char* key)
-      : key_(key) {}
+  explicit TestPropertyKeyIs(const std::string& key) : key_(key) {}
 
   // Returns true iff the test name of test property matches on key_.
   bool operator()(const TestProperty& test_property) const {
-    return String(test_property.key()).Compare(key_) == 0;
+    return test_property.key() == key_;
   }
 
  private:
-  String key_;
+  std::string key_;
 };
 
 // Class UnitTestOptions.
@@ -366,12 +375,12 @@ class GTEST_API_ UnitTestOptions {
   // Functions for processing the gtest_output flag.
 
   // Returns the output format, or "" for normal printed output.
-  static String GetOutputFormat();
+  static std::string GetOutputFormat();
 
   // Returns the absolute path of the requested output file, or the
   // default (test_detail.xml in the original working directory) if
   // none was explicitly specified.
-  static String GetAbsolutePathToOutputFile();
+  static std::string GetAbsolutePathToOutputFile();
 
   // Functions for processing the gtest_filter flag.
 
@@ -384,8 +393,8 @@ class GTEST_API_ UnitTestOptions {
 
   // Returns true iff the user-specified filter matches the test case
   // name and the test name.
-  static bool FilterMatchesTest(const String &test_case_name,
-                                const String &test_name);
+  static bool FilterMatchesTest(const std::string &test_case_name,
+                                const std::string &test_name);
 
 #if GTEST_OS_WINDOWS
   // Function for supporting the gtest_catch_exception flag.
@@ -398,7 +407,7 @@ class GTEST_API_ UnitTestOptions {
 
   // Returns true if "name" matches the ':' separated list of glob-style
   // filters in "filter".
-  static bool MatchesFilter(const String& name, const char* filter);
+  static bool MatchesFilter(const std::string& name, const char* filter);
 };
 
 // Returns the current application's name, removing directory path if that
@@ -411,19 +420,23 @@ class OsStackTraceGetterInterface {
   OsStackTraceGetterInterface() {}
   virtual ~OsStackTraceGetterInterface() {}
 
-  // Returns the current OS stack trace as a String.  Parameters:
+  // Returns the current OS stack trace as an std::string.  Parameters:
   //
   //   max_depth  - the maximum number of stack frames to be included
   //                in the trace.
   //   skip_count - the number of top frames to be skipped; doesn't count
   //                against max_depth.
-  virtual String CurrentStackTrace(int max_depth, int skip_count) = 0;
+  virtual string CurrentStackTrace(int max_depth, int skip_count) = 0;
 
   // UponLeavingGTest() should be called immediately before Google Test calls
   // user code. It saves some information about the current stack that
   // CurrentStackTrace() will use to find and hide Google Test stack frames.
   virtual void UponLeavingGTest() = 0;
 
+  // This string is inserted in place of stack frames that are part of
+  // Google Test's implementation.
+  static const char* const kElidedFramesMarker;
+
  private:
   GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface);
 };
@@ -431,23 +444,12 @@ class OsStackTraceGetterInterface {
 // A working implementation of the OsStackTraceGetterInterface interface.
 class OsStackTraceGetter : public OsStackTraceGetterInterface {
  public:
-  OsStackTraceGetter() : caller_frame_(NULL) {}
-  virtual String CurrentStackTrace(int max_depth, int skip_count);
-  virtual void UponLeavingGTest();
+  OsStackTraceGetter() {}
 
-  // This string is inserted in place of stack frames that are part of
-  // Google Test's implementation.
-  static const char* const kElidedFramesMarker;
+  virtual string CurrentStackTrace(int max_depth, int skip_count);
+  virtual void UponLeavingGTest();
 
  private:
-  Mutex mutex_;  // protects all internal state
-
-  // We save the stack frame below the frame that calls user code.
-  // We do this because the address of the frame immediately below
-  // the user code changes between the call to UponLeavingGTest()
-  // and any calls to CurrentStackTrace() from within the user code.
-  void* caller_frame_;
-
   GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter);
 };
 
@@ -455,7 +457,7 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface {
 struct TraceInfo {
   const char* file;
   int line;
-  String message;
+  std::string message;
 };
 
 // This is the default global test part result reporter used in UnitTestImpl.
@@ -539,15 +541,25 @@ class GTEST_API_ UnitTestImpl {
   // Gets the number of failed tests.
   int failed_test_count() const;
 
+  // Gets the number of disabled tests that will be reported in the XML report.
+  int reportable_disabled_test_count() const;
+
   // Gets the number of disabled tests.
   int disabled_test_count() const;
 
+  // Gets the number of tests to be printed in the XML report.
+  int reportable_test_count() const;
+
   // Gets the number of all tests.
   int total_test_count() const;
 
   // Gets the number of tests that should run.
   int test_to_run_count() const;
 
+  // Gets the time of the test program start, in ms from the start of the
+  // UNIX epoch.
+  TimeInMillis start_timestamp() const { return start_timestamp_; }
+
   // Gets the elapsed time, in milliseconds.
   TimeInMillis elapsed_time() const { return elapsed_time_; }
 
@@ -596,7 +608,7 @@ class GTEST_API_ UnitTestImpl {
   // getter, and returns it.
   OsStackTraceGetterInterface* os_stack_trace_getter();
 
-  // Returns the current OS stack trace as a String.
+  // Returns the current OS stack trace as an std::string.
   //
   // The maximum number of stack frames to be included is specified by
   // the gtest_stack_trace_depth flag.  The skip_count parameter
@@ -606,7 +618,7 @@ class GTEST_API_ UnitTestImpl {
   // For example, if Foo() calls Bar(), which in turn calls
   // CurrentOsStackTraceExceptTop(1), Foo() will be included in the
   // trace but Bar() and CurrentOsStackTraceExceptTop() won't.
-  String CurrentOsStackTraceExceptTop(int skip_count);
+  std::string CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_;
 
   // Finds and returns a TestCase with the given name.  If one doesn't
   // exist, creates one and returns it.
@@ -696,6 +708,12 @@ class GTEST_API_ UnitTestImpl {
     ad_hoc_test_result_.Clear();
   }
 
+  // Adds a TestProperty to the current TestResult object when invoked in a
+  // context of a test or a test case, or to the global property set. If the
+  // result already contains a property with the same key, the value will be
+  // updated.
+  void RecordProperty(const TestProperty& test_property);
+
   enum ReactionToSharding {
     HONOR_SHARDING_PROTOCOL,
     IGNORE_SHARDING_PROTOCOL
@@ -880,6 +898,10 @@ class GTEST_API_ UnitTestImpl {
   // Our random number generator.
   internal::Random random_;
 
+  // The time of the test program start, in ms from the start of the
+  // UNIX epoch.
+  TimeInMillis start_timestamp_;
+
   // How long the test took to run, in milliseconds.
   TimeInMillis elapsed_time_;
 
@@ -935,33 +957,7 @@ GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
 
 // Returns the message describing the last system error, regardless of the
 // platform.
-GTEST_API_ String GetLastErrnoDescription();
-
-# if GTEST_OS_WINDOWS
-// Provides leak-safe Windows kernel handle ownership.
-class AutoHandle {
- public:
-  AutoHandle() : handle_(INVALID_HANDLE_VALUE) {}
-  explicit AutoHandle(HANDLE handle) : handle_(handle) {}
-
-  ~AutoHandle() { Reset(); }
-
-  HANDLE Get() const { return handle_; }
-  void Reset() { Reset(INVALID_HANDLE_VALUE); }
-  void Reset(HANDLE handle) {
-    if (handle != handle_) {
-      if (handle_ != INVALID_HANDLE_VALUE)
-        ::CloseHandle(handle_);
-      handle_ = handle;
-    }
-  }
-
- private:
-  HANDLE handle_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
-};
-# endif  // GTEST_OS_WINDOWS
+GTEST_API_ std::string GetLastErrnoDescription();
 
 // Attempts to parse a string into a positive integer pointed to by the
 // number parameter.  Returns true if that is possible.
@@ -1018,8 +1014,9 @@ bool ParseNaturalNumber(const ::std::string& str, Integer* number) {
 class TestResultAccessor {
  public:
   static void RecordProperty(TestResult* test_result,
+                             const std::string& xml_element,
                              const TestProperty& property) {
-    test_result->RecordProperty(property);
+    test_result->RecordProperty(xml_element, property);
   }
 
   static void ClearTestPartResults(TestResult* test_result) {
@@ -1032,6 +1029,154 @@ class TestResultAccessor {
   }
 };
 
+#if GTEST_CAN_STREAM_RESULTS_
+
+// Streams test results to the given port on the given host machine.
+class GTEST_API_ StreamingListener : public EmptyTestEventListener {
+ public:
+  // Abstract base class for writing strings to a socket.
+  class AbstractSocketWriter {
+   public:
+    virtual ~AbstractSocketWriter() {}
+
+    // Sends a string to the socket.
+    virtual void Send(const string& message) = 0;
+
+    // Closes the socket.
+    virtual void CloseConnection() {}
+
+    // Sends a string and a newline to the socket.
+    void SendLn(const string& message) {
+      Send(message + "\n");
+    }
+  };
+
+  // Concrete class for actually writing strings to a socket.
+  class SocketWriter : public AbstractSocketWriter {
+   public:
+    SocketWriter(const string& host, const string& port)
+        : sockfd_(-1), host_name_(host), port_num_(port) {
+      MakeConnection();
+    }
+
+    virtual ~SocketWriter() {
+      if (sockfd_ != -1)
+        CloseConnection();
+    }
+
+    // Sends a string to the socket.
+    virtual void Send(const string& message) {
+      GTEST_CHECK_(sockfd_ != -1)
+          << "Send() can be called only when there is a connection.";
+
+      const int len = static_cast<int>(message.length());
+      if (write(sockfd_, message.c_str(), len) != len) {
+        GTEST_LOG_(WARNING)
+            << "stream_result_to: failed to stream to "
+            << host_name_ << ":" << port_num_;
+      }
+    }
+
+   private:
+    // Creates a client socket and connects to the server.
+    void MakeConnection();
+
+    // Closes the socket.
+    void CloseConnection() {
+      GTEST_CHECK_(sockfd_ != -1)
+          << "CloseConnection() can be called only when there is a connection.";
+
+      close(sockfd_);
+      sockfd_ = -1;
+    }
+
+    int sockfd_;  // socket file descriptor
+    const string host_name_;
+    const string port_num_;
+
+    GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter);
+  };  // class SocketWriter
+
+  // Escapes '=', '&', '%', and '\n' characters in str as "%xx".
+  static string UrlEncode(const char* str);
+
+  StreamingListener(const string& host, const string& port)
+      : socket_writer_(new SocketWriter(host, port)) { Start(); }
+
+  explicit StreamingListener(AbstractSocketWriter* socket_writer)
+      : socket_writer_(socket_writer) { Start(); }
+
+  void OnTestProgramStart(const UnitTest& /* unit_test */) {
+    SendLn("event=TestProgramStart");
+  }
+
+  void OnTestProgramEnd(const UnitTest& unit_test) {
+    // Note that Google Test current only report elapsed time for each
+    // test iteration, not for the entire test program.
+    SendLn("event=TestProgramEnd&passed=" + FormatBool(unit_test.Passed()));
+
+    // Notify the streaming server to stop.
+    socket_writer_->CloseConnection();
+  }
+
+  void OnTestIterationStart(const UnitTest& /* unit_test */, int iteration) {
+    SendLn("event=TestIterationStart&iteration=" +
+           StreamableToString(iteration));
+  }
+
+  void OnTestIterationEnd(const UnitTest& unit_test, int /* iteration */) {
+    SendLn("event=TestIterationEnd&passed=" +
+           FormatBool(unit_test.Passed()) + "&elapsed_time=" +
+           StreamableToString(unit_test.elapsed_time()) + "ms");
+  }
+
+  void OnTestCaseStart(const TestCase& test_case) {
+    SendLn(std::string("event=TestCaseStart&name=") + test_case.name());
+  }
+
+  void OnTestCaseEnd(const TestCase& test_case) {
+    SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed())
+           + "&elapsed_time=" + StreamableToString(test_case.elapsed_time())
+           + "ms");
+  }
+
+  void OnTestStart(const TestInfo& test_info) {
+    SendLn(std::string("event=TestStart&name=") + test_info.name());
+  }
+
+  void OnTestEnd(const TestInfo& test_info) {
+    SendLn("event=TestEnd&passed=" +
+           FormatBool((test_info.result())->Passed()) +
+           "&elapsed_time=" +
+           StreamableToString((test_info.result())->elapsed_time()) + "ms");
+  }
+
+  void OnTestPartResult(const TestPartResult& test_part_result) {
+    const char* file_name = test_part_result.file_name();
+    if (file_name == NULL)
+      file_name = "";
+    SendLn("event=TestPartResult&file=" + UrlEncode(file_name) +
+           "&line=" + StreamableToString(test_part_result.line_number()) +
+           "&message=" + UrlEncode(test_part_result.message()));
+  }
+
+ private:
+  // Sends the given message and a newline to the socket.
+  void SendLn(const string& message) { socket_writer_->SendLn(message); }
+
+  // Called at the start of streaming to notify the receiver what
+  // protocol we are using.
+  void Start() { SendLn("gtest_streaming_protocol_version=1.0"); }
+
+  string FormatBool(bool value) { return value ? "1" : "0"; }
+
+  const scoped_ptr<AbstractSocketWriter> socket_writer_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener);
+};  // class StreamingListener
+
+#endif  // GTEST_CAN_STREAM_RESULTS_
+
 }  // namespace internal
 }  // namespace testing
 
index b860d48..e5bf3dd 100755 (executable)
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <fstream>
 
-#if GTEST_OS_WINDOWS_MOBILE
-# include <windows.h>  // For TerminateProcess()
-#elif GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
+# include <windows.h>
 # include <io.h>
 # include <sys/stat.h>
+# include <map>  // Used in ThreadLocal.
 #else
 # include <unistd.h>
-#endif  // GTEST_OS_WINDOWS_MOBILE
+#endif  // GTEST_OS_WINDOWS
 
 #if GTEST_OS_MAC
 # include <mach/mach_init.h>
 # include <mach/vm_map.h>
 #endif  // GTEST_OS_MAC
 
+#if GTEST_OS_QNX
+# include <devctl.h>
+# include <fcntl.h>
+# include <sys/procfs.h>
+#endif  // GTEST_OS_QNX
+
+#if GTEST_OS_AIX
+# include <procinfo.h>
+# include <sys/types.h>
+#endif  // GTEST_OS_AIX
+
 #include "gtest/gtest-spi.h"
 #include "gtest/gtest-message.h"
 #include "gtest/internal/gtest-internal.h"
@@ -58,9 +70,9 @@
 
 // Indicates that this translation unit is part of Google Test's
 // implementation.  It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error.  This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
+// included, or there will be a compiler error.  This trick exists to
+// prevent the accidental inclusion of gtest-internal-inl.h in the
+// user's code.
 #define GTEST_IMPLEMENTATION_ 1
 #include "src/gtest-internal-inl.h"
 #undef GTEST_IMPLEMENTATION_
@@ -77,10 +89,31 @@ const int kStdOutFileno = STDOUT_FILENO;
 const int kStdErrFileno = STDERR_FILENO;
 #endif  // _MSC_VER
 
-#if GTEST_OS_MAC
+#if GTEST_OS_LINUX
+
+namespace {
+template <typename T>
+T ReadProcFileField(const string& filename, int field) {
+  std::string dummy;
+  std::ifstream file(filename.c_str());
+  while (field-- > 0) {
+    file >> dummy;
+  }
+  T output = 0;
+  file >> output;
+  return output;
+}
+}  // namespace
+
+// Returns the number of active threads, or 0 when there is an error.
+size_t GetThreadCount() {
+  const string filename =
+      (Message() << "/proc/" << getpid() << "/stat").GetString();
+  return ReadProcFileField<int>(filename, 19);
+}
+
+#elif GTEST_OS_MAC
 
-// Returns the number of threads running in the process, or 0 to indicate that
-// we cannot detect it.
 size_t GetThreadCount() {
   const task_t task = mach_task_self();
   mach_msg_type_number_t thread_count;
@@ -98,6 +131,39 @@ size_t GetThreadCount() {
   }
 }
 
+#elif GTEST_OS_QNX
+
+// Returns the number of threads running in the process, or 0 to indicate that
+// we cannot detect it.
+size_t GetThreadCount() {
+  const int fd = open("/proc/self/as", O_RDONLY);
+  if (fd < 0) {
+    return 0;
+  }
+  procfs_info process_info;
+  const int status =
+      devctl(fd, DCMD_PROC_INFO, &process_info, sizeof(process_info), NULL);
+  close(fd);
+  if (status == EOK) {
+    return static_cast<size_t>(process_info.num_threads);
+  } else {
+    return 0;
+  }
+}
+
+#elif GTEST_OS_AIX
+
+size_t GetThreadCount() {
+  struct procentry64 entry;
+  pid_t pid = getpid();
+  int status = getprocs64(&entry, sizeof(entry), NULL, 0, &pid, 1);
+  if (status == 1) {
+    return entry.pi_thcount;
+  } else {
+    return 0;
+  }
+}
+
 #else
 
 size_t GetThreadCount() {
@@ -106,7 +172,390 @@ size_t GetThreadCount() {
   return 0;
 }
 
-#endif  // GTEST_OS_MAC
+#endif  // GTEST_OS_LINUX
+
+#if GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS
+
+void SleepMilliseconds(int n) {
+  ::Sleep(n);
+}
+
+AutoHandle::AutoHandle()
+    : handle_(INVALID_HANDLE_VALUE) {}
+
+AutoHandle::AutoHandle(Handle handle)
+    : handle_(handle) {}
+
+AutoHandle::~AutoHandle() {
+  Reset();
+}
+
+AutoHandle::Handle AutoHandle::Get() const {
+  return handle_;
+}
+
+void AutoHandle::Reset() {
+  Reset(INVALID_HANDLE_VALUE);
+}
+
+void AutoHandle::Reset(HANDLE handle) {
+  // Resetting with the same handle we already own is invalid.
+  if (handle_ != handle) {
+    if (IsCloseable()) {
+      ::CloseHandle(handle_);
+    }
+    handle_ = handle;
+  } else {
+    GTEST_CHECK_(!IsCloseable())
+        << "Resetting a valid handle to itself is likely a programmer error "
+            "and thus not allowed.";
+  }
+}
+
+bool AutoHandle::IsCloseable() const {
+  // Different Windows APIs may use either of these values to represent an
+  // invalid handle.
+  return handle_ != NULL && handle_ != INVALID_HANDLE_VALUE;
+}
+
+Notification::Notification()
+    : event_(::CreateEvent(NULL,   // Default security attributes.
+                           TRUE,   // Do not reset automatically.
+                           FALSE,  // Initially unset.
+                           NULL)) {  // Anonymous event.
+  GTEST_CHECK_(event_.Get() != NULL);
+}
+
+void Notification::Notify() {
+  GTEST_CHECK_(::SetEvent(event_.Get()) != FALSE);
+}
+
+void Notification::WaitForNotification() {
+  GTEST_CHECK_(
+      ::WaitForSingleObject(event_.Get(), INFINITE) == WAIT_OBJECT_0);
+}
+
+Mutex::Mutex()
+    : owner_thread_id_(0),
+      type_(kDynamic),
+      critical_section_init_phase_(0),
+      critical_section_(new CRITICAL_SECTION) {
+  ::InitializeCriticalSection(critical_section_);
+}
+
+Mutex::~Mutex() {
+  // Static mutexes are leaked intentionally. It is not thread-safe to try
+  // to clean them up.
+  // TODO(yukawa): Switch to Slim Reader/Writer (SRW) Locks, which requires
+  // nothing to clean it up but is available only on Vista and later.
+  // http://msdn.microsoft.com/en-us/library/windows/desktop/aa904937.aspx
+  if (type_ == kDynamic) {
+    ::DeleteCriticalSection(critical_section_);
+    delete critical_section_;
+    critical_section_ = NULL;
+  }
+}
+
+void Mutex::Lock() {
+  ThreadSafeLazyInit();
+  ::EnterCriticalSection(critical_section_);
+  owner_thread_id_ = ::GetCurrentThreadId();
+}
+
+void Mutex::Unlock() {
+  ThreadSafeLazyInit();
+  // We don't protect writing to owner_thread_id_ here, as it's the
+  // caller's responsibility to ensure that the current thread holds the
+  // mutex when this is called.
+  owner_thread_id_ = 0;
+  ::LeaveCriticalSection(critical_section_);
+}
+
+// Does nothing if the current thread holds the mutex. Otherwise, crashes
+// with high probability.
+void Mutex::AssertHeld() {
+  ThreadSafeLazyInit();
+  GTEST_CHECK_(owner_thread_id_ == ::GetCurrentThreadId())
+      << "The current thread is not holding the mutex @" << this;
+}
+
+// Initializes owner_thread_id_ and critical_section_ in static mutexes.
+void Mutex::ThreadSafeLazyInit() {
+  // Dynamic mutexes are initialized in the constructor.
+  if (type_ == kStatic) {
+    switch (
+        ::InterlockedCompareExchange(&critical_section_init_phase_, 1L, 0L)) {
+      case 0:
+        // If critical_section_init_phase_ was 0 before the exchange, we
+        // are the first to test it and need to perform the initialization.
+        owner_thread_id_ = 0;
+        critical_section_ = new CRITICAL_SECTION;
+        ::InitializeCriticalSection(critical_section_);
+        // Updates the critical_section_init_phase_ to 2 to signal
+        // initialization complete.
+        GTEST_CHECK_(::InterlockedCompareExchange(
+                          &critical_section_init_phase_, 2L, 1L) ==
+                      1L);
+        break;
+      case 1:
+        // Somebody else is already initializing the mutex; spin until they
+        // are done.
+        while (::InterlockedCompareExchange(&critical_section_init_phase_,
+                                            2L,
+                                            2L) != 2L) {
+          // Possibly yields the rest of the thread's time slice to other
+          // threads.
+          ::Sleep(0);
+        }
+        break;
+
+      case 2:
+        break;  // The mutex is already initialized and ready for use.
+
+      default:
+        GTEST_CHECK_(false)
+            << "Unexpected value of critical_section_init_phase_ "
+            << "while initializing a static mutex.";
+    }
+  }
+}
+
+namespace {
+
+class ThreadWithParamSupport : public ThreadWithParamBase {
+ public:
+  static HANDLE CreateThread(Runnable* runnable,
+                             Notification* thread_can_start) {
+    ThreadMainParam* param = new ThreadMainParam(runnable, thread_can_start);
+    DWORD thread_id;
+    // TODO(yukawa): Consider to use _beginthreadex instead.
+    HANDLE thread_handle = ::CreateThread(
+        NULL,    // Default security.
+        0,       // Default stack size.
+        &ThreadWithParamSupport::ThreadMain,
+        param,   // Parameter to ThreadMainStatic
+        0x0,     // Default creation flags.
+        &thread_id);  // Need a valid pointer for the call to work under Win98.
+    GTEST_CHECK_(thread_handle != NULL) << "CreateThread failed with error "
+                                        << ::GetLastError() << ".";
+    if (thread_handle == NULL) {
+      delete param;
+    }
+    return thread_handle;
+  }
+
+ private:
+  struct ThreadMainParam {
+    ThreadMainParam(Runnable* runnable, Notification* thread_can_start)
+        : runnable_(runnable),
+          thread_can_start_(thread_can_start) {
+    }
+    scoped_ptr<Runnable> runnable_;
+    // Does not own.
+    Notification* thread_can_start_;
+  };
+
+  static DWORD WINAPI ThreadMain(void* ptr) {
+    // Transfers ownership.
+    scoped_ptr<ThreadMainParam> param(static_cast<ThreadMainParam*>(ptr));
+    if (param->thread_can_start_ != NULL)
+      param->thread_can_start_->WaitForNotification();
+    param->runnable_->Run();
+    return 0;
+  }
+
+  // Prohibit instantiation.
+  ThreadWithParamSupport();
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParamSupport);
+};
+
+}  // namespace
+
+ThreadWithParamBase::ThreadWithParamBase(Runnable *runnable,
+                                         Notification* thread_can_start)
+      : thread_(ThreadWithParamSupport::CreateThread(runnable,
+                                                     thread_can_start)) {
+}
+
+ThreadWithParamBase::~ThreadWithParamBase() {
+  Join();
+}
+
+void ThreadWithParamBase::Join() {
+  GTEST_CHECK_(::WaitForSingleObject(thread_.Get(), INFINITE) == WAIT_OBJECT_0)
+      << "Failed to join the thread with error " << ::GetLastError() << ".";
+}
+
+// Maps a thread to a set of ThreadIdToThreadLocals that have values
+// instantiated on that thread and notifies them when the thread exits.  A
+// ThreadLocal instance is expected to persist until all threads it has
+// values on have terminated.
+class ThreadLocalRegistryImpl {
+ public:
+  // Registers thread_local_instance as having value on the current thread.
+  // Returns a value that can be used to identify the thread from other threads.
+  static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
+      const ThreadLocalBase* thread_local_instance) {
+    DWORD current_thread = ::GetCurrentThreadId();
+    MutexLock lock(&mutex_);
+    ThreadIdToThreadLocals* const thread_to_thread_locals =
+        GetThreadLocalsMapLocked();
+    ThreadIdToThreadLocals::iterator thread_local_pos =
+        thread_to_thread_locals->find(current_thread);
+    if (thread_local_pos == thread_to_thread_locals->end()) {
+      thread_local_pos = thread_to_thread_locals->insert(
+          std::make_pair(current_thread, ThreadLocalValues())).first;
+      StartWatcherThreadFor(current_thread);
+    }
+    ThreadLocalValues& thread_local_values = thread_local_pos->second;
+    ThreadLocalValues::iterator value_pos =
+        thread_local_values.find(thread_local_instance);
+    if (value_pos == thread_local_values.end()) {
+      value_pos =
+          thread_local_values
+              .insert(std::make_pair(
+                  thread_local_instance,
+                  linked_ptr<ThreadLocalValueHolderBase>(
+                      thread_local_instance->NewValueForCurrentThread())))
+              .first;
+    }
+    return value_pos->second.get();
+  }
+
+  static void OnThreadLocalDestroyed(
+      const ThreadLocalBase* thread_local_instance) {
+    std::vector<linked_ptr<ThreadLocalValueHolderBase> > value_holders;
+    // Clean up the ThreadLocalValues data structure while holding the lock, but
+    // defer the destruction of the ThreadLocalValueHolderBases.
+    {
+      MutexLock lock(&mutex_);
+      ThreadIdToThreadLocals* const thread_to_thread_locals =
+          GetThreadLocalsMapLocked();
+      for (ThreadIdToThreadLocals::iterator it =
+          thread_to_thread_locals->begin();
+          it != thread_to_thread_locals->end();
+          ++it) {
+        ThreadLocalValues& thread_local_values = it->second;
+        ThreadLocalValues::iterator value_pos =
+            thread_local_values.find(thread_local_instance);
+        if (value_pos != thread_local_values.end()) {
+          value_holders.push_back(value_pos->second);
+          thread_local_values.erase(value_pos);
+          // This 'if' can only be successful at most once, so theoretically we
+          // could break out of the loop here, but we don't bother doing so.
+        }
+      }
+    }
+    // Outside the lock, let the destructor for 'value_holders' deallocate the
+    // ThreadLocalValueHolderBases.
+  }
+
+  static void OnThreadExit(DWORD thread_id) {
+    GTEST_CHECK_(thread_id != 0) << ::GetLastError();
+    std::vector<linked_ptr<ThreadLocalValueHolderBase> > value_holders;
+    // Clean up the ThreadIdToThreadLocals data structure while holding the
+    // lock, but defer the destruction of the ThreadLocalValueHolderBases.
+    {
+      MutexLock lock(&mutex_);
+      ThreadIdToThreadLocals* const thread_to_thread_locals =
+          GetThreadLocalsMapLocked();
+      ThreadIdToThreadLocals::iterator thread_local_pos =
+          thread_to_thread_locals->find(thread_id);
+      if (thread_local_pos != thread_to_thread_locals->end()) {
+        ThreadLocalValues& thread_local_values = thread_local_pos->second;
+        for (ThreadLocalValues::iterator value_pos =
+            thread_local_values.begin();
+            value_pos != thread_local_values.end();
+            ++value_pos) {
+          value_holders.push_back(value_pos->second);
+        }
+        thread_to_thread_locals->erase(thread_local_pos);
+      }
+    }
+    // Outside the lock, let the destructor for 'value_holders' deallocate the
+    // ThreadLocalValueHolderBases.
+  }
+
+ private:
+  // In a particular thread, maps a ThreadLocal object to its value.
+  typedef std::map<const ThreadLocalBase*,
+                   linked_ptr<ThreadLocalValueHolderBase> > ThreadLocalValues;
+  // Stores all ThreadIdToThreadLocals having values in a thread, indexed by
+  // thread's ID.
+  typedef std::map<DWORD, ThreadLocalValues> ThreadIdToThreadLocals;
+
+  // Holds the thread id and thread handle that we pass from
+  // StartWatcherThreadFor to WatcherThreadFunc.
+  typedef std::pair<DWORD, HANDLE> ThreadIdAndHandle;
+
+  static void StartWatcherThreadFor(DWORD thread_id) {
+    // The returned handle will be kept in thread_map and closed by
+    // watcher_thread in WatcherThreadFunc.
+    HANDLE thread = ::OpenThread(SYNCHRONIZE | THREAD_QUERY_INFORMATION,
+                                 FALSE,
+                                 thread_id);
+    GTEST_CHECK_(thread != NULL);
+    // We need to to pass a valid thread ID pointer into CreateThread for it
+    // to work correctly under Win98.
+    DWORD watcher_thread_id;
+    HANDLE watcher_thread = ::CreateThread(
+        NULL,   // Default security.
+        0,      // Default stack size
+        &ThreadLocalRegistryImpl::WatcherThreadFunc,
+        reinterpret_cast<LPVOID>(new ThreadIdAndHandle(thread_id, thread)),
+        CREATE_SUSPENDED,
+        &watcher_thread_id);
+    GTEST_CHECK_(watcher_thread != NULL);
+    // Give the watcher thread the same priority as ours to avoid being
+    // blocked by it.
+    ::SetThreadPriority(watcher_thread,
+                        ::GetThreadPriority(::GetCurrentThread()));
+    ::ResumeThread(watcher_thread);
+    ::CloseHandle(watcher_thread);
+  }
+
+  // Monitors exit from a given thread and notifies those
+  // ThreadIdToThreadLocals about thread termination.
+  static DWORD WINAPI WatcherThreadFunc(LPVOID param) {
+    const ThreadIdAndHandle* tah =
+        reinterpret_cast<const ThreadIdAndHandle*>(param);
+    GTEST_CHECK_(
+        ::WaitForSingleObject(tah->second, INFINITE) == WAIT_OBJECT_0);
+    OnThreadExit(tah->first);
+    ::CloseHandle(tah->second);
+    delete tah;
+    return 0;
+  }
+
+  // Returns map of thread local instances.
+  static ThreadIdToThreadLocals* GetThreadLocalsMapLocked() {
+    mutex_.AssertHeld();
+    static ThreadIdToThreadLocals* map = new ThreadIdToThreadLocals;
+    return map;
+  }
+
+  // Protects access to GetThreadLocalsMapLocked() and its return value.
+  static Mutex mutex_;
+  // Protects access to GetThreadMapLocked() and its return value.
+  static Mutex thread_map_mutex_;
+};
+
+Mutex ThreadLocalRegistryImpl::mutex_(Mutex::kStaticMutex);
+Mutex ThreadLocalRegistryImpl::thread_map_mutex_(Mutex::kStaticMutex);
+
+ThreadLocalValueHolderBase* ThreadLocalRegistry::GetValueOnCurrentThread(
+      const ThreadLocalBase* thread_local_instance) {
+  return ThreadLocalRegistryImpl::GetValueOnCurrentThread(
+      thread_local_instance);
+}
+
+void ThreadLocalRegistry::OnThreadLocalDestroyed(
+      const ThreadLocalBase* thread_local_instance) {
+  ThreadLocalRegistryImpl::OnThreadLocalDestroyed(thread_local_instance);
+}
+
+#endif  // GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS
 
 #if GTEST_USES_POSIX_RE
 
@@ -222,7 +671,7 @@ bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
 }
 
 // Helper function used by ValidateRegex() to format error messages.
-String FormatRegexSyntaxError(const char* regex, int index) {
+std::string FormatRegexSyntaxError(const char* regex, int index) {
   return (Message() << "Syntax error at index " << index
           << " in simple regular expression \"" << regex << "\": ").GetString();
 }
@@ -429,15 +878,15 @@ const char kUnknownFile[] = "unknown file";
 // Formats a source file path and a line number as they would appear
 // in an error message from the compiler used to compile this code.
 GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) {
-  const char* const file_name = file == NULL ? kUnknownFile : file;
+  const std::string file_name(file == NULL ? kUnknownFile : file);
 
   if (line < 0) {
-    return String::Format("%s:", file_name).c_str();
+    return file_name + ":";
   }
 #ifdef _MSC_VER
-  return String::Format("%s(%d):", file_name, line).c_str();
+  return file_name + "(" + StreamableToString(line) + "):";
 #else
-  return String::Format("%s:%d:", file_name, line).c_str();
+  return file_name + ":" + StreamableToString(line) + ":";
 #endif  // _MSC_VER
 }
 
@@ -448,15 +897,14 @@ GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) {
 // to the file location it produces, unlike FormatFileLocation().
 GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(
     const char* file, int line) {
-  const char* const file_name = file == NULL ? kUnknownFile : file;
+  const std::string file_name(file == NULL ? kUnknownFile : file);
 
   if (line < 0)
     return file_name;
   else
-    return String::Format("%s:%d", file_name, line).c_str();
+    return file_name + ":" + StreamableToString(line);
 }
 
-
 GTestLog::GTestLog(GTestLogSeverity severity, const char* file, int line)
     : severity_(severity) {
   const char* const marker =
@@ -477,10 +925,7 @@ GTestLog::~GTestLog() {
 }
 // Disable Microsoft deprecation warnings for POSIX functions called from
 // this class (creat, dup, dup2, and close)
-#ifdef _MSC_VER
-# pragma warning(push)
-# pragma warning(disable: 4996)
-#endif  // _MSC_VER
+GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
 
 #if GTEST_HAS_STREAM_REDIRECTION
 
@@ -488,8 +933,7 @@ GTestLog::~GTestLog() {
 class CapturedStream {
  public:
   // The ctor redirects the stream to a temporary file.
-  CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
-
+  explicit CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
 # if GTEST_OS_WINDOWS
     char temp_dir_path[MAX_PATH + 1] = { '\0' };  // NOLINT
     char temp_file_path[MAX_PATH + 1] = { '\0' };  // NOLINT
@@ -506,10 +950,29 @@ class CapturedStream {
                                     << temp_file_path;
     filename_ = temp_file_path;
 # else
-    // There's no guarantee that a test has write access to the
-    // current directory, so we create the temporary file in the /tmp
-    // directory instead.
+    // There's no guarantee that a test has write access to the current
+    // directory, so we create the temporary file in the /tmp directory
+    // instead. We use /tmp on most systems, and /sdcard on Android.
+    // That's because Android doesn't have /tmp.
+#  if GTEST_OS_LINUX_ANDROID
+    // Note: Android applications are expected to call the framework's
+    // Context.getExternalStorageDirectory() method through JNI to get
+    // the location of the world-writable SD Card directory. However,
+    // this requires a Context handle, which cannot be retrieved
+    // globally from native code. Doing so also precludes running the
+    // code as part of a regular standalone executable, which doesn't
+    // run in a Dalvik process (e.g. when running it through 'adb shell').
+    //
+    // The location /sdcard is directly accessible from native code
+    // and is the only location (unofficially) supported by the Android
+    // team. It's generally a symlink to the real SD Card mount point
+    // which can be /mnt/sdcard, /mnt/sdcard0, /system/media/sdcard, or
+    // other OEM-customized locations. Never rely on these, and always
+    // use /sdcard.
+    char name_template[] = "/sdcard/gtest_captured_stream.XXXXXX";
+#  else
     char name_template[] = "/tmp/captured_stream.XXXXXX";
+#  endif  // GTEST_OS_LINUX_ANDROID
     const int captured_fd = mkstemp(name_template);
     filename_ = name_template;
 # endif  // GTEST_OS_WINDOWS
@@ -522,7 +985,7 @@ class CapturedStream {
     remove(filename_.c_str());
   }
 
-  String GetCapturedString() {
+  std::string GetCapturedString() {
     if (uncaptured_fd_ != -1) {
       // Restores the original stream.
       fflush(NULL);
@@ -532,18 +995,12 @@ class CapturedStream {
     }
 
     FILE* const file = posix::FOpen(filename_.c_str(), "r");
-    const String content = ReadEntireFile(file);
+    const std::string content = ReadEntireFile(file);
     posix::FClose(file);
     return content;
   }
 
  private:
-  // Reads the entire content of a file as a String.
-  static String ReadEntireFile(FILE* file);
-
-  // Returns the size (in bytes) of a file.
-  static size_t GetFileSize(FILE* file);
-
   const int fd_;  // A stream to capture.
   int uncaptured_fd_;
   // Name of the temporary file holding the stderr output.
@@ -552,38 +1009,7 @@ class CapturedStream {
   GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream);
 };
 
-// Returns the size (in bytes) of a file.
-size_t CapturedStream::GetFileSize(FILE* file) {
-  fseek(file, 0, SEEK_END);
-  return static_cast<size_t>(ftell(file));
-}
-
-// Reads the entire content of a file as a string.
-String CapturedStream::ReadEntireFile(FILE* file) {
-  const size_t file_size = GetFileSize(file);
-  char* const buffer = new char[file_size];
-
-  size_t bytes_last_read = 0;  // # of bytes read in the last fread()
-  size_t bytes_read = 0;       // # of bytes read so far
-
-  fseek(file, 0, SEEK_SET);
-
-  // Keeps reading the file until we cannot read further or the
-  // pre-determined file size is reached.
-  do {
-    bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file);
-    bytes_read += bytes_last_read;
-  } while (bytes_last_read > 0 && bytes_read < file_size);
-
-  const String content(buffer, bytes_read);
-  delete[] buffer;
-
-  return content;
-}
-
-# ifdef _MSC_VER
-#  pragma warning(pop)
-# endif  // _MSC_VER
+GTEST_DISABLE_MSC_WARNINGS_POP_()
 
 static CapturedStream* g_captured_stderr = NULL;
 static CapturedStream* g_captured_stdout = NULL;
@@ -598,8 +1024,8 @@ void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
 }
 
 // Stops capturing the output stream and returns the captured string.
-String GetCapturedStream(CapturedStream** captured_stream) {
-  const String content = (*captured_stream)->GetCapturedString();
+std::string GetCapturedStream(CapturedStream** captured_stream) {
+  const std::string content = (*captured_stream)->GetCapturedString();
 
   delete *captured_stream;
   *captured_stream = NULL;
@@ -618,21 +1044,79 @@ void CaptureStderr() {
 }
 
 // Stops capturing stdout and returns the captured string.
-String GetCapturedStdout() { return GetCapturedStream(&g_captured_stdout); }
+std::string GetCapturedStdout() {
+  return GetCapturedStream(&g_captured_stdout);
+}
 
 // Stops capturing stderr and returns the captured string.
-String GetCapturedStderr() { return GetCapturedStream(&g_captured_stderr); }
+std::string GetCapturedStderr() {
+  return GetCapturedStream(&g_captured_stderr);
+}
 
 #endif  // GTEST_HAS_STREAM_REDIRECTION
 
+std::string TempDir() {
+#if GTEST_OS_WINDOWS_MOBILE
+  return "\\temp\\";
+#elif GTEST_OS_WINDOWS
+  const char* temp_dir = posix::GetEnv("TEMP");
+  if (temp_dir == NULL || temp_dir[0] == '\0')
+    return "\\temp\\";
+  else if (temp_dir[strlen(temp_dir) - 1] == '\\')
+    return temp_dir;
+  else
+    return std::string(temp_dir) + "\\";
+#elif GTEST_OS_LINUX_ANDROID
+  return "/sdcard/";
+#else
+  return "/tmp/";
+#endif  // GTEST_OS_WINDOWS_MOBILE
+}
+
+size_t GetFileSize(FILE* file) {
+  fseek(file, 0, SEEK_END);
+  return static_cast<size_t>(ftell(file));
+}
+
+std::string ReadEntireFile(FILE* file) {
+  const size_t file_size = GetFileSize(file);
+  char* const buffer = new char[file_size];
+
+  size_t bytes_last_read = 0;  // # of bytes read in the last fread()
+  size_t bytes_read = 0;       // # of bytes read so far
+
+  fseek(file, 0, SEEK_SET);
+
+  // Keeps reading the file until we cannot read further or the
+  // pre-determined file size is reached.
+  do {
+    bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file);
+    bytes_read += bytes_last_read;
+  } while (bytes_last_read > 0 && bytes_read < file_size);
+
+  const std::string content(buffer, bytes_read);
+  delete[] buffer;
+
+  return content;
+}
+
 #if GTEST_HAS_DEATH_TEST
 
-// A copy of all command line arguments.  Set by InitGoogleTest().
-::std::vector<String> g_argvs;
+static const ::std::vector<testing::internal::string>* g_injected_test_argvs =
+                                        NULL;  // Owned.
 
-// Returns the command line as a vector of strings.
-const ::std::vector<String>& GetArgvs() { return g_argvs; }
+void SetInjectableArgvs(const ::std::vector<testing::internal::string>* argvs) {
+  if (g_injected_test_argvs != argvs)
+    delete g_injected_test_argvs;
+  g_injected_test_argvs = argvs;
+}
 
+const ::std::vector<testing::internal::string>& GetInjectableArgvs() {
+  if (g_injected_test_argvs != NULL) {
+    return *g_injected_test_argvs;
+  }
+  return GetArgvs();
+}
 #endif  // GTEST_HAS_DEATH_TEST
 
 #if GTEST_OS_WINDOWS_MOBILE
@@ -647,8 +1131,8 @@ void Abort() {
 // Returns the name of the environment variable corresponding to the
 // given flag.  For example, FlagToEnvVar("foo") will return
 // "GTEST_FOO" in the open-source version.
-static String FlagToEnvVar(const char* flag) {
-  const String full_flag =
+static std::string FlagToEnvVar(const char* flag) {
+  const std::string full_flag =
       (Message() << GTEST_FLAG_PREFIX_ << flag).GetString();
 
   Message env_var;
@@ -705,7 +1189,10 @@ bool ParseInt32(const Message& src_text, const char* str, Int32* value) {
 //
 // The value is considered true iff it's not "0".
 bool BoolFromGTestEnv(const char* flag, bool default_value) {
-  const String env_var = FlagToEnvVar(flag);
+#if defined(GTEST_GET_BOOL_FROM_ENV_)
+  return GTEST_GET_BOOL_FROM_ENV_(flag, default_value);
+#endif  // defined(GTEST_GET_BOOL_FROM_ENV_)
+  const std::string env_var = FlagToEnvVar(flag);
   const char* const string_value = posix::GetEnv(env_var.c_str());
   return string_value == NULL ?
       default_value : strcmp(string_value, "0") != 0;
@@ -715,7 +1202,10 @@ bool BoolFromGTestEnv(const char* flag, bool default_value) {
 // variable corresponding to the given flag; if it isn't set or
 // doesn't represent a valid 32-bit integer, returns default_value.
 Int32 Int32FromGTestEnv(const char* flag, Int32 default_value) {
-  const String env_var = FlagToEnvVar(flag);
+#if defined(GTEST_GET_INT32_FROM_ENV_)
+  return GTEST_GET_INT32_FROM_ENV_(flag, default_value);
+#endif  // defined(GTEST_GET_INT32_FROM_ENV_)
+  const std::string env_var = FlagToEnvVar(flag);
   const char* const string_value = posix::GetEnv(env_var.c_str());
   if (string_value == NULL) {
     // The environment variable is not set.
@@ -736,10 +1226,33 @@ Int32 Int32FromGTestEnv(const char* flag, Int32 default_value) {
 
 // Reads and returns the string environment variable corresponding to
 // the given flag; if it's not set, returns default_value.
-const char* StringFromGTestEnv(const char* flag, const char* default_value) {
-  const String env_var = FlagToEnvVar(flag);
-  const char* const value = posix::GetEnv(env_var.c_str());
-  return value == NULL ? default_value : value;
+std::string StringFromGTestEnv(const char* flag, const char* default_value) {
+#if defined(GTEST_GET_STRING_FROM_ENV_)
+  return GTEST_GET_STRING_FROM_ENV_(flag, default_value);
+#endif  // defined(GTEST_GET_STRING_FROM_ENV_)
+  const std::string env_var = FlagToEnvVar(flag);
+  const char* value = posix::GetEnv(env_var.c_str());
+  if (value != NULL) {
+    return value;
+  }
+
+  // As a special case for the 'output' flag, if GTEST_OUTPUT is not
+  // set, we look for XML_OUTPUT_FILE, which is set by the Bazel build
+  // system.  The value of XML_OUTPUT_FILE is a filename without the
+  // "xml:" prefix of GTEST_OUTPUT.
+  //
+  // The net priority order after flag processing is thus:
+  //   --gtest_output command line flag
+  //   GTEST_OUTPUT environment variable
+  //   XML_OUTPUT_FILE environment variable
+  //   'default_value'
+  if (strcmp(flag, "output") == 0) {
+    value = posix::GetEnv("XML_OUTPUT_FILE");
+    if (value != NULL) {
+      return std::string("xml:") + value;
+    }
+  }
+  return default_value;
 }
 
 }  // namespace internal
index ed63c7b..a2df412 100755 (executable)
@@ -45,6 +45,7 @@
 #include "gtest/gtest-printers.h"
 #include <ctype.h>
 #include <stdio.h>
+#include <cwchar>
 #include <ostream>  // NOLINT
 #include <string>
 #include "gtest/internal/gtest-port.h"
@@ -55,15 +56,10 @@ namespace {
 
 using ::std::ostream;
 
-#if GTEST_OS_WINDOWS_MOBILE  // Windows CE does not define _snprintf_s.
-# define snprintf _snprintf
-#elif _MSC_VER >= 1400  // VC 8.0 and later deprecate snprintf and _snprintf.
-# define snprintf _snprintf_s
-#elif _MSC_VER
-# define snprintf _snprintf
-#endif  // GTEST_OS_WINDOWS_MOBILE
-
 // Prints a segment of bytes in the given object.
+GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
+GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
+GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
 void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,
                                 size_t count, ostream* os) {
   char text[5] = "";
@@ -77,7 +73,7 @@ void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,
       else
         *os << '-';
     }
-    snprintf(text, sizeof(text), "%02X", obj_bytes[j]);
+    GTEST_SNPRINTF_(text, sizeof(text), "%02X", obj_bytes[j]);
     *os << text;
   }
 }
@@ -184,16 +180,16 @@ static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {
         *os << static_cast<char>(c);
         return kAsIs;
       } else {
-        *os << String::Format("\\x%X", static_cast<UnsignedChar>(c));
+        *os << "\\x" + String::FormatHexInt(static_cast<UnsignedChar>(c));
         return kHexEscape;
       }
   }
   return kSpecialEscape;
 }
 
-// Prints a char c as if it's part of a string literal, escaping it when
+// Prints a wchar_t c as if it's part of a string literal, escaping it when
 // necessary; returns how c was formatted.
-static CharFormat PrintAsWideStringLiteralTo(wchar_t c, ostream* os) {
+static CharFormat PrintAsStringLiteralTo(wchar_t c, ostream* os) {
   switch (c) {
     case L'\'':
       *os << "'";
@@ -208,8 +204,9 @@ static CharFormat PrintAsWideStringLiteralTo(wchar_t c, ostream* os) {
 
 // Prints a char c as if it's part of a string literal, escaping it when
 // necessary; returns how c was formatted.
-static CharFormat PrintAsNarrowStringLiteralTo(char c, ostream* os) {
-  return PrintAsWideStringLiteralTo(static_cast<unsigned char>(c), os);
+static CharFormat PrintAsStringLiteralTo(char c, ostream* os) {
+  return PrintAsStringLiteralTo(
+      static_cast<wchar_t>(static_cast<unsigned char>(c)), os);
 }
 
 // Prints a wide or narrow character c and its code.  '\0' is printed
@@ -228,7 +225,7 @@ void PrintCharAndCodeTo(Char c, ostream* os) {
   // obvious).
   if (c == 0)
     return;
-  *os << " (" << String::Format("%d", c).c_str();
+  *os << " (" << static_cast<int>(c);
 
   // For more convenience, we print c's code again in hexidecimal,
   // unless c was already printed in the form '\x##' or the code is in
@@ -236,8 +233,7 @@ void PrintCharAndCodeTo(Char c, ostream* os) {
   if (format == kHexEscape || (1 <= c && c <= 9)) {
     // Do nothing.
   } else {
-    *os << String::Format(", 0x%X",
-                          static_cast<UnsignedChar>(c)).c_str();
+    *os << ", 0x" << String::FormatHexInt(static_cast<UnsignedChar>(c));
   }
   *os << ")";
 }
@@ -255,48 +251,69 @@ void PrintTo(wchar_t wc, ostream* os) {
   PrintCharAndCodeTo<wchar_t>(wc, os);
 }
 
-// Prints the given array of characters to the ostream.
-// The array starts at *begin, the length is len, it may include '\0' characters
-// and may not be null-terminated.
-static void PrintCharsAsStringTo(const char* begin, size_t len, ostream* os) {
-  *os << "\"";
+// Prints the given array of characters to the ostream.  CharType must be either
+// char or wchar_t.
+// The array starts at begin, the length is len, it may include '\0' characters
+// and may not be NUL-terminated.
+template <typename CharType>
+GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
+GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
+GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
+static void PrintCharsAsStringTo(
+    const CharType* begin, size_t len, ostream* os) {
+  const char* const kQuoteBegin = sizeof(CharType) == 1 ? "\"" : "L\"";
+  *os << kQuoteBegin;
   bool is_previous_hex = false;
   for (size_t index = 0; index < len; ++index) {
-    const char cur = begin[index];
+    const CharType cur = begin[index];
     if (is_previous_hex && IsXDigit(cur)) {
       // Previous character is of '\x..' form and this character can be
       // interpreted as another hexadecimal digit in its number. Break string to
       // disambiguate.
-      *os << "\" \"";
+      *os << "\" " << kQuoteBegin;
     }
-    is_previous_hex = PrintAsNarrowStringLiteralTo(cur, os) == kHexEscape;
+    is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape;
   }
   *os << "\"";
 }
 
+// Prints a (const) char/wchar_t array of 'len' elements, starting at address
+// 'begin'.  CharType must be either char or wchar_t.
+template <typename CharType>
+GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
+GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
+GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
+static void UniversalPrintCharArray(
+    const CharType* begin, size_t len, ostream* os) {
+  // The code
+  //   const char kFoo[] = "foo";
+  // generates an array of 4, not 3, elements, with the last one being '\0'.
+  //
+  // Therefore when printing a char array, we don't print the last element if
+  // it's '\0', such that the output matches the string literal as it's
+  // written in the source code.
+  if (len > 0 && begin[len - 1] == '\0') {
+    PrintCharsAsStringTo(begin, len - 1, os);
+    return;
+  }
+
+  // If, however, the last element in the array is not '\0', e.g.
+  //    const char kFoo[] = { 'f', 'o', 'o' };
+  // we must print the entire array.  We also print a message to indicate
+  // that the array is not NUL-terminated.
+  PrintCharsAsStringTo(begin, len, os);
+  *os << " (no terminating NUL)";
+}
+
 // Prints a (const) char array of 'len' elements, starting at address 'begin'.
 void UniversalPrintArray(const char* begin, size_t len, ostream* os) {
-  PrintCharsAsStringTo(begin, len, os);
+  UniversalPrintCharArray(begin, len, os);
 }
 
-// Prints the given array of wide characters to the ostream.
-// The array starts at *begin, the length is len, it may include L'\0'
-// characters and may not be null-terminated.
-static void PrintWideCharsAsStringTo(const wchar_t* begin, size_t len,
-                                     ostream* os) {
-  *os << "L\"";
-  bool is_previous_hex = false;
-  for (size_t index = 0; index < len; ++index) {
-    const wchar_t cur = begin[index];
-    if (is_previous_hex && isascii(cur) && IsXDigit(static_cast<char>(cur))) {
-      // Previous character is of '\x..' form and this character can be
-      // interpreted as another hexadecimal digit in its number. Break string to
-      // disambiguate.
-      *os << "\" L\"";
-    }
-    is_previous_hex = PrintAsWideStringLiteralTo(cur, os) == kHexEscape;
-  }
-  *os << "\"";
+// Prints a (const) wchar_t array of 'len' elements, starting at address
+// 'begin'.
+void UniversalPrintArray(const wchar_t* begin, size_t len, ostream* os) {
+  UniversalPrintCharArray(begin, len, os);
 }
 
 // Prints the given C string to the ostream.
@@ -322,7 +339,7 @@ void PrintTo(const wchar_t* s, ostream* os) {
     *os << "NULL";
   } else {
     *os << ImplicitCast_<const void*>(s) << " pointing to ";
-    PrintWideCharsAsStringTo(s, wcslen(s), os);
+    PrintCharsAsStringTo(s, std::wcslen(s), os);
   }
 }
 #endif  // wchar_t is native
@@ -341,13 +358,13 @@ void PrintStringTo(const ::std::string& s, ostream* os) {
 // Prints a ::wstring object.
 #if GTEST_HAS_GLOBAL_WSTRING
 void PrintWideStringTo(const ::wstring& s, ostream* os) {
-  PrintWideCharsAsStringTo(s.data(), s.size(), os);
+  PrintCharsAsStringTo(s.data(), s.size(), os);
 }
 #endif  // GTEST_HAS_GLOBAL_WSTRING
 
 #if GTEST_HAS_STD_WSTRING
 void PrintWideStringTo(const ::std::wstring& s, ostream* os) {
-  PrintWideCharsAsStringTo(s.data(), s.size(), os);
+  PrintCharsAsStringTo(s.data(), s.size(), os);
 }
 #endif  // GTEST_HAS_STD_WSTRING
 
index 5ddc67c..fb0e354 100755 (executable)
@@ -35,9 +35,9 @@
 
 // Indicates that this translation unit is part of Google Test's
 // implementation.  It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error.  This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
+// included, or there will be a compiler error.  This trick exists to
+// prevent the accidental inclusion of gtest-internal-inl.h in the
+// user's code.
 #define GTEST_IMPLEMENTATION_ 1
 #include "src/gtest-internal-inl.h"
 #undef GTEST_IMPLEMENTATION_
@@ -48,10 +48,10 @@ using internal::GetUnitTestImpl;
 
 // Gets the summary of the failure message by omitting the stack trace
 // in it.
-internal::String TestPartResult::ExtractSummary(const char* message) {
+std::string TestPartResult::ExtractSummary(const char* message) {
   const char* const stack_trace = strstr(message, internal::kStackTraceMarker);
-  return stack_trace == NULL ? internal::String(message) :
-      internal::String(message, stack_trace - message);
+  return stack_trace == NULL ? message :
+      std::string(message, stack_trace);
 }
 
 // Prints a TestPartResult object.
index a5cc88f..df1eef4 100755 (executable)
@@ -45,33 +45,41 @@ static const char* SkipSpaces(const char* str) {
   return str;
 }
 
+static std::vector<std::string> SplitIntoTestNames(const char* src) {
+  std::vector<std::string> name_vec;
+  src = SkipSpaces(src);
+  for (; src != NULL; src = SkipComma(src)) {
+    name_vec.push_back(StripTrailingSpaces(GetPrefixUntilComma(src)));
+  }
+  return name_vec;
+}
+
 // Verifies that registered_tests match the test names in
-// defined_test_names_; returns registered_tests if successful, or
+// registered_tests_; returns registered_tests if successful, or
 // aborts the program otherwise.
 const char* TypedTestCasePState::VerifyRegisteredTestNames(
     const char* file, int line, const char* registered_tests) {
-  typedef ::std::set<const char*>::const_iterator DefinedTestIter;
+  typedef RegisteredTestsMap::const_iterator RegisteredTestIter;
   registered_ = true;
 
-  // Skip initial whitespace in registered_tests since some
-  // preprocessors prefix stringizied literals with whitespace.
-  registered_tests = SkipSpaces(registered_tests);
+  std::vector<std::string> name_vec = SplitIntoTestNames(registered_tests);
 
   Message errors;
-  ::std::set<String> tests;
-  for (const char* names = registered_tests; names != NULL;
-       names = SkipComma(names)) {
-    const String name = GetPrefixUntilComma(names);
+
+  std::set<std::string> tests;
+  for (std::vector<std::string>::const_iterator name_it = name_vec.begin();
+       name_it != name_vec.end(); ++name_it) {
+    const std::string& name = *name_it;
     if (tests.count(name) != 0) {
       errors << "Test " << name << " is listed more than once.\n";
       continue;
     }
 
     bool found = false;
-    for (DefinedTestIter it = defined_test_names_.begin();
-         it != defined_test_names_.end();
+    for (RegisteredTestIter it = registered_tests_.begin();
+         it != registered_tests_.end();
          ++it) {
-      if (name == *it) {
+      if (name == it->first) {
         found = true;
         break;
       }
@@ -85,15 +93,15 @@ const char* TypedTestCasePState::VerifyRegisteredTestNames(
     }
   }
 
-  for (DefinedTestIter it = defined_test_names_.begin();
-       it != defined_test_names_.end();
+  for (RegisteredTestIter it = registered_tests_.begin();
+       it != registered_tests_.end();
        ++it) {
-    if (tests.count(*it) == 0) {
-      errors << "You forgot to list test " << *it << ".\n";
+    if (tests.count(it->first) == 0) {
+      errors << "You forgot to list test " << it->first << ".\n";
     }
   }
 
-  const String& errors_str = errors.GetString();
+  const std::string& errors_str = errors.GetString();
   if (errors_str != "") {
     fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
             errors_str.c_str());
index 904d9d7..d882ab2 100755 (executable)
@@ -32,6 +32,7 @@
 // The Google C++ Testing Framework (Google Test)
 
 #include "gtest/gtest.h"
+#include "gtest/internal/custom/gtest.h"
 #include "gtest/gtest-spi.h"
 
 #include <ctype.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <time.h>
 #include <wchar.h>
 #include <wctype.h>
 
 #include <algorithm>
+#include <iomanip>
+#include <limits>
+#include <list>
+#include <map>
 #include <ostream>  // NOLINT
 #include <sstream>
 #include <vector>
@@ -77,6 +83,7 @@
 #elif GTEST_OS_WINDOWS_MOBILE  // We are on Windows CE.
 
 # include <windows.h>  // NOLINT
+# undef min
 
 #elif GTEST_OS_WINDOWS  // We are on Windows proper.
 
 // cpplint thinks that the header is already included, so we want to
 // silence it.
 # include <windows.h>  // NOLINT
+# undef min
 
 #else
 
 #if GTEST_CAN_STREAM_RESULTS_
 # include <arpa/inet.h>  // NOLINT
 # include <netdb.h>  // NOLINT
+# include <sys/socket.h>  // NOLINT
+# include <sys/types.h>  // NOLINT
 #endif
 
 // Indicates that this translation unit is part of Google Test's
@@ -179,6 +189,16 @@ bool g_help_flag = false;
 
 }  // namespace internal
 
+static const char* GetDefaultFilter() {
+#ifdef GTEST_TEST_FILTER_ENV_VAR_
+  const char* const testbridge_test_only = getenv(GTEST_TEST_FILTER_ENV_VAR_);
+  if (testbridge_test_only != NULL) {
+    return testbridge_test_only;
+  }
+#endif  // GTEST_TEST_FILTER_ENV_VAR_
+  return kUniversalFilter;
+}
+
 GTEST_DEFINE_bool_(
     also_run_disabled_tests,
     internal::BoolFromGTestEnv("also_run_disabled_tests", false),
@@ -201,11 +221,11 @@ GTEST_DEFINE_string_(
     "Whether to use colors in the output.  Valid values: yes, no, "
     "and auto.  'auto' means to use colors if the output is "
     "being sent to a terminal and the TERM environment variable "
-    "is set to xterm, xterm-color, xterm-256color, linux or cygwin.");
+    "is set to a terminal type that supports colors.");
 
 GTEST_DEFINE_string_(
     filter,
-    internal::StringFromGTestEnv("filter", kUniversalFilter),
+    internal::StringFromGTestEnv("filter", GetDefaultFilter()),
     "A colon-separated list of glob (not regex) patterns "
     "for filtering the tests to run, optionally followed by a "
     "'-' and a : separated list of negative patterns (tests to "
@@ -276,6 +296,13 @@ GTEST_DEFINE_bool_(
     "if exceptions are enabled or exit the program with a non-zero code "
     "otherwise.");
 
+#if GTEST_USE_OWN_FLAGFILE_FLAG_
+GTEST_DEFINE_string_(
+    flagfile,
+    internal::StringFromGTestEnv("flagfile", ""),
+    "This flag specifies the flagfile to read command-line flags from.");
+#endif  // GTEST_USE_OWN_FLAGFILE_FLAG_
+
 namespace internal {
 
 // Generates a random number from [0, range), using a Linear
@@ -300,13 +327,7 @@ UInt32 Random::Generate(UInt32 range) {
 // GTestIsInitialized() returns true iff the user has initialized
 // Google Test.  Useful for catching the user mistake of not initializing
 // Google Test before calling RUN_ALL_TESTS().
-//
-// A user must call testing::InitGoogleTest() to initialize Google
-// Test.  g_init_gtest_count is set to the number of times
-// InitGoogleTest() has been called.  We don't protect this variable
-// under a mutex as it is only accessed in the main thread.
-int g_init_gtest_count = 0;
-static bool GTestIsInitialized() { return g_init_gtest_count != 0; }
+static bool GTestIsInitialized() { return GetArgvs().size() > 0; }
 
 // Iterates over a vector of TestCases, keeping a running sum of the
 // results of calling a given int-returning method on each.
@@ -360,10 +381,18 @@ void AssertHelper::operator=(const Message& message) const {
 }
 
 // Mutex for linked pointers.
-GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);
+GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);
+
+// A copy of all command line arguments.  Set by InitGoogleTest().
+::std::vector<testing::internal::string> g_argvs;
 
-// Application pathname gotten in InitGoogleTest.
-String g_executable_path;
+const ::std::vector<testing::internal::string>& GetArgvs() {
+#if defined(GTEST_CUSTOM_GET_ARGVS_)
+  return GTEST_CUSTOM_GET_ARGVS_();
+#else  // defined(GTEST_CUSTOM_GET_ARGVS_)
+  return g_argvs;
+#endif  // defined(GTEST_CUSTOM_GET_ARGVS_)
+}
 
 // Returns the current application's name, removing directory path if that
 // is present.
@@ -371,9 +400,9 @@ FilePath GetCurrentExecutableName() {
   FilePath result;
 
 #if GTEST_OS_WINDOWS
-  result.Set(FilePath(g_executable_path).RemoveExtension("exe"));
+  result.Set(FilePath(GetArgvs()[0]).RemoveExtension("exe"));
 #else
-  result.Set(FilePath(g_executable_path));
+  result.Set(FilePath(GetArgvs()[0]));
 #endif  // GTEST_OS_WINDOWS
 
   return result.RemoveDirectoryName();
@@ -382,29 +411,29 @@ FilePath GetCurrentExecutableName() {
 // Functions for processing the gtest_output flag.
 
 // Returns the output format, or "" for normal printed output.
-String UnitTestOptions::GetOutputFormat() {
+std::string UnitTestOptions::GetOutputFormat() {
   const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
-  if (gtest_output_flag == NULL) return String("");
+  if (gtest_output_flag == NULL) return std::string("");
 
   const char* const colon = strchr(gtest_output_flag, ':');
   return (colon == NULL) ?
-      String(gtest_output_flag) :
-      String(gtest_output_flag, colon - gtest_output_flag);
+      std::string(gtest_output_flag) :
+      std::string(gtest_output_flag, colon - gtest_output_flag);
 }
 
 // Returns the name of the requested output file, or the default if none
 // was explicitly specified.
-String UnitTestOptions::GetAbsolutePathToOutputFile() {
+std::string UnitTestOptions::GetAbsolutePathToOutputFile() {
   const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
   if (gtest_output_flag == NULL)
-    return String("");
+    return "";
 
   const char* const colon = strchr(gtest_output_flag, ':');
   if (colon == NULL)
-    return String(internal::FilePath::ConcatPaths(
-               internal::FilePath(
-                   UnitTest::GetInstance()->original_working_dir()),
-               internal::FilePath(kDefaultOutputFile)).ToString() );
+    return internal::FilePath::ConcatPaths(
+        internal::FilePath(
+            UnitTest::GetInstance()->original_working_dir()),
+        internal::FilePath(kDefaultOutputFile)).string();
 
   internal::FilePath output_name(colon + 1);
   if (!output_name.IsAbsolutePath())
@@ -417,12 +446,12 @@ String UnitTestOptions::GetAbsolutePathToOutputFile() {
         internal::FilePath(colon + 1));
 
   if (!output_name.IsDirectory())
-    return output_name.ToString();
+    return output_name.string();
 
   internal::FilePath result(internal::FilePath::GenerateUniqueFileName(
       output_name, internal::GetCurrentExecutableName(),
       GetOutputFormat().c_str()));
-  return result.ToString();
+  return result.string();
 }
 
 // Returns true iff the wildcard pattern matches the string.  The
@@ -447,7 +476,8 @@ bool UnitTestOptions::PatternMatchesString(const char *pattern,
   }
 }
 
-bool UnitTestOptions::MatchesFilter(const String& name, const char* filter) {
+bool UnitTestOptions::MatchesFilter(
+    const std::string& name, const char* filter) {
   const char *cur_pattern = filter;
   for (;;) {
     if (PatternMatchesString(cur_pattern, name.c_str())) {
@@ -467,28 +497,24 @@ bool UnitTestOptions::MatchesFilter(const String& name, const char* filter) {
   }
 }
 
-// TODO(keithray): move String function implementations to gtest-string.cc.
-
 // Returns true iff the user-specified filter matches the test case
 // name and the test name.
-bool UnitTestOptions::FilterMatchesTest(const String &test_case_name,
-                                        const String &test_name) {
-  const String& full_name = String::Format("%s.%s",
-                                           test_case_name.c_str(),
-                                           test_name.c_str());
+bool UnitTestOptions::FilterMatchesTest(const std::string &test_case_name,
+                                        const std::string &test_name) {
+  const std::string& full_name = test_case_name + "." + test_name.c_str();
 
   // Split --gtest_filter at '-', if there is one, to separate into
   // positive filter and negative filter portions
   const char* const p = GTEST_FLAG(filter).c_str();
   const char* const dash = strchr(p, '-');
-  String positive;
-  String negative;
+  std::string positive;
+  std::string negative;
   if (dash == NULL) {
     positive = GTEST_FLAG(filter).c_str();  // Whole string is a positive filter
-    negative = String("");
+    negative = "";
   } else {
-    positive = String(p, dash - p);  // Everything up to the dash
-    negative = String(dash+1);       // Everything after the dash
+    positive = std::string(p, dash);   // Everything up to the dash
+    negative = std::string(dash + 1);  // Everything after the dash
     if (positive.empty()) {
       // Treat '-test1' as the same as '*-test1'
       positive = kUniversalFilter;
@@ -608,7 +634,7 @@ AssertionResult HasOneFailure(const char* /* results_expr */,
                               const TestPartResultArray& results,
                               TestPartResult::Type type,
                               const string& substr) {
-  const String expected(type == TestPartResult::kFatalFailure ?
+  const std::string expected(type == TestPartResult::kFatalFailure ?
                         "1 fatal failure" :
                         "1 non-fatal failure");
   Message msg;
@@ -731,11 +757,22 @@ int UnitTestImpl::failed_test_count() const {
   return SumOverTestCaseList(test_cases_, &TestCase::failed_test_count);
 }
 
+// Gets the number of disabled tests that will be reported in the XML report.
+int UnitTestImpl::reportable_disabled_test_count() const {
+  return SumOverTestCaseList(test_cases_,
+                             &TestCase::reportable_disabled_test_count);
+}
+
 // Gets the number of disabled tests.
 int UnitTestImpl::disabled_test_count() const {
   return SumOverTestCaseList(test_cases_, &TestCase::disabled_test_count);
 }
 
+// Gets the number of tests to be printed in the XML report.
+int UnitTestImpl::reportable_test_count() const {
+  return SumOverTestCaseList(test_cases_, &TestCase::reportable_test_count);
+}
+
 // Gets the number of all tests.
 int UnitTestImpl::total_test_count() const {
   return SumOverTestCaseList(test_cases_, &TestCase::total_test_count);
@@ -746,7 +783,7 @@ int UnitTestImpl::test_to_run_count() const {
   return SumOverTestCaseList(test_cases_, &TestCase::test_to_run_count);
 }
 
-// Returns the current OS stack trace as a String.
+// Returns the current OS stack trace as an std::string.
 //
 // The maximum number of stack frames to be included is specified by
 // the gtest_stack_trace_depth flag.  The skip_count parameter
@@ -756,9 +793,13 @@ int UnitTestImpl::test_to_run_count() const {
 // For example, if Foo() calls Bar(), which in turn calls
 // CurrentOsStackTraceExceptTop(1), Foo() will be included in the
 // trace but Bar() and CurrentOsStackTraceExceptTop() won't.
-String UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) {
-  (void)skip_count;
-  return String("");
+std::string UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) {
+  return os_stack_trace_getter()->CurrentStackTrace(
+      static_cast<int>(GTEST_FLAG(stack_trace_depth)),
+      skip_count + 1
+      // Skips the user-specified number of frames plus this function
+      // itself.
+      );  // NOLINT
 }
 
 // Returns the current time in milliseconds.
@@ -787,21 +828,13 @@ TimeInMillis GetTimeInMillis() {
 #elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_
   __timeb64 now;
 
-# ifdef _MSC_VER
-
   // MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996
   // (deprecated function) there.
   // TODO(kenton@google.com): Use GetTickCount()?  Or use
   //   SystemTimeToFileTime()
-#  pragma warning(push)          // Saves the current warning state.
-#  pragma warning(disable:4996)  // Temporarily disables warning 4996.
-  _ftime64(&now);
-#  pragma warning(pop)           // Restores the warning state.
-# else
-
+  GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
   _ftime64(&now);
-
-# endif  // _MSC_VER
+  GTEST_DISABLE_MSC_WARNINGS_POP_()
 
   return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm;
 #elif GTEST_HAS_GETTIMEOFDAY_
@@ -815,41 +848,7 @@ TimeInMillis GetTimeInMillis() {
 
 // Utilities
 
-// class String
-
-// Returns the input enclosed in double quotes if it's not NULL;
-// otherwise returns "(null)".  For example, "\"Hello\"" is returned
-// for input "Hello".
-//
-// This is useful for printing a C string in the syntax of a literal.
-//
-// Known issue: escape sequences are not handled yet.
-String String::ShowCStringQuoted(const char* c_str) {
-  return c_str ? String::Format("\"%s\"", c_str) : String("(null)");
-}
-
-// Copies at most length characters from str into a newly-allocated
-// piece of memory of size length+1.  The memory is allocated with new[].
-// A terminating null byte is written to the memory, and a pointer to it
-// is returned.  If str is NULL, NULL is returned.
-static char* CloneString(const char* str, size_t length) {
-  if (str == NULL) {
-    return NULL;
-  } else {
-    char* const clone = new char[length + 1];
-    posix::StrNCpy(clone, str, length);
-    clone[length] = '\0';
-    return clone;
-  }
-}
-
-// Clones a 0-terminated C string, allocating memory using new.  The
-// caller is responsible for deleting[] the return value.  Returns the
-// cloned string, or NULL if the input is NULL.
-const char * String::CloneCString(const char* c_str) {
-  return (c_str == NULL) ?
-                    NULL : CloneString(c_str, strlen(c_str));
-}
+// class String.
 
 #if GTEST_OS_WINDOWS_MOBILE
 // Creates a UTF-16 wide string from the given ANSI string, allocating
@@ -906,11 +905,6 @@ bool String::CStringEquals(const char * lhs, const char * rhs) {
 // encoding, and streams the result to the given Message object.
 static void StreamWideCharsToMessage(const wchar_t* wstr, size_t length,
                                      Message* msg) {
-  // TODO(wan): consider allowing a testing::String object to
-  // contain '\0'.  This will make it behave more like std::string,
-  // and will allow ToUtf8String() to return the correct encoding
-  // for '\0' s.t. we can get rid of the conditional here (and in
-  // several other places).
   for (size_t i = 0; i != length; ) {  // NOLINT
     if (wstr[i] != L'\0') {
       *msg << WideStringToUtf8(wstr + i, static_cast<int>(length - i));
@@ -925,8 +919,45 @@ static void StreamWideCharsToMessage(const wchar_t* wstr, size_t length,
 
 #endif  // GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
 
+void SplitString(const ::std::string& str, char delimiter,
+                 ::std::vector< ::std::string>* dest) {
+  ::std::vector< ::std::string> parsed;
+  ::std::string::size_type pos = 0;
+  while (::testing::internal::AlwaysTrue()) {
+    const ::std::string::size_type colon = str.find(delimiter, pos);
+    if (colon == ::std::string::npos) {
+      parsed.push_back(str.substr(pos));
+      break;
+    } else {
+      parsed.push_back(str.substr(pos, colon - pos));
+      pos = colon + 1;
+    }
+  }
+  dest->swap(parsed);
+}
+
 }  // namespace internal
 
+// Constructs an empty Message.
+// We allocate the stringstream separately because otherwise each use of
+// ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's
+// stack frame leading to huge stack frames in some cases; gcc does not reuse
+// the stack space.
+Message::Message() : ss_(new ::std::stringstream) {
+  // By default, we want there to be enough precision when printing
+  // a double to a Message.
+  *ss_ << std::setprecision(std::numeric_limits<double>::digits10 + 2);
+}
+
+// These two overloads allow streaming a wide C string to a Message
+// using the UTF-8 encoding.
+Message& Message::operator <<(const wchar_t* wide_c_str) {
+  return *this << internal::String::ShowWideCString(wide_c_str);
+}
+Message& Message::operator <<(wchar_t* wide_c_str) {
+  return *this << internal::String::ShowWideCString(wide_c_str);
+}
+
 #if GTEST_HAS_STD_WSTRING
 // Converts the given wide string to a narrow string using the UTF-8
 // encoding, and streams the result to this Message object.
@@ -945,6 +976,12 @@ Message& Message::operator <<(const ::wstring& wstr) {
 }
 #endif  // GTEST_HAS_GLOBAL_WSTRING
 
+// Gets the text streamed to this object so far as an std::string.
+// Each '\0' character in the buffer is replaced with "\\0".
+std::string Message::GetString() const {
+  return internal::StringStreamToString(ss_.get());
+}
+
 // AssertionResult constructors.
 // Used in EXPECT_TRUE/FALSE(assertion_result).
 AssertionResult::AssertionResult(const AssertionResult& other)
@@ -954,6 +991,13 @@ AssertionResult::AssertionResult(const AssertionResult& other)
                static_cast< ::std::string*>(NULL)) {
 }
 
+// Swaps two AssertionResults.
+void AssertionResult::swap(AssertionResult& other) {
+  using std::swap;
+  swap(success_, other.success_);
+  swap(message_, other.message_);
+}
+
 // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
 AssertionResult AssertionResult::operator!() const {
   AssertionResult negation(!success_);
@@ -980,6 +1024,276 @@ AssertionResult AssertionFailure(const Message& message) {
 
 namespace internal {
 
+namespace edit_distance {
+std::vector<EditType> CalculateOptimalEdits(const std::vector<size_t>& left,
+                                            const std::vector<size_t>& right) {
+  std::vector<std::vector<double> > costs(
+      left.size() + 1, std::vector<double>(right.size() + 1));
+  std::vector<std::vector<EditType> > best_move(
+      left.size() + 1, std::vector<EditType>(right.size() + 1));
+
+  // Populate for empty right.
+  for (size_t l_i = 0; l_i < costs.size(); ++l_i) {
+    costs[l_i][0] = static_cast<double>(l_i);
+    best_move[l_i][0] = kRemove;
+  }
+  // Populate for empty left.
+  for (size_t r_i = 1; r_i < costs[0].size(); ++r_i) {
+    costs[0][r_i] = static_cast<double>(r_i);
+    best_move[0][r_i] = kAdd;
+  }
+
+  for (size_t l_i = 0; l_i < left.size(); ++l_i) {
+    for (size_t r_i = 0; r_i < right.size(); ++r_i) {
+      if (left[l_i] == right[r_i]) {
+        // Found a match. Consume it.
+        costs[l_i + 1][r_i + 1] = costs[l_i][r_i];
+        best_move[l_i + 1][r_i + 1] = kMatch;
+        continue;
+      }
+
+      const double add = costs[l_i + 1][r_i];
+      const double remove = costs[l_i][r_i + 1];
+      const double replace = costs[l_i][r_i];
+      if (add < remove && add < replace) {
+        costs[l_i + 1][r_i + 1] = add + 1;
+        best_move[l_i + 1][r_i + 1] = kAdd;
+      } else if (remove < add && remove < replace) {
+        costs[l_i + 1][r_i + 1] = remove + 1;
+        best_move[l_i + 1][r_i + 1] = kRemove;
+      } else {
+        // We make replace a little more expensive than add/remove to lower
+        // their priority.
+        costs[l_i + 1][r_i + 1] = replace + 1.00001;
+        best_move[l_i + 1][r_i + 1] = kReplace;
+      }
+    }
+  }
+
+  // Reconstruct the best path. We do it in reverse order.
+  std::vector<EditType> best_path;
+  for (size_t l_i = left.size(), r_i = right.size(); l_i > 0 || r_i > 0;) {
+    EditType move = best_move[l_i][r_i];
+    best_path.push_back(move);
+    l_i -= move != kAdd;
+    r_i -= move != kRemove;
+  }
+  std::reverse(best_path.begin(), best_path.end());
+  return best_path;
+}
+
+namespace {
+
+// Helper class to convert string into ids with deduplication.
+class InternalStrings {
+ public:
+  size_t GetId(const std::string& str) {
+    IdMap::iterator it = ids_.find(str);
+    if (it != ids_.end()) return it->second;
+    size_t id = ids_.size();
+    return ids_[str] = id;
+  }
+
+ private:
+  typedef std::map<std::string, size_t> IdMap;
+  IdMap ids_;
+};
+
+}  // namespace
+
+std::vector<EditType> CalculateOptimalEdits(
+    const std::vector<std::string>& left,
+    const std::vector<std::string>& right) {
+  std::vector<size_t> left_ids, right_ids;
+  {
+    InternalStrings intern_table;
+    for (size_t i = 0; i < left.size(); ++i) {
+      left_ids.push_back(intern_table.GetId(left[i]));
+    }
+    for (size_t i = 0; i < right.size(); ++i) {
+      right_ids.push_back(intern_table.GetId(right[i]));
+    }
+  }
+  return CalculateOptimalEdits(left_ids, right_ids);
+}
+
+namespace {
+
+// Helper class that holds the state for one hunk and prints it out to the
+// stream.
+// It reorders adds/removes when possible to group all removes before all
+// adds. It also adds the hunk header before printint into the stream.
+class Hunk {
+ public:
+  Hunk(size_t left_start, size_t right_start)
+      : left_start_(left_start),
+        right_start_(right_start),
+        adds_(),
+        removes_(),
+        common_() {}
+
+  void PushLine(char edit, const char* line) {
+    switch (edit) {
+      case ' ':
+        ++common_;
+        FlushEdits();
+        hunk_.push_back(std::make_pair(' ', line));
+        break;
+      case '-':
+        ++removes_;
+        hunk_removes_.push_back(std::make_pair('-', line));
+        break;
+      case '+':
+        ++adds_;
+        hunk_adds_.push_back(std::make_pair('+', line));
+        break;
+    }
+  }
+
+  void PrintTo(std::ostream* os) {
+    PrintHeader(os);
+    FlushEdits();
+    for (std::list<std::pair<char, const char*> >::const_iterator it =
+             hunk_.begin();
+         it != hunk_.end(); ++it) {
+      *os << it->first << it->second << "\n";
+    }
+  }
+
+  bool has_edits() const { return adds_ || removes_; }
+
+ private:
+  void FlushEdits() {
+    hunk_.splice(hunk_.end(), hunk_removes_);
+    hunk_.splice(hunk_.end(), hunk_adds_);
+  }
+
+  // Print a unified diff header for one hunk.
+  // The format is
+  //   "@@ -<left_start>,<left_length> +<right_start>,<right_length> @@"
+  // where the left/right parts are ommitted if unnecessary.
+  void PrintHeader(std::ostream* ss) const {
+    *ss << "@@ ";
+    if (removes_) {
+      *ss << "-" << left_start_ << "," << (removes_ + common_);
+    }
+    if (removes_ && adds_) {
+      *ss << " ";
+    }
+    if (adds_) {
+      *ss << "+" << right_start_ << "," << (adds_ + common_);
+    }
+    *ss << " @@\n";
+  }
+
+  size_t left_start_, right_start_;
+  size_t adds_, removes_, common_;
+  std::list<std::pair<char, const char*> > hunk_, hunk_adds_, hunk_removes_;
+};
+
+}  // namespace
+
+// Create a list of diff hunks in Unified diff format.
+// Each hunk has a header generated by PrintHeader above plus a body with
+// lines prefixed with ' ' for no change, '-' for deletion and '+' for
+// addition.
+// 'context' represents the desired unchanged prefix/suffix around the diff.
+// If two hunks are close enough that their contexts overlap, then they are
+// joined into one hunk.
+std::string CreateUnifiedDiff(const std::vector<std::string>& left,
+                              const std::vector<std::string>& right,
+                              size_t context) {
+  const std::vector<EditType> edits = CalculateOptimalEdits(left, right);
+
+  size_t l_i = 0, r_i = 0, edit_i = 0;
+  std::stringstream ss;
+  while (edit_i < edits.size()) {
+    // Find first edit.
+    while (edit_i < edits.size() && edits[edit_i] == kMatch) {
+      ++l_i;
+      ++r_i;
+      ++edit_i;
+    }
+
+    // Find the first line to include in the hunk.
+    const size_t prefix_context = std::min(l_i, context);
+    Hunk hunk(l_i - prefix_context + 1, r_i - prefix_context + 1);
+    for (size_t i = prefix_context; i > 0; --i) {
+      hunk.PushLine(' ', left[l_i - i].c_str());
+    }
+
+    // Iterate the edits until we found enough suffix for the hunk or the input
+    // is over.
+    size_t n_suffix = 0;
+    for (; edit_i < edits.size(); ++edit_i) {
+      if (n_suffix >= context) {
+        // Continue only if the next hunk is very close.
+        std::vector<EditType>::const_iterator it = edits.begin() + edit_i;
+        while (it != edits.end() && *it == kMatch) ++it;
+        if (it == edits.end() || (it - edits.begin()) - edit_i >= context) {
+          // There is no next edit or it is too far away.
+          break;
+        }
+      }
+
+      EditType edit = edits[edit_i];
+      // Reset count when a non match is found.
+      n_suffix = edit == kMatch ? n_suffix + 1 : 0;
+
+      if (edit == kMatch || edit == kRemove || edit == kReplace) {
+        hunk.PushLine(edit == kMatch ? ' ' : '-', left[l_i].c_str());
+      }
+      if (edit == kAdd || edit == kReplace) {
+        hunk.PushLine('+', right[r_i].c_str());
+      }
+
+      // Advance indices, depending on edit type.
+      l_i += edit != kAdd;
+      r_i += edit != kRemove;
+    }
+
+    if (!hunk.has_edits()) {
+      // We are done. We don't want this hunk.
+      break;
+    }
+
+    hunk.PrintTo(&ss);
+  }
+  return ss.str();
+}
+
+}  // namespace edit_distance
+
+namespace {
+
+// The string representation of the values received in EqFailure() are already
+// escaped. Split them on escaped '\n' boundaries. Leave all other escaped
+// characters the same.
+std::vector<std::string> SplitEscapedString(const std::string& str) {
+  std::vector<std::string> lines;
+  size_t start = 0, end = str.size();
+  if (end > 2 && str[0] == '"' && str[end - 1] == '"') {
+    ++start;
+    --end;
+  }
+  bool escaped = false;
+  for (size_t i = start; i + 1 < end; ++i) {
+    if (escaped) {
+      escaped = false;
+      if (str[i] == 'n') {
+        lines.push_back(str.substr(start, i - start - 1));
+        start = i + 1;
+      }
+    } else {
+      escaped = str[i] == '\\';
+    }
+  }
+  lines.push_back(str.substr(start, end - start));
+  return lines;
+}
+
+}  // namespace
+
 // Constructs and returns the message for an equality assertion
 // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
 //
@@ -987,41 +1301,53 @@ namespace internal {
 // and their values, as strings.  For example, for ASSERT_EQ(foo, bar)
 // where foo is 5 and bar is 6, we have:
 //
-//   expected_expression: "foo"
-//   actual_expression:   "bar"
-//   expected_value:      "5"
-//   actual_value:        "6"
+//   lhs_expression: "foo"
+//   rhs_expression: "bar"
+//   lhs_value:      "5"
+//   rhs_value:      "6"
 //
 // The ignoring_case parameter is true iff the assertion is a
-// *_STRCASEEQ*.  When it's true, the string " (ignoring case)" will
+// *_STRCASEEQ*.  When it's true, the string "Ignoring case" will
 // be inserted into the message.
-AssertionResult EqFailure(const char* expected_expression,
-                          const char* actual_expression,
-                          const String& expected_value,
-                          const String& actual_value,
+AssertionResult EqFailure(const char* lhs_expression,
+                          const char* rhs_expression,
+                          const std::string& lhs_value,
+                          const std::string& rhs_value,
                           bool ignoring_case) {
   Message msg;
-  msg << "Value of: " << actual_expression;
-  if (actual_value != actual_expression) {
-    msg << "\n  Actual: " << actual_value;
+  msg << "      Expected: " << lhs_expression;
+  if (lhs_value != lhs_expression) {
+    msg << "\n      Which is: " << lhs_value;
+  }
+  msg << "\nTo be equal to: " << rhs_expression;
+  if (rhs_value != rhs_expression) {
+    msg << "\n      Which is: " << rhs_value;
   }
 
-  msg << "\nExpected: " << expected_expression;
   if (ignoring_case) {
-    msg << " (ignoring case)";
+    msg << "\nIgnoring case";
   }
-  if (expected_value != expected_expression) {
-    msg << "\nWhich is: " << expected_value;
+
+  if (!lhs_value.empty() && !rhs_value.empty()) {
+    const std::vector<std::string> lhs_lines =
+        SplitEscapedString(lhs_value);
+    const std::vector<std::string> rhs_lines =
+        SplitEscapedString(rhs_value);
+    if (lhs_lines.size() > 1 || rhs_lines.size() > 1) {
+      msg << "\nWith diff:\n"
+          << edit_distance::CreateUnifiedDiff(lhs_lines, rhs_lines);
+    }
   }
 
   return AssertionFailure() << msg;
 }
 
 // Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
-String GetBoolAssertionFailureMessage(const AssertionResult& assertion_result,
-                                      const char* expression_text,
-                                      const char* actual_predicate_value,
-                                      const char* expected_predicate_value) {
+std::string GetBoolAssertionFailureMessage(
+    const AssertionResult& assertion_result,
+    const char* expression_text,
+    const char* actual_predicate_value,
+    const char* expected_predicate_value) {
   const char* actual_message = assertion_result.message();
   Message msg;
   msg << "Value of: " << expression_text
@@ -1108,18 +1434,18 @@ namespace internal {
 
 // The helper function for {ASSERT|EXPECT}_EQ with int or enum
 // arguments.
-AssertionResult CmpHelperEQ(const char* expected_expression,
-                            const char* actual_expression,
-                            BiggestInt expected,
-                            BiggestInt actual) {
-  if (expected == actual) {
+AssertionResult CmpHelperEQ(const char* lhs_expression,
+                            const char* rhs_expression,
+                            BiggestInt lhs,
+                            BiggestInt rhs) {
+  if (lhs == rhs) {
     return AssertionSuccess();
   }
 
-  return EqFailure(expected_expression,
-                   actual_expression,
-                   FormatForComparisonFailureMessage(expected, actual),
-                   FormatForComparisonFailureMessage(actual, expected),
+  return EqFailure(lhs_expression,
+                   rhs_expression,
+                   FormatForComparisonFailureMessage(lhs, rhs),
+                   FormatForComparisonFailureMessage(rhs, lhs),
                    false);
 }
 
@@ -1158,34 +1484,34 @@ GTEST_IMPL_CMP_HELPER_(GT, > )
 #undef GTEST_IMPL_CMP_HELPER_
 
 // The helper function for {ASSERT|EXPECT}_STREQ.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
-                               const char* actual_expression,
-                               const char* expected,
-                               const char* actual) {
-  if (String::CStringEquals(expected, actual)) {
+AssertionResult CmpHelperSTREQ(const char* lhs_expression,
+                               const char* rhs_expression,
+                               const char* lhs,
+                               const char* rhs) {
+  if (String::CStringEquals(lhs, rhs)) {
     return AssertionSuccess();
   }
 
-  return EqFailure(expected_expression,
-                   actual_expression,
-                   String::ShowCStringQuoted(expected),
-                   String::ShowCStringQuoted(actual),
+  return EqFailure(lhs_expression,
+                   rhs_expression,
+                   PrintToString(lhs),
+                   PrintToString(rhs),
                    false);
 }
 
 // The helper function for {ASSERT|EXPECT}_STRCASEEQ.
-AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
-                                   const char* actual_expression,
-                                   const char* expected,
-                                   const char* actual) {
-  if (String::CaseInsensitiveCStringEquals(expected, actual)) {
+AssertionResult CmpHelperSTRCASEEQ(const char* lhs_expression,
+                                   const char* rhs_expression,
+                                   const char* lhs,
+                                   const char* rhs) {
+  if (String::CaseInsensitiveCStringEquals(lhs, rhs)) {
     return AssertionSuccess();
   }
 
-  return EqFailure(expected_expression,
-                   actual_expression,
-                   String::ShowCStringQuoted(expected),
-                   String::ShowCStringQuoted(actual),
+  return EqFailure(lhs_expression,
+                   rhs_expression,
+                   PrintToString(lhs),
+                   PrintToString(rhs),
                    true);
 }
 
@@ -1349,7 +1675,7 @@ AssertionResult HRESULTFailureHelper(const char* expr,
   // want inserts expanded.
   const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM |
                        FORMAT_MESSAGE_IGNORE_INSERTS;
-  const DWORD kBufSize = 4096;  // String::Format can't exceed this length.
+  const DWORD kBufSize = 4096;
   // Gets the system's human readable message string for this HRESULT.
   char error_text[kBufSize] = { '\0' };
   DWORD message_length = ::FormatMessageA(kFlags,
@@ -1359,7 +1685,7 @@ AssertionResult HRESULTFailureHelper(const char* expr,
                                           error_text,  // output buffer
                                           kBufSize,  // buf size
                                           NULL);  // no arguments for inserts
-  // Trims tailing white space (FormatMessage leaves a trailing cr-lf)
+  // Trims tailing white space (FormatMessage leaves a trailing CR-LF)
   for (; message_length && IsSpace(error_text[message_length - 1]);
           --message_length) {
     error_text[message_length - 1] = '\0';
@@ -1367,10 +1693,10 @@ AssertionResult HRESULTFailureHelper(const char* expr,
 
 # endif  // GTEST_OS_WINDOWS_MOBILE
 
-  const String error_hex(String::Format("0x%08X ", hr));
+  const std::string error_hex("0x" + String::FormatHexInt(hr));
   return ::testing::AssertionFailure()
       << "Expected: " << expr << " " << expected << ".\n"
-      << "  Actual: " << error_hex << error_text << "\n";
+      << "  Actual: " << error_hex << " " << error_text << "\n";
 }
 
 }  // namespace
@@ -1427,12 +1753,15 @@ inline UInt32 ChopLowBits(UInt32* bits, int n) {
 // Converts a Unicode code point to a narrow string in UTF-8 encoding.
 // code_point parameter is of type UInt32 because wchar_t may not be
 // wide enough to contain a code point.
-// The output buffer str must containt at least 32 characters.
-// The function returns the address of the output buffer.
 // If the code_point is not a valid Unicode code point
-// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be output
-// as '(Invalid Unicode 0xXXXXXXXX)'.
-char* CodePointToUtf8(UInt32 code_point, char* str) {
+// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted
+// to "(Invalid Unicode 0xXXXXXXXX)".
+std::string CodePointToUtf8(UInt32 code_point) {
+  if (code_point > kMaxCodePoint4) {
+    return "(Invalid Unicode 0x" + String::FormatHexInt(code_point) + ")";
+  }
+
+  char str[5];  // Big enough for the largest valid code point.
   if (code_point <= kMaxCodePoint1) {
     str[1] = '\0';
     str[0] = static_cast<char>(code_point);                          // 0xxxxxxx
@@ -1445,22 +1774,12 @@ char* CodePointToUtf8(UInt32 code_point, char* str) {
     str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
     str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
     str[0] = static_cast<char>(0xE0 | code_point);                   // 1110xxxx
-  } else if (code_point <= kMaxCodePoint4) {
+  } else {  // code_point <= kMaxCodePoint4
     str[4] = '\0';
     str[3] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
     str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
     str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
     str[0] = static_cast<char>(0xF0 | code_point);                   // 11110xxx
-  } else {
-    // The longest string String::Format can produce when invoked
-    // with these parameters is 28 character long (not including
-    // the terminating nul character). We are asking for 32 character
-    // buffer just in case. This is also enough for strncpy to
-    // null-terminate the destination string.
-    posix::StrNCpy(
-        str, String::Format("(Invalid Unicode 0x%X)", code_point).c_str(), 32);
-    str[31] = '\0';  // Makes sure no change in the format to strncpy leaves
-                     // the result unterminated.
   }
   return str;
 }
@@ -1501,7 +1820,7 @@ inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
 // as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
 // and contains invalid UTF-16 surrogate pairs, values in those pairs
 // will be encoded as individual Unicode characters from Basic Normal Plane.
-String WideStringToUtf8(const wchar_t* str, int num_chars) {
+std::string WideStringToUtf8(const wchar_t* str, int num_chars) {
   if (num_chars == -1)
     num_chars = static_cast<int>(wcslen(str));
 
@@ -1519,27 +1838,17 @@ String WideStringToUtf8(const wchar_t* str, int num_chars) {
       unicode_code_point = static_cast<UInt32>(str[i]);
     }
 
-    char buffer[32];  // CodePointToUtf8 requires a buffer this big.
-    stream << CodePointToUtf8(unicode_code_point, buffer);
+    stream << CodePointToUtf8(unicode_code_point);
   }
   return StringStreamToString(&stream);
 }
 
-// Converts a wide C string to a String using the UTF-8 encoding.
+// Converts a wide C string to an std::string using the UTF-8 encoding.
 // NULL will be converted to "(null)".
-String String::ShowWideCString(const wchar_t * wide_c_str) {
-  if (wide_c_str == NULL) return String("(null)");
-
-  return String(internal::WideStringToUtf8(wide_c_str, -1).c_str());
-}
-
-// Similar to ShowWideCString(), except that this function encloses
-// the converted string in double quotes.
-String String::ShowWideCStringQuoted(const wchar_t* wide_c_str) {
-  if (wide_c_str == NULL) return String("(null)");
+std::string String::ShowWideCString(const wchar_t * wide_c_str) {
+  if (wide_c_str == NULL)  return "(null)";
 
-  return String::Format("L\"%s\"",
-                        String::ShowWideCString(wide_c_str).c_str());
+  return internal::WideStringToUtf8(wide_c_str, -1);
 }
 
 // Compares two wide C strings.  Returns true iff they have the same
@@ -1557,18 +1866,18 @@ bool String::WideCStringEquals(const wchar_t * lhs, const wchar_t * rhs) {
 }
 
 // Helper function for *_STREQ on wide strings.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
-                               const char* actual_expression,
-                               const wchar_t* expected,
-                               const wchar_t* actual) {
-  if (String::WideCStringEquals(expected, actual)) {
+AssertionResult CmpHelperSTREQ(const char* lhs_expression,
+                               const char* rhs_expression,
+                               const wchar_t* lhs,
+                               const wchar_t* rhs) {
+  if (String::WideCStringEquals(lhs, rhs)) {
     return AssertionSuccess();
   }
 
-  return EqFailure(expected_expression,
-                   actual_expression,
-                   String::ShowWideCStringQuoted(expected),
-                   String::ShowWideCStringQuoted(actual),
+  return EqFailure(lhs_expression,
+                   rhs_expression,
+                   PrintToString(lhs),
+                   PrintToString(rhs),
                    false);
 }
 
@@ -1583,8 +1892,8 @@ AssertionResult CmpHelperSTRNE(const char* s1_expression,
 
   return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
                             << s2_expression << "), actual: "
-                            << String::ShowWideCStringQuoted(s1)
-                            << " vs " << String::ShowWideCStringQuoted(s2);
+                            << PrintToString(s1)
+                            << " vs " << PrintToString(s2);
 }
 
 // Compares two C strings, ignoring case.  Returns true iff they have
@@ -1635,135 +1944,69 @@ bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
 #endif  // OS selector
 }
 
-// Compares this with another String.
-// Returns < 0 if this is less than rhs, 0 if this is equal to rhs, or > 0
-// if this is greater than rhs.
-int String::Compare(const String & rhs) const {
-  const char* const lhs_c_str = c_str();
-  const char* const rhs_c_str = rhs.c_str();
-
-  if (lhs_c_str == NULL) {
-    return rhs_c_str == NULL ? 0 : -1;  // NULL < anything except NULL
-  } else if (rhs_c_str == NULL) {
-    return 1;
-  }
-
-  const size_t shorter_str_len =
-      length() <= rhs.length() ? length() : rhs.length();
-  for (size_t i = 0; i != shorter_str_len; i++) {
-    if (lhs_c_str[i] < rhs_c_str[i]) {
-      return -1;
-    } else if (lhs_c_str[i] > rhs_c_str[i]) {
-      return 1;
-    }
-  }
-  return (length() < rhs.length()) ? -1 :
-      (length() > rhs.length()) ? 1 : 0;
+// Returns true iff str ends with the given suffix, ignoring case.
+// Any string is considered to end with an empty suffix.
+bool String::EndsWithCaseInsensitive(
+    const std::string& str, const std::string& suffix) {
+  const size_t str_len = str.length();
+  const size_t suffix_len = suffix.length();
+  return (str_len >= suffix_len) &&
+         CaseInsensitiveCStringEquals(str.c_str() + str_len - suffix_len,
+                                      suffix.c_str());
 }
 
-// Returns true iff this String ends with the given suffix.  *Any*
-// String is considered to end with a NULL or empty suffix.
-bool String::EndsWith(const char* suffix) const {
-  if (suffix == NULL || CStringEquals(suffix, "")) return true;
-
-  if (c_str() == NULL) return false;
-
-  const size_t this_len = strlen(c_str());
-  const size_t suffix_len = strlen(suffix);
-  return (this_len >= suffix_len) &&
-         CStringEquals(c_str() + this_len - suffix_len, suffix);
+// Formats an int value as "%02d".
+std::string String::FormatIntWidth2(int value) {
+  std::stringstream ss;
+  ss << std::setfill('0') << std::setw(2) << value;
+  return ss.str();
 }
 
-// Returns true iff this String ends with the given suffix, ignoring case.
-// Any String is considered to end with a NULL or empty suffix.
-bool String::EndsWithCaseInsensitive(const char* suffix) const {
-  if (suffix == NULL || CStringEquals(suffix, "")) return true;
-
-  if (c_str() == NULL) return false;
-
-  const size_t this_len = strlen(c_str());
-  const size_t suffix_len = strlen(suffix);
-  return (this_len >= suffix_len) &&
-         CaseInsensitiveCStringEquals(c_str() + this_len - suffix_len, suffix);
+// Formats an int value as "%X".
+std::string String::FormatHexInt(int value) {
+  std::stringstream ss;
+  ss << std::hex << std::uppercase << value;
+  return ss.str();
 }
 
-// Formats a list of arguments to a String, using the same format
-// spec string as for printf.
-//
-// We do not use the StringPrintf class as it is not universally
-// available.
-//
-// The result is limited to 4096 characters (including the tailing 0).
-// If 4096 characters are not enough to format the input, or if
-// there's an error, "<formatting error or buffer exceeded>" is
-// returned.
-String String::Format(const char * format, ...) {
-  va_list args;
-  va_start(args, format);
-
-  char buffer[4096];
-  const int kBufferSize = sizeof(buffer)/sizeof(buffer[0]);
-
-  // MSVC 8 deprecates vsnprintf(), so we want to suppress warning
-  // 4996 (deprecated function) there.
-#ifdef _MSC_VER  // We are using MSVC.
-# pragma warning(push)          // Saves the current warning state.
-# pragma warning(disable:4996)  // Temporarily disables warning 4996.
-
-  const int size = vsnprintf(buffer, kBufferSize, format, args);
-
-# pragma warning(pop)           // Restores the warning state.
-#else  // We are not using MSVC.
-  const int size = vsnprintf(buffer, kBufferSize, format, args);
-#endif  // _MSC_VER
-  va_end(args);
-
-  // vsnprintf()'s behavior is not portable.  When the buffer is not
-  // big enough, it returns a negative value in MSVC, and returns the
-  // needed buffer size on Linux.  When there is an output error, it
-  // always returns a negative value.  For simplicity, we lump the two
-  // error cases together.
-  if (size < 0 || size >= kBufferSize) {
-    return String("<formatting error or buffer exceeded>");
-  } else {
-    return String(buffer, size);
-  }
+// Formats a byte as "%02X".
+std::string String::FormatByte(unsigned char value) {
+  std::stringstream ss;
+  ss << std::setfill('0') << std::setw(2) << std::hex << std::uppercase
+     << static_cast<unsigned int>(value);
+  return ss.str();
 }
 
-// Converts the buffer in a stringstream to a String, converting NUL
+// Converts the buffer in a stringstream to an std::string, converting NUL
 // bytes to "\\0" along the way.
-String StringStreamToString(::std::stringstream* ss) {
+std::string StringStreamToString(::std::stringstream* ss) {
   const ::std::string& str = ss->str();
   const char* const start = str.c_str();
   const char* const end = start + str.length();
 
-  // We need to use a helper stringstream to do this transformation
-  // because String doesn't support push_back().
-  ::std::stringstream helper;
+  std::string result;
+  result.reserve(2 * (end - start));
   for (const char* ch = start; ch != end; ++ch) {
     if (*ch == '\0') {
-      helper << "\\0";  // Replaces NUL with "\\0";
+      result += "\\0";  // Replaces NUL with "\\0";
     } else {
-      helper.put(*ch);
+      result += *ch;
     }
   }
 
-  return String(helper.str().c_str());
+  return result;
 }
 
 // Appends the user-supplied message to the Google-Test-generated message.
-String AppendUserMessage(const String& gtest_msg,
-                         const Message& user_msg) {
+std::string AppendUserMessage(const std::string& gtest_msg,
+                              const Message& user_msg) {
   // Appends the user message if it's non-empty.
-  const String user_msg_string = user_msg.GetString();
+  const std::string user_msg_string = user_msg.GetString();
   if (user_msg_string.empty()) {
     return gtest_msg;
   }
 
-  Message msg;
-  msg << gtest_msg << "\n" << user_msg_string;
-
-  return msg.GetString();
+  return gtest_msg + "\n" + user_msg_string;
 }
 
 }  // namespace internal
@@ -1811,8 +2054,9 @@ void TestResult::AddTestPartResult(const TestPartResult& test_part_result) {
 // Adds a test property to the list. If a property with the same key as the
 // supplied property is already represented, the value of this test_property
 // replaces the old value for that key.
-void TestResult::RecordProperty(const TestProperty& test_property) {
-  if (!ValidateTestProperty(test_property)) {
+void TestResult::RecordProperty(const std::string& xml_element,
+                                const TestProperty& test_property) {
+  if (!ValidateTestProperty(xml_element, test_property)) {
     return;
   }
   internal::MutexLock lock(&test_properites_mutex_);
@@ -1826,21 +2070,94 @@ void TestResult::RecordProperty(const TestProperty& test_property) {
   property_with_matching_key->SetValue(test_property.value());
 }
 
-// Adds a failure if the key is a reserved attribute of Google Test
-// testcase tags.  Returns true if the property is valid.
-bool TestResult::ValidateTestProperty(const TestProperty& test_property) {
-  internal::String key(test_property.key());
-  if (key == "name" || key == "status" || key == "time" || key == "classname") {
-    ADD_FAILURE()
-        << "Reserved key used in RecordProperty(): "
-        << key
-        << " ('name', 'status', 'time', and 'classname' are reserved by "
-        << GTEST_NAME_ << ")";
+// The list of reserved attributes used in the <testsuites> element of XML
+// output.
+static const char* const kReservedTestSuitesAttributes[] = {
+  "disabled",
+  "errors",
+  "failures",
+  "name",
+  "random_seed",
+  "tests",
+  "time",
+  "timestamp"
+};
+
+// The list of reserved attributes used in the <testsuite> element of XML
+// output.
+static const char* const kReservedTestSuiteAttributes[] = {
+  "disabled",
+  "errors",
+  "failures",
+  "name",
+  "tests",
+  "time"
+};
+
+// The list of reserved attributes used in the <testcase> element of XML output.
+static const char* const kReservedTestCaseAttributes[] = {
+  "classname",
+  "name",
+  "status",
+  "time",
+  "type_param",
+  "value_param"
+};
+
+template <int kSize>
+std::vector<std::string> ArrayAsVector(const char* const (&array)[kSize]) {
+  return std::vector<std::string>(array, array + kSize);
+}
+
+static std::vector<std::string> GetReservedAttributesForElement(
+    const std::string& xml_element) {
+  if (xml_element == "testsuites") {
+    return ArrayAsVector(kReservedTestSuitesAttributes);
+  } else if (xml_element == "testsuite") {
+    return ArrayAsVector(kReservedTestSuiteAttributes);
+  } else if (xml_element == "testcase") {
+    return ArrayAsVector(kReservedTestCaseAttributes);
+  } else {
+    GTEST_CHECK_(false) << "Unrecognized xml_element provided: " << xml_element;
+  }
+  // This code is unreachable but some compilers may not realizes that.
+  return std::vector<std::string>();
+}
+
+static std::string FormatWordList(const std::vector<std::string>& words) {
+  Message word_list;
+  for (size_t i = 0; i < words.size(); ++i) {
+    if (i > 0 && words.size() > 2) {
+      word_list << ", ";
+    }
+    if (i == words.size() - 1) {
+      word_list << "and ";
+    }
+    word_list << "'" << words[i] << "'";
+  }
+  return word_list.GetString();
+}
+
+bool ValidateTestPropertyName(const std::string& property_name,
+                              const std::vector<std::string>& reserved_names) {
+  if (std::find(reserved_names.begin(), reserved_names.end(), property_name) !=
+          reserved_names.end()) {
+    ADD_FAILURE() << "Reserved key used in RecordProperty(): " << property_name
+                  << " (" << FormatWordList(reserved_names)
+                  << " are reserved by " << GTEST_NAME_ << ")";
     return false;
   }
   return true;
 }
 
+// Adds a failure if the key is a reserved attribute of the element named
+// xml_element.  Returns true if the property is valid.
+bool TestResult::ValidateTestProperty(const std::string& xml_element,
+                                      const TestProperty& test_property) {
+  return ValidateTestPropertyName(test_property.key(),
+                                  GetReservedAttributesForElement(xml_element));
+}
+
 // Clears the object.
 void TestResult::Clear() {
   test_part_results_.clear();
@@ -1893,14 +2210,15 @@ int TestResult::test_property_count() const {
 
 // Creates a Test object.
 
-// The c'tor saves the values of all Google Test flags.
+// The c'tor saves the states of all flags.
 Test::Test()
-    : gtest_flag_saver_(new internal::GTestFlagSaver) {
+    : gtest_flag_saver_(new GTEST_FLAG_SAVER_) {
 }
 
-// The d'tor restores the values of all Google Test flags.
+// The d'tor restores the states of all flags.  The actual work is
+// done by the d'tor of the gtest_flag_saver_ field, and thus not
+// visible here.
 Test::~Test() {
-  delete gtest_flag_saver_;
 }
 
 // Sets up the test fixture.
@@ -1916,12 +2234,12 @@ void Test::TearDown() {
 }
 
 // Allows user supplied key value pairs to be recorded for later output.
-void Test::RecordProperty(const char* key, const char* value) {
-  UnitTest::GetInstance()->RecordPropertyForCurrentTest(key, value);
+void Test::RecordProperty(const std::string& key, const std::string& value) {
+  UnitTest::GetInstance()->RecordProperty(key, value);
 }
 
 // Allows user supplied key value pairs to be recorded for later output.
-void Test::RecordProperty(const char* key, int value) {
+void Test::RecordProperty(const std::string& key, int value) {
   Message value_message;
   value_message << value;
   RecordProperty(key, value_message.GetString().c_str());
@@ -1930,7 +2248,7 @@ void Test::RecordProperty(const char* key, int value) {
 namespace internal {
 
 void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
-                                    const String& message) {
+                                    const std::string& message) {
   // This function is a friend of UnitTest and as such has access to
   // AddTestPartResult.
   UnitTest::GetInstance()->AddTestPartResult(
@@ -1938,7 +2256,7 @@ void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
       NULL,  // No info about the source file where the exception occurred.
       -1,    // We have no info on which line caused the exception.
       message,
-      String());  // No stack trace, either.
+      "");   // No stack trace, either.
 }
 
 }  // namespace internal
@@ -1969,8 +2287,8 @@ bool Test::HasSameFixtureClass() {
     const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId();
 
     if (first_is_TEST || this_is_TEST) {
-      // The user mixed TEST and TEST_F in this test case - we'll tell
-      // him/her how to fix it.
+      // Both TEST and TEST_F appear in same test case, which is incorrect.
+      // Tell the user how to fix this.
 
       // Gets the name of the TEST and the name of the TEST_F.  Note
       // that first_is_TEST and this_is_TEST cannot both be true, as
@@ -1990,8 +2308,8 @@ bool Test::HasSameFixtureClass() {
           << "want to change the TEST to TEST_F or move it to another test\n"
           << "case.";
     } else {
-      // The user defined two fixture classes with the same name in
-      // two namespaces - we'll tell him/her how to fix it.
+      // Two fixture classes with the same name appear in two different
+      // namespaces, which is not allowed. Tell the user how to fix this.
       ADD_FAILURE()
           << "All tests in the same test case must use the same test fixture\n"
           << "class.  However, in test case "
@@ -2015,22 +2333,24 @@ bool Test::HasSameFixtureClass() {
 // function returns its result via an output parameter pointer because VC++
 // prohibits creation of objects with destructors on stack in functions
 // using __try (see error C2712).
-static internal::String* FormatSehExceptionMessage(DWORD exception_code,
-                                                   const char* location) {
+static std::string* FormatSehExceptionMessage(DWORD exception_code,
+                                              const char* location) {
   Message message;
   message << "SEH exception with code 0x" << std::setbase(16) <<
     exception_code << std::setbase(10) << " thrown in " << location << ".";
 
-  return new internal::String(message.GetString());
+  return new std::string(message.GetString());
 }
 
 #endif  // GTEST_HAS_SEH
 
+namespace internal {
+
 #if GTEST_HAS_EXCEPTIONS
 
 // Adds an "exception thrown" fatal failure to the current test.
-static internal::String FormatCxxExceptionMessage(const char* description,
-                                                  const char* location) {
+static std::string FormatCxxExceptionMessage(const char* description,
+                                             const char* location) {
   Message message;
   if (description != NULL) {
     message << "C++ exception with description \"" << description << "\"";
@@ -2042,23 +2362,15 @@ static internal::String FormatCxxExceptionMessage(const char* description,
   return message.GetString();
 }
 
-static internal::String PrintTestPartResultToString(
+static std::string PrintTestPartResultToString(
     const TestPartResult& test_part_result);
 
-// A failed Google Test assertion will throw an exception of this type when
-// GTEST_FLAG(throw_on_failure) is true (if exceptions are enabled).  We
-// derive it from std::runtime_error, which is for errors presumably
-// detectable only at run time.  Since std::runtime_error inherits from
-// std::exception, many testing frameworks know how to extract and print the
-// message inside it.
-class GoogleTestFailureException : public ::std::runtime_error {
- public:
-  explicit GoogleTestFailureException(const TestPartResult& failure)
-      : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {}
-};
+GoogleTestFailureException::GoogleTestFailureException(
+    const TestPartResult& failure)
+    : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {}
+
 #endif  // GTEST_HAS_EXCEPTIONS
 
-namespace internal {
 // We put these helper functions in the internal namespace as IBM's xlC
 // compiler rejects the code if they were declared static.
 
@@ -2078,7 +2390,7 @@ Result HandleSehExceptionsInMethodIfSupported(
     // We create the exception message on the heap because VC++ prohibits
     // creation of objects with destructors on stack in functions using __try
     // (see error C2712).
-    internal::String* exception_message = FormatSehExceptionMessage(
+    std::string* exception_message = FormatSehExceptionMessage(
         GetExceptionCode(), location);
     internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,
                                              *exception_message);
@@ -2124,9 +2436,10 @@ Result HandleExceptionsInMethodIfSupported(
 #if GTEST_HAS_EXCEPTIONS
     try {
       return HandleSehExceptionsInMethodIfSupported(object, method, location);
-    } catch (const GoogleTestFailureException&) {  // NOLINT
-      // This exception doesn't originate in code under test. It makes no
-      // sense to report it as a test failure.
+    } catch (const internal::GoogleTestFailureException&) {  // NOLINT
+      // This exception type can only be thrown by a failed Google
+      // Test assertion with the intention of letting another testing
+      // framework catch it.  Therefore we just re-throw it.
       throw;
     } catch (const std::exception& e) {  // NOLINT
       internal::ReportFailureInUnknownLocation(
@@ -2185,18 +2498,18 @@ bool Test::HasNonfatalFailure() {
 
 // Constructs a TestInfo object. It assumes ownership of the test factory
 // object.
-// TODO(vladl@google.com): Make a_test_case_name and a_name const string&'s
-// to signify they cannot be NULLs.
-TestInfo::TestInfo(const char* a_test_case_name,
-                   const char* a_name,
+TestInfo::TestInfo(const std::string& a_test_case_name,
+                   const std::string& a_name,
                    const char* a_type_param,
                    const char* a_value_param,
+                   internal::CodeLocation a_code_location,
                    internal::TypeId fixture_class_id,
                    internal::TestFactoryBase* factory)
     : test_case_name_(a_test_case_name),
       name_(a_name),
       type_param_(a_type_param ? new std::string(a_type_param) : NULL),
       value_param_(a_value_param ? new std::string(a_value_param) : NULL),
+      location_(a_code_location),
       fixture_class_id_(fixture_class_id),
       should_run_(false),
       is_disabled_(false),
@@ -2220,6 +2533,7 @@ namespace internal {
 //                     this is not a typed or a type-parameterized test.
 //   value_param:      text representation of the test's value parameter,
 //                     or NULL if this is not a value-parameterized test.
+//   code_location:    code location where the test is defined
 //   fixture_class_id: ID of the test fixture class
 //   set_up_tc:        pointer to the function that sets up the test case
 //   tear_down_tc:     pointer to the function that tears down the test case
@@ -2227,23 +2541,25 @@ namespace internal {
 //                     The newly created TestInfo instance will assume
 //                     ownership of the factory object.
 TestInfo* MakeAndRegisterTestInfo(
-    const char* test_case_name, const char* name,
+    const char* test_case_name,
+    const char* name,
     const char* type_param,
     const char* value_param,
+    CodeLocation code_location,
     TypeId fixture_class_id,
     SetUpTestCaseFunc set_up_tc,
     TearDownTestCaseFunc tear_down_tc,
     TestFactoryBase* factory) {
   TestInfo* const test_info =
       new TestInfo(test_case_name, name, type_param, value_param,
-                   fixture_class_id, factory);
+                   code_location, fixture_class_id, factory);
   GetUnitTestImpl()->AddTestInfo(set_up_tc, tear_down_tc, test_info);
   return test_info;
 }
 
 #if GTEST_HAS_PARAM_TEST
 void ReportInvalidTestCaseType(const char* test_case_name,
-                               const char* file, int line) {
+                               CodeLocation code_location) {
   Message errors;
   errors
       << "Attempted redefinition of test case " << test_case_name << ".\n"
@@ -2255,7 +2571,9 @@ void ReportInvalidTestCaseType(const char* test_case_name,
       << "probably rename one of the classes to put the tests into different\n"
       << "test cases.";
 
-  fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
+  fprintf(stderr, "%s %s",
+          FormatFileLocation(code_location.file.c_str(),
+                             code_location.line).c_str(),
           errors.GetString().c_str());
 }
 #endif  // GTEST_HAS_PARAM_TEST
@@ -2282,11 +2600,11 @@ class TestNameIs {
 
   // Returns true iff the test name of test_info matches name_.
   bool operator()(const TestInfo * test_info) const {
-    return test_info && internal::String(test_info->name()).Compare(name_) == 0;
+    return test_info && test_info->name() == name_;
   }
 
  private:
-  internal::String name_;
+  std::string name_;
 };
 
 }  // namespace
@@ -2365,10 +2683,21 @@ int TestCase::failed_test_count() const {
   return CountIf(test_info_list_, TestFailed);
 }
 
+// Gets the number of disabled tests that will be reported in the XML report.
+int TestCase::reportable_disabled_test_count() const {
+  return CountIf(test_info_list_, TestReportableDisabled);
+}
+
+// Gets the number of disabled tests in this test case.
 int TestCase::disabled_test_count() const {
   return CountIf(test_info_list_, TestDisabled);
 }
 
+// Gets the number of tests to be printed in the XML report.
+int TestCase::reportable_test_count() const {
+  return CountIf(test_info_list_, TestReportable);
+}
+
 // Get the number of tests in this test case that should run.
 int TestCase::test_to_run_count() const {
   return CountIf(test_info_list_, ShouldRunTest);
@@ -2456,6 +2785,7 @@ void TestCase::Run() {
 
 // Clears the results of all tests in this test case.
 void TestCase::ClearResult() {
+  ad_hoc_test_result_.Clear();
   ForEach(test_info_list_, TestInfo::ClearTestResult);
 }
 
@@ -2476,20 +2806,20 @@ void TestCase::UnshuffleTests() {
 //
 // FormatCountableNoun(1, "formula", "formuli") returns "1 formula".
 // FormatCountableNoun(5, "book", "books") returns "5 books".
-static internal::String FormatCountableNoun(int count,
-                                            const char * singular_form,
-                                            const char * plural_form) {
-  return internal::String::Format("%d %s", count,
-                                  count == 1 ? singular_form : plural_form);
+static std::string FormatCountableNoun(int count,
+                                       const char * singular_form,
+                                       const char * plural_form) {
+  return internal::StreamableToString(count) + " " +
+      (count == 1 ? singular_form : plural_form);
 }
 
 // Formats the count of tests.
-static internal::String FormatTestCount(int test_count) {
+static std::string FormatTestCount(int test_count) {
   return FormatCountableNoun(test_count, "test", "tests");
 }
 
 // Formats the count of test cases.
-static internal::String FormatTestCaseCount(int test_case_count) {
+static std::string FormatTestCaseCount(int test_case_count) {
   return FormatCountableNoun(test_case_count, "test case", "test cases");
 }
 
@@ -2514,8 +2844,10 @@ static const char * TestPartResultTypeToString(TestPartResult::Type type) {
   }
 }
 
-// Prints a TestPartResult to a String.
-static internal::String PrintTestPartResultToString(
+namespace internal {
+
+// Prints a TestPartResult to an std::string.
+static std::string PrintTestPartResultToString(
     const TestPartResult& test_part_result) {
   return (Message()
           << internal::FormatFileLocation(test_part_result.file_name(),
@@ -2526,7 +2858,7 @@ static internal::String PrintTestPartResultToString(
 
 // Prints a TestPartResult.
 static void PrintTestPartResult(const TestPartResult& test_part_result) {
-  const internal::String& result =
+  const std::string& result =
       PrintTestPartResultToString(test_part_result);
   printf("%s\n", result.c_str());
   fflush(stdout);
@@ -2545,8 +2877,6 @@ static void PrintTestPartResult(const TestPartResult& test_part_result) {
 
 // class PrettyUnitTestResultPrinter
 
-namespace internal {
-
 enum GTestColor {
   COLOR_DEFAULT,
   COLOR_RED,
@@ -2554,7 +2884,8 @@ enum GTestColor {
   COLOR_YELLOW
 };
 
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
+#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \
+    !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
 
 // Returns the character attribute for the given color.
 WORD GetColorAttribute(GTestColor color) {
@@ -2598,6 +2929,11 @@ bool ShouldUseColor(bool stdout_is_tty) {
         String::CStringEquals(term, "xterm-color") ||
         String::CStringEquals(term, "xterm-256color") ||
         String::CStringEquals(term, "screen") ||
+        String::CStringEquals(term, "screen-256color") ||
+        String::CStringEquals(term, "tmux") ||
+        String::CStringEquals(term, "tmux-256color") ||
+        String::CStringEquals(term, "rxvt-unicode") ||
+        String::CStringEquals(term, "rxvt-unicode-256color") ||
         String::CStringEquals(term, "linux") ||
         String::CStringEquals(term, "cygwin");
     return stdout_is_tty && term_supports_color;
@@ -2621,8 +2957,9 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
   va_list args;
   va_start(args, fmt);
 
-#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS
-  const bool use_color = false;
+#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS || \
+    GTEST_OS_IOS || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
+  const bool use_color = AlwaysFalse();
 #else
   static const bool in_color_mode =
       ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);
@@ -2636,7 +2973,8 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
     return;
   }
 
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
+#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \
+    !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
   const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
 
   // Gets the current text color.
@@ -2663,6 +3001,11 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
   va_end(args);
 }
 
+// Text printed in Google Test's text output and --gunit_list_tests
+// output to label the type parameter and value parameter for a test.
+static const char kTypeParamLabel[] = "TypeParam";
+static const char kValueParamLabel[] = "GetParam()";
+
 void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
   const char* const type_param = test_info.type_param();
   const char* const value_param = test_info.value_param();
@@ -2670,12 +3013,12 @@ void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
   if (type_param != NULL || value_param != NULL) {
     printf(", where ");
     if (type_param != NULL) {
-      printf("TypeParam = %s", type_param);
+      printf("%s = %s", kTypeParamLabel, type_param);
       if (value_param != NULL)
         printf(" and ");
     }
     if (value_param != NULL) {
-      printf("GetParam() = %s", value_param);
+      printf("%s = %s", kValueParamLabel, value_param);
     }
   }
 }
@@ -2707,8 +3050,6 @@ class PrettyUnitTestResultPrinter : public TestEventListener {
 
  private:
   static void PrintFailedTests(const UnitTest& unit_test);
-
-  internal::String test_case_name_;
 };
 
   // Fired before each iteration of tests starts.
@@ -2721,7 +3062,7 @@ void PrettyUnitTestResultPrinter::OnTestIterationStart(
 
   // Prints the filter if it's not *.  This reminds the user that some
   // tests may be skipped.
-  if (!internal::String::CStringEquals(filter, kUniversalFilter)) {
+  if (!String::CStringEquals(filter, kUniversalFilter)) {
     ColoredPrintf(COLOR_YELLOW,
                   "Note: %s filter = %s\n", GTEST_NAME_, filter);
   }
@@ -2755,22 +3096,21 @@ void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(
 }
 
 void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
-  test_case_name_ = test_case.name();
-  const internal::String counts =
+  const std::string counts =
       FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
   ColoredPrintf(COLOR_GREEN, "[----------] ");
-  printf("%s from %s", counts.c_str(), test_case_name_.c_str());
+  printf("%s from %s", counts.c_str(), test_case.name());
   if (test_case.type_param() == NULL) {
     printf("\n");
   } else {
-    printf(", where TypeParam = %s\n", test_case.type_param());
+    printf(", where %s = %s\n", kTypeParamLabel, test_case.type_param());
   }
   fflush(stdout);
 }
 
 void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) {
   ColoredPrintf(COLOR_GREEN,  "[ RUN      ] ");
-  PrintTestName(test_case_name_.c_str(), test_info.name());
+  PrintTestName(test_info.test_case_name(), test_info.name());
   printf("\n");
   fflush(stdout);
 }
@@ -2793,7 +3133,7 @@ void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
   } else {
     ColoredPrintf(COLOR_RED, "[  FAILED  ] ");
   }
-  PrintTestName(test_case_name_.c_str(), test_info.name());
+  PrintTestName(test_info.test_case_name(), test_info.name());
   if (test_info.result()->Failed())
     PrintFullTestCommentIfPresent(test_info);
 
@@ -2809,12 +3149,11 @@ void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
 void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) {
   if (!GTEST_FLAG(print_time)) return;
 
-  test_case_name_ = test_case.name();
-  const internal::String counts =
+  const std::string counts =
       FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
   ColoredPrintf(COLOR_GREEN, "[----------] ");
   printf("%s from %s (%s ms total)\n\n",
-         counts.c_str(), test_case_name_.c_str(),
+         counts.c_str(), test_case.name(),
          internal::StreamableToString(test_case.elapsed_time()).c_str());
   fflush(stdout);
 }
@@ -2875,7 +3214,7 @@ void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
                         num_failures == 1 ? "TEST" : "TESTS");
   }
 
-  int num_disabled = unit_test.disabled_test_count();
+  int num_disabled = unit_test.reportable_disabled_test_count();
   if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) {
     if (!num_failures) {
       printf("\n");  // Add a spacer if no FAILURE banner is displayed.
@@ -3029,18 +3368,27 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener {
   // is_attribute is true, the text is meant to appear as an attribute
   // value, and normalizable whitespace is preserved by replacing it
   // with character references.
-  static String EscapeXml(const char* str, bool is_attribute);
+  static std::string EscapeXml(const std::string& str, bool is_attribute);
 
   // Returns the given string with all characters invalid in XML removed.
-  static string RemoveInvalidXmlCharacters(const string& str);
+  static std::string RemoveInvalidXmlCharacters(const std::string& str);
 
   // Convenience wrapper around EscapeXml when str is an attribute value.
-  static String EscapeXmlAttribute(const char* str) {
+  static std::string EscapeXmlAttribute(const std::string& str) {
     return EscapeXml(str, true);
   }
 
   // Convenience wrapper around EscapeXml when str is not an attribute value.
-  static String EscapeXmlText(const char* str) { return EscapeXml(str, false); }
+  static std::string EscapeXmlText(const char* str) {
+    return EscapeXml(str, false);
+  }
+
+  // Verifies that the given attribute belongs to the given element and
+  // streams the attribute as XML.
+  static void OutputXmlAttribute(std::ostream* stream,
+                                 const std::string& element_name,
+                                 const std::string& name,
+                                 const std::string& value);
 
   // Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
   static void OutputXmlCDataSection(::std::ostream* stream, const char* data);
@@ -3051,19 +3399,21 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener {
                                 const TestInfo& test_info);
 
   // Prints an XML representation of a TestCase object
-  static void PrintXmlTestCase(FILE* out, const TestCase& test_case);
+  static void PrintXmlTestCase(::std::ostream* stream,
+                               const TestCase& test_case);
 
   // Prints an XML summary of unit_test to output stream out.
-  static void PrintXmlUnitTest(FILE* out, const UnitTest& unit_test);
+  static void PrintXmlUnitTest(::std::ostream* stream,
+                               const UnitTest& unit_test);
 
   // Produces a string representing the test properties in a result as space
   // delimited XML attributes based on the property key="value" pairs.
-  // When the String is not empty, it includes a space at the beginning,
+  // When the std::string is not empty, it includes a space at the beginning,
   // to delimit this attribute from prior attributes.
-  static String TestPropertiesAsXmlAttributes(const TestResult& result);
+  static std::string TestPropertiesAsXmlAttributes(const TestResult& result);
 
   // The output file.
-  const String output_file_;
+  const std::string output_file_;
 
   GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter);
 };
@@ -3105,7 +3455,9 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
     fflush(stderr);
     exit(EXIT_FAILURE);
   }
-  PrintXmlUnitTest(xmlout, unit_test);
+  std::stringstream stream;
+  PrintXmlUnitTest(&stream, unit_test);
+  fprintf(xmlout, "%s", StringStreamToString(&stream).c_str());
   fclose(xmlout);
 }
 
@@ -3121,42 +3473,43 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
 // most invalid characters can be retained using character references.
 // TODO(wan): It might be nice to have a minimally invasive, human-readable
 // escaping scheme for invalid characters, rather than dropping them.
-String XmlUnitTestResultPrinter::EscapeXml(const char* str, bool is_attribute) {
+std::string XmlUnitTestResultPrinter::EscapeXml(
+    const std::string& str, bool is_attribute) {
   Message m;
 
-  if (str != NULL) {
-    for (const char* src = str; *src; ++src) {
-      switch (*src) {
-        case '<':
-          m << "&lt;";
-          break;
-        case '>':
-          m << "&gt;";
-          break;
-        case '&':
-          m << "&amp;";
-          break;
-        case '\'':
-          if (is_attribute)
-            m << "&apos;";
-          else
-            m << '\'';
-          break;
-        case '"':
-          if (is_attribute)
-            m << "&quot;";
+  for (size_t i = 0; i < str.size(); ++i) {
+    const char ch = str[i];
+    switch (ch) {
+      case '<':
+        m << "&lt;";
+        break;
+      case '>':
+        m << "&gt;";
+        break;
+      case '&':
+        m << "&amp;";
+        break;
+      case '\'':
+        if (is_attribute)
+          m << "&apos;";
+        else
+          m << '\'';
+        break;
+      case '"':
+        if (is_attribute)
+          m << "&quot;";
+        else
+          m << '"';
+        break;
+      default:
+        if (IsValidXmlCharacter(ch)) {
+          if (is_attribute && IsNormalizableWhitespace(ch))
+            m << "&#x" << String::FormatByte(static_cast<unsigned char>(ch))
+              << ";";
           else
-            m << '"';
-          break;
-        default:
-          if (IsValidXmlCharacter(*src)) {
-            if (is_attribute && IsNormalizableWhitespace(*src))
-              m << String::Format("&#x%02X;", unsigned(*src));
-            else
-              m << *src;
-          }
-          break;
-      }
+            m << ch;
+        }
+        break;
     }
   }
 
@@ -3166,10 +3519,11 @@ String XmlUnitTestResultPrinter::EscapeXml(const char* str, bool is_attribute) {
 // Returns the given string with all characters invalid in XML removed.
 // Currently invalid characters are dropped from the string. An
 // alternative is to replace them with certain characters such as . or ?.
-string XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(const string& str) {
-  string output;
+std::string XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(
+    const std::string& str) {
+  std::string output;
   output.reserve(str.size());
-  for (string::const_iterator it = str.begin(); it != str.end(); ++it)
+  for (std::string::const_iterator it = str.begin(); it != str.end(); ++it)
     if (IsValidXmlCharacter(*it))
       output.push_back(*it);
 
@@ -3195,10 +3549,41 @@ string XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(const string& str) {
 // Formats the given time in milliseconds as seconds.
 std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
   ::std::stringstream ss;
-  ss << ms/1000.0;
+  ss << (static_cast<double>(ms) * 1e-3);
   return ss.str();
 }
 
+static bool PortableLocaltime(time_t seconds, struct tm* out) {
+#if defined(_MSC_VER)
+  return localtime_s(out, &seconds) == 0;
+#elif defined(__MINGW32__) || defined(__MINGW64__)
+  // MINGW <time.h> provides neither localtime_r nor localtime_s, but uses
+  // Windows' localtime(), which has a thread-local tm buffer.
+  struct tm* tm_ptr = localtime(&seconds);  // NOLINT
+  if (tm_ptr == NULL)
+    return false;
+  *out = *tm_ptr;
+  return true;
+#else
+  return localtime_r(&seconds, out) != NULL;
+#endif
+}
+
+// Converts the given epoch time in milliseconds to a date string in the ISO
+// 8601 format, without the timezone information.
+std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {
+  struct tm time_struct;
+  if (!PortableLocaltime(static_cast<time_t>(ms / 1000), &time_struct))
+    return "";
+  // YYYY-MM-DDThh:mm:ss
+  return StreamableToString(time_struct.tm_year + 1900) + "-" +
+      String::FormatIntWidth2(time_struct.tm_mon + 1) + "-" +
+      String::FormatIntWidth2(time_struct.tm_mday) + "T" +
+      String::FormatIntWidth2(time_struct.tm_hour) + ":" +
+      String::FormatIntWidth2(time_struct.tm_min) + ":" +
+      String::FormatIntWidth2(time_struct.tm_sec);
+}
+
 // Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
 void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream,
                                                      const char* data) {
@@ -3219,45 +3604,63 @@ void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream,
   *stream << "]]>";
 }
 
+void XmlUnitTestResultPrinter::OutputXmlAttribute(
+    std::ostream* stream,
+    const std::string& element_name,
+    const std::string& name,
+    const std::string& value) {
+  const std::vector<std::string>& allowed_names =
+      GetReservedAttributesForElement(element_name);
+
+  GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) !=
+                   allowed_names.end())
+      << "Attribute " << name << " is not allowed for element <" << element_name
+      << ">.";
+
+  *stream << " " << name << "=\"" << EscapeXmlAttribute(value) << "\"";
+}
+
 // Prints an XML representation of a TestInfo object.
 // TODO(wan): There is also value in printing properties with the plain printer.
 void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
                                                  const char* test_case_name,
                                                  const TestInfo& test_info) {
   const TestResult& result = *test_info.result();
-  *stream << "    <testcase name=\""
-          << EscapeXmlAttribute(test_info.name()).c_str() << "\"";
+  const std::string kTestcase = "testcase";
+
+  *stream << "    <testcase";
+  OutputXmlAttribute(stream, kTestcase, "name", test_info.name());
 
   if (test_info.value_param() != NULL) {
-    *stream << " value_param=\"" << EscapeXmlAttribute(test_info.value_param())
-            << "\"";
+    OutputXmlAttribute(stream, kTestcase, "value_param",
+                       test_info.value_param());
   }
   if (test_info.type_param() != NULL) {
-    *stream << " type_param=\"" << EscapeXmlAttribute(test_info.type_param())
-            << "\"";
+    OutputXmlAttribute(stream, kTestcase, "type_param", test_info.type_param());
   }
 
-  *stream << " status=\""
-          << (test_info.should_run() ? "run" : "notrun")
-          << "\" time=\""
-          << FormatTimeInMillisAsSeconds(result.elapsed_time())
-          << "\" classname=\"" << EscapeXmlAttribute(test_case_name).c_str()
-          << "\"" << TestPropertiesAsXmlAttributes(result).c_str();
+  OutputXmlAttribute(stream, kTestcase, "status",
+                     test_info.should_run() ? "run" : "notrun");
+  OutputXmlAttribute(stream, kTestcase, "time",
+                     FormatTimeInMillisAsSeconds(result.elapsed_time()));
+  OutputXmlAttribute(stream, kTestcase, "classname", test_case_name);
+  *stream << TestPropertiesAsXmlAttributes(result);
 
   int failures = 0;
   for (int i = 0; i < result.total_part_count(); ++i) {
     const TestPartResult& part = result.GetTestPartResult(i);
     if (part.failed()) {
-      if (++failures == 1)
+      if (++failures == 1) {
         *stream << ">\n";
-      *stream << "      <failure message=\""
-              << EscapeXmlAttribute(part.summary()).c_str()
-              << "\" type=\"\">";
+      }
       const string location = internal::FormatCompilerIndependentFileLocation(
           part.file_name(), part.line_number());
-      const string message = location + "\n" + part.message();
-      OutputXmlCDataSection(stream,
-                            RemoveInvalidXmlCharacters(message).c_str());
+      const string summary = location + "\n" + part.summary();
+      *stream << "      <failure message=\""
+              << EscapeXmlAttribute(summary.c_str())
+              << "\" type=\"\">";
+      const string detail = location + "\n" + part.message();
+      OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
       *stream << "</failure>\n";
     }
   }
@@ -3269,49 +3672,73 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
 }
 
 // Prints an XML representation of a TestCase object
-void XmlUnitTestResultPrinter::PrintXmlTestCase(FILE* out,
+void XmlUnitTestResultPrinter::PrintXmlTestCase(std::ostream* stream,
                                                 const TestCase& test_case) {
-  fprintf(out,
-          "  <testsuite name=\"%s\" tests=\"%d\" failures=\"%d\" "
-          "disabled=\"%d\" ",
-          EscapeXmlAttribute(test_case.name()).c_str(),
-          test_case.total_test_count(),
-          test_case.failed_test_count(),
-          test_case.disabled_test_count());
-  fprintf(out,
-          "errors=\"0\" time=\"%s\">\n",
-          FormatTimeInMillisAsSeconds(test_case.elapsed_time()).c_str());
+  const std::string kTestsuite = "testsuite";
+  *stream << "  <" << kTestsuite;
+  OutputXmlAttribute(stream, kTestsuite, "name", test_case.name());
+  OutputXmlAttribute(stream, kTestsuite, "tests",
+                     StreamableToString(test_case.reportable_test_count()));
+  OutputXmlAttribute(stream, kTestsuite, "failures",
+                     StreamableToString(test_case.failed_test_count()));
+  OutputXmlAttribute(
+      stream, kTestsuite, "disabled",
+      StreamableToString(test_case.reportable_disabled_test_count()));
+  OutputXmlAttribute(stream, kTestsuite, "errors", "0");
+  OutputXmlAttribute(stream, kTestsuite, "time",
+                     FormatTimeInMillisAsSeconds(test_case.elapsed_time()));
+  *stream << TestPropertiesAsXmlAttributes(test_case.ad_hoc_test_result())
+          << ">\n";
+
   for (int i = 0; i < test_case.total_test_count(); ++i) {
-    ::std::stringstream stream;
-    OutputXmlTestInfo(&stream, test_case.name(), *test_case.GetTestInfo(i));
-    fprintf(out, "%s", StringStreamToString(&stream).c_str());
+    if (test_case.GetTestInfo(i)->is_reportable())
+      OutputXmlTestInfo(stream, test_case.name(), *test_case.GetTestInfo(i));
   }
-  fprintf(out, "  </testsuite>\n");
+  *stream << "  </" << kTestsuite << ">\n";
 }
 
 // Prints an XML summary of unit_test to output stream out.
-void XmlUnitTestResultPrinter::PrintXmlUnitTest(FILE* out,
+void XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream* stream,
                                                 const UnitTest& unit_test) {
-  fprintf(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
-  fprintf(out,
-          "<testsuites tests=\"%d\" failures=\"%d\" disabled=\"%d\" "
-          "errors=\"0\" time=\"%s\" ",
-          unit_test.total_test_count(),
-          unit_test.failed_test_count(),
-          unit_test.disabled_test_count(),
-          FormatTimeInMillisAsSeconds(unit_test.elapsed_time()).c_str());
+  const std::string kTestsuites = "testsuites";
+
+  *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+  *stream << "<" << kTestsuites;
+
+  OutputXmlAttribute(stream, kTestsuites, "tests",
+                     StreamableToString(unit_test.reportable_test_count()));
+  OutputXmlAttribute(stream, kTestsuites, "failures",
+                     StreamableToString(unit_test.failed_test_count()));
+  OutputXmlAttribute(
+      stream, kTestsuites, "disabled",
+      StreamableToString(unit_test.reportable_disabled_test_count()));
+  OutputXmlAttribute(stream, kTestsuites, "errors", "0");
+  OutputXmlAttribute(
+      stream, kTestsuites, "timestamp",
+      FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp()));
+  OutputXmlAttribute(stream, kTestsuites, "time",
+                     FormatTimeInMillisAsSeconds(unit_test.elapsed_time()));
+
   if (GTEST_FLAG(shuffle)) {
-    fprintf(out, "random_seed=\"%d\" ", unit_test.random_seed());
+    OutputXmlAttribute(stream, kTestsuites, "random_seed",
+                       StreamableToString(unit_test.random_seed()));
   }
-  fprintf(out, "name=\"AllTests\">\n");
-  for (int i = 0; i < unit_test.total_test_case_count(); ++i)
-    PrintXmlTestCase(out, *unit_test.GetTestCase(i));
-  fprintf(out, "</testsuites>\n");
+
+  *stream << TestPropertiesAsXmlAttributes(unit_test.ad_hoc_test_result());
+
+  OutputXmlAttribute(stream, kTestsuites, "name", "AllTests");
+  *stream << ">\n";
+
+  for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
+    if (unit_test.GetTestCase(i)->reportable_test_count() > 0)
+      PrintXmlTestCase(stream, *unit_test.GetTestCase(i));
+  }
+  *stream << "</" << kTestsuites << ">\n";
 }
 
 // Produces a string representing the test properties in a result as space
 // delimited XML attributes based on the property key="value" pairs.
-String XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
+std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
     const TestResult& result) {
   Message attributes;
   for (int i = 0; i < result.test_property_count(); ++i) {
@@ -3326,112 +3753,6 @@ String XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
 
 #if GTEST_CAN_STREAM_RESULTS_
 
-// Streams test results to the given port on the given host machine.
-class StreamingListener : public EmptyTestEventListener {
- public:
-  // Escapes '=', '&', '%', and '\n' characters in str as "%xx".
-  static string UrlEncode(const char* str);
-
-  StreamingListener(const string& host, const string& port)
-      : sockfd_(-1), host_name_(host), port_num_(port) {
-    MakeConnection();
-    Send("gtest_streaming_protocol_version=1.0\n");
-  }
-
-  virtual ~StreamingListener() {
-    if (sockfd_ != -1)
-      CloseConnection();
-  }
-
-  void OnTestProgramStart(const UnitTest& /* unit_test */) {
-    Send("event=TestProgramStart\n");
-  }
-
-  void OnTestProgramEnd(const UnitTest& unit_test) {
-    // Note that Google Test current only report elapsed time for each
-    // test iteration, not for the entire test program.
-    Send(String::Format("event=TestProgramEnd&passed=%d\n",
-                        unit_test.Passed()));
-
-    // Notify the streaming server to stop.
-    CloseConnection();
-  }
-
-  void OnTestIterationStart(const UnitTest& /* unit_test */, int iteration) {
-    Send(String::Format("event=TestIterationStart&iteration=%d\n",
-                        iteration));
-  }
-
-  void OnTestIterationEnd(const UnitTest& unit_test, int /* iteration */) {
-    Send(String::Format("event=TestIterationEnd&passed=%d&elapsed_time=%sms\n",
-                        unit_test.Passed(),
-                        StreamableToString(unit_test.elapsed_time()).c_str()));
-  }
-
-  void OnTestCaseStart(const TestCase& test_case) {
-    Send(String::Format("event=TestCaseStart&name=%s\n", test_case.name()));
-  }
-
-  void OnTestCaseEnd(const TestCase& test_case) {
-    Send(String::Format("event=TestCaseEnd&passed=%d&elapsed_time=%sms\n",
-                        test_case.Passed(),
-                        StreamableToString(test_case.elapsed_time()).c_str()));
-  }
-
-  void OnTestStart(const TestInfo& test_info) {
-    Send(String::Format("event=TestStart&name=%s\n", test_info.name()));
-  }
-
-  void OnTestEnd(const TestInfo& test_info) {
-    Send(String::Format(
-        "event=TestEnd&passed=%d&elapsed_time=%sms\n",
-        (test_info.result())->Passed(),
-        StreamableToString((test_info.result())->elapsed_time()).c_str()));
-  }
-
-  void OnTestPartResult(const TestPartResult& test_part_result) {
-    const char* file_name = test_part_result.file_name();
-    if (file_name == NULL)
-      file_name = "";
-    Send(String::Format("event=TestPartResult&file=%s&line=%d&message=",
-                        UrlEncode(file_name).c_str(),
-                        test_part_result.line_number()));
-    Send(UrlEncode(test_part_result.message()) + "\n");
-  }
-
- private:
-  // Creates a client socket and connects to the server.
-  void MakeConnection();
-
-  // Closes the socket.
-  void CloseConnection() {
-    GTEST_CHECK_(sockfd_ != -1)
-        << "CloseConnection() can be called only when there is a connection.";
-
-    close(sockfd_);
-    sockfd_ = -1;
-  }
-
-  // Sends a string to the socket.
-  void Send(const string& message) {
-    GTEST_CHECK_(sockfd_ != -1)
-        << "Send() can be called only when there is a connection.";
-
-    const int len = static_cast<int>(message.length());
-    if (write(sockfd_, message.c_str(), len) != len) {
-      GTEST_LOG_(WARNING)
-          << "stream_result_to: failed to stream to "
-          << host_name_ << ":" << port_num_;
-    }
-  }
-
-  int sockfd_;   // socket file descriptor
-  const string host_name_;
-  const string port_num_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener);
-};  // class StreamingListener
-
 // Checks if str contains '=', '&', '%' or '\n' characters. If yes,
 // replaces them by "%xx" where xx is their hexadecimal value. For
 // example, replaces "=" with "%3D".  This algorithm is O(strlen(str))
@@ -3446,7 +3767,7 @@ string StreamingListener::UrlEncode(const char* str) {
       case '=':
       case '&':
       case '\n':
-        result.append(String::Format("%%%02x", static_cast<unsigned char>(ch)));
+        result.append("%" + String::FormatByte(static_cast<unsigned char>(ch)));
         break;
       default:
         result.push_back(ch);
@@ -3456,7 +3777,7 @@ string StreamingListener::UrlEncode(const char* str) {
   return result;
 }
 
-void StreamingListener::MakeConnection() {
+void StreamingListener::SocketWriter::MakeConnection() {
   GTEST_CHECK_(sockfd_ == -1)
       << "MakeConnection() can't be called when there is already a connection.";
 
@@ -3504,8 +3825,8 @@ void StreamingListener::MakeConnection() {
 
 // Pushes the given source file location and message onto a per-thread
 // trace stack maintained by Google Test.
-// L < UnitTest::mutex_
-ScopedTrace::ScopedTrace(const char* file, int line, const Message& message) {
+ScopedTrace::ScopedTrace(const char* file, int line, const Message& message)
+    GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
   TraceInfo trace;
   trace.file = file;
   trace.line = line;
@@ -3515,34 +3836,52 @@ ScopedTrace::ScopedTrace(const char* file, int line, const Message& message) {
 }
 
 // Pops the info pushed by the c'tor.
-// L < UnitTest::mutex_
-ScopedTrace::~ScopedTrace() {
+ScopedTrace::~ScopedTrace()
+    GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
   UnitTest::GetInstance()->PopGTestTrace();
 }
 
 
 // class OsStackTraceGetter
 
-// Returns the current OS stack trace as a String.  Parameters:
-//
-//   max_depth  - the maximum number of stack frames to be included
-//                in the trace.
-//   skip_count - the number of top frames to be skipped; doesn't count
-//                against max_depth.
-//
-// L < mutex_
-// We use "L < mutex_" to denote that the function may acquire mutex_.
-String OsStackTraceGetter::CurrentStackTrace(int, int) {
-  return String("");
-}
+const char* const OsStackTraceGetterInterface::kElidedFramesMarker =
+    "... " GTEST_NAME_ " internal frames ...";
 
-// L < mutex_
-void OsStackTraceGetter::UponLeavingGTest() {
+string OsStackTraceGetter::CurrentStackTrace(int /*max_depth*/,
+                                             int /*skip_count*/) {
+  return "";
 }
 
-const char* const
-OsStackTraceGetter::kElidedFramesMarker =
-    "... " GTEST_NAME_ " internal frames ...";
+void OsStackTraceGetter::UponLeavingGTest() {}
+
+// A helper class that creates the premature-exit file in its
+// constructor and deletes the file in its destructor.
+class ScopedPrematureExitFile {
+ public:
+  explicit ScopedPrematureExitFile(const char* premature_exit_filepath)
+      : premature_exit_filepath_(premature_exit_filepath) {
+    // If a path to the premature-exit file is specified...
+    if (premature_exit_filepath != NULL && *premature_exit_filepath != '\0') {
+      // create the file with a single "0" character in it.  I/O
+      // errors are ignored as there's nothing better we can do and we
+      // don't want to fail the test because of this.
+      FILE* pfile = posix::FOpen(premature_exit_filepath, "w");
+      fwrite("0", 1, 1, pfile);
+      fclose(pfile);
+    }
+  }
+
+  ~ScopedPrematureExitFile() {
+    if (premature_exit_filepath_ != NULL && *premature_exit_filepath_ != '\0') {
+      remove(premature_exit_filepath_);
+    }
+  }
+
+ private:
+  const char* const premature_exit_filepath_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedPrematureExitFile);
+};
 
 }  // namespace internal
 
@@ -3630,7 +3969,7 @@ void TestEventListeners::SuppressEventForwarding() {
 // We don't protect this under mutex_ as a user is not supposed to
 // call this before main() starts, from which point on the return
 // value will never change.
-UnitTest * UnitTest::GetInstance() {
+UnitTest* UnitTest::GetInstance() {
   // When compiled with MSVC 7.1 in optimized mode, destroying the
   // UnitTest object upon exiting the program messes up the exit code,
   // causing successful tests to appear failed.  We have to use a
@@ -3680,17 +4019,33 @@ int UnitTest::successful_test_count() const {
 // Gets the number of failed tests.
 int UnitTest::failed_test_count() const { return impl()->failed_test_count(); }
 
+// Gets the number of disabled tests that will be reported in the XML report.
+int UnitTest::reportable_disabled_test_count() const {
+  return impl()->reportable_disabled_test_count();
+}
+
 // Gets the number of disabled tests.
 int UnitTest::disabled_test_count() const {
   return impl()->disabled_test_count();
 }
 
+// Gets the number of tests to be printed in the XML report.
+int UnitTest::reportable_test_count() const {
+  return impl()->reportable_test_count();
+}
+
 // Gets the number of all tests.
 int UnitTest::total_test_count() const { return impl()->total_test_count(); }
 
 // Gets the number of tests that should run.
 int UnitTest::test_to_run_count() const { return impl()->test_to_run_count(); }
 
+// Gets the time of the test program start, in ms from the start of the
+// UNIX epoch.
+internal::TimeInMillis UnitTest::start_timestamp() const {
+    return impl()->start_timestamp();
+}
+
 // Gets the elapsed time, in milliseconds.
 internal::TimeInMillis UnitTest::elapsed_time() const {
   return impl()->elapsed_time();
@@ -3709,6 +4064,12 @@ const TestCase* UnitTest::GetTestCase(int i) const {
   return impl()->GetTestCase(i);
 }
 
+// Returns the TestResult containing information on test failures and
+// properties logged outside of individual test cases.
+const TestResult& UnitTest::ad_hoc_test_result() const {
+  return *impl()->ad_hoc_test_result();
+}
+
 // Gets the i-th test case among all the test cases. i can range from 0 to
 // total_test_case_count() - 1. If i is not in that range, returns NULL.
 TestCase* UnitTest::GetMutableTestCase(int i) {
@@ -3744,12 +4105,12 @@ Environment* UnitTest::AddEnvironment(Environment* env) {
 // assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call
 // this to report their results.  The user code should use the
 // assertion macros instead of calling this directly.
-// L < mutex_
-void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
-                                 const char* file_name,
-                                 int line_number,
-                                 const internal::String& message,
-                                 const internal::String& os_stack_trace) {
+void UnitTest::AddTestPartResult(
+    TestPartResult::Type result_type,
+    const char* file_name,
+    int line_number,
+    const std::string& message,
+    const std::string& os_stack_trace) GTEST_LOCK_EXCLUDED_(mutex_) {
   Message msg;
   msg << message;
 
@@ -3782,7 +4143,7 @@ void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
     // with another testing framework) and specify the former on the
     // command line for debugging.
     if (GTEST_FLAG(break_on_failure)) {
-#if GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
       // Using DebugBreak on Windows allows gtest to still break into a debugger
       // when a failure happens and both the --gtest_break_on_failure and
       // the --gtest_catch_exceptions flags are specified.
@@ -3796,7 +4157,7 @@ void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
 #endif  // GTEST_OS_WINDOWS
     } else if (GTEST_FLAG(throw_on_failure)) {
 #if GTEST_HAS_EXCEPTIONS
-      throw GoogleTestFailureException(result);
+      throw internal::GoogleTestFailureException(result);
 #else
       // We cannot call abort() as it generates a pop-up in debug mode
       // that cannot be suppressed in VC 7.1 or below.
@@ -3806,12 +4167,14 @@ void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
   }
 }
 
-// Creates and adds a property to the current TestResult. If a property matching
-// the supplied value already exists, updates its value instead.
-void UnitTest::RecordPropertyForCurrentTest(const char* key,
-                                            const char* value) {
-  const TestProperty test_property(key, value);
-  impl_->current_test_result()->RecordProperty(test_property);
+// Adds a TestProperty to the current TestResult object when invoked from
+// inside a test, to current TestCase's ad_hoc_test_result_ when invoked
+// from SetUpTestCase or TearDownTestCase, or to the global property set
+// when invoked elsewhere.  If the result already contains a property with
+// the same key, the value will be updated.
+void UnitTest::RecordProperty(const std::string& key,
+                              const std::string& value) {
+  impl_->RecordProperty(TestProperty(key, value));
 }
 
 // Runs all tests in this UnitTest object and prints the result.
@@ -3820,21 +4183,45 @@ void UnitTest::RecordPropertyForCurrentTest(const char* key,
 // We don't protect this under mutex_, as we only support calling it
 // from the main thread.
 int UnitTest::Run() {
+  const bool in_death_test_child_process =
+      internal::GTEST_FLAG(internal_run_death_test).length() > 0;
+
+  // Google Test implements this protocol for catching that a test
+  // program exits before returning control to Google Test:
+  //
+  //   1. Upon start, Google Test creates a file whose absolute path
+  //      is specified by the environment variable
+  //      TEST_PREMATURE_EXIT_FILE.
+  //   2. When Google Test has finished its work, it deletes the file.
+  //
+  // This allows a test runner to set TEST_PREMATURE_EXIT_FILE before
+  // running a Google-Test-based test program and check the existence
+  // of the file at the end of the test execution to see if it has
+  // exited prematurely.
+
+  // If we are in the child process of a death test, don't
+  // create/delete the premature exit file, as doing so is unnecessary
+  // and will confuse the parent process.  Otherwise, create/delete
+  // the file upon entering/leaving this function.  If the program
+  // somehow exits before this function has a chance to return, the
+  // premature-exit file will be left undeleted, causing a test runner
+  // that understands the premature-exit-file protocol to report the
+  // test as having failed.
+  const internal::ScopedPrematureExitFile premature_exit_file(
+      in_death_test_child_process ?
+      NULL : internal::posix::GetEnv("TEST_PREMATURE_EXIT_FILE"));
+
   // Captures the value of GTEST_FLAG(catch_exceptions).  This value will be
   // used for the duration of the program.
   impl()->set_catch_exceptions(GTEST_FLAG(catch_exceptions));
 
 #if GTEST_HAS_SEH
-  const bool in_death_test_child_process =
-      internal::GTEST_FLAG(internal_run_death_test).length() > 0;
-
   // Either the user wants Google Test to catch exceptions thrown by the
   // tests or this is executing in the context of death test child
   // process. In either case the user does not want to see pop-up dialogs
   // about crashes - they are expected.
   if (impl()->catch_exceptions() || in_death_test_child_process) {
-
-# if !GTEST_OS_WINDOWS_MOBILE
+# if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
     // SetErrorMode doesn't exist on CE.
     SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
                  SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
@@ -3864,7 +4251,6 @@ int UnitTest::Run() {
           0x0,                                    // Clear the following flags:
           _WRITE_ABORT_MSG | _CALL_REPORTFAULT);  // pop-up window, core dump.
 # endif
-
   }
 #endif  // GTEST_HAS_SEH
 
@@ -3882,16 +4268,16 @@ const char* UnitTest::original_working_dir() const {
 
 // Returns the TestCase object for the test that's currently running,
 // or NULL if no test is running.
-// L < mutex_
-const TestCase* UnitTest::current_test_case() const {
+const TestCase* UnitTest::current_test_case() const
+    GTEST_LOCK_EXCLUDED_(mutex_) {
   internal::MutexLock lock(&mutex_);
   return impl_->current_test_case();
 }
 
 // Returns the TestInfo object for the test that's currently running,
 // or NULL if no test is running.
-// L < mutex_
-const TestInfo* UnitTest::current_test_info() const {
+const TestInfo* UnitTest::current_test_info() const
+    GTEST_LOCK_EXCLUDED_(mutex_) {
   internal::MutexLock lock(&mutex_);
   return impl_->current_test_info();
 }
@@ -3902,9 +4288,9 @@ int UnitTest::random_seed() const { return impl_->random_seed(); }
 #if GTEST_HAS_PARAM_TEST
 // Returns ParameterizedTestCaseRegistry object used to keep track of
 // value-parameterized tests and instantiate and register them.
-// L < mutex_
 internal::ParameterizedTestCaseRegistry&
-    UnitTest::parameterized_test_registry() {
+    UnitTest::parameterized_test_registry()
+        GTEST_LOCK_EXCLUDED_(mutex_) {
   return impl_->parameterized_test_registry();
 }
 #endif  // GTEST_HAS_PARAM_TEST
@@ -3921,15 +4307,15 @@ UnitTest::~UnitTest() {
 
 // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
 // Google Test trace stack.
-// L < mutex_
-void UnitTest::PushGTestTrace(const internal::TraceInfo& trace) {
+void UnitTest::PushGTestTrace(const internal::TraceInfo& trace)
+    GTEST_LOCK_EXCLUDED_(mutex_) {
   internal::MutexLock lock(&mutex_);
   impl_->gtest_trace_stack().push_back(trace);
 }
 
 // Pops a trace from the per-thread Google Test trace stack.
-// L < mutex_
-void UnitTest::PopGTestTrace() {
+void UnitTest::PopGTestTrace()
+    GTEST_LOCK_EXCLUDED_(mutex_) {
   internal::MutexLock lock(&mutex_);
   impl_->gtest_trace_stack().pop_back();
 }
@@ -3938,17 +4324,10 @@ namespace internal {
 
 UnitTestImpl::UnitTestImpl(UnitTest* parent)
     : parent_(parent),
-#ifdef _MSC_VER
-# pragma warning(push)                    // Saves the current warning state.
-# pragma warning(disable:4355)            // Temporarily disables warning 4355
-                                         // (using this in initializer).
+      GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355 /* using this in initializer */)
       default_global_test_part_result_reporter_(this),
       default_per_thread_test_part_result_reporter_(this),
-# pragma warning(pop)                     // Restores the warning state again.
-#else
-      default_global_test_part_result_reporter_(this),
-      default_per_thread_test_part_result_reporter_(this),
-#endif  // _MSC_VER
+      GTEST_DISABLE_MSC_WARNINGS_POP_()
       global_test_part_result_repoter_(
           &default_global_test_part_result_reporter_),
       per_thread_test_part_result_reporter_(
@@ -3965,9 +4344,9 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
       post_flag_parse_init_performed_(false),
       random_seed_(0),  // Will be overridden by the flag before first use.
       random_(0),  // Will be reseeded before first use.
+      start_timestamp_(0),
       elapsed_time_(0),
 #if GTEST_HAS_DEATH_TEST
-      internal_run_death_test_flag_(NULL),
       death_test_factory_(new DefaultDeathTestFactory),
 #endif
       // Will be overridden by the flag before first use.
@@ -3985,6 +4364,28 @@ UnitTestImpl::~UnitTestImpl() {
   delete os_stack_trace_getter_;
 }
 
+// Adds a TestProperty to the current TestResult object when invoked in a
+// context of a test, to current test case's ad_hoc_test_result when invoke
+// from SetUpTestCase/TearDownTestCase, or to the global property set
+// otherwise.  If the result already contains a property with the same key,
+// the value will be updated.
+void UnitTestImpl::RecordProperty(const TestProperty& test_property) {
+  std::string xml_element;
+  TestResult* test_result;  // TestResult appropriate for property recording.
+
+  if (current_test_info_ != NULL) {
+    xml_element = "testcase";
+    test_result = &(current_test_info_->result_);
+  } else if (current_test_case_ != NULL) {
+    xml_element = "testsuite";
+    test_result = &(current_test_case_->ad_hoc_test_result_);
+  } else {
+    xml_element = "testsuites";
+    test_result = &ad_hoc_test_result_;
+  }
+  test_result->RecordProperty(xml_element, test_property);
+}
+
 #if GTEST_HAS_DEATH_TEST
 // Disables event forwarding if the control is currently in a death test
 // subprocess. Must not be called before InitGoogleTest.
@@ -3997,7 +4398,7 @@ void UnitTestImpl::SuppressTestEventsIfInSubprocess() {
 // Initializes event listeners performing XML output as specified by
 // UnitTestOptions. Must not be called before InitGoogleTest.
 void UnitTestImpl::ConfigureXmlOutput() {
-  const String& output_format = UnitTestOptions::GetOutputFormat();
+  const std::string& output_format = UnitTestOptions::GetOutputFormat();
   if (output_format == "xml") {
     listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(
         UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));
@@ -4009,13 +4410,13 @@ void UnitTestImpl::ConfigureXmlOutput() {
 }
 
 #if GTEST_CAN_STREAM_RESULTS_
-// Initializes event listeners for streaming test results in String form.
+// Initializes event listeners for streaming test results in string form.
 // Must not be called before InitGoogleTest.
 void UnitTestImpl::ConfigureStreamingOutput() {
-  const string& target = GTEST_FLAG(stream_result_to);
+  const std::string& target = GTEST_FLAG(stream_result_to);
   if (!target.empty()) {
     const size_t pos = target.find(':');
-    if (pos != string::npos) {
+    if (pos != std::string::npos) {
       listeners()->Append(new StreamingListener(target.substr(0, pos),
                                                 target.substr(pos+1)));
     } else {
@@ -4037,6 +4438,11 @@ void UnitTestImpl::PostFlagParsingInit() {
   if (!post_flag_parse_init_performed_) {
     post_flag_parse_init_performed_ = true;
 
+#if defined(GTEST_CUSTOM_TEST_EVENT_LISTENER_)
+    // Register to send notifications about key process state changes.
+    listeners()->Append(new GTEST_CUSTOM_TEST_EVENT_LISTENER_());
+#endif  // defined(GTEST_CUSTOM_TEST_EVENT_LISTENER_)
+
 #if GTEST_HAS_DEATH_TEST
     InitDeathTestSubprocessControlInfo();
     SuppressTestEventsIfInSubprocess();
@@ -4069,7 +4475,7 @@ void UnitTestImpl::PostFlagParsingInit() {
 class TestCaseNameIs {
  public:
   // Constructor.
-  explicit TestCaseNameIs(const String& name)
+  explicit TestCaseNameIs(const std::string& name)
       : name_(name) {}
 
   // Returns true iff the name of test_case matches name_.
@@ -4078,7 +4484,7 @@ class TestCaseNameIs {
   }
 
  private:
-  String name_;
+  std::string name_;
 };
 
 // Finds and returns a TestCase with the given name.  If one doesn't
@@ -4110,7 +4516,7 @@ TestCase* UnitTestImpl::GetTestCase(const char* test_case_name,
       new TestCase(test_case_name, type_param, set_up_tc, tear_down_tc);
 
   // Is this a death test case?
-  if (internal::UnitTestOptions::MatchesFilter(String(test_case_name),
+  if (internal::UnitTestOptions::MatchesFilter(test_case_name,
                                                kDeathTestCaseFilter)) {
     // Yes.  Inserts the test case after the last death test case
     // defined so far.  This only works when the test cases haven't
@@ -4170,6 +4576,11 @@ bool UnitTestImpl::RunAllTests() {
 
 #if GTEST_HAS_DEATH_TEST
   in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL);
+# if defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_)
+  if (in_subprocess_for_death_test) {
+    GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_();
+  }
+# endif  // defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_)
 #endif  // GTEST_HAS_DEATH_TEST
 
   const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex,
@@ -4196,6 +4607,7 @@ bool UnitTestImpl::RunAllTests() {
 
   TestEventListener* repeater = listeners()->repeater();
 
+  start_timestamp_ = GetTimeInMillis();
   repeater->OnTestProgramStart(*parent_);
 
   // How many times to repeat the tests?  We don't want to repeat them
@@ -4388,12 +4800,12 @@ int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
   int num_selected_tests = 0;
   for (size_t i = 0; i < test_cases_.size(); i++) {
     TestCase* const test_case = test_cases_[i];
-    const String &test_case_name = test_case->name();
+    const std::string &test_case_name = test_case->name();
     test_case->set_should_run(false);
 
     for (size_t j = 0; j < test_case->test_info_list().size(); j++) {
       TestInfo* const test_info = test_case->test_info_list()[j];
-      const String test_name(test_info->name());
+      const std::string test_name(test_info->name());
       // A test is disabled if test case name or test name matches
       // kDisableTestFilter.
       const bool is_disabled =
@@ -4427,8 +4839,33 @@ int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
   return num_selected_tests;
 }
 
+// Prints the given C-string on a single line by replacing all '\n'
+// characters with string "\\n".  If the output takes more than
+// max_length characters, only prints the first max_length characters
+// and "...".
+static void PrintOnOneLine(const char* str, int max_length) {
+  if (str != NULL) {
+    for (int i = 0; *str != '\0'; ++str) {
+      if (i >= max_length) {
+        printf("...");
+        break;
+      }
+      if (*str == '\n') {
+        printf("\\n");
+        i += 2;
+      } else {
+        printf("%c", *str);
+        ++i;
+      }
+    }
+  }
+}
+
 // Prints the names of the tests matching the user-specified filter flag.
 void UnitTestImpl::ListTestsMatchingFilter() {
+  // Print at most this many characters for each type/value parameter.
+  const int kMaxParamLength = 250;
+
   for (size_t i = 0; i < test_cases_.size(); i++) {
     const TestCase* const test_case = test_cases_[i];
     bool printed_test_case_name = false;
@@ -4439,9 +4876,23 @@ void UnitTestImpl::ListTestsMatchingFilter() {
       if (test_info->matches_filter_) {
         if (!printed_test_case_name) {
           printed_test_case_name = true;
-          printf("%s.\n", test_case->name());
+          printf("%s.", test_case->name());
+          if (test_case->type_param() != NULL) {
+            printf("  # %s = ", kTypeParamLabel);
+            // We print the type parameter on a single line to make
+            // the output easy to parse by a program.
+            PrintOnOneLine(test_case->type_param(), kMaxParamLength);
+          }
+          printf("\n");
+        }
+        printf("  %s", test_info->name());
+        if (test_info->value_param() != NULL) {
+          printf("  # %s = ", kValueParamLabel);
+          // We print the value parameter on a single line to make the
+          // output easy to parse by a program.
+          PrintOnOneLine(test_info->value_param(), kMaxParamLength);
         }
-        printf("  %s\n", test_info->name());
+        printf("\n");
       }
     }
   }
@@ -4466,7 +4917,11 @@ void UnitTestImpl::set_os_stack_trace_getter(
 // getter, and returns it.
 OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
   if (os_stack_trace_getter_ == NULL) {
+#ifdef GTEST_OS_STACK_TRACE_GETTER_
+    os_stack_trace_getter_ = new GTEST_OS_STACK_TRACE_GETTER_;
+#else
     os_stack_trace_getter_ = new OsStackTraceGetter;
+#endif  // GTEST_OS_STACK_TRACE_GETTER_
   }
 
   return os_stack_trace_getter_;
@@ -4505,7 +4960,7 @@ void UnitTestImpl::UnshuffleTests() {
   }
 }
 
-// Returns the current OS stack trace as a String.
+// Returns the current OS stack trace as an std::string.
 //
 // The maximum number of stack frames to be included is specified by
 // the gtest_stack_trace_depth flag.  The skip_count parameter
@@ -4515,8 +4970,8 @@ void UnitTestImpl::UnshuffleTests() {
 // For example, if Foo() calls Bar(), which in turn calls
 // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
 // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
-String GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
-                                       int skip_count) {
+std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
+                                            int skip_count) {
   // We pass skip_count + 1 to skip this wrapper function in addition
   // to what the user really wants to skip.
   return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1);
@@ -4564,7 +5019,7 @@ const char* ParseFlagValue(const char* str,
   if (str == NULL || flag == NULL) return NULL;
 
   // The flag must start with "--" followed by GTEST_FLAG_PREFIX_.
-  const String flag_str = String::Format("--%s%s", GTEST_FLAG_PREFIX_, flag);
+  const std::string flag_str = std::string("--") + GTEST_FLAG_PREFIX_ + flag;
   const size_t flag_len = flag_str.length();
   if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL;
 
@@ -4629,7 +5084,7 @@ bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
 //
 // On success, stores the value of the flag in *value, and returns
 // true.  On failure, returns false without changing *value.
-bool ParseStringFlag(const char* str, const char* flag, String* value) {
+bool ParseStringFlag(const char* str, const char* flag, std::string* value) {
   // Gets the value of the flag as a string.
   const char* const value_str = ParseFlagValue(str, flag, false);
 
@@ -4681,7 +5136,7 @@ static void PrintColorEncoded(const char* str) {
       return;
     }
 
-    ColoredPrintf(color, "%s", String(str, p - str).c_str());
+    ColoredPrintf(color, "%s", std::string(str, p).c_str());
 
     const char ch = p[1];
     str = p + 2;
@@ -4765,48 +5220,89 @@ static const char kColorEncodedHelpMessage[] =
 "(not one in your own code or tests), please report it to\n"
 "@G<" GTEST_DEV_EMAIL_ ">@D.\n";
 
+bool ParseGoogleTestFlag(const char* const arg) {
+  return ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag,
+                       &GTEST_FLAG(also_run_disabled_tests)) ||
+      ParseBoolFlag(arg, kBreakOnFailureFlag,
+                    &GTEST_FLAG(break_on_failure)) ||
+      ParseBoolFlag(arg, kCatchExceptionsFlag,
+                    &GTEST_FLAG(catch_exceptions)) ||
+      ParseStringFlag(arg, kColorFlag, &GTEST_FLAG(color)) ||
+      ParseStringFlag(arg, kDeathTestStyleFlag,
+                      &GTEST_FLAG(death_test_style)) ||
+      ParseBoolFlag(arg, kDeathTestUseFork,
+                    &GTEST_FLAG(death_test_use_fork)) ||
+      ParseStringFlag(arg, kFilterFlag, &GTEST_FLAG(filter)) ||
+      ParseStringFlag(arg, kInternalRunDeathTestFlag,
+                      &GTEST_FLAG(internal_run_death_test)) ||
+      ParseBoolFlag(arg, kListTestsFlag, &GTEST_FLAG(list_tests)) ||
+      ParseStringFlag(arg, kOutputFlag, &GTEST_FLAG(output)) ||
+      ParseBoolFlag(arg, kPrintTimeFlag, &GTEST_FLAG(print_time)) ||
+      ParseInt32Flag(arg, kRandomSeedFlag, &GTEST_FLAG(random_seed)) ||
+      ParseInt32Flag(arg, kRepeatFlag, &GTEST_FLAG(repeat)) ||
+      ParseBoolFlag(arg, kShuffleFlag, &GTEST_FLAG(shuffle)) ||
+      ParseInt32Flag(arg, kStackTraceDepthFlag,
+                     &GTEST_FLAG(stack_trace_depth)) ||
+      ParseStringFlag(arg, kStreamResultToFlag,
+                      &GTEST_FLAG(stream_result_to)) ||
+      ParseBoolFlag(arg, kThrowOnFailureFlag,
+                    &GTEST_FLAG(throw_on_failure));
+}
+
+#if GTEST_USE_OWN_FLAGFILE_FLAG_
+void LoadFlagsFromFile(const std::string& path) {
+  FILE* flagfile = posix::FOpen(path.c_str(), "r");
+  if (!flagfile) {
+    fprintf(stderr,
+            "Unable to open file \"%s\"\n",
+            GTEST_FLAG(flagfile).c_str());
+    fflush(stderr);
+    exit(EXIT_FAILURE);
+  }
+  std::string contents(ReadEntireFile(flagfile));
+  posix::FClose(flagfile);
+  std::vector<std::string> lines;
+  SplitString(contents, '\n', &lines);
+  for (size_t i = 0; i < lines.size(); ++i) {
+    if (lines[i].empty())
+      continue;
+    if (!ParseGoogleTestFlag(lines[i].c_str()))
+      g_help_flag = true;
+  }
+}
+#endif  // GTEST_USE_OWN_FLAGFILE_FLAG_
+
 // Parses the command line for Google Test flags, without initializing
 // other parts of Google Test.  The type parameter CharType can be
 // instantiated to either char or wchar_t.
 template <typename CharType>
 void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
   for (int i = 1; i < *argc; i++) {
-    const String arg_string = StreamableToString(argv[i]);
+    const std::string arg_string = StreamableToString(argv[i]);
     const char* const arg = arg_string.c_str();
 
     using internal::ParseBoolFlag;
     using internal::ParseInt32Flag;
     using internal::ParseStringFlag;
 
-    // Do we see a Google Test flag?
-    if (ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag,
-                      &GTEST_FLAG(also_run_disabled_tests)) ||
-        ParseBoolFlag(arg, kBreakOnFailureFlag,
-                      &GTEST_FLAG(break_on_failure)) ||
-        ParseBoolFlag(arg, kCatchExceptionsFlag,
-                      &GTEST_FLAG(catch_exceptions)) ||
-        ParseStringFlag(arg, kColorFlag, &GTEST_FLAG(color)) ||
-        ParseStringFlag(arg, kDeathTestStyleFlag,
-                        &GTEST_FLAG(death_test_style)) ||
-        ParseBoolFlag(arg, kDeathTestUseFork,
-                      &GTEST_FLAG(death_test_use_fork)) ||
-        ParseStringFlag(arg, kFilterFlag, &GTEST_FLAG(filter)) ||
-        ParseStringFlag(arg, kInternalRunDeathTestFlag,
-                        &GTEST_FLAG(internal_run_death_test)) ||
-        ParseBoolFlag(arg, kListTestsFlag, &GTEST_FLAG(list_tests)) ||
-        ParseStringFlag(arg, kOutputFlag, &GTEST_FLAG(output)) ||
-        ParseBoolFlag(arg, kPrintTimeFlag, &GTEST_FLAG(print_time)) ||
-        ParseInt32Flag(arg, kRandomSeedFlag, &GTEST_FLAG(random_seed)) ||
-        ParseInt32Flag(arg, kRepeatFlag, &GTEST_FLAG(repeat)) ||
-        ParseBoolFlag(arg, kShuffleFlag, &GTEST_FLAG(shuffle)) ||
-        ParseInt32Flag(arg, kStackTraceDepthFlag,
-                       &GTEST_FLAG(stack_trace_depth)) ||
-        ParseStringFlag(arg, kStreamResultToFlag,
-                        &GTEST_FLAG(stream_result_to)) ||
-        ParseBoolFlag(arg, kThrowOnFailureFlag,
-                      &GTEST_FLAG(throw_on_failure))
-        ) {
-      // Yes.  Shift the remainder of the argv list left by one.  Note
+    bool remove_flag = false;
+    if (ParseGoogleTestFlag(arg)) {
+      remove_flag = true;
+#if GTEST_USE_OWN_FLAGFILE_FLAG_
+    } else if (ParseStringFlag(arg, kFlagfileFlag, &GTEST_FLAG(flagfile))) {
+      LoadFlagsFromFile(GTEST_FLAG(flagfile));
+      remove_flag = true;
+#endif  // GTEST_USE_OWN_FLAGFILE_FLAG_
+    } else if (arg_string == "--help" || arg_string == "-h" ||
+               arg_string == "-?" || arg_string == "/?" ||
+               HasGoogleTestFlagPrefix(arg)) {
+      // Both help flag and unrecognized Google Test flags (excluding
+      // internal ones) trigger help display.
+      g_help_flag = true;
+    }
+
+    if (remove_flag) {
+      // Shift the remainder of the argv list left by one.  Note
       // that argv has (*argc + 1) elements, the last one always being
       // NULL.  The following loop moves the trailing NULL element as
       // well.
@@ -4820,12 +5316,6 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
       // We also need to decrement the iterator as we just removed
       // an element.
       i--;
-    } else if (arg_string == "--help" || arg_string == "-h" ||
-               arg_string == "-?" || arg_string == "/?" ||
-               HasGoogleTestFlagPrefix(arg)) {
-      // Both help flag and unrecognized Google Test flags (excluding
-      // internal ones) trigger help display.
-      g_help_flag = true;
     }
   }
 
@@ -4852,24 +5342,16 @@ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
 // wchar_t.
 template <typename CharType>
 void InitGoogleTestImpl(int* argc, CharType** argv) {
-  g_init_gtest_count++;
-
   // We don't want to run the initialization code twice.
-  if (g_init_gtest_count != 1) return;
+  if (GTestIsInitialized()) return;
 
   if (*argc <= 0) return;
 
-  internal::g_executable_path = internal::StreamableToString(argv[0]);
-
-#if GTEST_HAS_DEATH_TEST
-
   g_argvs.clear();
   for (int i = 0; i != *argc; i++) {
     g_argvs.push_back(StreamableToString(argv[i]));
   }
 
-#endif  // GTEST_HAS_DEATH_TEST
-
   ParseGoogleTestFlagsOnly(argc, argv);
   GetUnitTestImpl()->PostFlagParsingInit();
 }
@@ -4886,13 +5368,21 @@ void InitGoogleTestImpl(int* argc, CharType** argv) {
 //
 // Calling the function for the second time has no user-visible effect.
 void InitGoogleTest(int* argc, char** argv) {
+#if defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
+  GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_(argc, argv);
+#else  // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
   internal::InitGoogleTestImpl(argc, argv);
+#endif  // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
 }
 
 // This overloaded version can be used in Windows programs compiled in
 // UNICODE mode.
 void InitGoogleTest(int* argc, wchar_t** argv) {
+#if defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
+  GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_(argc, argv);
+#else  // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
   internal::InitGoogleTestImpl(argc, argv);
+#endif  // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
 }
 
 }  // namespace testing
index a09bbe0..f302822 100755 (executable)
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-#include <iostream>
+#include <stdio.h>
 
 #include "gtest/gtest.h"
 
 GTEST_API_ int main(int argc, char **argv) {
-  std::cout << "Running main() from gtest_main.cc\n";
-
+  printf("Running main() from gtest_main.cc\n");
   testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
 }
diff --git a/src/gtest_main.o b/src/gtest_main.o
deleted file mode 100644 (file)
index 32acc4d..0000000
Binary files a/src/gtest_main.o and /dev/null differ
index bcf8e2a..bb4a3d1 100755 (executable)
@@ -45,13 +45,16 @@ using testing::internal::AlwaysTrue;
 # else
 #  include <unistd.h>
 #  include <sys/wait.h>        // For waitpid.
-#  include <limits>            // For std::numeric_limits.
 # endif  // GTEST_OS_WINDOWS
 
 # include <limits.h>
 # include <signal.h>
 # include <stdio.h>
 
+# if GTEST_OS_LINUX
+#  include <sys/time.h>
+# endif  // GTEST_OS_LINUX
+
 # include "gtest/gtest-spi.h"
 
 // Indicates that this translation unit is part of Google Test's
@@ -71,8 +74,8 @@ using testing::internal::DeathTestFactory;
 using testing::internal::FilePath;
 using testing::internal::GetLastErrnoDescription;
 using testing::internal::GetUnitTestImpl;
+using testing::internal::InDeathTestChild;
 using testing::internal::ParseNaturalNumber;
-using testing::internal::String;
 
 namespace testing {
 namespace internal {
@@ -323,12 +326,9 @@ TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
 // Tests that death test macros expand to code which interacts well with switch
 // statements.
 TEST_F(TestForDeathTest, SwitchStatement) {
-// Microsoft compiler usually complains about switch statements without
-// case labels. We suppress that warning for this test.
-# ifdef _MSC_VER
-#  pragma warning(push)
-#  pragma warning(disable: 4065)
-# endif  // _MSC_VER
+  // Microsoft compiler usually complains about switch statements without
+  // case labels. We suppress that warning for this test.
+  GTEST_DISABLE_MSC_WARNINGS_PUSH_(4065)
 
   switch (0)
     default:
@@ -338,9 +338,7 @@ TEST_F(TestForDeathTest, SwitchStatement) {
     case 0:
       EXPECT_DEATH(_exit(1), "") << "exit in switch case";
 
-# ifdef _MSC_VER
-#  pragma warning(pop)
-# endif  // _MSC_VER
+  GTEST_DISABLE_MSC_WARNINGS_POP_()
 }
 
 // Tests that a static member function can be used in a "fast" style
@@ -372,6 +370,58 @@ TEST_F(TestForDeathTest, FastDeathTestInChangedDir) {
   ASSERT_DEATH(_exit(1), "");
 }
 
+# if GTEST_OS_LINUX
+void SigprofAction(int, siginfo_t*, void*) { /* no op */ }
+
+// Sets SIGPROF action and ITIMER_PROF timer (interval: 1ms).
+void SetSigprofActionAndTimer() {
+  struct itimerval timer;
+  timer.it_interval.tv_sec = 0;
+  timer.it_interval.tv_usec = 1;
+  timer.it_value = timer.it_interval;
+  ASSERT_EQ(0, setitimer(ITIMER_PROF, &timer, NULL));
+  struct sigaction signal_action;
+  memset(&signal_action, 0, sizeof(signal_action));
+  sigemptyset(&signal_action.sa_mask);
+  signal_action.sa_sigaction = SigprofAction;
+  signal_action.sa_flags = SA_RESTART | SA_SIGINFO;
+  ASSERT_EQ(0, sigaction(SIGPROF, &signal_action, NULL));
+}
+
+// Disables ITIMER_PROF timer and ignores SIGPROF signal.
+void DisableSigprofActionAndTimer(struct sigaction* old_signal_action) {
+  struct itimerval timer;
+  timer.it_interval.tv_sec = 0;
+  timer.it_interval.tv_usec = 0;
+  timer.it_value = timer.it_interval;
+  ASSERT_EQ(0, setitimer(ITIMER_PROF, &timer, NULL));
+  struct sigaction signal_action;
+  memset(&signal_action, 0, sizeof(signal_action));
+  sigemptyset(&signal_action.sa_mask);
+  signal_action.sa_handler = SIG_IGN;
+  ASSERT_EQ(0, sigaction(SIGPROF, &signal_action, old_signal_action));
+}
+
+// Tests that death tests work when SIGPROF handler and timer are set.
+TEST_F(TestForDeathTest, FastSigprofActionSet) {
+  testing::GTEST_FLAG(death_test_style) = "fast";
+  SetSigprofActionAndTimer();
+  EXPECT_DEATH(_exit(1), "");
+  struct sigaction old_signal_action;
+  DisableSigprofActionAndTimer(&old_signal_action);
+  EXPECT_TRUE(old_signal_action.sa_sigaction == SigprofAction);
+}
+
+TEST_F(TestForDeathTest, ThreadSafeSigprofActionSet) {
+  testing::GTEST_FLAG(death_test_style) = "threadsafe";
+  SetSigprofActionAndTimer();
+  EXPECT_DEATH(_exit(1), "");
+  struct sigaction old_signal_action;
+  DisableSigprofActionAndTimer(&old_signal_action);
+  EXPECT_TRUE(old_signal_action.sa_sigaction == SigprofAction);
+}
+# endif  // GTEST_OS_LINUX
+
 // Repeats a representative sample of death tests in the "threadsafe" style:
 
 TEST_F(TestForDeathTest, StaticMemberFunctionThreadsafeStyle) {
@@ -409,6 +459,8 @@ TEST_F(TestForDeathTest, MixedStyles) {
   EXPECT_DEATH(_exit(1), "");
 }
 
+# if GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
+
 namespace {
 
 bool pthread_flag;
@@ -419,8 +471,6 @@ void SetPthreadFlag() {
 
 }  // namespace
 
-# if GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
-
 TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {
   if (!testing::GTEST_FLAG(death_test_use_fork)) {
     testing::GTEST_FLAG(death_test_style) = "threadsafe";
@@ -460,8 +510,12 @@ TEST_F(TestForDeathTest, AcceptsAnythingConvertibleToRE) {
 
 # endif  // GTEST_HAS_GLOBAL_STRING
 
+# if !GTEST_USES_PCRE
+
   const ::std::string regex_std_str(regex_c_str);
   EXPECT_DEATH(GlobalFunction(), regex_std_str);
+
+# endif  // !GTEST_USES_PCRE
 }
 
 // Tests that a non-void function can be used in a death test.
@@ -561,8 +615,8 @@ TEST_F(TestForDeathTest, ReturnIsFailure) {
                        "illegal return in test statement.");
 }
 
-// Tests that EXPECT_DEBUG_DEATH works as expected,
-// that is, in debug mode, it:
+// Tests that EXPECT_DEBUG_DEATH works as expected, that is, you can stream a
+// message to it, and in debug mode it:
 // 1. Asserts on death.
 // 2. Has no side effect.
 //
@@ -571,8 +625,8 @@ TEST_F(TestForDeathTest, ReturnIsFailure) {
 TEST_F(TestForDeathTest, TestExpectDebugDeath) {
   int sideeffect = 0;
 
-  EXPECT_DEBUG_DEATH(DieInDebugElse12(&sideeffect),
-                     "death.*DieInDebugElse12");
+  EXPECT_DEBUG_DEATH(DieInDebugElse12(&sideeffect), "death.*DieInDebugElse12")
+      << "Must accept a streamed message";
 
 # ifdef NDEBUG
 
@@ -587,22 +641,18 @@ TEST_F(TestForDeathTest, TestExpectDebugDeath) {
 # endif
 }
 
-// Tests that ASSERT_DEBUG_DEATH works as expected
-// In debug mode:
-// 1. Asserts on debug death.
+// Tests that ASSERT_DEBUG_DEATH works as expected, that is, you can stream a
+// message to it, and in debug mode it:
+// 1. Asserts on death.
 // 2. Has no side effect.
 //
-// In opt mode:
-// 1. Has side effects and returns the expected value (12).
+// And in opt mode, it:
+// 1.  Has side effects but does not assert.
 TEST_F(TestForDeathTest, TestAssertDebugDeath) {
   int sideeffect = 0;
 
-  ASSERT_DEBUG_DEATH({  // NOLINT
-    // Tests that the return value is 12 in opt mode.
-    EXPECT_EQ(12, DieInDebugElse12(&sideeffect));
-    // Tests that the side effect occurred in opt mode.
-    EXPECT_EQ(12, sideeffect);
-  }, "death.*DieInDebugElse12");
+  ASSERT_DEBUG_DEATH(DieInDebugElse12(&sideeffect), "death.*DieInDebugElse12")
+      << "Must accept a streamed message";
 
 # ifdef NDEBUG
 
@@ -648,7 +698,10 @@ TEST_F(TestForDeathTest, ExpectDebugDeathDoesNotAbort) {
 
 void AssertDebugDeathHelper(bool* aborted) {
   *aborted = true;
-  ASSERT_DEBUG_DEATH(return, "") << "This is expected to fail.";
+  GTEST_LOG_(INFO) << "Before ASSERT_DEBUG_DEATH";
+  ASSERT_DEBUG_DEATH(GTEST_LOG_(INFO) << "In ASSERT_DEBUG_DEATH"; return, "")
+      << "This is expected to fail.";
+  GTEST_LOG_(INFO) << "After ASSERT_DEBUG_DEATH";
   *aborted = false;
 }
 
@@ -661,6 +714,69 @@ TEST_F(TestForDeathTest, AssertDebugDeathAborts) {
   EXPECT_TRUE(aborted);
 }
 
+TEST_F(TestForDeathTest, AssertDebugDeathAborts2) {
+  static bool aborted;
+  aborted = false;
+  EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
+  EXPECT_TRUE(aborted);
+}
+
+TEST_F(TestForDeathTest, AssertDebugDeathAborts3) {
+  static bool aborted;
+  aborted = false;
+  EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
+  EXPECT_TRUE(aborted);
+}
+
+TEST_F(TestForDeathTest, AssertDebugDeathAborts4) {
+  static bool aborted;
+  aborted = false;
+  EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
+  EXPECT_TRUE(aborted);
+}
+
+TEST_F(TestForDeathTest, AssertDebugDeathAborts5) {
+  static bool aborted;
+  aborted = false;
+  EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
+  EXPECT_TRUE(aborted);
+}
+
+TEST_F(TestForDeathTest, AssertDebugDeathAborts6) {
+  static bool aborted;
+  aborted = false;
+  EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
+  EXPECT_TRUE(aborted);
+}
+
+TEST_F(TestForDeathTest, AssertDebugDeathAborts7) {
+  static bool aborted;
+  aborted = false;
+  EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
+  EXPECT_TRUE(aborted);
+}
+
+TEST_F(TestForDeathTest, AssertDebugDeathAborts8) {
+  static bool aborted;
+  aborted = false;
+  EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
+  EXPECT_TRUE(aborted);
+}
+
+TEST_F(TestForDeathTest, AssertDebugDeathAborts9) {
+  static bool aborted;
+  aborted = false;
+  EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
+  EXPECT_TRUE(aborted);
+}
+
+TEST_F(TestForDeathTest, AssertDebugDeathAborts10) {
+  static bool aborted;
+  aborted = false;
+  EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
+  EXPECT_TRUE(aborted);
+}
+
 # endif  // _NDEBUG
 
 // Tests the *_EXIT family of macros, using a variety of predicates.
@@ -673,7 +789,7 @@ static void TestExitMacros() {
   // Of all signals effects on the process exit code, only those of SIGABRT
   // are documented on Windows.
   // See http://msdn.microsoft.com/en-us/library/dwwzkt4c(VS.71).aspx.
-  EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "");
+  EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "") << "b_ar";
 
 # else
 
@@ -682,14 +798,14 @@ static void TestExitMacros() {
 
   EXPECT_FATAL_FAILURE({  // NOLINT
     ASSERT_EXIT(_exit(0), testing::KilledBySignal(SIGSEGV), "")
-        << "This failure is expected, too.";
+      << "This failure is expected, too.";
   }, "This failure is expected, too.");
 
 # endif  // GTEST_OS_WINDOWS
 
   EXPECT_NONFATAL_FAILURE({  // NOLINT
     EXPECT_EXIT(raise(SIGSEGV), testing::ExitedWithCode(0), "")
-        << "This failure is expected.";
+      << "This failure is expected.";
   }, "This failure is expected.");
 }
 
@@ -775,9 +891,9 @@ class MockDeathTestFactory : public DeathTestFactory {
   // Accessors.
   int AssumeRoleCalls() const { return assume_role_calls_; }
   int WaitCalls() const { return wait_calls_; }
-  int PassedCalls() const { return passed_args_.size(); }
+  size_t PassedCalls() const { return passed_args_.size(); }
   bool PassedArgument(int n) const { return passed_args_[n]; }
-  int AbortCalls() const { return abort_args_.size(); }
+  size_t AbortCalls() const { return abort_args_.size(); }
   DeathTest::AbortReason AbortArgument(int n) const {
     return abort_args_[n];
   }
@@ -839,6 +955,7 @@ class MockDeathTest : public DeathTest {
   virtual void Abort(AbortReason reason) {
     parent_->abort_args_.push_back(reason);
   }
+
  private:
   MockDeathTestFactory* const parent_;
   const TestRole role_;
@@ -937,8 +1054,8 @@ TEST_F(MacroLogicDeathTest, NothingHappens) {
   EXPECT_FALSE(flag);
   EXPECT_EQ(0, factory_->AssumeRoleCalls());
   EXPECT_EQ(0, factory_->WaitCalls());
-  EXPECT_EQ(0, factory_->PassedCalls());
-  EXPECT_EQ(0, factory_->AbortCalls());
+  EXPECT_EQ(0U, factory_->PassedCalls());
+  EXPECT_EQ(0U, factory_->AbortCalls());
   EXPECT_FALSE(factory_->TestDeleted());
 }
 
@@ -952,9 +1069,9 @@ TEST_F(MacroLogicDeathTest, ChildExitsSuccessfully) {
   EXPECT_FALSE(flag);
   EXPECT_EQ(1, factory_->AssumeRoleCalls());
   EXPECT_EQ(1, factory_->WaitCalls());
-  ASSERT_EQ(1, factory_->PassedCalls());
+  ASSERT_EQ(1U, factory_->PassedCalls());
   EXPECT_FALSE(factory_->PassedArgument(0));
-  EXPECT_EQ(0, factory_->AbortCalls());
+  EXPECT_EQ(0U, factory_->AbortCalls());
   EXPECT_TRUE(factory_->TestDeleted());
 }
 
@@ -967,9 +1084,9 @@ TEST_F(MacroLogicDeathTest, ChildExitsUnsuccessfully) {
   EXPECT_FALSE(flag);
   EXPECT_EQ(1, factory_->AssumeRoleCalls());
   EXPECT_EQ(1, factory_->WaitCalls());
-  ASSERT_EQ(1, factory_->PassedCalls());
+  ASSERT_EQ(1U, factory_->PassedCalls());
   EXPECT_TRUE(factory_->PassedArgument(0));
-  EXPECT_EQ(0, factory_->AbortCalls());
+  EXPECT_EQ(0U, factory_->AbortCalls());
   EXPECT_TRUE(factory_->TestDeleted());
 }
 
@@ -983,8 +1100,8 @@ TEST_F(MacroLogicDeathTest, ChildPerformsReturn) {
   EXPECT_TRUE(flag);
   EXPECT_EQ(1, factory_->AssumeRoleCalls());
   EXPECT_EQ(0, factory_->WaitCalls());
-  EXPECT_EQ(0, factory_->PassedCalls());
-  EXPECT_EQ(1, factory_->AbortCalls());
+  EXPECT_EQ(0U, factory_->PassedCalls());
+  EXPECT_EQ(1U, factory_->AbortCalls());
   EXPECT_EQ(DeathTest::TEST_ENCOUNTERED_RETURN_STATEMENT,
             factory_->AbortArgument(0));
   EXPECT_TRUE(factory_->TestDeleted());
@@ -999,13 +1116,13 @@ TEST_F(MacroLogicDeathTest, ChildDoesNotDie) {
   EXPECT_TRUE(flag);
   EXPECT_EQ(1, factory_->AssumeRoleCalls());
   EXPECT_EQ(0, factory_->WaitCalls());
-  EXPECT_EQ(0, factory_->PassedCalls());
+  EXPECT_EQ(0U, factory_->PassedCalls());
   // This time there are two calls to Abort: one since the test didn't
   // die, and another from the ReturnSentinel when it's destroyed.  The
   // sentinel normally isn't destroyed if a test doesn't die, since
   // _exit(2) is called in that case by ForkingDeathTest, but not by
   // our MockDeathTest.
-  ASSERT_EQ(2, factory_->AbortCalls());
+  ASSERT_EQ(2U, factory_->AbortCalls());
   EXPECT_EQ(DeathTest::TEST_DID_NOT_DIE,
             factory_->AbortArgument(0));
   EXPECT_EQ(DeathTest::TEST_ENCOUNTERED_RETURN_STATEMENT,
@@ -1070,41 +1187,40 @@ TEST(AutoHandleTest, AutoHandleWorks) {
 # if GTEST_OS_WINDOWS
 typedef unsigned __int64 BiggestParsable;
 typedef signed __int64 BiggestSignedParsable;
-const BiggestParsable kBiggestParsableMax = ULLONG_MAX;
-const BiggestSignedParsable kBiggestSignedParsableMax = LLONG_MAX;
 # else
 typedef unsigned long long BiggestParsable;
 typedef signed long long BiggestSignedParsable;
-const BiggestParsable kBiggestParsableMax =
-    ::std::numeric_limits<BiggestParsable>::max();
-const BiggestSignedParsable kBiggestSignedParsableMax =
-    ::std::numeric_limits<BiggestSignedParsable>::max();
 # endif  // GTEST_OS_WINDOWS
 
+// We cannot use std::numeric_limits<T>::max() as it clashes with the
+// max() macro defined by <windows.h>.
+const BiggestParsable kBiggestParsableMax = ULLONG_MAX;
+const BiggestSignedParsable kBiggestSignedParsableMax = LLONG_MAX;
+
 TEST(ParseNaturalNumberTest, RejectsInvalidFormat) {
   BiggestParsable result = 0;
 
   // Rejects non-numbers.
-  EXPECT_FALSE(ParseNaturalNumber(String("non-number string"), &result));
+  EXPECT_FALSE(ParseNaturalNumber("non-number string", &result));
 
   // Rejects numbers with whitespace prefix.
-  EXPECT_FALSE(ParseNaturalNumber(String(" 123"), &result));
+  EXPECT_FALSE(ParseNaturalNumber(" 123", &result));
 
   // Rejects negative numbers.
-  EXPECT_FALSE(ParseNaturalNumber(String("-123"), &result));
+  EXPECT_FALSE(ParseNaturalNumber("-123", &result));
 
   // Rejects numbers starting with a plus sign.
-  EXPECT_FALSE(ParseNaturalNumber(String("+123"), &result));
+  EXPECT_FALSE(ParseNaturalNumber("+123", &result));
   errno = 0;
 }
 
 TEST(ParseNaturalNumberTest, RejectsOverflownNumbers) {
   BiggestParsable result = 0;
 
-  EXPECT_FALSE(ParseNaturalNumber(String("99999999999999999999999"), &result));
+  EXPECT_FALSE(ParseNaturalNumber("99999999999999999999999", &result));
 
   signed char char_result = 0;
-  EXPECT_FALSE(ParseNaturalNumber(String("200"), &char_result));
+  EXPECT_FALSE(ParseNaturalNumber("200", &char_result));
   errno = 0;
 }
 
@@ -1112,16 +1228,16 @@ TEST(ParseNaturalNumberTest, AcceptsValidNumbers) {
   BiggestParsable result = 0;
 
   result = 0;
-  ASSERT_TRUE(ParseNaturalNumber(String("123"), &result));
+  ASSERT_TRUE(ParseNaturalNumber("123", &result));
   EXPECT_EQ(123U, result);
 
   // Check 0 as an edge case.
   result = 1;
-  ASSERT_TRUE(ParseNaturalNumber(String("0"), &result));
+  ASSERT_TRUE(ParseNaturalNumber("0", &result));
   EXPECT_EQ(0U, result);
 
   result = 1;
-  ASSERT_TRUE(ParseNaturalNumber(String("00000"), &result));
+  ASSERT_TRUE(ParseNaturalNumber("00000", &result));
   EXPECT_EQ(0U, result);
 }
 
@@ -1157,11 +1273,11 @@ TEST(ParseNaturalNumberTest, AcceptsTypeLimits) {
 
 TEST(ParseNaturalNumberTest, WorksForShorterIntegers) {
   short short_result = 0;
-  ASSERT_TRUE(ParseNaturalNumber(String("123"), &short_result));
+  ASSERT_TRUE(ParseNaturalNumber("123", &short_result));
   EXPECT_EQ(123, short_result);
 
   signed char char_result = 0;
-  ASSERT_TRUE(ParseNaturalNumber(String("123"), &char_result));
+  ASSERT_TRUE(ParseNaturalNumber("123", &char_result));
   EXPECT_EQ(123, char_result);
 }
 
@@ -1187,11 +1303,30 @@ TEST(ConditionalDeathMacrosDeathTest, ExpectsDeathWhenDeathTestsAvailable) {
   EXPECT_FATAL_FAILURE(ASSERT_DEATH_IF_SUPPORTED(;, ""), "");
 }
 
-#else
+TEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInFastStyle) {
+  testing::GTEST_FLAG(death_test_style) = "fast";
+  EXPECT_FALSE(InDeathTestChild());
+  EXPECT_DEATH({
+    fprintf(stderr, InDeathTestChild() ? "Inside" : "Outside");
+    fflush(stderr);
+    _exit(1);
+  }, "Inside");
+}
+
+TEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInThreadSafeStyle) {
+  testing::GTEST_FLAG(death_test_style) = "threadsafe";
+  EXPECT_FALSE(InDeathTestChild());
+  EXPECT_DEATH({
+    fprintf(stderr, InDeathTestChild() ? "Inside" : "Outside");
+    fflush(stderr);
+    _exit(1);
+  }, "Inside");
+}
+
+#else  // !GTEST_HAS_DEATH_TEST follows
 
 using testing::internal::CaptureStderr;
 using testing::internal::GetCapturedStderr;
-using testing::internal::String;
 
 // Tests that EXPECT_DEATH_IF_SUPPORTED/ASSERT_DEATH_IF_SUPPORTED are still
 // defined but do not trigger failures when death tests are not available on
@@ -1201,7 +1336,7 @@ TEST(ConditionalDeathMacrosTest, WarnsWhenDeathTestsNotAvailable) {
   // when death tests are not supported.
   CaptureStderr();
   EXPECT_DEATH_IF_SUPPORTED(;, "");
-  String output = GetCapturedStderr();
+  std::string output = GetCapturedStderr();
   ASSERT_TRUE(NULL != strstr(output.c_str(),
                              "Death tests are not supported on this platform"));
   ASSERT_TRUE(NULL != strstr(output.c_str(), ";"));
@@ -1237,7 +1372,8 @@ TEST(ConditionalDeathMacrosTest, AssertDeatDoesNotReturnhIfUnsupported) {
   FuncWithAssert(&n);
   EXPECT_EQ(1, n);
 }
-#endif  // GTEST_HAS_DEATH_TEST
+
+#endif  // !GTEST_HAS_DEATH_TEST
 
 // Tests that the death test macros expand to code which may or may not
 // be followed by operator<<, and that in either case the complete text
@@ -1268,12 +1404,9 @@ TEST(ConditionalDeathMacrosSyntaxDeathTest, SingleStatement) {
 // Tests that conditional death test macros expand to code which interacts
 // well with switch statements.
 TEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) {
-// Microsoft compiler usually complains about switch statements without
-// case labels. We suppress that warning for this test.
-#ifdef _MSC_VER
-# pragma warning(push)
-# pragma warning(disable: 4065)
-#endif  // _MSC_VER
+  // Microsoft compiler usually complains about switch statements without
+  // case labels. We suppress that warning for this test.
+  GTEST_DISABLE_MSC_WARNINGS_PUSH_(4065)
 
   switch (0)
     default:
@@ -1284,9 +1417,7 @@ TEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) {
     case 0:
       EXPECT_DEATH_IF_SUPPORTED(_exit(1), "") << "exit in switch case";
 
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif  // _MSC_VER
+  GTEST_DISABLE_MSC_WARNINGS_POP_()
 }
 
 // Tests that a test case whose name ends with "DeathTest" works fine
index 66d4118..da72986 100755 (executable)
@@ -100,7 +100,7 @@ TEST(GetCurrentDirTest, ReturnsCurrentDir) {
 
 # else
 
-  EXPECT_STREQ(GTEST_PATH_SEP_, cwd.c_str());
+  EXPECT_EQ(GTEST_PATH_SEP_, cwd.string());
 
 # endif
 }
@@ -109,7 +109,6 @@ TEST(GetCurrentDirTest, ReturnsCurrentDir) {
 
 TEST(IsEmptyTest, ReturnsTrueForEmptyPath) {
   EXPECT_TRUE(FilePath("").IsEmpty());
-  EXPECT_TRUE(FilePath(NULL).IsEmpty());
 }
 
 TEST(IsEmptyTest, ReturnsFalseForNonEmptyPath) {
@@ -121,38 +120,38 @@ TEST(IsEmptyTest, ReturnsFalseForNonEmptyPath) {
 
 // RemoveDirectoryName "" -> ""
 TEST(RemoveDirectoryNameTest, WhenEmptyName) {
-  EXPECT_STREQ("", FilePath("").RemoveDirectoryName().c_str());
+  EXPECT_EQ("", FilePath("").RemoveDirectoryName().string());
 }
 
 // RemoveDirectoryName "afile" -> "afile"
 TEST(RemoveDirectoryNameTest, ButNoDirectory) {
-  EXPECT_STREQ("afile",
-      FilePath("afile").RemoveDirectoryName().c_str());
+  EXPECT_EQ("afile",
+      FilePath("afile").RemoveDirectoryName().string());
 }
 
 // RemoveDirectoryName "/afile" -> "afile"
 TEST(RemoveDirectoryNameTest, RootFileShouldGiveFileName) {
-  EXPECT_STREQ("afile",
-      FilePath(GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str());
+  EXPECT_EQ("afile",
+      FilePath(GTEST_PATH_SEP_ "afile").RemoveDirectoryName().string());
 }
 
 // RemoveDirectoryName "adir/" -> ""
 TEST(RemoveDirectoryNameTest, WhereThereIsNoFileName) {
-  EXPECT_STREQ("",
-      FilePath("adir" GTEST_PATH_SEP_).RemoveDirectoryName().c_str());
+  EXPECT_EQ("",
+      FilePath("adir" GTEST_PATH_SEP_).RemoveDirectoryName().string());
 }
 
 // RemoveDirectoryName "adir/afile" -> "afile"
 TEST(RemoveDirectoryNameTest, ShouldGiveFileName) {
-  EXPECT_STREQ("afile",
-      FilePath("adir" GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str());
+  EXPECT_EQ("afile",
+      FilePath("adir" GTEST_PATH_SEP_ "afile").RemoveDirectoryName().string());
 }
 
 // RemoveDirectoryName "adir/subdir/afile" -> "afile"
 TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
-  EXPECT_STREQ("afile",
+  EXPECT_EQ("afile",
       FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile")
-      .RemoveDirectoryName().c_str());
+      .RemoveDirectoryName().string());
 }
 
 #if GTEST_HAS_ALT_PATH_SEP_
@@ -162,26 +161,23 @@ TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
 
 // RemoveDirectoryName("/afile") -> "afile"
 TEST(RemoveDirectoryNameTest, RootFileShouldGiveFileNameForAlternateSeparator) {
-  EXPECT_STREQ("afile",
-               FilePath("/afile").RemoveDirectoryName().c_str());
+  EXPECT_EQ("afile", FilePath("/afile").RemoveDirectoryName().string());
 }
 
 // RemoveDirectoryName("adir/") -> ""
 TEST(RemoveDirectoryNameTest, WhereThereIsNoFileNameForAlternateSeparator) {
-  EXPECT_STREQ("",
-               FilePath("adir/").RemoveDirectoryName().c_str());
+  EXPECT_EQ("", FilePath("adir/").RemoveDirectoryName().string());
 }
 
 // RemoveDirectoryName("adir/afile") -> "afile"
 TEST(RemoveDirectoryNameTest, ShouldGiveFileNameForAlternateSeparator) {
-  EXPECT_STREQ("afile",
-               FilePath("adir/afile").RemoveDirectoryName().c_str());
+  EXPECT_EQ("afile", FilePath("adir/afile").RemoveDirectoryName().string());
 }
 
 // RemoveDirectoryName("adir/subdir/afile") -> "afile"
 TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileNameForAlternateSeparator) {
-  EXPECT_STREQ("afile",
-               FilePath("adir/subdir/afile").RemoveDirectoryName().c_str());
+  EXPECT_EQ("afile",
+            FilePath("adir/subdir/afile").RemoveDirectoryName().string());
 }
 
 #endif
@@ -190,38 +186,35 @@ TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileNameForAlternateSeparator) {
 TEST(RemoveFileNameTest, EmptyName) {
 #if GTEST_OS_WINDOWS_MOBILE
   // On Windows CE, we use the root as the current directory.
-  EXPECT_STREQ(GTEST_PATH_SEP_,
-      FilePath("").RemoveFileName().c_str());
+  EXPECT_EQ(GTEST_PATH_SEP_, FilePath("").RemoveFileName().string());
 #else
-  EXPECT_STREQ("." GTEST_PATH_SEP_,
-      FilePath("").RemoveFileName().c_str());
+  EXPECT_EQ("." GTEST_PATH_SEP_, FilePath("").RemoveFileName().string());
 #endif
 }
 
 // RemoveFileName "adir/" -> "adir/"
 TEST(RemoveFileNameTest, ButNoFile) {
-  EXPECT_STREQ("adir" GTEST_PATH_SEP_,
-      FilePath("adir" GTEST_PATH_SEP_).RemoveFileName().c_str());
+  EXPECT_EQ("adir" GTEST_PATH_SEP_,
+      FilePath("adir" GTEST_PATH_SEP_).RemoveFileName().string());
 }
 
 // RemoveFileName "adir/afile" -> "adir/"
 TEST(RemoveFileNameTest, GivesDirName) {
-  EXPECT_STREQ("adir" GTEST_PATH_SEP_,
-      FilePath("adir" GTEST_PATH_SEP_ "afile")
-      .RemoveFileName().c_str());
+  EXPECT_EQ("adir" GTEST_PATH_SEP_,
+            FilePath("adir" GTEST_PATH_SEP_ "afile").RemoveFileName().string());
 }
 
 // RemoveFileName "adir/subdir/afile" -> "adir/subdir/"
 TEST(RemoveFileNameTest, GivesDirAndSubDirName) {
-  EXPECT_STREQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_,
+  EXPECT_EQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_,
       FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile")
-      .RemoveFileName().c_str());
+      .RemoveFileName().string());
 }
 
 // RemoveFileName "/afile" -> "/"
 TEST(RemoveFileNameTest, GivesRootDir) {
-  EXPECT_STREQ(GTEST_PATH_SEP_,
-      FilePath(GTEST_PATH_SEP_ "afile").RemoveFileName().c_str());
+  EXPECT_EQ(GTEST_PATH_SEP_,
+      FilePath(GTEST_PATH_SEP_ "afile").RemoveFileName().string());
 }
 
 #if GTEST_HAS_ALT_PATH_SEP_
@@ -231,26 +224,25 @@ TEST(RemoveFileNameTest, GivesRootDir) {
 
 // RemoveFileName("adir/") -> "adir/"
 TEST(RemoveFileNameTest, ButNoFileForAlternateSeparator) {
-  EXPECT_STREQ("adir" GTEST_PATH_SEP_,
-               FilePath("adir/").RemoveFileName().c_str());
+  EXPECT_EQ("adir" GTEST_PATH_SEP_,
+            FilePath("adir/").RemoveFileName().string());
 }
 
 // RemoveFileName("adir/afile") -> "adir/"
 TEST(RemoveFileNameTest, GivesDirNameForAlternateSeparator) {
-  EXPECT_STREQ("adir" GTEST_PATH_SEP_,
-               FilePath("adir/afile").RemoveFileName().c_str());
+  EXPECT_EQ("adir" GTEST_PATH_SEP_,
+            FilePath("adir/afile").RemoveFileName().string());
 }
 
 // RemoveFileName("adir/subdir/afile") -> "adir/subdir/"
 TEST(RemoveFileNameTest, GivesDirAndSubDirNameForAlternateSeparator) {
-  EXPECT_STREQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_,
-               FilePath("adir/subdir/afile").RemoveFileName().c_str());
+  EXPECT_EQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_,
+            FilePath("adir/subdir/afile").RemoveFileName().string());
 }
 
 // RemoveFileName("/afile") -> "\"
 TEST(RemoveFileNameTest, GivesRootDirForAlternateSeparator) {
-  EXPECT_STREQ(GTEST_PATH_SEP_,
-               FilePath("/afile").RemoveFileName().c_str());
+  EXPECT_EQ(GTEST_PATH_SEP_, FilePath("/afile").RemoveFileName().string());
 }
 
 #endif
@@ -258,125 +250,120 @@ TEST(RemoveFileNameTest, GivesRootDirForAlternateSeparator) {
 TEST(MakeFileNameTest, GenerateWhenNumberIsZero) {
   FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"),
       0, "xml");
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.string());
 }
 
 TEST(MakeFileNameTest, GenerateFileNameNumberGtZero) {
   FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"),
       12, "xml");
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.string());
 }
 
 TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberIsZero) {
   FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_),
       FilePath("bar"), 0, "xml");
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.string());
 }
 
 TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberGtZero) {
   FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_),
       FilePath("bar"), 12, "xml");
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.string());
 }
 
 TEST(MakeFileNameTest, GenerateWhenNumberIsZeroAndDirIsEmpty) {
   FilePath actual = FilePath::MakeFileName(FilePath(""), FilePath("bar"),
       0, "xml");
-  EXPECT_STREQ("bar.xml", actual.c_str());
+  EXPECT_EQ("bar.xml", actual.string());
 }
 
 TEST(MakeFileNameTest, GenerateWhenNumberIsNotZeroAndDirIsEmpty) {
   FilePath actual = FilePath::MakeFileName(FilePath(""), FilePath("bar"),
       14, "xml");
-  EXPECT_STREQ("bar_14.xml", actual.c_str());
+  EXPECT_EQ("bar_14.xml", actual.string());
 }
 
 TEST(ConcatPathsTest, WorksWhenDirDoesNotEndWithPathSep) {
   FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
                                           FilePath("bar.xml"));
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.string());
 }
 
 TEST(ConcatPathsTest, WorksWhenPath1EndsWithPathSep) {
   FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_),
                                           FilePath("bar.xml"));
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.string());
 }
 
 TEST(ConcatPathsTest, Path1BeingEmpty) {
   FilePath actual = FilePath::ConcatPaths(FilePath(""),
                                           FilePath("bar.xml"));
-  EXPECT_STREQ("bar.xml", actual.c_str());
+  EXPECT_EQ("bar.xml", actual.string());
 }
 
 TEST(ConcatPathsTest, Path2BeingEmpty) {
-  FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
-                                          FilePath(""));
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_, actual.c_str());
+  FilePath actual = FilePath::ConcatPaths(FilePath("foo"), FilePath(""));
+  EXPECT_EQ("foo" GTEST_PATH_SEP_, actual.string());
 }
 
 TEST(ConcatPathsTest, BothPathBeingEmpty) {
   FilePath actual = FilePath::ConcatPaths(FilePath(""),
                                           FilePath(""));
-  EXPECT_STREQ("", actual.c_str());
+  EXPECT_EQ("", actual.string());
 }
 
 TEST(ConcatPathsTest, Path1ContainsPathSep) {
   FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_ "bar"),
                                           FilePath("foobar.xml"));
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "foobar.xml",
-               actual.c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "foobar.xml",
+            actual.string());
 }
 
 TEST(ConcatPathsTest, Path2ContainsPathSep) {
   FilePath actual = FilePath::ConcatPaths(
       FilePath("foo" GTEST_PATH_SEP_),
       FilePath("bar" GTEST_PATH_SEP_ "bar.xml"));
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "bar.xml",
-               actual.c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "bar.xml",
+            actual.string());
 }
 
 TEST(ConcatPathsTest, Path2EndsWithPathSep) {
   FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
                                           FilePath("bar" GTEST_PATH_SEP_));
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_, actual.c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_, actual.string());
 }
 
 // RemoveTrailingPathSeparator "" -> ""
 TEST(RemoveTrailingPathSeparatorTest, EmptyString) {
-  EXPECT_STREQ("",
-      FilePath("").RemoveTrailingPathSeparator().c_str());
+  EXPECT_EQ("", FilePath("").RemoveTrailingPathSeparator().string());
 }
 
 // RemoveTrailingPathSeparator "foo" -> "foo"
 TEST(RemoveTrailingPathSeparatorTest, FileNoSlashString) {
-  EXPECT_STREQ("foo",
-      FilePath("foo").RemoveTrailingPathSeparator().c_str());
+  EXPECT_EQ("foo", FilePath("foo").RemoveTrailingPathSeparator().string());
 }
 
 // RemoveTrailingPathSeparator "foo/" -> "foo"
 TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveTrailingSeparator) {
-  EXPECT_STREQ(
-      "foo",
-      FilePath("foo" GTEST_PATH_SEP_).RemoveTrailingPathSeparator().c_str());
+  EXPECT_EQ("foo",
+      FilePath("foo" GTEST_PATH_SEP_).RemoveTrailingPathSeparator().string());
 #if GTEST_HAS_ALT_PATH_SEP_
-  EXPECT_STREQ("foo",
-               FilePath("foo/").RemoveTrailingPathSeparator().c_str());
+  EXPECT_EQ("foo", FilePath("foo/").RemoveTrailingPathSeparator().string());
 #endif
 }
 
 // RemoveTrailingPathSeparator "foo/bar/" -> "foo/bar/"
 TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveLastSeparator) {
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
-               FilePath("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_)
-               .RemoveTrailingPathSeparator().c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar",
+            FilePath("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_)
+                .RemoveTrailingPathSeparator().string());
 }
 
 // RemoveTrailingPathSeparator "foo/bar" -> "foo/bar"
 TEST(RemoveTrailingPathSeparatorTest, ShouldReturnUnmodified) {
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
-               FilePath("foo" GTEST_PATH_SEP_ "bar")
-               .RemoveTrailingPathSeparator().c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar",
+            FilePath("foo" GTEST_PATH_SEP_ "bar")
+                .RemoveTrailingPathSeparator().string());
 }
 
 TEST(DirectoryTest, RootDirectoryExists) {
@@ -431,40 +418,35 @@ TEST(DirectoryTest, CurrentDirectoryExists) {
 #endif  // GTEST_OS_WINDOWS
 }
 
-TEST(NormalizeTest, NullStringsEqualEmptyDirectory) {
-  EXPECT_STREQ("", FilePath(NULL).c_str());
-  EXPECT_STREQ("", FilePath(String(NULL)).c_str());
-}
-
 // "foo/bar" == foo//bar" == "foo///bar"
 TEST(NormalizeTest, MultipleConsecutiveSepaparatorsInMidstring) {
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
-               FilePath("foo" GTEST_PATH_SEP_ "bar").c_str());
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
-               FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
-               FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_
-                        GTEST_PATH_SEP_ "bar").c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar",
+            FilePath("foo" GTEST_PATH_SEP_ "bar").string());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar",
+            FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").string());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar",
+            FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_
+                     GTEST_PATH_SEP_ "bar").string());
 }
 
 // "/bar" == //bar" == "///bar"
 TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringStart) {
-  EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
-    FilePath(GTEST_PATH_SEP_ "bar").c_str());
-  EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
-    FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
-  EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
-    FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
+  EXPECT_EQ(GTEST_PATH_SEP_ "bar",
+    FilePath(GTEST_PATH_SEP_ "bar").string());
+  EXPECT_EQ(GTEST_PATH_SEP_ "bar",
+    FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").string());
+  EXPECT_EQ(GTEST_PATH_SEP_ "bar",
+    FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").string());
 }
 
 // "foo/" == foo//" == "foo///"
 TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringEnd) {
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_,
-    FilePath("foo" GTEST_PATH_SEP_).c_str());
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_,
-    FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str());
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_,
-    FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_,
+    FilePath("foo" GTEST_PATH_SEP_).string());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_,
+    FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_).string());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_,
+    FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_).string());
 }
 
 #if GTEST_HAS_ALT_PATH_SEP_
@@ -473,12 +455,12 @@ TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringEnd) {
 // regardless of their combination (e.g. "foo\" =="foo/\" ==
 // "foo\\/").
 TEST(NormalizeTest, MixAlternateSeparatorAtStringEnd) {
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_,
-               FilePath("foo/").c_str());
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_,
-               FilePath("foo" GTEST_PATH_SEP_ "/").c_str());
-  EXPECT_STREQ("foo" GTEST_PATH_SEP_,
-               FilePath("foo//" GTEST_PATH_SEP_).c_str());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_,
+            FilePath("foo/").string());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_,
+            FilePath("foo" GTEST_PATH_SEP_ "/").string());
+  EXPECT_EQ("foo" GTEST_PATH_SEP_,
+            FilePath("foo//" GTEST_PATH_SEP_).string());
 }
 
 #endif
@@ -487,31 +469,31 @@ TEST(AssignmentOperatorTest, DefaultAssignedToNonDefault) {
   FilePath default_path;
   FilePath non_default_path("path");
   non_default_path = default_path;
-  EXPECT_STREQ("", non_default_path.c_str());
-  EXPECT_STREQ("", default_path.c_str());  // RHS var is unchanged.
+  EXPECT_EQ("", non_default_path.string());
+  EXPECT_EQ("", default_path.string());  // RHS var is unchanged.
 }
 
 TEST(AssignmentOperatorTest, NonDefaultAssignedToDefault) {
   FilePath non_default_path("path");
   FilePath default_path;
   default_path = non_default_path;
-  EXPECT_STREQ("path", default_path.c_str());
-  EXPECT_STREQ("path", non_default_path.c_str());  // RHS var is unchanged.
+  EXPECT_EQ("path", default_path.string());
+  EXPECT_EQ("path", non_default_path.string());  // RHS var is unchanged.
 }
 
 TEST(AssignmentOperatorTest, ConstAssignedToNonConst) {
   const FilePath const_default_path("const_path");
   FilePath non_default_path("path");
   non_default_path = const_default_path;
-  EXPECT_STREQ("const_path", non_default_path.c_str());
+  EXPECT_EQ("const_path", non_default_path.string());
 }
 
 class DirectoryCreationTest : public Test {
  protected:
   virtual void SetUp() {
-    testdata_path_.Set(FilePath(String::Format("%s%s%s",
-        TempDir().c_str(), GetCurrentExecutableName().c_str(),
-        "_directory_creation" GTEST_PATH_SEP_ "test" GTEST_PATH_SEP_)));
+    testdata_path_.Set(FilePath(
+        TempDir() + GetCurrentExecutableName().string() +
+        "_directory_creation" GTEST_PATH_SEP_ "test" GTEST_PATH_SEP_));
     testdata_file_.Set(testdata_path_.RemoveTrailingPathSeparator());
 
     unique_file0_.Set(FilePath::MakeFileName(testdata_path_, FilePath("unique"),
@@ -532,22 +514,6 @@ class DirectoryCreationTest : public Test {
     posix::RmDir(testdata_path_.c_str());
   }
 
-  String TempDir() const {
-#if GTEST_OS_WINDOWS_MOBILE
-    return String("\\temp\\");
-#elif GTEST_OS_WINDOWS
-    const char* temp_dir = posix::GetEnv("TEMP");
-    if (temp_dir == NULL || temp_dir[0] == '\0')
-      return String("\\temp\\");
-    else if (String(temp_dir).EndsWith("\\"))
-      return String(temp_dir);
-    else
-      return String::Format("%s\\", temp_dir);
-#else
-    return String("/tmp/");
-#endif  // GTEST_OS_WINDOWS_MOBILE
-  }
-
   void CreateTextFile(const char* filename) {
     FILE* f = posix::FOpen(filename, "w");
     fprintf(f, "text\n");
@@ -564,13 +530,13 @@ class DirectoryCreationTest : public Test {
 };
 
 TEST_F(DirectoryCreationTest, CreateDirectoriesRecursively) {
-  EXPECT_FALSE(testdata_path_.DirectoryExists()) << testdata_path_.c_str();
+  EXPECT_FALSE(testdata_path_.DirectoryExists()) << testdata_path_.string();
   EXPECT_TRUE(testdata_path_.CreateDirectoriesRecursively());
   EXPECT_TRUE(testdata_path_.DirectoryExists());
 }
 
 TEST_F(DirectoryCreationTest, CreateDirectoriesForAlreadyExistingPath) {
-  EXPECT_FALSE(testdata_path_.DirectoryExists()) << testdata_path_.c_str();
+  EXPECT_FALSE(testdata_path_.DirectoryExists()) << testdata_path_.string();
   EXPECT_TRUE(testdata_path_.CreateDirectoriesRecursively());
   // Call 'create' again... should still succeed.
   EXPECT_TRUE(testdata_path_.CreateDirectoriesRecursively());
@@ -579,7 +545,7 @@ TEST_F(DirectoryCreationTest, CreateDirectoriesForAlreadyExistingPath) {
 TEST_F(DirectoryCreationTest, CreateDirectoriesAndUniqueFilename) {
   FilePath file_path(FilePath::GenerateUniqueFileName(testdata_path_,
       FilePath("unique"), "txt"));
-  EXPECT_STREQ(unique_file0_.c_str(), file_path.c_str());
+  EXPECT_EQ(unique_file0_.string(), file_path.string());
   EXPECT_FALSE(file_path.FileOrDirectoryExists());  // file not there
 
   testdata_path_.CreateDirectoriesRecursively();
@@ -589,7 +555,7 @@ TEST_F(DirectoryCreationTest, CreateDirectoriesAndUniqueFilename) {
 
   FilePath file_path2(FilePath::GenerateUniqueFileName(testdata_path_,
       FilePath("unique"), "txt"));
-  EXPECT_STREQ(unique_file1_.c_str(), file_path2.c_str());
+  EXPECT_EQ(unique_file1_.string(), file_path2.string());
   EXPECT_FALSE(file_path2.FileOrDirectoryExists());  // file not there
   CreateTextFile(file_path2.c_str());
   EXPECT_TRUE(file_path2.FileOrDirectoryExists());
@@ -610,43 +576,43 @@ TEST(NoDirectoryCreationTest, CreateNoDirectoriesForDefaultXmlFile) {
 
 TEST(FilePathTest, DefaultConstructor) {
   FilePath fp;
-  EXPECT_STREQ("", fp.c_str());
+  EXPECT_EQ("", fp.string());
 }
 
 TEST(FilePathTest, CharAndCopyConstructors) {
   const FilePath fp("spicy");
-  EXPECT_STREQ("spicy", fp.c_str());
+  EXPECT_EQ("spicy", fp.string());
 
   const FilePath fp_copy(fp);
-  EXPECT_STREQ("spicy", fp_copy.c_str());
+  EXPECT_EQ("spicy", fp_copy.string());
 }
 
 TEST(FilePathTest, StringConstructor) {
-  const FilePath fp(String("cider"));
-  EXPECT_STREQ("cider", fp.c_str());
+  const FilePath fp(std::string("cider"));
+  EXPECT_EQ("cider", fp.string());
 }
 
 TEST(FilePathTest, Set) {
   const FilePath apple("apple");
   FilePath mac("mac");
   mac.Set(apple);  // Implement Set() since overloading operator= is forbidden.
-  EXPECT_STREQ("apple", mac.c_str());
-  EXPECT_STREQ("apple", apple.c_str());
+  EXPECT_EQ("apple", mac.string());
+  EXPECT_EQ("apple", apple.string());
 }
 
 TEST(FilePathTest, ToString) {
   const FilePath file("drink");
-  String str(file.ToString());
-  EXPECT_STREQ("drink", str.c_str());
+  EXPECT_EQ("drink", file.string());
 }
 
 TEST(FilePathTest, RemoveExtension) {
-  EXPECT_STREQ("app", FilePath("app.exe").RemoveExtension("exe").c_str());
-  EXPECT_STREQ("APP", FilePath("APP.EXE").RemoveExtension("exe").c_str());
+  EXPECT_EQ("app", FilePath("app.cc").RemoveExtension("cc").string());
+  EXPECT_EQ("app", FilePath("app.exe").RemoveExtension("exe").string());
+  EXPECT_EQ("APP", FilePath("APP.EXE").RemoveExtension("exe").string());
 }
 
 TEST(FilePathTest, RemoveExtensionWhenThereIsNoExtension) {
-  EXPECT_STREQ("app", FilePath("app").RemoveExtension("exe").c_str());
+  EXPECT_EQ("app", FilePath("app").RemoveExtension("exe").string());
 }
 
 TEST(FilePathTest, IsDirectory) {
index 0d5508a..6fcf512 100755 (executable)
@@ -148,8 +148,7 @@ TEST_F(LinkedPtrTest, GeneralTest) {
     "A0 dtor\n"
     "A3 dtor\n"
     "A1 dtor\n",
-    history->GetString().c_str()
-  );
+    history->GetString().c_str());
 }
 
 }  // Unnamed namespace
index 2aa08ef..9074768 100755 (executable)
@@ -45,17 +45,16 @@ using ::testing::TestEventListener;
 using ::testing::TestInfo;
 using ::testing::TestPartResult;
 using ::testing::UnitTest;
-using ::testing::internal::String;
 
 // Used by tests to register their events.
-std::vector<String>* g_events = NULL;
+std::vector<std::string>* g_events = NULL;
 
 namespace testing {
 namespace internal {
 
 class EventRecordingListener : public TestEventListener {
  public:
-  EventRecordingListener(const char* name) : name_(name) {}
+  explicit EventRecordingListener(const char* name) : name_(name) {}
 
  protected:
   virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {
@@ -119,54 +118,52 @@ class EventRecordingListener : public TestEventListener {
   }
 
  private:
-  String GetFullMethodName(const char* name) {
-    Message message;
-    message << name_ << "." << name;
-    return message.GetString();
+  std::string GetFullMethodName(const char* name) {
+    return name_ + "." + name;
   }
 
-  String name_;
+  std::string name_;
 };
 
 class EnvironmentInvocationCatcher : public Environment {
  protected:
   virtual void SetUp() {
-    g_events->push_back(String("Environment::SetUp"));
+    g_events->push_back("Environment::SetUp");
   }
 
   virtual void TearDown() {
-    g_events->push_back(String("Environment::TearDown"));
+    g_events->push_back("Environment::TearDown");
   }
 };
 
 class ListenerTest : public Test {
  protected:
   static void SetUpTestCase() {
-    g_events->push_back(String("ListenerTest::SetUpTestCase"));
+    g_events->push_back("ListenerTest::SetUpTestCase");
   }
 
   static void TearDownTestCase() {
-    g_events->push_back(String("ListenerTest::TearDownTestCase"));
+    g_events->push_back("ListenerTest::TearDownTestCase");
   }
 
   virtual void SetUp() {
-    g_events->push_back(String("ListenerTest::SetUp"));
+    g_events->push_back("ListenerTest::SetUp");
   }
 
   virtual void TearDown() {
-    g_events->push_back(String("ListenerTest::TearDown"));
+    g_events->push_back("ListenerTest::TearDown");
   }
 };
 
 TEST_F(ListenerTest, DoesFoo) {
   // Test execution order within a test case is not guaranteed so we are not
   // recording the test name.
-  g_events->push_back(String("ListenerTest::* Test Body"));
+  g_events->push_back("ListenerTest::* Test Body");
   SUCCEED();  // Triggers OnTestPartResult.
 }
 
 TEST_F(ListenerTest, DoesBar) {
-  g_events->push_back(String("ListenerTest::* Test Body"));
+  g_events->push_back("ListenerTest::* Test Body");
   SUCCEED();  // Triggers OnTestPartResult.
 }
 
@@ -177,18 +174,18 @@ TEST_F(ListenerTest, DoesBar) {
 using ::testing::internal::EnvironmentInvocationCatcher;
 using ::testing::internal::EventRecordingListener;
 
-void VerifyResults(const std::vector<String>& data,
+void VerifyResults(const std::vector<std::string>& data,
                    const char* const* expected_data,
-                   int expected_data_size) {
-  const int actual_size = data.size();
+                   size_t expected_data_size) {
+  const size_t actual_size = data.size();
   // If the following assertion fails, a new entry will be appended to
   // data.  Hence we save data.size() first.
   EXPECT_EQ(expected_data_size, actual_size);
 
   // Compares the common prefix.
-  const int shorter_size = expected_data_size <= actual_size ?
+  const size_t shorter_size = expected_data_size <= actual_size ?
       expected_data_size : actual_size;
-  int i = 0;
+  size_t i = 0;
   for (; i < shorter_size; ++i) {
     ASSERT_STREQ(expected_data[i], data[i].c_str())
         << "at position " << i;
@@ -196,12 +193,13 @@ void VerifyResults(const std::vector<String>& data,
 
   // Prints extra elements in the actual data.
   for (; i < actual_size; ++i) {
-    printf("  Actual event #%d: %s\n", i, data[i].c_str());
+    printf("  Actual event #%lu: %s\n",
+        static_cast<unsigned long>(i), data[i].c_str());
   }
 }
 
 int main(int argc, char **argv) {
-  std::vector<String> events;
+  std::vector<std::string> events;
   g_events = &events;
   InitGoogleTest(&argc, argv);
 
index c09c6a8..175238e 100755 (executable)
@@ -39,79 +39,72 @@ namespace {
 
 using ::testing::Message;
 
-// A helper function that turns a Message into a C string.
-const char* ToCString(const Message& msg) {
-  static testing::internal::String result;
-  result = msg.GetString();
-  return result.c_str();
-}
-
 // Tests the testing::Message class
 
 // Tests the default constructor.
 TEST(MessageTest, DefaultConstructor) {
   const Message msg;
-  EXPECT_STREQ("", ToCString(msg));
+  EXPECT_EQ("", msg.GetString());
 }
 
 // Tests the copy constructor.
 TEST(MessageTest, CopyConstructor) {
   const Message msg1("Hello");
   const Message msg2(msg1);
-  EXPECT_STREQ("Hello", ToCString(msg2));
+  EXPECT_EQ("Hello", msg2.GetString());
 }
 
 // Tests constructing a Message from a C-string.
 TEST(MessageTest, ConstructsFromCString) {
   Message msg("Hello");
-  EXPECT_STREQ("Hello", ToCString(msg));
+  EXPECT_EQ("Hello", msg.GetString());
 }
 
 // Tests streaming a float.
 TEST(MessageTest, StreamsFloat) {
-  const char* const s = ToCString(Message() << 1.23456F << " " << 2.34567F);
+  const std::string s = (Message() << 1.23456F << " " << 2.34567F).GetString();
   // Both numbers should be printed with enough precision.
-  EXPECT_PRED_FORMAT2(testing::IsSubstring, "1.234560", s);
-  EXPECT_PRED_FORMAT2(testing::IsSubstring, " 2.345669", s);
+  EXPECT_PRED_FORMAT2(testing::IsSubstring, "1.234560", s.c_str());
+  EXPECT_PRED_FORMAT2(testing::IsSubstring, " 2.345669", s.c_str());
 }
 
 // Tests streaming a double.
 TEST(MessageTest, StreamsDouble) {
-  const char* const s = ToCString(Message() << 1260570880.4555497 << " "
-                                  << 1260572265.1954534);
+  const std::string s = (Message() << 1260570880.4555497 << " "
+                                  << 1260572265.1954534).GetString();
   // Both numbers should be printed with enough precision.
-  EXPECT_PRED_FORMAT2(testing::IsSubstring, "1260570880.45", s);
-  EXPECT_PRED_FORMAT2(testing::IsSubstring, " 1260572265.19", s);
+  EXPECT_PRED_FORMAT2(testing::IsSubstring, "1260570880.45", s.c_str());
+  EXPECT_PRED_FORMAT2(testing::IsSubstring, " 1260572265.19", s.c_str());
 }
 
 // Tests streaming a non-char pointer.
 TEST(MessageTest, StreamsPointer) {
   int n = 0;
   int* p = &n;
-  EXPECT_STRNE("(null)", ToCString(Message() << p));
+  EXPECT_NE("(null)", (Message() << p).GetString());
 }
 
 // Tests streaming a NULL non-char pointer.
 TEST(MessageTest, StreamsNullPointer) {
   int* p = NULL;
-  EXPECT_STREQ("(null)", ToCString(Message() << p));
+  EXPECT_EQ("(null)", (Message() << p).GetString());
 }
 
 // Tests streaming a C string.
 TEST(MessageTest, StreamsCString) {
-  EXPECT_STREQ("Foo", ToCString(Message() << "Foo"));
+  EXPECT_EQ("Foo", (Message() << "Foo").GetString());
 }
 
 // Tests streaming a NULL C string.
 TEST(MessageTest, StreamsNullCString) {
   char* p = NULL;
-  EXPECT_STREQ("(null)", ToCString(Message() << p));
+  EXPECT_EQ("(null)", (Message() << p).GetString());
 }
 
 // Tests streaming std::string.
 TEST(MessageTest, StreamsString) {
   const ::std::string str("Hello");
-  EXPECT_STREQ("Hello", ToCString(Message() << str));
+  EXPECT_EQ("Hello", (Message() << str).GetString());
 }
 
 // Tests that we can output strings containing embedded NULs.
@@ -120,34 +113,34 @@ TEST(MessageTest, StreamsStringWithEmbeddedNUL) {
       "Here's a NUL\0 and some more string";
   const ::std::string string_with_nul(char_array_with_nul,
                                       sizeof(char_array_with_nul) - 1);
-  EXPECT_STREQ("Here's a NUL\\0 and some more string",
-               ToCString(Message() << string_with_nul));
+  EXPECT_EQ("Here's a NUL\\0 and some more string",
+            (Message() << string_with_nul).GetString());
 }
 
 // Tests streaming a NUL char.
 TEST(MessageTest, StreamsNULChar) {
-  EXPECT_STREQ("\\0", ToCString(Message() << '\0'));
+  EXPECT_EQ("\\0", (Message() << '\0').GetString());
 }
 
 // Tests streaming int.
 TEST(MessageTest, StreamsInt) {
-  EXPECT_STREQ("123", ToCString(Message() << 123));
+  EXPECT_EQ("123", (Message() << 123).GetString());
 }
 
 // Tests that basic IO manipulators (endl, ends, and flush) can be
 // streamed to Message.
 TEST(MessageTest, StreamsBasicIoManip) {
-  EXPECT_STREQ("Line 1.\nA NUL char \\0 in line 2.",
-               ToCString(Message() << "Line 1." << std::endl
+  EXPECT_EQ("Line 1.\nA NUL char \\0 in line 2.",
+               (Message() << "Line 1." << std::endl
                          << "A NUL char " << std::ends << std::flush
-                         << " in line 2."));
+                         << " in line 2.").GetString());
 }
 
 // Tests Message::GetString()
 TEST(MessageTest, GetString) {
   Message msg;
   msg << 1 << " lamb";
-  EXPECT_STREQ("1 lamb", msg.GetString().c_str());
+  EXPECT_EQ("1 lamb", msg.GetString());
 }
 
 // Tests streaming a Message object to an ostream.
@@ -155,7 +148,7 @@ TEST(MessageTest, StreamsToOStream) {
   Message msg("Hello");
   ::std::stringstream ss;
   ss << msg;
-  EXPECT_STREQ("Hello", testing::internal::StringStreamToString(&ss).c_str());
+  EXPECT_EQ("Hello", testing::internal::StringStreamToString(&ss));
 }
 
 // Tests that a Message object doesn't take up too much stack space.
index 9e98f3f..5586dc3 100755 (executable)
@@ -78,14 +78,14 @@ TEST(XmlOutputTest, GetOutputFormat) {
 
 TEST(XmlOutputTest, GetOutputFileDefault) {
   GTEST_FLAG(output) = "";
-  EXPECT_STREQ(GetAbsolutePathOf(FilePath("test_detail.xml")).c_str(),
-               UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+  EXPECT_EQ(GetAbsolutePathOf(FilePath("test_detail.xml")).string(),
+            UnitTestOptions::GetAbsolutePathToOutputFile());
 }
 
 TEST(XmlOutputTest, GetOutputFileSingleFile) {
   GTEST_FLAG(output) = "xml:filename.abc";
-  EXPECT_STREQ(GetAbsolutePathOf(FilePath("filename.abc")).c_str(),
-               UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+  EXPECT_EQ(GetAbsolutePathOf(FilePath("filename.abc")).string(),
+            UnitTestOptions::GetAbsolutePathToOutputFile());
 }
 
 TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) {
@@ -93,8 +93,9 @@ TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) {
   const std::string expected_output_file =
       GetAbsolutePathOf(
           FilePath(std::string("path") + GTEST_PATH_SEP_ +
-                   GetCurrentExecutableName().c_str() + ".xml")).c_str();
-  const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
+                   GetCurrentExecutableName().string() + ".xml")).string();
+  const std::string& output_file =
+      UnitTestOptions::GetAbsolutePathToOutputFile();
 #if GTEST_OS_WINDOWS
   EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str());
 #else
@@ -103,7 +104,7 @@ TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) {
 }
 
 TEST(OutputFileHelpersTest, GetCurrentExecutableName) {
-  const std::string exe_str = GetCurrentExecutableName().c_str();
+  const std::string exe_str = GetCurrentExecutableName().string();
 #if GTEST_OS_WINDOWS
   const bool success =
       _strcmpi("gtest-options_test", exe_str.c_str()) == 0 ||
@@ -129,12 +130,12 @@ class XmlOutputChangeDirTest : public Test {
     original_working_dir_ = FilePath::GetCurrentDir();
     posix::ChDir("..");
     // This will make the test fail if run from the root directory.
-    EXPECT_STRNE(original_working_dir_.c_str(),
-                 FilePath::GetCurrentDir().c_str());
+    EXPECT_NE(original_working_dir_.string(),
+              FilePath::GetCurrentDir().string());
   }
 
   virtual void TearDown() {
-    posix::ChDir(original_working_dir_.c_str());
+    posix::ChDir(original_working_dir_.string().c_str());
   }
 
   FilePath original_working_dir_;
@@ -142,23 +143,23 @@ class XmlOutputChangeDirTest : public Test {
 
 TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefault) {
   GTEST_FLAG(output) = "";
-  EXPECT_STREQ(FilePath::ConcatPaths(original_working_dir_,
-                                     FilePath("test_detail.xml")).c_str(),
-               UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+  EXPECT_EQ(FilePath::ConcatPaths(original_working_dir_,
+                                  FilePath("test_detail.xml")).string(),
+            UnitTestOptions::GetAbsolutePathToOutputFile());
 }
 
 TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefaultXML) {
   GTEST_FLAG(output) = "xml";
-  EXPECT_STREQ(FilePath::ConcatPaths(original_working_dir_,
-                                     FilePath("test_detail.xml")).c_str(),
-               UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+  EXPECT_EQ(FilePath::ConcatPaths(original_working_dir_,
+                                  FilePath("test_detail.xml")).string(),
+            UnitTestOptions::GetAbsolutePathToOutputFile());
 }
 
 TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativeFile) {
   GTEST_FLAG(output) = "xml:filename.abc";
-  EXPECT_STREQ(FilePath::ConcatPaths(original_working_dir_,
-                                     FilePath("filename.abc")).c_str(),
-               UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+  EXPECT_EQ(FilePath::ConcatPaths(original_working_dir_,
+                                  FilePath("filename.abc")).string(),
+            UnitTestOptions::GetAbsolutePathToOutputFile());
 }
 
 TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) {
@@ -167,8 +168,9 @@ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) {
       FilePath::ConcatPaths(
           original_working_dir_,
           FilePath(std::string("path") + GTEST_PATH_SEP_ +
-                   GetCurrentExecutableName().c_str() + ".xml")).c_str();
-  const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
+                   GetCurrentExecutableName().string() + ".xml")).string();
+  const std::string& output_file =
+      UnitTestOptions::GetAbsolutePathToOutputFile();
 #if GTEST_OS_WINDOWS
   EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str());
 #else
@@ -179,12 +181,12 @@ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) {
 TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsoluteFile) {
 #if GTEST_OS_WINDOWS
   GTEST_FLAG(output) = "xml:c:\\tmp\\filename.abc";
-  EXPECT_STREQ(FilePath("c:\\tmp\\filename.abc").c_str(),
-               UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+  EXPECT_EQ(FilePath("c:\\tmp\\filename.abc").string(),
+            UnitTestOptions::GetAbsolutePathToOutputFile());
 #else
   GTEST_FLAG(output) ="xml:/tmp/filename.abc";
-  EXPECT_STREQ(FilePath("/tmp/filename.abc").c_str(),
-               UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
+  EXPECT_EQ(FilePath("/tmp/filename.abc").string(),
+            UnitTestOptions::GetAbsolutePathToOutputFile());
 #endif
 }
 
@@ -197,8 +199,9 @@ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolutePath) {
 
   GTEST_FLAG(output) = "xml:" + path;
   const std::string expected_output_file =
-      path + GetCurrentExecutableName().c_str() + ".xml";
-  const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
+      path + GetCurrentExecutableName().string() + ".xml";
+  const std::string& output_file =
+      UnitTestOptions::GetAbsolutePathToOutputFile();
 
 #if GTEST_OS_WINDOWS
   EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str());
index 94a53d9..8b278bb 100755 (executable)
@@ -64,9 +64,9 @@ using ::testing::ValuesIn;
 
 # if GTEST_HAS_COMBINE
 using ::testing::Combine;
-using ::std::tr1::get;
-using ::std::tr1::make_tuple;
-using ::std::tr1::tuple;
+using ::testing::get;
+using ::testing::make_tuple;
+using ::testing::tuple;
 # endif  // GTEST_HAS_COMBINE
 
 using ::testing::internal::ParamGenerator;
@@ -280,10 +280,10 @@ class DogAdder {
   bool operator<(const DogAdder& other) const {
     return value_ < other.value_;
   }
-  const ::testing::internal::String& value() const { return value_; }
+  const std::string& value() const { return value_; }
 
  private:
-  ::testing::internal::String value_;
+  std::string value_;
 };
 
 TEST(RangeTest, WorksWithACustomType) {
@@ -606,6 +606,7 @@ class TestGenerationEnvironment : public ::testing::Environment {
           << "has not been run as expected.";
     }
   }
+
  private:
   TestGenerationEnvironment() : fixture_constructor_count_(0), set_up_count_(0),
                                 tear_down_count_(0), test_body_count_(0) {}
@@ -674,6 +675,7 @@ class TestGenerationTest : public TestWithParam<int> {
 
     EXPECT_TRUE(collected_parameters_ == expected_values);
   }
+
  protected:
   int current_parameter_;
   static vector<int> collected_parameters_;
@@ -807,6 +809,157 @@ TEST_P(NamingTest, TestsReportCorrectNamesAndParameters) {
 
 INSTANTIATE_TEST_CASE_P(ZeroToFiveSequence, NamingTest, Range(0, 5));
 
+// Tests that user supplied custom parameter names are working correctly.
+// Runs the test with a builtin helper method which uses PrintToString,
+// as well as a custom function and custom functor to ensure all possible
+// uses work correctly.
+class CustomFunctorNamingTest : public TestWithParam<std::string> {};
+TEST_P(CustomFunctorNamingTest, CustomTestNames) {}
+
+struct CustomParamNameFunctor {
+  std::string operator()(const ::testing::TestParamInfo<std::string>& info) {
+    return info.param;
+  }
+};
+
+INSTANTIATE_TEST_CASE_P(CustomParamNameFunctor,
+                        CustomFunctorNamingTest,
+                        Values(std::string("FunctorName")),
+                        CustomParamNameFunctor());
+
+INSTANTIATE_TEST_CASE_P(AllAllowedCharacters,
+                        CustomFunctorNamingTest,
+                        Values("abcdefghijklmnopqrstuvwxyz",
+                               "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
+                               "01234567890_"),
+                        CustomParamNameFunctor());
+
+inline std::string CustomParamNameFunction(
+    const ::testing::TestParamInfo<std::string>& info) {
+  return info.param;
+}
+
+class CustomFunctionNamingTest : public TestWithParam<std::string> {};
+TEST_P(CustomFunctionNamingTest, CustomTestNames) {}
+
+INSTANTIATE_TEST_CASE_P(CustomParamNameFunction,
+                        CustomFunctionNamingTest,
+                        Values(std::string("FunctionName")),
+                        CustomParamNameFunction);
+
+#if GTEST_LANG_CXX11
+
+// Test custom naming with a lambda
+
+class CustomLambdaNamingTest : public TestWithParam<std::string> {};
+TEST_P(CustomLambdaNamingTest, CustomTestNames) {}
+
+INSTANTIATE_TEST_CASE_P(CustomParamNameLambda,
+                        CustomLambdaNamingTest,
+                        Values(std::string("LambdaName")),
+                        [](const ::testing::TestParamInfo<std::string>& info) {
+                          return info.param;
+                        });
+
+#endif  // GTEST_LANG_CXX11
+
+TEST(CustomNamingTest, CheckNameRegistry) {
+  ::testing::UnitTest* unit_test = ::testing::UnitTest::GetInstance();
+  std::set<std::string> test_names;
+  for (int case_num = 0;
+       case_num < unit_test->total_test_case_count();
+       ++case_num) {
+    const ::testing::TestCase* test_case = unit_test->GetTestCase(case_num);
+    for (int test_num = 0;
+         test_num < test_case->total_test_count();
+         ++test_num) {
+      const ::testing::TestInfo* test_info = test_case->GetTestInfo(test_num);
+      test_names.insert(std::string(test_info->name()));
+    }
+  }
+  EXPECT_EQ(1u, test_names.count("CustomTestNames/FunctorName"));
+  EXPECT_EQ(1u, test_names.count("CustomTestNames/FunctionName"));
+#if GTEST_LANG_CXX11
+  EXPECT_EQ(1u, test_names.count("CustomTestNames/LambdaName"));
+#endif  // GTEST_LANG_CXX11
+}
+
+// Test a numeric name to ensure PrintToStringParamName works correctly.
+
+class CustomIntegerNamingTest : public TestWithParam<int> {};
+
+TEST_P(CustomIntegerNamingTest, TestsReportCorrectNames) {
+  const ::testing::TestInfo* const test_info =
+     ::testing::UnitTest::GetInstance()->current_test_info();
+  Message test_name_stream;
+  test_name_stream << "TestsReportCorrectNames/" << GetParam();
+  EXPECT_STREQ(test_name_stream.GetString().c_str(), test_info->name());
+}
+
+INSTANTIATE_TEST_CASE_P(PrintToString,
+                        CustomIntegerNamingTest,
+                        Range(0, 5),
+                        ::testing::PrintToStringParamName());
+
+// Test a custom struct with PrintToString.
+
+struct CustomStruct {
+  explicit CustomStruct(int value) : x(value) {}
+  int x;
+};
+
+std::ostream& operator<<(std::ostream& stream, const CustomStruct& val) {
+  stream << val.x;
+  return stream;
+}
+
+class CustomStructNamingTest : public TestWithParam<CustomStruct> {};
+
+TEST_P(CustomStructNamingTest, TestsReportCorrectNames) {
+  const ::testing::TestInfo* const test_info =
+     ::testing::UnitTest::GetInstance()->current_test_info();
+  Message test_name_stream;
+  test_name_stream << "TestsReportCorrectNames/" << GetParam();
+  EXPECT_STREQ(test_name_stream.GetString().c_str(), test_info->name());
+}
+
+INSTANTIATE_TEST_CASE_P(PrintToString,
+                        CustomStructNamingTest,
+                        Values(CustomStruct(0), CustomStruct(1)),
+                        ::testing::PrintToStringParamName());
+
+// Test that using a stateful parameter naming function works as expected.
+
+struct StatefulNamingFunctor {
+  StatefulNamingFunctor() : sum(0) {}
+  std::string operator()(const ::testing::TestParamInfo<int>& info) {
+    int value = info.param + sum;
+    sum += info.param;
+    return ::testing::PrintToString(value);
+  }
+  int sum;
+};
+
+class StatefulNamingTest : public ::testing::TestWithParam<int> {
+ protected:
+  StatefulNamingTest() : sum_(0) {}
+  int sum_;
+};
+
+TEST_P(StatefulNamingTest, TestsReportCorrectNames) {
+  const ::testing::TestInfo* const test_info =
+     ::testing::UnitTest::GetInstance()->current_test_info();
+  sum_ += GetParam();
+  Message test_name_stream;
+  test_name_stream << "TestsReportCorrectNames/" << sum_;
+  EXPECT_STREQ(test_name_stream.GetString().c_str(), test_info->name());
+}
+
+INSTANTIATE_TEST_CASE_P(StatefulNamingFunctor,
+                        StatefulNamingTest,
+                        Range(0, 5),
+                        StatefulNamingFunctor());
+
 // Class that cannot be streamed into an ostream.  It needs to be copyable
 // (and, in case of MSVC, also assignable) in order to be a test parameter
 // type.  Its default copy constructor and assignment operator do exactly
@@ -863,6 +1016,13 @@ TEST_P(ParameterizedDerivedTest, SeesSequence) {
   EXPECT_EQ(GetParam(), global_count_++);
 }
 
+class ParameterizedDeathTest : public ::testing::TestWithParam<int> { };
+
+TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
+  EXPECT_DEATH_IF_SUPPORTED(GetParam(),
+                            ".* value-parameterized test .*");
+}
+
 INSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5));
 
 #endif  // GTEST_HAS_PARAM_TEST
index d0f6556..26ea122 100755 (executable)
 
 // Test fixture for testing definition and instantiation of a test
 // in separate translation units.
-class ExternalInstantiationTest : public ::testing::TestWithParam<int> {};
+class ExternalInstantiationTest : public ::testing::TestWithParam<int> {
+};
 
 // Test fixture for testing instantiation of a test in multiple
 // translation units.
 class InstantiationInMultipleTranslaionUnitsTest
-    : public ::testing::TestWithParam<int> {};
+    : public ::testing::TestWithParam<int> {
+};
 
 #endif  // GTEST_HAS_PARAM_TEST
 
index 1c6e2b0..6ea607b 100755 (executable)
@@ -61,6 +61,43 @@ using std::pair;
 namespace testing {
 namespace internal {
 
+TEST(IsXDigitTest, WorksForNarrowAscii) {
+  EXPECT_TRUE(IsXDigit('0'));
+  EXPECT_TRUE(IsXDigit('9'));
+  EXPECT_TRUE(IsXDigit('A'));
+  EXPECT_TRUE(IsXDigit('F'));
+  EXPECT_TRUE(IsXDigit('a'));
+  EXPECT_TRUE(IsXDigit('f'));
+
+  EXPECT_FALSE(IsXDigit('-'));
+  EXPECT_FALSE(IsXDigit('g'));
+  EXPECT_FALSE(IsXDigit('G'));
+}
+
+TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) {
+  EXPECT_FALSE(IsXDigit('\x80'));
+  EXPECT_FALSE(IsXDigit(static_cast<char>('0' | '\x80')));
+}
+
+TEST(IsXDigitTest, WorksForWideAscii) {
+  EXPECT_TRUE(IsXDigit(L'0'));
+  EXPECT_TRUE(IsXDigit(L'9'));
+  EXPECT_TRUE(IsXDigit(L'A'));
+  EXPECT_TRUE(IsXDigit(L'F'));
+  EXPECT_TRUE(IsXDigit(L'a'));
+  EXPECT_TRUE(IsXDigit(L'f'));
+
+  EXPECT_FALSE(IsXDigit(L'-'));
+  EXPECT_FALSE(IsXDigit(L'g'));
+  EXPECT_FALSE(IsXDigit(L'G'));
+}
+
+TEST(IsXDigitTest, ReturnsFalseForWideNonAscii) {
+  EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(0x80)));
+  EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x80)));
+  EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x100)));
+}
+
 class Base {
  public:
   // Copy constructor and assignment operator do exactly what we need, so we
@@ -92,7 +129,7 @@ TEST(ImplicitCastTest, CanUseInheritance) {
 
 class Castable {
  public:
-  Castable(bool* converted) : converted_(converted) {}
+  explicit Castable(bool* converted) : converted_(converted) {}
   operator Base() {
     *converted_ = true;
     return Base();
@@ -111,7 +148,7 @@ TEST(ImplicitCastTest, CanUseNonConstCastOperator) {
 
 class ConstCastable {
  public:
-  ConstCastable(bool* converted) : converted_(converted) {}
+  explicit ConstCastable(bool* converted) : converted_(converted) {}
   operator Base() const {
     *converted_ = true;
     return Base();
@@ -224,7 +261,7 @@ TEST(GtestCheckSyntaxTest, WorksWithSwitch) {
       GTEST_CHECK_(true);
   }
 
-  switch(0)
+  switch (0)
     case 0:
       GTEST_CHECK_(true) << "Check failed in switch case";
 }
@@ -267,53 +304,51 @@ TEST(FormatCompilerIndependentFileLocationTest, FormatsUknownFileAndLine) {
   EXPECT_EQ("unknown file", FormatCompilerIndependentFileLocation(NULL, -1));
 }
 
-#if GTEST_OS_MAC
+#if GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX
 void* ThreadFunc(void* data) {
-  pthread_mutex_t* mutex = static_cast<pthread_mutex_t*>(data);
-  pthread_mutex_lock(mutex);
-  pthread_mutex_unlock(mutex);
+  internal::Mutex* mutex = static_cast<internal::Mutex*>(data);
+  mutex->Lock();
+  mutex->Unlock();
   return NULL;
 }
 
 TEST(GetThreadCountTest, ReturnsCorrectValue) {
-  EXPECT_EQ(1U, GetThreadCount());
-  pthread_mutex_t mutex;
-  pthread_attr_t  attr;
+  const size_t starting_count = GetThreadCount();
   pthread_t       thread_id;
 
-  // TODO(vladl@google.com): turn mutex into internal::Mutex for automatic
-  // destruction.
-  pthread_mutex_init(&mutex, NULL);
-  pthread_mutex_lock(&mutex);
-  ASSERT_EQ(0, pthread_attr_init(&attr));
-  ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE));
-
-  const int status = pthread_create(&thread_id, &attr, &ThreadFunc, &mutex);
-  ASSERT_EQ(0, pthread_attr_destroy(&attr));
-  ASSERT_EQ(0, status);
-  EXPECT_EQ(2U, GetThreadCount());
-  pthread_mutex_unlock(&mutex);
+  internal::Mutex mutex;
+  {
+    internal::MutexLock lock(&mutex);
+    pthread_attr_t  attr;
+    ASSERT_EQ(0, pthread_attr_init(&attr));
+    ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE));
+
+    const int status = pthread_create(&thread_id, &attr, &ThreadFunc, &mutex);
+    ASSERT_EQ(0, pthread_attr_destroy(&attr));
+    ASSERT_EQ(0, status);
+    EXPECT_EQ(starting_count + 1, GetThreadCount());
+  }
 
   void* dummy;
   ASSERT_EQ(0, pthread_join(thread_id, &dummy));
 
-  // MacOS X may not immediately report the updated thread count after
+  // The OS may not immediately report the updated thread count after
   // joining a thread, causing flakiness in this test. To counter that, we
   // wait for up to .5 seconds for the OS to report the correct value.
   for (int i = 0; i < 5; ++i) {
-    if (GetThreadCount() == 1)
+    if (GetThreadCount() == starting_count)
       break;
 
     SleepMilliseconds(100);
   }
-  EXPECT_EQ(1U, GetThreadCount());
-  pthread_mutex_destroy(&mutex);
+
+  EXPECT_EQ(starting_count, GetThreadCount());
 }
 #else
 TEST(GetThreadCountTest, ReturnsZeroWhenUnableToCountThreads) {
   EXPECT_EQ(0U, GetThreadCount());
 }
-#endif  // GTEST_OS_MAC
+#endif  // GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX
 
 TEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) {
   const bool a_false_condition = false;
@@ -347,15 +382,17 @@ TEST(GtestCheckDeathTest, LivesSilentlyOnSuccess) {
 // the platform. The test will produce compiler errors in case of failure.
 // For simplicity, we only cover the most important platforms here.
 TEST(RegexEngineSelectionTest, SelectsCorrectRegexEngine) {
-#if GTEST_HAS_POSIX_RE
+#if !GTEST_USES_PCRE
+# if GTEST_HAS_POSIX_RE
 
   EXPECT_TRUE(GTEST_USES_POSIX_RE);
 
-#else
+# else
 
   EXPECT_TRUE(GTEST_USES_SIMPLE_RE);
 
-#endif
+# endif
+#endif  // !GTEST_USES_PCRE
 }
 
 #if GTEST_USES_POSIX_RE
@@ -924,7 +961,7 @@ TEST(CaptureTest, CapturesStdoutAndStderr) {
 
 TEST(CaptureDeathTest, CannotReenterStdoutCapture) {
   CaptureStdout();
-  EXPECT_DEATH_IF_SUPPORTED(CaptureStdout();,
+  EXPECT_DEATH_IF_SUPPORTED(CaptureStdout(),
                             "Only one stdout capturer can exist at a time");
   GetCapturedStdout();
 
@@ -963,23 +1000,24 @@ TEST(ThreadLocalTest, ValueDefaultContructorIsNotRequiredForParamVersion) {
 }
 
 TEST(ThreadLocalTest, GetAndPointerReturnSameValue) {
-  ThreadLocal<String> thread_local;
+  ThreadLocal<std::string> thread_local_string;
 
-  EXPECT_EQ(thread_local.pointer(), &(thread_local.get()));
+  EXPECT_EQ(thread_local_string.pointer(), &(thread_local_string.get()));
 
   // Verifies the condition still holds after calling set.
-  thread_local.set("foo");
-  EXPECT_EQ(thread_local.pointer(), &(thread_local.get()));
+  thread_local_string.set("foo");
+  EXPECT_EQ(thread_local_string.pointer(), &(thread_local_string.get()));
 }
 
 TEST(ThreadLocalTest, PointerAndConstPointerReturnSameValue) {
-  ThreadLocal<String> thread_local;
-  const ThreadLocal<String>& const_thread_local = thread_local;
+  ThreadLocal<std::string> thread_local_string;
+  const ThreadLocal<std::string>& const_thread_local_string =
+      thread_local_string;
 
-  EXPECT_EQ(thread_local.pointer(), const_thread_local.pointer());
+  EXPECT_EQ(thread_local_string.pointer(), const_thread_local_string.pointer());
 
-  thread_local.set("foo");
-  EXPECT_EQ(thread_local.pointer(), const_thread_local.pointer());
+  thread_local_string.set("foo");
+  EXPECT_EQ(thread_local_string.pointer(), const_thread_local_string.pointer());
 }
 
 #if GTEST_IS_THREADSAFE
@@ -1019,11 +1057,13 @@ class AtomicCounterWithMutex {
     MutexLock lock(mutex_);
     int temp = value_;
     {
-      // Locking a mutex puts up a memory barrier, preventing reads and
-      // writes to value_ rearranged when observed from other threads.
-      //
-      // We cannot use Mutex and MutexLock here or rely on their memory
-      // barrier functionality as we are testing them here.
+      // We need to put up a memory barrier to prevent reads and writes to
+      // value_ rearranged with the call to SleepMilliseconds when observed
+      // from other threads.
+#if GTEST_HAS_PTHREAD
+      // On POSIX, locking a mutex puts up a memory barrier.  We cannot use
+      // Mutex and MutexLock here or rely on their memory barrier
+      // functionality as we are testing them here.
       pthread_mutex_t memory_barrier_mutex;
       GTEST_CHECK_POSIX_SUCCESS_(
           pthread_mutex_init(&memory_barrier_mutex, NULL));
@@ -1032,6 +1072,16 @@ class AtomicCounterWithMutex {
       SleepMilliseconds(random_.Generate(30));
 
       GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&memory_barrier_mutex));
+      GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&memory_barrier_mutex));
+#elif GTEST_OS_WINDOWS
+      // On Windows, performing an interlocked access puts up a memory barrier.
+      volatile LONG dummy = 0;
+      ::InterlockedIncrement(&dummy);
+      SleepMilliseconds(random_.Generate(30));
+      ::InterlockedIncrement(&dummy);
+#else
+# error "Memory barrier not implemented on this platform."
+#endif  // GTEST_HAS_PTHREAD
     }
     value_ = temp + 1;
   }
@@ -1083,124 +1133,172 @@ void RunFromThread(void (func)(T), T param) {
   thread.Join();
 }
 
-void RetrieveThreadLocalValue(pair<ThreadLocal<String>*, String*> param) {
+void RetrieveThreadLocalValue(
+    pair<ThreadLocal<std::string>*, std::string*> param) {
   *param.second = param.first->get();
 }
 
 TEST(ThreadLocalTest, ParameterizedConstructorSetsDefault) {
-  ThreadLocal<String> thread_local("foo");
-  EXPECT_STREQ("foo", thread_local.get().c_str());
+  ThreadLocal<std::string> thread_local_string("foo");
+  EXPECT_STREQ("foo", thread_local_string.get().c_str());
 
-  thread_local.set("bar");
-  EXPECT_STREQ("bar", thread_local.get().c_str());
+  thread_local_string.set("bar");
+  EXPECT_STREQ("bar", thread_local_string.get().c_str());
 
-  String result;
-  RunFromThread(&RetrieveThreadLocalValue, make_pair(&thread_local, &result));
+  std::string result;
+  RunFromThread(&RetrieveThreadLocalValue,
+                make_pair(&thread_local_string, &result));
   EXPECT_STREQ("foo", result.c_str());
 }
 
+// Keeps track of whether of destructors being called on instances of
+// DestructorTracker.  On Windows, waits for the destructor call reports.
+class DestructorCall {
+ public:
+  DestructorCall() {
+    invoked_ = false;
+#if GTEST_OS_WINDOWS
+    wait_event_.Reset(::CreateEvent(NULL, TRUE, FALSE, NULL));
+    GTEST_CHECK_(wait_event_.Get() != NULL);
+#endif
+  }
+
+  bool CheckDestroyed() const {
+#if GTEST_OS_WINDOWS
+    if (::WaitForSingleObject(wait_event_.Get(), 1000) != WAIT_OBJECT_0)
+      return false;
+#endif
+    return invoked_;
+  }
+
+  void ReportDestroyed() {
+    invoked_ = true;
+#if GTEST_OS_WINDOWS
+    ::SetEvent(wait_event_.Get());
+#endif
+  }
+
+  static std::vector<DestructorCall*>& List() { return *list_; }
+
+  static void ResetList() {
+    for (size_t i = 0; i < list_->size(); ++i) {
+      delete list_->at(i);
+    }
+    list_->clear();
+  }
+
+ private:
+  bool invoked_;
+#if GTEST_OS_WINDOWS
+  AutoHandle wait_event_;
+#endif
+  static std::vector<DestructorCall*>* const list_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(DestructorCall);
+};
+
+std::vector<DestructorCall*>* const DestructorCall::list_ =
+    new std::vector<DestructorCall*>;
+
 // DestructorTracker keeps track of whether its instances have been
 // destroyed.
-static std::vector<bool> g_destroyed;
-
 class DestructorTracker {
  public:
   DestructorTracker() : index_(GetNewIndex()) {}
   DestructorTracker(const DestructorTracker& /* rhs */)
       : index_(GetNewIndex()) {}
   ~DestructorTracker() {
-    // We never access g_destroyed concurrently, so we don't need to
-    // protect the write operation under a mutex.
-    g_destroyed[index_] = true;
+    // We never access DestructorCall::List() concurrently, so we don't need
+    // to protect this acccess with a mutex.
+    DestructorCall::List()[index_]->ReportDestroyed();
   }
 
  private:
-  static int GetNewIndex() {
-    g_destroyed.push_back(false);
-    return g_destroyed.size() - 1;
+  static size_t GetNewIndex() {
+    DestructorCall::List().push_back(new DestructorCall);
+    return DestructorCall::List().size() - 1;
   }
-  const int index_;
+  const size_t index_;
+
+  GTEST_DISALLOW_ASSIGN_(DestructorTracker);
 };
 
 typedef ThreadLocal<DestructorTracker>* ThreadParam;
 
-void CallThreadLocalGet(ThreadParam thread_local) {
-  thread_local->get();
+void CallThreadLocalGet(ThreadParam thread_local_param) {
+  thread_local_param->get();
 }
 
 // Tests that when a ThreadLocal object dies in a thread, it destroys
 // the managed object for that thread.
 TEST(ThreadLocalTest, DestroysManagedObjectForOwnThreadWhenDying) {
-  g_destroyed.clear();
+  DestructorCall::ResetList();
 
   {
-    // The next line default constructs a DestructorTracker object as
-    // the default value of objects managed by thread_local.
-    ThreadLocal<DestructorTracker> thread_local;
-    ASSERT_EQ(1U, g_destroyed.size());
-    ASSERT_FALSE(g_destroyed[0]);
+    ThreadLocal<DestructorTracker> thread_local_tracker;
+    ASSERT_EQ(0U, DestructorCall::List().size());
 
     // This creates another DestructorTracker object for the main thread.
-    thread_local.get();
-    ASSERT_EQ(2U, g_destroyed.size());
-    ASSERT_FALSE(g_destroyed[0]);
-    ASSERT_FALSE(g_destroyed[1]);
+    thread_local_tracker.get();
+    ASSERT_EQ(1U, DestructorCall::List().size());
+    ASSERT_FALSE(DestructorCall::List()[0]->CheckDestroyed());
   }
 
-  // Now thread_local has died.  It should have destroyed both the
-  // default value shared by all threads and the value for the main
-  // thread.
-  ASSERT_EQ(2U, g_destroyed.size());
-  EXPECT_TRUE(g_destroyed[0]);
-  EXPECT_TRUE(g_destroyed[1]);
+  // Now thread_local_tracker has died.
+  ASSERT_EQ(1U, DestructorCall::List().size());
+  EXPECT_TRUE(DestructorCall::List()[0]->CheckDestroyed());
 
-  g_destroyed.clear();
+  DestructorCall::ResetList();
 }
 
 // Tests that when a thread exits, the thread-local object for that
 // thread is destroyed.
 TEST(ThreadLocalTest, DestroysManagedObjectAtThreadExit) {
-  g_destroyed.clear();
+  DestructorCall::ResetList();
 
   {
-    // The next line default constructs a DestructorTracker object as
-    // the default value of objects managed by thread_local.
-    ThreadLocal<DestructorTracker> thread_local;
-    ASSERT_EQ(1U, g_destroyed.size());
-    ASSERT_FALSE(g_destroyed[0]);
+    ThreadLocal<DestructorTracker> thread_local_tracker;
+    ASSERT_EQ(0U, DestructorCall::List().size());
 
     // This creates another DestructorTracker object in the new thread.
     ThreadWithParam<ThreadParam> thread(
-        &CallThreadLocalGet, &thread_local, NULL);
+        &CallThreadLocalGet, &thread_local_tracker, NULL);
     thread.Join();
 
-    // Now the new thread has exited.  The per-thread object for it
-    // should have been destroyed.
-    ASSERT_EQ(2U, g_destroyed.size());
-    ASSERT_FALSE(g_destroyed[0]);
-    ASSERT_TRUE(g_destroyed[1]);
+    // The thread has exited, and we should have a DestroyedTracker
+    // instance created for it. But it may not have been destroyed yet.
+    ASSERT_EQ(1U, DestructorCall::List().size());
   }
 
-  // Now thread_local has died.  The default value should have been
-  // destroyed too.
-  ASSERT_EQ(2U, g_destroyed.size());
-  EXPECT_TRUE(g_destroyed[0]);
-  EXPECT_TRUE(g_destroyed[1]);
+  // The thread has exited and thread_local_tracker has died.
+  ASSERT_EQ(1U, DestructorCall::List().size());
+  EXPECT_TRUE(DestructorCall::List()[0]->CheckDestroyed());
 
-  g_destroyed.clear();
+  DestructorCall::ResetList();
 }
 
 TEST(ThreadLocalTest, ThreadLocalMutationsAffectOnlyCurrentThread) {
-  ThreadLocal<String> thread_local;
-  thread_local.set("Foo");
-  EXPECT_STREQ("Foo", thread_local.get().c_str());
+  ThreadLocal<std::string> thread_local_string;
+  thread_local_string.set("Foo");
+  EXPECT_STREQ("Foo", thread_local_string.get().c_str());
 
-  String result;
-  RunFromThread(&RetrieveThreadLocalValue, make_pair(&thread_local, &result));
-  EXPECT_TRUE(result.c_str() == NULL);
+  std::string result;
+  RunFromThread(&RetrieveThreadLocalValue,
+                make_pair(&thread_local_string, &result));
+  EXPECT_TRUE(result.empty());
 }
 
 #endif  // GTEST_IS_THREADSAFE
 
+#if GTEST_OS_WINDOWS
+TEST(WindowsTypesTest, HANDLEIsVoidStar) {
+  StaticAssertTypeEq<HANDLE, void*>();
+}
+
+TEST(WindowsTypesTest, CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION) {
+  StaticAssertTypeEq<CRITICAL_SECTION, _RTL_CRITICAL_SECTION>();
+}
+#endif  // GTEST_OS_WINDOWS
+
 }  // namespace internal
 }  // namespace testing
index 6292c7f..3e97cc2 100755 (executable)
 
 #include "gtest/gtest.h"
 
-// hash_map and hash_set are available under Visual C++.
-#if _MSC_VER
-# define GTEST_HAS_HASH_MAP_ 1  // Indicates that hash_map is available.
+// hash_map and hash_set are available under Visual C++, or on Linux.
+#if GTEST_HAS_HASH_MAP_
 # include <hash_map>            // NOLINT
-# define GTEST_HAS_HASH_SET_ 1  // Indicates that hash_set is available.
+#endif  // GTEST_HAS_HASH_MAP_
+#if GTEST_HAS_HASH_SET_
 # include <hash_set>            // NOLINT
-#endif  // GTEST_OS_WINDOWS
+#endif  // GTEST_HAS_HASH_SET_
+
+#if GTEST_HAS_STD_FORWARD_LIST_
+# include <forward_list> // NOLINT
+#endif  // GTEST_HAS_STD_FORWARD_LIST_
 
 // Some user-defined types for testing the universal value printer.
 
@@ -125,6 +129,7 @@ namespace foo {
 class UnprintableInFoo {
  public:
   UnprintableInFoo() : z_(0) { memcpy(xy_, "\xEF\x12\x0\x0\x34\xAB\x0\x0", 8); }
+  double z() const { return z_; }
  private:
   char xy_[8];
   double z_;
@@ -197,25 +202,27 @@ using ::std::pair;
 using ::std::set;
 using ::std::vector;
 using ::testing::PrintToString;
+using ::testing::internal::FormatForComparisonFailureMessage;
+using ::testing::internal::ImplicitCast_;
 using ::testing::internal::NativeArray;
 using ::testing::internal::RE;
+using ::testing::internal::RelationToSourceReference;
 using ::testing::internal::Strings;
-using ::testing::internal::UniversalTersePrint;
 using ::testing::internal::UniversalPrint;
-using ::testing::internal::UniversalTersePrintTupleFieldsToStrings;
 using ::testing::internal::UniversalPrinter;
-using ::testing::internal::kReference;
+using ::testing::internal::UniversalTersePrint;
+using ::testing::internal::UniversalTersePrintTupleFieldsToStrings;
 using ::testing::internal::string;
 
-#if GTEST_HAS_TR1_TUPLE
-using ::std::tr1::make_tuple;
-using ::std::tr1::tuple;
-#endif
-
-#if _MSC_VER
-// MSVC defines the following classes in the ::stdext namespace while
-// gcc defines them in the :: namespace.  Note that they are not part
-// of the C++ standard.
+// The hash_* classes are not part of the C++ standard.  STLport
+// defines them in namespace std.  MSVC defines them in ::stdext.  GCC
+// defines them in ::.
+#ifdef _STLP_HASH_MAP  // We got <hash_map> from STLport.
+using ::std::hash_map;
+using ::std::hash_set;
+using ::std::hash_multimap;
+using ::std::hash_multiset;
+#elif _MSC_VER
 using ::stdext::hash_map;
 using ::stdext::hash_set;
 using ::stdext::hash_multimap;
@@ -407,8 +414,6 @@ TEST(PrintCStringTest, EscapesProperly) {
             Print(p));
 }
 
-
-
 // MSVC compiler can be configured to define whar_t as a typedef
 // of unsigned short. Defining an overload for const wchar_t* in that case
 // would cause pointers to unsigned shorts be printed as wide strings,
@@ -612,17 +617,30 @@ TEST(PrintArrayTest, ConstArray) {
   EXPECT_EQ("{ false }", PrintArrayHelper(a));
 }
 
-// Char array.
-TEST(PrintArrayTest, CharArray) {
+// char array without terminating NUL.
+TEST(PrintArrayTest, CharArrayWithNoTerminatingNul) {
+  // Array a contains '\0' in the middle and doesn't end with '\0'.
+  char a[] = { 'H', '\0', 'i' };
+  EXPECT_EQ("\"H\\0i\" (no terminating NUL)", PrintArrayHelper(a));
+}
+
+// const char array with terminating NUL.
+TEST(PrintArrayTest, ConstCharArrayWithTerminatingNul) {
+  const char a[] = "\0Hi";
+  EXPECT_EQ("\"\\0Hi\"", PrintArrayHelper(a));
+}
+
+// const wchar_t array without terminating NUL.
+TEST(PrintArrayTest, WCharArrayWithNoTerminatingNul) {
   // Array a contains '\0' in the middle and doesn't end with '\0'.
-  char a[3] = { 'H', '\0', 'i' };
-  EXPECT_EQ("\"H\\0i\"", PrintArrayHelper(a));
+  const wchar_t a[] = { L'H', L'\0', L'i' };
+  EXPECT_EQ("L\"H\\0i\" (no terminating NUL)", PrintArrayHelper(a));
 }
 
-// Const char array.
-TEST(PrintArrayTest, ConstCharArray) {
-  const char a[4] = "\0Hi";
-  EXPECT_EQ("\"\\0Hi\\0\"", PrintArrayHelper(a));
+// wchar_t array with terminating NUL.
+TEST(PrintArrayTest, WConstCharArrayWithTerminatingNul) {
+  const wchar_t a[] = L"\0Hi";
+  EXPECT_EQ("L\"\\0Hi\"", PrintArrayHelper(a));
 }
 
 // Array of objects.
@@ -840,7 +858,7 @@ TEST(PrintStlContainerTest, HashMultiSet) {
   std::vector<int> numbers;
   for (size_t i = 0; i != result.length(); i++) {
     if (expected_pattern[i] == 'd') {
-      ASSERT_TRUE(isdigit(static_cast<unsigned char>(result[i])) != 0);
+      ASSERT_NE(isdigit(static_cast<unsigned char>(result[i])), 0);
       numbers.push_back(result[i] - '0');
     } else {
       EXPECT_EQ(expected_pattern[i], result[i]) << " where result is "
@@ -899,6 +917,17 @@ TEST(PrintStlContainerTest, MultiSet) {
   EXPECT_EQ("{ 1, 1, 1, 2, 5 }", Print(set1));
 }
 
+#if GTEST_HAS_STD_FORWARD_LIST_
+// <slist> is available on Linux in the google3 mode, but not on
+// Windows or Mac OS X.
+
+TEST(PrintStlContainerTest, SinglyLinkedList) {
+  int a[] = { 9, 2, 8 };
+  const std::forward_list<int> ints(a, a + 3);
+  EXPECT_EQ("{ 9, 2, 8 }", Print(ints));
+}
+#endif  // GTEST_HAS_STD_FORWARD_LIST_
+
 TEST(PrintStlContainerTest, Pair) {
   pair<const bool, int> p(true, 5);
   EXPECT_EQ("(true, 5)", Print(p));
@@ -932,13 +961,13 @@ TEST(PrintStlContainerTest, NestedContainer) {
 
 TEST(PrintStlContainerTest, OneDimensionalNativeArray) {
   const int a[3] = { 1, 2, 3 };
-  NativeArray<int> b(a, 3, kReference);
+  NativeArray<int> b(a, 3, RelationToSourceReference());
   EXPECT_EQ("{ 1, 2, 3 }", Print(b));
 }
 
 TEST(PrintStlContainerTest, TwoDimensionalNativeArray) {
   const int a[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } };
-  NativeArray<int[3]> b(a, 2, kReference);
+  NativeArray<int[3]> b(a, 2, RelationToSourceReference());
   EXPECT_EQ("{ { 1, 2, 3 }, { 4, 5, 6 } }", Print(b));
 }
 
@@ -965,59 +994,123 @@ TEST(PrintStlContainerTest, ConstIterator) {
 }
 
 #if GTEST_HAS_TR1_TUPLE
-// Tests printing tuples.
+// Tests printing ::std::tr1::tuples.
 
 // Tuples of various arities.
-TEST(PrintTupleTest, VariousSizes) {
-  tuple<> t0;
+TEST(PrintTr1TupleTest, VariousSizes) {
+  ::std::tr1::tuple<> t0;
   EXPECT_EQ("()", Print(t0));
 
-  tuple<int> t1(5);
+  ::std::tr1::tuple<int> t1(5);
   EXPECT_EQ("(5)", Print(t1));
 
-  tuple<char, bool> t2('a', true);
+  ::std::tr1::tuple<char, bool> t2('a', true);
   EXPECT_EQ("('a' (97, 0x61), true)", Print(t2));
 
-  tuple<bool, int, int> t3(false, 2, 3);
+  ::std::tr1::tuple<bool, int, int> t3(false, 2, 3);
   EXPECT_EQ("(false, 2, 3)", Print(t3));
 
-  tuple<bool, int, int, int> t4(false, 2, 3, 4);
+  ::std::tr1::tuple<bool, int, int, int> t4(false, 2, 3, 4);
   EXPECT_EQ("(false, 2, 3, 4)", Print(t4));
 
-  tuple<bool, int, int, int, bool> t5(false, 2, 3, 4, true);
+  ::std::tr1::tuple<bool, int, int, int, bool> t5(false, 2, 3, 4, true);
   EXPECT_EQ("(false, 2, 3, 4, true)", Print(t5));
 
-  tuple<bool, int, int, int, bool, int> t6(false, 2, 3, 4, true, 6);
+  ::std::tr1::tuple<bool, int, int, int, bool, int> t6(false, 2, 3, 4, true, 6);
   EXPECT_EQ("(false, 2, 3, 4, true, 6)", Print(t6));
 
-  tuple<bool, int, int, int, bool, int, int> t7(false, 2, 3, 4, true, 6, 7);
+  ::std::tr1::tuple<bool, int, int, int, bool, int, int> t7(
+      false, 2, 3, 4, true, 6, 7);
   EXPECT_EQ("(false, 2, 3, 4, true, 6, 7)", Print(t7));
 
-  tuple<bool, int, int, int, bool, int, int, bool> t8(
+  ::std::tr1::tuple<bool, int, int, int, bool, int, int, bool> t8(
       false, 2, 3, 4, true, 6, 7, true);
   EXPECT_EQ("(false, 2, 3, 4, true, 6, 7, true)", Print(t8));
 
-  tuple<bool, int, int, int, bool, int, int, bool, int> t9(
+  ::std::tr1::tuple<bool, int, int, int, bool, int, int, bool, int> t9(
       false, 2, 3, 4, true, 6, 7, true, 9);
   EXPECT_EQ("(false, 2, 3, 4, true, 6, 7, true, 9)", Print(t9));
 
   const char* const str = "8";
-  tuple<bool, char, short, testing::internal::Int32,  // NOLINT
+  // VC++ 2010's implementation of tuple of C++0x is deficient, requiring
+  // an explicit type cast of NULL to be used.
+  ::std::tr1::tuple<bool, char, short, testing::internal::Int32,  // NOLINT
       testing::internal::Int64, float, double, const char*, void*, string>
-      t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, NULL, "10");
+      t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str,
+          ImplicitCast_<void*>(NULL), "10");
   EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
             " pointing to \"8\", NULL, \"10\")",
             Print(t10));
 }
 
 // Nested tuples.
-TEST(PrintTupleTest, NestedTuple) {
-  tuple<tuple<int, bool>, char> nested(make_tuple(5, true), 'a');
+TEST(PrintTr1TupleTest, NestedTuple) {
+  ::std::tr1::tuple< ::std::tr1::tuple<int, bool>, char> nested(
+      ::std::tr1::make_tuple(5, true), 'a');
   EXPECT_EQ("((5, true), 'a' (97, 0x61))", Print(nested));
 }
 
 #endif  // GTEST_HAS_TR1_TUPLE
 
+#if GTEST_HAS_STD_TUPLE_
+// Tests printing ::std::tuples.
+
+// Tuples of various arities.
+TEST(PrintStdTupleTest, VariousSizes) {
+  ::std::tuple<> t0;
+  EXPECT_EQ("()", Print(t0));
+
+  ::std::tuple<int> t1(5);
+  EXPECT_EQ("(5)", Print(t1));
+
+  ::std::tuple<char, bool> t2('a', true);
+  EXPECT_EQ("('a' (97, 0x61), true)", Print(t2));
+
+  ::std::tuple<bool, int, int> t3(false, 2, 3);
+  EXPECT_EQ("(false, 2, 3)", Print(t3));
+
+  ::std::tuple<bool, int, int, int> t4(false, 2, 3, 4);
+  EXPECT_EQ("(false, 2, 3, 4)", Print(t4));
+
+  ::std::tuple<bool, int, int, int, bool> t5(false, 2, 3, 4, true);
+  EXPECT_EQ("(false, 2, 3, 4, true)", Print(t5));
+
+  ::std::tuple<bool, int, int, int, bool, int> t6(false, 2, 3, 4, true, 6);
+  EXPECT_EQ("(false, 2, 3, 4, true, 6)", Print(t6));
+
+  ::std::tuple<bool, int, int, int, bool, int, int> t7(
+      false, 2, 3, 4, true, 6, 7);
+  EXPECT_EQ("(false, 2, 3, 4, true, 6, 7)", Print(t7));
+
+  ::std::tuple<bool, int, int, int, bool, int, int, bool> t8(
+      false, 2, 3, 4, true, 6, 7, true);
+  EXPECT_EQ("(false, 2, 3, 4, true, 6, 7, true)", Print(t8));
+
+  ::std::tuple<bool, int, int, int, bool, int, int, bool, int> t9(
+      false, 2, 3, 4, true, 6, 7, true, 9);
+  EXPECT_EQ("(false, 2, 3, 4, true, 6, 7, true, 9)", Print(t9));
+
+  const char* const str = "8";
+  // VC++ 2010's implementation of tuple of C++0x is deficient, requiring
+  // an explicit type cast of NULL to be used.
+  ::std::tuple<bool, char, short, testing::internal::Int32,  // NOLINT
+      testing::internal::Int64, float, double, const char*, void*, string>
+      t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str,
+          ImplicitCast_<void*>(NULL), "10");
+  EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
+            " pointing to \"8\", NULL, \"10\")",
+            Print(t10));
+}
+
+// Nested tuples.
+TEST(PrintStdTupleTest, NestedTuple) {
+  ::std::tuple< ::std::tuple<int, bool>, char> nested(
+      ::std::make_tuple(5, true), 'a');
+  EXPECT_EQ("((5, true), 'a' (97, 0x61))", Print(nested));
+}
+
+#endif  // GTEST_LANG_CXX11
+
 // Tests printing user-defined unprintable types.
 
 // Unprintable types in the global namespace.
@@ -1084,44 +1177,6 @@ TEST(PrintPrintableTypeTest, TemplateInUserNamespace) {
             Print(::foo::PrintableViaPrintToTemplate<int>(5)));
 }
 
-#if GTEST_HAS_PROTOBUF_
-
-// Tests printing a protocol message.
-TEST(PrintProtocolMessageTest, PrintsShortDebugString) {
-  testing::internal::TestMessage msg;
-  msg.set_member("yes");
-  EXPECT_EQ("<member:\"yes\">", Print(msg));
-}
-
-// Tests printing a short proto2 message.
-TEST(PrintProto2MessageTest, PrintsShortDebugStringWhenItIsShort) {
-  testing::internal::FooMessage msg;
-  msg.set_int_field(2);
-  msg.set_string_field("hello");
-  EXPECT_PRED2(RE::FullMatch, Print(msg),
-               "<int_field:\\s*2\\s+string_field:\\s*\"hello\">");
-}
-
-// Tests printing a long proto2 message.
-TEST(PrintProto2MessageTest, PrintsDebugStringWhenItIsLong) {
-  testing::internal::FooMessage msg;
-  msg.set_int_field(2);
-  msg.set_string_field("hello");
-  msg.add_names("peter");
-  msg.add_names("paul");
-  msg.add_names("mary");
-  EXPECT_PRED2(RE::FullMatch, Print(msg),
-               "<\n"
-               "int_field:\\s*2\n"
-               "string_field:\\s*\"hello\"\n"
-               "names:\\s*\"peter\"\n"
-               "names:\\s*\"paul\"\n"
-               "names:\\s*\"mary\"\n"
-               ">");
-}
-
-#endif  // GTEST_HAS_PROTOBUF_
-
 // Tests that the universal printer prints both the address and the
 // value of a reference.
 TEST(PrintReferenceTest, PrintsAddressAndValue) {
@@ -1182,6 +1237,207 @@ TEST(PrintReferenceTest, HandlesMemberVariablePointer) {
       "@" + PrintPointer(&p) + " " + Print(sizeof(p)) + "-byte object "));
 }
 
+// Tests that FormatForComparisonFailureMessage(), which is used to print
+// an operand in a comparison assertion (e.g. ASSERT_EQ) when the assertion
+// fails, formats the operand in the desired way.
+
+// scalar
+TEST(FormatForComparisonFailureMessageTest, WorksForScalar) {
+  EXPECT_STREQ("123",
+               FormatForComparisonFailureMessage(123, 124).c_str());
+}
+
+// non-char pointer
+TEST(FormatForComparisonFailureMessageTest, WorksForNonCharPointer) {
+  int n = 0;
+  EXPECT_EQ(PrintPointer(&n),
+            FormatForComparisonFailureMessage(&n, &n).c_str());
+}
+
+// non-char array
+TEST(FormatForComparisonFailureMessageTest, FormatsNonCharArrayAsPointer) {
+  // In expression 'array == x', 'array' is compared by pointer.
+  // Therefore we want to print an array operand as a pointer.
+  int n[] = { 1, 2, 3 };
+  EXPECT_EQ(PrintPointer(n),
+            FormatForComparisonFailureMessage(n, n).c_str());
+}
+
+// Tests formatting a char pointer when it's compared with another pointer.
+// In this case we want to print it as a raw pointer, as the comparision is by
+// pointer.
+
+// char pointer vs pointer
+TEST(FormatForComparisonFailureMessageTest, WorksForCharPointerVsPointer) {
+  // In expression 'p == x', where 'p' and 'x' are (const or not) char
+  // pointers, the operands are compared by pointer.  Therefore we
+  // want to print 'p' as a pointer instead of a C string (we don't
+  // even know if it's supposed to point to a valid C string).
+
+  // const char*
+  const char* s = "hello";
+  EXPECT_EQ(PrintPointer(s),
+            FormatForComparisonFailureMessage(s, s).c_str());
+
+  // char*
+  char ch = 'a';
+  EXPECT_EQ(PrintPointer(&ch),
+            FormatForComparisonFailureMessage(&ch, &ch).c_str());
+}
+
+// wchar_t pointer vs pointer
+TEST(FormatForComparisonFailureMessageTest, WorksForWCharPointerVsPointer) {
+  // In expression 'p == x', where 'p' and 'x' are (const or not) char
+  // pointers, the operands are compared by pointer.  Therefore we
+  // want to print 'p' as a pointer instead of a wide C string (we don't
+  // even know if it's supposed to point to a valid wide C string).
+
+  // const wchar_t*
+  const wchar_t* s = L"hello";
+  EXPECT_EQ(PrintPointer(s),
+            FormatForComparisonFailureMessage(s, s).c_str());
+
+  // wchar_t*
+  wchar_t ch = L'a';
+  EXPECT_EQ(PrintPointer(&ch),
+            FormatForComparisonFailureMessage(&ch, &ch).c_str());
+}
+
+// Tests formatting a char pointer when it's compared to a string object.
+// In this case we want to print the char pointer as a C string.
+
+#if GTEST_HAS_GLOBAL_STRING
+// char pointer vs ::string
+TEST(FormatForComparisonFailureMessageTest, WorksForCharPointerVsString) {
+  const char* s = "hello \"world";
+  EXPECT_STREQ("\"hello \\\"world\"",  // The string content should be escaped.
+               FormatForComparisonFailureMessage(s, ::string()).c_str());
+
+  // char*
+  char str[] = "hi\1";
+  char* p = str;
+  EXPECT_STREQ("\"hi\\x1\"",  // The string content should be escaped.
+               FormatForComparisonFailureMessage(p, ::string()).c_str());
+}
+#endif
+
+// char pointer vs std::string
+TEST(FormatForComparisonFailureMessageTest, WorksForCharPointerVsStdString) {
+  const char* s = "hello \"world";
+  EXPECT_STREQ("\"hello \\\"world\"",  // The string content should be escaped.
+               FormatForComparisonFailureMessage(s, ::std::string()).c_str());
+
+  // char*
+  char str[] = "hi\1";
+  char* p = str;
+  EXPECT_STREQ("\"hi\\x1\"",  // The string content should be escaped.
+               FormatForComparisonFailureMessage(p, ::std::string()).c_str());
+}
+
+#if GTEST_HAS_GLOBAL_WSTRING
+// wchar_t pointer vs ::wstring
+TEST(FormatForComparisonFailureMessageTest, WorksForWCharPointerVsWString) {
+  const wchar_t* s = L"hi \"world";
+  EXPECT_STREQ("L\"hi \\\"world\"",  // The string content should be escaped.
+               FormatForComparisonFailureMessage(s, ::wstring()).c_str());
+
+  // wchar_t*
+  wchar_t str[] = L"hi\1";
+  wchar_t* p = str;
+  EXPECT_STREQ("L\"hi\\x1\"",  // The string content should be escaped.
+               FormatForComparisonFailureMessage(p, ::wstring()).c_str());
+}
+#endif
+
+#if GTEST_HAS_STD_WSTRING
+// wchar_t pointer vs std::wstring
+TEST(FormatForComparisonFailureMessageTest, WorksForWCharPointerVsStdWString) {
+  const wchar_t* s = L"hi \"world";
+  EXPECT_STREQ("L\"hi \\\"world\"",  // The string content should be escaped.
+               FormatForComparisonFailureMessage(s, ::std::wstring()).c_str());
+
+  // wchar_t*
+  wchar_t str[] = L"hi\1";
+  wchar_t* p = str;
+  EXPECT_STREQ("L\"hi\\x1\"",  // The string content should be escaped.
+               FormatForComparisonFailureMessage(p, ::std::wstring()).c_str());
+}
+#endif
+
+// Tests formatting a char array when it's compared with a pointer or array.
+// In this case we want to print the array as a row pointer, as the comparison
+// is by pointer.
+
+// char array vs pointer
+TEST(FormatForComparisonFailureMessageTest, WorksForCharArrayVsPointer) {
+  char str[] = "hi \"world\"";
+  char* p = NULL;
+  EXPECT_EQ(PrintPointer(str),
+            FormatForComparisonFailureMessage(str, p).c_str());
+}
+
+// char array vs char array
+TEST(FormatForComparisonFailureMessageTest, WorksForCharArrayVsCharArray) {
+  const char str[] = "hi \"world\"";
+  EXPECT_EQ(PrintPointer(str),
+            FormatForComparisonFailureMessage(str, str).c_str());
+}
+
+// wchar_t array vs pointer
+TEST(FormatForComparisonFailureMessageTest, WorksForWCharArrayVsPointer) {
+  wchar_t str[] = L"hi \"world\"";
+  wchar_t* p = NULL;
+  EXPECT_EQ(PrintPointer(str),
+            FormatForComparisonFailureMessage(str, p).c_str());
+}
+
+// wchar_t array vs wchar_t array
+TEST(FormatForComparisonFailureMessageTest, WorksForWCharArrayVsWCharArray) {
+  const wchar_t str[] = L"hi \"world\"";
+  EXPECT_EQ(PrintPointer(str),
+            FormatForComparisonFailureMessage(str, str).c_str());
+}
+
+// Tests formatting a char array when it's compared with a string object.
+// In this case we want to print the array as a C string.
+
+#if GTEST_HAS_GLOBAL_STRING
+// char array vs string
+TEST(FormatForComparisonFailureMessageTest, WorksForCharArrayVsString) {
+  const char str[] = "hi \"w\0rld\"";
+  EXPECT_STREQ("\"hi \\\"w\"",  // The content should be escaped.
+                                // Embedded NUL terminates the string.
+               FormatForComparisonFailureMessage(str, ::string()).c_str());
+}
+#endif
+
+// char array vs std::string
+TEST(FormatForComparisonFailureMessageTest, WorksForCharArrayVsStdString) {
+  const char str[] = "hi \"world\"";
+  EXPECT_STREQ("\"hi \\\"world\\\"\"",  // The content should be escaped.
+               FormatForComparisonFailureMessage(str, ::std::string()).c_str());
+}
+
+#if GTEST_HAS_GLOBAL_WSTRING
+// wchar_t array vs wstring
+TEST(FormatForComparisonFailureMessageTest, WorksForWCharArrayVsWString) {
+  const wchar_t str[] = L"hi \"world\"";
+  EXPECT_STREQ("L\"hi \\\"world\\\"\"",  // The content should be escaped.
+               FormatForComparisonFailureMessage(str, ::wstring()).c_str());
+}
+#endif
+
+#if GTEST_HAS_STD_WSTRING
+// wchar_t array vs std::wstring
+TEST(FormatForComparisonFailureMessageTest, WorksForWCharArrayVsStdWString) {
+  const wchar_t str[] = L"hi \"w\0rld\"";
+  EXPECT_STREQ(
+      "L\"hi \\\"w\"",  // The content should be escaped.
+                        // Embedded NUL terminates the string.
+      FormatForComparisonFailureMessage(str, ::std::wstring()).c_str());
+}
+#endif
+
 // Useful for testing PrintToString().  We cannot use EXPECT_EQ()
 // there as its implementation uses PrintToString().  The caller must
 // ensure that 'value' has no side effect.
@@ -1204,11 +1460,35 @@ TEST(PrintToStringTest, WorksForPointerToNonConstChar) {
   EXPECT_PRINT_TO_STRING_(p, "\"hello\"");
 }
 
+TEST(PrintToStringTest, EscapesForPointerToConstChar) {
+  const char* p = "hello\n";
+  EXPECT_PRINT_TO_STRING_(p, "\"hello\\n\"");
+}
+
+TEST(PrintToStringTest, EscapesForPointerToNonConstChar) {
+  char s[] = "hello\1";
+  char* p = s;
+  EXPECT_PRINT_TO_STRING_(p, "\"hello\\x1\"");
+}
+
 TEST(PrintToStringTest, WorksForArray) {
   int n[3] = { 1, 2, 3 };
   EXPECT_PRINT_TO_STRING_(n, "{ 1, 2, 3 }");
 }
 
+TEST(PrintToStringTest, WorksForCharArray) {
+  char s[] = "hello";
+  EXPECT_PRINT_TO_STRING_(s, "\"hello\"");
+}
+
+TEST(PrintToStringTest, WorksForCharArrayWithEmbeddedNul) {
+  const char str_with_nul[] = "hello\0 world";
+  EXPECT_PRINT_TO_STRING_(str_with_nul, "\"hello\\0 world\"");
+
+  char mutable_str_with_nul[] = "hello\0 world";
+  EXPECT_PRINT_TO_STRING_(mutable_str_with_nul, "\"hello\\0 world\"");
+}
+
 #undef EXPECT_PRINT_TO_STRING_
 
 TEST(UniversalTersePrintTest, WorksForNonReference) {
@@ -1271,31 +1551,45 @@ TEST(UniversalPrintTest, WorksForCString) {
   EXPECT_EQ("NULL", ss3.str());
 }
 
+TEST(UniversalPrintTest, WorksForCharArray) {
+  const char str[] = "\"Line\0 1\"\nLine 2";
+  ::std::stringstream ss1;
+  UniversalPrint(str, &ss1);
+  EXPECT_EQ("\"\\\"Line\\0 1\\\"\\nLine 2\"", ss1.str());
+
+  const char mutable_str[] = "\"Line\0 1\"\nLine 2";
+  ::std::stringstream ss2;
+  UniversalPrint(mutable_str, &ss2);
+  EXPECT_EQ("\"\\\"Line\\0 1\\\"\\nLine 2\"", ss2.str());
+}
 
 #if GTEST_HAS_TR1_TUPLE
 
-TEST(UniversalTersePrintTupleFieldsToStringsTest, PrintsEmptyTuple) {
-  Strings result = UniversalTersePrintTupleFieldsToStrings(make_tuple());
+TEST(UniversalTersePrintTupleFieldsToStringsTestWithTr1, PrintsEmptyTuple) {
+  Strings result = UniversalTersePrintTupleFieldsToStrings(
+      ::std::tr1::make_tuple());
   EXPECT_EQ(0u, result.size());
 }
 
-TEST(UniversalTersePrintTupleFieldsToStringsTest, PrintsOneTuple) {
-  Strings result = UniversalTersePrintTupleFieldsToStrings(make_tuple(1));
+TEST(UniversalTersePrintTupleFieldsToStringsTestWithTr1, PrintsOneTuple) {
+  Strings result = UniversalTersePrintTupleFieldsToStrings(
+      ::std::tr1::make_tuple(1));
   ASSERT_EQ(1u, result.size());
   EXPECT_EQ("1", result[0]);
 }
 
-TEST(UniversalTersePrintTupleFieldsToStringsTest, PrintsTwoTuple) {
-  Strings result = UniversalTersePrintTupleFieldsToStrings(make_tuple(1, 'a'));
+TEST(UniversalTersePrintTupleFieldsToStringsTestWithTr1, PrintsTwoTuple) {
+  Strings result = UniversalTersePrintTupleFieldsToStrings(
+      ::std::tr1::make_tuple(1, 'a'));
   ASSERT_EQ(2u, result.size());
   EXPECT_EQ("1", result[0]);
   EXPECT_EQ("'a' (97, 0x61)", result[1]);
 }
 
-TEST(UniversalTersePrintTupleFieldsToStringsTest, PrintsTersely) {
+TEST(UniversalTersePrintTupleFieldsToStringsTestWithTr1, PrintsTersely) {
   const int n = 1;
   Strings result = UniversalTersePrintTupleFieldsToStrings(
-      tuple<const int&, const char*>(n, "a"));
+      ::std::tr1::tuple<const int&, const char*>(n, "a"));
   ASSERT_EQ(2u, result.size());
   EXPECT_EQ("1", result[0]);
   EXPECT_EQ("\"a\"", result[1]);
@@ -1303,5 +1597,39 @@ TEST(UniversalTersePrintTupleFieldsToStringsTest, PrintsTersely) {
 
 #endif  // GTEST_HAS_TR1_TUPLE
 
+#if GTEST_HAS_STD_TUPLE_
+
+TEST(UniversalTersePrintTupleFieldsToStringsTestWithStd, PrintsEmptyTuple) {
+  Strings result = UniversalTersePrintTupleFieldsToStrings(::std::make_tuple());
+  EXPECT_EQ(0u, result.size());
+}
+
+TEST(UniversalTersePrintTupleFieldsToStringsTestWithStd, PrintsOneTuple) {
+  Strings result = UniversalTersePrintTupleFieldsToStrings(
+      ::std::make_tuple(1));
+  ASSERT_EQ(1u, result.size());
+  EXPECT_EQ("1", result[0]);
+}
+
+TEST(UniversalTersePrintTupleFieldsToStringsTestWithStd, PrintsTwoTuple) {
+  Strings result = UniversalTersePrintTupleFieldsToStrings(
+      ::std::make_tuple(1, 'a'));
+  ASSERT_EQ(2u, result.size());
+  EXPECT_EQ("1", result[0]);
+  EXPECT_EQ("'a' (97, 0x61)", result[1]);
+}
+
+TEST(UniversalTersePrintTupleFieldsToStringsTestWithStd, PrintsTersely) {
+  const int n = 1;
+  Strings result = UniversalTersePrintTupleFieldsToStrings(
+      ::std::tuple<const int&, const char*>(n, "a"));
+  ASSERT_EQ(2u, result.size());
+  EXPECT_EQ("1", result[0]);
+  EXPECT_EQ("\"a\"", result[1]);
+}
+
+#endif  // GTEST_HAS_STD_TUPLE_
+
 }  // namespace gtest_printers_test
 }  // namespace testing
+
index dd4ba43..93628ba 100755 (executable)
 //
 // Author: wan@google.com (Zhanyong Wan)
 
+#include "test/gtest-typed-test_test.h"
+
 #include <set>
 #include <vector>
 
-#include "test/gtest-typed-test_test.h"
 #include "gtest/gtest.h"
 
 using testing::Test;
@@ -343,6 +344,25 @@ REGISTER_TYPED_TEST_CASE_P(NumericTest,
 typedef Types<int, double> NumericTypes;
 INSTANTIATE_TYPED_TEST_CASE_P(My, NumericTest, NumericTypes);
 
+static const char* GetTestName() {
+  return testing::UnitTest::GetInstance()->current_test_info()->name();
+}
+// Test the stripping of space from test names
+template <typename T> class TrimmedTest : public Test { };
+TYPED_TEST_CASE_P(TrimmedTest);
+TYPED_TEST_P(TrimmedTest, Test1) { EXPECT_STREQ("Test1", GetTestName()); }
+TYPED_TEST_P(TrimmedTest, Test2) { EXPECT_STREQ("Test2", GetTestName()); }
+TYPED_TEST_P(TrimmedTest, Test3) { EXPECT_STREQ("Test3", GetTestName()); }
+TYPED_TEST_P(TrimmedTest, Test4) { EXPECT_STREQ("Test4", GetTestName()); }
+TYPED_TEST_P(TrimmedTest, Test5) { EXPECT_STREQ("Test5", GetTestName()); }
+REGISTER_TYPED_TEST_CASE_P(
+    TrimmedTest,
+    Test1, Test2,Test3 , Test4 ,Test5 );  // NOLINT
+template <typename T1, typename T2> struct MyPair {};
+// Be sure to try a type with a comma in its name just in case it matters.
+typedef Types<int, double, MyPair<int, int> > TrimTypes;
+INSTANTIATE_TYPED_TEST_CASE_P(My, TrimmedTest, TrimTypes);
+
 }  // namespace library2
 
 #endif  // GTEST_HAS_TYPED_TEST_P
index 07083e5..b1f5168 100755 (executable)
@@ -54,7 +54,7 @@ class UnitTestHelper {
  public:
   // Returns the array of pointers to all test cases sorted by the test case
   // name.  The caller is responsible for deleting the array.
-  static TestCase const** const GetSortedTestCases() {
+  static TestCase const** GetSortedTestCases() {
     UnitTest& unit_test = *UnitTest::GetInstance();
     TestCase const** const test_cases =
         new const TestCase*[unit_test.total_test_case_count()];
@@ -83,7 +83,7 @@ class UnitTestHelper {
   // Returns the array of pointers to all tests in a particular test case
   // sorted by the test name.  The caller is responsible for deleting the
   // array.
-  static TestInfo const** const GetSortedTests(const TestCase* test_case) {
+  static TestInfo const** GetSortedTests(const TestCase* test_case) {
     TestInfo const** const tests =
         new const TestInfo*[test_case->total_test_count()];
 
index c819183..78f3e0f 100755 (executable)
@@ -66,21 +66,15 @@ EXE_PATH = gtest_test_utils.GetTestExecutablePath(
     'gtest_break_on_failure_unittest_')
 
 
-# Utilities.
-
-
-environ = os.environ.copy()
-
-
-def SetEnvVar(env_var, value):
-  """Sets an environment variable to a given value; unsets it when the
-  given value is None.
-  """
-
-  if value is not None:
-    environ[env_var] = value
-  elif env_var in environ:
-    del environ[env_var]
+environ = gtest_test_utils.environ
+SetEnvVar = gtest_test_utils.SetEnvVar
+
+# Tests in this file run a Google-Test-based test program and expect it
+# to terminate prematurely.  Therefore they are incompatible with
+# the premature-exit-file protocol by design.  Unset the
+# premature-exit filepath to prevent Google Test from creating
+# the file.
+SetEnvVar(gtest_test_utils.PREMATURE_EXIT_FILE_ENV_VAR, None)
 
 
 def Run(command):
index 7fd7dba..e6fc22f 100755 (executable)
@@ -57,14 +57,27 @@ EX_EXE_PATH = gtest_test_utils.GetTestExecutablePath(
 EXE_PATH = gtest_test_utils.GetTestExecutablePath(
     'gtest_catch_exceptions_no_ex_test_')
 
-TEST_LIST = gtest_test_utils.Subprocess([EXE_PATH, LIST_TESTS_FLAG]).output
+environ = gtest_test_utils.environ
+SetEnvVar = gtest_test_utils.SetEnvVar
+
+# Tests in this file run a Google-Test-based test program and expect it
+# to terminate prematurely.  Therefore they are incompatible with
+# the premature-exit-file protocol by design.  Unset the
+# premature-exit filepath to prevent Google Test from creating
+# the file.
+SetEnvVar(gtest_test_utils.PREMATURE_EXIT_FILE_ENV_VAR, None)
+
+TEST_LIST = gtest_test_utils.Subprocess(
+    [EXE_PATH, LIST_TESTS_FLAG], env=environ).output
 
 SUPPORTS_SEH_EXCEPTIONS = 'ThrowsSehException' in TEST_LIST
 
 if SUPPORTS_SEH_EXCEPTIONS:
-  BINARY_OUTPUT = gtest_test_utils.Subprocess([EXE_PATH]).output
+  BINARY_OUTPUT = gtest_test_utils.Subprocess([EXE_PATH], env=environ).output
+
+EX_BINARY_OUTPUT = gtest_test_utils.Subprocess(
+    [EX_EXE_PATH], env=environ).output
 
-EX_BINARY_OUTPUT = gtest_test_utils.Subprocess([EX_EXE_PATH]).output
 
 # The tests.
 if SUPPORTS_SEH_EXCEPTIONS:
@@ -117,14 +130,17 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
                  '"CxxExceptionInConstructorTest" (no quotes) '
                  'appears on the same line as words "called unexpectedly"')
 
-  def testCatchesCxxExceptionsInFixtureDestructor(self):
-    self.assert_('C++ exception with description '
-                 '"Standard C++ exception" thrown '
-                 'in the test fixture\'s destructor'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInDestructorTest::TearDownTestCase() '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
+  if ('CxxExceptionInDestructorTest.ThrowsExceptionInDestructor' in
+      EX_BINARY_OUTPUT):
+
+    def testCatchesCxxExceptionsInFixtureDestructor(self):
+      self.assert_('C++ exception with description '
+                   '"Standard C++ exception" thrown '
+                   'in the test fixture\'s destructor'
+                   in EX_BINARY_OUTPUT)
+      self.assert_('CxxExceptionInDestructorTest::TearDownTestCase() '
+                   'called as expected.'
+                   in EX_BINARY_OUTPUT)
 
   def testCatchesCxxExceptionsInSetUpTestCase(self):
     self.assert_('C++ exception with description "Standard C++ exception"'
@@ -209,7 +225,8 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
     uncaught_exceptions_ex_binary_output = gtest_test_utils.Subprocess(
         [EX_EXE_PATH,
          NO_CATCH_EXCEPTIONS_FLAG,
-         FITLER_OUT_SEH_TESTS_FLAG]).output
+         FITLER_OUT_SEH_TESTS_FLAG],
+        env=environ).output
 
     self.assert_('Unhandled C++ exception terminating the program'
                  in uncaught_exceptions_ex_binary_output)
index a35103f..d0fc82c 100755 (executable)
@@ -137,6 +137,8 @@ TEST_F(CxxExceptionInConstructorTest, ThrowsExceptionInConstructor) {
                 << "called unexpectedly.";
 }
 
+// Exceptions in destructors are not supported in C++11.
+#if !defined(__GXX_EXPERIMENTAL_CXX0X__) &&  __cplusplus < 201103L
 class CxxExceptionInDestructorTest : public Test {
  public:
   static void TearDownTestCase() {
@@ -153,6 +155,7 @@ class CxxExceptionInDestructorTest : public Test {
 };
 
 TEST_F(CxxExceptionInDestructorTest, ThrowsExceptionInDestructor) {}
+#endif  // C++11 mode
 
 class CxxExceptionInSetUpTestCaseTest : public Test {
  public:
index ac24337..424075c 100755 (executable)
@@ -47,8 +47,8 @@ environ = os.environ.copy()
 
 def AssertEq(expected, actual):
   if expected != actual:
-    print 'Expected: %s' % (expected,)
-    print '  Actual: %s' % (actual,)
+    print('Expected: %s' % (expected,))
+    print('  Actual: %s' % (actual,))
     raise AssertionError
 
 
@@ -87,6 +87,7 @@ class GTestEnvVarTest(gtest_test_utils.TestCase):
     TestFlag('break_on_failure', '1', '0')
     TestFlag('color', 'yes', 'auto')
     TestFlag('filter', 'FooTest.Bar', '*')
+    SetEnvVar('XML_OUTPUT_FILE', None) # For 'output' test
     TestFlag('output', 'xml:tmp/foo.xml', '')
     TestFlag('print_time', '0', '1')
     TestFlag('repeat', '999', '1')
@@ -98,6 +99,19 @@ class GTestEnvVarTest(gtest_test_utils.TestCase):
       TestFlag('death_test_use_fork', '1', '0')
       TestFlag('stack_trace_depth', '0', '100')
 
+  def testXmlOutputFile(self):
+    """Tests that $XML_OUTPUT_FILE affects the output flag."""
+
+    SetEnvVar('GTEST_OUTPUT', None)
+    SetEnvVar('XML_OUTPUT_FILE', 'tmp/bar.xml')
+    AssertEq('xml:tmp/bar.xml', GetFlag('output'))
+
+  def testXmlOutputFileOverride(self):
+    """Tests that $XML_OUTPUT_FILE is overridden by $GTEST_OUTPUT"""
+
+    SetEnvVar('GTEST_OUTPUT', 'xml:tmp/foo.xml')
+    SetEnvVar('XML_OUTPUT_FILE', 'tmp/bar.xml')
+    AssertEq('xml:tmp/foo.xml', GetFlag('output'))
 
 if __name__ == '__main__':
   gtest_test_utils.Main()
index ec9aa2c..3cff19e 100755 (executable)
@@ -96,6 +96,7 @@ class MyEnvironment : public testing::Environment {
 
   // Was TearDown() run?
   bool tear_down_was_run() const { return tear_down_was_run_; }
+
  private:
   FailureType failure_in_set_up_;
   bool set_up_was_run_;
index 0d1a770..ec0b151 100755 (executable)
@@ -44,7 +44,10 @@ __author__ = 'wan@google.com (Zhanyong Wan)'
 
 import os
 import re
-import sets
+try:
+  from sets import Set as set  # For Python 2.3 compatibility
+except ImportError:
+  pass
 import sys
 
 import gtest_test_utils
@@ -58,7 +61,7 @@ import gtest_test_utils
 # exception is thrown if the input is anything other than 'True' nor 'False'.
 os.environ['EMPTY_VAR'] = ''
 child = gtest_test_utils.Subprocess(
-    [sys.executable, '-c', 'import os; print \'EMPTY_VAR\' in os.environ'])
+    [sys.executable, '-c', 'import os; print(\'EMPTY_VAR\' in os.environ)'])
 CAN_PASS_EMPTY_ENV = eval(child.output)
 
 
@@ -71,7 +74,7 @@ CAN_PASS_EMPTY_ENV = eval(child.output)
 os.environ['UNSET_VAR'] = 'X'
 del os.environ['UNSET_VAR']
 child = gtest_test_utils.Subprocess(
-    [sys.executable, '-c', 'import os; print \'UNSET_VAR\' not in os.environ'])
+    [sys.executable, '-c', 'import os; print(\'UNSET_VAR\' not in os.environ)'])
 CAN_UNSET_ENV = eval(child.output)
 
 
@@ -243,14 +246,14 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
     for slice_var in list_of_sets:
       full_partition.extend(slice_var)
     self.assertEqual(len(set_var), len(full_partition))
-    self.assertEqual(sets.Set(set_var), sets.Set(full_partition))
+    self.assertEqual(set(set_var), set(full_partition))
 
   def AdjustForParameterizedTests(self, tests_to_run):
     """Adjust tests_to_run in case value parameterized tests are disabled."""
 
     global param_tests_present
     if not param_tests_present:
-      return list(sets.Set(tests_to_run) - sets.Set(PARAM_TESTS))
+      return list(set(tests_to_run) - set(PARAM_TESTS))
     else:
       return tests_to_run
 
index ce8c3ef..f2d2fd1 100755 (executable)
@@ -40,6 +40,7 @@ Google Test) the command line flags.
 __author__ = 'phanna@google.com (Patrick Hanna)'
 
 import gtest_test_utils
+import re
 
 
 # Constants.
@@ -52,38 +53,63 @@ EXE_PATH = gtest_test_utils.GetTestExecutablePath('gtest_list_tests_unittest_')
 
 # The expected output when running gtest_list_tests_unittest_ with
 # --gtest_list_tests
-EXPECTED_OUTPUT_NO_FILTER = """FooDeathTest.
+EXPECTED_OUTPUT_NO_FILTER_RE = re.compile(r"""FooDeathTest\.
   Test1
-Foo.
+Foo\.
   Bar1
   Bar2
   DISABLED_Bar3
-Abc.
+Abc\.
   Xyz
   Def
-FooBar.
+FooBar\.
   Baz
-FooTest.
+FooTest\.
   Test1
   DISABLED_Test2
   Test3
-"""
+TypedTest/0\.  # TypeParam = (VeryLo{245}|class VeryLo{239})\.\.\.
+  TestA
+  TestB
+TypedTest/1\.  # TypeParam = int\s*\*( __ptr64)?
+  TestA
+  TestB
+TypedTest/2\.  # TypeParam = .*MyArray<bool,\s*42>
+  TestA
+  TestB
+My/TypeParamTest/0\.  # TypeParam = (VeryLo{245}|class VeryLo{239})\.\.\.
+  TestA
+  TestB
+My/TypeParamTest/1\.  # TypeParam = int\s*\*( __ptr64)?
+  TestA
+  TestB
+My/TypeParamTest/2\.  # TypeParam = .*MyArray<bool,\s*42>
+  TestA
+  TestB
+MyInstantiation/ValueParamTest\.
+  TestA/0  # GetParam\(\) = one line
+  TestA/1  # GetParam\(\) = two\\nlines
+  TestA/2  # GetParam\(\) = a very\\nlo{241}\.\.\.
+  TestB/0  # GetParam\(\) = one line
+  TestB/1  # GetParam\(\) = two\\nlines
+  TestB/2  # GetParam\(\) = a very\\nlo{241}\.\.\.
+""")
 
 # The expected output when running gtest_list_tests_unittest_ with
 # --gtest_list_tests and --gtest_filter=Foo*.
-EXPECTED_OUTPUT_FILTER_FOO = """FooDeathTest.
+EXPECTED_OUTPUT_FILTER_FOO_RE = re.compile(r"""FooDeathTest\.
   Test1
-Foo.
+Foo\.
   Bar1
   Bar2
   DISABLED_Bar3
-FooBar.
+FooBar\.
   Baz
-FooTest.
+FooTest\.
   Test1
   DISABLED_Test2
   Test3
-"""
+""")
 
 # Utilities.
 
@@ -100,19 +126,18 @@ def Run(args):
 class GTestListTestsUnitTest(gtest_test_utils.TestCase):
   """Tests using the --gtest_list_tests flag to list all tests."""
 
-  def RunAndVerify(self, flag_value, expected_output, other_flag):
+  def RunAndVerify(self, flag_value, expected_output_re, other_flag):
     """Runs gtest_list_tests_unittest_ and verifies that it prints
     the correct tests.
 
     Args:
-      flag_value:       value of the --gtest_list_tests flag;
-                        None if the flag should not be present.
-
-      expected_output:  the expected output after running command;
-
-      other_flag:       a different flag to be passed to command
-                        along with gtest_list_tests;
-                        None if the flag should not be present.
+      flag_value:         value of the --gtest_list_tests flag;
+                          None if the flag should not be present.
+      expected_output_re: regular expression that matches the expected
+                          output after running command;
+      other_flag:         a different flag to be passed to command
+                          along with gtest_list_tests;
+                          None if the flag should not be present.
     """
 
     if flag_value is None:
@@ -132,36 +157,41 @@ class GTestListTestsUnitTest(gtest_test_utils.TestCase):
 
     output = Run(args)
 
-    msg = ('when %s is %s, the output of "%s" is "%s".' %
-           (LIST_TESTS_FLAG, flag_expression, ' '.join(args), output))
-
-    if expected_output is not None:
-      self.assert_(output == expected_output, msg)
+    if expected_output_re:
+      self.assert_(
+          expected_output_re.match(output),
+          ('when %s is %s, the output of "%s" is "%s",\n'
+           'which does not match regex "%s"' %
+           (LIST_TESTS_FLAG, flag_expression, ' '.join(args), output,
+            expected_output_re.pattern)))
     else:
-      self.assert_(output != EXPECTED_OUTPUT_NO_FILTER, msg)
+      self.assert_(
+          not EXPECTED_OUTPUT_NO_FILTER_RE.match(output),
+          ('when %s is %s, the output of "%s" is "%s"'%
+           (LIST_TESTS_FLAG, flag_expression, ' '.join(args), output)))
 
   def testDefaultBehavior(self):
     """Tests the behavior of the default mode."""
 
     self.RunAndVerify(flag_value=None,
-                      expected_output=None,
+                      expected_output_re=None,
                       other_flag=None)
 
   def testFlag(self):
     """Tests using the --gtest_list_tests flag."""
 
     self.RunAndVerify(flag_value='0',
-                      expected_output=None,
+                      expected_output_re=None,
                       other_flag=None)
     self.RunAndVerify(flag_value='1',
-                      expected_output=EXPECTED_OUTPUT_NO_FILTER,
+                      expected_output_re=EXPECTED_OUTPUT_NO_FILTER_RE,
                       other_flag=None)
 
   def testOverrideNonFilterFlags(self):
     """Tests that --gtest_list_tests overrides the non-filter flags."""
 
     self.RunAndVerify(flag_value='1',
-                      expected_output=EXPECTED_OUTPUT_NO_FILTER,
+                      expected_output_re=EXPECTED_OUTPUT_NO_FILTER_RE,
                       other_flag='--gtest_break_on_failure')
 
   def testWithFilterFlags(self):
@@ -169,7 +199,7 @@ class GTestListTestsUnitTest(gtest_test_utils.TestCase):
     --gtest_filter flag."""
 
     self.RunAndVerify(flag_value='1',
-                      expected_output=EXPECTED_OUTPUT_FILTER_FOO,
+                      expected_output_re=EXPECTED_OUTPUT_FILTER_FOO_RE,
                       other_flag='--gtest_filter=Foo*')
 
 
index 2b1d078..907c176 100755 (executable)
@@ -40,8 +40,6 @@
 
 #include "gtest/gtest.h"
 
-namespace {
-
 // Several different test cases and tests that will be listed.
 TEST(Foo, Bar1) {
 }
@@ -76,7 +74,81 @@ TEST_F(FooTest, Test3) {
 TEST(FooDeathTest, Test1) {
 }
 
-}  // namespace
+// A group of value-parameterized tests.
+
+class MyType {
+ public:
+  explicit MyType(const std::string& a_value) : value_(a_value) {}
+
+  const std::string& value() const { return value_; }
+
+ private:
+  std::string value_;
+};
+
+// Teaches Google Test how to print a MyType.
+void PrintTo(const MyType& x, std::ostream* os) {
+  *os << x.value();
+}
+
+class ValueParamTest : public testing::TestWithParam<MyType> {
+};
+
+TEST_P(ValueParamTest, TestA) {
+}
+
+TEST_P(ValueParamTest, TestB) {
+}
+
+INSTANTIATE_TEST_CASE_P(
+    MyInstantiation, ValueParamTest,
+    testing::Values(MyType("one line"),
+                    MyType("two\nlines"),
+                    MyType("a very\nloooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong line")));  // NOLINT
+
+// A group of typed tests.
+
+// A deliberately long type name for testing the line-truncating
+// behavior when printing a type parameter.
+class VeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooogName {  // NOLINT
+};
+
+template <typename T>
+class TypedTest : public testing::Test {
+};
+
+template <typename T, int kSize>
+class MyArray {
+};
+
+typedef testing::Types<VeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooogName,  // NOLINT
+                       int*, MyArray<bool, 42> > MyTypes;
+
+TYPED_TEST_CASE(TypedTest, MyTypes);
+
+TYPED_TEST(TypedTest, TestA) {
+}
+
+TYPED_TEST(TypedTest, TestB) {
+}
+
+// A group of type-parameterized tests.
+
+template <typename T>
+class TypeParamTest : public testing::Test {
+};
+
+TYPED_TEST_CASE_P(TypeParamTest);
+
+TYPED_TEST_P(TypeParamTest, TestA) {
+}
+
+TYPED_TEST_P(TypeParamTest, TestB) {
+}
+
+REGISTER_TYPED_TEST_CASE_P(TypeParamTest, TestA, TestB);
+
+INSTANTIATE_TYPED_TEST_CASE_P(My, TypeParamTest, MyTypes);
 
 int main(int argc, char **argv) {
   ::testing::InitGoogleTest(&argc, argv);
index e3a85f1..292599a 100755 (executable)
@@ -34,7 +34,6 @@
 
 #include "gtest/gtest.h"
 
-
 int main(int argc, char **argv) {
   testing::InitGoogleTest(&argc, argv);
 
index f409e2a..06dbee0 100755 (executable)
@@ -40,6 +40,7 @@ SYNOPSIS
 
 __author__ = 'wan@google.com (Zhanyong Wan)'
 
+import difflib
 import os
 import re
 import sys
@@ -58,22 +59,22 @@ GOLDEN_NAME = 'gtest_output_test_golden_lin.txt'
 PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('gtest_output_test_')
 
 # At least one command we exercise must not have the
-# --gtest_internal_skip_environment_and_ad_hoc_tests flag.
+# 'internal_skip_environment_and_ad_hoc_tests' argument.
 COMMAND_LIST_TESTS = ({}, [PROGRAM_PATH, '--gtest_list_tests'])
 COMMAND_WITH_COLOR = ({}, [PROGRAM_PATH, '--gtest_color=yes'])
 COMMAND_WITH_TIME = ({}, [PROGRAM_PATH,
                           '--gtest_print_time',
-                          '--gtest_internal_skip_environment_and_ad_hoc_tests',
+                          'internal_skip_environment_and_ad_hoc_tests',
                           '--gtest_filter=FatalFailureTest.*:LoggingTest.*'])
 COMMAND_WITH_DISABLED = (
     {}, [PROGRAM_PATH,
          '--gtest_also_run_disabled_tests',
-         '--gtest_internal_skip_environment_and_ad_hoc_tests',
+         'internal_skip_environment_and_ad_hoc_tests',
          '--gtest_filter=*DISABLED_*'])
 COMMAND_WITH_SHARDING = (
     {'GTEST_SHARD_INDEX': '1', 'GTEST_TOTAL_SHARDS': '2'},
     [PROGRAM_PATH,
-     '--gtest_internal_skip_environment_and_ad_hoc_tests',
+     'internal_skip_environment_and_ad_hoc_tests',
      '--gtest_filter=PassingTest.*'])
 
 GOLDEN_PATH = os.path.join(gtest_test_utils.GetSourceDir(), GOLDEN_NAME)
@@ -252,8 +253,8 @@ SUPPORTS_STACK_TRACES = False
 
 CAN_GENERATE_GOLDEN_FILE = (SUPPORTS_DEATH_TESTS and
                             SUPPORTS_TYPED_TESTS and
-                            SUPPORTS_THREADS)
-
+                            SUPPORTS_THREADS and
+                            not IS_WINDOWS)
 
 class GTestOutputTest(gtest_test_utils.TestCase):
   def RemoveUnsupportedTests(self, test_output):
@@ -278,7 +279,7 @@ class GTestOutputTest(gtest_test_utils.TestCase):
   def testOutput(self):
     output = GetOutputOfAllCommands()
 
-    golden_file = open(GOLDEN_PATH, 'rb')
+    golden_file = open(GOLDEN_PATH, 'r')
     # A mis-configured source control system can cause \r appear in EOL
     # sequences when we read the golden file irrespective of an operating
     # system used. Therefore, we need to strip those \r's from newlines
@@ -294,7 +295,11 @@ class GTestOutputTest(gtest_test_utils.TestCase):
     normalized_golden = RemoveTypeInfoDetails(golden)
 
     if CAN_GENERATE_GOLDEN_FILE:
-      self.assertEqual(normalized_golden, normalized_actual)
+      self.assertEqual(normalized_golden, normalized_actual,
+                       '\n'.join(difflib.unified_diff(
+                           normalized_golden.split('\n'),
+                           normalized_actual.split('\n'),
+                           'golden', 'actual')))
     else:
       normalized_actual = NormalizeToCurrentPlatform(
           RemoveTestCounts(normalized_actual))
index 13dbec4..1070a9f 100755 (executable)
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //
-// A unit test for Google Test itself.  This verifies that the basic
-// constructs of Google Test work.
+// The purpose of this file is to generate Google Test output under
+// various conditions.  The output will then be verified by
+// gtest_output_test.py to ensure that Google Test generates the
+// desired messages.  Therefore, most tests in this file are MEANT TO
+// FAIL.
 //
 // Author: wan@google.com (Zhanyong Wan)
 
@@ -55,8 +58,6 @@ using testing::internal::ThreadWithParam;
 #endif
 
 namespace posix = ::testing::internal::posix;
-using testing::internal::String;
-using testing::internal::scoped_ptr;
 
 // Tests catching fatal failures.
 
@@ -101,6 +102,21 @@ INSTANTIATE_TEST_CASE_P(PrintingFailingParams,
                         FailingParamTest,
                         testing::Values(2));
 
+static const char kGoldenString[] = "\"Line\0 1\"\nLine 2";
+
+TEST(NonfatalFailureTest, EscapesStringOperands) {
+  std::string actual = "actual \"string\"";
+  EXPECT_EQ(kGoldenString, actual);
+
+  const char* golden = kGoldenString;
+  EXPECT_EQ(golden, actual);
+}
+
+TEST(NonfatalFailureTest, DiffForLongStrings) {
+  std::string golden_str(kGoldenString, sizeof(kGoldenString) - 1);
+  EXPECT_EQ(golden_str, "Line 2");
+}
+
 // Tests catching a fatal failure in a subroutine.
 TEST(FatalFailureTest, FatalFailureInSubroutine) {
   printf("(expecting a failure that x should be 1)\n");
@@ -221,13 +237,13 @@ TEST(SCOPED_TRACETest, CanBeRepeated) {
 
   {
     SCOPED_TRACE("C");
-    ADD_FAILURE() << "This failure is expected, and should contain "
-                  << "trace point A, B, and C.";
+    ADD_FAILURE() << "This failure is expected, and should "
+                  << "contain trace point A, B, and C.";
   }
 
   SCOPED_TRACE("D");
-  ADD_FAILURE() << "This failure is expected, and should contain "
-                << "trace point A, B, and D.";
+  ADD_FAILURE() << "This failure is expected, and should "
+                << "contain trace point A, B, and D.";
 }
 
 #if GTEST_IS_THREADSAFE
@@ -378,6 +394,7 @@ class FatalFailureInFixtureConstructorTest : public testing::Test {
                   << "We should never get here, as the test fixture c'tor "
                   << "had a fatal failure.";
   }
+
  private:
   void Init() {
     FAIL() << "Expected failure #1, in the test fixture c'tor.";
@@ -497,7 +514,8 @@ class DeathTestAndMultiThreadsTest : public testing::Test {
 
  private:
   SpawnThreadNotifications notifications_;
-  scoped_ptr<ThreadWithParam<SpawnThreadNotifications*> > thread_;
+  testing::internal::scoped_ptr<ThreadWithParam<SpawnThreadNotifications*> >
+      thread_;
 };
 
 #endif  // GTEST_IS_THREADSAFE
@@ -737,6 +755,32 @@ TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
 
 #endif  // GTEST_HAS_EXCEPTIONS
 
+// This #ifdef block tests the output of value-parameterized tests.
+
+#if GTEST_HAS_PARAM_TEST
+
+std::string ParamNameFunc(const testing::TestParamInfo<std::string>& info) {
+  return info.param;
+}
+
+class ParamTest : public testing::TestWithParam<std::string> {
+};
+
+TEST_P(ParamTest, Success) {
+  EXPECT_EQ("a", GetParam());
+}
+
+TEST_P(ParamTest, Failure) {
+  EXPECT_EQ("b", GetParam()) << "Expected failure";
+}
+
+INSTANTIATE_TEST_CASE_P(PrintingStrings,
+                        ParamTest,
+                        testing::Values(std::string("a")),
+                        ParamNameFunc);
+
+#endif  // GTEST_HAS_PARAM_TEST
+
 // This #ifdef block tests the output of typed tests.
 #if GTEST_HAS_TYPED_TEST
 
@@ -972,8 +1016,6 @@ class BarEnvironment : public testing::Environment {
   }
 };
 
-bool GTEST_FLAG(internal_skip_environment_and_ad_hoc_tests) = false;
-
 // The main function.
 //
 // The idea is to use Google Test to run all the tests we have defined (some
@@ -990,9 +1032,9 @@ int main(int argc, char **argv) {
   // global side effects.  The following line serves as a sanity test
   // for it.
   testing::InitGoogleTest(&argc, argv);
-  if (argc >= 2 &&
-      String(argv[1]) == "--gtest_internal_skip_environment_and_ad_hoc_tests")
-    GTEST_FLAG(internal_skip_environment_and_ad_hoc_tests) = true;
+  bool internal_skip_environment_and_ad_hoc_tests =
+      std::count(argv, argv + argc,
+                 std::string("internal_skip_environment_and_ad_hoc_tests")) > 0;
 
 #if GTEST_HAS_DEATH_TEST
   if (testing::internal::GTEST_FLAG(internal_run_death_test) != "") {
@@ -1007,7 +1049,7 @@ int main(int argc, char **argv) {
   }
 #endif  // GTEST_HAS_DEATH_TEST
 
-  if (GTEST_FLAG(internal_skip_environment_and_ad_hoc_tests))
+  if (internal_skip_environment_and_ad_hoc_tests)
     return RUN_ALL_TESTS();
 
   // Registers two global test environments.
index a1d342d..2223d56 100755 (executable)
@@ -5,9 +5,9 @@ Value of: false
   Actual: false
 Expected: true
 gtest_output_test_.cc:#: Failure
-Value of: 3
-Expected: 2
-\e[0;32m[==========] \e[mRunning 62 tests from 27 test cases.
+      Expected: 2
+To be equal to: 3
+\e[0;32m[==========] \e[mRunning 66 tests from 29 test cases.
 \e[0;32m[----------] \e[mGlobal test environment set-up.
 FooEnvironment::SetUp() called.
 BarEnvironment::SetUp() called.
@@ -31,20 +31,44 @@ BarEnvironment::SetUp() called.
 \e[0;32m[       OK ] \e[mPassingTest.PassingTest1
 \e[0;32m[ RUN      ] \e[mPassingTest.PassingTest2
 \e[0;32m[       OK ] \e[mPassingTest.PassingTest2
+\e[0;32m[----------] \e[m2 tests from NonfatalFailureTest
+\e[0;32m[ RUN      ] \e[mNonfatalFailureTest.EscapesStringOperands
+gtest_output_test_.cc:#: Failure
+      Expected: kGoldenString
+      Which is: "\"Line"
+To be equal to: actual
+      Which is: "actual \"string\""
+gtest_output_test_.cc:#: Failure
+      Expected: golden
+      Which is: "\"Line"
+To be equal to: actual
+      Which is: "actual \"string\""
+\e[0;31m[  FAILED  ] \e[mNonfatalFailureTest.EscapesStringOperands
+\e[0;32m[ RUN      ] \e[mNonfatalFailureTest.DiffForLongStrings
+gtest_output_test_.cc:#: Failure
+      Expected: golden_str
+      Which is: "\"Line\0 1\"\nLine 2"
+To be equal to: "Line 2"
+With diff:
+@@ -1,2 @@
+-\"Line\0 1\"
+ Line 2
+
+\e[0;31m[  FAILED  ] \e[mNonfatalFailureTest.DiffForLongStrings
 \e[0;32m[----------] \e[m3 tests from FatalFailureTest
 \e[0;32m[ RUN      ] \e[mFatalFailureTest.FatalFailureInSubroutine
 (expecting a failure that x should be 1)
 gtest_output_test_.cc:#: Failure
-Value of: x
-  Actual: 2
-Expected: 1
+      Expected: 1
+To be equal to: x
+      Which is: 2
 \e[0;31m[  FAILED  ] \e[mFatalFailureTest.FatalFailureInSubroutine
 \e[0;32m[ RUN      ] \e[mFatalFailureTest.FatalFailureInNestedSubroutine
 (expecting a failure that x should be 1)
 gtest_output_test_.cc:#: Failure
-Value of: x
-  Actual: 2
-Expected: 1
+      Expected: 1
+To be equal to: x
+      Which is: 2
 \e[0;31m[  FAILED  ] \e[mFatalFailureTest.FatalFailureInNestedSubroutine
 \e[0;32m[ RUN      ] \e[mFatalFailureTest.NonfatalFailureInSubroutine
 (expecting a failure on false)
@@ -83,39 +107,39 @@ This failure is expected, and shouldn't have a trace.
 \e[0;32m[ RUN      ] \e[mSCOPED_TRACETest.WorksInLoop
 (expected to fail)
 gtest_output_test_.cc:#: Failure
-Value of: n
-  Actual: 1
-Expected: 2
+      Expected: 2
+To be equal to: n
+      Which is: 1
 Google Test trace:
 gtest_output_test_.cc:#: i = 1
 gtest_output_test_.cc:#: Failure
-Value of: n
-  Actual: 2
-Expected: 1
+      Expected: 1
+To be equal to: n
+      Which is: 2
 Google Test trace:
 gtest_output_test_.cc:#: i = 2
 \e[0;31m[  FAILED  ] \e[mSCOPED_TRACETest.WorksInLoop
 \e[0;32m[ RUN      ] \e[mSCOPED_TRACETest.WorksInSubroutine
 (expected to fail)
 gtest_output_test_.cc:#: Failure
-Value of: n
-  Actual: 1
-Expected: 2
+      Expected: 2
+To be equal to: n
+      Which is: 1
 Google Test trace:
 gtest_output_test_.cc:#: n = 1
 gtest_output_test_.cc:#: Failure
-Value of: n
-  Actual: 2
-Expected: 1
+      Expected: 1
+To be equal to: n
+      Which is: 2
 Google Test trace:
 gtest_output_test_.cc:#: n = 2
 \e[0;31m[  FAILED  ] \e[mSCOPED_TRACETest.WorksInSubroutine
 \e[0;32m[ RUN      ] \e[mSCOPED_TRACETest.CanBeNested
 (expected to fail)
 gtest_output_test_.cc:#: Failure
-Value of: n
-  Actual: 2
-Expected: 1
+      Expected: 1
+To be equal to: n
+      Which is: 2
 Google Test trace:
 gtest_output_test_.cc:#: n = 2
 gtest_output_test_.cc:#: 
@@ -413,9 +437,9 @@ Expected: 1 fatal failure
 \e[0;32m[       OK ] \e[mTypedTest/0.Success
 \e[0;32m[ RUN      ] \e[mTypedTest/0.Failure
 gtest_output_test_.cc:#: Failure
-Value of: TypeParam()
-  Actual: 0
-Expected: 1
+      Expected: 1
+To be equal to: TypeParam()
+      Which is: 0
 Expected failure
 \e[0;31m[  FAILED  ] \e[mTypedTest/0.Failure, where TypeParam = int
 \e[0;32m[----------] \e[m2 tests from Unsigned/TypedTestP/0, where TypeParam = unsigned char
@@ -423,10 +447,10 @@ Expected failure
 \e[0;32m[       OK ] \e[mUnsigned/TypedTestP/0.Success
 \e[0;32m[ RUN      ] \e[mUnsigned/TypedTestP/0.Failure
 gtest_output_test_.cc:#: Failure
-Value of: TypeParam()
-  Actual: '\0'
-Expected: 1U
-Which is: 1
+      Expected: 1U
+      Which is: 1
+To be equal to: TypeParam()
+      Which is: '\0'
 Expected failure
 \e[0;31m[  FAILED  ] \e[mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
 \e[0;32m[----------] \e[m2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned int
@@ -434,10 +458,10 @@ Expected failure
 \e[0;32m[       OK ] \e[mUnsigned/TypedTestP/1.Success
 \e[0;32m[ RUN      ] \e[mUnsigned/TypedTestP/1.Failure
 gtest_output_test_.cc:#: Failure
-Value of: TypeParam()
-  Actual: 0
-Expected: 1U
-Which is: 1
+      Expected: 1U
+      Which is: 1
+To be equal to: TypeParam()
+      Which is: 0
 Expected failure
 \e[0;31m[  FAILED  ] \e[mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
 \e[0;32m[----------] \e[m4 tests from ExpectFailureTest
@@ -573,10 +597,20 @@ Expected non-fatal failure.
 \e[0;32m[----------] \e[m1 test from PrintingFailingParams/FailingParamTest
 \e[0;32m[ RUN      ] \e[mPrintingFailingParams/FailingParamTest.Fails/0
 gtest_output_test_.cc:#: Failure
-Value of: GetParam()
-  Actual: 2
-Expected: 1
+      Expected: 1
+To be equal to: GetParam()
+      Which is: 2
 \e[0;31m[  FAILED  ] \e[mPrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2
+\e[0;32m[----------] \e[m2 tests from PrintingStrings/ParamTest
+\e[0;32m[ RUN      ] \e[mPrintingStrings/ParamTest.Success/a
+\e[0;32m[       OK ] \e[mPrintingStrings/ParamTest.Success/a
+\e[0;32m[ RUN      ] \e[mPrintingStrings/ParamTest.Failure/a
+gtest_output_test_.cc:#: Failure
+      Expected: "b"
+To be equal to: GetParam()
+      Which is: "a"
+Expected failure
+\e[0;31m[  FAILED  ] \e[mPrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
 \e[0;32m[----------] \e[mGlobal test environment tear-down
 BarEnvironment::TearDown() called.
 gtest_output_test_.cc:#: Failure
@@ -586,9 +620,11 @@ FooEnvironment::TearDown() called.
 gtest_output_test_.cc:#: Failure
 Failed
 Expected fatal failure.
-\e[0;32m[==========] \e[m62 tests from 27 test cases ran.
-\e[0;32m[  PASSED  ] \e[m21 tests.
-\e[0;31m[  FAILED  ] \e[m41 tests, listed below:
+\e[0;32m[==========] \e[m66 tests from 29 test cases ran.
+\e[0;32m[  PASSED  ] \e[m22 tests.
+\e[0;31m[  FAILED  ] \e[m44 tests, listed below:
+\e[0;31m[  FAILED  ] \e[mNonfatalFailureTest.EscapesStringOperands
+\e[0;31m[  FAILED  ] \e[mNonfatalFailureTest.DiffForLongStrings
 \e[0;31m[  FAILED  ] \e[mFatalFailureTest.FatalFailureInSubroutine
 \e[0;31m[  FAILED  ] \e[mFatalFailureTest.FatalFailureInNestedSubroutine
 \e[0;31m[  FAILED  ] \e[mFatalFailureTest.NonfatalFailureInSubroutine
@@ -630,8 +666,9 @@ Expected fatal failure.
 \e[0;31m[  FAILED  ] \e[mExpectFailureWithThreadsTest.ExpectNonFatalFailure
 \e[0;31m[  FAILED  ] \e[mScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread
 \e[0;31m[  FAILED  ] \e[mPrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2
+\e[0;31m[  FAILED  ] \e[mPrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
 
-41 FAILED TESTS
+44 FAILED TESTS
 \e[0;33m  YOU HAVE 1 DISABLED TEST
 
 \e[mNote: Google Test filter = FatalFailureTest.*:LoggingTest.*
@@ -641,16 +678,16 @@ Expected fatal failure.
 [ RUN      ] FatalFailureTest.FatalFailureInSubroutine
 (expecting a failure that x should be 1)
 gtest_output_test_.cc:#: Failure
-Value of: x
-  Actual: 2
-Expected: 1
+      Expected: 1
+To be equal to: x
+      Which is: 2
 [  FAILED  ] FatalFailureTest.FatalFailureInSubroutine (? ms)
 [ RUN      ] FatalFailureTest.FatalFailureInNestedSubroutine
 (expecting a failure that x should be 1)
 gtest_output_test_.cc:#: Failure
-Value of: x
-  Actual: 2
-Expected: 1
+      Expected: 1
+To be equal to: x
+      Which is: 2
 [  FAILED  ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms)
 [ RUN      ] FatalFailureTest.NonfatalFailureInSubroutine
 (expecting a failure on false)
@@ -685,8 +722,6 @@ Expected: (3) >= (a[i]), actual: 3 vs 6
 [  FAILED  ] LoggingTest.InterleavingLoggingAndAssertions
 
  4 FAILED TESTS
-  YOU HAVE 1 DISABLED TEST
-
 Note: Google Test filter = *DISABLED_*
 [==========] Running 1 test from 1 test case.
 [----------] Global test environment set-up.
@@ -706,6 +741,3 @@ Note: This is test shard 2 of 2.
 [----------] Global test environment tear-down
 [==========] 1 test from 1 test case ran.
 [  PASSED  ] 1 test.
-
-  YOU HAVE 1 DISABLED TEST
-
diff --git a/test/gtest_output_test_golden_win.txt b/test/gtest_output_test_golden_win.txt
deleted file mode 100644 (file)
index 313c3aa..0000000
+++ /dev/null
@@ -1,605 +0,0 @@
-The non-test part of the code is expected to have 2 failures.
-
-gtest_output_test_.cc:#: error: Value of: false
-  Actual: false
-Expected: true
-gtest_output_test_.cc:#: error: Value of: 3
-Expected: 2
-[==========] Running 61 tests from 27 test cases.
-[----------] Global test environment set-up.
-FooEnvironment::SetUp() called.
-BarEnvironment::SetUp() called.
-[----------] 1 test from ADeathTest
-[ RUN      ] ADeathTest.ShouldRunFirst
-[       OK ] ADeathTest.ShouldRunFirst
-[----------] 1 test from ATypedDeathTest/0, where TypeParam = int
-[ RUN      ] ATypedDeathTest/0.ShouldRunFirst
-[       OK ] ATypedDeathTest/0.ShouldRunFirst
-[----------] 1 test from ATypedDeathTest/1, where TypeParam = double
-[ RUN      ] ATypedDeathTest/1.ShouldRunFirst
-[       OK ] ATypedDeathTest/1.ShouldRunFirst
-[----------] 1 test from My/ATypeParamDeathTest/0, where TypeParam = int
-[ RUN      ] My/ATypeParamDeathTest/0.ShouldRunFirst
-[       OK ] My/ATypeParamDeathTest/0.ShouldRunFirst
-[----------] 1 test from My/ATypeParamDeathTest/1, where TypeParam = double
-[ RUN      ] My/ATypeParamDeathTest/1.ShouldRunFirst
-[       OK ] My/ATypeParamDeathTest/1.ShouldRunFirst
-[----------] 2 tests from PassingTest
-[ RUN      ] PassingTest.PassingTest1
-[       OK ] PassingTest.PassingTest1
-[ RUN      ] PassingTest.PassingTest2
-[       OK ] PassingTest.PassingTest2
-[----------] 3 tests from FatalFailureTest
-[ RUN      ] FatalFailureTest.FatalFailureInSubroutine
-(expecting a failure that x should be 1)
-gtest_output_test_.cc:#: error: Value of: x
-  Actual: 2
-Expected: 1
-[  FAILED  ] FatalFailureTest.FatalFailureInSubroutine
-[ RUN      ] FatalFailureTest.FatalFailureInNestedSubroutine
-(expecting a failure that x should be 1)
-gtest_output_test_.cc:#: error: Value of: x
-  Actual: 2
-Expected: 1
-[  FAILED  ] FatalFailureTest.FatalFailureInNestedSubroutine
-[ RUN      ] FatalFailureTest.NonfatalFailureInSubroutine
-(expecting a failure on false)
-gtest_output_test_.cc:#: error: Value of: false
-  Actual: false
-Expected: true
-[  FAILED  ] FatalFailureTest.NonfatalFailureInSubroutine
-[----------] 1 test from LoggingTest
-[ RUN      ] LoggingTest.InterleavingLoggingAndAssertions
-(expecting 2 failures on (3) >= (a[i]))
-i == 0
-i == 1
-gtest_output_test_.cc:#: error: Expected: (3) >= (a[i]), actual: 3 vs 9
-i == 2
-i == 3
-gtest_output_test_.cc:#: error: Expected: (3) >= (a[i]), actual: 3 vs 6
-[  FAILED  ] LoggingTest.InterleavingLoggingAndAssertions
-[----------] 5 tests from SCOPED_TRACETest
-[ RUN      ] SCOPED_TRACETest.ObeysScopes
-(expected to fail)
-gtest_output_test_.cc:#: error: Failed
-This failure is expected, and shouldn't have a trace.
-gtest_output_test_.cc:#: error: Failed
-This failure is expected, and should have a trace.
-Google Test trace:
-gtest_output_test_.cc:#: Expected trace
-gtest_output_test_.cc:#: error: Failed
-This failure is expected, and shouldn't have a trace.
-[  FAILED  ] SCOPED_TRACETest.ObeysScopes
-[ RUN      ] SCOPED_TRACETest.WorksInLoop
-(expected to fail)
-gtest_output_test_.cc:#: error: Value of: n
-  Actual: 1
-Expected: 2
-Google Test trace:
-gtest_output_test_.cc:#: i = 1
-gtest_output_test_.cc:#: error: Value of: n
-  Actual: 2
-Expected: 1
-Google Test trace:
-gtest_output_test_.cc:#: i = 2
-[  FAILED  ] SCOPED_TRACETest.WorksInLoop
-[ RUN      ] SCOPED_TRACETest.WorksInSubroutine
-(expected to fail)
-gtest_output_test_.cc:#: error: Value of: n
-  Actual: 1
-Expected: 2
-Google Test trace:
-gtest_output_test_.cc:#: n = 1
-gtest_output_test_.cc:#: error: Value of: n
-  Actual: 2
-Expected: 1
-Google Test trace:
-gtest_output_test_.cc:#: n = 2
-[  FAILED  ] SCOPED_TRACETest.WorksInSubroutine
-[ RUN      ] SCOPED_TRACETest.CanBeNested
-(expected to fail)
-gtest_output_test_.cc:#: error: Value of: n
-  Actual: 2
-Expected: 1
-Google Test trace:
-gtest_output_test_.cc:#: n = 2
-gtest_output_test_.cc:#: 
-[  FAILED  ] SCOPED_TRACETest.CanBeNested
-[ RUN      ] SCOPED_TRACETest.CanBeRepeated
-(expected to fail)
-gtest_output_test_.cc:#: error: Failed
-This failure is expected, and should contain trace point A.
-Google Test trace:
-gtest_output_test_.cc:#: A
-gtest_output_test_.cc:#: error: Failed
-This failure is expected, and should contain trace point A and B.
-Google Test trace:
-gtest_output_test_.cc:#: B
-gtest_output_test_.cc:#: A
-gtest_output_test_.cc:#: error: Failed
-This failure is expected, and should contain trace point A, B, and C.
-Google Test trace:
-gtest_output_test_.cc:#: C
-gtest_output_test_.cc:#: B
-gtest_output_test_.cc:#: A
-gtest_output_test_.cc:#: error: Failed
-This failure is expected, and should contain trace point A, B, and D.
-Google Test trace:
-gtest_output_test_.cc:#: D
-gtest_output_test_.cc:#: B
-gtest_output_test_.cc:#: A
-[  FAILED  ] SCOPED_TRACETest.CanBeRepeated
-[----------] 1 test from NonFatalFailureInFixtureConstructorTest
-[ RUN      ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
-(expecting 5 failures)
-gtest_output_test_.cc:#: error: Failed
-Expected failure #1, in the test fixture c'tor.
-gtest_output_test_.cc:#: error: Failed
-Expected failure #2, in SetUp().
-gtest_output_test_.cc:#: error: Failed
-Expected failure #3, in the test body.
-gtest_output_test_.cc:#: error: Failed
-Expected failure #4, in TearDown.
-gtest_output_test_.cc:#: error: Failed
-Expected failure #5, in the test fixture d'tor.
-[  FAILED  ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
-[----------] 1 test from FatalFailureInFixtureConstructorTest
-[ RUN      ] FatalFailureInFixtureConstructorTest.FailureInConstructor
-(expecting 2 failures)
-gtest_output_test_.cc:#: error: Failed
-Expected failure #1, in the test fixture c'tor.
-gtest_output_test_.cc:#: error: Failed
-Expected failure #2, in the test fixture d'tor.
-[  FAILED  ] FatalFailureInFixtureConstructorTest.FailureInConstructor
-[----------] 1 test from NonFatalFailureInSetUpTest
-[ RUN      ] NonFatalFailureInSetUpTest.FailureInSetUp
-(expecting 4 failures)
-gtest_output_test_.cc:#: error: Failed
-Expected failure #1, in SetUp().
-gtest_output_test_.cc:#: error: Failed
-Expected failure #2, in the test function.
-gtest_output_test_.cc:#: error: Failed
-Expected failure #3, in TearDown().
-gtest_output_test_.cc:#: error: Failed
-Expected failure #4, in the test fixture d'tor.
-[  FAILED  ] NonFatalFailureInSetUpTest.FailureInSetUp
-[----------] 1 test from FatalFailureInSetUpTest
-[ RUN      ] FatalFailureInSetUpTest.FailureInSetUp
-(expecting 3 failures)
-gtest_output_test_.cc:#: error: Failed
-Expected failure #1, in SetUp().
-gtest_output_test_.cc:#: error: Failed
-Expected failure #2, in TearDown().
-gtest_output_test_.cc:#: error: Failed
-Expected failure #3, in the test fixture d'tor.
-[  FAILED  ] FatalFailureInSetUpTest.FailureInSetUp
-[----------] 1 test from ExceptionInFixtureCtorTest
-[ RUN      ] ExceptionInFixtureCtorTest.ExceptionInFixtureCtor
-(expecting a failure on thrown exception in the test fixture's constructor)
-unknown file: error: Exception thrown with code 0xc0000005 in the test fixture's constructor.
-[----------] 1 test from ExceptionInSetUpTest
-[ RUN      ] ExceptionInSetUpTest.ExceptionInSetUp
-(expecting 3 failures)
-unknown file: error: Exception thrown with code 0xc0000005 in SetUp().
-gtest_output_test_.cc:#: error: Failed
-Expected failure #2, in TearDown().
-gtest_output_test_.cc:#: error: Failed
-Expected failure #3, in the test fixture d'tor.
-[  FAILED  ] ExceptionInSetUpTest.ExceptionInSetUp
-[----------] 2 tests from ExceptionInTestFunctionTest
-[ RUN      ] ExceptionInTestFunctionTest.SEH
-(expecting 3 failures)
-unknown file: error: Exception thrown with code 0xc0000005 in the test body.
-gtest_output_test_.cc:#: error: Failed
-Expected failure #2, in TearDown().
-gtest_output_test_.cc:#: error: Failed
-Expected failure #3, in the test fixture d'tor.
-[  FAILED  ] ExceptionInTestFunctionTest.SEH
-[ RUN      ] ExceptionInTestFunctionTest.CppException
-unknown file: error: Exception thrown with code 0xe06d7363 in the test body.
-gtest_output_test_.cc:#: error: Failed
-Expected failure #2, in TearDown().
-gtest_output_test_.cc:#: error: Failed
-Expected failure #3, in the test fixture d'tor.
-[  FAILED  ] ExceptionInTestFunctionTest.CppException
-[----------] 1 test from ExceptionInTearDownTest
-[ RUN      ] ExceptionInTearDownTest.ExceptionInTearDown
-(expecting 2 failures)
-unknown file: error: Exception thrown with code 0xe06d7363 in TearDown().
-gtest_output_test_.cc:#: error: Failed
-Expected failure #2, in the test fixture d'tor.
-[  FAILED  ] ExceptionInTearDownTest.ExceptionInTearDown
-[----------] 4 tests from MixedUpTestCaseTest
-[ RUN      ] MixedUpTestCaseTest.FirstTestFromNamespaceFoo
-[       OK ] MixedUpTestCaseTest.FirstTestFromNamespaceFoo
-[ RUN      ] MixedUpTestCaseTest.SecondTestFromNamespaceFoo
-[       OK ] MixedUpTestCaseTest.SecondTestFromNamespaceFoo
-[ RUN      ] MixedUpTestCaseTest.ThisShouldFail
-gtest.cc:#: error: Failed
-All tests in the same test case must use the same test fixture
-class.  However, in test case MixedUpTestCaseTest,
-you defined test FirstTestFromNamespaceFoo and test ThisShouldFail
-using two different test fixture classes.  This can happen if
-the two classes are from different namespaces or translation
-units and have the same name.  You should probably rename one
-of the classes to put the tests into different test cases.
-[  FAILED  ] MixedUpTestCaseTest.ThisShouldFail
-[ RUN      ] MixedUpTestCaseTest.ThisShouldFailToo
-gtest.cc:#: error: Failed
-All tests in the same test case must use the same test fixture
-class.  However, in test case MixedUpTestCaseTest,
-you defined test FirstTestFromNamespaceFoo and test ThisShouldFailToo
-using two different test fixture classes.  This can happen if
-the two classes are from different namespaces or translation
-units and have the same name.  You should probably rename one
-of the classes to put the tests into different test cases.
-[  FAILED  ] MixedUpTestCaseTest.ThisShouldFailToo
-[----------] 2 tests from MixedUpTestCaseWithSameTestNameTest
-[ RUN      ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
-[       OK ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
-[ RUN      ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
-gtest.cc:#: error: Failed
-All tests in the same test case must use the same test fixture
-class.  However, in test case MixedUpTestCaseWithSameTestNameTest,
-you defined test TheSecondTestWithThisNameShouldFail and test TheSecondTestWithThisNameShouldFail
-using two different test fixture classes.  This can happen if
-the two classes are from different namespaces or translation
-units and have the same name.  You should probably rename one
-of the classes to put the tests into different test cases.
-[  FAILED  ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
-[----------] 2 tests from TEST_F_before_TEST_in_same_test_case
-[ RUN      ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F
-[       OK ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F
-[ RUN      ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail
-gtest.cc:#: error: Failed
-All tests in the same test case must use the same test fixture
-class, so mixing TEST_F and TEST in the same test case is
-illegal.  In test case TEST_F_before_TEST_in_same_test_case,
-test DefinedUsingTEST_F is defined using TEST_F but
-test DefinedUsingTESTAndShouldFail is defined using TEST.  You probably
-want to change the TEST to TEST_F or move it to another test
-case.
-[  FAILED  ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail
-[----------] 2 tests from TEST_before_TEST_F_in_same_test_case
-[ RUN      ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST
-[       OK ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST
-[ RUN      ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
-gtest.cc:#: error: Failed
-All tests in the same test case must use the same test fixture
-class, so mixing TEST_F and TEST in the same test case is
-illegal.  In test case TEST_before_TEST_F_in_same_test_case,
-test DefinedUsingTEST_FAndShouldFail is defined using TEST_F but
-test DefinedUsingTEST is defined using TEST.  You probably
-want to change the TEST to TEST_F or move it to another test
-case.
-[  FAILED  ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
-[----------] 8 tests from ExpectNonfatalFailureTest
-[ RUN      ] ExpectNonfatalFailureTest.CanReferenceGlobalVariables
-[       OK ] ExpectNonfatalFailureTest.CanReferenceGlobalVariables
-[ RUN      ] ExpectNonfatalFailureTest.CanReferenceLocalVariables
-[       OK ] ExpectNonfatalFailureTest.CanReferenceLocalVariables
-[ RUN      ] ExpectNonfatalFailureTest.SucceedsWhenThereIsOneNonfatalFailure
-[       OK ] ExpectNonfatalFailureTest.SucceedsWhenThereIsOneNonfatalFailure
-[ RUN      ] ExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure
-(expecting a failure)
-gtest.cc:#: error: Expected: 1 non-fatal failure
-  Actual: 0 failures
-[  FAILED  ] ExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure
-[ RUN      ] ExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
-(expecting a failure)
-gtest.cc:#: error: Expected: 1 non-fatal failure
-  Actual: 2 failures
-gtest_output_test_.cc:#: Non-fatal failure:
-Failed
-Expected non-fatal failure 1.
-
-gtest_output_test_.cc:#: Non-fatal failure:
-Failed
-Expected non-fatal failure 2.
-
-[  FAILED  ] ExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
-[ RUN      ] ExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
-(expecting a failure)
-gtest.cc:#: error: Expected: 1 non-fatal failure
-  Actual:
-gtest_output_test_.cc:#: Fatal failure:
-Failed
-Expected fatal failure.
-
-[  FAILED  ] ExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
-[ RUN      ] ExpectNonfatalFailureTest.FailsWhenStatementReturns
-(expecting a failure)
-gtest.cc:#: error: Expected: 1 non-fatal failure
-  Actual: 0 failures
-[  FAILED  ] ExpectNonfatalFailureTest.FailsWhenStatementReturns
-[ RUN      ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
-(expecting a failure)
-gtest.cc:#: error: Expected: 1 non-fatal failure
-  Actual: 0 failures
-[  FAILED  ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
-[----------] 8 tests from ExpectFatalFailureTest
-[ RUN      ] ExpectFatalFailureTest.CanReferenceGlobalVariables
-[       OK ] ExpectFatalFailureTest.CanReferenceGlobalVariables
-[ RUN      ] ExpectFatalFailureTest.CanReferenceLocalStaticVariables
-[       OK ] ExpectFatalFailureTest.CanReferenceLocalStaticVariables
-[ RUN      ] ExpectFatalFailureTest.SucceedsWhenThereIsOneFatalFailure
-[       OK ] ExpectFatalFailureTest.SucceedsWhenThereIsOneFatalFailure
-[ RUN      ] ExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure
-(expecting a failure)
-gtest.cc:#: error: Expected: 1 fatal failure
-  Actual: 0 failures
-[  FAILED  ] ExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure
-[ RUN      ] ExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
-(expecting a failure)
-gtest.cc:#: error: Expected: 1 fatal failure
-  Actual: 2 failures
-gtest_output_test_.cc:#: Fatal failure:
-Failed
-Expected fatal failure.
-
-gtest_output_test_.cc:#: Fatal failure:
-Failed
-Expected fatal failure.
-
-[  FAILED  ] ExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
-[ RUN      ] ExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
-(expecting a failure)
-gtest.cc:#: error: Expected: 1 fatal failure
-  Actual:
-gtest_output_test_.cc:#: Non-fatal failure:
-Failed
-Expected non-fatal failure.
-
-[  FAILED  ] ExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
-[ RUN      ] ExpectFatalFailureTest.FailsWhenStatementReturns
-(expecting a failure)
-gtest.cc:#: error: Expected: 1 fatal failure
-  Actual: 0 failures
-[  FAILED  ] ExpectFatalFailureTest.FailsWhenStatementReturns
-[ RUN      ] ExpectFatalFailureTest.FailsWhenStatementThrows
-(expecting a failure)
-gtest.cc:#: error: Expected: 1 fatal failure
-  Actual: 0 failures
-[  FAILED  ] ExpectFatalFailureTest.FailsWhenStatementThrows
-[----------] 2 tests from TypedTest/0, where TypeParam = int
-[ RUN      ] TypedTest/0.Success
-[       OK ] TypedTest/0.Success
-[ RUN      ] TypedTest/0.Failure
-gtest_output_test_.cc:#: error: Value of: TypeParam()
-  Actual: 0
-Expected: 1
-Expected failure
-[  FAILED  ] TypedTest/0.Failure
-[----------] 2 tests from Unsigned/TypedTestP/0, where TypeParam = unsigned char
-[ RUN      ] Unsigned/TypedTestP/0.Success
-[       OK ] Unsigned/TypedTestP/0.Success
-[ RUN      ] Unsigned/TypedTestP/0.Failure
-gtest_output_test_.cc:#: error: Value of: TypeParam()
-  Actual: \0
-Expected: 1U
-Which is: 1
-Expected failure
-[  FAILED  ] Unsigned/TypedTestP/0.Failure
-[----------] 2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned int
-[ RUN      ] Unsigned/TypedTestP/1.Success
-[       OK ] Unsigned/TypedTestP/1.Success
-[ RUN      ] Unsigned/TypedTestP/1.Failure
-gtest_output_test_.cc:#: error: Value of: TypeParam()
-  Actual: 0
-Expected: 1U
-Which is: 1
-Expected failure
-[  FAILED  ] Unsigned/TypedTestP/1.Failure
-[----------] 4 tests from ExpectFailureTest
-[ RUN      ] ExpectFailureTest.ExpectFatalFailure
-(expecting 1 failure)
-gtest.cc:#: error: Expected: 1 fatal failure
-  Actual:
-gtest_output_test_.cc:#: Success:
-Succeeded
-
-(expecting 1 failure)
-gtest.cc:#: error: Expected: 1 fatal failure
-  Actual:
-gtest_output_test_.cc:#: Non-fatal failure:
-Failed
-Expected non-fatal failure.
-
-(expecting 1 failure)
-gtest.cc:#: error: Expected: 1 fatal failure containing "Some other fatal failure expected."
-  Actual:
-gtest_output_test_.cc:#: Fatal failure:
-Failed
-Expected fatal failure.
-
-[  FAILED  ] ExpectFailureTest.ExpectFatalFailure
-[ RUN      ] ExpectFailureTest.ExpectNonFatalFailure
-(expecting 1 failure)
-gtest.cc:#: error: Expected: 1 non-fatal failure
-  Actual:
-gtest_output_test_.cc:#: Success:
-Succeeded
-
-(expecting 1 failure)
-gtest.cc:#: error: Expected: 1 non-fatal failure
-  Actual:
-gtest_output_test_.cc:#: Fatal failure:
-Failed
-Expected fatal failure.
-
-(expecting 1 failure)
-gtest.cc:#: error: Expected: 1 non-fatal failure containing "Some other non-fatal failure."
-  Actual:
-gtest_output_test_.cc:#: Non-fatal failure:
-Failed
-Expected non-fatal failure.
-
-[  FAILED  ] ExpectFailureTest.ExpectNonFatalFailure
-[ RUN      ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
-(expecting 1 failure)
-gtest.cc:#: error: Expected: 1 fatal failure
-  Actual:
-gtest_output_test_.cc:#: Success:
-Succeeded
-
-(expecting 1 failure)
-gtest.cc:#: error: Expected: 1 fatal failure
-  Actual:
-gtest_output_test_.cc:#: Non-fatal failure:
-Failed
-Expected non-fatal failure.
-
-(expecting 1 failure)
-gtest.cc:#: error: Expected: 1 fatal failure containing "Some other fatal failure expected."
-  Actual:
-gtest_output_test_.cc:#: Fatal failure:
-Failed
-Expected fatal failure.
-
-[  FAILED  ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
-[ RUN      ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
-(expecting 1 failure)
-gtest.cc:#: error: Expected: 1 non-fatal failure
-  Actual:
-gtest_output_test_.cc:#: Success:
-Succeeded
-
-(expecting 1 failure)
-gtest.cc:#: error: Expected: 1 non-fatal failure
-  Actual:
-gtest_output_test_.cc:#: Fatal failure:
-Failed
-Expected fatal failure.
-
-(expecting 1 failure)
-gtest.cc:#: error: Expected: 1 non-fatal failure containing "Some other non-fatal failure."
-  Actual:
-gtest_output_test_.cc:#: Non-fatal failure:
-Failed
-Expected non-fatal failure.
-
-[  FAILED  ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
-[----------] Global test environment tear-down
-BarEnvironment::TearDown() called.
-gtest_output_test_.cc:#: error: Failed
-Expected non-fatal failure.
-FooEnvironment::TearDown() called.
-gtest_output_test_.cc:#: error: Failed
-Expected fatal failure.
-[==========] 61 tests from 27 test cases ran.
-[  PASSED  ] 21 tests.
-[  FAILED  ] 40 tests, listed below:
-[  FAILED  ] FatalFailureTest.FatalFailureInSubroutine
-[  FAILED  ] FatalFailureTest.FatalFailureInNestedSubroutine
-[  FAILED  ] FatalFailureTest.NonfatalFailureInSubroutine
-[  FAILED  ] LoggingTest.InterleavingLoggingAndAssertions
-[  FAILED  ] SCOPED_TRACETest.ObeysScopes
-[  FAILED  ] SCOPED_TRACETest.WorksInLoop
-[  FAILED  ] SCOPED_TRACETest.WorksInSubroutine
-[  FAILED  ] SCOPED_TRACETest.CanBeNested
-[  FAILED  ] SCOPED_TRACETest.CanBeRepeated
-[  FAILED  ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
-[  FAILED  ] FatalFailureInFixtureConstructorTest.FailureInConstructor
-[  FAILED  ] NonFatalFailureInSetUpTest.FailureInSetUp
-[  FAILED  ] FatalFailureInSetUpTest.FailureInSetUp
-[  FAILED  ] ExceptionInFixtureCtorTest.ExceptionInFixtureCtor
-[  FAILED  ] ExceptionInSetUpTest.ExceptionInSetUp
-[  FAILED  ] ExceptionInTestFunctionTest.SEH
-[  FAILED  ] ExceptionInTestFunctionTest.CppException
-[  FAILED  ] ExceptionInTearDownTest.ExceptionInTearDown
-[  FAILED  ] MixedUpTestCaseTest.ThisShouldFail
-[  FAILED  ] MixedUpTestCaseTest.ThisShouldFailToo
-[  FAILED  ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
-[  FAILED  ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail
-[  FAILED  ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
-[  FAILED  ] ExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure
-[  FAILED  ] ExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
-[  FAILED  ] ExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
-[  FAILED  ] ExpectNonfatalFailureTest.FailsWhenStatementReturns
-[  FAILED  ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
-[  FAILED  ] ExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure
-[  FAILED  ] ExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
-[  FAILED  ] ExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
-[  FAILED  ] ExpectFatalFailureTest.FailsWhenStatementReturns
-[  FAILED  ] ExpectFatalFailureTest.FailsWhenStatementThrows
-[  FAILED  ] TypedTest/0.Failure, where TypeParam = int
-[  FAILED  ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
-[  FAILED  ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
-[  FAILED  ] ExpectFailureTest.ExpectFatalFailure
-[  FAILED  ] ExpectFailureTest.ExpectNonFatalFailure
-[  FAILED  ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
-[  FAILED  ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
-
-40 FAILED TESTS
-  YOU HAVE 1 DISABLED TEST
-
-Note: Google Test filter = FatalFailureTest.*:LoggingTest.*
-[==========] Running 4 tests from 2 test cases.
-[----------] Global test environment set-up.
-[----------] 3 tests from FatalFailureTest
-[ RUN      ] FatalFailureTest.FatalFailureInSubroutine
-(expecting a failure that x should be 1)
-gtest_output_test_.cc:#: error: Value of: x
-  Actual: 2
-Expected: 1
-[  FAILED  ] FatalFailureTest.FatalFailureInSubroutine (? ms)
-[ RUN      ] FatalFailureTest.FatalFailureInNestedSubroutine
-(expecting a failure that x should be 1)
-gtest_output_test_.cc:#: error: Value of: x
-  Actual: 2
-Expected: 1
-[  FAILED  ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms)
-[ RUN      ] FatalFailureTest.NonfatalFailureInSubroutine
-(expecting a failure on false)
-gtest_output_test_.cc:#: error: Value of: false
-  Actual: false
-Expected: true
-[  FAILED  ] FatalFailureTest.NonfatalFailureInSubroutine (? ms)
-[----------] 3 tests from FatalFailureTest (? ms total)
-
-[----------] 1 test from LoggingTest
-[ RUN      ] LoggingTest.InterleavingLoggingAndAssertions
-(expecting 2 failures on (3) >= (a[i]))
-i == 0
-i == 1
-gtest_output_test_.cc:#: error: Expected: (3) >= (a[i]), actual: 3 vs 9
-i == 2
-i == 3
-gtest_output_test_.cc:#: error: Expected: (3) >= (a[i]), actual: 3 vs 6
-[  FAILED  ] LoggingTest.InterleavingLoggingAndAssertions (? ms)
-[----------] 1 test from LoggingTest (? ms total)
-
-[----------] Global test environment tear-down
-[==========] 4 tests from 2 test cases ran. (? ms total)
-[  PASSED  ] 0 tests.
-[  FAILED  ] 4 tests, listed below:
-[  FAILED  ] FatalFailureTest.FatalFailureInSubroutine
-[  FAILED  ] FatalFailureTest.FatalFailureInNestedSubroutine
-[  FAILED  ] FatalFailureTest.NonfatalFailureInSubroutine
-[  FAILED  ] LoggingTest.InterleavingLoggingAndAssertions
-
- 4 FAILED TESTS
-  YOU HAVE 1 DISABLED TEST
-
-Note: Google Test filter = *DISABLED_*
-[==========] Running 1 test from 1 test case.
-[----------] Global test environment set-up.
-[----------] 1 test from DisabledTestsWarningTest
-[ RUN      ] DisabledTestsWarningTest.DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning
-[       OK ] DisabledTestsWarningTest.DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning
-[----------] Global test environment tear-down
-[==========] 1 test from 1 test case ran.
-[  PASSED  ] 1 test.
-Note: Google Test filter = PassingTest.*
-Note: This is test shard 1 of 2.
-[==========] Running 1 test from 1 test case.
-[----------] Global test environment set-up.
-[----------] 1 test from PassingTest
-[ RUN      ] PassingTest.PassingTest2
-[       OK ] PassingTest.PassingTest2
-[----------] Global test environment tear-down
-[==========] 1 test from 1 test case ran.
-[  PASSED  ] 1 test.
-
-  YOU HAVE 1 DISABLED TEST
-
index 35dc9bc..a84eff8 100755 (executable)
@@ -27,7 +27,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-// This file is AUTOMATICALLY GENERATED on 09/24/2010 by command
+// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command
 // 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!
 
 // Regression test for gtest_pred_impl.h
diff --git a/test/gtest_premature_exit_test.cc b/test/gtest_premature_exit_test.cc
new file mode 100755 (executable)
index 0000000..3b4dc7d
--- /dev/null
@@ -0,0 +1,127 @@
+// Copyright 2013, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: wan@google.com (Zhanyong Wan)
+//
+// Tests that Google Test manipulates the premature-exit-detection
+// file correctly.
+
+#include <stdio.h>
+
+#include "gtest/gtest.h"
+
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::internal::posix::GetEnv;
+using ::testing::internal::posix::Stat;
+using ::testing::internal::posix::StatStruct;
+
+namespace {
+
+class PrematureExitTest : public Test {
+ public:
+  // Returns true iff the given file exists.
+  static bool FileExists(const char* filepath) {
+    StatStruct stat;
+    return Stat(filepath, &stat) == 0;
+  }
+
+ protected:
+  PrematureExitTest() {
+    premature_exit_file_path_ = GetEnv("TEST_PREMATURE_EXIT_FILE");
+
+    // Normalize NULL to "" for ease of handling.
+    if (premature_exit_file_path_ == NULL) {
+      premature_exit_file_path_ = "";
+    }
+  }
+
+  // Returns true iff the premature-exit file exists.
+  bool PrematureExitFileExists() const {
+    return FileExists(premature_exit_file_path_);
+  }
+
+  const char* premature_exit_file_path_;
+};
+
+typedef PrematureExitTest PrematureExitDeathTest;
+
+// Tests that:
+//   - the premature-exit file exists during the execution of a
+//     death test (EXPECT_DEATH*), and
+//   - a death test doesn't interfere with the main test process's
+//     handling of the premature-exit file.
+TEST_F(PrematureExitDeathTest, FileExistsDuringExecutionOfDeathTest) {
+  if (*premature_exit_file_path_ == '\0') {
+    return;
+  }
+
+  EXPECT_DEATH_IF_SUPPORTED({
+      // If the file exists, crash the process such that the main test
+      // process will catch the (expected) crash and report a success;
+      // otherwise don't crash, which will cause the main test process
+      // to report that the death test has failed.
+      if (PrematureExitFileExists()) {
+        exit(1);
+      }
+    }, "");
+}
+
+// Tests that the premature-exit file exists during the execution of a
+// normal (non-death) test.
+TEST_F(PrematureExitTest, PrematureExitFileExistsDuringTestExecution) {
+  if (*premature_exit_file_path_ == '\0') {
+    return;
+  }
+
+  EXPECT_TRUE(PrematureExitFileExists())
+      << " file " << premature_exit_file_path_
+      << " should exist during test execution, but doesn't.";
+}
+
+}  // namespace
+
+int main(int argc, char **argv) {
+  InitGoogleTest(&argc, argv);
+  const int exit_code = RUN_ALL_TESTS();
+
+  // Test that the premature-exit file is deleted upon return from
+  // RUN_ALL_TESTS().
+  const char* const filepath = GetEnv("TEST_PREMATURE_EXIT_FILE");
+  if (filepath != NULL && *filepath != '\0') {
+    if (PrematureExitTest::FileExists(filepath)) {
+      printf(
+          "File %s shouldn't exist after the test program finishes, but does.",
+          filepath);
+      return 1;
+    }
+  }
+
+  return exit_code;
+}
index 5223dc0..481012a 100755 (executable)
@@ -71,7 +71,7 @@ namespace {
                   << "Which is: " << expected_val << "\n";\
       ::testing::internal::posix::Abort();\
     }\
-  } while(::testing::internal::AlwaysFalse())
+  } while (::testing::internal::AlwaysFalse())
 
 
 // Used for verifying that global environment set-up and tear-down are
index 0752789..6fb441b 100755 (executable)
@@ -42,7 +42,6 @@ using ::testing::Test;
 using ::testing::TestEventListeners;
 using ::testing::TestInfo;
 using ::testing::UnitTest;
-using ::testing::internal::String;
 using ::testing::internal::scoped_ptr;
 
 // The test methods are empty, as the sole purpose of this program is
index 4e7d9bf..e7daa43 100755 (executable)
@@ -50,7 +50,6 @@ namespace testing {
 namespace {
 
 using internal::Notification;
-using internal::String;
 using internal::TestPropertyKeyIs;
 using internal::ThreadWithParam;
 using internal::scoped_ptr;
@@ -62,13 +61,13 @@ using internal::scoped_ptr;
 // How many threads to create?
 const int kThreadCount = 50;
 
-String IdToKey(int id, const char* suffix) {
+std::string IdToKey(int id, const char* suffix) {
   Message key;
   key << "key_" << id << "_" << suffix;
   return key.GetString();
 }
 
-String IdToString(int id) {
+std::string IdToString(int id) {
   Message id_message;
   id_message << id;
   return id_message.GetString();
index 4e897bd..4acd36c 100755 (executable)
@@ -56,6 +56,21 @@ GTEST_OUTPUT_VAR_NAME = 'GTEST_OUTPUT'
 IS_WINDOWS = os.name == 'nt'
 IS_CYGWIN = os.name == 'posix' and 'CYGWIN' in os.uname()[0]
 
+# The environment variable for specifying the path to the premature-exit file.
+PREMATURE_EXIT_FILE_ENV_VAR = 'TEST_PREMATURE_EXIT_FILE'
+
+environ = os.environ.copy()
+
+
+def SetEnvVar(env_var, value):
+  """Sets/unsets an environment variable to a given value."""
+
+  if value is not None:
+    environ[env_var] = value
+  elif env_var in environ:
+    del environ[env_var]
+
+
 # Here we expose a class from a particular module, depending on the
 # environment. The comment suppresses the 'Invalid variable name' lint
 # complaint.
@@ -160,10 +175,10 @@ def GetTestExecutablePath(executable_name, build_dir=None):
 
   if not os.path.exists(path):
     message = (
-        'Unable to find the test binary. Please make sure to provide path\n'
-        'to the binary via the --build_dir flag or the BUILD_DIR\n'
-        'environment variable.')
-    print >> sys.stderr, message
+        'Unable to find the test binary "%s". Please make sure to provide\n'
+        'a path to the binary via the --build_dir flag or the BUILD_DIR\n'
+        'environment variable.' % path)
+    sys.stdout.write(message)
     sys.exit(1)
 
   return path
@@ -241,7 +256,7 @@ class Subprocess:
         # Changes made by os.environ.clear are not inheritable by child
         # processes until Python 2.6. To produce inheritable changes we have
         # to delete environment items with the del statement.
-        for key in dest:
+        for key in dest.keys():
           del dest[key]
         dest.update(src)
 
index 5678ffe..3e7740c 100755 (executable)
@@ -70,7 +70,7 @@ def SetEnvVar(env_var, value):
 def Run(command):
   """Runs a command; returns True/False if its exit code is/isn't 0."""
 
-  print 'Running "%s". . .' % ' '.join(command)
+  print('Running "%s". . .' % ' '.join(command))
   p = gtest_test_utils.Subprocess(command)
   return p.exited and p.exit_code == 0
 
index 03776ec..2b88fe3 100755 (executable)
 
 #include "gtest/gtest.h"
 
+#include <stdio.h>                      // for fflush, fprintf, NULL, etc.
+#include <stdlib.h>                     // for exit
+#include <exception>                    // for set_terminate
+
+// This terminate handler aborts the program using exit() rather than abort().
+// This avoids showing pop-ups on Windows systems and core dumps on Unix-like
+// ones.
+void TerminateHandler() {
+  fprintf(stderr, "%s\n", "Unhandled C++ exception terminating the program.");
+  fflush(NULL);
+  exit(1);
+}
+
 int main(int argc, char** argv) {
+#if GTEST_HAS_EXCEPTIONS
+  std::set_terminate(&TerminateHandler);
+#endif
   testing::InitGoogleTest(&argc, argv);
 
   // We want to ensure that people can use Google Test assertions in
   // other testing frameworks, as long as they initialize Google Test
-  // properly and set the thrown-on-failure mode.  Therefore, we don't
+  // properly and set the throw-on-failure mode.  Therefore, we don't
   // use Google Test's constructs for defining and running tests
   // (e.g. TEST and RUN_ALL_TESTS) here.
 
index 6ae57ee..4358370 100755 (executable)
@@ -46,8 +46,8 @@ def Assert(condition):
 
 def AssertEq(expected, actual):
   if expected != actual:
-    print 'Expected: %s' % (expected,)
-    print '  Actual: %s' % (actual,)
+    print('Expected: %s' % (expected,))
+    print('  Actual: %s' % (actual,))
     raise AssertionError
 
 
index 23d6860..88e9413 100755 (executable)
@@ -33,8 +33,6 @@
 // Google Test work.
 
 #include "gtest/gtest.h"
-#include <vector>
-#include <ostream>
 
 // Verifies that the command line flag variables can be accessed
 // in code once <gtest/gtest.h> has been #included.
@@ -58,6 +56,15 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) {
   EXPECT_TRUE(dummy || !dummy);  // Suppresses warning that dummy is unused.
 }
 
+#include <limits.h>  // For INT_MAX.
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include <map>
+#include <vector>
+#include <ostream>
+
 #include "gtest/gtest-spi.h"
 
 // Indicates that this translation unit is part of Google Test's
@@ -69,15 +76,85 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) {
 #include "src/gtest-internal-inl.h"
 #undef GTEST_IMPLEMENTATION_
 
-#include <limits.h>  // For INT_MAX.
-#include <stdlib.h>
-#include <time.h>
-
-#include <map>
-
 namespace testing {
 namespace internal {
 
+#if GTEST_CAN_STREAM_RESULTS_
+
+class StreamingListenerTest : public Test {
+ public:
+  class FakeSocketWriter : public StreamingListener::AbstractSocketWriter {
+   public:
+    // Sends a string to the socket.
+    virtual void Send(const string& message) { output_ += message; }
+
+    string output_;
+  };
+
+  StreamingListenerTest()
+      : fake_sock_writer_(new FakeSocketWriter),
+        streamer_(fake_sock_writer_),
+        test_info_obj_("FooTest", "Bar", NULL, NULL,
+                       CodeLocation(__FILE__, __LINE__), 0, NULL) {}
+
+ protected:
+  string* output() { return &(fake_sock_writer_->output_); }
+
+  FakeSocketWriter* const fake_sock_writer_;
+  StreamingListener streamer_;
+  UnitTest unit_test_;
+  TestInfo test_info_obj_;  // The name test_info_ was taken by testing::Test.
+};
+
+TEST_F(StreamingListenerTest, OnTestProgramEnd) {
+  *output() = "";
+  streamer_.OnTestProgramEnd(unit_test_);
+  EXPECT_EQ("event=TestProgramEnd&passed=1\n", *output());
+}
+
+TEST_F(StreamingListenerTest, OnTestIterationEnd) {
+  *output() = "";
+  streamer_.OnTestIterationEnd(unit_test_, 42);
+  EXPECT_EQ("event=TestIterationEnd&passed=1&elapsed_time=0ms\n", *output());
+}
+
+TEST_F(StreamingListenerTest, OnTestCaseStart) {
+  *output() = "";
+  streamer_.OnTestCaseStart(TestCase("FooTest", "Bar", NULL, NULL));
+  EXPECT_EQ("event=TestCaseStart&name=FooTest\n", *output());
+}
+
+TEST_F(StreamingListenerTest, OnTestCaseEnd) {
+  *output() = "";
+  streamer_.OnTestCaseEnd(TestCase("FooTest", "Bar", NULL, NULL));
+  EXPECT_EQ("event=TestCaseEnd&passed=1&elapsed_time=0ms\n", *output());
+}
+
+TEST_F(StreamingListenerTest, OnTestStart) {
+  *output() = "";
+  streamer_.OnTestStart(test_info_obj_);
+  EXPECT_EQ("event=TestStart&name=Bar\n", *output());
+}
+
+TEST_F(StreamingListenerTest, OnTestEnd) {
+  *output() = "";
+  streamer_.OnTestEnd(test_info_obj_);
+  EXPECT_EQ("event=TestEnd&passed=1&elapsed_time=0ms\n", *output());
+}
+
+TEST_F(StreamingListenerTest, OnTestPartResult) {
+  *output() = "";
+  streamer_.OnTestPartResult(TestPartResult(
+      TestPartResult::kFatalFailure, "foo.cc", 42, "failed=\n&%"));
+
+  // Meta characters in the failure message should be properly escaped.
+  EXPECT_EQ(
+      "event=TestPartResult&file=foo.cc&line=42&message=failed%3D%0A%26%25\n",
+      *output());
+}
+
+#endif  // GTEST_CAN_STREAM_RESULTS_
+
 // Provides access to otherwise private parts of the TestEventListeners class
 // that are needed to test it.
 class TestEventListenersAccessor {
@@ -104,6 +181,18 @@ class TestEventListenersAccessor {
   }
 };
 
+class UnitTestRecordPropertyTestHelper : public Test {
+ protected:
+  UnitTestRecordPropertyTestHelper() {}
+
+  // Forwards to UnitTest::RecordProperty() to bypass access controls.
+  void UnitTestRecordProperty(const char* key, const std::string& value) {
+    unit_test_.RecordProperty(key, value);
+  }
+
+  UnitTest unit_test_;
+};
+
 }  // namespace internal
 }  // namespace testing
 
@@ -112,6 +201,7 @@ using testing::AssertionResult;
 using testing::AssertionSuccess;
 using testing::DoubleLE;
 using testing::EmptyTestEventListener;
+using testing::Environment;
 using testing::FloatLE;
 using testing::GTEST_FLAG(also_run_disabled_tests);
 using testing::GTEST_FLAG(break_on_failure);
@@ -137,12 +227,13 @@ using testing::StaticAssertTypeEq;
 using testing::Test;
 using testing::TestCase;
 using testing::TestEventListeners;
+using testing::TestInfo;
 using testing::TestPartResult;
 using testing::TestPartResultArray;
 using testing::TestProperty;
 using testing::TestResult;
+using testing::TimeInMillis;
 using testing::UnitTest;
-using testing::kMaxStackTraceDepth;
 using testing::internal::AddReference;
 using testing::internal::AlwaysFalse;
 using testing::internal::AlwaysTrue;
@@ -156,6 +247,7 @@ using testing::internal::CountIf;
 using testing::internal::EqFailure;
 using testing::internal::FloatingPoint;
 using testing::internal::ForEach;
+using testing::internal::FormatEpochTimeInMillisAsIso8601;
 using testing::internal::FormatTimeInMillisAsSeconds;
 using testing::internal::GTestFlagSaver;
 using testing::internal::GetCurrentOsStackTraceExceptTop;
@@ -163,6 +255,7 @@ using testing::internal::GetElementOr;
 using testing::internal::GetNextRandomSeed;
 using testing::internal::GetRandomSeedFromFlag;
 using testing::internal::GetTestTypeId;
+using testing::internal::GetTimeInMillis;
 using testing::internal::GetTypeId;
 using testing::internal::GetUnitTestImpl;
 using testing::internal::ImplicitlyConvertible;
@@ -174,6 +267,8 @@ using testing::internal::IsContainerTest;
 using testing::internal::IsNotContainer;
 using testing::internal::NativeArray;
 using testing::internal::ParseInt32Flag;
+using testing::internal::RelationToSourceCopy;
+using testing::internal::RelationToSourceReference;
 using testing::internal::RemoveConst;
 using testing::internal::RemoveReference;
 using testing::internal::ShouldRunTestOnShard;
@@ -188,11 +283,12 @@ using testing::internal::TestEventListenersAccessor;
 using testing::internal::TestResultAccessor;
 using testing::internal::UInt32;
 using testing::internal::WideStringToUtf8;
-using testing::internal::kCopy;
+using testing::internal::edit_distance::CalculateOptimalEdits;
+using testing::internal::edit_distance::CreateUnifiedDiff;
+using testing::internal::edit_distance::EditType;
 using testing::internal::kMaxRandomSeed;
-using testing::internal::kReference;
 using testing::internal::kTestTypeIdInGoogleTest;
-using testing::internal::scoped_ptr;
+using testing::kMaxStackTraceDepth;
 
 #if GTEST_HAS_STREAM_REDIRECTION
 using testing::internal::CaptureStdout;
@@ -308,6 +404,93 @@ TEST(FormatTimeInMillisAsSecondsTest, FormatsNegativeNumber) {
   EXPECT_EQ("-3", FormatTimeInMillisAsSeconds(-3000));
 }
 
+// Tests FormatEpochTimeInMillisAsIso8601().  The correctness of conversion
+// for particular dates below was verified in Python using
+// datetime.datetime.fromutctimestamp(<timetamp>/1000).
+
+// FormatEpochTimeInMillisAsIso8601 depends on the current timezone, so we
+// have to set up a particular timezone to obtain predictable results.
+class FormatEpochTimeInMillisAsIso8601Test : public Test {
+ public:
+  // On Cygwin, GCC doesn't allow unqualified integer literals to exceed
+  // 32 bits, even when 64-bit integer types are available.  We have to
+  // force the constants to have a 64-bit type here.
+  static const TimeInMillis kMillisPerSec = 1000;
+
+ private:
+  virtual void SetUp() {
+    saved_tz_ = NULL;
+
+    GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* getenv, strdup: deprecated */)
+    if (getenv("TZ"))
+      saved_tz_ = strdup(getenv("TZ"));
+    GTEST_DISABLE_MSC_WARNINGS_POP_()
+
+    // Set up the time zone for FormatEpochTimeInMillisAsIso8601 to use.  We
+    // cannot use the local time zone because the function's output depends
+    // on the time zone.
+    SetTimeZone("UTC+00");
+  }
+
+  virtual void TearDown() {
+    SetTimeZone(saved_tz_);
+    free(const_cast<char*>(saved_tz_));
+    saved_tz_ = NULL;
+  }
+
+  static void SetTimeZone(const char* time_zone) {
+    // tzset() distinguishes between the TZ variable being present and empty
+    // and not being present, so we have to consider the case of time_zone
+    // being NULL.
+#if _MSC_VER
+    // ...Unless it's MSVC, whose standard library's _putenv doesn't
+    // distinguish between an empty and a missing variable.
+    const std::string env_var =
+        std::string("TZ=") + (time_zone ? time_zone : "");
+    _putenv(env_var.c_str());
+    GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* deprecated function */)
+    tzset();
+    GTEST_DISABLE_MSC_WARNINGS_POP_()
+#else
+    if (time_zone) {
+      setenv(("TZ"), time_zone, 1);
+    } else {
+      unsetenv("TZ");
+    }
+    tzset();
+#endif
+  }
+
+  const char* saved_tz_;
+};
+
+const TimeInMillis FormatEpochTimeInMillisAsIso8601Test::kMillisPerSec;
+
+TEST_F(FormatEpochTimeInMillisAsIso8601Test, PrintsTwoDigitSegments) {
+  EXPECT_EQ("2011-10-31T18:52:42",
+            FormatEpochTimeInMillisAsIso8601(1320087162 * kMillisPerSec));
+}
+
+TEST_F(FormatEpochTimeInMillisAsIso8601Test, MillisecondsDoNotAffectResult) {
+  EXPECT_EQ(
+      "2011-10-31T18:52:42",
+      FormatEpochTimeInMillisAsIso8601(1320087162 * kMillisPerSec + 234));
+}
+
+TEST_F(FormatEpochTimeInMillisAsIso8601Test, PrintsLeadingZeroes) {
+  EXPECT_EQ("2011-09-03T05:07:02",
+            FormatEpochTimeInMillisAsIso8601(1315026422 * kMillisPerSec));
+}
+
+TEST_F(FormatEpochTimeInMillisAsIso8601Test, Prints24HourTime) {
+  EXPECT_EQ("2011-09-28T17:08:22",
+            FormatEpochTimeInMillisAsIso8601(1317229702 * kMillisPerSec));
+}
+
+TEST_F(FormatEpochTimeInMillisAsIso8601Test, PrintsEpochStart) {
+  EXPECT_EQ("1970-01-01T00:00:00", FormatEpochTimeInMillisAsIso8601(0));
+}
+
 #if GTEST_CAN_COMPARE_NULL
 
 # ifdef __BORLANDC__
@@ -322,15 +505,6 @@ TEST(NullLiteralTest, IsTrueForNullLiterals) {
   EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0));
   EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0U));
   EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0L));
-
-# ifndef __BORLANDC__
-
-  // Some compilers may fail to detect some null pointer literals;
-  // as long as users of the framework don't use such literals, this
-  // is harmless.
-  EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(1 - 1));
-
-# endif
 }
 
 // Tests that GTEST_IS_NULL_LITERAL_(x) is false when x is not a null
@@ -353,45 +527,41 @@ TEST(NullLiteralTest, IsFalseForNonNullLiterals) {
 
 // Tests that the NUL character L'\0' is encoded correctly.
 TEST(CodePointToUtf8Test, CanEncodeNul) {
-  char buffer[32];
-  EXPECT_STREQ("", CodePointToUtf8(L'\0', buffer));
+  EXPECT_EQ("", CodePointToUtf8(L'\0'));
 }
 
 // Tests that ASCII characters are encoded correctly.
 TEST(CodePointToUtf8Test, CanEncodeAscii) {
-  char buffer[32];
-  EXPECT_STREQ("a", CodePointToUtf8(L'a', buffer));
-  EXPECT_STREQ("Z", CodePointToUtf8(L'Z', buffer));
-  EXPECT_STREQ("&", CodePointToUtf8(L'&', buffer));
-  EXPECT_STREQ("\x7F", CodePointToUtf8(L'\x7F', buffer));
+  EXPECT_EQ("a", CodePointToUtf8(L'a'));
+  EXPECT_EQ("Z", CodePointToUtf8(L'Z'));
+  EXPECT_EQ("&", CodePointToUtf8(L'&'));
+  EXPECT_EQ("\x7F", CodePointToUtf8(L'\x7F'));
 }
 
 // Tests that Unicode code-points that have 8 to 11 bits are encoded
 // as 110xxxxx 10xxxxxx.
 TEST(CodePointToUtf8Test, CanEncode8To11Bits) {
-  char buffer[32];
   // 000 1101 0011 => 110-00011 10-010011
-  EXPECT_STREQ("\xC3\x93", CodePointToUtf8(L'\xD3', buffer));
+  EXPECT_EQ("\xC3\x93", CodePointToUtf8(L'\xD3'));
 
   // 101 0111 0110 => 110-10101 10-110110
   // Some compilers (e.g., GCC on MinGW) cannot handle non-ASCII codepoints
   // in wide strings and wide chars. In order to accomodate them, we have to
   // introduce such character constants as integers.
-  EXPECT_STREQ("\xD5\xB6",
-               CodePointToUtf8(static_cast<wchar_t>(0x576), buffer));
+  EXPECT_EQ("\xD5\xB6",
+            CodePointToUtf8(static_cast<wchar_t>(0x576)));
 }
 
 // Tests that Unicode code-points that have 12 to 16 bits are encoded
 // as 1110xxxx 10xxxxxx 10xxxxxx.
 TEST(CodePointToUtf8Test, CanEncode12To16Bits) {
-  char buffer[32];
   // 0000 1000 1101 0011 => 1110-0000 10-100011 10-010011
-  EXPECT_STREQ("\xE0\xA3\x93",
-               CodePointToUtf8(static_cast<wchar_t>(0x8D3), buffer));
+  EXPECT_EQ("\xE0\xA3\x93",
+            CodePointToUtf8(static_cast<wchar_t>(0x8D3)));
 
   // 1100 0111 0100 1101 => 1110-1100 10-011101 10-001101
-  EXPECT_STREQ("\xEC\x9D\x8D",
-               CodePointToUtf8(static_cast<wchar_t>(0xC74D), buffer));
+  EXPECT_EQ("\xEC\x9D\x8D",
+            CodePointToUtf8(static_cast<wchar_t>(0xC74D)));
 }
 
 #if !GTEST_WIDE_STRING_USES_UTF16_
@@ -402,22 +572,19 @@ TEST(CodePointToUtf8Test, CanEncode12To16Bits) {
 // Tests that Unicode code-points that have 17 to 21 bits are encoded
 // as 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx.
 TEST(CodePointToUtf8Test, CanEncode17To21Bits) {
-  char buffer[32];
   // 0 0001 0000 1000 1101 0011 => 11110-000 10-010000 10-100011 10-010011
-  EXPECT_STREQ("\xF0\x90\xA3\x93", CodePointToUtf8(L'\x108D3', buffer));
+  EXPECT_EQ("\xF0\x90\xA3\x93", CodePointToUtf8(L'\x108D3'));
 
   // 0 0001 0000 0100 0000 0000 => 11110-000 10-010000 10-010000 10-000000
-  EXPECT_STREQ("\xF0\x90\x90\x80", CodePointToUtf8(L'\x10400', buffer));
+  EXPECT_EQ("\xF0\x90\x90\x80", CodePointToUtf8(L'\x10400'));
 
   // 1 0000 1000 0110 0011 0100 => 11110-100 10-001000 10-011000 10-110100
-  EXPECT_STREQ("\xF4\x88\x98\xB4", CodePointToUtf8(L'\x108634', buffer));
+  EXPECT_EQ("\xF4\x88\x98\xB4", CodePointToUtf8(L'\x108634'));
 }
 
 // Tests that encoding an invalid code-point generates the expected result.
 TEST(CodePointToUtf8Test, CanEncodeInvalidCodePoint) {
-  char buffer[32];
-  EXPECT_STREQ("(Invalid Unicode 0x1234ABCD)",
-               CodePointToUtf8(L'\x1234ABCD', buffer));
+  EXPECT_EQ("(Invalid Unicode 0x1234ABCD)", CodePointToUtf8(L'\x1234ABCD'));
 }
 
 #endif  // !GTEST_WIDE_STRING_USES_UTF16_
@@ -830,269 +997,16 @@ TEST(AssertHelperTest, AssertHelperIsSmall) {
   EXPECT_LE(sizeof(testing::internal::AssertHelper), sizeof(void*));
 }
 
-// Tests the String class.
-
-// Tests String's constructors.
-TEST(StringTest, Constructors) {
-  // Default ctor.
-  String s1;
-  // We aren't using EXPECT_EQ(NULL, s1.c_str()) because comparing
-  // pointers with NULL isn't supported on all platforms.
-  EXPECT_EQ(0U, s1.length());
-  EXPECT_TRUE(NULL == s1.c_str());
-
-  // Implicitly constructs from a C-string.
-  String s2 = "Hi";
-  EXPECT_EQ(2U, s2.length());
-  EXPECT_STREQ("Hi", s2.c_str());
-
-  // Constructs from a C-string and a length.
-  String s3("hello", 3);
-  EXPECT_EQ(3U, s3.length());
-  EXPECT_STREQ("hel", s3.c_str());
-
-  // The empty String should be created when String is constructed with
-  // a NULL pointer and length 0.
-  EXPECT_EQ(0U, String(NULL, 0).length());
-  EXPECT_FALSE(String(NULL, 0).c_str() == NULL);
-
-  // Constructs a String that contains '\0'.
-  String s4("a\0bcd", 4);
-  EXPECT_EQ(4U, s4.length());
-  EXPECT_EQ('a', s4.c_str()[0]);
-  EXPECT_EQ('\0', s4.c_str()[1]);
-  EXPECT_EQ('b', s4.c_str()[2]);
-  EXPECT_EQ('c', s4.c_str()[3]);
-
-  // Copy ctor where the source is NULL.
-  const String null_str;
-  String s5 = null_str;
-  EXPECT_TRUE(s5.c_str() == NULL);
-
-  // Copy ctor where the source isn't NULL.
-  String s6 = s3;
-  EXPECT_EQ(3U, s6.length());
-  EXPECT_STREQ("hel", s6.c_str());
-
-  // Copy ctor where the source contains '\0'.
-  String s7 = s4;
-  EXPECT_EQ(4U, s7.length());
-  EXPECT_EQ('a', s7.c_str()[0]);
-  EXPECT_EQ('\0', s7.c_str()[1]);
-  EXPECT_EQ('b', s7.c_str()[2]);
-  EXPECT_EQ('c', s7.c_str()[3]);
-}
-
-TEST(StringTest, ConvertsFromStdString) {
-  // An empty std::string.
-  const std::string src1("");
-  const String dest1 = src1;
-  EXPECT_EQ(0U, dest1.length());
-  EXPECT_STREQ("", dest1.c_str());
-
-  // A normal std::string.
-  const std::string src2("Hi");
-  const String dest2 = src2;
-  EXPECT_EQ(2U, dest2.length());
-  EXPECT_STREQ("Hi", dest2.c_str());
-
-  // An std::string with an embedded NUL character.
-  const char src3[] = "a\0b";
-  const String dest3 = std::string(src3, sizeof(src3));
-  EXPECT_EQ(sizeof(src3), dest3.length());
-  EXPECT_EQ('a', dest3.c_str()[0]);
-  EXPECT_EQ('\0', dest3.c_str()[1]);
-  EXPECT_EQ('b', dest3.c_str()[2]);
-}
-
-TEST(StringTest, ConvertsToStdString) {
-  // An empty String.
-  const String src1("");
-  const std::string dest1 = src1;
-  EXPECT_EQ("", dest1);
-
-  // A normal String.
-  const String src2("Hi");
-  const std::string dest2 = src2;
-  EXPECT_EQ("Hi", dest2);
-
-  // A String containing a '\0'.
-  const String src3("x\0y", 3);
-  const std::string dest3 = src3;
-  EXPECT_EQ(std::string("x\0y", 3), dest3);
-}
-
-#if GTEST_HAS_GLOBAL_STRING
-
-TEST(StringTest, ConvertsFromGlobalString) {
-  // An empty ::string.
-  const ::string src1("");
-  const String dest1 = src1;
-  EXPECT_EQ(0U, dest1.length());
-  EXPECT_STREQ("", dest1.c_str());
-
-  // A normal ::string.
-  const ::string src2("Hi");
-  const String dest2 = src2;
-  EXPECT_EQ(2U, dest2.length());
-  EXPECT_STREQ("Hi", dest2.c_str());
-
-  // An ::string with an embedded NUL character.
-  const char src3[] = "x\0y";
-  const String dest3 = ::string(src3, sizeof(src3));
-  EXPECT_EQ(sizeof(src3), dest3.length());
-  EXPECT_EQ('x', dest3.c_str()[0]);
-  EXPECT_EQ('\0', dest3.c_str()[1]);
-  EXPECT_EQ('y', dest3.c_str()[2]);
-}
-
-TEST(StringTest, ConvertsToGlobalString) {
-  // An empty String.
-  const String src1("");
-  const ::string dest1 = src1;
-  EXPECT_EQ("", dest1);
-
-  // A normal String.
-  const String src2("Hi");
-  const ::string dest2 = src2;
-  EXPECT_EQ("Hi", dest2);
-
-  const String src3("x\0y", 3);
-  const ::string dest3 = src3;
-  EXPECT_EQ(::string("x\0y", 3), dest3);
-}
-
-#endif  // GTEST_HAS_GLOBAL_STRING
-
-// Tests String::ShowCStringQuoted().
-TEST(StringTest, ShowCStringQuoted) {
-  EXPECT_STREQ("(null)",
-               String::ShowCStringQuoted(NULL).c_str());
-  EXPECT_STREQ("\"\"",
-               String::ShowCStringQuoted("").c_str());
-  EXPECT_STREQ("\"foo\"",
-               String::ShowCStringQuoted("foo").c_str());
-}
-
-// Tests String::empty().
-TEST(StringTest, Empty) {
-  EXPECT_TRUE(String("").empty());
-  EXPECT_FALSE(String().empty());
-  EXPECT_FALSE(String(NULL).empty());
-  EXPECT_FALSE(String("a").empty());
-  EXPECT_FALSE(String("\0", 1).empty());
-}
-
-// Tests String::Compare().
-TEST(StringTest, Compare) {
-  // NULL vs NULL.
-  EXPECT_EQ(0, String().Compare(String()));
-
-  // NULL vs non-NULL.
-  EXPECT_EQ(-1, String().Compare(String("")));
-
-  // Non-NULL vs NULL.
-  EXPECT_EQ(1, String("").Compare(String()));
-
-  // The following covers non-NULL vs non-NULL.
-
-  // "" vs "".
-  EXPECT_EQ(0, String("").Compare(String("")));
-
-  // "" vs non-"".
-  EXPECT_EQ(-1, String("").Compare(String("\0", 1)));
-  EXPECT_EQ(-1, String("").Compare(" "));
-
-  // Non-"" vs "".
-  EXPECT_EQ(1, String("a").Compare(String("")));
-
-  // The following covers non-"" vs non-"".
-
-  // Same length and equal.
-  EXPECT_EQ(0, String("a").Compare(String("a")));
-
-  // Same length and different.
-  EXPECT_EQ(-1, String("a\0b", 3).Compare(String("a\0c", 3)));
-  EXPECT_EQ(1, String("b").Compare(String("a")));
-
-  // Different lengths.
-  EXPECT_EQ(-1, String("a").Compare(String("ab")));
-  EXPECT_EQ(-1, String("a").Compare(String("a\0", 2)));
-  EXPECT_EQ(1, String("abc").Compare(String("aacd")));
-}
-
-// Tests String::operator==().
-TEST(StringTest, Equals) {
-  const String null(NULL);
-  EXPECT_TRUE(null == NULL);  // NOLINT
-  EXPECT_FALSE(null == "");  // NOLINT
-  EXPECT_FALSE(null == "bar");  // NOLINT
-
-  const String empty("");
-  EXPECT_FALSE(empty == NULL);  // NOLINT
-  EXPECT_TRUE(empty == "");  // NOLINT
-  EXPECT_FALSE(empty == "bar");  // NOLINT
-
-  const String foo("foo");
-  EXPECT_FALSE(foo == NULL);  // NOLINT
-  EXPECT_FALSE(foo == "");  // NOLINT
-  EXPECT_FALSE(foo == "bar");  // NOLINT
-  EXPECT_TRUE(foo == "foo");  // NOLINT
-
-  const String bar("x\0y", 3);
-  EXPECT_FALSE(bar == "x");
-}
-
-// Tests String::operator!=().
-TEST(StringTest, NotEquals) {
-  const String null(NULL);
-  EXPECT_FALSE(null != NULL);  // NOLINT
-  EXPECT_TRUE(null != "");  // NOLINT
-  EXPECT_TRUE(null != "bar");  // NOLINT
-
-  const String empty("");
-  EXPECT_TRUE(empty != NULL);  // NOLINT
-  EXPECT_FALSE(empty != "");  // NOLINT
-  EXPECT_TRUE(empty != "bar");  // NOLINT
-
-  const String foo("foo");
-  EXPECT_TRUE(foo != NULL);  // NOLINT
-  EXPECT_TRUE(foo != "");  // NOLINT
-  EXPECT_TRUE(foo != "bar");  // NOLINT
-  EXPECT_FALSE(foo != "foo");  // NOLINT
-
-  const String bar("x\0y", 3);
-  EXPECT_TRUE(bar != "x");
-}
-
-// Tests String::length().
-TEST(StringTest, Length) {
-  EXPECT_EQ(0U, String().length());
-  EXPECT_EQ(0U, String("").length());
-  EXPECT_EQ(2U, String("ab").length());
-  EXPECT_EQ(3U, String("a\0b", 3).length());
-}
-
-// Tests String::EndsWith().
-TEST(StringTest, EndsWith) {
-  EXPECT_TRUE(String("foobar").EndsWith("bar"));
-  EXPECT_TRUE(String("foobar").EndsWith(""));
-  EXPECT_TRUE(String("").EndsWith(""));
-
-  EXPECT_FALSE(String("foobar").EndsWith("foo"));
-  EXPECT_FALSE(String("").EndsWith("foo"));
-}
-
 // Tests String::EndsWithCaseInsensitive().
 TEST(StringTest, EndsWithCaseInsensitive) {
-  EXPECT_TRUE(String("foobar").EndsWithCaseInsensitive("BAR"));
-  EXPECT_TRUE(String("foobaR").EndsWithCaseInsensitive("bar"));
-  EXPECT_TRUE(String("foobar").EndsWithCaseInsensitive(""));
-  EXPECT_TRUE(String("").EndsWithCaseInsensitive(""));
+  EXPECT_TRUE(String::EndsWithCaseInsensitive("foobar", "BAR"));
+  EXPECT_TRUE(String::EndsWithCaseInsensitive("foobaR", "bar"));
+  EXPECT_TRUE(String::EndsWithCaseInsensitive("foobar", ""));
+  EXPECT_TRUE(String::EndsWithCaseInsensitive("", ""));
 
-  EXPECT_FALSE(String("Foobar").EndsWithCaseInsensitive("foo"));
-  EXPECT_FALSE(String("foobar").EndsWithCaseInsensitive("Foo"));
-  EXPECT_FALSE(String("").EndsWithCaseInsensitive("foo"));
+  EXPECT_FALSE(String::EndsWithCaseInsensitive("Foobar", "foo"));
+  EXPECT_FALSE(String::EndsWithCaseInsensitive("foobar", "Foo"));
+  EXPECT_FALSE(String::EndsWithCaseInsensitive("", "foo"));
 }
 
 // C++Builder's preprocessor is buggy; it fails to expand macros that
@@ -1112,88 +1026,6 @@ TEST(StringTest, CaseInsensitiveWideCStringEquals) {
   EXPECT_TRUE(String::CaseInsensitiveWideCStringEquals(L"FOOBAR", L"foobar"));
 }
 
-// Tests that NULL can be assigned to a String.
-TEST(StringTest, CanBeAssignedNULL) {
-  const String src(NULL);
-  String dest;
-
-  dest = src;
-  EXPECT_STREQ(NULL, dest.c_str());
-}
-
-// Tests that the empty string "" can be assigned to a String.
-TEST(StringTest, CanBeAssignedEmpty) {
-  const String src("");
-  String dest;
-
-  dest = src;
-  EXPECT_STREQ("", dest.c_str());
-}
-
-// Tests that a non-empty string can be assigned to a String.
-TEST(StringTest, CanBeAssignedNonEmpty) {
-  const String src("hello");
-  String dest;
-  dest = src;
-  EXPECT_EQ(5U, dest.length());
-  EXPECT_STREQ("hello", dest.c_str());
-
-  const String src2("x\0y", 3);
-  String dest2;
-  dest2 = src2;
-  EXPECT_EQ(3U, dest2.length());
-  EXPECT_EQ('x', dest2.c_str()[0]);
-  EXPECT_EQ('\0', dest2.c_str()[1]);
-  EXPECT_EQ('y', dest2.c_str()[2]);
-}
-
-// Tests that a String can be assigned to itself.
-TEST(StringTest, CanBeAssignedSelf) {
-  String dest("hello");
-
-  // Use explicit function call notation here to suppress self-assign warning.
-  dest.operator=(dest);
-  EXPECT_STREQ("hello", dest.c_str());
-}
-
-// Sun Studio < 12 incorrectly rejects this code due to an overloading
-// ambiguity.
-#if !(defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
-// Tests streaming a String.
-TEST(StringTest, Streams) {
-  EXPECT_EQ(StreamableToString(String()), "(null)");
-  EXPECT_EQ(StreamableToString(String("")), "");
-  EXPECT_EQ(StreamableToString(String("a\0b", 3)), "a\\0b");
-}
-#endif
-
-// Tests that String::Format() works.
-TEST(StringTest, FormatWorks) {
-  // Normal case: the format spec is valid, the arguments match the
-  // spec, and the result is < 4095 characters.
-  EXPECT_STREQ("Hello, 42", String::Format("%s, %d", "Hello", 42).c_str());
-
-  // Edge case: the result is 4095 characters.
-  char buffer[4096];
-  const size_t kSize = sizeof(buffer);
-  memset(buffer, 'a', kSize - 1);
-  buffer[kSize - 1] = '\0';
-  EXPECT_STREQ(buffer, String::Format("%s", buffer).c_str());
-
-  // The result needs to be 4096 characters, exceeding Format()'s limit.
-  EXPECT_STREQ("<formatting error or buffer exceeded>",
-               String::Format("x%s", buffer).c_str());
-
-#if GTEST_OS_LINUX
-  // On Linux, invalid format spec should lead to an error message.
-  // In other environment (e.g. MSVC on Windows), String::Format() may
-  // simply ignore a bad format spec, so this assertion is run on
-  // Linux only.
-  EXPECT_STREQ("<formatting error or buffer exceeded>",
-               String::Format("%").c_str());
-#endif
-}
-
 #if GTEST_OS_WINDOWS
 
 // Tests String::ShowWideCString().
@@ -1204,16 +1036,6 @@ TEST(StringTest, ShowWideCString) {
   EXPECT_STREQ("foo", String::ShowWideCString(L"foo").c_str());
 }
 
-// Tests String::ShowWideCStringQuoted().
-TEST(StringTest, ShowWideCStringQuoted) {
-  EXPECT_STREQ("(null)",
-               String::ShowWideCStringQuoted(NULL).c_str());
-  EXPECT_STREQ("L\"\"",
-               String::ShowWideCStringQuoted(L"").c_str());
-  EXPECT_STREQ("L\"foo\"",
-               String::ShowWideCStringQuoted(L"foo").c_str());
-}
-
 # if GTEST_OS_WINDOWS_MOBILE
 TEST(StringTest, AnsiAndUtf16Null) {
   EXPECT_EQ(NULL, String::AnsiToUtf16(NULL));
@@ -1623,7 +1445,7 @@ TEST(TestResultPropertyTest, NoPropertiesFoundWhenNoneAreAdded) {
 TEST(TestResultPropertyTest, OnePropertyFoundWhenAdded) {
   TestResult test_result;
   TestProperty property("key_1", "1");
-  TestResultAccessor::RecordProperty(&test_result, property);
+  TestResultAccessor::RecordProperty(&test_result, "testcase", property);
   ASSERT_EQ(1, test_result.test_property_count());
   const TestProperty& actual_property = test_result.GetTestProperty(0);
   EXPECT_STREQ("key_1", actual_property.key());
@@ -1635,8 +1457,8 @@ TEST(TestResultPropertyTest, MultiplePropertiesFoundWhenAdded) {
   TestResult test_result;
   TestProperty property_1("key_1", "1");
   TestProperty property_2("key_2", "2");
-  TestResultAccessor::RecordProperty(&test_result, property_1);
-  TestResultAccessor::RecordProperty(&test_result, property_2);
+  TestResultAccessor::RecordProperty(&test_result, "testcase", property_1);
+  TestResultAccessor::RecordProperty(&test_result, "testcase", property_2);
   ASSERT_EQ(2, test_result.test_property_count());
   const TestProperty& actual_property_1 = test_result.GetTestProperty(0);
   EXPECT_STREQ("key_1", actual_property_1.key());
@@ -1654,10 +1476,10 @@ TEST(TestResultPropertyTest, OverridesValuesForDuplicateKeys) {
   TestProperty property_2_1("key_2", "2");
   TestProperty property_1_2("key_1", "12");
   TestProperty property_2_2("key_2", "22");
-  TestResultAccessor::RecordProperty(&test_result, property_1_1);
-  TestResultAccessor::RecordProperty(&test_result, property_2_1);
-  TestResultAccessor::RecordProperty(&test_result, property_1_2);
-  TestResultAccessor::RecordProperty(&test_result, property_2_2);
+  TestResultAccessor::RecordProperty(&test_result, "testcase", property_1_1);
+  TestResultAccessor::RecordProperty(&test_result, "testcase", property_2_1);
+  TestResultAccessor::RecordProperty(&test_result, "testcase", property_1_2);
+  TestResultAccessor::RecordProperty(&test_result, "testcase", property_2_2);
 
   ASSERT_EQ(2, test_result.test_property_count());
   const TestProperty& actual_property_1 = test_result.GetTestProperty(0);
@@ -1670,14 +1492,14 @@ TEST(TestResultPropertyTest, OverridesValuesForDuplicateKeys) {
 }
 
 // Tests TestResult::GetTestProperty().
-TEST(TestResultPropertyDeathTest, GetTestProperty) {
+TEST(TestResultPropertyTest, GetTestProperty) {
   TestResult test_result;
   TestProperty property_1("key_1", "1");
   TestProperty property_2("key_2", "2");
   TestProperty property_3("key_3", "3");
-  TestResultAccessor::RecordProperty(&test_result, property_1);
-  TestResultAccessor::RecordProperty(&test_result, property_2);
-  TestResultAccessor::RecordProperty(&test_result, property_3);
+  TestResultAccessor::RecordProperty(&test_result, "testcase", property_1);
+  TestResultAccessor::RecordProperty(&test_result, "testcase", property_2);
+  TestResultAccessor::RecordProperty(&test_result, "testcase", property_3);
 
   const TestProperty& fetched_property_1 = test_result.GetTestProperty(0);
   const TestProperty& fetched_property_2 = test_result.GetTestProperty(1);
@@ -1696,41 +1518,15 @@ TEST(TestResultPropertyDeathTest, GetTestProperty) {
   EXPECT_DEATH_IF_SUPPORTED(test_result.GetTestProperty(-1), "");
 }
 
-// When a property using a reserved key is supplied to this function, it tests
-// that a non-fatal failure is added, a fatal failure is not added, and that the
-// property is not recorded.
-void ExpectNonFatalFailureRecordingPropertyWithReservedKey(const char* key) {
-  TestResult test_result;
-  TestProperty property(key, "1");
-  EXPECT_NONFATAL_FAILURE(
-      TestResultAccessor::RecordProperty(&test_result, property),
-      "Reserved key");
-  ASSERT_EQ(0, test_result.test_property_count()) << "Not recorded";
-}
-
-// Attempting to recording a property with the Reserved literal "name"
-// should add a non-fatal failure and the property should not be recorded.
-TEST(TestResultPropertyTest, AddFailureWhenUsingReservedKeyCalledName) {
-  ExpectNonFatalFailureRecordingPropertyWithReservedKey("name");
-}
-
-// Attempting to recording a property with the Reserved literal "status"
-// should add a non-fatal failure and the property should not be recorded.
-TEST(TestResultPropertyTest, AddFailureWhenUsingReservedKeyCalledStatus) {
-  ExpectNonFatalFailureRecordingPropertyWithReservedKey("status");
-}
-
-// Attempting to recording a property with the Reserved literal "time"
-// should add a non-fatal failure and the property should not be recorded.
-TEST(TestResultPropertyTest, AddFailureWhenUsingReservedKeyCalledTime) {
-  ExpectNonFatalFailureRecordingPropertyWithReservedKey("time");
-}
-
-// Attempting to recording a property with the Reserved literal "classname"
-// should add a non-fatal failure and the property should not be recorded.
-TEST(TestResultPropertyTest, AddFailureWhenUsingReservedKeyCalledClassname) {
-  ExpectNonFatalFailureRecordingPropertyWithReservedKey("classname");
-}
+// Tests the Test class.
+//
+// It's difficult to test every public method of this class (we are
+// already stretching the limit of Google Test by using it to test itself!).
+// Fortunately, we don't have to do that, as we are already testing
+// the functionalities of the Test class extensively by using Google Test
+// alone.
+//
+// Therefore, this section only contains one test.
 
 // Tests that GTestFlagSaver works on Windows and Mac.
 
@@ -1801,6 +1597,7 @@ class GTestFlagSaverTest : public Test {
     GTEST_FLAG(stream_result_to) = "localhost:1234";
     GTEST_FLAG(throw_on_failure) = true;
   }
+
  private:
   // For saving Google Test flags during this test case.
   static GTestFlagSaver* saver_;
@@ -1833,15 +1630,16 @@ static void SetEnv(const char* name, const char* value) {
   // C++Builder's putenv only stores a pointer to its parameter; we have to
   // ensure that the string remains valid as long as it might be needed.
   // We use an std::map to do so.
-  static std::map<String, String*> added_env;
+  static std::map<std::string, std::string*> added_env;
 
   // Because putenv stores a pointer to the string buffer, we can't delete the
   // previous string (if present) until after it's replaced.
-  String *prev_env = NULL;
+  std::string *prev_env = NULL;
   if (added_env.find(name) != added_env.end()) {
     prev_env = added_env[name];
   }
-  added_env[name] = new String((Message() << name << "=" << value).GetString());
+  added_env[name] = new std::string(
+      (Message() << name << "=" << value).GetString());
 
   // The standard signature of putenv accepts a 'char*' argument. Other
   // implementations, like C++Builder's, accept a 'const char*'.
@@ -1873,6 +1671,8 @@ TEST(Int32FromGTestEnvTest, ReturnsDefaultWhenVariableIsNotSet) {
   EXPECT_EQ(10, Int32FromGTestEnv("temp", 10));
 }
 
+# if !defined(GTEST_GET_INT32_FROM_ENV_)
+
 // Tests that Int32FromGTestEnv() returns the default value when the
 // environment variable overflows as an Int32.
 TEST(Int32FromGTestEnvTest, ReturnsDefaultWhenValueOverflows) {
@@ -1897,6 +1697,8 @@ TEST(Int32FromGTestEnvTest, ReturnsDefaultWhenValueIsInvalid) {
   EXPECT_EQ(50, Int32FromGTestEnv("temp", 50));
 }
 
+# endif  // !defined(GTEST_GET_INT32_FROM_ENV_)
+
 // Tests that Int32FromGTestEnv() parses and returns the value of the
 // environment variable when it represents a valid decimal integer in
 // the range of an Int32.
@@ -2130,6 +1932,173 @@ TEST(UnitTestTest, CanGetOriginalWorkingDir) {
   EXPECT_STRNE(UnitTest::GetInstance()->original_working_dir(), "");
 }
 
+TEST(UnitTestTest, ReturnsPlausibleTimestamp) {
+  EXPECT_LT(0, UnitTest::GetInstance()->start_timestamp());
+  EXPECT_LE(UnitTest::GetInstance()->start_timestamp(), GetTimeInMillis());
+}
+
+// When a property using a reserved key is supplied to this function, it
+// tests that a non-fatal failure is added, a fatal failure is not added,
+// and that the property is not recorded.
+void ExpectNonFatalFailureRecordingPropertyWithReservedKey(
+    const TestResult& test_result, const char* key) {
+  EXPECT_NONFATAL_FAILURE(Test::RecordProperty(key, "1"), "Reserved key");
+  ASSERT_EQ(0, test_result.test_property_count()) << "Property for key '" << key
+                                                  << "' recorded unexpectedly.";
+}
+
+void ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(
+    const char* key) {
+  const TestInfo* test_info = UnitTest::GetInstance()->current_test_info();
+  ASSERT_TRUE(test_info != NULL);
+  ExpectNonFatalFailureRecordingPropertyWithReservedKey(*test_info->result(),
+                                                        key);
+}
+
+void ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+    const char* key) {
+  const TestCase* test_case = UnitTest::GetInstance()->current_test_case();
+  ASSERT_TRUE(test_case != NULL);
+  ExpectNonFatalFailureRecordingPropertyWithReservedKey(
+      test_case->ad_hoc_test_result(), key);
+}
+
+void ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+    const char* key) {
+  ExpectNonFatalFailureRecordingPropertyWithReservedKey(
+      UnitTest::GetInstance()->ad_hoc_test_result(), key);
+}
+
+// Tests that property recording functions in UnitTest outside of tests
+// functions correcly.  Creating a separate instance of UnitTest ensures it
+// is in a state similar to the UnitTest's singleton's between tests.
+class UnitTestRecordPropertyTest :
+    public testing::internal::UnitTestRecordPropertyTestHelper {
+ public:
+  static void SetUpTestCase() {
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+        "disabled");
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+        "errors");
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+        "failures");
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+        "name");
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+        "tests");
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
+        "time");
+
+    Test::RecordProperty("test_case_key_1", "1");
+    const TestCase* test_case = UnitTest::GetInstance()->current_test_case();
+    ASSERT_TRUE(test_case != NULL);
+
+    ASSERT_EQ(1, test_case->ad_hoc_test_result().test_property_count());
+    EXPECT_STREQ("test_case_key_1",
+                 test_case->ad_hoc_test_result().GetTestProperty(0).key());
+    EXPECT_STREQ("1",
+                 test_case->ad_hoc_test_result().GetTestProperty(0).value());
+  }
+};
+
+// Tests TestResult has the expected property when added.
+TEST_F(UnitTestRecordPropertyTest, OnePropertyFoundWhenAdded) {
+  UnitTestRecordProperty("key_1", "1");
+
+  ASSERT_EQ(1, unit_test_.ad_hoc_test_result().test_property_count());
+
+  EXPECT_STREQ("key_1",
+               unit_test_.ad_hoc_test_result().GetTestProperty(0).key());
+  EXPECT_STREQ("1",
+               unit_test_.ad_hoc_test_result().GetTestProperty(0).value());
+}
+
+// Tests TestResult has multiple properties when added.
+TEST_F(UnitTestRecordPropertyTest, MultiplePropertiesFoundWhenAdded) {
+  UnitTestRecordProperty("key_1", "1");
+  UnitTestRecordProperty("key_2", "2");
+
+  ASSERT_EQ(2, unit_test_.ad_hoc_test_result().test_property_count());
+
+  EXPECT_STREQ("key_1",
+               unit_test_.ad_hoc_test_result().GetTestProperty(0).key());
+  EXPECT_STREQ("1", unit_test_.ad_hoc_test_result().GetTestProperty(0).value());
+
+  EXPECT_STREQ("key_2",
+               unit_test_.ad_hoc_test_result().GetTestProperty(1).key());
+  EXPECT_STREQ("2", unit_test_.ad_hoc_test_result().GetTestProperty(1).value());
+}
+
+// Tests TestResult::RecordProperty() overrides values for duplicate keys.
+TEST_F(UnitTestRecordPropertyTest, OverridesValuesForDuplicateKeys) {
+  UnitTestRecordProperty("key_1", "1");
+  UnitTestRecordProperty("key_2", "2");
+  UnitTestRecordProperty("key_1", "12");
+  UnitTestRecordProperty("key_2", "22");
+
+  ASSERT_EQ(2, unit_test_.ad_hoc_test_result().test_property_count());
+
+  EXPECT_STREQ("key_1",
+               unit_test_.ad_hoc_test_result().GetTestProperty(0).key());
+  EXPECT_STREQ("12",
+               unit_test_.ad_hoc_test_result().GetTestProperty(0).value());
+
+  EXPECT_STREQ("key_2",
+               unit_test_.ad_hoc_test_result().GetTestProperty(1).key());
+  EXPECT_STREQ("22",
+               unit_test_.ad_hoc_test_result().GetTestProperty(1).value());
+}
+
+TEST_F(UnitTestRecordPropertyTest,
+       AddFailureInsideTestsWhenUsingTestCaseReservedKeys) {
+  ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(
+      "name");
+  ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(
+      "value_param");
+  ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(
+      "type_param");
+  ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(
+      "status");
+  ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(
+      "time");
+  ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(
+      "classname");
+}
+
+TEST_F(UnitTestRecordPropertyTest,
+       AddRecordWithReservedKeysGeneratesCorrectPropertyList) {
+  EXPECT_NONFATAL_FAILURE(
+      Test::RecordProperty("name", "1"),
+      "'classname', 'name', 'status', 'time', 'type_param', and 'value_param'"
+      " are reserved");
+}
+
+class UnitTestRecordPropertyTestEnvironment : public Environment {
+ public:
+  virtual void TearDown() {
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+        "tests");
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+        "failures");
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+        "disabled");
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+        "errors");
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+        "name");
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+        "timestamp");
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+        "time");
+    ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
+        "random_seed");
+  }
+};
+
+// This will test property recording outside of any test or test case.
+static Environment* record_property_env =
+    AddGlobalTestEnvironment(new UnitTestRecordPropertyTestEnvironment);
+
 // This group of tests is for predicate assertions (ASSERT_PRED*, etc)
 // of various arities.  They do not attempt to be exhaustive.  Rather,
 // view them as smoke tests that can be easily reviewed and verified.
@@ -2497,7 +2466,7 @@ TEST(StringAssertionTest, ASSERT_STRCASEEQ) {
 
   ASSERT_STRCASEEQ("", "");
   EXPECT_FATAL_FAILURE(ASSERT_STRCASEEQ("Hi", "hi2"),
-                       "(ignoring case)");
+                       "Ignoring case");
 }
 
 // Tests ASSERT_STRCASENE.
@@ -2535,6 +2504,11 @@ TEST(StringAssertionTest, STREQ_Wide) {
   // Strings containing wide characters.
   EXPECT_NONFATAL_FAILURE(EXPECT_STREQ(L"abc\x8119", L"abc\x8120"),
                           "abc");
+
+  // The streaming variation.
+  EXPECT_NONFATAL_FAILURE({  // NOLINT
+    EXPECT_STREQ(L"abc\x8119", L"abc\x8121") << "Expected failure";
+  }, "Expected failure");
 }
 
 // Tests *_STRNE on wide strings.
@@ -2561,6 +2535,9 @@ TEST(StringAssertionTest, STRNE_Wide) {
   // Strings containing wide characters.
   EXPECT_NONFATAL_FAILURE(EXPECT_STRNE(L"abc\x8119", L"abc\x8119"),
                           "abc");
+
+  // The streaming variation.
+  ASSERT_STRNE(L"abc\x8119", L"abc\x8120") << "This shouldn't happen";
 }
 
 // Tests for ::testing::IsSubstring().
@@ -2691,7 +2668,6 @@ TEST(IsNotSubstringTest, ReturnsCorrectResultForStdWstring) {
 template <typename RawType>
 class FloatingPointTest : public Test {
  protected:
-
   // Pre-calculated numbers to be used by the tests.
   struct TestValues {
     RawType close_to_positive_zero;
@@ -3284,7 +3260,7 @@ TEST_F(SingleEvaluationTest, ASSERT_STR) {
 
   // failed EXPECT_STRCASEEQ
   EXPECT_NONFATAL_FAILURE(EXPECT_STRCASEEQ(p1_++, p2_++),
-                          "ignoring case");
+                          "Ignoring case");
   EXPECT_EQ(s1_ + 2, p1_);
   EXPECT_EQ(s2_ + 2, p2_);
 }
@@ -3472,59 +3448,151 @@ TEST_F(NoFatalFailureTest, MessageIsStreamable) {
 
 // Tests non-string assertions.
 
+std::string EditsToString(const std::vector<EditType>& edits) {
+  std::string out;
+  for (size_t i = 0; i < edits.size(); ++i) {
+    static const char kEdits[] = " +-/";
+    out.append(1, kEdits[edits[i]]);
+  }
+  return out;
+}
+
+std::vector<size_t> CharsToIndices(const std::string& str) {
+  std::vector<size_t> out;
+  for (size_t i = 0; i < str.size(); ++i) {
+    out.push_back(str[i]);
+  }
+  return out;
+}
+
+std::vector<std::string> CharsToLines(const std::string& str) {
+  std::vector<std::string> out;
+  for (size_t i = 0; i < str.size(); ++i) {
+    out.push_back(str.substr(i, 1));
+  }
+  return out;
+}
+
+TEST(EditDistance, TestCases) {
+  struct Case {
+    int line;
+    const char* left;
+    const char* right;
+    const char* expected_edits;
+    const char* expected_diff;
+  };
+  static const Case kCases[] = {
+      // No change.
+      {__LINE__, "A", "A", " ", ""},
+      {__LINE__, "ABCDE", "ABCDE", "     ", ""},
+      // Simple adds.
+      {__LINE__, "X", "XA", " +", "@@ +1,2 @@\n X\n+A\n"},
+      {__LINE__, "X", "XABCD", " ++++", "@@ +1,5 @@\n X\n+A\n+B\n+C\n+D\n"},
+      // Simple removes.
+      {__LINE__, "XA", "X", " -", "@@ -1,2 @@\n X\n-A\n"},
+      {__LINE__, "XABCD", "X", " ----", "@@ -1,5 @@\n X\n-A\n-B\n-C\n-D\n"},
+      // Simple replaces.
+      {__LINE__, "A", "a", "/", "@@ -1,1 +1,1 @@\n-A\n+a\n"},
+      {__LINE__, "ABCD", "abcd", "////",
+       "@@ -1,4 +1,4 @@\n-A\n-B\n-C\n-D\n+a\n+b\n+c\n+d\n"},
+      // Path finding.
+      {__LINE__, "ABCDEFGH", "ABXEGH1", "  -/ -  +",
+       "@@ -1,8 +1,7 @@\n A\n B\n-C\n-D\n+X\n E\n-F\n G\n H\n+1\n"},
+      {__LINE__, "AAAABCCCC", "ABABCDCDC", "- /   + / ",
+       "@@ -1,9 +1,9 @@\n-A\n A\n-A\n+B\n A\n B\n C\n+D\n C\n-C\n+D\n C\n"},
+      {__LINE__, "ABCDE", "BCDCD", "-   +/",
+       "@@ -1,5 +1,5 @@\n-A\n B\n C\n D\n-E\n+C\n+D\n"},
+      {__LINE__, "ABCDEFGHIJKL", "BCDCDEFGJKLJK", "- ++     --   ++",
+       "@@ -1,4 +1,5 @@\n-A\n B\n+C\n+D\n C\n D\n"
+       "@@ -6,7 +7,7 @@\n F\n G\n-H\n-I\n J\n K\n L\n+J\n+K\n"},
+      {}};
+  for (const Case* c = kCases; c->left; ++c) {
+    EXPECT_TRUE(c->expected_edits ==
+                EditsToString(CalculateOptimalEdits(CharsToIndices(c->left),
+                                                    CharsToIndices(c->right))))
+        << "Left <" << c->left << "> Right <" << c->right << "> Edits <"
+        << EditsToString(CalculateOptimalEdits(
+               CharsToIndices(c->left), CharsToIndices(c->right))) << ">";
+    EXPECT_TRUE(c->expected_diff == CreateUnifiedDiff(CharsToLines(c->left),
+                                                      CharsToLines(c->right)))
+        << "Left <" << c->left << "> Right <" << c->right << "> Diff <"
+        << CreateUnifiedDiff(CharsToLines(c->left), CharsToLines(c->right))
+        << ">";
+  }
+}
+
 // Tests EqFailure(), used for implementing *EQ* assertions.
 TEST(AssertionTest, EqFailure) {
-  const String foo_val("5"), bar_val("6");
-  const String msg1(
+  const std::string foo_val("5"), bar_val("6");
+  const std::string msg1(
       EqFailure("foo", "bar", foo_val, bar_val, false)
       .failure_message());
   EXPECT_STREQ(
-      "Value of: bar\n"
-      "  Actual: 6\n"
-      "Expected: foo\n"
-      "Which is: 5",
+      "      Expected: foo\n"
+      "      Which is: 5\n"
+      "To be equal to: bar\n"
+      "      Which is: 6",
       msg1.c_str());
 
-  const String msg2(
+  const std::string msg2(
       EqFailure("foo", "6", foo_val, bar_val, false)
       .failure_message());
   EXPECT_STREQ(
-      "Value of: 6\n"
-      "Expected: foo\n"
-      "Which is: 5",
+      "      Expected: foo\n"
+      "      Which is: 5\n"
+      "To be equal to: 6",
       msg2.c_str());
 
-  const String msg3(
+  const std::string msg3(
       EqFailure("5", "bar", foo_val, bar_val, false)
       .failure_message());
   EXPECT_STREQ(
-      "Value of: bar\n"
-      "  Actual: 6\n"
-      "Expected: 5",
+      "      Expected: 5\n"
+      "To be equal to: bar\n"
+      "      Which is: 6",
       msg3.c_str());
 
-  const String msg4(
+  const std::string msg4(
       EqFailure("5", "6", foo_val, bar_val, false).failure_message());
   EXPECT_STREQ(
-      "Value of: 6\n"
-      "Expected: 5",
+      "      Expected: 5\n"
+      "To be equal to: 6",
       msg4.c_str());
 
-  const String msg5(
+  const std::string msg5(
       EqFailure("foo", "bar",
-                String("\"x\""), String("\"y\""),
+                std::string("\"x\""), std::string("\"y\""),
                 true).failure_message());
   EXPECT_STREQ(
-      "Value of: bar\n"
-      "  Actual: \"y\"\n"
-      "Expected: foo (ignoring case)\n"
-      "Which is: \"x\"",
+      "      Expected: foo\n"
+      "      Which is: \"x\"\n"
+      "To be equal to: bar\n"
+      "      Which is: \"y\"\n"
+      "Ignoring case",
       msg5.c_str());
 }
 
+TEST(AssertionTest, EqFailureWithDiff) {
+  const std::string left(
+      "1\\n2XXX\\n3\\n5\\n6\\n7\\n8\\n9\\n10\\n11\\n12XXX\\n13\\n14\\n15");
+  const std::string right(
+      "1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n11\\n12\\n13\\n14");
+  const std::string msg1(
+      EqFailure("left", "right", left, right, false).failure_message());
+  EXPECT_STREQ(
+      "      Expected: left\n"
+      "      Which is: "
+      "1\\n2XXX\\n3\\n5\\n6\\n7\\n8\\n9\\n10\\n11\\n12XXX\\n13\\n14\\n15\n"
+      "To be equal to: right\n"
+      "      Which is: 1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n11\\n12\\n13\\n14\n"
+      "With diff:\n@@ -1,5 +1,6 @@\n 1\n-2XXX\n+2\n 3\n+4\n 5\n 6\n"
+      "@@ -7,8 +8,6 @@\n 8\n 9\n-10\n 11\n-12XXX\n+12\n 13\n 14\n-15\n",
+      msg1.c_str());
+}
+
 // Tests AppendUserMessage(), used for implementing the *EQ* macros.
 TEST(AssertionTest, AppendUserMessage) {
-  const String foo("foo");
+  const std::string foo("foo");
 
   Message msg;
   EXPECT_STREQ("foo",
@@ -3611,9 +3679,9 @@ TEST(ExpectTest, ASSERT_EQ_Double) {
 TEST(AssertionTest, ASSERT_EQ) {
   ASSERT_EQ(5, 2 + 3);
   EXPECT_FATAL_FAILURE(ASSERT_EQ(5, 2*3),
-                       "Value of: 2*3\n"
-                       "  Actual: 6\n"
-                       "Expected: 5");
+                       "      Expected: 5\n"
+                       "To be equal to: 2*3\n"
+                       "      Which is: 6");
 }
 
 // Tests ASSERT_EQ(NULL, pointer).
@@ -3630,7 +3698,7 @@ TEST(AssertionTest, ASSERT_EQ_NULL) {
   // A failure.
   static int n = 0;
   EXPECT_FATAL_FAILURE(ASSERT_EQ(NULL, &n),
-                       "Value of: &n\n");
+                       "To be equal to: &n\n");
 }
 #endif  // GTEST_CAN_COMPARE_NULL
 
@@ -3745,7 +3813,7 @@ void TestEq1(int x) {
 // Tests calling a test subroutine that's not part of a fixture.
 TEST(AssertionTest, NonFixtureSubroutine) {
   EXPECT_FATAL_FAILURE(TestEq1(2),
-                       "Value of: x");
+                       "To be equal to: x");
 }
 
 // An uncopyable class.
@@ -3794,7 +3862,7 @@ TEST(AssertionTest, AssertWorksWithUncopyableObject) {
   EXPECT_FATAL_FAILURE(TestAssertNonPositive(),
     "IsPositiveUncopyable(y) evaluates to false, where\ny evaluates to -1");
   EXPECT_FATAL_FAILURE(TestAssertEqualsUncopyable(),
-    "Value of: y\n  Actual: -1\nExpected: x\nWhich is: 5");
+    "Expected: x\n      Which is: 5\nTo be equal to: y\n      Which is: -1");
 }
 
 // Tests that uncopyable objects can be used in expects.
@@ -3806,7 +3874,7 @@ TEST(AssertionTest, ExpectWorksWithUncopyableObject) {
     "IsPositiveUncopyable(y) evaluates to false, where\ny evaluates to -1");
   EXPECT_EQ(x, x);
   EXPECT_NONFATAL_FAILURE(EXPECT_EQ(x, y),
-    "Value of: y\n  Actual: -1\nExpected: x\nWhich is: 5");
+    "Expected: x\n      Which is: 5\nTo be equal to: y\n      Which is: -1");
 }
 
 enum NamedEnum {
@@ -3818,7 +3886,7 @@ TEST(AssertionTest, NamedEnum) {
   EXPECT_EQ(kE1, kE1);
   EXPECT_LT(kE1, kE2);
   EXPECT_NONFATAL_FAILURE(EXPECT_EQ(kE1, kE2), "Which is: 0");
-  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(kE1, kE2), "Actual: 1");
+  EXPECT_NONFATAL_FAILURE(EXPECT_EQ(kE1, kE2), "Which is: 1");
 }
 
 // The version of gcc used in XCode 2.2 has a bug and doesn't allow
@@ -3882,9 +3950,9 @@ TEST(AssertionTest, AnonymousEnum) {
 
   // ICE's in C++Builder.
   EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseB),
-                       "Value of: kCaseB");
+                       "To be equal to: kCaseB");
   EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC),
-                       "Actual: 42");
+                       "Which is: 42");
 # endif
 
   EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC),
@@ -3934,10 +4002,10 @@ TEST(HRESULTAssertionTest, EXPECT_HRESULT_FAILED) {
 
   EXPECT_NONFATAL_FAILURE(EXPECT_HRESULT_FAILED(OkHRESULTSuccess()),
     "Expected: (OkHRESULTSuccess()) fails.\n"
-    "  Actual: 0x00000000");
+    "  Actual: 0x0");
   EXPECT_NONFATAL_FAILURE(EXPECT_HRESULT_FAILED(FalseHRESULTSuccess()),
     "Expected: (FalseHRESULTSuccess()) fails.\n"
-    "  Actual: 0x00000001");
+    "  Actual: 0x1");
 }
 
 TEST(HRESULTAssertionTest, ASSERT_HRESULT_FAILED) {
@@ -3948,12 +4016,12 @@ TEST(HRESULTAssertionTest, ASSERT_HRESULT_FAILED) {
   // ICE's in C++Builder 2007 and 2009.
   EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(OkHRESULTSuccess()),
     "Expected: (OkHRESULTSuccess()) fails.\n"
-    "  Actual: 0x00000000");
+    "  Actual: 0x0");
 # endif
 
   EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(FalseHRESULTSuccess()),
     "Expected: (FalseHRESULTSuccess()) fails.\n"
-    "  Actual: 0x00000001");
+    "  Actual: 0x1");
 }
 
 // Tests that streaming to the HRESULT macros works.
@@ -4105,7 +4173,7 @@ TEST(AssertionSyntaxTest, WorksWithSwitch) {
 #if GTEST_HAS_EXCEPTIONS
 
 void ThrowAString() {
-    throw "String";
+    throw "std::string";
 }
 
 // Test that the exception assertion macros compile and work with const
@@ -4157,8 +4225,109 @@ TEST(SuccessfulAssertionTest, ASSERT_STR) {
 
 namespace {
 
+// Tests the message streaming variation of assertions.
+
+TEST(AssertionWithMessageTest, EXPECT) {
+  EXPECT_EQ(1, 1) << "This should succeed.";
+  EXPECT_NONFATAL_FAILURE(EXPECT_NE(1, 1) << "Expected failure #1.",
+                          "Expected failure #1");
+  EXPECT_LE(1, 2) << "This should succeed.";
+  EXPECT_NONFATAL_FAILURE(EXPECT_LT(1, 0) << "Expected failure #2.",
+                          "Expected failure #2.");
+  EXPECT_GE(1, 0) << "This should succeed.";
+  EXPECT_NONFATAL_FAILURE(EXPECT_GT(1, 2) << "Expected failure #3.",
+                          "Expected failure #3.");
+
+  EXPECT_STREQ("1", "1") << "This should succeed.";
+  EXPECT_NONFATAL_FAILURE(EXPECT_STRNE("1", "1") << "Expected failure #4.",
+                          "Expected failure #4.");
+  EXPECT_STRCASEEQ("a", "A") << "This should succeed.";
+  EXPECT_NONFATAL_FAILURE(EXPECT_STRCASENE("a", "A") << "Expected failure #5.",
+                          "Expected failure #5.");
+
+  EXPECT_FLOAT_EQ(1, 1) << "This should succeed.";
+  EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(1, 1.2) << "Expected failure #6.",
+                          "Expected failure #6.");
+  EXPECT_NEAR(1, 1.1, 0.2) << "This should succeed.";
+}
+
+TEST(AssertionWithMessageTest, ASSERT) {
+  ASSERT_EQ(1, 1) << "This should succeed.";
+  ASSERT_NE(1, 2) << "This should succeed.";
+  ASSERT_LE(1, 2) << "This should succeed.";
+  ASSERT_LT(1, 2) << "This should succeed.";
+  ASSERT_GE(1, 0) << "This should succeed.";
+  EXPECT_FATAL_FAILURE(ASSERT_GT(1, 2) << "Expected failure.",
+                       "Expected failure.");
+}
+
+TEST(AssertionWithMessageTest, ASSERT_STR) {
+  ASSERT_STREQ("1", "1") << "This should succeed.";
+  ASSERT_STRNE("1", "2") << "This should succeed.";
+  ASSERT_STRCASEEQ("a", "A") << "This should succeed.";
+  EXPECT_FATAL_FAILURE(ASSERT_STRCASENE("a", "A") << "Expected failure.",
+                       "Expected failure.");
+}
+
+TEST(AssertionWithMessageTest, ASSERT_FLOATING) {
+  ASSERT_FLOAT_EQ(1, 1) << "This should succeed.";
+  ASSERT_DOUBLE_EQ(1, 1) << "This should succeed.";
+  EXPECT_FATAL_FAILURE(ASSERT_NEAR(1,1.2, 0.1) << "Expect failure.",  // NOLINT
+                       "Expect failure.");
+  // To work around a bug in gcc 2.95.0, there is intentionally no
+  // space after the first comma in the previous statement.
+}
+
+// Tests using ASSERT_FALSE with a streamed message.
+TEST(AssertionWithMessageTest, ASSERT_FALSE) {
+  ASSERT_FALSE(false) << "This shouldn't fail.";
+  EXPECT_FATAL_FAILURE({  // NOLINT
+    ASSERT_FALSE(true) << "Expected failure: " << 2 << " > " << 1
+                       << " evaluates to " << true;
+  }, "Expected failure");
+}
+
+// Tests using FAIL with a streamed message.
+TEST(AssertionWithMessageTest, FAIL) {
+  EXPECT_FATAL_FAILURE(FAIL() << 0,
+                       "0");
+}
+
+// Tests using SUCCEED with a streamed message.
+TEST(AssertionWithMessageTest, SUCCEED) {
+  SUCCEED() << "Success == " << 1;
+}
+
+// Tests using ASSERT_TRUE with a streamed message.
+TEST(AssertionWithMessageTest, ASSERT_TRUE) {
+  ASSERT_TRUE(true) << "This should succeed.";
+  ASSERT_TRUE(true) << true;
+  EXPECT_FATAL_FAILURE({  // NOLINT
+    ASSERT_TRUE(false) << static_cast<const char *>(NULL)
+                       << static_cast<char *>(NULL);
+  }, "(null)(null)");
+}
+
+#if GTEST_OS_WINDOWS
+// Tests using wide strings in assertion messages.
+TEST(AssertionWithMessageTest, WideStringMessage) {
+  EXPECT_NONFATAL_FAILURE({  // NOLINT
+    EXPECT_TRUE(false) << L"This failure is expected.\x8119";
+  }, "This failure is expected.");
+  EXPECT_FATAL_FAILURE({  // NOLINT
+    ASSERT_EQ(1, 2) << "This failure is "
+                    << L"expected too.\x8120";
+  }, "This failure is expected too.");
+}
+#endif  // GTEST_OS_WINDOWS
+
 // Tests EXPECT_TRUE.
 TEST(ExpectTest, EXPECT_TRUE) {
+  EXPECT_TRUE(true) << "Intentional success";
+  EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(false) << "Intentional failure #1.",
+                          "Intentional failure #1.");
+  EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(false) << "Intentional failure #2.",
+                          "Intentional failure #2.");
   EXPECT_TRUE(2 > 1);  // NOLINT
   EXPECT_NONFATAL_FAILURE(EXPECT_TRUE(2 < 1),
                           "Value of: 2 < 1\n"
@@ -4182,9 +4351,14 @@ TEST(ExpectTest, ExpectTrueWithAssertionResult) {
                           "Expected: true");
 }
 
-// Tests EXPECT_FALSE.
+// Tests EXPECT_FALSE with a streamed message.
 TEST(ExpectTest, EXPECT_FALSE) {
   EXPECT_FALSE(2 < 1);  // NOLINT
+  EXPECT_FALSE(false) << "Intentional success";
+  EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(true) << "Intentional failure #1.",
+                          "Intentional failure #1.");
+  EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(true) << "Intentional failure #2.",
+                          "Intentional failure #2.");
   EXPECT_NONFATAL_FAILURE(EXPECT_FALSE(2 > 1),
                           "Value of: 2 > 1\n"
                           "  Actual: true\n"
@@ -4216,9 +4390,9 @@ TEST(ExpectTest, ExpectFalseWithAssertionResult) {
 TEST(ExpectTest, EXPECT_EQ) {
   EXPECT_EQ(5, 2 + 3);
   EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5, 2*3),
-                          "Value of: 2*3\n"
-                          "  Actual: 6\n"
-                          "Expected: 5");
+                          "      Expected: 5\n"
+                          "To be equal to: 2*3\n"
+                          "      Which is: 6");
   EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5, 2 - 3),
                           "2 - 3");
 }
@@ -4249,7 +4423,7 @@ TEST(ExpectTest, EXPECT_EQ_NULL) {
   // A failure.
   int n = 0;
   EXPECT_NONFATAL_FAILURE(EXPECT_EQ(NULL, &n),
-                          "Value of: &n\n");
+                          "To be equal to: &n\n");
 }
 #endif  // GTEST_CAN_COMPARE_NULL
 
@@ -4365,7 +4539,7 @@ TEST(ExpectTest, EXPECT_ANY_THROW) {
 TEST(ExpectTest, ExpectPrecedence) {
   EXPECT_EQ(1 < 2, true);
   EXPECT_NONFATAL_FAILURE(EXPECT_EQ(true, true && false),
-                          "Value of: true && false");
+                          "To be equal to: true && false");
 }
 
 
@@ -4458,7 +4632,7 @@ TEST(StreamableTest, BasicIoManip) {
 
 void AddFailureHelper(bool* aborted) {
   *aborted = true;
-  ADD_FAILURE() << "Failure";
+  ADD_FAILURE() << "Intentional failure.";
   *aborted = false;
 }
 
@@ -4466,7 +4640,7 @@ void AddFailureHelper(bool* aborted) {
 TEST(MacroTest, ADD_FAILURE) {
   bool aborted = true;
   EXPECT_NONFATAL_FAILURE(AddFailureHelper(&aborted),
-                          "Failure");
+                          "Intentional failure.");
   EXPECT_FALSE(aborted);
 }
 
@@ -4499,7 +4673,6 @@ TEST(MacroTest, SUCCEED) {
   SUCCEED() << "Explicit success.";
 }
 
-
 // Tests for EXPECT_EQ() and ASSERT_EQ().
 //
 // These tests fail *intentionally*, s.t. the failure messages can be
@@ -4513,7 +4686,7 @@ TEST(EqAssertionTest, Bool) {
   EXPECT_FATAL_FAILURE({
       bool false_value = false;
       ASSERT_EQ(false_value, true);
-    }, "Value of: true");
+    }, "To be equal to: true");
 }
 
 // Tests using int values in {EXPECT|ASSERT}_EQ.
@@ -4547,10 +4720,10 @@ TEST(EqAssertionTest, WideChar) {
   EXPECT_EQ(L'b', L'b');
 
   EXPECT_NONFATAL_FAILURE(EXPECT_EQ(L'\0', L'x'),
-                          "Value of: L'x'\n"
-                          "  Actual: L'x' (120, 0x78)\n"
-                          "Expected: L'\0'\n"
-                          "Which is: L'\0' (0, 0x0)");
+                          "      Expected: L'\0'\n"
+                          "      Which is: L'\0' (0, 0x0)\n"
+                          "To be equal to: L'x'\n"
+                          "      Which is: L'x' (120, 0x78)");
 
   static wchar_t wchar;
   wchar = L'b';
@@ -4558,7 +4731,7 @@ TEST(EqAssertionTest, WideChar) {
                           "wchar");
   wchar = 0x8119;
   EXPECT_FATAL_FAILURE(ASSERT_EQ(static_cast<wchar_t>(0x8120), wchar),
-                       "Value of: wchar");
+                       "To be equal to: wchar");
 }
 
 // Tests using ::std::string values in {EXPECT|ASSERT}_EQ.
@@ -4575,7 +4748,7 @@ TEST(EqAssertionTest, StdString) {
   // Compares a const char* to an std::string that has different
   // content
   EXPECT_NONFATAL_FAILURE(EXPECT_EQ("Test", ::std::string("test")),
-                          "::std::string(\"test\")");
+                          "\"test\"");
 
   // Compares an std::string to a char* that has different content.
   char* const p1 = const_cast<char*>("foo");
@@ -4587,8 +4760,8 @@ TEST(EqAssertionTest, StdString) {
   static ::std::string str3(str1);
   str3.at(2) = '\0';
   EXPECT_FATAL_FAILURE(ASSERT_EQ(str1, str3),
-                       "Value of: str3\n"
-                       "  Actual: \"A \\0 in the middle\"");
+                       "To be equal to: str3\n"
+                       "      Which is: \"A \\0 in the middle\"");
 }
 
 #if GTEST_HAS_STD_WSTRING
@@ -4708,7 +4881,7 @@ TEST(EqAssertionTest, CharPointer) {
   ASSERT_EQ(p1, p1);
 
   EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),
-                          "Value of: p2");
+                          "To be equal to: p2");
   EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),
                           "p2");
   EXPECT_FATAL_FAILURE(ASSERT_EQ(reinterpret_cast<char*>(0x1234),
@@ -4730,7 +4903,7 @@ TEST(EqAssertionTest, WideCharPointer) {
   EXPECT_EQ(p0, p0);
 
   EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),
-                          "Value of: p2");
+                          "To be equal to: p2");
   EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),
                           "p2");
   void* pv3 = (void*)0x1234;  // NOLINT
@@ -4952,6 +5125,31 @@ TEST(AssertionResultTest, CanStreamOstreamManipulators) {
   EXPECT_STREQ("Data\n\\0Will be visible", r.message());
 }
 
+// The next test uses explicit conversion operators -- a C++11 feature.
+#if GTEST_LANG_CXX11
+
+TEST(AssertionResultTest, ConstructibleFromContextuallyConvertibleToBool) {
+  struct ExplicitlyConvertibleToBool {
+    explicit operator bool() const { return value; }
+    bool value;
+  };
+  ExplicitlyConvertibleToBool v1 = {false};
+  ExplicitlyConvertibleToBool v2 = {true};
+  EXPECT_FALSE(v1);
+  EXPECT_TRUE(v2);
+}
+
+#endif  // GTEST_LANG_CXX11
+
+struct ConvertibleToAssertionResult {
+  operator AssertionResult() const { return AssertionResult(true); }
+};
+
+TEST(AssertionResultTest, ConstructibleFromImplicitlyConvertible) {
+  ConvertibleToAssertionResult obj;
+  EXPECT_TRUE(obj);
+}
+
 // Tests streaming a user type whose definition and operator << are
 // both in the global namespace.
 class Base {
@@ -5136,6 +5334,59 @@ TEST_F(TestInfoTest, result) {
   ASSERT_EQ(0, GetTestResult(test_info)->total_part_count());
 }
 
+#define VERIFY_CODE_LOCATION \
+  const int expected_line = __LINE__ - 1; \
+  const TestInfo* const test_info = GetUnitTestImpl()->current_test_info(); \
+  ASSERT_TRUE(test_info); \
+  EXPECT_STREQ(__FILE__, test_info->file()); \
+  EXPECT_EQ(expected_line, test_info->line())
+
+TEST(CodeLocationForTEST, Verify) {
+  VERIFY_CODE_LOCATION;
+}
+
+class CodeLocationForTESTF : public Test {
+};
+
+TEST_F(CodeLocationForTESTF, Verify) {
+  VERIFY_CODE_LOCATION;
+}
+
+class CodeLocationForTESTP : public TestWithParam<int> {
+};
+
+TEST_P(CodeLocationForTESTP, Verify) {
+  VERIFY_CODE_LOCATION;
+}
+
+INSTANTIATE_TEST_CASE_P(, CodeLocationForTESTP, Values(0));
+
+template <typename T>
+class CodeLocationForTYPEDTEST : public Test {
+};
+
+TYPED_TEST_CASE(CodeLocationForTYPEDTEST, int);
+
+TYPED_TEST(CodeLocationForTYPEDTEST, Verify) {
+  VERIFY_CODE_LOCATION;
+}
+
+template <typename T>
+class CodeLocationForTYPEDTESTP : public Test {
+};
+
+TYPED_TEST_CASE_P(CodeLocationForTYPEDTESTP);
+
+TYPED_TEST_P(CodeLocationForTYPEDTESTP, Verify) {
+  VERIFY_CODE_LOCATION;
+}
+
+REGISTER_TYPED_TEST_CASE_P(CodeLocationForTYPEDTESTP, Verify);
+
+INSTANTIATE_TYPED_TEST_CASE_P(My, CodeLocationForTYPEDTESTP, int);
+
+#undef VERIFY_CODE_LOCATION
+
 // Tests setting up and tearing down a test case.
 
 class SetUpTestCaseTest : public Test {
@@ -5420,7 +5671,7 @@ class InitGoogleTestTest : public Test {
     internal::ParseGoogleTestFlagsOnly(&argc1, const_cast<CharType**>(argv1));
 
 #if GTEST_HAS_STREAM_REDIRECTION
-    const String captured_stdout = GetCapturedStdout();
+    const std::string captured_stdout = GetCapturedStdout();
 #endif
 
     // Verifies the flag values.
@@ -6151,7 +6402,108 @@ TEST_F(InitGoogleTestTest, WideStrings) {
 
   GTEST_TEST_PARSING_FLAGS_(argv, argv2, expected_flags, false);
 }
-#endif  // GTEST_OS_WINDOWS
+# endif  // GTEST_OS_WINDOWS
+
+#if GTEST_USE_OWN_FLAGFILE_FLAG_
+class FlagfileTest : public InitGoogleTestTest {
+ public:
+  virtual void SetUp() {
+    InitGoogleTestTest::SetUp();
+
+    testdata_path_.Set(internal::FilePath(
+        internal::TempDir() + internal::GetCurrentExecutableName().string() +
+        "_flagfile_test"));
+    testing::internal::posix::RmDir(testdata_path_.c_str());
+    EXPECT_TRUE(testdata_path_.CreateFolder());
+  }
+
+  virtual void TearDown() {
+    testing::internal::posix::RmDir(testdata_path_.c_str());
+    InitGoogleTestTest::TearDown();
+  }
+
+  internal::FilePath CreateFlagfile(const char* contents) {
+    internal::FilePath file_path(internal::FilePath::GenerateUniqueFileName(
+        testdata_path_, internal::FilePath("unique"), "txt"));
+    FILE* f = testing::internal::posix::FOpen(file_path.c_str(), "w");
+    fprintf(f, "%s", contents);
+    fclose(f);
+    return file_path;
+  }
+
+ private:
+  internal::FilePath testdata_path_;
+};
+
+// Tests an empty flagfile.
+TEST_F(FlagfileTest, Empty) {
+  internal::FilePath flagfile_path(CreateFlagfile(""));
+  std::string flagfile_flag =
+      std::string("--" GTEST_FLAG_PREFIX_ "flagfile=") + flagfile_path.c_str();
+
+  const char* argv[] = {
+    "foo.exe",
+    flagfile_flag.c_str(),
+    NULL
+  };
+
+  const char* argv2[] = {
+    "foo.exe",
+    NULL
+  };
+
+  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), false);
+}
+
+// Tests passing a non-empty --gtest_filter flag via --gtest_flagfile.
+TEST_F(FlagfileTest, FilterNonEmpty) {
+  internal::FilePath flagfile_path(CreateFlagfile(
+      "--"  GTEST_FLAG_PREFIX_  "filter=abc"));
+  std::string flagfile_flag =
+      std::string("--" GTEST_FLAG_PREFIX_ "flagfile=") + flagfile_path.c_str();
+
+  const char* argv[] = {
+    "foo.exe",
+    flagfile_flag.c_str(),
+    NULL
+  };
+
+  const char* argv2[] = {
+    "foo.exe",
+    NULL
+  };
+
+  GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter("abc"), false);
+}
+
+// Tests passing several flags via --gtest_flagfile.
+TEST_F(FlagfileTest, SeveralFlags) {
+  internal::FilePath flagfile_path(CreateFlagfile(
+      "--"  GTEST_FLAG_PREFIX_  "filter=abc\n"
+      "--"  GTEST_FLAG_PREFIX_  "break_on_failure\n"
+      "--"  GTEST_FLAG_PREFIX_  "list_tests"));
+  std::string flagfile_flag =
+      std::string("--" GTEST_FLAG_PREFIX_ "flagfile=") + flagfile_path.c_str();
+
+  const char* argv[] = {
+    "foo.exe",
+    flagfile_flag.c_str(),
+    NULL
+  };
+
+  const char* argv2[] = {
+    "foo.exe",
+    NULL
+  };
+
+  Flags expected_flags;
+  expected_flags.break_on_failure = true;
+  expected_flags.filter = "abc";
+  expected_flags.list_tests = true;
+
+  GTEST_TEST_PARSING_FLAGS_(argv, argv2, expected_flags, false);
+}
+#endif  // GTEST_USE_OWN_FLAGFILE_FLAG_
 
 // Tests current_test_info() in UnitTest.
 class CurrentTestInfoTest : public Test {
@@ -6486,6 +6838,21 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {
   SetEnv("TERM", "screen");  // TERM supports colors.
   EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.
 
+  SetEnv("TERM", "screen-256color");  // TERM supports colors.
+  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.
+
+  SetEnv("TERM", "tmux");  // TERM supports colors.
+  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.
+
+  SetEnv("TERM", "tmux-256color");  // TERM supports colors.
+  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.
+
+  SetEnv("TERM", "rxvt-unicode");  // TERM supports colors.
+  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.
+
+  SetEnv("TERM", "rxvt-unicode-256color");  // TERM supports colors.
+  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.
+
   SetEnv("TERM", "linux");  // TERM supports colors.
   EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.
 
@@ -6692,7 +7059,7 @@ TEST(TestEventListenersTest, Append) {
 // order.
 class SequenceTestingListener : public EmptyTestEventListener {
  public:
-  SequenceTestingListener(std::vector<String>* vector, const char* id)
+  SequenceTestingListener(std::vector<std::string>* vector, const char* id)
       : vector_(vector), id_(id) {}
 
  protected:
@@ -6715,20 +7082,20 @@ class SequenceTestingListener : public EmptyTestEventListener {
   }
 
  private:
-  String GetEventDescription(const char* method) {
+  std::string GetEventDescription(const char* method) {
     Message message;
     message << id_ << "." << method;
     return message.GetString();
   }
 
-  std::vector<String>* vector_;
+  std::vector<std::string>* vector_;
   const char* const id_;
 
   GTEST_DISALLOW_COPY_AND_ASSIGN_(SequenceTestingListener);
 };
 
 TEST(EventListenerTest, AppendKeepsOrder) {
-  std::vector<String> vec;
+  std::vector<std::string> vec;
   TestEventListeners listeners;
   listeners.Append(new SequenceTestingListener(&vec, "1st"));
   listeners.Append(new SequenceTestingListener(&vec, "2nd"));
@@ -7114,7 +7481,7 @@ TEST(GTestReferenceToConstTest, Works) {
   TestGTestReferenceToConst<const char&, char>();
   TestGTestReferenceToConst<const int&, const int>();
   TestGTestReferenceToConst<const double&, double>();
-  TestGTestReferenceToConst<const String&, const String&>();
+  TestGTestReferenceToConst<const std::string&, const std::string&>();
 }
 
 // Tests that ImplicitlyConvertible<T1, T2>::value is a compile-time constant.
@@ -7172,6 +7539,7 @@ TEST(ArrayEqTest, WorksForDegeneratedArrays) {
 }
 
 TEST(ArrayEqTest, WorksForOneDimensionalArrays) {
+  // Note that a and b are distinct but compatible types.
   const int a[] = { 0, 1 };
   long b[] = { 0, 1 };
   EXPECT_TRUE(ArrayEq(a, b));
@@ -7249,7 +7617,7 @@ TEST(CopyArrayTest, WorksForTwoDimensionalArrays) {
 
 TEST(NativeArrayTest, ConstructorFromArrayWorks) {
   const int a[3] = { 0, 1, 2 };
-  NativeArray<int> na(a, 3, kReference);
+  NativeArray<int> na(a, 3, RelationToSourceReference());
   EXPECT_EQ(3U, na.size());
   EXPECT_EQ(a, na.begin());
 }
@@ -7259,7 +7627,7 @@ TEST(NativeArrayTest, CreatesAndDeletesCopyOfArrayWhenAskedTo) {
   Array* a = new Array[1];
   (*a)[0] = 0;
   (*a)[1] = 1;
-  NativeArray<int> na(*a, 2, kCopy);
+  NativeArray<int> na(*a, 2, RelationToSourceCopy());
   EXPECT_NE(*a, na.begin());
   delete[] a;
   EXPECT_EQ(0, na.begin()[0]);
@@ -7279,7 +7647,7 @@ TEST(NativeArrayTest, TypeMembersAreCorrect) {
 
 TEST(NativeArrayTest, MethodsWork) {
   const int a[3] = { 0, 1, 2 };
-  NativeArray<int> na(a, 3, kCopy);
+  NativeArray<int> na(a, 3, RelationToSourceCopy());
   ASSERT_EQ(3U, na.size());
   EXPECT_EQ(3, na.end() - na.begin());
 
@@ -7294,18 +7662,18 @@ TEST(NativeArrayTest, MethodsWork) {
 
   EXPECT_TRUE(na == na);
 
-  NativeArray<int> na2(a, 3, kReference);
+  NativeArray<int> na2(a, 3, RelationToSourceReference());
   EXPECT_TRUE(na == na2);
 
   const int b1[3] = { 0, 1, 1 };
   const int b2[4] = { 0, 1, 2, 3 };
-  EXPECT_FALSE(na == NativeArray<int>(b1, 3, kReference));
-  EXPECT_FALSE(na == NativeArray<int>(b2, 4, kCopy));
+  EXPECT_FALSE(na == NativeArray<int>(b1, 3, RelationToSourceReference()));
+  EXPECT_FALSE(na == NativeArray<int>(b2, 4, RelationToSourceCopy()));
 }
 
 TEST(NativeArrayTest, WorksForTwoDimensionalArray) {
   const char a[2][3] = { "hi", "lo" };
-  NativeArray<char[3]> na(a, 2, kReference);
+  NativeArray<char[3]> na(a, 2, RelationToSourceReference());
   ASSERT_EQ(2U, na.size());
   EXPECT_EQ(a, na.begin());
 }
@@ -7335,3 +7703,4 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) {
   EXPECT_FALSE(SkipPrefix("world!", &p));
   EXPECT_EQ(str, p);
 }
+
index 0fe947f..524e437 100755 (executable)
@@ -45,7 +45,7 @@ GTEST_OUTPUT_1_TEST = "gtest_xml_outfile1_test_"
 GTEST_OUTPUT_2_TEST = "gtest_xml_outfile2_test_"
 
 EXPECTED_XML_1 = """<?xml version="1.0" encoding="UTF-8"?>
-<testsuites tests="1" failures="0" disabled="0" errors="0" time="*" name="AllTests">
+<testsuites tests="1" failures="0" disabled="0" errors="0" time="*" timestamp="*" name="AllTests">
   <testsuite name="PropertyOne" tests="1" failures="0" disabled="0" errors="0" time="*">
     <testcase name="TestSomeProperties" status="run" time="*" classname="PropertyOne" SetUpProp="1" TestSomeProperty="1" TearDownProp="1" />
   </testsuite>
@@ -53,7 +53,7 @@ EXPECTED_XML_1 = """<?xml version="1.0" encoding="UTF-8"?>
 """
 
 EXPECTED_XML_2 = """<?xml version="1.0" encoding="UTF-8"?>
-<testsuites tests="1" failures="0" disabled="0" errors="0" time="*" name="AllTests">
+<testsuites tests="1" failures="0" disabled="0" errors="0" time="*" timestamp="*" name="AllTests">
   <testsuite name="PropertyTwo" tests="1" failures="0" disabled="0" errors="0" time="*">
     <testcase name="TestSomeProperties" status="run" time="*" classname="PropertyTwo" SetUpProp="2" TestSomeProperty="2" TearDownProp="2" />
   </testsuite>
index bdd5035..bcd5975 100755 (executable)
 
 __author__ = 'eefacm@gmail.com (Sean Mcafee)'
 
+import datetime
 import errno
 import os
+import re
 import sys
 from xml.dom import minidom, Node
 
@@ -42,6 +44,8 @@ import gtest_test_utils
 import gtest_xml_test_utils
 
 
+GTEST_FILTER_FLAG = '--gtest_filter'
+GTEST_LIST_TESTS_FLAG = '--gtest_list_tests'
 GTEST_OUTPUT_FLAG         = "--gtest_output"
 GTEST_DEFAULT_OUTPUT_FILE = "test_detail.xml"
 GTEST_PROGRAM_NAME = "gtest_xml_output_unittest_"
@@ -49,44 +53,44 @@ GTEST_PROGRAM_NAME = "gtest_xml_output_unittest_"
 SUPPORTS_STACK_TRACES = False
 
 if SUPPORTS_STACK_TRACES:
-  STACK_TRACE_TEMPLATE = "\nStack trace:\n*"
+  STACK_TRACE_TEMPLATE = '\nStack trace:\n*'
 else:
-  STACK_TRACE_TEMPLATE = ""
+  STACK_TRACE_TEMPLATE = ''
 
 EXPECTED_NON_EMPTY_XML = """<?xml version="1.0" encoding="UTF-8"?>
-<testsuites tests="23" failures="4" disabled="2" errors="0" time="*" name="AllTests">
+<testsuites tests="23" failures="4" disabled="2" errors="0" time="*" timestamp="*" name="AllTests" ad_hoc_property="42">
   <testsuite name="SuccessfulTest" tests="1" failures="0" disabled="0" errors="0" time="*">
     <testcase name="Succeeds" status="run" time="*" classname="SuccessfulTest"/>
   </testsuite>
   <testsuite name="FailedTest" tests="1" failures="1" disabled="0" errors="0" time="*">
     <testcase name="Fails" status="run" time="*" classname="FailedTest">
-      <failure message="Value of: 2&#x0A;Expected: 1" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
-Value of: 2
-Expected: 1%(stack)s]]></failure>
+      <failure message="gtest_xml_output_unittest_.cc:*&#x0A;      Expected: 1&#x0A;To be equal to: 2" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
+      Expected: 1
+To be equal to: 2%(stack)s]]></failure>
     </testcase>
   </testsuite>
   <testsuite name="MixedResultTest" tests="3" failures="1" disabled="1" errors="0" time="*">
     <testcase name="Succeeds" status="run" time="*" classname="MixedResultTest"/>
     <testcase name="Fails" status="run" time="*" classname="MixedResultTest">
-      <failure message="Value of: 2&#x0A;Expected: 1" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
-Value of: 2
-Expected: 1%(stack)s]]></failure>
-      <failure message="Value of: 3&#x0A;Expected: 2" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
-Value of: 3
-Expected: 2%(stack)s]]></failure>
+      <failure message="gtest_xml_output_unittest_.cc:*&#x0A;      Expected: 1&#x0A;To be equal to: 2" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
+      Expected: 1
+To be equal to: 2%(stack)s]]></failure>
+      <failure message="gtest_xml_output_unittest_.cc:*&#x0A;      Expected: 2&#x0A;To be equal to: 3" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
+      Expected: 2
+To be equal to: 3%(stack)s]]></failure>
     </testcase>
     <testcase name="DISABLED_test" status="notrun" time="*" classname="MixedResultTest"/>
   </testsuite>
   <testsuite name="XmlQuotingTest" tests="1" failures="1" disabled="0" errors="0" time="*">
     <testcase name="OutputsCData" status="run" time="*" classname="XmlQuotingTest">
-      <failure message="Failed&#x0A;XML output: &lt;?xml encoding=&quot;utf-8&quot;&gt;&lt;top&gt;&lt;![CDATA[cdata text]]&gt;&lt;/top&gt;" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
+      <failure message="gtest_xml_output_unittest_.cc:*&#x0A;Failed&#x0A;XML output: &lt;?xml encoding=&quot;utf-8&quot;&gt;&lt;top&gt;&lt;![CDATA[cdata text]]&gt;&lt;/top&gt;" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
 Failed
 XML output: <?xml encoding="utf-8"><top><![CDATA[cdata text]]>]]&gt;<![CDATA[</top>%(stack)s]]></failure>
     </testcase>
   </testsuite>
   <testsuite name="InvalidCharactersTest" tests="1" failures="1" disabled="0" errors="0" time="*">
     <testcase name="InvalidCharactersInMessage" status="run" time="*" classname="InvalidCharactersTest">
-      <failure message="Failed&#x0A;Invalid characters in brackets []" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
+      <failure message="gtest_xml_output_unittest_.cc:*&#x0A;Failed&#x0A;Invalid characters in brackets []" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
 Failed
 Invalid characters in brackets []%(stack)s]]></failure>
     </testcase>
@@ -94,7 +98,7 @@ Invalid characters in brackets []%(stack)s]]></failure>
   <testsuite name="DisabledTest" tests="1" failures="0" disabled="1" errors="0" time="*">
     <testcase name="DISABLED_test_not_run" status="notrun" time="*" classname="DisabledTest"/>
   </testsuite>
-  <testsuite name="PropertyRecordingTest" tests="4" failures="0" disabled="0" errors="0" time="*">
+  <testsuite name="PropertyRecordingTest" tests="4" failures="0" disabled="0" errors="0" time="*" SetUpTestCase="yes" TearDownTestCase="aye">
     <testcase name="OneProperty" status="run" time="*" classname="PropertyRecordingTest" key_1="1"/>
     <testcase name="IntValuedProperty" status="run" time="*" classname="PropertyRecordingTest" key_int="1"/>
     <testcase name="ThreeProperties" status="run" time="*" classname="PropertyRecordingTest" key_1="1" key_2="2" key_3="3"/>
@@ -125,32 +129,74 @@ Invalid characters in brackets []%(stack)s]]></failure>
   </testsuite>
 </testsuites>""" % {'stack': STACK_TRACE_TEMPLATE}
 
+EXPECTED_FILTERED_TEST_XML = """<?xml version="1.0" encoding="UTF-8"?>
+<testsuites tests="1" failures="0" disabled="0" errors="0" time="*"
+            timestamp="*" name="AllTests" ad_hoc_property="42">
+  <testsuite name="SuccessfulTest" tests="1" failures="0" disabled="0"
+             errors="0" time="*">
+    <testcase name="Succeeds" status="run" time="*" classname="SuccessfulTest"/>
+  </testsuite>
+</testsuites>"""
 
 EXPECTED_EMPTY_XML = """<?xml version="1.0" encoding="UTF-8"?>
-<testsuites tests="0" failures="0" disabled="0" errors="0" time="*" name="AllTests">
+<testsuites tests="0" failures="0" disabled="0" errors="0" time="*"
+            timestamp="*" name="AllTests">
 </testsuites>"""
 
+GTEST_PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath(GTEST_PROGRAM_NAME)
+
+SUPPORTS_TYPED_TESTS = 'TypedTest' in gtest_test_utils.Subprocess(
+    [GTEST_PROGRAM_PATH, GTEST_LIST_TESTS_FLAG], capture_stderr=False).output
+
 
 class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
   """
   Unit test for Google Test's XML output functionality.
   """
 
-  def testNonEmptyXmlOutput(self):
-    """
-    Runs a test program that generates a non-empty XML output, and
-    tests that the XML output is expected.
-    """
-    self._TestXmlOutput(GTEST_PROGRAM_NAME, EXPECTED_NON_EMPTY_XML, 1)
+  # This test currently breaks on platforms that do not support typed and
+  # type-parameterized tests, so we don't run it under them.
+  if SUPPORTS_TYPED_TESTS:
+    def testNonEmptyXmlOutput(self):
+      """
+      Runs a test program that generates a non-empty XML output, and
+      tests that the XML output is expected.
+      """
+      self._TestXmlOutput(GTEST_PROGRAM_NAME, EXPECTED_NON_EMPTY_XML, 1)
 
   def testEmptyXmlOutput(self):
-    """
+    """Verifies XML output for a Google Test binary without actual tests.
+
     Runs a test program that generates an empty XML output, and
     tests that the XML output is expected.
     """
 
-    self._TestXmlOutput("gtest_no_test_unittest",
-                        EXPECTED_EMPTY_XML, 0)
+    self._TestXmlOutput('gtest_no_test_unittest', EXPECTED_EMPTY_XML, 0)
+
+  def testTimestampValue(self):
+    """Checks whether the timestamp attribute in the XML output is valid.
+
+    Runs a test program that generates an empty XML output, and checks if
+    the timestamp attribute in the testsuites tag is valid.
+    """
+    actual = self._GetXmlOutput('gtest_no_test_unittest', [], 0)
+    date_time_str = actual.documentElement.getAttributeNode('timestamp').value
+    # datetime.strptime() is only available in Python 2.5+ so we have to
+    # parse the expected datetime manually.
+    match = re.match(r'(\d+)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)', date_time_str)
+    self.assertTrue(
+        re.match,
+        'XML datettime string %s has incorrect format' % date_time_str)
+    date_time_from_xml = datetime.datetime(
+        year=int(match.group(1)), month=int(match.group(2)),
+        day=int(match.group(3)), hour=int(match.group(4)),
+        minute=int(match.group(5)), second=int(match.group(6)))
+
+    time_delta = abs(datetime.datetime.now() - date_time_from_xml)
+    # timestamp value should be near the current local time
+    self.assertTrue(time_delta < datetime.timedelta(seconds=600),
+                    'time_delta is %s' % time_delta)
+    actual.unlink()
 
   def testDefaultOutputFile(self):
     """
@@ -160,15 +206,16 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
     output_file = os.path.join(gtest_test_utils.GetTempDir(),
                                GTEST_DEFAULT_OUTPUT_FILE)
     gtest_prog_path = gtest_test_utils.GetTestExecutablePath(
-        "gtest_no_test_unittest")
+        'gtest_no_test_unittest')
     try:
       os.remove(output_file)
-    except OSError, e:
+    except OSError:
+      e = sys.exc_info()[1]
       if e.errno != errno.ENOENT:
         raise
 
     p = gtest_test_utils.Subprocess(
-        [gtest_prog_path, "%s=xml" % GTEST_OUTPUT_FLAG],
+        [gtest_prog_path, '%s=xml' % GTEST_OUTPUT_FLAG],
         working_dir=gtest_test_utils.GetTempDir())
     self.assert_(p.exited)
     self.assertEquals(0, p.exit_code)
@@ -181,60 +228,79 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
     """
 
     xml_path = os.path.join(gtest_test_utils.GetTempDir(),
-                            GTEST_PROGRAM_NAME + "out.xml")
+                            GTEST_PROGRAM_NAME + 'out.xml')
     if os.path.isfile(xml_path):
       os.remove(xml_path)
 
-    gtest_prog_path = gtest_test_utils.GetTestExecutablePath(GTEST_PROGRAM_NAME)
-
-    command = [gtest_prog_path,
-               "%s=xml:%s" % (GTEST_OUTPUT_FLAG, xml_path),
-               "--shut_down_xml"]
+    command = [GTEST_PROGRAM_PATH,
+               '%s=xml:%s' % (GTEST_OUTPUT_FLAG, xml_path),
+               '--shut_down_xml']
     p = gtest_test_utils.Subprocess(command)
     if p.terminated_by_signal:
-      self.assert_(False,
-                   "%s was killed by signal %d" % (gtest_prog_name, p.signal))
+      # p.signal is avalable only if p.terminated_by_signal is True.
+      self.assertFalse(
+          p.terminated_by_signal,
+          '%s was killed by signal %d' % (GTEST_PROGRAM_NAME, p.signal))
     else:
       self.assert_(p.exited)
       self.assertEquals(1, p.exit_code,
                         "'%s' exited with code %s, which doesn't match "
-                        "the expected exit code %s."
+                        'the expected exit code %s.'
                         % (command, p.exit_code, 1))
 
     self.assert_(not os.path.isfile(xml_path))
 
+  def testFilteredTestXmlOutput(self):
+    """Verifies XML output when a filter is applied.
 
-  def _TestXmlOutput(self, gtest_prog_name, expected_xml, expected_exit_code):
+    Runs a test program that executes only some tests and verifies that
+    non-selected tests do not show up in the XML output.
     """
-    Asserts that the XML document generated by running the program
-    gtest_prog_name matches expected_xml, a string containing another
-    XML document.  Furthermore, the program's exit code must be
-    expected_exit_code.
+
+    self._TestXmlOutput(GTEST_PROGRAM_NAME, EXPECTED_FILTERED_TEST_XML, 0,
+                        extra_args=['%s=SuccessfulTest.*' % GTEST_FILTER_FLAG])
+
+  def _GetXmlOutput(self, gtest_prog_name, extra_args, expected_exit_code):
+    """
+    Returns the xml output generated by running the program gtest_prog_name.
+    Furthermore, the program's exit code must be expected_exit_code.
     """
     xml_path = os.path.join(gtest_test_utils.GetTempDir(),
-                            gtest_prog_name + "out.xml")
+                            gtest_prog_name + 'out.xml')
     gtest_prog_path = gtest_test_utils.GetTestExecutablePath(gtest_prog_name)
 
-    command = [gtest_prog_path, "%s=xml:%s" % (GTEST_OUTPUT_FLAG, xml_path)]
+    command = ([gtest_prog_path, '%s=xml:%s' % (GTEST_OUTPUT_FLAG, xml_path)] +
+               extra_args)
     p = gtest_test_utils.Subprocess(command)
     if p.terminated_by_signal:
       self.assert_(False,
-                   "%s was killed by signal %d" % (gtest_prog_name, p.signal))
+                   '%s was killed by signal %d' % (gtest_prog_name, p.signal))
     else:
       self.assert_(p.exited)
       self.assertEquals(expected_exit_code, p.exit_code,
                         "'%s' exited with code %s, which doesn't match "
-                        "the expected exit code %s."
+                        'the expected exit code %s.'
                         % (command, p.exit_code, expected_exit_code))
+    actual = minidom.parse(xml_path)
+    return actual
 
+  def _TestXmlOutput(self, gtest_prog_name, expected_xml,
+                     expected_exit_code, extra_args=None):
+    """
+    Asserts that the XML document generated by running the program
+    gtest_prog_name matches expected_xml, a string containing another
+    XML document.  Furthermore, the program's exit code must be
+    expected_exit_code.
+    """
+
+    actual = self._GetXmlOutput(gtest_prog_name, extra_args or [],
+                                expected_exit_code)
     expected = minidom.parseString(expected_xml)
-    actual   = minidom.parse(xml_path)
     self.NormalizeXml(actual.documentElement)
     self.AssertEquivalentNodes(expected.documentElement,
                                actual.documentElement)
     expected.unlink()
-    actual  .unlink()
-
+    actual.unlink()
 
 
 if __name__ == '__main__':
index 741a887..48b8771 100755 (executable)
@@ -45,7 +45,6 @@ using ::testing::TestEventListeners;
 using ::testing::TestWithParam;
 using ::testing::UnitTest;
 using ::testing::Test;
-using ::testing::Types;
 using ::testing::Values;
 
 class SuccessfulTest : public Test {
@@ -96,6 +95,9 @@ TEST(InvalidCharactersTest, InvalidCharactersInMessage) {
 }
 
 class PropertyRecordingTest : public Test {
+ public:
+  static void SetUpTestCase() { RecordProperty("SetUpTestCase", "yes"); }
+  static void TearDownTestCase() { RecordProperty("TearDownTestCase", "aye"); }
 };
 
 TEST_F(PropertyRecordingTest, OneProperty) {
@@ -121,12 +123,12 @@ TEST(NoFixtureTest, RecordProperty) {
   RecordProperty("key", "1");
 }
 
-void ExternalUtilityThatCallsRecordProperty(const char* key, int value) {
+void ExternalUtilityThatCallsRecordProperty(const std::string& key, int value) {
   testing::Test::RecordProperty(key, value);
 }
 
-void ExternalUtilityThatCallsRecordProperty(const char* key,
-                                            const char* value) {
+void ExternalUtilityThatCallsRecordProperty(const std::string& key,
+                                            const std::string& value) {
   testing::Test::RecordProperty(key, value);
 }
 
@@ -145,23 +147,27 @@ TEST_P(ValueParamTest, HasValueParamAttribute) {}
 TEST_P(ValueParamTest, AnotherTestThatHasValueParamAttribute) {}
 INSTANTIATE_TEST_CASE_P(Single, ValueParamTest, Values(33, 42));
 
+#if GTEST_HAS_TYPED_TEST
 // Verifies that the type parameter name is output in the 'type_param'
 // XML attribute for typed tests.
 template <typename T> class TypedTest : public Test {};
-typedef Types<int, long> TypedTestTypes;
+typedef testing::Types<int, long> TypedTestTypes;
 TYPED_TEST_CASE(TypedTest, TypedTestTypes);
 TYPED_TEST(TypedTest, HasTypeParamAttribute) {}
+#endif
 
+#if GTEST_HAS_TYPED_TEST_P
 // Verifies that the type parameter name is output in the 'type_param'
 // XML attribute for type-parameterized tests.
 template <typename T> class TypeParameterizedTestCase : public Test {};
 TYPED_TEST_CASE_P(TypeParameterizedTestCase);
 TYPED_TEST_P(TypeParameterizedTestCase, HasTypeParamAttribute) {}
 REGISTER_TYPED_TEST_CASE_P(TypeParameterizedTestCase, HasTypeParamAttribute);
-typedef Types<int, long> TypeParameterizedTestCaseTypes;
+typedef testing::Types<int, long> TypeParameterizedTestCaseTypes;
 INSTANTIATE_TYPED_TEST_CASE_P(Single,
                               TypeParameterizedTestCase,
                               TypeParameterizedTestCaseTypes);
+#endif
 
 int main(int argc, char** argv) {
   InitGoogleTest(&argc, argv);
@@ -170,5 +176,6 @@ int main(int argc, char** argv) {
     TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
     delete listeners.Release(listeners.default_xml_generator());
   }
+  testing::Test::RecordProperty("ad_hoc_property", "42");
   return RUN_ALL_TESTS();
 }
index 0f55c16..341956b 100755 (executable)
@@ -39,8 +39,8 @@ from xml.dom import minidom, Node
 import gtest_test_utils
 
 
-GTEST_OUTPUT_FLAG         = "--gtest_output"
-GTEST_DEFAULT_OUTPUT_FILE = "test_detail.xml"
+GTEST_OUTPUT_FLAG         = '--gtest_output'
+GTEST_DEFAULT_OUTPUT_FILE = 'test_detail.xml'
 
 class GTestXMLTestCase(gtest_test_utils.TestCase):
   """
@@ -80,34 +80,38 @@ class GTestXMLTestCase(gtest_test_utils.TestCase):
     actual_attributes   = actual_node  .attributes
     self.assertEquals(
         expected_attributes.length, actual_attributes.length,
-        "attribute numbers differ in element " + actual_node.tagName)
+        'attribute numbers differ in element %s:\nExpected: %r\nActual: %r' % (
+            actual_node.tagName, expected_attributes.keys(),
+            actual_attributes.keys()))
     for i in range(expected_attributes.length):
       expected_attr = expected_attributes.item(i)
       actual_attr   = actual_attributes.get(expected_attr.name)
       self.assert_(
           actual_attr is not None,
-          "expected attribute %s not found in element %s" %
+          'expected attribute %s not found in element %s' %
           (expected_attr.name, actual_node.tagName))
-      self.assertEquals(expected_attr.value, actual_attr.value,
-                        " values of attribute %s in element %s differ" %
-                        (expected_attr.name, actual_node.tagName))
+      self.assertEquals(
+          expected_attr.value, actual_attr.value,
+          ' values of attribute %s in element %s differ: %s vs %s' %
+          (expected_attr.name, actual_node.tagName,
+           expected_attr.value, actual_attr.value))
 
     expected_children = self._GetChildren(expected_node)
     actual_children = self._GetChildren(actual_node)
     self.assertEquals(
         len(expected_children), len(actual_children),
-        "number of child elements differ in element " + actual_node.tagName)
-    for child_id, child in expected_children.iteritems():
+        'number of child elements differ in element ' + actual_node.tagName)
+    for child_id, child in expected_children.items():
       self.assert_(child_id in actual_children,
                    '<%s> is not in <%s> (in element %s)' %
                    (child_id, actual_children, actual_node.tagName))
       self.AssertEquivalentNodes(child, actual_children[child_id])
 
   identifying_attribute = {
-    "testsuites": "name",
-    "testsuite": "name",
-    "testcase":  "name",
-    "failure":   "message",
+    'testsuites': 'name',
+    'testsuite': 'name',
+    'testcase':  'name',
+    'failure':   'message',
     }
 
   def _GetChildren(self, element):
@@ -127,20 +131,20 @@ class GTestXMLTestCase(gtest_test_utils.TestCase):
     for child in element.childNodes:
       if child.nodeType == Node.ELEMENT_NODE:
         self.assert_(child.tagName in self.identifying_attribute,
-                     "Encountered unknown element <%s>" % child.tagName)
+                     'Encountered unknown element <%s>' % child.tagName)
         childID = child.getAttribute(self.identifying_attribute[child.tagName])
         self.assert_(childID not in children)
         children[childID] = child
       elif child.nodeType in [Node.TEXT_NODE, Node.CDATA_SECTION_NODE]:
-        if "detail" not in children:
+        if 'detail' not in children:
           if (child.nodeType == Node.CDATA_SECTION_NODE or
               not child.nodeValue.isspace()):
-            children["detail"] = child.ownerDocument.createCDATASection(
+            children['detail'] = child.ownerDocument.createCDATASection(
                 child.nodeValue)
         else:
-          children["detail"].nodeValue += child.nodeValue
+          children['detail'].nodeValue += child.nodeValue
       else:
-        self.fail("Encountered unexpected node type %d" % child.nodeType)
+        self.fail('Encountered unexpected node type %d' % child.nodeType)
     return children
 
   def NormalizeXml(self, element):
@@ -151,29 +155,40 @@ class GTestXMLTestCase(gtest_test_utils.TestCase):
     *  The "time" attribute of <testsuites>, <testsuite> and <testcase>
        elements is replaced with a single asterisk, if it contains
        only digit characters.
+    *  The "timestamp" attribute of <testsuites> elements is replaced with a
+       single asterisk, if it contains a valid ISO8601 datetime value.
     *  The "type_param" attribute of <testcase> elements is replaced with a
        single asterisk (if it sn non-empty) as it is the type name returned
        by the compiler and is platform dependent.
-    *  The line number reported in the first line of the "message"
-       attribute of <failure> elements is replaced with a single asterisk.
+    *  The line info reported in the first line of the "message"
+       attribute and CDATA section of <failure> elements is replaced with the
+       file's basename and a single asterisk for the line number.
     *  The directory names in file paths are removed.
     *  The stack traces are removed.
     """
 
-    if element.tagName in ("testsuites", "testsuite", "testcase"):
-      time = element.getAttributeNode("time")
-      time.value = re.sub(r"^\d+(\.\d+)?$", "*", time.value)
-      type_param = element.getAttributeNode("type_param")
+    if element.tagName == 'testsuites':
+      timestamp = element.getAttributeNode('timestamp')
+      timestamp.value = re.sub(r'^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d$',
+                               '*', timestamp.value)
+    if element.tagName in ('testsuites', 'testsuite', 'testcase'):
+      time = element.getAttributeNode('time')
+      time.value = re.sub(r'^\d+(\.\d+)?$', '*', time.value)
+      type_param = element.getAttributeNode('type_param')
       if type_param and type_param.value:
-        type_param.value = "*"
-    elif element.tagName == "failure":
+        type_param.value = '*'
+    elif element.tagName == 'failure':
+      source_line_pat = r'^.*[/\\](.*:)\d+\n'
+      # Replaces the source line information with a normalized form.
+      message = element.getAttributeNode('message')
+      message.value = re.sub(source_line_pat, '\\1*\n', message.value)
       for child in element.childNodes:
         if child.nodeType == Node.CDATA_SECTION_NODE:
-          # Removes the source line number.
-          cdata = re.sub(r"^.*[/\\](.*:)\d+\n", "\\1*\n", child.nodeValue)
+          # Replaces the source line information with a normalized form.
+          cdata = re.sub(source_line_pat, '\\1*\n', child.nodeValue)
           # Removes the actual stack trace.
-          child.nodeValue = re.sub(r"\nStack trace:\n(.|\n)*",
-                                   "", cdata)
+          child.nodeValue = re.sub(r'\nStack trace:\n(.|\n)*',
+                                   '', cdata)
     for child in element.childNodes:
       if child.nodeType == Node.ELEMENT_NODE:
         self.NormalizeXml(child)
index 74a7815..aefaa88 100755 (executable)
@@ -3,7 +3,7 @@
        archiveVersion = 1;
        classes = {
        };
-       objectVersion = 42;
+       objectVersion = 46;
        objects = {
 
 /* Begin PBXAggregateTarget section */
@@ -46,7 +46,7 @@
                4048843B0E2F799B00CF7658 /* gtest.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DE0E2F799B00CF7658 /* gtest.h */; settings = {ATTRIBUTES = (Public, ); }; };
                4048843C0E2F799B00CF7658 /* gtest_pred_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883DF0E2F799B00CF7658 /* gtest_pred_impl.h */; settings = {ATTRIBUTES = (Public, ); }; };
                4048843D0E2F799B00CF7658 /* gtest_prod.h in Headers */ = {isa = PBXBuildFile; fileRef = 404883E00E2F799B00CF7658 /* gtest_prod.h */; settings = {ATTRIBUTES = (Public, ); }; };
-               404884500E2F799B00CF7658 /* README in Resources */ = {isa = PBXBuildFile; fileRef = 404883F60E2F799B00CF7658 /* README */; };
+               404884500E2F799B00CF7658 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 404883F60E2F799B00CF7658 /* README.md */; };
                404884A00E2F7BE600CF7658 /* gtest-death-test-internal.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E20E2F799B00CF7658 /* gtest-death-test-internal.h */; };
                404884A10E2F7BE600CF7658 /* gtest-filepath.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E30E2F799B00CF7658 /* gtest-filepath.h */; };
                404884A20E2F7BE600CF7658 /* gtest-internal.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E40E2F799B00CF7658 /* gtest-internal.h */; };
@@ -54,7 +54,7 @@
                404884A40E2F7BE600CF7658 /* gtest-string.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 404883E60E2F799B00CF7658 /* gtest-string.h */; };
                404884AC0E2F7CD900CF7658 /* CHANGES in Resources */ = {isa = PBXBuildFile; fileRef = 404884A90E2F7CD900CF7658 /* CHANGES */; };
                404884AD0E2F7CD900CF7658 /* CONTRIBUTORS in Resources */ = {isa = PBXBuildFile; fileRef = 404884AA0E2F7CD900CF7658 /* CONTRIBUTORS */; };
-               404884AE0E2F7CD900CF7658 /* COPYING in Resources */ = {isa = PBXBuildFile; fileRef = 404884AB0E2F7CD900CF7658 /* COPYING */; };
+               404884AE0E2F7CD900CF7658 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 404884AB0E2F7CD900CF7658 /* LICENSE */; };
                40899F3A0FFA70D4000B29AE /* gtest-all.cc in Sources */ = {isa = PBXBuildFile; fileRef = 224A12A10E9EADA700BD17FD /* gtest-all.cc */; };
                40899F500FFA7281000B29AE /* gtest-tuple.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 40899F4D0FFA7271000B29AE /* gtest-tuple.h */; };
                40899F530FFA72A0000B29AE /* gtest_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C120E7FE13C00846E11 /* gtest_unittest.cc */; };
                404883E40E2F799B00CF7658 /* gtest-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-internal.h"; sourceTree = "<group>"; };
                404883E50E2F799B00CF7658 /* gtest-port.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-port.h"; sourceTree = "<group>"; };
                404883E60E2F799B00CF7658 /* gtest-string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-string.h"; sourceTree = "<group>"; };
-               404883F60E2F799B00CF7658 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README; path = ../README; sourceTree = SOURCE_ROOT; };
+               404883F60E2F799B00CF7658 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README.md; path = ../README.md; sourceTree = SOURCE_ROOT; };
                4048840D0E2F799B00CF7658 /* gtest_main.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_main.cc; sourceTree = "<group>"; };
                404884A90E2F7CD900CF7658 /* CHANGES */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CHANGES; path = ../CHANGES; sourceTree = SOURCE_ROOT; };
                404884AA0E2F7CD900CF7658 /* CONTRIBUTORS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CONTRIBUTORS; path = ../CONTRIBUTORS; sourceTree = SOURCE_ROOT; };
-               404884AB0E2F7CD900CF7658 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = COPYING; path = ../COPYING; sourceTree = SOURCE_ROOT; };
+               404884AB0E2F7CD900CF7658 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = SOURCE_ROOT; };
                40899F430FFA7184000B29AE /* gtest_unittest-framework */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "gtest_unittest-framework"; sourceTree = BUILT_PRODUCTS_DIR; };
                40899F4D0FFA7271000B29AE /* gtest-tuple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-tuple.h"; sourceTree = "<group>"; };
                40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = StaticLibraryTarget.xcconfig; sourceTree = "<group>"; };
                        children = (
                                404884A90E2F7CD900CF7658 /* CHANGES */,
                                404884AA0E2F7CD900CF7658 /* CONTRIBUTORS */,
-                               404884AB0E2F7CD900CF7658 /* COPYING */,
-                               404883F60E2F799B00CF7658 /* README */,
+                               404884AB0E2F7CD900CF7658 /* LICENSE */,
+                               404883F60E2F799B00CF7658 /* README.md */,
                                404883D90E2F799B00CF7658 /* include */,
                                4089A02F0FFACF84000B29AE /* samples */,
                                404884070E2F799B00CF7658 /* src */,
 /* Begin PBXProject section */
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
+                       attributes = {
+                               LastUpgradeCheck = 0460;
+                       };
                        buildConfigurationList = 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject "gtest" */;
-                       compatibilityVersion = "Xcode 2.4";
+                       compatibilityVersion = "Xcode 3.2";
+                       developmentRegion = English;
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               404884500E2F799B00CF7658 /* README in Resources */,
+                               404884500E2F799B00CF7658 /* README.md in Resources */,
                                404884AC0E2F7CD900CF7658 /* CHANGES in Resources */,
                                404884AD0E2F7CD900CF7658 /* CONTRIBUTORS in Resources */,
-                               404884AE0E2F7CD900CF7658 /* COPYING in Resources */,
+                               404884AE0E2F7CD900CF7658 /* LICENSE in Resources */,
                                40C84978101A36540083642A /* libgtest_main.a in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                3B238F600E828B5400846E11 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               COMBINE_HIDPI_IMAGES = YES;
                                COPY_PHASE_STRIP = NO;
                                GCC_DYNAMIC_NO_PIC = NO;
                                GCC_OPTIMIZATION_LEVEL = 0;
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                PRODUCT_NAME = Check;
+                               SDKROOT = macosx;
                        };
                        name = Debug;
                };
                3B238F610E828B5400846E11 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               COMBINE_HIDPI_IMAGES = YES;
                                COPY_PHASE_STRIP = YES;
                                DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                PRODUCT_NAME = Check;
+                               SDKROOT = macosx;
                                ZERO_LINK = NO;
                        };
                        name = Release;
                40899F450FFA7185000B29AE /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                HEADER_SEARCH_PATHS = ../;
                                PRODUCT_NAME = "gtest_unittest-framework";
+                               SDKROOT = macosx;
                        };
                        name = Debug;
                };
                40899F460FFA7185000B29AE /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                HEADER_SEARCH_PATHS = ../;
                                PRODUCT_NAME = "gtest_unittest-framework";
+                               SDKROOT = macosx;
                        };
                        name = Release;
                };
                4089A0150FFACEFD000B29AE /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                PRODUCT_NAME = "sample1_unittest-framework";
+                               SDKROOT = macosx;
                        };
                        name = Debug;
                };
                4089A0160FFACEFD000B29AE /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                PRODUCT_NAME = "sample1_unittest-framework";
+                               SDKROOT = macosx;
                        };
                        name = Release;
                };
                40C44ADF0E3798F4008FCC51 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               COMBINE_HIDPI_IMAGES = YES;
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+                               MACOSX_DEPLOYMENT_TARGET = 10.7;
                                PRODUCT_NAME = gtest;
+                               SDKROOT = macosx;
                                TARGET_NAME = gtest;
                        };
                        name = Debug;
                40C44AE00E3798F4008FCC51 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               COMBINE_HIDPI_IMAGES = YES;
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+                               MACOSX_DEPLOYMENT_TARGET = 10.7;
                                PRODUCT_NAME = gtest;
+                               SDKROOT = macosx;
                                TARGET_NAME = gtest;
                        };
                        name = Release;
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;
                        buildSettings = {
+                               COMBINE_HIDPI_IMAGES = YES;
                                GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
                                GCC_SYMBOLS_PRIVATE_EXTERN = YES;
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                HEADER_SEARCH_PATHS = (
                                        ../,
                                        ../include/,
                                );
                                PRODUCT_NAME = gtest;
+                               SDKROOT = macosx;
                        };
                        name = Debug;
                };
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;
                        buildSettings = {
+                               COMBINE_HIDPI_IMAGES = YES;
                                GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
                                GCC_SYMBOLS_PRIVATE_EXTERN = YES;
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                HEADER_SEARCH_PATHS = (
                                        ../,
                                        ../include/,
                                );
                                PRODUCT_NAME = gtest;
+                               SDKROOT = macosx;
                        };
                        name = Release;
                };
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;
                        buildSettings = {
+                               COMBINE_HIDPI_IMAGES = YES;
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                HEADER_SEARCH_PATHS = (
                                        ../,
                                        ../include/,
                                );
                                PRODUCT_NAME = gtest_main;
+                               SDKROOT = macosx;
                        };
                        name = Debug;
                };
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 40899FB30FFA7567000B29AE /* StaticLibraryTarget.xcconfig */;
                        buildSettings = {
+                               COMBINE_HIDPI_IMAGES = YES;
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                HEADER_SEARCH_PATHS = (
                                        ../,
                                        ../include/,
                                );
                                PRODUCT_NAME = gtest_main;
+                               SDKROOT = macosx;
                        };
                        name = Release;
                };
                40C84985101A36850083642A /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                HEADER_SEARCH_PATHS = ../;
                                PRODUCT_NAME = gtest_unittest;
+                               SDKROOT = macosx;
                        };
                        name = Debug;
                };
                40C84986101A36850083642A /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                HEADER_SEARCH_PATHS = ../;
                                PRODUCT_NAME = gtest_unittest;
+                               SDKROOT = macosx;
                        };
                        name = Release;
                };
                40C84995101A36A60083642A /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                PRODUCT_NAME = "sample1_unittest-static";
+                               SDKROOT = macosx;
                        };
                        name = Debug;
                };
                40C84996101A36A60083642A /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                PRODUCT_NAME = "sample1_unittest-static";
+                               SDKROOT = macosx;
                        };
                        name = Release;
                };
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */;
                        buildSettings = {
+                               COMBINE_HIDPI_IMAGES = YES;
                                DYLIB_COMPATIBILITY_VERSION = 1;
                                DYLIB_CURRENT_VERSION = 1;
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                HEADER_SEARCH_PATHS = (
                                        ../,
                                        ../include/,
                                INFOPLIST_PREFIX_HEADER = "$(PROJECT_TEMP_DIR)/Version.h";
                                INFOPLIST_PREPROCESS = YES;
                                PRODUCT_NAME = gtest;
+                               SDKROOT = macosx;
                                VERSIONING_SYSTEM = "apple-generic";
                        };
                        name = Debug;
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */;
                        buildSettings = {
+                               COMBINE_HIDPI_IMAGES = YES;
                                DYLIB_COMPATIBILITY_VERSION = 1;
                                DYLIB_CURRENT_VERSION = 1;
+                               GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                HEADER_SEARCH_PATHS = (
                                        ../,
                                        ../include/,
                                INFOPLIST_PREFIX_HEADER = "$(PROJECT_TEMP_DIR)/Version.h";
                                INFOPLIST_PREPROCESS = YES;
                                PRODUCT_NAME = gtest;
+                               SDKROOT = macosx;
                                VERSIONING_SYSTEM = "apple-generic";
                        };
                        name = Release;