Merge branch 'master' into fix-argc
This commit is contained in:
commit
27bb844e5c
16
.gitignore
vendored
16
.gitignore
vendored
|
@ -22,3 +22,19 @@ Win32-Debug/
|
||||||
Win32-Release/
|
Win32-Release/
|
||||||
x64-Debug/
|
x64-Debug/
|
||||||
x64-Release/
|
x64-Release/
|
||||||
|
|
||||||
|
# Ignore autoconf / automake files
|
||||||
|
Makefile.in
|
||||||
|
aclocal.m4
|
||||||
|
configure
|
||||||
|
build-aux/
|
||||||
|
autom4te.cache/
|
||||||
|
googletest/m4/libtool.m4
|
||||||
|
googletest/m4/ltoptions.m4
|
||||||
|
googletest/m4/ltsugar.m4
|
||||||
|
googletest/m4/ltversion.m4
|
||||||
|
googletest/m4/lt~obsolete.m4
|
||||||
|
|
||||||
|
# Ignore generated directories.
|
||||||
|
googlemock/fused-src/
|
||||||
|
googletest/fused-src/
|
||||||
|
|
90
.travis.yml
90
.travis.yml
|
@ -3,19 +3,67 @@
|
||||||
# This file can be validated on:
|
# This file can be validated on:
|
||||||
# http://lint.travis-ci.org/
|
# http://lint.travis-ci.org/
|
||||||
|
|
||||||
|
sudo: false
|
||||||
|
language: cpp
|
||||||
|
|
||||||
|
# Define the matrix explicitly, manually expanding the combinations of (os, compiler, env).
|
||||||
|
# It is more tedious, but grants us far more flexibility.
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
sudo : true
|
||||||
|
install: ./ci/install-linux.sh && ./ci/log-config.sh
|
||||||
|
script: ./ci/build-linux-bazel.sh
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
sudo : true
|
||||||
|
install: ./ci/install-linux.sh && ./ci/log-config.sh
|
||||||
|
script: ./ci/build-linux-bazel.sh
|
||||||
|
- os: linux
|
||||||
|
group: deprecated-2017Q4
|
||||||
|
compiler: gcc
|
||||||
|
install: ./ci/install-linux.sh && ./ci/log-config.sh
|
||||||
|
script: ./ci/build-linux-autotools.sh
|
||||||
|
- os: linux
|
||||||
|
group: deprecated-2017Q4
|
||||||
|
compiler: gcc
|
||||||
|
env: BUILD_TYPE=Debug VERBOSE=1 CXX_FLAGS=-std=c++11
|
||||||
|
- os: linux
|
||||||
|
group: deprecated-2017Q4
|
||||||
|
compiler: clang
|
||||||
|
env: BUILD_TYPE=Debug VERBOSE=1
|
||||||
|
- os: linux
|
||||||
|
group: deprecated-2017Q4
|
||||||
|
compiler: clang
|
||||||
|
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
|
||||||
|
- os: osx
|
||||||
|
compiler: gcc
|
||||||
|
env: BUILD_TYPE=Debug VERBOSE=1
|
||||||
|
if: type != pull_request
|
||||||
|
- os: osx
|
||||||
|
compiler: gcc
|
||||||
|
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
|
||||||
|
if: type != pull_request
|
||||||
|
- os: osx
|
||||||
|
compiler: clang
|
||||||
|
env: BUILD_TYPE=Debug VERBOSE=1
|
||||||
|
if: type != pull_request
|
||||||
|
- os: osx
|
||||||
|
compiler: clang
|
||||||
|
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
|
||||||
|
if: type != pull_request
|
||||||
|
|
||||||
|
# These are the install and build (script) phases for the most common entries in the matrix. They could be included
|
||||||
|
# in each entry in the matrix, but that is just repetitive.
|
||||||
install:
|
install:
|
||||||
# /usr/bin/gcc is 4.6 always, but gcc-X.Y is available.
|
- ./ci/install-${TRAVIS_OS_NAME}.sh
|
||||||
- if [ "$CXX" = "g++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
|
- . ./ci/env-${TRAVIS_OS_NAME}.sh
|
||||||
# /usr/bin/clang is 3.4, lets override with modern one.
|
- ./ci/log-config.sh
|
||||||
- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; ln -sf /usr/bin/ccache /$HOME/bin/$CXX; ln -sf /usr/bin/ccache /$HOME/bin/$CC; fi
|
|
||||||
# ccache on OS X needs installation first
|
script: ./ci/travis.sh
|
||||||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install ccache; export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
|
|
||||||
# reset ccache statistics
|
# For sudo=false builds this section installs the necessary dependencies.
|
||||||
- ccache --zero-stats
|
|
||||||
- echo ${PATH}
|
|
||||||
- echo ${CXX}
|
|
||||||
- ${CXX} --version
|
|
||||||
- ${CXX} -v
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
# List of whitelisted in travis packages for ubuntu-precise can be found here:
|
# List of whitelisted in travis packages for ubuntu-precise can be found here:
|
||||||
|
@ -28,22 +76,6 @@ addons:
|
||||||
packages:
|
packages:
|
||||||
- g++-4.9
|
- g++-4.9
|
||||||
- clang-3.7
|
- clang-3.7
|
||||||
os:
|
|
||||||
- linux
|
|
||||||
- osx
|
|
||||||
language: cpp
|
|
||||||
cache: ccache
|
|
||||||
before_cache:
|
|
||||||
# print statistics before uploading new cache
|
|
||||||
- ccache --show-stats
|
|
||||||
compiler:
|
|
||||||
- gcc
|
|
||||||
- clang
|
|
||||||
script: ./travis.sh
|
|
||||||
env:
|
|
||||||
matrix:
|
|
||||||
- BUILD_TYPE=Debug VERBOSE=1
|
|
||||||
- BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
sudo: false
|
|
||||||
|
|
19
BUILD.bazel
19
BUILD.bazel
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2017 Google Inc.
|
# Copyright 2017 Google Inc.
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -37,11 +37,16 @@ package(default_visibility = ["//visibility:public"])
|
||||||
licenses(["notice"])
|
licenses(["notice"])
|
||||||
|
|
||||||
config_setting(
|
config_setting(
|
||||||
name = "win",
|
name = "windows",
|
||||||
|
values = { "cpu": "x64_windows" },
|
||||||
|
)
|
||||||
|
|
||||||
|
config_setting(
|
||||||
|
name = "windows_msvc",
|
||||||
values = {"cpu": "x64_windows_msvc"},
|
values = {"cpu": "x64_windows_msvc"},
|
||||||
)
|
)
|
||||||
|
|
||||||
# Google Test including Google Mock
|
# Google Test including Google Mock
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "gtest",
|
name = "gtest",
|
||||||
srcs = glob(
|
srcs = glob(
|
||||||
|
@ -65,7 +70,8 @@ cc_library(
|
||||||
]),
|
]),
|
||||||
copts = select(
|
copts = select(
|
||||||
{
|
{
|
||||||
":win": [],
|
":windows": [],
|
||||||
|
":windows_msvc": [],
|
||||||
"//conditions:default": ["-pthread"],
|
"//conditions:default": ["-pthread"],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -76,7 +82,8 @@ cc_library(
|
||||||
"googletest/include",
|
"googletest/include",
|
||||||
],
|
],
|
||||||
linkopts = select({
|
linkopts = select({
|
||||||
":win": [],
|
":windows": [],
|
||||||
|
":windows_msvc": [],
|
||||||
"//conditions:default": [
|
"//conditions:default": [
|
||||||
"-pthread",
|
"-pthread",
|
||||||
],
|
],
|
||||||
|
@ -88,7 +95,7 @@ cc_library(
|
||||||
srcs = [
|
srcs = [
|
||||||
"googlemock/src/gmock_main.cc",
|
"googlemock/src/gmock_main.cc",
|
||||||
],
|
],
|
||||||
deps = ["//:gtest"],
|
deps = [":gtest"],
|
||||||
)
|
)
|
||||||
|
|
||||||
# The following rules build samples of how to use gTest.
|
# The following rules build samples of how to use gTest.
|
||||||
|
|
160
CONTRIBUTING.md
Normal file
160
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
# How to become a contributor and submit your own code
|
||||||
|
|
||||||
|
## Contributor License Agreements
|
||||||
|
|
||||||
|
We'd love to accept your patches! Before we can take them, we
|
||||||
|
have to jump a couple of legal hurdles.
|
||||||
|
|
||||||
|
Please fill out either the individual or corporate Contributor License Agreement
|
||||||
|
(CLA).
|
||||||
|
|
||||||
|
* 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](https://developers.google.com/open-source/cla/individual).
|
||||||
|
* If you work for a company that wants to allow you to contribute your work,
|
||||||
|
then you'll need to sign a
|
||||||
|
[corporate CLA](https://developers.google.com/open-source/cla/corporate).
|
||||||
|
|
||||||
|
Follow either of the two links above to access the appropriate CLA and
|
||||||
|
instructions for how to sign and return it. Once we receive it, we'll be able to
|
||||||
|
accept your pull requests.
|
||||||
|
|
||||||
|
## Contributing A Patch
|
||||||
|
|
||||||
|
1. Submit an issue describing your proposed change to the
|
||||||
|
[issue tracker](https://github.com/google/googletest).
|
||||||
|
1. 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. If your proposed change is accepted, and you haven't already done so, sign a
|
||||||
|
Contributor License Agreement (see details above).
|
||||||
|
1. Fork the desired repo, develop and test your code changes.
|
||||||
|
1. Ensure that your code adheres to the existing style in the sample to which
|
||||||
|
you are contributing.
|
||||||
|
1. Ensure that your code has an appropriate set of unit tests which all pass.
|
||||||
|
1. Submit a pull request.
|
||||||
|
|
||||||
|
If you are a Googler, it is preferable to first create an internal change and
|
||||||
|
have it reviewed and submitted, and then create an upstreaming pull
|
||||||
|
request here.
|
||||||
|
|
||||||
|
## The Google Test and Google Mock Communities ##
|
||||||
|
|
||||||
|
The Google Test community exists primarily through the
|
||||||
|
[discussion group](http://groups.google.com/group/googletestframework)
|
||||||
|
and the GitHub repository.
|
||||||
|
Likewise, the Google Mock community exists primarily through their own
|
||||||
|
[discussion group](http://groups.google.com/group/googlemock).
|
||||||
|
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.
|
||||||
|
|
||||||
|
## 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](https://github.com/google/styleguide) project. All patches will be expected
|
||||||
|
to conform to the style outlined [here](https://google.github.io/styleguide/cppguide.html).
|
||||||
|
|
||||||
|
## Requirements for Contributors ###
|
||||||
|
|
||||||
|
If you plan to contribute a patch, you need to build Google Test,
|
||||||
|
Google Mock, and their own tests from a git checkout, which has
|
||||||
|
further requirements:
|
||||||
|
|
||||||
|
* [Python](https://www.python.org/) v2.3 or newer (for running some of
|
||||||
|
the tests and re-generating certain source files from templates)
|
||||||
|
* [CMake](https://cmake.org/) v2.6.4 or newer
|
||||||
|
* [GNU Build System](https://en.wikipedia.org/wiki/GNU_Build_System)
|
||||||
|
including automake (>= 1.9), autoconf (>= 2.59), and
|
||||||
|
libtool / libtoolize.
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
For example, the
|
||||||
|
file include/gtest/internal/gtest-type-util.h.pump is used to generate
|
||||||
|
gtest-type-util.h in the same directory.
|
||||||
|
|
||||||
|
You don't need to worry about regenerating the source files
|
||||||
|
unless you need to modify them. You would then modify the
|
||||||
|
corresponding `.pump` files and run the '[pump.py](googletest/scripts/pump.py)'
|
||||||
|
generator script. See the [Pump Manual](googletest/docs/PumpManual.md).
|
||||||
|
|
||||||
|
## Developing Google Mock ###
|
||||||
|
|
||||||
|
This section discusses how to make your own changes to Google Mock.
|
||||||
|
|
||||||
|
#### Testing Google Mock 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'll need Autotools. First, make sure you have followed
|
||||||
|
the instructions above to configure Google Mock.
|
||||||
|
Then, create a build output directory and enter it. Next,
|
||||||
|
|
||||||
|
${GMOCK_DIR}/configure # try --help for more info
|
||||||
|
|
||||||
|
Once you have successfully configured Google Mock, the build steps are
|
||||||
|
standard for GNU-style OSS packages.
|
||||||
|
|
||||||
|
make # Standard makefile following GNU conventions
|
||||||
|
make check # Builds and runs all tests - all should pass.
|
||||||
|
|
||||||
|
Note that when building your project against Google Mock, you are building
|
||||||
|
against Google Test as well. There is no need to configure Google Test
|
||||||
|
separately.
|
28
LICENSE
Normal file
28
LICENSE
Normal file
|
@ -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.
|
14
Makefile.am
Normal file
14
Makefile.am
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
## Process this file with automake to produce Makefile.in
|
||||||
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
|
# Build . before src so that our all-local and clean-local hooks kicks in at
|
||||||
|
# the right time.
|
||||||
|
SUBDIRS = googletest googlemock
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
BUILD.bazel \
|
||||||
|
CMakeLists.txt \
|
||||||
|
README.md \
|
||||||
|
WORKSPACE
|
32
README.md
32
README.md
|
@ -114,35 +114,9 @@ package (as described below):
|
||||||
* Mac OS X v10.4 Tiger or newer
|
* Mac OS X v10.4 Tiger or newer
|
||||||
* Xcode Developer Tools
|
* Xcode Developer Tools
|
||||||
|
|
||||||
### Requirements for Contributors ###
|
## Contributing change
|
||||||
|
|
||||||
We welcome patches. If you plan to contribute a patch, you need to
|
Please read the [`CONTRIBUTING.md`](CONTRIBUTING.md) for details on
|
||||||
build Google Test and its own tests from a git checkout (described
|
how to contribute to this project.
|
||||||
below), which has further requirements:
|
|
||||||
|
|
||||||
* [Python](https://www.python.org/) v2.3 or newer (for running some of
|
|
||||||
the tests and re-generating certain source files from templates)
|
|
||||||
* [CMake](https://cmake.org/) v2.6.4 or newer
|
|
||||||
|
|
||||||
## Regenerating Source Files ##
|
|
||||||
|
|
||||||
Some of Google Test's source files are generated from templates (not
|
|
||||||
in the C++ sense) using a script.
|
|
||||||
For example, the
|
|
||||||
file include/gtest/internal/gtest-type-util.h.pump is used to generate
|
|
||||||
gtest-type-util.h in the same directory.
|
|
||||||
|
|
||||||
You don't need to worry about regenerating the source files
|
|
||||||
unless you need to modify them. You would then modify the
|
|
||||||
corresponding `.pump` files and run the '[pump.py](googletest/scripts/pump.py)'
|
|
||||||
generator script. See the [Pump Manual](googletest/docs/PumpManual.md).
|
|
||||||
|
|
||||||
### Contributing Code ###
|
|
||||||
|
|
||||||
We welcome patches. Please read the
|
|
||||||
[Developer's Guide](googletest/docs/DevGuide.md)
|
|
||||||
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.
|
|
||||||
|
|
||||||
Happy testing!
|
Happy testing!
|
||||||
|
|
18
appveyor.yml
18
appveyor.yml
|
@ -11,6 +11,7 @@ environment:
|
||||||
- compiler: msvc-15-seh
|
- compiler: msvc-15-seh
|
||||||
generator: "Visual Studio 15 2017 Win64"
|
generator: "Visual Studio 15 2017 Win64"
|
||||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
enabled_on_pr: yes
|
||||||
|
|
||||||
- compiler: msvc-14-seh
|
- compiler: msvc-14-seh
|
||||||
generator: "Visual Studio 14 2015"
|
generator: "Visual Studio 14 2015"
|
||||||
|
@ -43,7 +44,6 @@ environment:
|
||||||
|
|
||||||
configuration:
|
configuration:
|
||||||
- Debug
|
- Debug
|
||||||
#- Release
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
verbosity: minimal
|
verbosity: minimal
|
||||||
|
@ -52,6 +52,14 @@ install:
|
||||||
- ps: |
|
- ps: |
|
||||||
Write-Output "Compiler: $env:compiler"
|
Write-Output "Compiler: $env:compiler"
|
||||||
Write-Output "Generator: $env:generator"
|
Write-Output "Generator: $env:generator"
|
||||||
|
if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) {
|
||||||
|
Write-Output "This is *NOT* a pull request build"
|
||||||
|
} else {
|
||||||
|
Write-Output "This is a pull request build"
|
||||||
|
if (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes") {
|
||||||
|
Write-Output "PR builds are *NOT* explicitly enabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# git bash conflicts with MinGW makefiles
|
# git bash conflicts with MinGW makefiles
|
||||||
if ($env:generator -eq "MinGW Makefiles") {
|
if ($env:generator -eq "MinGW Makefiles") {
|
||||||
|
@ -63,6 +71,10 @@ install:
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- ps: |
|
- ps: |
|
||||||
|
# Only enable some builds for pull requests, the AppVeyor queue is too long.
|
||||||
|
if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) {
|
||||||
|
return
|
||||||
|
}
|
||||||
md _build -Force | Out-Null
|
md _build -Force | Out-Null
|
||||||
cd _build
|
cd _build
|
||||||
|
|
||||||
|
@ -81,6 +93,10 @@ build_script:
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- ps: |
|
- ps: |
|
||||||
|
# Only enable some builds for pull requests, the AppVeyor queue is too long.
|
||||||
|
if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if ($env:generator -eq "MinGW Makefiles") {
|
if ($env:generator -eq "MinGW Makefiles") {
|
||||||
return # No test available for MinGW
|
return # No test available for MinGW
|
||||||
}
|
}
|
||||||
|
|
44
ci/build-linux-autotools.sh
Executable file
44
ci/build-linux-autotools.sh
Executable file
|
@ -0,0 +1,44 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright 2017 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.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
. ci/get-nprocessors.sh
|
||||||
|
|
||||||
|
# Create the configuration script
|
||||||
|
autoreconf -i
|
||||||
|
|
||||||
|
# Run in a subdirectory to keep the sources clean
|
||||||
|
mkdir build || true
|
||||||
|
cd build
|
||||||
|
../configure
|
||||||
|
|
||||||
|
make -j ${NPROCESSORS:-2}
|
35
ci/build-linux-bazel.sh
Executable file
35
ci/build-linux-bazel.sh
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright 2017 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.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
bazel build --curses=no //...:all
|
||||||
|
bazel test --curses=no //...:all
|
41
ci/env-linux.sh
Executable file
41
ci/env-linux.sh
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright 2017 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 should be sourced, and not executed as a standalone script.
|
||||||
|
#
|
||||||
|
|
||||||
|
# TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}.
|
||||||
|
|
||||||
|
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
|
||||||
|
if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
|
||||||
|
if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
|
||||||
|
fi
|
40
ci/env-osx.sh
Executable file
40
ci/env-osx.sh
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright 2017 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 should be sourced, and not executed as a standalone script.
|
||||||
|
#
|
||||||
|
|
||||||
|
# TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}.
|
||||||
|
|
||||||
|
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
|
||||||
|
if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
|
||||||
|
fi
|
48
ci/get-nprocessors.sh
Executable file
48
ci/get-nprocessors.sh
Executable file
|
@ -0,0 +1,48 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright 2017 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 is typically sourced by another script.
|
||||||
|
# if possible, ask for the precise number of processors,
|
||||||
|
# otherwise take 2 processors as reasonable default; see
|
||||||
|
# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization
|
||||||
|
if [ -x /usr/bin/getconf ]; then
|
||||||
|
NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
|
||||||
|
else
|
||||||
|
NPROCESSORS=2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# as of 2017-09-04 Travis CI reports 32 processors, but GCC build
|
||||||
|
# crashes if parallelized too much (maybe memory consumption problem),
|
||||||
|
# so limit to 4 processors for the time being.
|
||||||
|
if [ $NPROCESSORS -gt 4 ] ; then
|
||||||
|
echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4."
|
||||||
|
NPROCESSORS=4
|
||||||
|
fi
|
49
ci/install-linux.sh
Executable file
49
ci/install-linux.sh
Executable file
|
@ -0,0 +1,49 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright 2017 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.
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
if [ "${TRAVIS_OS_NAME}" != linux ]; then
|
||||||
|
echo "Not a Linux build; skipping installation"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "${TRAVIS_SUDO}" = "true" ]; then
|
||||||
|
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | \
|
||||||
|
sudo tee /etc/apt/sources.list.d/bazel.list
|
||||||
|
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
|
||||||
|
sudo apt-get update && sudo apt-get install -y bazel gcc-4.9 g++-4.9 clang-3.7
|
||||||
|
elif [ "${CXX}" = "clang++" ]; then
|
||||||
|
# Use ccache, assuming $HOME/bin is in the path, which is true in the Travis build environment.
|
||||||
|
ln -sf /usr/bin/ccache $HOME/bin/${CXX};
|
||||||
|
ln -sf /usr/bin/ccache $HOME/bin/${CC};
|
||||||
|
fi
|
39
ci/install-osx.sh
Executable file
39
ci/install-osx.sh
Executable file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright 2017 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.
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
if [ "${TRAVIS_OS_NAME}" != "osx" ]; then
|
||||||
|
echo "Not a macOS build; skipping installation"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
brew install ccache
|
51
ci/log-config.sh
Executable file
51
ci/log-config.sh
Executable file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright 2017 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.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# ccache on OS X needs installation first
|
||||||
|
# reset ccache statistics
|
||||||
|
ccache --zero-stats
|
||||||
|
|
||||||
|
echo PATH=${PATH}
|
||||||
|
|
||||||
|
echo "Compiler configuration:"
|
||||||
|
echo CXX=${CXX}
|
||||||
|
echo CC=${CC}
|
||||||
|
echo CXXFLAGS=${CXXFLAGS}
|
||||||
|
|
||||||
|
echo "C++ compiler version:"
|
||||||
|
${CXX} --version || echo "${CXX} does not seem to support the --version flag"
|
||||||
|
${CXX} -v || echo "${CXX} does not seem to support the -v flag"
|
||||||
|
|
||||||
|
echo "C compiler version:"
|
||||||
|
${CC} --version || echo "${CXX} does not seem to support the --version flag"
|
||||||
|
${CC} -v || echo "${CXX} does not seem to support the -v flag"
|
|
@ -1,6 +1,8 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
set -evx
|
set -evx
|
||||||
|
|
||||||
|
. ci/get-nprocessors.sh
|
||||||
|
|
||||||
# if possible, ask for the precise number of processors,
|
# if possible, ask for the precise number of processors,
|
||||||
# otherwise take 2 processors as reasonable default; see
|
# otherwise take 2 processors as reasonable default; see
|
||||||
# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization
|
# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization
|
16
configure.ac
Normal file
16
configure.ac
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
AC_INIT([Google C++ Mocking and Testing Frameworks],
|
||||||
|
[1.8.0],
|
||||||
|
[googlemock@googlegroups.com],
|
||||||
|
[googletest])
|
||||||
|
|
||||||
|
# Provide various options to initialize the Autoconf and configure processes.
|
||||||
|
AC_PREREQ([2.59])
|
||||||
|
AC_CONFIG_SRCDIR([./README.md])
|
||||||
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
|
AC_CONFIG_FILES([Makefile])
|
||||||
|
AC_CONFIG_SUBDIRS([googletest googlemock])
|
||||||
|
|
||||||
|
AM_INIT_AUTOMAKE
|
||||||
|
|
||||||
|
# Output the generated files. No further autoconf macros may be used.
|
||||||
|
AC_OUTPUT
|
|
@ -103,8 +103,8 @@ cxx_library(gmock_main
|
||||||
# to the targets for when we are part of a parent build (ie being pulled
|
# 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).
|
# in via add_subdirectory() rather than being a standalone build).
|
||||||
if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
|
if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
|
||||||
target_include_directories(gmock INTERFACE "${gmock_SOURCE_DIR}/include")
|
target_include_directories(gmock SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include")
|
||||||
target_include_directories(gmock_main INTERFACE "${gmock_SOURCE_DIR}/include")
|
target_include_directories(gmock_main SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -112,11 +112,11 @@ endif()
|
||||||
# Install rules
|
# Install rules
|
||||||
if(INSTALL_GMOCK)
|
if(INSTALL_GMOCK)
|
||||||
install(TARGETS gmock gmock_main
|
install(TARGETS gmock gmock_main
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
install(DIRECTORY ${gmock_SOURCE_DIR}/include/gmock
|
install(DIRECTORY "${gmock_SOURCE_DIR}/include/gmock"
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
|
||||||
# configure and install pkgconfig files
|
# configure and install pkgconfig files
|
||||||
configure_file(
|
configure_file(
|
||||||
|
|
|
@ -337,38 +337,6 @@ use the new matcher API (
|
||||||
[polymorphic](./docs/CookBook.md#writing-new-polymorphic-matchers)).
|
[polymorphic](./docs/CookBook.md#writing-new-polymorphic-matchers)).
|
||||||
Matchers defined using `MATCHER()` or `MATCHER_P*()` aren't affected.
|
Matchers defined using `MATCHER()` or `MATCHER_P*()` aren't affected.
|
||||||
|
|
||||||
### Developing Google Mock ###
|
|
||||||
|
|
||||||
This section discusses how to make your own changes to Google Mock.
|
|
||||||
|
|
||||||
#### Testing Google Mock 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'll need Autotools. First, make sure you have followed
|
|
||||||
the instructions above to configure Google Mock.
|
|
||||||
Then, create a build output directory and enter it. Next,
|
|
||||||
|
|
||||||
${GMOCK_DIR}/configure # try --help for more info
|
|
||||||
|
|
||||||
Once you have successfully configured Google Mock, the build steps are
|
|
||||||
standard for GNU-style OSS packages.
|
|
||||||
|
|
||||||
make # Standard makefile following GNU conventions
|
|
||||||
make check # Builds and runs all tests - all should pass.
|
|
||||||
|
|
||||||
Note that when building your project against Google Mock, you are building
|
|
||||||
against Google Test as well. There is no need to configure Google Test
|
|
||||||
separately.
|
|
||||||
|
|
||||||
#### Contributing a Patch ####
|
|
||||||
|
|
||||||
We welcome patches.
|
|
||||||
Please read the [Developer's Guide](docs/DevGuide.md)
|
|
||||||
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.
|
|
||||||
|
|
||||||
Happy testing!
|
Happy testing!
|
||||||
|
|
||||||
[gtest_readme]: ../googletest/README.md "googletest"
|
[gtest_readme]: ../googletest/README.md "googletest"
|
||||||
|
|
|
@ -129,7 +129,7 @@ AS_IF([test "x${HAVE_BUILT_GTEST}" = "xyes"],
|
||||||
GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
|
GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
|
||||||
GTEST_LIBS=`${GTEST_CONFIG} --libs`
|
GTEST_LIBS=`${GTEST_CONFIG} --libs`
|
||||||
GTEST_VERSION=`${GTEST_CONFIG} --version`],
|
GTEST_VERSION=`${GTEST_CONFIG} --version`],
|
||||||
[AC_CONFIG_SUBDIRS([../googletest])
|
[
|
||||||
# GTEST_CONFIG needs to be executable both in a Makefile environment and
|
# GTEST_CONFIG needs to be executable both in a Makefile environment and
|
||||||
# in a shell script environment, so resolve an absolute path for it here.
|
# in a shell script environment, so resolve an absolute path for it here.
|
||||||
GTEST_CONFIG="`pwd -P`/../googletest/scripts/gtest-config"
|
GTEST_CONFIG="`pwd -P`/../googletest/scripts/gtest-config"
|
||||||
|
|
|
@ -1,132 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
If you are interested in understanding the internals of Google Mock,
|
|
||||||
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 Mock source and pre-built packages are provided under the [New BSD License](http://www.opensource.org/licenses/bsd-license.php).
|
|
||||||
|
|
||||||
## The Google Mock Community ##
|
|
||||||
|
|
||||||
The Google Mock community exists primarily through the [discussion group](http://groups.google.com/group/googlemock), the
|
|
||||||
[issue tracker](https://github.com/google/googletest/issues) and, to a lesser extent, the [source control 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
|
|
||||||
Mock 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.
|
|
||||||
|
|
||||||
### Where to Discuss Google Mock ###
|
|
||||||
|
|
||||||
As always, discuss Google Mock in the official [Google C++ Mocking Framework discussion group](http://groups.google.com/group/googlemock). 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 Mock,
|
|
||||||
this is the section for you.
|
|
||||||
|
|
||||||
## Checking Out the Source from Subversion ##
|
|
||||||
|
|
||||||
Checking out the Google Mock source is most useful if you plan to
|
|
||||||
tweak it yourself. You check out the source for Google Mock using a
|
|
||||||
[Subversion](http://subversion.tigris.org/) client as you would for any
|
|
||||||
other project hosted on Google Code. Please see the instruction on
|
|
||||||
the [source code access page](../) for how to do it.
|
|
||||||
|
|
||||||
## 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 mocking 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 Mock 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 Mock, 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](https://github.com/google/styleguide) project. All patches will be expected
|
|
||||||
to conform to the style outlined [here](https://google.github.io/styleguide/cppguide.html).
|
|
||||||
|
|
||||||
## Submitting Patches ##
|
|
||||||
|
|
||||||
Please do submit code. Here's what you need to do:
|
|
||||||
|
|
||||||
1. Normally you should make your change against the SVN trunk instead of a branch or a tag, as the latter two are for release control and should be treated mostly as read-only.
|
|
||||||
1. Decide which code you want to submit. A submission should be a set of changes that addresses one issue in the [Google Mock 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 Mock 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 patch file using `svn diff`.
|
|
||||||
1. We use [Rietveld](http://codereview.appspot.com/) to do web-based code reviews. You can read about the tool [here](https://github.com/rietveld-codereview/rietveld/wiki). When you are ready, upload your patch via Rietveld and notify `googlemock@googlegroups.com` to review it. There are several ways to upload the patch. We recommend using the [upload\_gmock.py](../scripts/upload_gmock.py) script, which you can find in the `scripts/` folder in the SVN trunk.
|
|
||||||
|
|
||||||
## Google Mock Committers ##
|
|
||||||
|
|
||||||
The current members of the Google Mock 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 Mock 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
|
|
||||||
Mock.
|
|
||||||
|
|
||||||
# Release Process #
|
|
||||||
|
|
||||||
We follow the typical release process for Subversion-based projects:
|
|
||||||
|
|
||||||
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/).
|
|
|
@ -11,5 +11,5 @@ the respective git branch/tag).**
|
||||||
|
|
||||||
To contribute code to Google Mock, read:
|
To contribute code to Google Mock, read:
|
||||||
|
|
||||||
* [DevGuide](DevGuide.md) -- read this _before_ writing your first patch.
|
* [CONTRIBUTING](../CONTRIBUTING.md) -- read this _before_ writing your first patch.
|
||||||
* [Pump Manual](../../googletest/docs/PumpManual.md) -- how we generate some of Google Mock's source files.
|
* [Pump Manual](../../googletest/docs/PumpManual.md) -- how we generate some of Google Mock's source files.
|
||||||
|
|
|
@ -3615,6 +3615,10 @@ BoundSecondMatcher<Tuple2Matcher, Second> MatcherBindSecond(
|
||||||
return BoundSecondMatcher<Tuple2Matcher, Second>(tm, second);
|
return BoundSecondMatcher<Tuple2Matcher, Second>(tm, second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Joins a vector of strings as if they are fields of a tuple; returns
|
||||||
|
// the joined string. This function is exported for testing.
|
||||||
|
GTEST_API_ string JoinAsTuple(const Strings& fields);
|
||||||
|
|
||||||
// Returns the description for a matcher defined using the MATCHER*()
|
// Returns the description for a matcher defined using the MATCHER*()
|
||||||
// macro where the user-supplied description string is "", if
|
// macro where the user-supplied description string is "", if
|
||||||
// 'negation' is false; otherwise returns the description of the
|
// 'negation' is false; otherwise returns the description of the
|
||||||
|
|
|
@ -508,7 +508,7 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked()
|
||||||
return expectations_met;
|
return expectations_met;
|
||||||
}
|
}
|
||||||
|
|
||||||
CallReaction intToCallReaction(int mock_behavior) {
|
static CallReaction intToCallReaction(int mock_behavior) {
|
||||||
if (mock_behavior >= kAllow && mock_behavior <= kFail) {
|
if (mock_behavior >= kAllow && mock_behavior <= kFail) {
|
||||||
return static_cast<internal::CallReaction>(mock_behavior);
|
return static_cast<internal::CallReaction>(mock_behavior);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#
|
#
|
||||||
# Bazel Build for Google C++ Testing Framework(Google Test)-googlemock
|
# Bazel Build for Google C++ Testing Framework(Google Test)-googlemock
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
""" gmock own tests """
|
""" gmock own tests """
|
||||||
|
|
||||||
cc_test(
|
cc_test(
|
||||||
|
@ -43,7 +45,8 @@ cc_test(
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
linkopts = select({
|
linkopts = select({
|
||||||
"//:win": [],
|
"//:windows": [],
|
||||||
|
"//:windows_msvc": [],
|
||||||
"//conditions:default": [
|
"//conditions:default": [
|
||||||
"-pthread",
|
"-pthread",
|
||||||
],
|
],
|
||||||
|
|
|
@ -44,15 +44,7 @@
|
||||||
#include "gmock/internal/gmock-port.h"
|
#include "gmock/internal/gmock-port.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "gtest/gtest-spi.h"
|
#include "gtest/gtest-spi.h"
|
||||||
|
|
||||||
// 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
|
|
||||||
// their code.
|
|
||||||
#define GTEST_IMPLEMENTATION_ 1
|
|
||||||
#include "src/gtest-internal-inl.h"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
#if GTEST_OS_CYGWIN
|
#if GTEST_OS_CYGWIN
|
||||||
# include <sys/types.h> // For ssize_t. NOLINT
|
# include <sys/types.h> // For ssize_t. NOLINT
|
||||||
|
|
|
@ -65,10 +65,6 @@
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
namespace internal {
|
|
||||||
GTEST_API_ string JoinAsTuple(const Strings& fields);
|
|
||||||
} // namespace internal
|
|
||||||
|
|
||||||
namespace gmock_matchers_test {
|
namespace gmock_matchers_test {
|
||||||
|
|
||||||
using std::greater;
|
using std::greater;
|
||||||
|
|
|
@ -74,8 +74,8 @@ config_compiler_and_linker() # Defined in internal_utils.cmake.
|
||||||
|
|
||||||
# Where Google Test's .h files can be found.
|
# Where Google Test's .h files can be found.
|
||||||
include_directories(
|
include_directories(
|
||||||
${gtest_SOURCE_DIR}/include
|
"${gtest_SOURCE_DIR}/include"
|
||||||
${gtest_SOURCE_DIR})
|
"${gtest_SOURCE_DIR}")
|
||||||
|
|
||||||
# Summary of tuple support for Microsoft Visual Studio:
|
# Summary of tuple support for Microsoft Visual Studio:
|
||||||
# Compiler version(MS) version(cmake) Support
|
# Compiler version(MS) version(cmake) Support
|
||||||
|
@ -88,7 +88,7 @@ include_directories(
|
||||||
if (MSVC AND MSVC_VERSION EQUAL 1700)
|
if (MSVC AND MSVC_VERSION EQUAL 1700)
|
||||||
add_definitions(/D _VARIADIC_MAX=10)
|
add_definitions(/D _VARIADIC_MAX=10)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
#
|
#
|
||||||
# Defines the gtest & gtest_main libraries. User tests should link
|
# Defines the gtest & gtest_main libraries. User tests should link
|
||||||
|
@ -105,8 +105,8 @@ target_link_libraries(gtest_main gtest)
|
||||||
# to the targets for when we are part of a parent build (ie being pulled
|
# 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).
|
# in via add_subdirectory() rather than being a standalone build).
|
||||||
if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
|
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 SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include")
|
||||||
target_include_directories(gtest_main INTERFACE "${gtest_SOURCE_DIR}/include")
|
target_include_directories(gtest_main SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -114,11 +114,11 @@ endif()
|
||||||
# Install rules
|
# Install rules
|
||||||
if(INSTALL_GTEST)
|
if(INSTALL_GTEST)
|
||||||
install(TARGETS gtest gtest_main
|
install(TARGETS gtest gtest_main
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
install(DIRECTORY ${gtest_SOURCE_DIR}/include/gtest
|
install(DIRECTORY "${gtest_SOURCE_DIR}/include/gtest"
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
|
||||||
# configure and install pkgconfig files
|
# configure and install pkgconfig files
|
||||||
configure_file(
|
configure_file(
|
||||||
|
|
|
@ -34,6 +34,7 @@ EXTRA_DIST += $(GTEST_SRC)
|
||||||
# Sample files that we don't compile.
|
# Sample files that we don't compile.
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
samples/prime_tables.h \
|
samples/prime_tables.h \
|
||||||
|
samples/sample1_unittest.cc \
|
||||||
samples/sample2_unittest.cc \
|
samples/sample2_unittest.cc \
|
||||||
samples/sample3_unittest.cc \
|
samples/sample3_unittest.cc \
|
||||||
samples/sample4_unittest.cc \
|
samples/sample4_unittest.cc \
|
||||||
|
@ -120,16 +121,16 @@ EXTRA_DIST += \
|
||||||
|
|
||||||
# MSVC project files
|
# MSVC project files
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
msvc/gtest-md.sln \
|
msvc/2010/gtest-md.sln \
|
||||||
msvc/gtest-md.vcproj \
|
msvc/2010/gtest-md.vcxproj \
|
||||||
msvc/gtest.sln \
|
msvc/2010/gtest.sln \
|
||||||
msvc/gtest.vcproj \
|
msvc/2010/gtest.vcxproj \
|
||||||
msvc/gtest_main-md.vcproj \
|
msvc/2010/gtest_main-md.vcxproj \
|
||||||
msvc/gtest_main.vcproj \
|
msvc/2010/gtest_main.vcxproj \
|
||||||
msvc/gtest_prod_test-md.vcproj \
|
msvc/2010/gtest_prod_test-md.vcxproj \
|
||||||
msvc/gtest_prod_test.vcproj \
|
msvc/2010/gtest_prod_test.vcxproj \
|
||||||
msvc/gtest_unittest-md.vcproj \
|
msvc/2010/gtest_unittest-md.vcxproj \
|
||||||
msvc/gtest_unittest.vcproj
|
msvc/2010/gtest_unittest.vcxproj
|
||||||
|
|
||||||
# xcode project files
|
# xcode project files
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
|
@ -223,33 +224,61 @@ lib_libgtest_main_la_LIBADD = lib/libgtest.la
|
||||||
# TESTS -- Programs run automatically by "make check"
|
# TESTS -- Programs run automatically by "make check"
|
||||||
# check_PROGRAMS -- Programs built by "make check" but not necessarily run
|
# check_PROGRAMS -- Programs built by "make check" but not necessarily run
|
||||||
|
|
||||||
noinst_LTLIBRARIES = samples/libsamples.la
|
|
||||||
|
|
||||||
samples_libsamples_la_SOURCES = \
|
|
||||||
samples/sample1.cc \
|
|
||||||
samples/sample1.h \
|
|
||||||
samples/sample2.cc \
|
|
||||||
samples/sample2.h \
|
|
||||||
samples/sample3-inl.h \
|
|
||||||
samples/sample4.cc \
|
|
||||||
samples/sample4.h
|
|
||||||
|
|
||||||
TESTS=
|
TESTS=
|
||||||
TESTS_ENVIRONMENT = GTEST_SOURCE_DIR="$(srcdir)/test" \
|
TESTS_ENVIRONMENT = GTEST_SOURCE_DIR="$(srcdir)/test" \
|
||||||
GTEST_BUILD_DIR="$(top_builddir)/test"
|
GTEST_BUILD_DIR="$(top_builddir)/test"
|
||||||
check_PROGRAMS=
|
check_PROGRAMS=
|
||||||
|
|
||||||
# A simple sample on using gtest.
|
# A simple sample on using gtest.
|
||||||
TESTS += samples/sample1_unittest
|
TESTS += samples/sample1_unittest \
|
||||||
check_PROGRAMS += samples/sample1_unittest
|
samples/sample2_unittest \
|
||||||
samples_sample1_unittest_SOURCES = samples/sample1_unittest.cc
|
samples/sample3_unittest \
|
||||||
samples_sample1_unittest_LDADD = lib/libgtest_main.la \
|
samples/sample4_unittest \
|
||||||
lib/libgtest.la \
|
samples/sample5_unittest \
|
||||||
samples/libsamples.la
|
samples/sample6_unittest \
|
||||||
|
samples/sample7_unittest \
|
||||||
|
samples/sample8_unittest \
|
||||||
|
samples/sample9_unittest \
|
||||||
|
samples/sample10_unittest
|
||||||
|
check_PROGRAMS += samples/sample1_unittest \
|
||||||
|
samples/sample2_unittest \
|
||||||
|
samples/sample3_unittest \
|
||||||
|
samples/sample4_unittest \
|
||||||
|
samples/sample5_unittest \
|
||||||
|
samples/sample6_unittest \
|
||||||
|
samples/sample7_unittest \
|
||||||
|
samples/sample8_unittest \
|
||||||
|
samples/sample9_unittest \
|
||||||
|
samples/sample10_unittest
|
||||||
|
|
||||||
# Another sample. It also verifies that libgtest works.
|
samples_sample1_unittest_SOURCES = samples/sample1_unittest.cc samples/sample1.cc
|
||||||
TESTS += samples/sample10_unittest
|
samples_sample1_unittest_LDADD = lib/libgtest_main.la \
|
||||||
check_PROGRAMS += samples/sample10_unittest
|
lib/libgtest.la
|
||||||
|
samples_sample2_unittest_SOURCES = samples/sample2_unittest.cc samples/sample2.cc
|
||||||
|
samples_sample2_unittest_LDADD = lib/libgtest_main.la \
|
||||||
|
lib/libgtest.la
|
||||||
|
samples_sample3_unittest_SOURCES = samples/sample3_unittest.cc
|
||||||
|
samples_sample3_unittest_LDADD = lib/libgtest_main.la \
|
||||||
|
lib/libgtest.la
|
||||||
|
samples_sample4_unittest_SOURCES = samples/sample4_unittest.cc samples/sample4.cc
|
||||||
|
samples_sample4_unittest_LDADD = lib/libgtest_main.la \
|
||||||
|
lib/libgtest.la
|
||||||
|
samples_sample5_unittest_SOURCES = samples/sample5_unittest.cc samples/sample1.cc
|
||||||
|
samples_sample5_unittest_LDADD = lib/libgtest_main.la \
|
||||||
|
lib/libgtest.la
|
||||||
|
samples_sample6_unittest_SOURCES = samples/sample6_unittest.cc
|
||||||
|
samples_sample6_unittest_LDADD = lib/libgtest_main.la \
|
||||||
|
lib/libgtest.la
|
||||||
|
samples_sample7_unittest_SOURCES = samples/sample7_unittest.cc
|
||||||
|
samples_sample7_unittest_LDADD = lib/libgtest_main.la \
|
||||||
|
lib/libgtest.la
|
||||||
|
samples_sample8_unittest_SOURCES = samples/sample8_unittest.cc
|
||||||
|
samples_sample8_unittest_LDADD = lib/libgtest_main.la \
|
||||||
|
lib/libgtest.la
|
||||||
|
|
||||||
|
# Also verify that libgtest works by itself.
|
||||||
|
samples_sample9_unittest_SOURCES = samples/sample9_unittest.cc
|
||||||
|
samples_sample9_unittest_LDADD = lib/libgtest.la
|
||||||
samples_sample10_unittest_SOURCES = samples/sample10_unittest.cc
|
samples_sample10_unittest_SOURCES = samples/sample10_unittest.cc
|
||||||
samples_sample10_unittest_LDADD = lib/libgtest.la
|
samples_sample10_unittest_LDADD = lib/libgtest.la
|
||||||
|
|
||||||
|
|
|
@ -358,38 +358,3 @@ instead of
|
||||||
TEST(SomeTest, DoesThis) { ... }
|
TEST(SomeTest, DoesThis) { ... }
|
||||||
|
|
||||||
in order to define a test.
|
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.
|
|
||||||
|
|
|
@ -1,130 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
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](https://github.com/google/styleguide) project. All patches will be expected
|
|
||||||
to conform to the style outlined [here](https://google.github.io/styleguide/cppguide.html).
|
|
||||||
|
|
||||||
## 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.
|
|
||||||
|
|
||||||
If you are a Googler, it is preferable to first create an internal change and
|
|
||||||
have it reviewed and submitted, and then create an upstreaming pull
|
|
||||||
request here.
|
|
||||||
|
|
||||||
## 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/).
|
|
|
@ -12,5 +12,5 @@ the respective git branch/tag).**
|
||||||
|
|
||||||
To contribute code to Google Test, read:
|
To contribute code to Google Test, read:
|
||||||
|
|
||||||
* [DevGuide](DevGuide.md) -- read this _before_ writing your first patch.
|
* [CONTRIBUTING](../CONTRIBUTING.md) -- read this _before_ writing your first patch.
|
||||||
* [PumpManual](PumpManual.md) -- how we generate some of Google Test's source files.
|
* [PumpManual](PumpManual.md) -- how we generate some of Google Test's source files.
|
||||||
|
|
|
@ -102,7 +102,7 @@ GTEST_API_ bool InDeathTestChild();
|
||||||
// On POSIX-compliant systems (*nix), we use the <regex.h> library,
|
// On POSIX-compliant systems (*nix), we use the <regex.h> library,
|
||||||
// which uses the POSIX extended regex syntax.
|
// which uses the POSIX extended regex syntax.
|
||||||
//
|
//
|
||||||
// On other platforms (e.g. Windows), we only support a simple regex
|
// On other platforms (e.g. Windows or Mac), we only support a simple regex
|
||||||
// syntax implemented as part of Google Test. This limited
|
// syntax implemented as part of Google Test. This limited
|
||||||
// implementation should be enough most of the time when writing
|
// implementation should be enough most of the time when writing
|
||||||
// death tests; though it lacks many features you can find in PCRE
|
// death tests; though it lacks many features you can find in PCRE
|
||||||
|
@ -272,6 +272,54 @@ class GTEST_API_ KilledBySignal {
|
||||||
# endif // NDEBUG for EXPECT_DEBUG_DEATH
|
# endif // NDEBUG for EXPECT_DEBUG_DEATH
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
|
// This macro is used for implementing macros such as
|
||||||
|
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
|
||||||
|
// death tests are not supported. Those macros must compile on such systems
|
||||||
|
// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
|
||||||
|
// systems that support death tests. This allows one to write such a macro
|
||||||
|
// on a system that does not support death tests and be sure that it will
|
||||||
|
// compile on a death-test supporting system. It is exposed publicly so that
|
||||||
|
// systems that have death-tests with stricter requirements than
|
||||||
|
// GTEST_HAS_DEATH_TEST can write their own equivalent of
|
||||||
|
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED.
|
||||||
|
//
|
||||||
|
// Parameters:
|
||||||
|
// statement - A statement that a macro such as EXPECT_DEATH would test
|
||||||
|
// for program termination. This macro has to make sure this
|
||||||
|
// statement is compiled but not executed, to ensure that
|
||||||
|
// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
|
||||||
|
// parameter iff EXPECT_DEATH compiles with it.
|
||||||
|
// regex - A regex that a macro such as EXPECT_DEATH would use to test
|
||||||
|
// the output of statement. This parameter has to be
|
||||||
|
// compiled but not evaluated by this macro, to ensure that
|
||||||
|
// this macro only accepts expressions that a macro such as
|
||||||
|
// EXPECT_DEATH would accept.
|
||||||
|
// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
|
||||||
|
// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
|
||||||
|
// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
|
||||||
|
// compile inside functions where ASSERT_DEATH doesn't
|
||||||
|
// compile.
|
||||||
|
//
|
||||||
|
// The branch that has an always false condition is used to ensure that
|
||||||
|
// statement and regex are compiled (and thus syntactically correct) but
|
||||||
|
// never executed. The unreachable code macro protects the terminator
|
||||||
|
// statement from generating an 'unreachable code' warning in case
|
||||||
|
// statement unconditionally returns or throws. The Message constructor at
|
||||||
|
// the end allows the syntax of streaming additional messages into the
|
||||||
|
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
|
||||||
|
# define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
|
||||||
|
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||||
|
if (::testing::internal::AlwaysTrue()) { \
|
||||||
|
GTEST_LOG_(WARNING) \
|
||||||
|
<< "Death tests are not supported on this platform.\n" \
|
||||||
|
<< "Statement '" #statement "' cannot be verified."; \
|
||||||
|
} else if (::testing::internal::AlwaysFalse()) { \
|
||||||
|
::testing::internal::RE::PartialMatch(".*", (regex)); \
|
||||||
|
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
||||||
|
terminator; \
|
||||||
|
} else \
|
||||||
|
::testing::Message()
|
||||||
|
|
||||||
// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
|
// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
|
||||||
// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
|
// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
|
||||||
// death tests are supported; otherwise they just issue a warning. This is
|
// death tests are supported; otherwise they just issue a warning. This is
|
||||||
|
@ -284,9 +332,9 @@ class GTEST_API_ KilledBySignal {
|
||||||
ASSERT_DEATH(statement, regex)
|
ASSERT_DEATH(statement, regex)
|
||||||
#else
|
#else
|
||||||
# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||||
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
|
GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, )
|
||||||
# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||||
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
|
GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
|
@ -196,7 +196,6 @@ class GTEST_API_ Message {
|
||||||
std::string GetString() const;
|
std::string GetString() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
#if GTEST_OS_SYMBIAN
|
#if GTEST_OS_SYMBIAN
|
||||||
// These are needed as the Nokia Symbian Compiler cannot decide between
|
// These are needed as the Nokia Symbian Compiler cannot decide between
|
||||||
// const T& and const T* in a function template. The Nokia compiler _can_
|
// const T& and const T* in a function template. The Nokia compiler _can_
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
//
|
//
|
||||||
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
|
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
|
#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
|
||||||
#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
|
#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ TEST_P(FooTest, HasBlahBlah) {
|
||||||
// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
|
// 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
|
// case with any set of parameters you want. Google Test defines a number
|
||||||
// of functions for generating test parameters. They return what we call
|
// of functions for generating test parameters. They return what we call
|
||||||
// (surprise!) parameter generators. Here is a summary of them, which
|
// (surprise!) parameter generators. Here is a summary of them, which
|
||||||
// are all in the testing namespace:
|
// are all in the testing namespace:
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -185,15 +186,10 @@ TEST_P(DerivedTest, DoesBlah) {
|
||||||
# include <utility>
|
# include <utility>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// scripts/fuse_gtest.py depends on gtest's own header being #included
|
|
||||||
// *unconditionally*. Therefore these #includes cannot be moved
|
|
||||||
// inside #if GTEST_HAS_PARAM_TEST.
|
|
||||||
#include "gtest/internal/gtest-internal.h"
|
#include "gtest/internal/gtest-internal.h"
|
||||||
#include "gtest/internal/gtest-param-util.h"
|
#include "gtest/internal/gtest-param-util.h"
|
||||||
#include "gtest/internal/gtest-param-util-generated.h"
|
#include "gtest/internal/gtest-param-util-generated.h"
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
// Functions producing parameter generators.
|
// Functions producing parameter generators.
|
||||||
|
@ -273,7 +269,7 @@ internal::ParamGenerator<T> Range(T start, T end) {
|
||||||
// each with C-string values of "foo", "bar", and "baz":
|
// each with C-string values of "foo", "bar", and "baz":
|
||||||
//
|
//
|
||||||
// const char* strings[] = {"foo", "bar", "baz"};
|
// const char* strings[] = {"foo", "bar", "baz"};
|
||||||
// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
|
// INSTANTIATE_TEST_CASE_P(StringSequence, StringTest, ValuesIn(strings));
|
||||||
//
|
//
|
||||||
// This instantiates tests from test case StlStringTest
|
// This instantiates tests from test case StlStringTest
|
||||||
// each with STL strings with values "a" and "b":
|
// each with STL strings with values "a" and "b":
|
||||||
|
@ -1412,33 +1408,33 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
|
||||||
// type testing::TestParamInfo<class ParamType>, and return std::string.
|
// type testing::TestParamInfo<class ParamType>, and return std::string.
|
||||||
//
|
//
|
||||||
// testing::PrintToStringParamName is a builtin test suffix generator that
|
// testing::PrintToStringParamName is a builtin test suffix generator that
|
||||||
// returns the value of testing::PrintToString(GetParam()). It does not work
|
// returns the value of testing::PrintToString(GetParam()).
|
||||||
// for std::string or C strings.
|
|
||||||
//
|
//
|
||||||
// Note: test names must be non-empty, unique, and may only contain ASCII
|
// Note: test names must be non-empty, unique, and may only contain ASCII
|
||||||
// alphanumeric characters or underscore.
|
// 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, ...) \
|
#define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
|
||||||
::testing::internal::ParamGenerator<test_case_name::ParamType> \
|
static ::testing::internal::ParamGenerator<test_case_name::ParamType> \
|
||||||
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
|
gtest_##prefix##test_case_name##_EvalGenerator_() { \
|
||||||
::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
|
return generator; \
|
||||||
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
|
} \
|
||||||
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
|
static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
|
||||||
(__VA_ARGS__)(info); \
|
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
|
||||||
} \
|
return ::testing::internal::GetParamNameGen<test_case_name::ParamType>( \
|
||||||
int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
|
__VA_ARGS__)(info); \
|
||||||
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
|
} \
|
||||||
GetTestCasePatternHolder<test_case_name>(\
|
static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
|
||||||
#test_case_name, \
|
::testing::UnitTest::GetInstance() \
|
||||||
::testing::internal::CodeLocation(\
|
->parameterized_test_registry() \
|
||||||
__FILE__, __LINE__))->AddTestCaseInstantiation(\
|
.GetTestCasePatternHolder<test_case_name>( \
|
||||||
#prefix, \
|
#test_case_name, \
|
||||||
>est_##prefix##test_case_name##_EvalGenerator_, \
|
::testing::internal::CodeLocation(__FILE__, __LINE__)) \
|
||||||
>est_##prefix##test_case_name##_EvalGenerateName_, \
|
->AddTestCaseInstantiation( \
|
||||||
__FILE__, __LINE__)
|
#prefix, >est_##prefix##test_case_name##_EvalGenerator_, \
|
||||||
|
>est_##prefix##test_case_name##_EvalGenerateName_, __FILE__, \
|
||||||
|
__LINE__)
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
|
#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
|
||||||
|
|
|
@ -78,7 +78,7 @@ TEST_P(FooTest, HasBlahBlah) {
|
||||||
// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
|
// 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
|
// case with any set of parameters you want. Google Test defines a number
|
||||||
// of functions for generating test parameters. They return what we call
|
// of functions for generating test parameters. They return what we call
|
||||||
// (surprise!) parameter generators. Here is a summary of them, which
|
// (surprise!) parameter generators. Here is a summary of them, which
|
||||||
// are all in the testing namespace:
|
// are all in the testing namespace:
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -184,15 +184,10 @@ TEST_P(DerivedTest, DoesBlah) {
|
||||||
# include <utility>
|
# include <utility>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// scripts/fuse_gtest.py depends on gtest's own header being #included
|
|
||||||
// *unconditionally*. Therefore these #includes cannot be moved
|
|
||||||
// inside #if GTEST_HAS_PARAM_TEST.
|
|
||||||
#include "gtest/internal/gtest-internal.h"
|
#include "gtest/internal/gtest-internal.h"
|
||||||
#include "gtest/internal/gtest-param-util.h"
|
#include "gtest/internal/gtest-param-util.h"
|
||||||
#include "gtest/internal/gtest-param-util-generated.h"
|
#include "gtest/internal/gtest-param-util-generated.h"
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
// Functions producing parameter generators.
|
// Functions producing parameter generators.
|
||||||
|
@ -272,7 +267,7 @@ internal::ParamGenerator<T> Range(T start, T end) {
|
||||||
// each with C-string values of "foo", "bar", and "baz":
|
// each with C-string values of "foo", "bar", and "baz":
|
||||||
//
|
//
|
||||||
// const char* strings[] = {"foo", "bar", "baz"};
|
// const char* strings[] = {"foo", "bar", "baz"};
|
||||||
// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
|
// INSTANTIATE_TEST_CASE_P(StringSequence, StringTest, ValuesIn(strings));
|
||||||
//
|
//
|
||||||
// This instantiates tests from test case StlStringTest
|
// This instantiates tests from test case StlStringTest
|
||||||
// each with STL strings with values "a" and "b":
|
// each with STL strings with values "a" and "b":
|
||||||
|
@ -485,14 +480,14 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
|
||||||
// to std::string and C strings, it won't work for these types.
|
// to std::string and C strings, it won't work for these types.
|
||||||
|
|
||||||
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
|
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
|
||||||
::testing::internal::ParamGenerator<test_case_name::ParamType> \
|
static ::testing::internal::ParamGenerator<test_case_name::ParamType> \
|
||||||
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
|
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
|
||||||
::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
|
static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
|
||||||
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
|
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
|
||||||
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
|
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
|
||||||
(__VA_ARGS__)(info); \
|
(__VA_ARGS__)(info); \
|
||||||
} \
|
} \
|
||||||
int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
|
static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
|
||||||
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
|
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
|
||||||
GetTestCasePatternHolder<test_case_name>(\
|
GetTestCasePatternHolder<test_case_name>(\
|
||||||
#test_case_name, \
|
#test_case_name, \
|
||||||
|
@ -505,6 +500,4 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
|
#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
|
||||||
|
|
|
@ -427,13 +427,8 @@ void DefaultPrintTo(WrapPrinterType<kPrintFunctionPointer> /* dummy */,
|
||||||
*os << "NULL";
|
*os << "NULL";
|
||||||
} else {
|
} else {
|
||||||
// T is a function type, so '*os << p' doesn't do what we want
|
// T is a function type, so '*os << p' doesn't do what we want
|
||||||
// (it just prints p as bool). We want to print p as a const
|
// (it just prints p as bool). Cast p to const void* to print it.
|
||||||
// void*. However, we cannot cast it to const void* directly,
|
*os << reinterpret_cast<const void*>(p);
|
||||||
// even using reinterpret_cast, as earlier versions of gcc
|
|
||||||
// (e.g. 3.4.5) cannot compile the cast when p is a function
|
|
||||||
// pointer. Casting to UInt64 first solves the problem.
|
|
||||||
*os << reinterpret_cast<const void*>(
|
|
||||||
reinterpret_cast<internal::UInt64>(p));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
|
||||||
} \
|
} \
|
||||||
static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) \
|
static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) \
|
||||||
GTEST_ATTRIBUTE_UNUSED_ = \
|
GTEST_ATTRIBUTE_UNUSED_ = \
|
||||||
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
|
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames( \
|
||||||
__FILE__, __LINE__, #__VA_ARGS__)
|
__FILE__, __LINE__, #__VA_ARGS__)
|
||||||
|
|
||||||
// The 'Types' template argument below must have spaces around it
|
// The 'Types' template argument below must have spaces around it
|
||||||
|
|
|
@ -259,7 +259,9 @@ class GTEST_API_ AssertionResult {
|
||||||
// Used in EXPECT_TRUE/FALSE(assertion_result).
|
// Used in EXPECT_TRUE/FALSE(assertion_result).
|
||||||
AssertionResult(const AssertionResult& other);
|
AssertionResult(const AssertionResult& other);
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER < 1910
|
||||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Used in the EXPECT_TRUE/FALSE(bool_expression).
|
// Used in the EXPECT_TRUE/FALSE(bool_expression).
|
||||||
//
|
//
|
||||||
|
@ -276,7 +278,9 @@ class GTEST_API_ AssertionResult {
|
||||||
/*enabler*/ = NULL)
|
/*enabler*/ = NULL)
|
||||||
: success_(success) {}
|
: success_(success) {}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER < 1910
|
||||||
GTEST_DISABLE_MSC_WARNINGS_POP_()
|
GTEST_DISABLE_MSC_WARNINGS_POP_()
|
||||||
|
#endif
|
||||||
|
|
||||||
// Assignment operator.
|
// Assignment operator.
|
||||||
AssertionResult& operator=(AssertionResult other) {
|
AssertionResult& operator=(AssertionResult other) {
|
||||||
|
@ -1180,14 +1184,12 @@ class GTEST_API_ UnitTest {
|
||||||
// Returns the random seed used at the start of the current test run.
|
// Returns the random seed used at the start of the current test run.
|
||||||
int random_seed() const;
|
int random_seed() const;
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
// Returns the ParameterizedTestCaseRegistry object used to keep track of
|
// Returns the ParameterizedTestCaseRegistry object used to keep track of
|
||||||
// value-parameterized tests and instantiate and register them.
|
// value-parameterized tests and instantiate and register them.
|
||||||
//
|
//
|
||||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||||
internal::ParameterizedTestCaseRegistry& parameterized_test_registry()
|
internal::ParameterizedTestCaseRegistry& parameterized_test_registry()
|
||||||
GTEST_LOCK_EXCLUDED_(mutex_);
|
GTEST_LOCK_EXCLUDED_(mutex_);
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
// Gets the number of successful test cases.
|
// Gets the number of successful test cases.
|
||||||
int successful_test_case_count() const;
|
int successful_test_case_count() const;
|
||||||
|
@ -1388,11 +1390,9 @@ AssertionResult CmpHelperEQ(const char* lhs_expression,
|
||||||
const char* rhs_expression,
|
const char* rhs_expression,
|
||||||
const T1& lhs,
|
const T1& lhs,
|
||||||
const T2& rhs) {
|
const T2& rhs) {
|
||||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4389 /* signed/unsigned mismatch */)
|
|
||||||
if (lhs == rhs) {
|
if (lhs == rhs) {
|
||||||
return AssertionSuccess();
|
return AssertionSuccess();
|
||||||
}
|
}
|
||||||
GTEST_DISABLE_MSC_WARNINGS_POP_()
|
|
||||||
|
|
||||||
return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);
|
return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);
|
||||||
}
|
}
|
||||||
|
@ -1706,7 +1706,6 @@ class GTEST_API_ AssertHelper {
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
// The pure interface class that all value-parameterized tests inherit from.
|
// The pure interface class that all value-parameterized tests inherit from.
|
||||||
// A value-parameterized class must inherit from both ::testing::Test and
|
// A value-parameterized class must inherit from both ::testing::Test and
|
||||||
// ::testing::WithParamInterface. In most cases that just means inheriting
|
// ::testing::WithParamInterface. In most cases that just means inheriting
|
||||||
|
@ -1783,7 +1782,6 @@ template <typename T>
|
||||||
class TestWithParam : public Test, public WithParamInterface<T> {
|
class TestWithParam : public Test, public WithParamInterface<T> {
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
// Macros for indicating success/failure in test code.
|
// Macros for indicating success/failure in test code.
|
||||||
|
|
||||||
|
@ -2112,9 +2110,14 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
||||||
// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
|
// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
|
||||||
// to appear in the same block - as long as they are on different
|
// to appear in the same block - as long as they are on different
|
||||||
// lines.
|
// lines.
|
||||||
|
//
|
||||||
|
// Assuming that each thread maintains its own stack of traces.
|
||||||
|
// Therefore, a SCOPED_TRACE() would (correctly) only affect the
|
||||||
|
// assertions in its own thread.
|
||||||
#define SCOPED_TRACE(message) \
|
#define SCOPED_TRACE(message) \
|
||||||
::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
|
::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
|
||||||
__FILE__, __LINE__, ::testing::Message() << (message))
|
__FILE__, __LINE__, (message))
|
||||||
|
|
||||||
|
|
||||||
// Compile-time assertion for type equality.
|
// Compile-time assertion for type equality.
|
||||||
// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
|
// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
|
||||||
|
|
|
@ -61,6 +61,9 @@
|
||||||
// GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
|
// GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
|
||||||
// GTEST_LOCK_EXCLUDED_(locks)
|
// GTEST_LOCK_EXCLUDED_(locks)
|
||||||
//
|
//
|
||||||
|
// Underlying library support features:
|
||||||
|
// GTEST_HAS_CXXABI_H_
|
||||||
|
//
|
||||||
// Exporting API symbols:
|
// Exporting API symbols:
|
||||||
// GTEST_API_ - Specifier for exported symbols.
|
// GTEST_API_ - Specifier for exported symbols.
|
||||||
//
|
//
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
// GTEST_CUSTOM_TEMPDIR_FUNCTION_ - An override for testing::TempDir().
|
// GTEST_CUSTOM_TEMPDIR_FUNCTION_ - An override for testing::TempDir().
|
||||||
// See testing::TempDir for semantics and
|
// See testing::TempDir for semantics and
|
||||||
// signature.
|
// signature.
|
||||||
//
|
//
|
||||||
// ** Custom implementation starts here **
|
// ** Custom implementation starts here **
|
||||||
|
|
||||||
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
|
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
|
|
||||||
//
|
//
|
||||||
// The Google C++ Testing Framework (Google Test)
|
// The Google C++ Testing Framework (Google Test)
|
||||||
//
|
//
|
||||||
|
@ -264,53 +263,6 @@ class InternalRunDeathTestFlag {
|
||||||
// the flag is specified; otherwise returns NULL.
|
// the flag is specified; otherwise returns NULL.
|
||||||
InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
|
InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
|
||||||
|
|
||||||
#else // GTEST_HAS_DEATH_TEST
|
|
||||||
|
|
||||||
// This macro is used for implementing macros such as
|
|
||||||
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
|
|
||||||
// death tests are not supported. Those macros must compile on such systems
|
|
||||||
// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
|
|
||||||
// systems that support death tests. This allows one to write such a macro
|
|
||||||
// on a system that does not support death tests and be sure that it will
|
|
||||||
// compile on a death-test supporting system.
|
|
||||||
//
|
|
||||||
// Parameters:
|
|
||||||
// statement - A statement that a macro such as EXPECT_DEATH would test
|
|
||||||
// for program termination. This macro has to make sure this
|
|
||||||
// statement is compiled but not executed, to ensure that
|
|
||||||
// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
|
|
||||||
// parameter iff EXPECT_DEATH compiles with it.
|
|
||||||
// regex - A regex that a macro such as EXPECT_DEATH would use to test
|
|
||||||
// the output of statement. This parameter has to be
|
|
||||||
// compiled but not evaluated by this macro, to ensure that
|
|
||||||
// this macro only accepts expressions that a macro such as
|
|
||||||
// EXPECT_DEATH would accept.
|
|
||||||
// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
|
|
||||||
// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
|
|
||||||
// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
|
|
||||||
// compile inside functions where ASSERT_DEATH doesn't
|
|
||||||
// compile.
|
|
||||||
//
|
|
||||||
// The branch that has an always false condition is used to ensure that
|
|
||||||
// statement and regex are compiled (and thus syntactically correct) but
|
|
||||||
// never executed. The unreachable code macro protects the terminator
|
|
||||||
// statement from generating an 'unreachable code' warning in case
|
|
||||||
// statement unconditionally returns or throws. The Message constructor at
|
|
||||||
// the end allows the syntax of streaming additional messages into the
|
|
||||||
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
|
|
||||||
# define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
|
|
||||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
|
||||||
if (::testing::internal::AlwaysTrue()) { \
|
|
||||||
GTEST_LOG_(WARNING) \
|
|
||||||
<< "Death tests are not supported on this platform.\n" \
|
|
||||||
<< "Statement '" #statement "' cannot be verified."; \
|
|
||||||
} else if (::testing::internal::AlwaysFalse()) { \
|
|
||||||
::testing::internal::RE::PartialMatch(".*", (regex)); \
|
|
||||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
|
||||||
terminator; \
|
|
||||||
} else \
|
|
||||||
::testing::Message()
|
|
||||||
|
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
|
@ -27,14 +27,13 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Author: keith.ray@gmail.com (Keith Ray)
|
|
||||||
//
|
//
|
||||||
// Google Test filepath utilities
|
// Google Test filepath utilities
|
||||||
//
|
//
|
||||||
// This header file declares classes and functions used internally by
|
// This header file declares classes and functions used internally by
|
||||||
// Google Test. They are subject to change without notice.
|
// Google Test. They are subject to change without notice.
|
||||||
//
|
//
|
||||||
// This file is #included in <gtest/internal/gtest-internal.h>.
|
// This file is #included in gtest/internal/gtest-internal.h.
|
||||||
// Do not include this header file separately!
|
// Do not include this header file separately!
|
||||||
|
|
||||||
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
|
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
|
|
||||||
//
|
//
|
||||||
// The Google C++ Testing Framework (Google Test)
|
// The Google C++ Testing Framework (Google Test)
|
||||||
//
|
//
|
||||||
|
@ -61,8 +60,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "gtest/gtest-message.h"
|
#include "gtest/gtest-message.h"
|
||||||
#include "gtest/internal/gtest-string.h"
|
|
||||||
#include "gtest/internal/gtest-filepath.h"
|
#include "gtest/internal/gtest-filepath.h"
|
||||||
|
#include "gtest/internal/gtest-string.h"
|
||||||
#include "gtest/internal/gtest-type-util.h"
|
#include "gtest/internal/gtest-type-util.h"
|
||||||
|
|
||||||
// Due to C++ preprocessor weirdness, we need double indirection to
|
// Due to C++ preprocessor weirdness, we need double indirection to
|
||||||
|
@ -157,7 +156,28 @@ class GTEST_API_ ScopedTrace {
|
||||||
public:
|
public:
|
||||||
// The c'tor pushes the given source file location and message onto
|
// The c'tor pushes the given source file location and message onto
|
||||||
// a trace stack maintained by Google Test.
|
// a trace stack maintained by Google Test.
|
||||||
ScopedTrace(const char* file, int line, const Message& message);
|
|
||||||
|
// Template version. Uses Message() to convert the values into strings.
|
||||||
|
// Slow, but flexible.
|
||||||
|
template <typename T>
|
||||||
|
ScopedTrace(const char* file, int line, const T& message) {
|
||||||
|
PushTrace(file, line, (Message() << message).GetString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optimize for some known types.
|
||||||
|
ScopedTrace(const char* file, int line, const char* message) {
|
||||||
|
PushTrace(file, line, message ? message : "(null)");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if GTEST_HAS_GLOBAL_STRING
|
||||||
|
ScopedTrace(const char* file, int line, const ::string& message) {
|
||||||
|
PushTrace(file, line, message);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ScopedTrace(const char* file, int line, const std::string& message) {
|
||||||
|
PushTrace(file, line, message);
|
||||||
|
}
|
||||||
|
|
||||||
// The d'tor pops the info pushed by the c'tor.
|
// The d'tor pops the info pushed by the c'tor.
|
||||||
//
|
//
|
||||||
|
@ -166,6 +186,8 @@ class GTEST_API_ ScopedTrace {
|
||||||
~ScopedTrace();
|
~ScopedTrace();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void PushTrace(const char* file, int line, std::string message);
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
|
||||||
} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
|
} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
|
||||||
// c'tor and d'tor. Therefore it doesn't
|
// c'tor and d'tor. Therefore it doesn't
|
||||||
|
|
|
@ -46,14 +46,9 @@
|
||||||
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
|
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
|
||||||
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
|
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
|
||||||
|
|
||||||
// scripts/fuse_gtest.py depends on gtest's own header being #included
|
|
||||||
// *unconditionally*. Therefore these #includes cannot be moved
|
|
||||||
// inside #if GTEST_HAS_PARAM_TEST.
|
|
||||||
#include "gtest/internal/gtest-param-util.h"
|
#include "gtest/internal/gtest-param-util.h"
|
||||||
#include "gtest/internal/gtest-port.h"
|
#include "gtest/internal/gtest-port.h"
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
// Forward declarations of ValuesIn(), which is implemented in
|
// Forward declarations of ValuesIn(), which is implemented in
|
||||||
|
@ -3208,7 +3203,7 @@ class CartesianProductGenerator2
|
||||||
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
||||||
return new Iterator(*this);
|
return new Iterator(*this);
|
||||||
}
|
}
|
||||||
virtual const ParamType* Current() const { return ¤t_value_; }
|
virtual const ParamType* Current() const { return current_value_.get(); }
|
||||||
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
||||||
// Having the same base generator guarantees that the other
|
// Having the same base generator guarantees that the other
|
||||||
// iterator is of the same type and we can downcast.
|
// iterator is of the same type and we can downcast.
|
||||||
|
@ -3240,7 +3235,7 @@ class CartesianProductGenerator2
|
||||||
|
|
||||||
void ComputeCurrentValue() {
|
void ComputeCurrentValue() {
|
||||||
if (!AtEnd())
|
if (!AtEnd())
|
||||||
current_value_ = ParamType(*current1_, *current2_);
|
current_value_.reset(new ParamType(*current1_, *current2_));
|
||||||
}
|
}
|
||||||
bool AtEnd() const {
|
bool AtEnd() const {
|
||||||
// We must report iterator past the end of the range when either of the
|
// We must report iterator past the end of the range when either of the
|
||||||
|
@ -3262,7 +3257,7 @@ class CartesianProductGenerator2
|
||||||
const typename ParamGenerator<T2>::iterator begin2_;
|
const typename ParamGenerator<T2>::iterator begin2_;
|
||||||
const typename ParamGenerator<T2>::iterator end2_;
|
const typename ParamGenerator<T2>::iterator end2_;
|
||||||
typename ParamGenerator<T2>::iterator current2_;
|
typename ParamGenerator<T2>::iterator current2_;
|
||||||
ParamType current_value_;
|
linked_ptr<ParamType> current_value_;
|
||||||
}; // class CartesianProductGenerator2::Iterator
|
}; // class CartesianProductGenerator2::Iterator
|
||||||
|
|
||||||
// No implementation - assignment is unsupported.
|
// No implementation - assignment is unsupported.
|
||||||
|
@ -3331,7 +3326,7 @@ class CartesianProductGenerator3
|
||||||
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
||||||
return new Iterator(*this);
|
return new Iterator(*this);
|
||||||
}
|
}
|
||||||
virtual const ParamType* Current() const { return ¤t_value_; }
|
virtual const ParamType* Current() const { return current_value_.get(); }
|
||||||
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
||||||
// Having the same base generator guarantees that the other
|
// Having the same base generator guarantees that the other
|
||||||
// iterator is of the same type and we can downcast.
|
// iterator is of the same type and we can downcast.
|
||||||
|
@ -3367,7 +3362,7 @@ class CartesianProductGenerator3
|
||||||
|
|
||||||
void ComputeCurrentValue() {
|
void ComputeCurrentValue() {
|
||||||
if (!AtEnd())
|
if (!AtEnd())
|
||||||
current_value_ = ParamType(*current1_, *current2_, *current3_);
|
current_value_.reset(new ParamType(*current1_, *current2_, *current3_));
|
||||||
}
|
}
|
||||||
bool AtEnd() const {
|
bool AtEnd() const {
|
||||||
// We must report iterator past the end of the range when either of the
|
// We must report iterator past the end of the range when either of the
|
||||||
|
@ -3393,7 +3388,7 @@ class CartesianProductGenerator3
|
||||||
const typename ParamGenerator<T3>::iterator begin3_;
|
const typename ParamGenerator<T3>::iterator begin3_;
|
||||||
const typename ParamGenerator<T3>::iterator end3_;
|
const typename ParamGenerator<T3>::iterator end3_;
|
||||||
typename ParamGenerator<T3>::iterator current3_;
|
typename ParamGenerator<T3>::iterator current3_;
|
||||||
ParamType current_value_;
|
linked_ptr<ParamType> current_value_;
|
||||||
}; // class CartesianProductGenerator3::Iterator
|
}; // class CartesianProductGenerator3::Iterator
|
||||||
|
|
||||||
// No implementation - assignment is unsupported.
|
// No implementation - assignment is unsupported.
|
||||||
|
@ -3472,7 +3467,7 @@ class CartesianProductGenerator4
|
||||||
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
||||||
return new Iterator(*this);
|
return new Iterator(*this);
|
||||||
}
|
}
|
||||||
virtual const ParamType* Current() const { return ¤t_value_; }
|
virtual const ParamType* Current() const { return current_value_.get(); }
|
||||||
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
||||||
// Having the same base generator guarantees that the other
|
// Having the same base generator guarantees that the other
|
||||||
// iterator is of the same type and we can downcast.
|
// iterator is of the same type and we can downcast.
|
||||||
|
@ -3512,8 +3507,8 @@ class CartesianProductGenerator4
|
||||||
|
|
||||||
void ComputeCurrentValue() {
|
void ComputeCurrentValue() {
|
||||||
if (!AtEnd())
|
if (!AtEnd())
|
||||||
current_value_ = ParamType(*current1_, *current2_, *current3_,
|
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
|
||||||
*current4_);
|
*current4_));
|
||||||
}
|
}
|
||||||
bool AtEnd() const {
|
bool AtEnd() const {
|
||||||
// We must report iterator past the end of the range when either of the
|
// We must report iterator past the end of the range when either of the
|
||||||
|
@ -3543,7 +3538,7 @@ class CartesianProductGenerator4
|
||||||
const typename ParamGenerator<T4>::iterator begin4_;
|
const typename ParamGenerator<T4>::iterator begin4_;
|
||||||
const typename ParamGenerator<T4>::iterator end4_;
|
const typename ParamGenerator<T4>::iterator end4_;
|
||||||
typename ParamGenerator<T4>::iterator current4_;
|
typename ParamGenerator<T4>::iterator current4_;
|
||||||
ParamType current_value_;
|
linked_ptr<ParamType> current_value_;
|
||||||
}; // class CartesianProductGenerator4::Iterator
|
}; // class CartesianProductGenerator4::Iterator
|
||||||
|
|
||||||
// No implementation - assignment is unsupported.
|
// No implementation - assignment is unsupported.
|
||||||
|
@ -3630,7 +3625,7 @@ class CartesianProductGenerator5
|
||||||
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
||||||
return new Iterator(*this);
|
return new Iterator(*this);
|
||||||
}
|
}
|
||||||
virtual const ParamType* Current() const { return ¤t_value_; }
|
virtual const ParamType* Current() const { return current_value_.get(); }
|
||||||
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
||||||
// Having the same base generator guarantees that the other
|
// Having the same base generator guarantees that the other
|
||||||
// iterator is of the same type and we can downcast.
|
// iterator is of the same type and we can downcast.
|
||||||
|
@ -3674,8 +3669,8 @@ class CartesianProductGenerator5
|
||||||
|
|
||||||
void ComputeCurrentValue() {
|
void ComputeCurrentValue() {
|
||||||
if (!AtEnd())
|
if (!AtEnd())
|
||||||
current_value_ = ParamType(*current1_, *current2_, *current3_,
|
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
|
||||||
*current4_, *current5_);
|
*current4_, *current5_));
|
||||||
}
|
}
|
||||||
bool AtEnd() const {
|
bool AtEnd() const {
|
||||||
// We must report iterator past the end of the range when either of the
|
// We must report iterator past the end of the range when either of the
|
||||||
|
@ -3709,7 +3704,7 @@ class CartesianProductGenerator5
|
||||||
const typename ParamGenerator<T5>::iterator begin5_;
|
const typename ParamGenerator<T5>::iterator begin5_;
|
||||||
const typename ParamGenerator<T5>::iterator end5_;
|
const typename ParamGenerator<T5>::iterator end5_;
|
||||||
typename ParamGenerator<T5>::iterator current5_;
|
typename ParamGenerator<T5>::iterator current5_;
|
||||||
ParamType current_value_;
|
linked_ptr<ParamType> current_value_;
|
||||||
}; // class CartesianProductGenerator5::Iterator
|
}; // class CartesianProductGenerator5::Iterator
|
||||||
|
|
||||||
// No implementation - assignment is unsupported.
|
// No implementation - assignment is unsupported.
|
||||||
|
@ -3807,7 +3802,7 @@ class CartesianProductGenerator6
|
||||||
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
||||||
return new Iterator(*this);
|
return new Iterator(*this);
|
||||||
}
|
}
|
||||||
virtual const ParamType* Current() const { return ¤t_value_; }
|
virtual const ParamType* Current() const { return current_value_.get(); }
|
||||||
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
||||||
// Having the same base generator guarantees that the other
|
// Having the same base generator guarantees that the other
|
||||||
// iterator is of the same type and we can downcast.
|
// iterator is of the same type and we can downcast.
|
||||||
|
@ -3855,8 +3850,8 @@ class CartesianProductGenerator6
|
||||||
|
|
||||||
void ComputeCurrentValue() {
|
void ComputeCurrentValue() {
|
||||||
if (!AtEnd())
|
if (!AtEnd())
|
||||||
current_value_ = ParamType(*current1_, *current2_, *current3_,
|
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
|
||||||
*current4_, *current5_, *current6_);
|
*current4_, *current5_, *current6_));
|
||||||
}
|
}
|
||||||
bool AtEnd() const {
|
bool AtEnd() const {
|
||||||
// We must report iterator past the end of the range when either of the
|
// We must report iterator past the end of the range when either of the
|
||||||
|
@ -3894,7 +3889,7 @@ class CartesianProductGenerator6
|
||||||
const typename ParamGenerator<T6>::iterator begin6_;
|
const typename ParamGenerator<T6>::iterator begin6_;
|
||||||
const typename ParamGenerator<T6>::iterator end6_;
|
const typename ParamGenerator<T6>::iterator end6_;
|
||||||
typename ParamGenerator<T6>::iterator current6_;
|
typename ParamGenerator<T6>::iterator current6_;
|
||||||
ParamType current_value_;
|
linked_ptr<ParamType> current_value_;
|
||||||
}; // class CartesianProductGenerator6::Iterator
|
}; // class CartesianProductGenerator6::Iterator
|
||||||
|
|
||||||
// No implementation - assignment is unsupported.
|
// No implementation - assignment is unsupported.
|
||||||
|
@ -4001,7 +3996,7 @@ class CartesianProductGenerator7
|
||||||
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
||||||
return new Iterator(*this);
|
return new Iterator(*this);
|
||||||
}
|
}
|
||||||
virtual const ParamType* Current() const { return ¤t_value_; }
|
virtual const ParamType* Current() const { return current_value_.get(); }
|
||||||
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
||||||
// Having the same base generator guarantees that the other
|
// Having the same base generator guarantees that the other
|
||||||
// iterator is of the same type and we can downcast.
|
// iterator is of the same type and we can downcast.
|
||||||
|
@ -4053,8 +4048,8 @@ class CartesianProductGenerator7
|
||||||
|
|
||||||
void ComputeCurrentValue() {
|
void ComputeCurrentValue() {
|
||||||
if (!AtEnd())
|
if (!AtEnd())
|
||||||
current_value_ = ParamType(*current1_, *current2_, *current3_,
|
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
|
||||||
*current4_, *current5_, *current6_, *current7_);
|
*current4_, *current5_, *current6_, *current7_));
|
||||||
}
|
}
|
||||||
bool AtEnd() const {
|
bool AtEnd() const {
|
||||||
// We must report iterator past the end of the range when either of the
|
// We must report iterator past the end of the range when either of the
|
||||||
|
@ -4096,7 +4091,7 @@ class CartesianProductGenerator7
|
||||||
const typename ParamGenerator<T7>::iterator begin7_;
|
const typename ParamGenerator<T7>::iterator begin7_;
|
||||||
const typename ParamGenerator<T7>::iterator end7_;
|
const typename ParamGenerator<T7>::iterator end7_;
|
||||||
typename ParamGenerator<T7>::iterator current7_;
|
typename ParamGenerator<T7>::iterator current7_;
|
||||||
ParamType current_value_;
|
linked_ptr<ParamType> current_value_;
|
||||||
}; // class CartesianProductGenerator7::Iterator
|
}; // class CartesianProductGenerator7::Iterator
|
||||||
|
|
||||||
// No implementation - assignment is unsupported.
|
// No implementation - assignment is unsupported.
|
||||||
|
@ -4214,7 +4209,7 @@ class CartesianProductGenerator8
|
||||||
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
||||||
return new Iterator(*this);
|
return new Iterator(*this);
|
||||||
}
|
}
|
||||||
virtual const ParamType* Current() const { return ¤t_value_; }
|
virtual const ParamType* Current() const { return current_value_.get(); }
|
||||||
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
||||||
// Having the same base generator guarantees that the other
|
// Having the same base generator guarantees that the other
|
||||||
// iterator is of the same type and we can downcast.
|
// iterator is of the same type and we can downcast.
|
||||||
|
@ -4270,8 +4265,8 @@ class CartesianProductGenerator8
|
||||||
|
|
||||||
void ComputeCurrentValue() {
|
void ComputeCurrentValue() {
|
||||||
if (!AtEnd())
|
if (!AtEnd())
|
||||||
current_value_ = ParamType(*current1_, *current2_, *current3_,
|
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
|
||||||
*current4_, *current5_, *current6_, *current7_, *current8_);
|
*current4_, *current5_, *current6_, *current7_, *current8_));
|
||||||
}
|
}
|
||||||
bool AtEnd() const {
|
bool AtEnd() const {
|
||||||
// We must report iterator past the end of the range when either of the
|
// We must report iterator past the end of the range when either of the
|
||||||
|
@ -4317,7 +4312,7 @@ class CartesianProductGenerator8
|
||||||
const typename ParamGenerator<T8>::iterator begin8_;
|
const typename ParamGenerator<T8>::iterator begin8_;
|
||||||
const typename ParamGenerator<T8>::iterator end8_;
|
const typename ParamGenerator<T8>::iterator end8_;
|
||||||
typename ParamGenerator<T8>::iterator current8_;
|
typename ParamGenerator<T8>::iterator current8_;
|
||||||
ParamType current_value_;
|
linked_ptr<ParamType> current_value_;
|
||||||
}; // class CartesianProductGenerator8::Iterator
|
}; // class CartesianProductGenerator8::Iterator
|
||||||
|
|
||||||
// No implementation - assignment is unsupported.
|
// No implementation - assignment is unsupported.
|
||||||
|
@ -4443,7 +4438,7 @@ class CartesianProductGenerator9
|
||||||
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
||||||
return new Iterator(*this);
|
return new Iterator(*this);
|
||||||
}
|
}
|
||||||
virtual const ParamType* Current() const { return ¤t_value_; }
|
virtual const ParamType* Current() const { return current_value_.get(); }
|
||||||
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
||||||
// Having the same base generator guarantees that the other
|
// Having the same base generator guarantees that the other
|
||||||
// iterator is of the same type and we can downcast.
|
// iterator is of the same type and we can downcast.
|
||||||
|
@ -4503,9 +4498,9 @@ class CartesianProductGenerator9
|
||||||
|
|
||||||
void ComputeCurrentValue() {
|
void ComputeCurrentValue() {
|
||||||
if (!AtEnd())
|
if (!AtEnd())
|
||||||
current_value_ = ParamType(*current1_, *current2_, *current3_,
|
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
|
||||||
*current4_, *current5_, *current6_, *current7_, *current8_,
|
*current4_, *current5_, *current6_, *current7_, *current8_,
|
||||||
*current9_);
|
*current9_));
|
||||||
}
|
}
|
||||||
bool AtEnd() const {
|
bool AtEnd() const {
|
||||||
// We must report iterator past the end of the range when either of the
|
// We must report iterator past the end of the range when either of the
|
||||||
|
@ -4555,7 +4550,7 @@ class CartesianProductGenerator9
|
||||||
const typename ParamGenerator<T9>::iterator begin9_;
|
const typename ParamGenerator<T9>::iterator begin9_;
|
||||||
const typename ParamGenerator<T9>::iterator end9_;
|
const typename ParamGenerator<T9>::iterator end9_;
|
||||||
typename ParamGenerator<T9>::iterator current9_;
|
typename ParamGenerator<T9>::iterator current9_;
|
||||||
ParamType current_value_;
|
linked_ptr<ParamType> current_value_;
|
||||||
}; // class CartesianProductGenerator9::Iterator
|
}; // class CartesianProductGenerator9::Iterator
|
||||||
|
|
||||||
// No implementation - assignment is unsupported.
|
// No implementation - assignment is unsupported.
|
||||||
|
@ -4690,7 +4685,7 @@ class CartesianProductGenerator10
|
||||||
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
||||||
return new Iterator(*this);
|
return new Iterator(*this);
|
||||||
}
|
}
|
||||||
virtual const ParamType* Current() const { return ¤t_value_; }
|
virtual const ParamType* Current() const { return current_value_.get(); }
|
||||||
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
||||||
// Having the same base generator guarantees that the other
|
// Having the same base generator guarantees that the other
|
||||||
// iterator is of the same type and we can downcast.
|
// iterator is of the same type and we can downcast.
|
||||||
|
@ -4754,9 +4749,9 @@ class CartesianProductGenerator10
|
||||||
|
|
||||||
void ComputeCurrentValue() {
|
void ComputeCurrentValue() {
|
||||||
if (!AtEnd())
|
if (!AtEnd())
|
||||||
current_value_ = ParamType(*current1_, *current2_, *current3_,
|
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
|
||||||
*current4_, *current5_, *current6_, *current7_, *current8_,
|
*current4_, *current5_, *current6_, *current7_, *current8_,
|
||||||
*current9_, *current10_);
|
*current9_, *current10_));
|
||||||
}
|
}
|
||||||
bool AtEnd() const {
|
bool AtEnd() const {
|
||||||
// We must report iterator past the end of the range when either of the
|
// We must report iterator past the end of the range when either of the
|
||||||
|
@ -4810,7 +4805,7 @@ class CartesianProductGenerator10
|
||||||
const typename ParamGenerator<T10>::iterator begin10_;
|
const typename ParamGenerator<T10>::iterator begin10_;
|
||||||
const typename ParamGenerator<T10>::iterator end10_;
|
const typename ParamGenerator<T10>::iterator end10_;
|
||||||
typename ParamGenerator<T10>::iterator current10_;
|
typename ParamGenerator<T10>::iterator current10_;
|
||||||
ParamType current_value_;
|
linked_ptr<ParamType> current_value_;
|
||||||
}; // class CartesianProductGenerator10::Iterator
|
}; // class CartesianProductGenerator10::Iterator
|
||||||
|
|
||||||
// No implementation - assignment is unsupported.
|
// No implementation - assignment is unsupported.
|
||||||
|
@ -5141,6 +5136,4 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
|
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
|
||||||
|
|
|
@ -45,14 +45,9 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
|
||||||
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
|
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
|
||||||
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
|
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
|
||||||
|
|
||||||
// scripts/fuse_gtest.py depends on gtest's own header being #included
|
|
||||||
// *unconditionally*. Therefore these #includes cannot be moved
|
|
||||||
// inside #if GTEST_HAS_PARAM_TEST.
|
|
||||||
#include "gtest/internal/gtest-param-util.h"
|
#include "gtest/internal/gtest-param-util.h"
|
||||||
#include "gtest/internal/gtest-port.h"
|
#include "gtest/internal/gtest-port.h"
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
// Forward declarations of ValuesIn(), which is implemented in
|
// Forward declarations of ValuesIn(), which is implemented in
|
||||||
|
@ -165,7 +160,7 @@ $for k [[
|
||||||
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
virtual ParamIteratorInterface<ParamType>* Clone() const {
|
||||||
return new Iterator(*this);
|
return new Iterator(*this);
|
||||||
}
|
}
|
||||||
virtual const ParamType* Current() const { return ¤t_value_; }
|
virtual const ParamType* Current() const { return current_value_.get(); }
|
||||||
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
|
||||||
// Having the same base generator guarantees that the other
|
// Having the same base generator guarantees that the other
|
||||||
// iterator is of the same type and we can downcast.
|
// iterator is of the same type and we can downcast.
|
||||||
|
@ -197,7 +192,7 @@ $for k [[
|
||||||
|
|
||||||
void ComputeCurrentValue() {
|
void ComputeCurrentValue() {
|
||||||
if (!AtEnd())
|
if (!AtEnd())
|
||||||
current_value_ = ParamType($for j, [[*current$(j)_]]);
|
current_value_.reset(new ParamType($for j, [[*current$(j)_]]));
|
||||||
}
|
}
|
||||||
bool AtEnd() const {
|
bool AtEnd() const {
|
||||||
// We must report iterator past the end of the range when either of the
|
// We must report iterator past the end of the range when either of the
|
||||||
|
@ -222,7 +217,7 @@ $for j [[
|
||||||
typename ParamGenerator<T$j>::iterator current$(j)_;
|
typename ParamGenerator<T$j>::iterator current$(j)_;
|
||||||
]]
|
]]
|
||||||
|
|
||||||
ParamType current_value_;
|
linked_ptr<ParamType> current_value_;
|
||||||
}; // class CartesianProductGenerator$i::Iterator
|
}; // class CartesianProductGenerator$i::Iterator
|
||||||
|
|
||||||
// No implementation - assignment is unsupported.
|
// No implementation - assignment is unsupported.
|
||||||
|
@ -281,6 +276,4 @@ $for j [[
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
|
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
|
||||||
|
|
|
@ -41,16 +41,11 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// scripts/fuse_gtest.py depends on gtest's own header being #included
|
|
||||||
// *unconditionally*. Therefore these #includes cannot be moved
|
|
||||||
// inside #if GTEST_HAS_PARAM_TEST.
|
|
||||||
#include "gtest/internal/gtest-internal.h"
|
#include "gtest/internal/gtest-internal.h"
|
||||||
#include "gtest/internal/gtest-linked_ptr.h"
|
#include "gtest/internal/gtest-linked_ptr.h"
|
||||||
#include "gtest/internal/gtest-port.h"
|
#include "gtest/internal/gtest-port.h"
|
||||||
#include "gtest/gtest-printers.h"
|
#include "gtest/gtest-printers.h"
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
// Input to a parameterized test name generator, describing a test parameter.
|
// Input to a parameterized test name generator, describing a test parameter.
|
||||||
|
@ -725,6 +720,4 @@ class ParameterizedTestCaseRegistry {
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
|
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
|
||||||
|
|
|
@ -171,7 +171,6 @@
|
||||||
// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
|
// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
|
||||||
// tests)
|
// tests)
|
||||||
// GTEST_HAS_DEATH_TEST - death tests
|
// GTEST_HAS_DEATH_TEST - death tests
|
||||||
// GTEST_HAS_PARAM_TEST - value-parameterized tests
|
|
||||||
// GTEST_HAS_TYPED_TEST - typed tests
|
// GTEST_HAS_TYPED_TEST - typed tests
|
||||||
// GTEST_HAS_TYPED_TEST_P - type-parameterized tests
|
// GTEST_HAS_TYPED_TEST_P - type-parameterized tests
|
||||||
// GTEST_IS_THREADSAFE - Google Test is thread-safe.
|
// GTEST_IS_THREADSAFE - Google Test is thread-safe.
|
||||||
|
@ -815,11 +814,6 @@ using ::std::tuple_size;
|
||||||
# define GTEST_HAS_DEATH_TEST 1
|
# define GTEST_HAS_DEATH_TEST 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// We don't support MSVC 7.1 with exceptions disabled now. Therefore
|
|
||||||
// all the compilers we care about are adequate for supporting
|
|
||||||
// value-parameterized tests.
|
|
||||||
#define GTEST_HAS_PARAM_TEST 1
|
|
||||||
|
|
||||||
// Determines whether to support type-driven tests.
|
// Determines whether to support type-driven tests.
|
||||||
|
|
||||||
// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
|
// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
|
||||||
|
@ -830,11 +824,10 @@ using ::std::tuple_size;
|
||||||
# define GTEST_HAS_TYPED_TEST_P 1
|
# define GTEST_HAS_TYPED_TEST_P 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Determines whether to support Combine(). This only makes sense when
|
// Determines whether to support Combine().
|
||||||
// value-parameterized tests are enabled. The implementation doesn't
|
// The implementation doesn't work on Sun Studio since it doesn't
|
||||||
// work on Sun Studio since it doesn't understand templated conversion
|
// understand templated conversion operators.
|
||||||
// operators.
|
#if (GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_) && !defined(__SUNPRO_CC)
|
||||||
#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
|
|
||||||
# define GTEST_HAS_COMBINE 1
|
# define GTEST_HAS_COMBINE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -886,7 +879,7 @@ using ::std::tuple_size;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Use this annotation before a function that takes a printf format string.
|
// Use this annotation before a function that takes a printf format string.
|
||||||
#if defined(__GNUC__) && !defined(COMPILER_ICC)
|
#if (defined(__GNUC__) || defined(__clang__)) && !defined(COMPILER_ICC)
|
||||||
# if defined(__MINGW_PRINTF_FORMAT)
|
# if defined(__MINGW_PRINTF_FORMAT)
|
||||||
// MinGW has two different printf implementations. Ensure the format macro
|
// MinGW has two different printf implementations. Ensure the format macro
|
||||||
// matches the selected implementation. See
|
// matches the selected implementation. See
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
|
|
||||||
//
|
//
|
||||||
// The Google C++ Testing Framework (Google Test)
|
// The Google C++ Testing Framework (Google Test)
|
||||||
//
|
//
|
||||||
|
@ -35,7 +34,8 @@
|
||||||
// Google Test. They are subject to change without notice. They should not used
|
// Google Test. They are subject to change without notice. They should not used
|
||||||
// by code external to Google Test.
|
// by code external to Google Test.
|
||||||
//
|
//
|
||||||
// This header file is #included by <gtest/internal/gtest-internal.h>.
|
// This header file is #included by
|
||||||
|
// gtest/internal/gtest-internal.h.
|
||||||
// It should not be #included by other files.
|
// It should not be #included by other files.
|
||||||
|
|
||||||
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
|
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
|
||||||
|
|
|
@ -103,11 +103,15 @@ class PreCalculatedPrimeTable : public PrimeTable {
|
||||||
::std::fill(is_prime_, is_prime_ + is_prime_size_, true);
|
::std::fill(is_prime_, is_prime_ + is_prime_size_, true);
|
||||||
is_prime_[0] = is_prime_[1] = false;
|
is_prime_[0] = is_prime_[1] = false;
|
||||||
|
|
||||||
for (int i = 2; i <= max; i++) {
|
// Checks every candidate for prime number (we know that 2 is the only even
|
||||||
|
// prime).
|
||||||
|
for (int i = 2; i*i <= max; i += i%2+1) {
|
||||||
if (!is_prime_[i]) continue;
|
if (!is_prime_[i]) continue;
|
||||||
|
|
||||||
// Marks all multiples of i (except i itself) as non-prime.
|
// Marks all multiples of i (except i itself) as non-prime.
|
||||||
for (int j = 2*i; j <= max; j += i) {
|
// We are starting here from i-th multiplier, because all smaller
|
||||||
|
// complex numbers were already marked.
|
||||||
|
for (int j = i*i; j <= max; j += i) {
|
||||||
is_prime_[j] = false;
|
is_prime_[j] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,12 @@
|
||||||
//
|
//
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
// Author: wan@google.com (Zhanyong Wan)
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "sample4.h"
|
#include "sample4.h"
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// Tests the Increment() method.
|
// Tests the Increment() method.
|
||||||
|
|
||||||
TEST(Counter, Increment) {
|
TEST(Counter, Increment) {
|
||||||
Counter c;
|
Counter c;
|
||||||
|
|
||||||
|
@ -43,4 +45,5 @@ TEST(Counter, Increment) {
|
||||||
EXPECT_EQ(1, c.Increment());
|
EXPECT_EQ(1, c.Increment());
|
||||||
EXPECT_EQ(2, c.Increment());
|
EXPECT_EQ(2, c.Increment());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -46,9 +46,9 @@
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "sample3-inl.h"
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "sample1.h"
|
#include "sample1.h"
|
||||||
|
#include "sample3-inl.h"
|
||||||
namespace {
|
namespace {
|
||||||
// In this sample, we want to ensure that every test finishes within
|
// In this sample, we want to ensure that every test finishes within
|
||||||
// ~5 seconds. If a test takes longer to run, we consider it a
|
// ~5 seconds. If a test takes longer to run, we consider it a
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
namespace {
|
namespace {
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
using ::testing::TestWithParam;
|
using ::testing::TestWithParam;
|
||||||
using ::testing::Values;
|
using ::testing::Values;
|
||||||
|
@ -116,15 +115,4 @@ INSTANTIATE_TEST_CASE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7,
|
||||||
Values(&CreateOnTheFlyPrimeTable,
|
Values(&CreateOnTheFlyPrimeTable,
|
||||||
&CreatePreCalculatedPrimeTable<1000>));
|
&CreatePreCalculatedPrimeTable<1000>));
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// Google Test may not support value-parameterized tests with some
|
|
||||||
// compilers. If we use conditional compilation to compile out all
|
|
||||||
// code referring to the gtest_main library, MSVC linker will not link
|
|
||||||
// that library at all and consequently complain about missing entry
|
|
||||||
// point defined in that library (fatal error LNK1561: entry point
|
|
||||||
// must be defined). This dummy test keeps gtest_main linked in.
|
|
||||||
TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {}
|
|
||||||
|
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -66,15 +66,7 @@
|
||||||
|
|
||||||
#include "gtest/gtest-message.h"
|
#include "gtest/gtest-message.h"
|
||||||
#include "gtest/internal/gtest-string.h"
|
#include "gtest/internal/gtest-string.h"
|
||||||
|
|
||||||
// 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 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"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
|
@ -259,7 +251,7 @@ enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
|
||||||
// message is propagated back to the parent process. Otherwise, the
|
// message is propagated back to the parent process. Otherwise, the
|
||||||
// message is simply printed to stderr. In either case, the program
|
// message is simply printed to stderr. In either case, the program
|
||||||
// then exits with status 1.
|
// then exits with status 1.
|
||||||
void DeathTestAbort(const std::string& message) {
|
static void DeathTestAbort(const std::string& message) {
|
||||||
// On a POSIX system, this function may be called from a threadsafe-style
|
// 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
|
// death test child process, which operates on a very small stack. Use
|
||||||
// the heap for any additional non-minuscule memory requirements.
|
// the heap for any additional non-minuscule memory requirements.
|
||||||
|
@ -985,6 +977,7 @@ static int ExecDeathTestChildMain(void* child_arg) {
|
||||||
}
|
}
|
||||||
# endif // !GTEST_OS_QNX
|
# endif // !GTEST_OS_QNX
|
||||||
|
|
||||||
|
# if GTEST_HAS_CLONE
|
||||||
// Two utility routines that together determine the direction the stack
|
// Two utility routines that together determine the direction the stack
|
||||||
// grows.
|
// grows.
|
||||||
// This could be accomplished more elegantly by a single recursive
|
// This could be accomplished more elegantly by a single recursive
|
||||||
|
@ -994,20 +987,22 @@ static int ExecDeathTestChildMain(void* child_arg) {
|
||||||
// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining
|
// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining
|
||||||
// StackLowerThanAddress into StackGrowsDown, which then doesn't give
|
// StackLowerThanAddress into StackGrowsDown, which then doesn't give
|
||||||
// correct answer.
|
// correct answer.
|
||||||
void StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_;
|
static void StackLowerThanAddress(const void* ptr,
|
||||||
void StackLowerThanAddress(const void* ptr, bool* result) {
|
bool* result) GTEST_NO_INLINE_;
|
||||||
|
static void StackLowerThanAddress(const void* ptr, bool* result) {
|
||||||
int dummy;
|
int dummy;
|
||||||
*result = (&dummy < ptr);
|
*result = (&dummy < ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure AddressSanitizer does not tamper with the stack here.
|
// Make sure AddressSanitizer does not tamper with the stack here.
|
||||||
GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
|
GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
|
||||||
bool StackGrowsDown() {
|
static bool StackGrowsDown() {
|
||||||
int dummy;
|
int dummy;
|
||||||
bool result;
|
bool result;
|
||||||
StackLowerThanAddress(&dummy, &result);
|
StackLowerThanAddress(&dummy, &result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
# endif // GTEST_HAS_CLONE
|
||||||
|
|
||||||
// Spawns a child process with the same executable as the current process in
|
// 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
|
// a thread-safe manner and instructs it to run the death test. The
|
||||||
|
@ -1223,12 +1218,12 @@ bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,
|
||||||
// Recreates the pipe and event handles from the provided parameters,
|
// Recreates the pipe and event handles from the provided parameters,
|
||||||
// signals the event, and returns a file descriptor wrapped around the pipe
|
// signals the event, and returns a file descriptor wrapped around the pipe
|
||||||
// handle. This function is called in the child process only.
|
// handle. This function is called in the child process only.
|
||||||
int GetStatusFileDescriptor(unsigned int parent_process_id,
|
static int GetStatusFileDescriptor(unsigned int parent_process_id,
|
||||||
size_t write_handle_as_size_t,
|
size_t write_handle_as_size_t,
|
||||||
size_t event_handle_as_size_t) {
|
size_t event_handle_as_size_t) {
|
||||||
AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE,
|
AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE,
|
||||||
FALSE, // Non-inheritable.
|
FALSE, // Non-inheritable.
|
||||||
parent_process_id));
|
parent_process_id));
|
||||||
if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) {
|
if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) {
|
||||||
DeathTestAbort("Unable to open parent process " +
|
DeathTestAbort("Unable to open parent process " +
|
||||||
StreamableToString(parent_process_id));
|
StreamableToString(parent_process_id));
|
||||||
|
|
|
@ -26,14 +26,12 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Authors: keith.ray@gmail.com (Keith Ray)
|
|
||||||
|
|
||||||
#include "gtest/gtest-message.h"
|
|
||||||
#include "gtest/internal/gtest-filepath.h"
|
#include "gtest/internal/gtest-filepath.h"
|
||||||
#include "gtest/internal/gtest-port.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "gtest/internal/gtest-port.h"
|
||||||
|
#include "gtest/gtest-message.h"
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
#if GTEST_OS_WINDOWS_MOBILE
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
|
@ -48,6 +46,8 @@
|
||||||
# include <climits> // Some Linux distributions define PATH_MAX here.
|
# include <climits> // Some Linux distributions define PATH_MAX here.
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
|
|
||||||
|
#include "gtest/internal/gtest-string.h"
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
#if GTEST_OS_WINDOWS
|
||||||
# define GTEST_PATH_MAX_ _MAX_PATH
|
# define GTEST_PATH_MAX_ _MAX_PATH
|
||||||
#elif defined(PATH_MAX)
|
#elif defined(PATH_MAX)
|
||||||
|
@ -58,8 +58,6 @@
|
||||||
# define GTEST_PATH_MAX_ _POSIX_PATH_MAX
|
# define GTEST_PATH_MAX_ _POSIX_PATH_MAX
|
||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
#include "gtest/internal/gtest-string.h"
|
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
|
|
|
@ -37,14 +37,6 @@
|
||||||
#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
|
#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
|
||||||
#define GTEST_SRC_GTEST_INTERNAL_INL_H_
|
#define GTEST_SRC_GTEST_INTERNAL_INL_H_
|
||||||
|
|
||||||
// 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_
|
|
||||||
// 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_
|
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
#endif // !_WIN32_WCE
|
#endif // !_WIN32_WCE
|
||||||
|
@ -664,13 +656,11 @@ class GTEST_API_ UnitTestImpl {
|
||||||
tear_down_tc)->AddTestInfo(test_info);
|
tear_down_tc)->AddTestInfo(test_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
// Returns ParameterizedTestCaseRegistry object used to keep track of
|
// Returns ParameterizedTestCaseRegistry object used to keep track of
|
||||||
// value-parameterized tests and instantiate and register them.
|
// value-parameterized tests and instantiate and register them.
|
||||||
internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
|
internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
|
||||||
return parameterized_test_registry_;
|
return parameterized_test_registry_;
|
||||||
}
|
}
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
// Sets the TestCase object for the test that's currently running.
|
// Sets the TestCase object for the test that's currently running.
|
||||||
void set_current_test_case(TestCase* a_current_test_case) {
|
void set_current_test_case(TestCase* a_current_test_case) {
|
||||||
|
@ -845,14 +835,12 @@ class GTEST_API_ UnitTestImpl {
|
||||||
// shuffled order.
|
// shuffled order.
|
||||||
std::vector<int> test_case_indices_;
|
std::vector<int> test_case_indices_;
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
// ParameterizedTestRegistry object used to register value-parameterized
|
// ParameterizedTestRegistry object used to register value-parameterized
|
||||||
// tests.
|
// tests.
|
||||||
internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
|
internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
|
||||||
|
|
||||||
// Indicates whether RegisterParameterizedTests() has been called already.
|
// Indicates whether RegisterParameterizedTests() has been called already.
|
||||||
bool parameterized_tests_registered_;
|
bool parameterized_tests_registered_;
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
// Index of the last death test case registered. Initially -1.
|
// Index of the last death test case registered. Initially -1.
|
||||||
int last_death_test_case_;
|
int last_death_test_case_;
|
||||||
|
|
|
@ -67,15 +67,7 @@
|
||||||
#include "gtest/gtest-message.h"
|
#include "gtest/gtest-message.h"
|
||||||
#include "gtest/internal/gtest-internal.h"
|
#include "gtest/internal/gtest-internal.h"
|
||||||
#include "gtest/internal/gtest-string.h"
|
#include "gtest/internal/gtest-string.h"
|
||||||
|
|
||||||
// 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 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"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
@ -671,7 +663,7 @@ bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function used by ValidateRegex() to format error messages.
|
// Helper function used by ValidateRegex() to format error messages.
|
||||||
std::string FormatRegexSyntaxError(const char* regex, int index) {
|
static std::string FormatRegexSyntaxError(const char* regex, int index) {
|
||||||
return (Message() << "Syntax error at index " << index
|
return (Message() << "Syntax error at index " << index
|
||||||
<< " in simple regular expression \"" << regex << "\": ").GetString();
|
<< " in simple regular expression \"" << regex << "\": ").GetString();
|
||||||
}
|
}
|
||||||
|
@ -1015,7 +1007,9 @@ static CapturedStream* g_captured_stderr = NULL;
|
||||||
static CapturedStream* g_captured_stdout = NULL;
|
static CapturedStream* g_captured_stdout = NULL;
|
||||||
|
|
||||||
// Starts capturing an output stream (stdout/stderr).
|
// Starts capturing an output stream (stdout/stderr).
|
||||||
void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
|
static void CaptureStream(int fd,
|
||||||
|
const char* stream_name,
|
||||||
|
CapturedStream** stream) {
|
||||||
if (*stream != NULL) {
|
if (*stream != NULL) {
|
||||||
GTEST_LOG_(FATAL) << "Only one " << stream_name
|
GTEST_LOG_(FATAL) << "Only one " << stream_name
|
||||||
<< " capturer can exist at a time.";
|
<< " capturer can exist at a time.";
|
||||||
|
@ -1024,7 +1018,7 @@ void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stops capturing the output stream and returns the captured string.
|
// Stops capturing the output stream and returns the captured string.
|
||||||
std::string GetCapturedStream(CapturedStream** captured_stream) {
|
static std::string GetCapturedStream(CapturedStream** captured_stream) {
|
||||||
const std::string content = (*captured_stream)->GetCapturedString();
|
const std::string content = (*captured_stream)->GetCapturedString();
|
||||||
|
|
||||||
delete *captured_stream;
|
delete *captured_stream;
|
||||||
|
|
|
@ -32,15 +32,7 @@
|
||||||
// The Google C++ Testing Framework (Google Test)
|
// The Google C++ Testing Framework (Google Test)
|
||||||
|
|
||||||
#include "gtest/gtest-test-part.h"
|
#include "gtest/gtest-test-part.h"
|
||||||
|
|
||||||
// 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 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"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
|
|
|
@ -133,14 +133,7 @@
|
||||||
# include <sys/types.h> // NOLINT
|
# include <sys/types.h> // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 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
|
|
||||||
// their code.
|
|
||||||
#define GTEST_IMPLEMENTATION_ 1
|
|
||||||
#include "src/gtest-internal-inl.h"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
#if GTEST_OS_WINDOWS
|
||||||
# define vsnprintf _vsnprintf
|
# define vsnprintf _vsnprintf
|
||||||
|
@ -635,12 +628,12 @@ extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();
|
||||||
// This predicate-formatter checks that 'results' contains a test part
|
// This predicate-formatter checks that 'results' contains a test part
|
||||||
// failure of the given type and that the failure message contains the
|
// failure of the given type and that the failure message contains the
|
||||||
// given substring.
|
// given substring.
|
||||||
AssertionResult HasOneFailure(const char* /* results_expr */,
|
static AssertionResult HasOneFailure(const char* /* results_expr */,
|
||||||
const char* /* type_expr */,
|
const char* /* type_expr */,
|
||||||
const char* /* substr_expr */,
|
const char* /* substr_expr */,
|
||||||
const TestPartResultArray& results,
|
const TestPartResultArray& results,
|
||||||
TestPartResult::Type type,
|
TestPartResult::Type type,
|
||||||
const std::string& substr) {
|
const std::string& substr) {
|
||||||
const std::string expected(type == TestPartResult::kFatalFailure ?
|
const std::string expected(type == TestPartResult::kFatalFailure ?
|
||||||
"1 fatal failure" :
|
"1 fatal failure" :
|
||||||
"1 non-fatal failure");
|
"1 non-fatal failure");
|
||||||
|
@ -2143,8 +2136,9 @@ static std::string FormatWordList(const std::vector<std::string>& words) {
|
||||||
return word_list.GetString();
|
return word_list.GetString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ValidateTestPropertyName(const std::string& property_name,
|
static bool ValidateTestPropertyName(
|
||||||
const std::vector<std::string>& reserved_names) {
|
const std::string& property_name,
|
||||||
|
const std::vector<std::string>& reserved_names) {
|
||||||
if (std::find(reserved_names.begin(), reserved_names.end(), property_name) !=
|
if (std::find(reserved_names.begin(), reserved_names.end(), property_name) !=
|
||||||
reserved_names.end()) {
|
reserved_names.end()) {
|
||||||
ADD_FAILURE() << "Reserved key used in RecordProperty(): " << property_name
|
ADD_FAILURE() << "Reserved key used in RecordProperty(): " << property_name
|
||||||
|
@ -2562,7 +2556,6 @@ TestInfo* MakeAndRegisterTestInfo(
|
||||||
return test_info;
|
return test_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
void ReportInvalidTestCaseType(const char* test_case_name,
|
void ReportInvalidTestCaseType(const char* test_case_name,
|
||||||
CodeLocation code_location) {
|
CodeLocation code_location) {
|
||||||
Message errors;
|
Message errors;
|
||||||
|
@ -2576,12 +2569,11 @@ void ReportInvalidTestCaseType(const char* test_case_name,
|
||||||
<< "probably rename one of the classes to put the tests into different\n"
|
<< "probably rename one of the classes to put the tests into different\n"
|
||||||
<< "test cases.";
|
<< "test cases.";
|
||||||
|
|
||||||
GTEST_LOG_(ERROR)
|
GTEST_LOG_(ERROR)
|
||||||
<< FormatFileLocation(code_location.file.c_str(),
|
<< FormatFileLocation(code_location.file.c_str(),
|
||||||
code_location.line)
|
code_location.line)
|
||||||
<< " " << errors.GetString();
|
<< " " << errors.GetString();
|
||||||
}
|
}
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
|
@ -2620,12 +2612,10 @@ namespace internal {
|
||||||
// and INSTANTIATE_TEST_CASE_P into regular tests and registers those.
|
// and INSTANTIATE_TEST_CASE_P into regular tests and registers those.
|
||||||
// This will be done just once during the program runtime.
|
// This will be done just once during the program runtime.
|
||||||
void UnitTestImpl::RegisterParameterizedTests() {
|
void UnitTestImpl::RegisterParameterizedTests() {
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
if (!parameterized_tests_registered_) {
|
if (!parameterized_tests_registered_) {
|
||||||
parameterized_test_registry_.RegisterTests();
|
parameterized_test_registry_.RegisterTests();
|
||||||
parameterized_tests_registered_ = true;
|
parameterized_tests_registered_ = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
@ -2893,7 +2883,7 @@ enum GTestColor {
|
||||||
!GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW
|
!GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW
|
||||||
|
|
||||||
// Returns the character attribute for the given color.
|
// Returns the character attribute for the given color.
|
||||||
WORD GetColorAttribute(GTestColor color) {
|
static WORD GetColorAttribute(GTestColor color) {
|
||||||
switch (color) {
|
switch (color) {
|
||||||
case COLOR_RED: return FOREGROUND_RED;
|
case COLOR_RED: return FOREGROUND_RED;
|
||||||
case COLOR_GREEN: return FOREGROUND_GREEN;
|
case COLOR_GREEN: return FOREGROUND_GREEN;
|
||||||
|
@ -2902,7 +2892,7 @@ WORD GetColorAttribute(GTestColor color) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetBitOffset(WORD color_mask) {
|
static int GetBitOffset(WORD color_mask) {
|
||||||
if (color_mask == 0) return 0;
|
if (color_mask == 0) return 0;
|
||||||
|
|
||||||
int bitOffset = 0;
|
int bitOffset = 0;
|
||||||
|
@ -2913,7 +2903,7 @@ int GetBitOffset(WORD color_mask) {
|
||||||
return bitOffset;
|
return bitOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
|
static WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
|
||||||
// Let's reuse the BG
|
// Let's reuse the BG
|
||||||
static const WORD background_mask = BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY;
|
static const WORD background_mask = BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY;
|
||||||
static const WORD foreground_mask = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY;
|
static const WORD foreground_mask = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY;
|
||||||
|
@ -2928,12 +2918,12 @@ WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
|
||||||
}
|
}
|
||||||
return new_color;
|
return new_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Returns the ANSI color code for the given color. COLOR_DEFAULT is
|
// Returns the ANSI color code for the given color. COLOR_DEFAULT is
|
||||||
// an invalid input.
|
// an invalid input.
|
||||||
const char* GetAnsiColorCode(GTestColor color) {
|
static const char* GetAnsiColorCode(GTestColor color) {
|
||||||
switch (color) {
|
switch (color) {
|
||||||
case COLOR_RED: return "1";
|
case COLOR_RED: return "1";
|
||||||
case COLOR_GREEN: return "2";
|
case COLOR_GREEN: return "2";
|
||||||
|
@ -2986,7 +2976,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
|
||||||
// This routine must actually emit the characters rather than return a string
|
// This routine must actually emit the characters rather than return a string
|
||||||
// that would be colored when printed, as can be done on Linux.
|
// that would be colored when printed, as can be done on Linux.
|
||||||
GTEST_ATTRIBUTE_PRINTF_(2, 3)
|
GTEST_ATTRIBUTE_PRINTF_(2, 3)
|
||||||
void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
static void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
|
||||||
|
@ -3015,7 +3005,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
||||||
GetConsoleScreenBufferInfo(stdout_handle, &buffer_info);
|
GetConsoleScreenBufferInfo(stdout_handle, &buffer_info);
|
||||||
const WORD old_color_attrs = buffer_info.wAttributes;
|
const WORD old_color_attrs = buffer_info.wAttributes;
|
||||||
const WORD new_color = GetNewColor(color, old_color_attrs);
|
const WORD new_color = GetNewColor(color, old_color_attrs);
|
||||||
|
|
||||||
// We need to flush the stream buffers into the console before each
|
// We need to flush the stream buffers into the console before each
|
||||||
// SetConsoleTextAttribute call lest it affect the text that is already
|
// SetConsoleTextAttribute call lest it affect the text that is already
|
||||||
// printed but has not yet reached the console.
|
// printed but has not yet reached the console.
|
||||||
|
@ -3040,7 +3030,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
||||||
static const char kTypeParamLabel[] = "TypeParam";
|
static const char kTypeParamLabel[] = "TypeParam";
|
||||||
static const char kValueParamLabel[] = "GetParam()";
|
static const char kValueParamLabel[] = "GetParam()";
|
||||||
|
|
||||||
void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
|
static void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
|
||||||
const char* const type_param = test_info.type_param();
|
const char* const type_param = test_info.type_param();
|
||||||
const char* const value_param = test_info.value_param();
|
const char* const value_param = test_info.value_param();
|
||||||
|
|
||||||
|
@ -3481,7 +3471,7 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
|
||||||
// 3. To interpret the meaning of errno in a thread-safe way,
|
// 3. To interpret the meaning of errno in a thread-safe way,
|
||||||
// we need the strerror_r() function, which is not available on
|
// we need the strerror_r() function, which is not available on
|
||||||
// Windows.
|
// Windows.
|
||||||
GTEST_LOG_(FATAL) << "Unable to open file \""
|
GTEST_LOG_(FATAL) << "Unable to open file \""
|
||||||
<< output_file_ << "\"";
|
<< output_file_ << "\"";
|
||||||
}
|
}
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
|
@ -3855,12 +3845,11 @@ void StreamingListener::SocketWriter::MakeConnection() {
|
||||||
|
|
||||||
// Pushes the given source file location and message onto a per-thread
|
// Pushes the given source file location and message onto a per-thread
|
||||||
// trace stack maintained by Google Test.
|
// trace stack maintained by Google Test.
|
||||||
ScopedTrace::ScopedTrace(const char* file, int line, const Message& message)
|
void ScopedTrace::PushTrace(const char* file, int line, std::string message) {
|
||||||
GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
|
|
||||||
TraceInfo trace;
|
TraceInfo trace;
|
||||||
trace.file = file;
|
trace.file = file;
|
||||||
trace.line = line;
|
trace.line = line;
|
||||||
trace.message = message.GetString();
|
trace.message.swap(message);
|
||||||
|
|
||||||
UnitTest::GetInstance()->PushGTestTrace(trace);
|
UnitTest::GetInstance()->PushGTestTrace(trace);
|
||||||
}
|
}
|
||||||
|
@ -4315,7 +4304,6 @@ const TestInfo* UnitTest::current_test_info() const
|
||||||
// Returns the random seed used at the start of the current test run.
|
// Returns the random seed used at the start of the current test run.
|
||||||
int UnitTest::random_seed() const { return impl_->random_seed(); }
|
int UnitTest::random_seed() const { return impl_->random_seed(); }
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
// Returns ParameterizedTestCaseRegistry object used to keep track of
|
// Returns ParameterizedTestCaseRegistry object used to keep track of
|
||||||
// value-parameterized tests and instantiate and register them.
|
// value-parameterized tests and instantiate and register them.
|
||||||
internal::ParameterizedTestCaseRegistry&
|
internal::ParameterizedTestCaseRegistry&
|
||||||
|
@ -4323,7 +4311,6 @@ internal::ParameterizedTestCaseRegistry&
|
||||||
GTEST_LOCK_EXCLUDED_(mutex_) {
|
GTEST_LOCK_EXCLUDED_(mutex_) {
|
||||||
return impl_->parameterized_test_registry();
|
return impl_->parameterized_test_registry();
|
||||||
}
|
}
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
// Creates an empty UnitTest.
|
// Creates an empty UnitTest.
|
||||||
UnitTest::UnitTest() {
|
UnitTest::UnitTest() {
|
||||||
|
@ -4362,10 +4349,8 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
|
||||||
&default_global_test_part_result_reporter_),
|
&default_global_test_part_result_reporter_),
|
||||||
per_thread_test_part_result_reporter_(
|
per_thread_test_part_result_reporter_(
|
||||||
&default_per_thread_test_part_result_reporter_),
|
&default_per_thread_test_part_result_reporter_),
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
parameterized_test_registry_(),
|
parameterized_test_registry_(),
|
||||||
parameterized_tests_registered_(false),
|
parameterized_tests_registered_(false),
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
last_death_test_case_(-1),
|
last_death_test_case_(-1),
|
||||||
current_test_case_(NULL),
|
current_test_case_(NULL),
|
||||||
current_test_info_(NULL),
|
current_test_info_(NULL),
|
||||||
|
@ -4433,8 +4418,8 @@ void UnitTestImpl::ConfigureXmlOutput() {
|
||||||
listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(
|
listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(
|
||||||
UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));
|
UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));
|
||||||
} else if (output_format != "") {
|
} else if (output_format != "") {
|
||||||
GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \""
|
GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \""
|
||||||
<< output_format
|
<< output_format
|
||||||
<< "\" ignored.";
|
<< "\" ignored.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4450,8 +4435,8 @@ void UnitTestImpl::ConfigureStreamingOutput() {
|
||||||
listeners()->Append(new StreamingListener(target.substr(0, pos),
|
listeners()->Append(new StreamingListener(target.substr(0, pos),
|
||||||
target.substr(pos+1)));
|
target.substr(pos+1)));
|
||||||
} else {
|
} else {
|
||||||
GTEST_LOG_(WARNING) << "unrecognized streaming target \""
|
GTEST_LOG_(WARNING) << "unrecognized streaming target \""
|
||||||
<< target
|
<< target
|
||||||
<< "\" ignored.";
|
<< "\" ignored.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4581,7 +4566,7 @@ static void TearDownEnvironment(Environment* env) { env->TearDown(); }
|
||||||
bool UnitTestImpl::RunAllTests() {
|
bool UnitTestImpl::RunAllTests() {
|
||||||
// Makes sure InitGoogleTest() was called.
|
// Makes sure InitGoogleTest() was called.
|
||||||
if (!GTestIsInitialized()) {
|
if (!GTestIsInitialized()) {
|
||||||
GTEST_LOG_(ERROR) <<
|
GTEST_LOG_(ERROR) <<
|
||||||
"\nThis test program did NOT call ::testing::InitGoogleTest "
|
"\nThis test program did NOT call ::testing::InitGoogleTest "
|
||||||
"before calling RUN_ALL_TESTS(). Please fix it.";
|
"before calling RUN_ALL_TESTS(). Please fix it.";
|
||||||
return false;
|
return false;
|
||||||
|
@ -5042,9 +5027,9 @@ bool SkipPrefix(const char* prefix, const char** pstr) {
|
||||||
// part can be omitted.
|
// part can be omitted.
|
||||||
//
|
//
|
||||||
// Returns the value of the flag, or NULL if the parsing failed.
|
// Returns the value of the flag, or NULL if the parsing failed.
|
||||||
const char* ParseFlagValue(const char* str,
|
static const char* ParseFlagValue(const char* str,
|
||||||
const char* flag,
|
const char* flag,
|
||||||
bool def_optional) {
|
bool def_optional) {
|
||||||
// str and flag must not be NULL.
|
// str and flag must not be NULL.
|
||||||
if (str == NULL || flag == NULL) return NULL;
|
if (str == NULL || flag == NULL) return NULL;
|
||||||
|
|
||||||
|
@ -5080,7 +5065,7 @@ const char* ParseFlagValue(const char* str,
|
||||||
//
|
//
|
||||||
// On success, stores the value of the flag in *value, and returns
|
// On success, stores the value of the flag in *value, and returns
|
||||||
// true. On failure, returns false without changing *value.
|
// true. On failure, returns false without changing *value.
|
||||||
bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
|
static bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
|
||||||
// Gets the value of the flag as a string.
|
// Gets the value of the flag as a string.
|
||||||
const char* const value_str = ParseFlagValue(str, flag, true);
|
const char* const value_str = ParseFlagValue(str, flag, true);
|
||||||
|
|
||||||
|
@ -5114,7 +5099,9 @@ bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
|
||||||
//
|
//
|
||||||
// On success, stores the value of the flag in *value, and returns
|
// On success, stores the value of the flag in *value, and returns
|
||||||
// true. On failure, returns false without changing *value.
|
// true. On failure, returns false without changing *value.
|
||||||
bool ParseStringFlag(const char* str, const char* flag, std::string* value) {
|
static bool ParseStringFlag(const char* str,
|
||||||
|
const char* flag,
|
||||||
|
std::string* value) {
|
||||||
// Gets the value of the flag as a string.
|
// Gets the value of the flag as a string.
|
||||||
const char* const value_str = ParseFlagValue(str, flag, false);
|
const char* const value_str = ParseFlagValue(str, flag, false);
|
||||||
|
|
||||||
|
@ -5250,7 +5237,7 @@ static const char kColorEncodedHelpMessage[] =
|
||||||
"(not one in your own code or tests), please report it to\n"
|
"(not one in your own code or tests), please report it to\n"
|
||||||
"@G<" GTEST_DEV_EMAIL_ ">@D.\n";
|
"@G<" GTEST_DEV_EMAIL_ ">@D.\n";
|
||||||
|
|
||||||
bool ParseGoogleTestFlag(const char* const arg) {
|
static bool ParseGoogleTestFlag(const char* const arg) {
|
||||||
return ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag,
|
return ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag,
|
||||||
>EST_FLAG(also_run_disabled_tests)) ||
|
>EST_FLAG(also_run_disabled_tests)) ||
|
||||||
ParseBoolFlag(arg, kBreakOnFailureFlag,
|
ParseBoolFlag(arg, kBreakOnFailureFlag,
|
||||||
|
@ -5280,11 +5267,11 @@ bool ParseGoogleTestFlag(const char* const arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_USE_OWN_FLAGFILE_FLAG_
|
#if GTEST_USE_OWN_FLAGFILE_FLAG_
|
||||||
void LoadFlagsFromFile(const std::string& path) {
|
static void LoadFlagsFromFile(const std::string& path) {
|
||||||
FILE* flagfile = posix::FOpen(path.c_str(), "r");
|
FILE* flagfile = posix::FOpen(path.c_str(), "r");
|
||||||
if (!flagfile) {
|
if (!flagfile) {
|
||||||
GTEST_LOG_(FATAL) << "Unable to open file \""
|
GTEST_LOG_(FATAL) << "Unable to open file \""
|
||||||
<< GTEST_FLAG(flagfile)
|
<< GTEST_FLAG(flagfile)
|
||||||
<< "\"";
|
<< "\"";
|
||||||
}
|
}
|
||||||
std::string contents(ReadEntireFile(flagfile));
|
std::string contents(ReadEntireFile(flagfile));
|
||||||
|
|
|
@ -57,13 +57,15 @@ cc_test(
|
||||||
"gtest-param-test_test.cc",
|
"gtest-param-test_test.cc",
|
||||||
],
|
],
|
||||||
) + select({
|
) + select({
|
||||||
"//:win": [],
|
"//:windows": [],
|
||||||
|
"//:windows_msvc": [],
|
||||||
"//conditions:default": [
|
"//conditions:default": [
|
||||||
"gtest-tuple_test.cc",
|
"gtest-tuple_test.cc",
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
copts = select({
|
copts = select({
|
||||||
"//:win": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
|
"//:windows": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
|
||||||
|
"//:windows_msvc": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
|
||||||
"//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"],
|
"//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"],
|
||||||
}),
|
}),
|
||||||
includes = [
|
includes = [
|
||||||
|
@ -73,7 +75,8 @@ cc_test(
|
||||||
"googletest/test",
|
"googletest/test",
|
||||||
],
|
],
|
||||||
linkopts = select({
|
linkopts = select({
|
||||||
"//:win": [],
|
"//:windows": [],
|
||||||
|
"//:windows_msvc": [],
|
||||||
"//conditions:default": [
|
"//conditions:default": [
|
||||||
"-pthread",
|
"-pthread",
|
||||||
],
|
],
|
||||||
|
|
|
@ -56,15 +56,7 @@ using testing::internal::AlwaysTrue;
|
||||||
# endif // GTEST_OS_LINUX
|
# endif // GTEST_OS_LINUX
|
||||||
|
|
||||||
# include "gtest/gtest-spi.h"
|
# include "gtest/gtest-spi.h"
|
||||||
|
|
||||||
// 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
|
|
||||||
// their code.
|
|
||||||
# define GTEST_IMPLEMENTATION_ 1
|
|
||||||
# include "src/gtest-internal-inl.h"
|
# include "src/gtest-internal-inl.h"
|
||||||
# undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
namespace posix = ::testing::internal::posix;
|
namespace posix = ::testing::internal::posix;
|
||||||
|
|
||||||
|
@ -313,14 +305,14 @@ void DieWithEmbeddedNul() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# if GTEST_USES_PCRE
|
# if GTEST_USES_PCRE
|
||||||
|
|
||||||
// Tests that EXPECT_DEATH and ASSERT_DEATH work when the error
|
// Tests that EXPECT_DEATH and ASSERT_DEATH work when the error
|
||||||
// message has a NUL character in it.
|
// message has a NUL character in it.
|
||||||
TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
|
TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
|
||||||
// TODO(wan@google.com): <regex.h> doesn't support matching strings
|
|
||||||
// with embedded NUL characters - find a way to workaround it.
|
|
||||||
EXPECT_DEATH(DieWithEmbeddedNul(), "my null world");
|
EXPECT_DEATH(DieWithEmbeddedNul(), "my null world");
|
||||||
ASSERT_DEATH(DieWithEmbeddedNul(), "my null world");
|
ASSERT_DEATH(DieWithEmbeddedNul(), "my null world");
|
||||||
}
|
}
|
||||||
|
|
||||||
# endif // GTEST_USES_PCRE
|
# endif // GTEST_USES_PCRE
|
||||||
|
|
||||||
// Tests that death test macros expand to code which interacts well with switch
|
// Tests that death test macros expand to code which interacts well with switch
|
||||||
|
|
|
@ -27,28 +27,18 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Authors: keith.ray@gmail.com (Keith Ray)
|
|
||||||
//
|
//
|
||||||
// Google Test filepath utilities
|
// Google Test filepath utilities
|
||||||
//
|
//
|
||||||
// This file tests classes and functions used internally by
|
// This file tests classes and functions used internally by
|
||||||
// Google Test. They are subject to change without notice.
|
// Google Test. They are subject to change without notice.
|
||||||
//
|
//
|
||||||
// This file is #included from gtest_unittest.cc, to avoid changing
|
// This file is #included from gtest-internal.h.
|
||||||
// build or make-files for some existing Google Test clients. Do not
|
// Do not #include this file anywhere else!
|
||||||
// #include this file anywhere else!
|
|
||||||
|
|
||||||
#include "gtest/internal/gtest-filepath.h"
|
#include "gtest/internal/gtest-filepath.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
// 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
|
|
||||||
// their code.
|
|
||||||
#define GTEST_IMPLEMENTATION_ 1
|
|
||||||
#include "src/gtest-internal-inl.h"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
#if GTEST_OS_WINDOWS_MOBILE
|
||||||
# include <windows.h> // NOLINT
|
# include <windows.h> // NOLINT
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Authors: keith.ray@gmail.com (Keith Ray)
|
|
||||||
//
|
//
|
||||||
// Google Test UnitTestOptions tests
|
// Google Test UnitTestOptions tests
|
||||||
//
|
//
|
||||||
|
@ -46,14 +45,7 @@
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
|
|
||||||
// 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
|
|
||||||
// their code.
|
|
||||||
#define GTEST_IMPLEMENTATION_ 1
|
|
||||||
#include "src/gtest-internal-inl.h"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
|
@ -33,11 +33,8 @@
|
||||||
// Google Test work.
|
// Google Test work.
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include "test/gtest-param-test_test.h"
|
#include "test/gtest-param-test_test.h"
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
using ::testing::Values;
|
using ::testing::Values;
|
||||||
using ::testing::internal::ParamGenerator;
|
using ::testing::internal::ParamGenerator;
|
||||||
|
|
||||||
|
@ -62,4 +59,3 @@ INSTANTIATE_TEST_CASE_P(Sequence2,
|
||||||
InstantiationInMultipleTranslaionUnitsTest,
|
InstantiationInMultipleTranslaionUnitsTest,
|
||||||
Values(42*3, 42*4, 42*5));
|
Values(42*3, 42*4, 42*5));
|
||||||
|
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
|
@ -35,19 +35,13 @@
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
# include <algorithm>
|
# include <algorithm>
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
# include <list>
|
# include <list>
|
||||||
# include <sstream>
|
# include <sstream>
|
||||||
# include <string>
|
# include <string>
|
||||||
# include <vector>
|
# include <vector>
|
||||||
|
|
||||||
// To include gtest-internal-inl.h.
|
|
||||||
# define GTEST_IMPLEMENTATION_ 1
|
|
||||||
# include "src/gtest-internal-inl.h" // for UnitTestOptions
|
# include "src/gtest-internal-inl.h" // for UnitTestOptions
|
||||||
# undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
# include "test/gtest-param-test_test.h"
|
# include "test/gtest-param-test_test.h"
|
||||||
|
|
||||||
|
@ -1025,31 +1019,19 @@ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5));
|
INSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5));
|
||||||
|
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
TEST(CompileTest, CombineIsDefinedOnlyWhenGtestHasParamTestIsDefined) {
|
|
||||||
#if GTEST_HAS_COMBINE && !GTEST_HAS_PARAM_TEST
|
|
||||||
FAIL() << "GTEST_HAS_COMBINE is defined while GTEST_HAS_PARAM_TEST is not\n"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
// Used in TestGenerationTest test case.
|
// Used in TestGenerationTest test case.
|
||||||
AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance());
|
AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance());
|
||||||
// Used in GeneratorEvaluationTest test case. Tests that the updated value
|
// Used in GeneratorEvaluationTest test case. Tests that the updated value
|
||||||
// will be picked up for instantiating tests in GeneratorEvaluationTest.
|
// will be picked up for instantiating tests in GeneratorEvaluationTest.
|
||||||
GeneratorEvaluationTest::set_param_value(1);
|
GeneratorEvaluationTest::set_param_value(1);
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
// Used in GeneratorEvaluationTest test case. Tests that value updated
|
// Used in GeneratorEvaluationTest test case. Tests that value updated
|
||||||
// here will NOT be used for instantiating tests in
|
// here will NOT be used for instantiating tests in
|
||||||
// GeneratorEvaluationTest.
|
// GeneratorEvaluationTest.
|
||||||
GeneratorEvaluationTest::set_param_value(2);
|
GeneratorEvaluationTest::set_param_value(2);
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,6 @@
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
// Test fixture for testing definition and instantiation of a test
|
// Test fixture for testing definition and instantiation of a test
|
||||||
// in separate translation units.
|
// in separate translation units.
|
||||||
class ExternalInstantiationTest : public ::testing::TestWithParam<int> {
|
class ExternalInstantiationTest : public ::testing::TestWithParam<int> {
|
||||||
|
@ -52,6 +50,4 @@ class InstantiationInMultipleTranslaionUnitsTest
|
||||||
: public ::testing::TestWithParam<int> {
|
: public ::testing::TestWithParam<int> {
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
#endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_
|
#endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_
|
||||||
|
|
|
@ -45,15 +45,7 @@
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "gtest/gtest-spi.h"
|
#include "gtest/gtest-spi.h"
|
||||||
|
|
||||||
// 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
|
|
||||||
// their code.
|
|
||||||
#define GTEST_IMPLEMENTATION_ 1
|
|
||||||
#include "src/gtest-internal-inl.h"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
using std::make_pair;
|
using std::make_pair;
|
||||||
using std::pair;
|
using std::pair;
|
||||||
|
@ -75,8 +67,8 @@ TEST(IsXDigitTest, WorksForNarrowAscii) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) {
|
TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) {
|
||||||
EXPECT_FALSE(IsXDigit('\x80'));
|
EXPECT_FALSE(IsXDigit(static_cast<char>(0x80)));
|
||||||
EXPECT_FALSE(IsXDigit(static_cast<char>('0' | '\x80')));
|
EXPECT_FALSE(IsXDigit(static_cast<char>('0' | 0x80)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(IsXDigitTest, WorksForWideAscii) {
|
TEST(IsXDigitTest, WorksForWideAscii) {
|
||||||
|
|
|
@ -52,13 +52,13 @@
|
||||||
|
|
||||||
// hash_map and hash_set are available under Visual C++, or on Linux.
|
// hash_map and hash_set are available under Visual C++, or on Linux.
|
||||||
#if GTEST_HAS_UNORDERED_MAP_
|
#if GTEST_HAS_UNORDERED_MAP_
|
||||||
# include <unordered_map> // NOLINT
|
# include <unordered_map> // NOLINT
|
||||||
#elif GTEST_HAS_HASH_MAP_
|
#elif GTEST_HAS_HASH_MAP_
|
||||||
# include <hash_map> // NOLINT
|
# include <hash_map> // NOLINT
|
||||||
#endif // GTEST_HAS_HASH_MAP_
|
#endif // GTEST_HAS_HASH_MAP_
|
||||||
|
|
||||||
#if GTEST_HAS_UNORDERED_SET_
|
#if GTEST_HAS_UNORDERED_SET_
|
||||||
# include <unordered_set> // NOLINT
|
# include <unordered_set> // NOLINT
|
||||||
#elif GTEST_HAS_HASH_SET_
|
#elif GTEST_HAS_HASH_SET_
|
||||||
# include <hash_set> // NOLINT
|
# include <hash_set> // NOLINT
|
||||||
#endif // GTEST_HAS_HASH_SET_
|
#endif // GTEST_HAS_HASH_SET_
|
||||||
|
@ -192,13 +192,12 @@ inline ::std::ostream& operator<<(::std::ostream& os,
|
||||||
return os << "StreamableTemplateInFoo: " << x.value();
|
return os << "StreamableTemplateInFoo: " << x.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
// A user-defined streamable but recursivly-defined container type in
|
// A user-defined streamable but recursivly-defined container type in
|
||||||
// a user namespace, it mimics therefore std::filesystem::path or
|
// a user namespace, it mimics therefore std::filesystem::path or
|
||||||
// boost::filesystem::path.
|
// boost::filesystem::path.
|
||||||
class PathLike {
|
class PathLike {
|
||||||
public:
|
public:
|
||||||
struct iterator
|
struct iterator {
|
||||||
{
|
|
||||||
typedef PathLike value_type;
|
typedef PathLike value_type;
|
||||||
};
|
};
|
||||||
typedef iterator const_iterator;
|
typedef iterator const_iterator;
|
||||||
|
@ -208,9 +207,7 @@ class PathLike {
|
||||||
iterator begin() const { return iterator(); }
|
iterator begin() const { return iterator(); }
|
||||||
iterator end() const { return iterator(); }
|
iterator end() const { return iterator(); }
|
||||||
|
|
||||||
friend
|
friend ::std::ostream& operator<<(::std::ostream& os, const PathLike&) {
|
||||||
::std::ostream& operator<<(::std::ostream& os, const PathLike&)
|
|
||||||
{
|
|
||||||
return os << "Streamable-PathLike";
|
return os << "Streamable-PathLike";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -250,9 +247,9 @@ using ::testing::internal::string;
|
||||||
#if GTEST_HAS_UNORDERED_MAP_
|
#if GTEST_HAS_UNORDERED_MAP_
|
||||||
|
|
||||||
#define GTEST_HAS_HASH_MAP_ 1
|
#define GTEST_HAS_HASH_MAP_ 1
|
||||||
template<class Key, class T>
|
template <class Key, class T>
|
||||||
using hash_map = ::std::unordered_map<Key, T>;
|
using hash_map = ::std::unordered_map<Key, T>;
|
||||||
template<class Key, class T>
|
template <class Key, class T>
|
||||||
using hash_multimap = ::std::unordered_multimap<Key, T>;
|
using hash_multimap = ::std::unordered_multimap<Key, T>;
|
||||||
|
|
||||||
#elif GTEST_HAS_HASH_MAP_
|
#elif GTEST_HAS_HASH_MAP_
|
||||||
|
@ -270,9 +267,9 @@ using ::stdext::hash_multimap;
|
||||||
#if GTEST_HAS_UNORDERED_SET_
|
#if GTEST_HAS_UNORDERED_SET_
|
||||||
|
|
||||||
#define GTEST_HAS_HASH_SET_ 1
|
#define GTEST_HAS_HASH_SET_ 1
|
||||||
template<class Key>
|
template <class Key>
|
||||||
using hash_set = ::std::unordered_set<Key>;
|
using hash_set = ::std::unordered_set<Key>;
|
||||||
template<class Key>
|
template <class Key>
|
||||||
using hash_multiset = ::std::unordered_multiset<Key>;
|
using hash_multiset = ::std::unordered_multiset<Key>;
|
||||||
|
|
||||||
#elif GTEST_HAS_HASH_SET_
|
#elif GTEST_HAS_HASH_SET_
|
||||||
|
@ -1092,7 +1089,7 @@ TEST(PrintTr1TupleTest, VariousSizes) {
|
||||||
::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT
|
::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT
|
||||||
testing::internal::Int64, float, double, const char*, void*,
|
testing::internal::Int64, float, double, const char*, void*,
|
||||||
std::string>
|
std::string>
|
||||||
t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str,
|
t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str, // NOLINT
|
||||||
ImplicitCast_<void*>(NULL), "10");
|
ImplicitCast_<void*>(NULL), "10");
|
||||||
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
|
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
|
||||||
" pointing to \"8\", NULL, \"10\")",
|
" pointing to \"8\", NULL, \"10\")",
|
||||||
|
@ -1152,7 +1149,7 @@ TEST(PrintStdTupleTest, VariousSizes) {
|
||||||
::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT
|
::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT
|
||||||
testing::internal::Int64, float, double, const char*, void*,
|
testing::internal::Int64, float, double, const char*, void*,
|
||||||
std::string>
|
std::string>
|
||||||
t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str,
|
t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str, // NOLINT
|
||||||
ImplicitCast_<void*>(NULL), "10");
|
ImplicitCast_<void*>(NULL), "10");
|
||||||
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
|
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
|
||||||
" pointing to \"8\", NULL, \"10\")",
|
" pointing to \"8\", NULL, \"10\")",
|
||||||
|
|
|
@ -80,8 +80,7 @@ int main(int argc, char **argv) {
|
||||||
SetUnhandledExceptionFilter(ExitWithExceptionCode);
|
SetUnhandledExceptionFilter(ExitWithExceptionCode);
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
testing::InitGoogleTest(&argc, argv);
|
testing::InitGoogleTest(&argc, argv);
|
||||||
|
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
|
|
|
@ -36,15 +36,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
// 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
|
|
||||||
// their code.
|
|
||||||
#define GTEST_IMPLEMENTATION_ 1
|
|
||||||
#include "src/gtest-internal-inl.h"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
using testing::internal::ShouldUseColor;
|
using testing::internal::ShouldUseColor;
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,7 @@
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#define GTEST_IMPLEMENTATION_ 1
|
|
||||||
#include "src/gtest-internal-inl.h"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
using ::std::cout;
|
using ::std::cout;
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#define GTEST_IMPLEMENTATION_ 1 // Required for the next #include.
|
|
||||||
#include "src/gtest-internal-inl.h"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
GTEST_DECLARE_string_(filter);
|
GTEST_DECLARE_string_(filter);
|
||||||
|
|
|
@ -117,7 +117,6 @@ TEST(DISABLED_FoobarbazTest, TestA) {
|
||||||
FAIL() << "Expected failure.";
|
FAIL() << "Expected failure.";
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
class ParamTest : public testing::TestWithParam<int> {
|
class ParamTest : public testing::TestWithParam<int> {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -129,7 +128,6 @@ TEST_P(ParamTest, TestY) {
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(SeqP, ParamTest, testing::Values(1, 2));
|
INSTANTIATE_TEST_CASE_P(SeqP, ParamTest, testing::Values(1, 2));
|
||||||
INSTANTIATE_TEST_CASE_P(SeqQ, ParamTest, testing::Values(5, 6));
|
INSTANTIATE_TEST_CASE_P(SeqQ, ParamTest, testing::Values(5, 6));
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -37,15 +37,7 @@
|
||||||
|
|
||||||
#include "gtest/gtest-spi.h"
|
#include "gtest/gtest-spi.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
// 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
|
|
||||||
// their code.
|
|
||||||
#define GTEST_IMPLEMENTATION_ 1
|
|
||||||
#include "src/gtest-internal-inl.h"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -757,8 +749,6 @@ TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
|
||||||
|
|
||||||
// This #ifdef block tests the output of value-parameterized tests.
|
// This #ifdef block tests the output of value-parameterized tests.
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
std::string ParamNameFunc(const testing::TestParamInfo<std::string>& info) {
|
std::string ParamNameFunc(const testing::TestParamInfo<std::string>& info) {
|
||||||
return info.param;
|
return info.param;
|
||||||
}
|
}
|
||||||
|
@ -779,8 +769,6 @@ INSTANTIATE_TEST_CASE_P(PrintingStrings,
|
||||||
testing::Values(std::string("a")),
|
testing::Values(std::string("a")),
|
||||||
ParamNameFunc);
|
ParamNameFunc);
|
||||||
|
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
// This #ifdef block tests the output of typed tests.
|
// This #ifdef block tests the output of typed tests.
|
||||||
#if GTEST_HAS_TYPED_TEST
|
#if GTEST_HAS_TYPED_TEST
|
||||||
|
|
||||||
|
|
|
@ -34,15 +34,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
// 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
|
|
||||||
// their code.
|
|
||||||
#define GTEST_IMPLEMENTATION_ 1
|
|
||||||
#include "src/gtest-internal-inl.h"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
|
@ -119,7 +111,6 @@ TEST(BarDeathTest, ThreadSafeAndFast) {
|
||||||
EXPECT_DEATH_IF_SUPPORTED(::testing::internal::posix::Abort(), "");
|
EXPECT_DEATH_IF_SUPPORTED(::testing::internal::posix::Abort(), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
int g_param_test_count = 0;
|
int g_param_test_count = 0;
|
||||||
|
|
||||||
const int kNumberOfParamTests = 10;
|
const int kNumberOfParamTests = 10;
|
||||||
|
@ -135,7 +126,6 @@ TEST_P(MyParamTest, ShouldPass) {
|
||||||
INSTANTIATE_TEST_CASE_P(MyParamSequence,
|
INSTANTIATE_TEST_CASE_P(MyParamSequence,
|
||||||
MyParamTest,
|
MyParamTest,
|
||||||
testing::Range(0, kNumberOfParamTests));
|
testing::Range(0, kNumberOfParamTests));
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
|
|
||||||
// Resets the count for each test.
|
// Resets the count for each test.
|
||||||
void ResetCounts() {
|
void ResetCounts() {
|
||||||
|
@ -144,9 +134,7 @@ void ResetCounts() {
|
||||||
g_should_fail_count = 0;
|
g_should_fail_count = 0;
|
||||||
g_should_pass_count = 0;
|
g_should_pass_count = 0;
|
||||||
g_death_test_count = 0;
|
g_death_test_count = 0;
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
g_param_test_count = 0;
|
g_param_test_count = 0;
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks that the count for each test is expected.
|
// Checks that the count for each test is expected.
|
||||||
|
@ -156,9 +144,7 @@ void CheckCounts(int expected) {
|
||||||
GTEST_CHECK_INT_EQ_(expected, g_should_fail_count);
|
GTEST_CHECK_INT_EQ_(expected, g_should_fail_count);
|
||||||
GTEST_CHECK_INT_EQ_(expected, g_should_pass_count);
|
GTEST_CHECK_INT_EQ_(expected, g_should_pass_count);
|
||||||
GTEST_CHECK_INT_EQ_(expected, g_death_test_count);
|
GTEST_CHECK_INT_EQ_(expected, g_death_test_count);
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
GTEST_CHECK_INT_EQ_(expected * kNumberOfParamTests, g_param_test_count);
|
GTEST_CHECK_INT_EQ_(expected * kNumberOfParamTests, g_param_test_count);
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests the behavior of Google Test when --gtest_repeat is not specified.
|
// Tests the behavior of Google Test when --gtest_repeat is not specified.
|
||||||
|
@ -201,9 +187,7 @@ void TestRepeatWithFilterForSuccessfulTests(int repeat) {
|
||||||
GTEST_CHECK_INT_EQ_(0, g_should_fail_count);
|
GTEST_CHECK_INT_EQ_(0, g_should_fail_count);
|
||||||
GTEST_CHECK_INT_EQ_(repeat, g_should_pass_count);
|
GTEST_CHECK_INT_EQ_(repeat, g_should_pass_count);
|
||||||
GTEST_CHECK_INT_EQ_(repeat, g_death_test_count);
|
GTEST_CHECK_INT_EQ_(repeat, g_death_test_count);
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
GTEST_CHECK_INT_EQ_(repeat * kNumberOfParamTests, g_param_test_count);
|
GTEST_CHECK_INT_EQ_(repeat * kNumberOfParamTests, g_param_test_count);
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using --gtest_repeat when --gtest_filter specifies a set of
|
// Tests using --gtest_repeat when --gtest_filter specifies a set of
|
||||||
|
@ -219,15 +203,14 @@ void TestRepeatWithFilterForFailedTests(int repeat) {
|
||||||
GTEST_CHECK_INT_EQ_(repeat, g_should_fail_count);
|
GTEST_CHECK_INT_EQ_(repeat, g_should_fail_count);
|
||||||
GTEST_CHECK_INT_EQ_(0, g_should_pass_count);
|
GTEST_CHECK_INT_EQ_(0, g_should_pass_count);
|
||||||
GTEST_CHECK_INT_EQ_(0, g_death_test_count);
|
GTEST_CHECK_INT_EQ_(0, g_death_test_count);
|
||||||
#if GTEST_HAS_PARAM_TEST
|
|
||||||
GTEST_CHECK_INT_EQ_(0, g_param_test_count);
|
GTEST_CHECK_INT_EQ_(0, g_param_test_count);
|
||||||
#endif // GTEST_HAS_PARAM_TEST
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
testing::InitGoogleTest(&argc, argv);
|
testing::InitGoogleTest(&argc, argv);
|
||||||
|
|
||||||
testing::AddGlobalTestEnvironment(new MyEnvironment);
|
testing::AddGlobalTestEnvironment(new MyEnvironment);
|
||||||
|
|
||||||
TestRepeatUnspecified();
|
TestRepeatUnspecified();
|
||||||
|
|
|
@ -34,15 +34,9 @@
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// We must define this macro in order to #include
|
|
||||||
// gtest-internal-inl.h. This is how Google Test prevents a user from
|
|
||||||
// accidentally depending on its internal implementation.
|
|
||||||
#define GTEST_IMPLEMENTATION_ 1
|
|
||||||
#include "src/gtest-internal-inl.h"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
#if GTEST_IS_THREADSAFE
|
#if GTEST_IS_THREADSAFE
|
||||||
|
|
||||||
|
|
|
@ -66,15 +66,7 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) {
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
#include "gtest/gtest-spi.h"
|
#include "gtest/gtest-spi.h"
|
||||||
|
|
||||||
// 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
|
|
||||||
// their code.
|
|
||||||
#define GTEST_IMPLEMENTATION_ 1
|
|
||||||
#include "src/gtest-internal-inl.h"
|
#include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Author: keith.ray@gmail.com (Keith Ray)
|
|
||||||
//
|
//
|
||||||
// gtest_xml_outfile1_test_ writes some xml via TestProperty used by
|
// gtest_xml_outfile1_test_ writes some xml via TestProperty used by
|
||||||
// gtest_xml_outfiles_test.py
|
// gtest_xml_outfiles_test.py
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Author: keith.ray@gmail.com (Keith Ray)
|
|
||||||
//
|
//
|
||||||
// gtest_xml_outfile2_test_ writes some xml via TestProperty used by
|
// gtest_xml_outfile2_test_ writes some xml via TestProperty used by
|
||||||
// gtest_xml_outfiles_test.py
|
// gtest_xml_outfiles_test.py
|
||||||
|
|
|
@ -27,8 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Author: eefacm@gmail.com (Sean Mcafee)
|
|
||||||
|
|
||||||
// Unit test for Google Test XML output.
|
// Unit test for Google Test XML output.
|
||||||
//
|
//
|
||||||
// A user can specify XML output in a Google Test program to run via
|
// A user can specify XML output in a Google Test program to run via
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
//
|
//
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
// Author: wan@google.com (Zhanyong Wan)
|
||||||
//
|
//
|
||||||
// This is part of the unit test for include/gtest/gtest_prod.h.
|
// This is part of the unit test for gtest_prod.h.
|
||||||
|
|
||||||
#include "production.h"
|
#include "production.h"
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
//
|
//
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
// Author: wan@google.com (Zhanyong Wan)
|
||||||
//
|
//
|
||||||
// This is part of the unit test for include/gtest/gtest_prod.h.
|
// This is part of the unit test for gtest_prod.h.
|
||||||
|
|
||||||
#ifndef GTEST_TEST_PRODUCTION_H_
|
#ifndef GTEST_TEST_PRODUCTION_H_
|
||||||
#define GTEST_TEST_PRODUCTION_H_
|
#define GTEST_TEST_PRODUCTION_H_
|
||||||
|
|
Loading…
Reference in New Issue
Block a user