Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- data/miniconda3/pkgs/cuda-compiler-12.8.1-0/info/index.json +18 -0
- data/miniconda3/pkgs/cuda-compiler-12.8.1-0/info/licenses/LICENSE.txt +1632 -0
- data/miniconda3/pkgs/cuda-compiler-12.8.1-0/info/test/run_test.sh +11 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock-actions.h +1687 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock-cardinalities.h +157 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock-function-mocker.h +479 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock-matchers.h +0 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock-more-actions.h +573 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock-more-matchers.h +92 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock-nice-strict.h +261 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock-spec-builders.h +2038 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock.h +98 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-death-test.h +346 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-matchers.h +930 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-message.h +219 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-param-test.h +507 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-printers.h +1029 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-spi.h +238 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-test-part.h +184 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-typed-test.h +329 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest.h +2495 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest_pred_impl.h +359 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest_prod.h +61 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/anchor.h +17 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/binary.h +71 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/contrib/anchordict.h +40 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/contrib/graphbuilder.h +149 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/depthguard.h +77 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/dll.h +61 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/emitfromevents.h +57 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/emitter.h +281 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/emitterdef.h +16 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/emittermanip.h +144 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/emitterstyle.h +16 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/eventhandler.h +45 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/exceptions.h +303 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/mark.h +29 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/convert.h +469 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/detail/iterator.h +96 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/detail/node.h +177 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/detail/node_data.h +127 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/emit.h +32 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/impl.h +385 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/iterator.h +34 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/node.h +148 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/parse.h +78 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/ptr.h +28 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/type.h +16 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/noexcept.h +18 -0
- data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/null.h +26 -0
data/miniconda3/pkgs/cuda-compiler-12.8.1-0/info/index.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"arch": "x86_64",
|
| 3 |
+
"build": "0",
|
| 4 |
+
"build_number": 0,
|
| 5 |
+
"depends": [
|
| 6 |
+
"__linux",
|
| 7 |
+
"cuda-cuobjdump 12.8.90.*",
|
| 8 |
+
"cuda-cuxxfilt 12.8.90.*",
|
| 9 |
+
"cuda-nvcc 12.8.93.*",
|
| 10 |
+
"cuda-nvprune 12.8.90.*"
|
| 11 |
+
],
|
| 12 |
+
"license": "LicenseRef-NVIDIA-End-User-License-Agreement",
|
| 13 |
+
"name": "cuda-compiler",
|
| 14 |
+
"platform": "linux",
|
| 15 |
+
"subdir": "linux-64",
|
| 16 |
+
"timestamp": 1741064439932,
|
| 17 |
+
"version": "12.8.1"
|
| 18 |
+
}
|
data/miniconda3/pkgs/cuda-compiler-12.8.1-0/info/licenses/LICENSE.txt
ADDED
|
@@ -0,0 +1,1632 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
End User License Agreement
|
| 2 |
+
--------------------------
|
| 3 |
+
|
| 4 |
+
NVIDIA Software License Agreement and CUDA Supplement to
|
| 5 |
+
Software License Agreement.
|
| 6 |
+
|
| 7 |
+
The CUDA Toolkit End User License Agreement applies to the
|
| 8 |
+
NVIDIA CUDA Toolkit, the NVIDIA CUDA Samples, the NVIDIA
|
| 9 |
+
Display Driver, NVIDIA Nsight tools (Visual Studio Edition),
|
| 10 |
+
and the associated documentation on CUDA APIs, programming
|
| 11 |
+
model and development tools. If you do not agree with the
|
| 12 |
+
terms and conditions of the license agreement, then do not
|
| 13 |
+
download or use the software.
|
| 14 |
+
|
| 15 |
+
Last updated: January 12, 2024.
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
Preface
|
| 19 |
+
-------
|
| 20 |
+
|
| 21 |
+
The Software License Agreement in Chapter 1 and the Supplement
|
| 22 |
+
in Chapter 2 contain license terms and conditions that govern
|
| 23 |
+
the use of NVIDIA toolkit. By accepting this agreement, you
|
| 24 |
+
agree to comply with all the terms and conditions applicable
|
| 25 |
+
to the product(s) included herein.
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
NVIDIA Driver
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
Description
|
| 32 |
+
|
| 33 |
+
This package contains the operating system driver and
|
| 34 |
+
fundamental system software components for NVIDIA GPUs.
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
NVIDIA CUDA Toolkit
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
Description
|
| 41 |
+
|
| 42 |
+
The NVIDIA CUDA Toolkit provides command-line and graphical
|
| 43 |
+
tools for building, debugging and optimizing the performance
|
| 44 |
+
of applications accelerated by NVIDIA GPUs, runtime and math
|
| 45 |
+
libraries, and documentation including programming guides,
|
| 46 |
+
user manuals, and API references.
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
Default Install Location of CUDA Toolkit
|
| 50 |
+
|
| 51 |
+
Windows platform:
|
| 52 |
+
|
| 53 |
+
%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v#.#
|
| 54 |
+
|
| 55 |
+
Linux platform:
|
| 56 |
+
|
| 57 |
+
/usr/local/cuda-#.#
|
| 58 |
+
|
| 59 |
+
Mac platform:
|
| 60 |
+
|
| 61 |
+
/Developer/NVIDIA/CUDA-#.#
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
NVIDIA CUDA Samples
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
Description
|
| 68 |
+
|
| 69 |
+
CUDA Samples are now located in
|
| 70 |
+
https://github.com/nvidia/cuda-samples, which includes
|
| 71 |
+
instructions for obtaining, building, and running the samples.
|
| 72 |
+
They are no longer included in the CUDA toolkit.
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
NVIDIA Nsight Visual Studio Edition (Windows only)
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
Description
|
| 79 |
+
|
| 80 |
+
NVIDIA Nsight Development Platform, Visual Studio Edition is a
|
| 81 |
+
development environment integrated into Microsoft Visual
|
| 82 |
+
Studio that provides tools for debugging, profiling, analyzing
|
| 83 |
+
and optimizing your GPU computing and graphics applications.
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
Default Install Location of Nsight Visual Studio Edition
|
| 87 |
+
|
| 88 |
+
Windows platform:
|
| 89 |
+
|
| 90 |
+
%ProgramFiles(x86)%\NVIDIA Corporation\Nsight Visual Studio Edition #.#
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
1. License Agreement for NVIDIA Software Development Kits
|
| 94 |
+
---------------------------------------------------------
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
Important Notice—Read before downloading, installing,
|
| 98 |
+
copying or using the licensed software:
|
| 99 |
+
-------------------------------------------------------
|
| 100 |
+
|
| 101 |
+
This license agreement, including exhibits attached
|
| 102 |
+
("Agreement”) is a legal agreement between you and NVIDIA
|
| 103 |
+
Corporation ("NVIDIA") and governs your use of a NVIDIA
|
| 104 |
+
software development kit (“SDK”).
|
| 105 |
+
|
| 106 |
+
Each SDK has its own set of software and materials, but here
|
| 107 |
+
is a description of the types of items that may be included in
|
| 108 |
+
a SDK: source code, header files, APIs, data sets and assets
|
| 109 |
+
(examples include images, textures, models, scenes, videos,
|
| 110 |
+
native API input/output files), binary software, sample code,
|
| 111 |
+
libraries, utility programs, programming code and
|
| 112 |
+
documentation.
|
| 113 |
+
|
| 114 |
+
This Agreement can be accepted only by an adult of legal age
|
| 115 |
+
of majority in the country in which the SDK is used.
|
| 116 |
+
|
| 117 |
+
If you are entering into this Agreement on behalf of a company
|
| 118 |
+
or other legal entity, you represent that you have the legal
|
| 119 |
+
authority to bind the entity to this Agreement, in which case
|
| 120 |
+
“you” will mean the entity you represent.
|
| 121 |
+
|
| 122 |
+
If you don’t have the required age or authority to accept
|
| 123 |
+
this Agreement, or if you don’t accept all the terms and
|
| 124 |
+
conditions of this Agreement, do not download, install or use
|
| 125 |
+
the SDK.
|
| 126 |
+
|
| 127 |
+
You agree to use the SDK only for purposes that are permitted
|
| 128 |
+
by (a) this Agreement, and (b) any applicable law, regulation
|
| 129 |
+
or generally accepted practices or guidelines in the relevant
|
| 130 |
+
jurisdictions.
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
1.1. License
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
1.1.1. License Grant
|
| 137 |
+
|
| 138 |
+
Subject to the terms of this Agreement, NVIDIA hereby grants
|
| 139 |
+
you a non-exclusive, non-transferable license, without the
|
| 140 |
+
right to sublicense (except as expressly provided in this
|
| 141 |
+
Agreement) to:
|
| 142 |
+
|
| 143 |
+
1. Install and use the SDK,
|
| 144 |
+
|
| 145 |
+
2. Modify and create derivative works of sample source code
|
| 146 |
+
delivered in the SDK, and
|
| 147 |
+
|
| 148 |
+
3. Distribute those portions of the SDK that are identified
|
| 149 |
+
in this Agreement as distributable, as incorporated in
|
| 150 |
+
object code format into a software application that meets
|
| 151 |
+
the distribution requirements indicated in this Agreement.
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
1.1.2. Distribution Requirements
|
| 155 |
+
|
| 156 |
+
These are the distribution requirements for you to exercise
|
| 157 |
+
the distribution grant:
|
| 158 |
+
|
| 159 |
+
1. Your application must have material additional
|
| 160 |
+
functionality, beyond the included portions of the SDK.
|
| 161 |
+
|
| 162 |
+
2. The distributable portions of the SDK shall only be
|
| 163 |
+
accessed by your application.
|
| 164 |
+
|
| 165 |
+
3. The following notice shall be included in modifications
|
| 166 |
+
and derivative works of sample source code distributed:
|
| 167 |
+
“This software contains source code provided by NVIDIA
|
| 168 |
+
Corporation.”
|
| 169 |
+
|
| 170 |
+
4. Unless a developer tool is identified in this Agreement
|
| 171 |
+
as distributable, it is delivered for your internal use
|
| 172 |
+
only.
|
| 173 |
+
|
| 174 |
+
5. The terms under which you distribute your application
|
| 175 |
+
must be consistent with the terms of this Agreement,
|
| 176 |
+
including (without limitation) terms relating to the
|
| 177 |
+
license grant and license restrictions and protection of
|
| 178 |
+
NVIDIA’s intellectual property rights. Additionally, you
|
| 179 |
+
agree that you will protect the privacy, security and
|
| 180 |
+
legal rights of your application users.
|
| 181 |
+
|
| 182 |
+
6. You agree to notify NVIDIA in writing of any known or
|
| 183 |
+
suspected distribution or use of the SDK not in compliance
|
| 184 |
+
with the requirements of this Agreement, and to enforce
|
| 185 |
+
the terms of your agreements with respect to distributed
|
| 186 |
+
SDK.
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
1.1.3. Authorized Users
|
| 190 |
+
|
| 191 |
+
You may allow employees and contractors of your entity or of
|
| 192 |
+
your subsidiary(ies) to access and use the SDK from your
|
| 193 |
+
secure network to perform work on your behalf.
|
| 194 |
+
|
| 195 |
+
If you are an academic institution you may allow users
|
| 196 |
+
enrolled or employed by the academic institution to access and
|
| 197 |
+
use the SDK from your secure network.
|
| 198 |
+
|
| 199 |
+
You are responsible for the compliance with the terms of this
|
| 200 |
+
Agreement by your authorized users. If you become aware that
|
| 201 |
+
your authorized users didn’t follow the terms of this
|
| 202 |
+
Agreement, you agree to take reasonable steps to resolve the
|
| 203 |
+
non-compliance and prevent new occurrences.
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
1.1.4. Pre-Release SDK
|
| 207 |
+
|
| 208 |
+
The SDK versions identified as alpha, beta, preview or
|
| 209 |
+
otherwise as pre-release, may not be fully functional, may
|
| 210 |
+
contain errors or design flaws, and may have reduced or
|
| 211 |
+
different security, privacy, accessibility, availability, and
|
| 212 |
+
reliability standards relative to commercial versions of
|
| 213 |
+
NVIDIA software and materials. Use of a pre-release SDK may
|
| 214 |
+
result in unexpected results, loss of data, project delays or
|
| 215 |
+
other unpredictable damage or loss.
|
| 216 |
+
|
| 217 |
+
You may use a pre-release SDK at your own risk, understanding
|
| 218 |
+
that pre-release SDKs are not intended for use in production
|
| 219 |
+
or business-critical systems.
|
| 220 |
+
|
| 221 |
+
NVIDIA may choose not to make available a commercial version
|
| 222 |
+
of any pre-release SDK. NVIDIA may also choose to abandon
|
| 223 |
+
development and terminate the availability of a pre-release
|
| 224 |
+
SDK at any time without liability.
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
1.1.5. Updates
|
| 228 |
+
|
| 229 |
+
NVIDIA may, at its option, make available patches, workarounds
|
| 230 |
+
or other updates to this SDK. Unless the updates are provided
|
| 231 |
+
with their separate governing terms, they are deemed part of
|
| 232 |
+
the SDK licensed to you as provided in this Agreement. You
|
| 233 |
+
agree that the form and content of the SDK that NVIDIA
|
| 234 |
+
provides may change without prior notice to you. While NVIDIA
|
| 235 |
+
generally maintains compatibility between versions, NVIDIA may
|
| 236 |
+
in some cases make changes that introduce incompatibilities in
|
| 237 |
+
future versions of the SDK.
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
1.1.6. Components Under Other Licenses
|
| 241 |
+
|
| 242 |
+
The SDK may come bundled with, or otherwise include or be
|
| 243 |
+
distributed with, NVIDIA or third-party components with
|
| 244 |
+
separate legal notices or terms as may be described in
|
| 245 |
+
proprietary notices accompanying the SDK. If and to the extent
|
| 246 |
+
there is a conflict between the terms in this Agreement and
|
| 247 |
+
the license terms associated with the component, the license
|
| 248 |
+
terms associated with the components control only to the
|
| 249 |
+
extent necessary to resolve the conflict.
|
| 250 |
+
|
| 251 |
+
Subject to the other terms of this Agreement, you may use the
|
| 252 |
+
SDK to develop and test applications released under Open
|
| 253 |
+
Source Initiative (OSI) approved open source software
|
| 254 |
+
licenses.
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
1.1.7. Reservation of Rights
|
| 258 |
+
|
| 259 |
+
NVIDIA reserves all rights, title, and interest in and to the
|
| 260 |
+
SDK, not expressly granted to you under this Agreement.
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
1.2. Limitations
|
| 264 |
+
|
| 265 |
+
The following license limitations apply to your use of the
|
| 266 |
+
SDK:
|
| 267 |
+
|
| 268 |
+
1. You may not reverse engineer, decompile or disassemble,
|
| 269 |
+
or remove copyright or other proprietary notices from any
|
| 270 |
+
portion of the SDK or copies of the SDK.
|
| 271 |
+
|
| 272 |
+
2. Except as expressly provided in this Agreement, you may
|
| 273 |
+
not copy, sell, rent, sublicense, transfer, distribute,
|
| 274 |
+
modify, or create derivative works of any portion of the
|
| 275 |
+
SDK. For clarity, you may not distribute or sublicense the
|
| 276 |
+
SDK as a stand-alone product.
|
| 277 |
+
|
| 278 |
+
3. Unless you have an agreement with NVIDIA for this
|
| 279 |
+
purpose, you may not indicate that an application created
|
| 280 |
+
with the SDK is sponsored or endorsed by NVIDIA.
|
| 281 |
+
|
| 282 |
+
4. You may not bypass, disable, or circumvent any
|
| 283 |
+
encryption, security, digital rights management or
|
| 284 |
+
authentication mechanism in the SDK.
|
| 285 |
+
|
| 286 |
+
5. You may not use the SDK in any manner that would cause it
|
| 287 |
+
to become subject to an open source software license. As
|
| 288 |
+
examples, licenses that require as a condition of use,
|
| 289 |
+
modification, and/or distribution that the SDK be:
|
| 290 |
+
|
| 291 |
+
a. Disclosed or distributed in source code form;
|
| 292 |
+
|
| 293 |
+
b. Licensed for the purpose of making derivative works;
|
| 294 |
+
or
|
| 295 |
+
|
| 296 |
+
c. Redistributable at no charge.
|
| 297 |
+
|
| 298 |
+
6. You acknowledge that the SDK as delivered is not tested
|
| 299 |
+
or certified by NVIDIA for use in connection with the
|
| 300 |
+
design, construction, maintenance, and/or operation of any
|
| 301 |
+
system where the use or failure of such system could
|
| 302 |
+
result in a situation that threatens the safety of human
|
| 303 |
+
life or results in catastrophic damages (each, a "Critical
|
| 304 |
+
Application"). Examples of Critical Applications include
|
| 305 |
+
use in avionics, navigation, autonomous vehicle
|
| 306 |
+
applications, ai solutions for automotive products,
|
| 307 |
+
military, medical, life support or other life critical
|
| 308 |
+
applications. NVIDIA shall not be liable to you or any
|
| 309 |
+
third party, in whole or in part, for any claims or
|
| 310 |
+
damages arising from such uses. You are solely responsible
|
| 311 |
+
for ensuring that any product or service developed with
|
| 312 |
+
the SDK as a whole includes sufficient features to comply
|
| 313 |
+
with all applicable legal and regulatory standards and
|
| 314 |
+
requirements.
|
| 315 |
+
|
| 316 |
+
7. You agree to defend, indemnify and hold harmless NVIDIA
|
| 317 |
+
and its affiliates, and their respective employees,
|
| 318 |
+
contractors, agents, officers and directors, from and
|
| 319 |
+
against any and all claims, damages, obligations, losses,
|
| 320 |
+
liabilities, costs or debt, fines, restitutions and
|
| 321 |
+
expenses (including but not limited to attorney’s fees
|
| 322 |
+
and costs incident to establishing the right of
|
| 323 |
+
indemnification) arising out of or related to products or
|
| 324 |
+
services that use the SDK in or for Critical Applications,
|
| 325 |
+
and for use of the SDK outside of the scope of this
|
| 326 |
+
Agreement or not in compliance with its terms.
|
| 327 |
+
|
| 328 |
+
8. You may not reverse engineer, decompile or disassemble
|
| 329 |
+
any portion of the output generated using SDK elements for
|
| 330 |
+
the purpose of translating such output artifacts to target
|
| 331 |
+
a non-NVIDIA platform.
|
| 332 |
+
|
| 333 |
+
|
| 334 |
+
1.3. Ownership
|
| 335 |
+
|
| 336 |
+
1. NVIDIA or its licensors hold all rights, title and
|
| 337 |
+
interest in and to the SDK and its modifications and
|
| 338 |
+
derivative works, including their respective intellectual
|
| 339 |
+
property rights, subject to your rights under Section
|
| 340 |
+
1.3.2. This SDK may include software and materials from
|
| 341 |
+
NVIDIA’s licensors, and these licensors are intended
|
| 342 |
+
third party beneficiaries that may enforce this Agreement
|
| 343 |
+
with respect to their intellectual property rights.
|
| 344 |
+
|
| 345 |
+
2. You hold all rights, title and interest in and to your
|
| 346 |
+
applications and your derivative works of the sample
|
| 347 |
+
source code delivered in the SDK, including their
|
| 348 |
+
respective intellectual property rights, subject to
|
| 349 |
+
NVIDIA’s rights under Section 1.3.1.
|
| 350 |
+
|
| 351 |
+
3. You may, but don’t have to, provide to NVIDIA
|
| 352 |
+
suggestions, feature requests or other feedback regarding
|
| 353 |
+
the SDK, including possible enhancements or modifications
|
| 354 |
+
to the SDK. For any feedback that you voluntarily provide,
|
| 355 |
+
you hereby grant NVIDIA and its affiliates a perpetual,
|
| 356 |
+
non-exclusive, worldwide, irrevocable license to use,
|
| 357 |
+
reproduce, modify, license, sublicense (through multiple
|
| 358 |
+
tiers of sublicensees), and distribute (through multiple
|
| 359 |
+
tiers of distributors) it without the payment of any
|
| 360 |
+
royalties or fees to you. NVIDIA will use feedback at its
|
| 361 |
+
choice. NVIDIA is constantly looking for ways to improve
|
| 362 |
+
its products, so you may send feedback to NVIDIA through
|
| 363 |
+
the developer portal at https://developer.nvidia.com.
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
1.4. No Warranties
|
| 367 |
+
|
| 368 |
+
THE SDK IS PROVIDED BY NVIDIA “AS IS” AND “WITH ALL
|
| 369 |
+
FAULTS.” TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND
|
| 370 |
+
ITS AFFILIATES EXPRESSLY DISCLAIM ALL WARRANTIES OF ANY KIND
|
| 371 |
+
OR NATURE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING,
|
| 372 |
+
BUT NOT LIMITED TO, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
|
| 373 |
+
FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, OR THE
|
| 374 |
+
ABSENCE OF ANY DEFECTS THEREIN, WHETHER LATENT OR PATENT. NO
|
| 375 |
+
WARRANTY IS MADE ON THE BASIS OF TRADE USAGE, COURSE OF
|
| 376 |
+
DEALING OR COURSE OF TRADE.
|
| 377 |
+
|
| 378 |
+
|
| 379 |
+
1.5. Limitation of Liability
|
| 380 |
+
|
| 381 |
+
TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND ITS
|
| 382 |
+
AFFILIATES SHALL NOT BE LIABLE FOR ANY (I) SPECIAL, INCIDENTAL,
|
| 383 |
+
PUNITIVE OR CONSEQUENTIAL DAMAGES, OR (II) DAMAGES FOR (A) ANY
|
| 384 |
+
LOST PROFITS, LOSS OF USE, LOSS OF DATA OR LOSS OF GOODWILL,
|
| 385 |
+
OR THE COSTS OF PROCURING SUBSTITUTE PRODUCTS, ARISING OUT OF
|
| 386 |
+
OR IN CONNECTION WITH THIS AGREEMENT OR THE USE OR PERFORMANCE
|
| 387 |
+
OF THE SDK, WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED
|
| 388 |
+
UPON BREACH OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING
|
| 389 |
+
NEGLIGENCE), PRODUCT LIABILITY OR ANY OTHER CAUSE OF ACTION OR
|
| 390 |
+
THEORY OF LIABILITY. IN NO EVENT WILL NVIDIA’S AND ITS AFFILIATES
|
| 391 |
+
TOTAL CUMULATIVE LIABILITY UNDER OR ARISING OUT OF THIS
|
| 392 |
+
AGREEMENT EXCEED US$10.00. THE NATURE OF THE LIABILITY OR THE
|
| 393 |
+
NUMBER OF CLAIMS OR SUITS SHALL NOT ENLARGE OR EXTEND THIS
|
| 394 |
+
LIMIT.
|
| 395 |
+
|
| 396 |
+
These exclusions and limitations of liability shall apply
|
| 397 |
+
regardless if NVIDIA or its affiliates have been advised of
|
| 398 |
+
the possibility of such damages, and regardless of whether a
|
| 399 |
+
remedy fails its essential purpose. These exclusions and
|
| 400 |
+
limitations of liability form an essential basis of the
|
| 401 |
+
bargain between the parties, and, absent any of these
|
| 402 |
+
exclusions or limitations of liability, the provisions of this
|
| 403 |
+
Agreement, including, without limitation, the economic terms,
|
| 404 |
+
would be substantially different.
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
1.6. Termination
|
| 408 |
+
|
| 409 |
+
1. This Agreement will continue to apply until terminated by
|
| 410 |
+
either you or NVIDIA as described below.
|
| 411 |
+
|
| 412 |
+
2. If you want to terminate this Agreement, you may do so by
|
| 413 |
+
stopping to use the SDK.
|
| 414 |
+
|
| 415 |
+
3. NVIDIA may, at any time, terminate this Agreement if:
|
| 416 |
+
|
| 417 |
+
a. (i) you fail to comply with any term of this
|
| 418 |
+
Agreement and the non-compliance is not fixed within
|
| 419 |
+
thirty (30) days following notice from NVIDIA (or
|
| 420 |
+
immediately if you violate NVIDIA’s intellectual
|
| 421 |
+
property rights);
|
| 422 |
+
|
| 423 |
+
b. (ii) you commence or participate in any legal
|
| 424 |
+
proceeding against NVIDIA with respect to the SDK; or
|
| 425 |
+
|
| 426 |
+
c. (iii) NVIDIA decides to no longer provide the SDK in
|
| 427 |
+
a country or, in NVIDIA’s sole discretion, the
|
| 428 |
+
continued use of it is no longer commercially viable.
|
| 429 |
+
|
| 430 |
+
4. Upon any termination of this Agreement, you agree to
|
| 431 |
+
promptly discontinue use of the SDK and destroy all copies
|
| 432 |
+
in your possession or control. Your prior distributions in
|
| 433 |
+
accordance with this Agreement are not affected by the
|
| 434 |
+
termination of this Agreement. Upon written request, you
|
| 435 |
+
will certify in writing that you have complied with your
|
| 436 |
+
commitments under this section. Upon any termination of
|
| 437 |
+
this Agreement all provisions survive except for the
|
| 438 |
+
license grant provisions.
|
| 439 |
+
|
| 440 |
+
|
| 441 |
+
1.7. General
|
| 442 |
+
|
| 443 |
+
If you wish to assign this Agreement or your rights and
|
| 444 |
+
obligations, including by merger, consolidation, dissolution
|
| 445 |
+
or operation of law, contact NVIDIA to ask for permission. Any
|
| 446 |
+
attempted assignment not approved by NVIDIA in writing shall
|
| 447 |
+
be void and of no effect. NVIDIA may assign, delegate or
|
| 448 |
+
transfer this Agreement and its rights and obligations, and if
|
| 449 |
+
to a non-affiliate you will be notified.
|
| 450 |
+
|
| 451 |
+
You agree to cooperate with NVIDIA and provide reasonably
|
| 452 |
+
requested information to verify your compliance with this
|
| 453 |
+
Agreement.
|
| 454 |
+
|
| 455 |
+
This Agreement will be governed in all respects by the laws of
|
| 456 |
+
the United States and of the State of Delaware, without regard to the
|
| 457 |
+
conflicts of laws principles. The United Nations Convention on
|
| 458 |
+
Contracts for the International Sale of Goods is specifically
|
| 459 |
+
disclaimed. You agree to all terms of this Agreement in the
|
| 460 |
+
English language.
|
| 461 |
+
|
| 462 |
+
The state or federal courts residing in Santa Clara County,
|
| 463 |
+
California shall have exclusive jurisdiction over any dispute
|
| 464 |
+
or claim arising out of this Agreement. Notwithstanding this,
|
| 465 |
+
you agree that NVIDIA shall still be allowed to apply for
|
| 466 |
+
injunctive remedies or an equivalent type of urgent legal
|
| 467 |
+
relief in any jurisdiction.
|
| 468 |
+
|
| 469 |
+
If any court of competent jurisdiction determines that any
|
| 470 |
+
provision of this Agreement is illegal, invalid or
|
| 471 |
+
unenforceable, such provision will be construed as limited to
|
| 472 |
+
the extent necessary to be consistent with and fully
|
| 473 |
+
enforceable under the law and the remaining provisions will
|
| 474 |
+
remain in full force and effect. Unless otherwise specified,
|
| 475 |
+
remedies are cumulative.
|
| 476 |
+
|
| 477 |
+
Each party acknowledges and agrees that the other is an
|
| 478 |
+
independent contractor in the performance of this Agreement.
|
| 479 |
+
|
| 480 |
+
The SDK has been developed entirely at private expense and is
|
| 481 |
+
“commercial items” consisting of “commercial computer
|
| 482 |
+
software” and “commercial computer software
|
| 483 |
+
documentation” provided with RESTRICTED RIGHTS. Use,
|
| 484 |
+
duplication or disclosure by the U.S. Government or a U.S.
|
| 485 |
+
Government subcontractor is subject to the restrictions in
|
| 486 |
+
this Agreement pursuant to DFARS 227.7202-3(a) or as set forth
|
| 487 |
+
in subparagraphs (c)(1) and (2) of the Commercial Computer
|
| 488 |
+
Software - Restricted Rights clause at FAR 52.227-19, as
|
| 489 |
+
applicable. Contractor/manufacturer is NVIDIA, 2788 San Tomas
|
| 490 |
+
Expressway, Santa Clara, CA 95051.
|
| 491 |
+
|
| 492 |
+
The SDK is subject to United States export laws and
|
| 493 |
+
regulations. You agree that you will not ship, transfer or
|
| 494 |
+
export the SDK into any country, or use the SDK in any manner,
|
| 495 |
+
prohibited by the United States Bureau of Industry and
|
| 496 |
+
Security or economic sanctions regulations administered by the
|
| 497 |
+
U.S. Department of Treasury’s Office of Foreign Assets
|
| 498 |
+
Control (OFAC), or any applicable export laws, restrictions or
|
| 499 |
+
regulations. These laws include restrictions on destinations,
|
| 500 |
+
end users and end use. By accepting this Agreement, you
|
| 501 |
+
confirm that you are not located in a country currently
|
| 502 |
+
embargoed by the U.S. or otherwise prohibited from receiving
|
| 503 |
+
the SDK under U.S. law.
|
| 504 |
+
|
| 505 |
+
Any notice delivered by NVIDIA to you under this Agreement
|
| 506 |
+
will be delivered via mail, email or fax. You agree that any
|
| 507 |
+
notices that NVIDIA sends you electronically will satisfy any
|
| 508 |
+
legal communication requirements. Please direct your legal
|
| 509 |
+
notices or other correspondence to NVIDIA Corporation, 2788
|
| 510 |
+
San Tomas Expressway, Santa Clara, California 95051, United
|
| 511 |
+
States of America, Attention: Legal Department.
|
| 512 |
+
|
| 513 |
+
This Agreement and any exhibits incorporated into this
|
| 514 |
+
Agreement constitute the entire agreement of the parties with
|
| 515 |
+
respect to the subject matter of this Agreement and supersede
|
| 516 |
+
all prior negotiations or documentation exchanged between the
|
| 517 |
+
parties relating to this SDK license. Any additional and/or
|
| 518 |
+
conflicting terms on documents issued by you are null, void,
|
| 519 |
+
and invalid. Any amendment or waiver under this Agreement
|
| 520 |
+
shall be in writing and signed by representatives of both
|
| 521 |
+
parties.
|
| 522 |
+
|
| 523 |
+
|
| 524 |
+
2. CUDA Toolkit Supplement to Software License Agreement for
|
| 525 |
+
NVIDIA Software Development Kits
|
| 526 |
+
------------------------------------------------------------
|
| 527 |
+
|
| 528 |
+
The terms in this supplement govern your use of the NVIDIA
|
| 529 |
+
CUDA Toolkit SDK under the terms of your license agreement
|
| 530 |
+
(“Agreement”) as modified by this supplement. Capitalized
|
| 531 |
+
terms used but not defined below have the meaning assigned to
|
| 532 |
+
them in the Agreement.
|
| 533 |
+
|
| 534 |
+
This supplement is an exhibit to the Agreement and is
|
| 535 |
+
incorporated as an integral part of the Agreement. In the
|
| 536 |
+
event of conflict between the terms in this supplement and the
|
| 537 |
+
terms in the Agreement, the terms in this supplement govern.
|
| 538 |
+
|
| 539 |
+
|
| 540 |
+
2.1. License Scope
|
| 541 |
+
|
| 542 |
+
The SDK is licensed for you to develop applications only for
|
| 543 |
+
use in systems with NVIDIA GPUs.
|
| 544 |
+
|
| 545 |
+
|
| 546 |
+
2.2. Distribution
|
| 547 |
+
|
| 548 |
+
The portions of the SDK that are distributable under the
|
| 549 |
+
Agreement are listed in Attachment A.
|
| 550 |
+
|
| 551 |
+
|
| 552 |
+
2.3. Operating Systems
|
| 553 |
+
|
| 554 |
+
Those portions of the SDK designed exclusively for use on the
|
| 555 |
+
Linux or FreeBSD operating systems, or other operating systems
|
| 556 |
+
derived from the source code to these operating systems, may
|
| 557 |
+
be copied and redistributed for use in accordance with this
|
| 558 |
+
Agreement, provided that the object code files are not
|
| 559 |
+
modified in any way (except for unzipping of compressed
|
| 560 |
+
files).
|
| 561 |
+
|
| 562 |
+
|
| 563 |
+
2.4. Audio and Video Encoders and Decoders
|
| 564 |
+
|
| 565 |
+
You acknowledge and agree that it is your sole responsibility
|
| 566 |
+
to obtain any additional third-party licenses required to
|
| 567 |
+
make, have made, use, have used, sell, import, and offer for
|
| 568 |
+
sale your products or services that include or incorporate any
|
| 569 |
+
third-party software and content relating to audio and/or
|
| 570 |
+
video encoders and decoders from, including but not limited
|
| 571 |
+
to, Microsoft, Thomson, Fraunhofer IIS, Sisvel S.p.A.,
|
| 572 |
+
MPEG-LA, and Coding Technologies. NVIDIA does not grant to you
|
| 573 |
+
under this Agreement any necessary patent or other rights with
|
| 574 |
+
respect to any audio and/or video encoders and decoders.
|
| 575 |
+
|
| 576 |
+
|
| 577 |
+
2.5. Licensing
|
| 578 |
+
|
| 579 |
+
If the distribution terms in this Agreement are not suitable
|
| 580 |
+
for your organization, or for any questions regarding this
|
| 581 |
+
Agreement, please contact NVIDIA at
|
| 582 |
+
nvidia-compute-license-questions@nvidia.com.
|
| 583 |
+
|
| 584 |
+
|
| 585 |
+
2.6. Attachment A
|
| 586 |
+
|
| 587 |
+
The following CUDA Toolkit files may be distributed with
|
| 588 |
+
applications developed by you, including certain
|
| 589 |
+
variations of these files that have version number or
|
| 590 |
+
architecture specific information embedded in the file name -
|
| 591 |
+
as an example only, for release version 9.0 of the 64-bit
|
| 592 |
+
Windows software, the file cudart64_90.dll is redistributable.
|
| 593 |
+
|
| 594 |
+
Component
|
| 595 |
+
|
| 596 |
+
CUDA Runtime
|
| 597 |
+
|
| 598 |
+
Windows
|
| 599 |
+
|
| 600 |
+
cudart.dll, cudart_static.lib, cudadevrt.lib
|
| 601 |
+
|
| 602 |
+
Mac OSX
|
| 603 |
+
|
| 604 |
+
libcudart.dylib, libcudart_static.a, libcudadevrt.a
|
| 605 |
+
|
| 606 |
+
Linux
|
| 607 |
+
|
| 608 |
+
libcudart.so, libcudart_static.a, libcudadevrt.a
|
| 609 |
+
|
| 610 |
+
Android
|
| 611 |
+
|
| 612 |
+
libcudart.so, libcudart_static.a, libcudadevrt.a
|
| 613 |
+
|
| 614 |
+
Component
|
| 615 |
+
|
| 616 |
+
CUDA FFT Library
|
| 617 |
+
|
| 618 |
+
Windows
|
| 619 |
+
|
| 620 |
+
cufft.dll, cufftw.dll, cufft.lib, cufftw.lib
|
| 621 |
+
|
| 622 |
+
Mac OSX
|
| 623 |
+
|
| 624 |
+
libcufft.dylib, libcufft_static.a, libcufftw.dylib,
|
| 625 |
+
libcufftw_static.a
|
| 626 |
+
|
| 627 |
+
Linux
|
| 628 |
+
|
| 629 |
+
libcufft.so, libcufft_static.a, libcufftw.so,
|
| 630 |
+
libcufftw_static.a
|
| 631 |
+
|
| 632 |
+
Android
|
| 633 |
+
|
| 634 |
+
libcufft.so, libcufft_static.a, libcufftw.so,
|
| 635 |
+
libcufftw_static.a
|
| 636 |
+
|
| 637 |
+
Component
|
| 638 |
+
|
| 639 |
+
CUDA BLAS Library
|
| 640 |
+
|
| 641 |
+
Windows
|
| 642 |
+
|
| 643 |
+
cublas.dll, cublasLt.dll
|
| 644 |
+
|
| 645 |
+
Mac OSX
|
| 646 |
+
|
| 647 |
+
libcublas.dylib, libcublasLt.dylib, libcublas_static.a,
|
| 648 |
+
libcublasLt_static.a
|
| 649 |
+
|
| 650 |
+
Linux
|
| 651 |
+
|
| 652 |
+
libcublas.so, libcublasLt.so, libcublas_static.a,
|
| 653 |
+
libcublasLt_static.a
|
| 654 |
+
|
| 655 |
+
Android
|
| 656 |
+
|
| 657 |
+
libcublas.so, libcublasLt.so, libcublas_static.a,
|
| 658 |
+
libcublasLt_static.a
|
| 659 |
+
|
| 660 |
+
Component
|
| 661 |
+
|
| 662 |
+
NVIDIA "Drop-in" BLAS Library
|
| 663 |
+
|
| 664 |
+
Windows
|
| 665 |
+
|
| 666 |
+
nvblas.dll
|
| 667 |
+
|
| 668 |
+
Mac OSX
|
| 669 |
+
|
| 670 |
+
libnvblas.dylib
|
| 671 |
+
|
| 672 |
+
Linux
|
| 673 |
+
|
| 674 |
+
libnvblas.so
|
| 675 |
+
|
| 676 |
+
Component
|
| 677 |
+
|
| 678 |
+
CUDA Sparse Matrix Library
|
| 679 |
+
|
| 680 |
+
Windows
|
| 681 |
+
|
| 682 |
+
cusparse.dll, cusparse.lib
|
| 683 |
+
|
| 684 |
+
Mac OSX
|
| 685 |
+
|
| 686 |
+
libcusparse.dylib, libcusparse_static.a
|
| 687 |
+
|
| 688 |
+
Linux
|
| 689 |
+
|
| 690 |
+
libcusparse.so, libcusparse_static.a
|
| 691 |
+
|
| 692 |
+
Android
|
| 693 |
+
|
| 694 |
+
libcusparse.so, libcusparse_static.a
|
| 695 |
+
|
| 696 |
+
Component
|
| 697 |
+
|
| 698 |
+
CUDA Linear Solver Library
|
| 699 |
+
|
| 700 |
+
Windows
|
| 701 |
+
|
| 702 |
+
cusolver.dll, cusolver.lib
|
| 703 |
+
|
| 704 |
+
Mac OSX
|
| 705 |
+
|
| 706 |
+
libcusolver.dylib, libcusolver_static.a
|
| 707 |
+
|
| 708 |
+
Linux
|
| 709 |
+
|
| 710 |
+
libcusolver.so, libcusolver_static.a
|
| 711 |
+
|
| 712 |
+
Android
|
| 713 |
+
|
| 714 |
+
libcusolver.so, libcusolver_static.a
|
| 715 |
+
|
| 716 |
+
Component
|
| 717 |
+
|
| 718 |
+
CUDA Random Number Generation Library
|
| 719 |
+
|
| 720 |
+
Windows
|
| 721 |
+
|
| 722 |
+
curand.dll, curand.lib
|
| 723 |
+
|
| 724 |
+
Mac OSX
|
| 725 |
+
|
| 726 |
+
libcurand.dylib, libcurand_static.a
|
| 727 |
+
|
| 728 |
+
Linux
|
| 729 |
+
|
| 730 |
+
libcurand.so, libcurand_static.a
|
| 731 |
+
|
| 732 |
+
Android
|
| 733 |
+
|
| 734 |
+
libcurand.so, libcurand_static.a
|
| 735 |
+
|
| 736 |
+
Component
|
| 737 |
+
|
| 738 |
+
NVIDIA Performance Primitives Library
|
| 739 |
+
|
| 740 |
+
Windows
|
| 741 |
+
|
| 742 |
+
nppc.dll, nppc.lib, nppial.dll, nppial.lib, nppicc.dll,
|
| 743 |
+
nppicc.lib, nppicom.dll, nppicom.lib, nppidei.dll,
|
| 744 |
+
nppidei.lib, nppif.dll, nppif.lib, nppig.dll, nppig.lib,
|
| 745 |
+
nppim.dll, nppim.lib, nppist.dll, nppist.lib, nppisu.dll,
|
| 746 |
+
nppisu.lib, nppitc.dll, nppitc.lib, npps.dll, npps.lib
|
| 747 |
+
|
| 748 |
+
Mac OSX
|
| 749 |
+
|
| 750 |
+
libnppc.dylib, libnppc_static.a, libnppial.dylib,
|
| 751 |
+
libnppial_static.a, libnppicc.dylib, libnppicc_static.a,
|
| 752 |
+
libnppicom.dylib, libnppicom_static.a, libnppidei.dylib,
|
| 753 |
+
libnppidei_static.a, libnppif.dylib, libnppif_static.a,
|
| 754 |
+
libnppig.dylib, libnppig_static.a, libnppim.dylib,
|
| 755 |
+
libnppisu_static.a, libnppitc.dylib, libnppitc_static.a,
|
| 756 |
+
libnpps.dylib, libnpps_static.a
|
| 757 |
+
|
| 758 |
+
Linux
|
| 759 |
+
|
| 760 |
+
libnppc.so, libnppc_static.a, libnppial.so,
|
| 761 |
+
libnppial_static.a, libnppicc.so, libnppicc_static.a,
|
| 762 |
+
libnppicom.so, libnppicom_static.a, libnppidei.so,
|
| 763 |
+
libnppidei_static.a, libnppif.so, libnppif_static.a
|
| 764 |
+
libnppig.so, libnppig_static.a, libnppim.so,
|
| 765 |
+
libnppim_static.a, libnppist.so, libnppist_static.a,
|
| 766 |
+
libnppisu.so, libnppisu_static.a, libnppitc.so
|
| 767 |
+
libnppitc_static.a, libnpps.so, libnpps_static.a
|
| 768 |
+
|
| 769 |
+
Android
|
| 770 |
+
|
| 771 |
+
libnppc.so, libnppc_static.a, libnppial.so,
|
| 772 |
+
libnppial_static.a, libnppicc.so, libnppicc_static.a,
|
| 773 |
+
libnppicom.so, libnppicom_static.a, libnppidei.so,
|
| 774 |
+
libnppidei_static.a, libnppif.so, libnppif_static.a
|
| 775 |
+
libnppig.so, libnppig_static.a, libnppim.so,
|
| 776 |
+
libnppim_static.a, libnppist.so, libnppist_static.a,
|
| 777 |
+
libnppisu.so, libnppisu_static.a, libnppitc.so
|
| 778 |
+
libnppitc_static.a, libnpps.so, libnpps_static.a
|
| 779 |
+
|
| 780 |
+
Component
|
| 781 |
+
|
| 782 |
+
NVIDIA JPEG Library
|
| 783 |
+
|
| 784 |
+
Windows
|
| 785 |
+
|
| 786 |
+
nvjpeg.lib, nvjpeg.dll
|
| 787 |
+
|
| 788 |
+
Linux
|
| 789 |
+
|
| 790 |
+
libnvjpeg.so, libnvjpeg_static.a
|
| 791 |
+
|
| 792 |
+
Component
|
| 793 |
+
|
| 794 |
+
Internal common library required for statically linking to
|
| 795 |
+
cuBLAS, cuSPARSE, cuFFT, cuRAND, nvJPEG and NPP
|
| 796 |
+
|
| 797 |
+
Mac OSX
|
| 798 |
+
|
| 799 |
+
libculibos.a
|
| 800 |
+
|
| 801 |
+
Linux
|
| 802 |
+
|
| 803 |
+
libculibos.a
|
| 804 |
+
|
| 805 |
+
Component
|
| 806 |
+
|
| 807 |
+
NVIDIA Runtime Compilation Library and Header
|
| 808 |
+
|
| 809 |
+
All
|
| 810 |
+
|
| 811 |
+
nvrtc.h
|
| 812 |
+
|
| 813 |
+
Windows
|
| 814 |
+
|
| 815 |
+
nvrtc.dll, nvrtc-builtins.dll
|
| 816 |
+
|
| 817 |
+
Mac OSX
|
| 818 |
+
|
| 819 |
+
libnvrtc.dylib, libnvrtc-builtins.dylib
|
| 820 |
+
|
| 821 |
+
Linux
|
| 822 |
+
|
| 823 |
+
libnvrtc.so, libnvrtc-builtins.so, libnvrtc_static.a, libnvrtx-builtins_static.a
|
| 824 |
+
|
| 825 |
+
Component
|
| 826 |
+
|
| 827 |
+
NVIDIA Optimizing Compiler Library
|
| 828 |
+
|
| 829 |
+
Windows
|
| 830 |
+
|
| 831 |
+
nvvm.dll
|
| 832 |
+
|
| 833 |
+
Mac OSX
|
| 834 |
+
|
| 835 |
+
libnvvm.dylib
|
| 836 |
+
|
| 837 |
+
Linux
|
| 838 |
+
|
| 839 |
+
libnvvm.so
|
| 840 |
+
|
| 841 |
+
Component
|
| 842 |
+
|
| 843 |
+
NVIDIA JIT Linking Library
|
| 844 |
+
|
| 845 |
+
Windows
|
| 846 |
+
|
| 847 |
+
libnvJitLink.dll, libnvJitLink.lib
|
| 848 |
+
|
| 849 |
+
Linux
|
| 850 |
+
|
| 851 |
+
libnvJitLink.so, libnvJitLink_static.a
|
| 852 |
+
|
| 853 |
+
Component
|
| 854 |
+
|
| 855 |
+
NVIDIA Common Device Math Functions Library
|
| 856 |
+
|
| 857 |
+
Windows
|
| 858 |
+
|
| 859 |
+
libdevice.10.bc
|
| 860 |
+
|
| 861 |
+
Mac OSX
|
| 862 |
+
|
| 863 |
+
libdevice.10.bc
|
| 864 |
+
|
| 865 |
+
Linux
|
| 866 |
+
|
| 867 |
+
libdevice.10.bc
|
| 868 |
+
|
| 869 |
+
Component
|
| 870 |
+
|
| 871 |
+
CUDA Occupancy Calculation Header Library
|
| 872 |
+
|
| 873 |
+
All
|
| 874 |
+
|
| 875 |
+
cuda_occupancy.h
|
| 876 |
+
|
| 877 |
+
Component
|
| 878 |
+
|
| 879 |
+
CUDA Half Precision Headers
|
| 880 |
+
|
| 881 |
+
All
|
| 882 |
+
|
| 883 |
+
cuda_fp16.h, cuda_fp16.hpp
|
| 884 |
+
|
| 885 |
+
Component
|
| 886 |
+
|
| 887 |
+
CUDA Profiling Tools Interface (CUPTI) Library
|
| 888 |
+
|
| 889 |
+
Windows
|
| 890 |
+
|
| 891 |
+
cupti.dll
|
| 892 |
+
|
| 893 |
+
Mac OSX
|
| 894 |
+
|
| 895 |
+
libcupti.dylib
|
| 896 |
+
|
| 897 |
+
Linux
|
| 898 |
+
|
| 899 |
+
libcupti.so
|
| 900 |
+
|
| 901 |
+
Component
|
| 902 |
+
|
| 903 |
+
NVIDIA Tools Extension Library
|
| 904 |
+
|
| 905 |
+
Windows
|
| 906 |
+
|
| 907 |
+
nvToolsExt.dll, nvToolsExt.lib
|
| 908 |
+
|
| 909 |
+
Mac OSX
|
| 910 |
+
|
| 911 |
+
libnvToolsExt.dylib
|
| 912 |
+
|
| 913 |
+
Linux
|
| 914 |
+
|
| 915 |
+
libnvToolsExt.so
|
| 916 |
+
|
| 917 |
+
Component
|
| 918 |
+
|
| 919 |
+
NVIDIA CUDA Driver Libraries
|
| 920 |
+
|
| 921 |
+
Linux
|
| 922 |
+
|
| 923 |
+
libcuda.so, libnvidia-ptxjitcompiler.so, libnvptxcompiler_static.a
|
| 924 |
+
|
| 925 |
+
Component
|
| 926 |
+
|
| 927 |
+
NVIDIA CUDA File IO Libraries and Header
|
| 928 |
+
|
| 929 |
+
All
|
| 930 |
+
|
| 931 |
+
cufile.h
|
| 932 |
+
|
| 933 |
+
Linux
|
| 934 |
+
|
| 935 |
+
libcufile.so, libcufile_rdma.so, libcufile_static.a,
|
| 936 |
+
libcufile_rdma_static.a
|
| 937 |
+
|
| 938 |
+
In addition to the rights above, for parties that are
|
| 939 |
+
developing software intended solely for use on Jetson
|
| 940 |
+
development kits or Jetson modules, and running Linux for
|
| 941 |
+
Tegra software, the following shall apply:
|
| 942 |
+
|
| 943 |
+
* The SDK may be distributed in its entirety, as provided by
|
| 944 |
+
NVIDIA, and without separation of its components, for you
|
| 945 |
+
and/or your licensees to create software development kits
|
| 946 |
+
for use only on the Jetson platform and running Linux for
|
| 947 |
+
Tegra software.
|
| 948 |
+
|
| 949 |
+
|
| 950 |
+
2.7. Attachment B
|
| 951 |
+
|
| 952 |
+
|
| 953 |
+
Additional Licensing Obligations
|
| 954 |
+
|
| 955 |
+
The following third party components included in the SOFTWARE
|
| 956 |
+
are licensed to Licensee pursuant to the following terms and
|
| 957 |
+
conditions:
|
| 958 |
+
|
| 959 |
+
1. Licensee's use of the GDB third party component is
|
| 960 |
+
subject to the terms and conditions of GNU GPL v3:
|
| 961 |
+
|
| 962 |
+
This product includes copyrighted third-party software licensed
|
| 963 |
+
under the terms of the GNU General Public License v3 ("GPL v3").
|
| 964 |
+
All third-party software packages are copyright by their respective
|
| 965 |
+
authors. GPL v3 terms and conditions are hereby incorporated into
|
| 966 |
+
the Agreement by this reference: http://www.gnu.org/licenses/gpl.txt
|
| 967 |
+
|
| 968 |
+
Consistent with these licensing requirements, the software
|
| 969 |
+
listed below is provided under the terms of the specified
|
| 970 |
+
open source software licenses. To obtain source code for
|
| 971 |
+
software provided under licenses that require
|
| 972 |
+
redistribution of source code, including the GNU General
|
| 973 |
+
Public License (GPL) and GNU Lesser General Public License
|
| 974 |
+
(LGPL), contact oss-requests@nvidia.com. This offer is
|
| 975 |
+
valid for a period of three (3) years from the date of the
|
| 976 |
+
distribution of this product by NVIDIA CORPORATION.
|
| 977 |
+
|
| 978 |
+
Component License
|
| 979 |
+
CUDA-GDB GPL v3
|
| 980 |
+
|
| 981 |
+
2. Licensee represents and warrants that any and all third
|
| 982 |
+
party licensing and/or royalty payment obligations in
|
| 983 |
+
connection with Licensee's use of the H.264 video codecs
|
| 984 |
+
are solely the responsibility of Licensee.
|
| 985 |
+
|
| 986 |
+
3. Licensee's use of the Thrust library is subject to the
|
| 987 |
+
terms and conditions of the Apache License Version 2.0.
|
| 988 |
+
All third-party software packages are copyright by their
|
| 989 |
+
respective authors. Apache License Version 2.0 terms and
|
| 990 |
+
conditions are hereby incorporated into the Agreement by
|
| 991 |
+
this reference.
|
| 992 |
+
http://www.apache.org/licenses/LICENSE-2.0.html
|
| 993 |
+
|
| 994 |
+
In addition, Licensee acknowledges the following notice:
|
| 995 |
+
Thrust includes source code from the Boost Iterator,
|
| 996 |
+
Tuple, System, and Random Number libraries.
|
| 997 |
+
|
| 998 |
+
Boost Software License - Version 1.0 - August 17th, 2003
|
| 999 |
+
. . . .
|
| 1000 |
+
|
| 1001 |
+
Permission is hereby granted, free of charge, to any person or
|
| 1002 |
+
organization obtaining a copy of the software and accompanying
|
| 1003 |
+
documentation covered by this license (the "Software") to use,
|
| 1004 |
+
reproduce, display, distribute, execute, and transmit the Software,
|
| 1005 |
+
and to prepare derivative works of the Software, and to permit
|
| 1006 |
+
third-parties to whom the Software is furnished to do so, all
|
| 1007 |
+
subject to the following:
|
| 1008 |
+
|
| 1009 |
+
The copyright notices in the Software and this entire statement,
|
| 1010 |
+
including the above license grant, this restriction and the following
|
| 1011 |
+
disclaimer, must be included in all copies of the Software, in whole
|
| 1012 |
+
or in part, and all derivative works of the Software, unless such
|
| 1013 |
+
copies or derivative works are solely in the form of machine-executable
|
| 1014 |
+
object code generated by a source language processor.
|
| 1015 |
+
|
| 1016 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 1017 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 1018 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
|
| 1019 |
+
NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
| 1020 |
+
ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR
|
| 1021 |
+
OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING
|
| 1022 |
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
| 1023 |
+
OTHER DEALINGS IN THE SOFTWARE.
|
| 1024 |
+
|
| 1025 |
+
4. Licensee's use of the LLVM third party component is
|
| 1026 |
+
subject to the following terms and conditions:
|
| 1027 |
+
|
| 1028 |
+
======================================================
|
| 1029 |
+
LLVM Release License
|
| 1030 |
+
======================================================
|
| 1031 |
+
University of Illinois/NCSA
|
| 1032 |
+
Open Source License
|
| 1033 |
+
|
| 1034 |
+
Copyright (c) 2003-2010 University of Illinois at Urbana-Champaign.
|
| 1035 |
+
All rights reserved.
|
| 1036 |
+
|
| 1037 |
+
Developed by:
|
| 1038 |
+
|
| 1039 |
+
LLVM Team
|
| 1040 |
+
|
| 1041 |
+
University of Illinois at Urbana-Champaign
|
| 1042 |
+
|
| 1043 |
+
http://llvm.org
|
| 1044 |
+
|
| 1045 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 1046 |
+
of this software and associated documentation files (the "Software"), to
|
| 1047 |
+
deal with the Software without restriction, including without limitation the
|
| 1048 |
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
| 1049 |
+
sell copies of the Software, and to permit persons to whom the Software is
|
| 1050 |
+
furnished to do so, subject to the following conditions:
|
| 1051 |
+
|
| 1052 |
+
* Redistributions of source code must retain the above copyright notice,
|
| 1053 |
+
this list of conditions and the following disclaimers.
|
| 1054 |
+
|
| 1055 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 1056 |
+
notice, this list of conditions and the following disclaimers in the
|
| 1057 |
+
documentation and/or other materials provided with the distribution.
|
| 1058 |
+
|
| 1059 |
+
* Neither the names of the LLVM Team, University of Illinois at Urbana-
|
| 1060 |
+
Champaign, nor the names of its contributors may be used to endorse or
|
| 1061 |
+
promote products derived from this Software without specific prior
|
| 1062 |
+
written permission.
|
| 1063 |
+
|
| 1064 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 1065 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 1066 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
| 1067 |
+
THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
| 1068 |
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
| 1069 |
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
| 1070 |
+
DEALINGS WITH THE SOFTWARE.
|
| 1071 |
+
|
| 1072 |
+
5. Licensee's use of the PCRE third party component is
|
| 1073 |
+
subject to the following terms and conditions:
|
| 1074 |
+
|
| 1075 |
+
------------
|
| 1076 |
+
PCRE LICENCE
|
| 1077 |
+
------------
|
| 1078 |
+
PCRE is a library of functions to support regular expressions whose syntax
|
| 1079 |
+
and semantics are as close as possible to those of the Perl 5 language.
|
| 1080 |
+
Release 8 of PCRE is distributed under the terms of the "BSD" licence, as
|
| 1081 |
+
specified below. The documentation for PCRE, supplied in the "doc"
|
| 1082 |
+
directory, is distributed under the same terms as the software itself. The
|
| 1083 |
+
basic library functions are written in C and are freestanding. Also
|
| 1084 |
+
included in the distribution is a set of C++ wrapper functions, and a just-
|
| 1085 |
+
in-time compiler that can be used to optimize pattern matching. These are
|
| 1086 |
+
both optional features that can be omitted when the library is built.
|
| 1087 |
+
|
| 1088 |
+
THE BASIC LIBRARY FUNCTIONS
|
| 1089 |
+
---------------------------
|
| 1090 |
+
Written by: Philip Hazel
|
| 1091 |
+
Email local part: ph10
|
| 1092 |
+
Email domain: cam.ac.uk
|
| 1093 |
+
University of Cambridge Computing Service,
|
| 1094 |
+
Cambridge, England.
|
| 1095 |
+
Copyright (c) 1997-2012 University of Cambridge
|
| 1096 |
+
All rights reserved.
|
| 1097 |
+
|
| 1098 |
+
PCRE JUST-IN-TIME COMPILATION SUPPORT
|
| 1099 |
+
-------------------------------------
|
| 1100 |
+
Written by: Zoltan Herczeg
|
| 1101 |
+
Email local part: hzmester
|
| 1102 |
+
Emain domain: freemail.hu
|
| 1103 |
+
Copyright(c) 2010-2012 Zoltan Herczeg
|
| 1104 |
+
All rights reserved.
|
| 1105 |
+
|
| 1106 |
+
STACK-LESS JUST-IN-TIME COMPILER
|
| 1107 |
+
--------------------------------
|
| 1108 |
+
Written by: Zoltan Herczeg
|
| 1109 |
+
Email local part: hzmester
|
| 1110 |
+
Emain domain: freemail.hu
|
| 1111 |
+
Copyright(c) 2009-2012 Zoltan Herczeg
|
| 1112 |
+
All rights reserved.
|
| 1113 |
+
|
| 1114 |
+
THE C++ WRAPPER FUNCTIONS
|
| 1115 |
+
-------------------------
|
| 1116 |
+
Contributed by: Google Inc.
|
| 1117 |
+
Copyright (c) 2007-2012, Google Inc.
|
| 1118 |
+
All rights reserved.
|
| 1119 |
+
|
| 1120 |
+
THE "BSD" LICENCE
|
| 1121 |
+
-----------------
|
| 1122 |
+
Redistribution and use in source and binary forms, with or without
|
| 1123 |
+
modification, are permitted provided that the following conditions are met:
|
| 1124 |
+
|
| 1125 |
+
* Redistributions of source code must retain the above copyright notice,
|
| 1126 |
+
this list of conditions and the following disclaimer.
|
| 1127 |
+
|
| 1128 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 1129 |
+
notice, this list of conditions and the following disclaimer in the
|
| 1130 |
+
documentation and/or other materials provided with the distribution.
|
| 1131 |
+
|
| 1132 |
+
* Neither the name of the University of Cambridge nor the name of Google
|
| 1133 |
+
Inc. nor the names of their contributors may be used to endorse or
|
| 1134 |
+
promote products derived from this software without specific prior
|
| 1135 |
+
written permission.
|
| 1136 |
+
|
| 1137 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 1138 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 1139 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 1140 |
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
| 1141 |
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
| 1142 |
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
| 1143 |
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
| 1144 |
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
| 1145 |
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
| 1146 |
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
| 1147 |
+
POSSIBILITY OF SUCH DAMAGE.
|
| 1148 |
+
|
| 1149 |
+
6. Some of the cuBLAS library routines were written by or
|
| 1150 |
+
derived from code written by Vasily Volkov and are subject
|
| 1151 |
+
to the Modified Berkeley Software Distribution License as
|
| 1152 |
+
follows:
|
| 1153 |
+
|
| 1154 |
+
Copyright (c) 2007-2009, Regents of the University of California
|
| 1155 |
+
|
| 1156 |
+
All rights reserved.
|
| 1157 |
+
|
| 1158 |
+
Redistribution and use in source and binary forms, with or without
|
| 1159 |
+
modification, are permitted provided that the following conditions are
|
| 1160 |
+
met:
|
| 1161 |
+
* Redistributions of source code must retain the above copyright
|
| 1162 |
+
notice, this list of conditions and the following disclaimer.
|
| 1163 |
+
* Redistributions in binary form must reproduce the above
|
| 1164 |
+
copyright notice, this list of conditions and the following
|
| 1165 |
+
disclaimer in the documentation and/or other materials provided
|
| 1166 |
+
with the distribution.
|
| 1167 |
+
* Neither the name of the University of California, Berkeley nor
|
| 1168 |
+
the names of its contributors may be used to endorse or promote
|
| 1169 |
+
products derived from this software without specific prior
|
| 1170 |
+
written permission.
|
| 1171 |
+
|
| 1172 |
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
| 1173 |
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
| 1174 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 1175 |
+
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
| 1176 |
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 1177 |
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 1178 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
| 1179 |
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
| 1180 |
+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
| 1181 |
+
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
| 1182 |
+
POSSIBILITY OF SUCH DAMAGE.
|
| 1183 |
+
|
| 1184 |
+
7. Some of the cuBLAS library routines were written by or
|
| 1185 |
+
derived from code written by Davide Barbieri and are
|
| 1186 |
+
subject to the Modified Berkeley Software Distribution
|
| 1187 |
+
License as follows:
|
| 1188 |
+
|
| 1189 |
+
Copyright (c) 2008-2009 Davide Barbieri @ University of Rome Tor Vergata.
|
| 1190 |
+
|
| 1191 |
+
All rights reserved.
|
| 1192 |
+
|
| 1193 |
+
Redistribution and use in source and binary forms, with or without
|
| 1194 |
+
modification, are permitted provided that the following conditions are
|
| 1195 |
+
met:
|
| 1196 |
+
* Redistributions of source code must retain the above copyright
|
| 1197 |
+
notice, this list of conditions and the following disclaimer.
|
| 1198 |
+
* Redistributions in binary form must reproduce the above
|
| 1199 |
+
copyright notice, this list of conditions and the following
|
| 1200 |
+
disclaimer in the documentation and/or other materials provided
|
| 1201 |
+
with the distribution.
|
| 1202 |
+
* The name of the author may not be used to endorse or promote
|
| 1203 |
+
products derived from this software without specific prior
|
| 1204 |
+
written permission.
|
| 1205 |
+
|
| 1206 |
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
| 1207 |
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
| 1208 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 1209 |
+
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
| 1210 |
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 1211 |
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 1212 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
| 1213 |
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
| 1214 |
+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
| 1215 |
+
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
| 1216 |
+
POSSIBILITY OF SUCH DAMAGE.
|
| 1217 |
+
|
| 1218 |
+
8. Some of the cuBLAS library routines were derived from
|
| 1219 |
+
code developed by the University of Tennessee and are
|
| 1220 |
+
subject to the Modified Berkeley Software Distribution
|
| 1221 |
+
License as follows:
|
| 1222 |
+
|
| 1223 |
+
Copyright (c) 2010 The University of Tennessee.
|
| 1224 |
+
|
| 1225 |
+
All rights reserved.
|
| 1226 |
+
|
| 1227 |
+
Redistribution and use in source and binary forms, with or without
|
| 1228 |
+
modification, are permitted provided that the following conditions are
|
| 1229 |
+
met:
|
| 1230 |
+
* Redistributions of source code must retain the above copyright
|
| 1231 |
+
notice, this list of conditions and the following disclaimer.
|
| 1232 |
+
* Redistributions in binary form must reproduce the above
|
| 1233 |
+
copyright notice, this list of conditions and the following
|
| 1234 |
+
disclaimer listed in this license in the documentation and/or
|
| 1235 |
+
other materials provided with the distribution.
|
| 1236 |
+
* Neither the name of the copyright holders nor the names of its
|
| 1237 |
+
contributors may be used to endorse or promote products derived
|
| 1238 |
+
from this software without specific prior written permission.
|
| 1239 |
+
|
| 1240 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1241 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1242 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1243 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 1244 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 1245 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 1246 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 1247 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 1248 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 1249 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 1250 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 1251 |
+
|
| 1252 |
+
9. Some of the cuBLAS library routines were written by or
|
| 1253 |
+
derived from code written by Jonathan Hogg and are subject
|
| 1254 |
+
to the Modified Berkeley Software Distribution License as
|
| 1255 |
+
follows:
|
| 1256 |
+
|
| 1257 |
+
Copyright (c) 2012, The Science and Technology Facilities Council (STFC).
|
| 1258 |
+
|
| 1259 |
+
All rights reserved.
|
| 1260 |
+
|
| 1261 |
+
Redistribution and use in source and binary forms, with or without
|
| 1262 |
+
modification, are permitted provided that the following conditions are
|
| 1263 |
+
met:
|
| 1264 |
+
* Redistributions of source code must retain the above copyright
|
| 1265 |
+
notice, this list of conditions and the following disclaimer.
|
| 1266 |
+
* Redistributions in binary form must reproduce the above
|
| 1267 |
+
copyright notice, this list of conditions and the following
|
| 1268 |
+
disclaimer in the documentation and/or other materials provided
|
| 1269 |
+
with the distribution.
|
| 1270 |
+
* Neither the name of the STFC nor the names of its contributors
|
| 1271 |
+
may be used to endorse or promote products derived from this
|
| 1272 |
+
software without specific prior written permission.
|
| 1273 |
+
|
| 1274 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1275 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1276 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1277 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE STFC BE
|
| 1278 |
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
| 1279 |
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
| 1280 |
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
| 1281 |
+
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
| 1282 |
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
| 1283 |
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
| 1284 |
+
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 1285 |
+
|
| 1286 |
+
10. Some of the cuBLAS library routines were written by or
|
| 1287 |
+
derived from code written by Ahmad M. Abdelfattah, David
|
| 1288 |
+
Keyes, and Hatem Ltaief, and are subject to the Apache
|
| 1289 |
+
License, Version 2.0, as follows:
|
| 1290 |
+
|
| 1291 |
+
-- (C) Copyright 2013 King Abdullah University of Science and Technology
|
| 1292 |
+
Authors:
|
| 1293 |
+
Ahmad Abdelfattah (ahmad.ahmad@kaust.edu.sa)
|
| 1294 |
+
David Keyes (david.keyes@kaust.edu.sa)
|
| 1295 |
+
Hatem Ltaief (hatem.ltaief@kaust.edu.sa)
|
| 1296 |
+
|
| 1297 |
+
Redistribution and use in source and binary forms, with or without
|
| 1298 |
+
modification, are permitted provided that the following conditions
|
| 1299 |
+
are met:
|
| 1300 |
+
|
| 1301 |
+
* Redistributions of source code must retain the above copyright
|
| 1302 |
+
notice, this list of conditions and the following disclaimer.
|
| 1303 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 1304 |
+
notice, this list of conditions and the following disclaimer in the
|
| 1305 |
+
documentation and/or other materials provided with the distribution.
|
| 1306 |
+
* Neither the name of the King Abdullah University of Science and
|
| 1307 |
+
Technology nor the names of its contributors may be used to endorse
|
| 1308 |
+
or promote products derived from this software without specific prior
|
| 1309 |
+
written permission.
|
| 1310 |
+
|
| 1311 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1312 |
+
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1313 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1314 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 1315 |
+
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 1316 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 1317 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 1318 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 1319 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 1320 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 1321 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
|
| 1322 |
+
|
| 1323 |
+
11. Some of the cuSPARSE library routines were written by or
|
| 1324 |
+
derived from code written by Li-Wen Chang and are subject
|
| 1325 |
+
to the NCSA Open Source License as follows:
|
| 1326 |
+
|
| 1327 |
+
Copyright (c) 2012, University of Illinois.
|
| 1328 |
+
|
| 1329 |
+
All rights reserved.
|
| 1330 |
+
|
| 1331 |
+
Developed by: IMPACT Group, University of Illinois, http://impact.crhc.illinois.edu
|
| 1332 |
+
|
| 1333 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 1334 |
+
a copy of this software and associated documentation files (the
|
| 1335 |
+
"Software"), to deal with the Software without restriction, including
|
| 1336 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 1337 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 1338 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 1339 |
+
the following conditions:
|
| 1340 |
+
* Redistributions of source code must retain the above copyright
|
| 1341 |
+
notice, this list of conditions and the following disclaimer.
|
| 1342 |
+
* Redistributions in binary form must reproduce the above
|
| 1343 |
+
copyright notice, this list of conditions and the following
|
| 1344 |
+
disclaimers in the documentation and/or other materials provided
|
| 1345 |
+
with the distribution.
|
| 1346 |
+
* Neither the names of IMPACT Group, University of Illinois, nor
|
| 1347 |
+
the names of its contributors may be used to endorse or promote
|
| 1348 |
+
products derived from this Software without specific prior
|
| 1349 |
+
written permission.
|
| 1350 |
+
|
| 1351 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 1352 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 1353 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 1354 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT
|
| 1355 |
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
| 1356 |
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
| 1357 |
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
| 1358 |
+
SOFTWARE.
|
| 1359 |
+
|
| 1360 |
+
12. Some of the cuRAND library routines were written by or
|
| 1361 |
+
derived from code written by Mutsuo Saito and Makoto
|
| 1362 |
+
Matsumoto and are subject to the following license:
|
| 1363 |
+
|
| 1364 |
+
Copyright (c) 2009, 2010 Mutsuo Saito, Makoto Matsumoto and Hiroshima
|
| 1365 |
+
University. All rights reserved.
|
| 1366 |
+
|
| 1367 |
+
Copyright (c) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima
|
| 1368 |
+
University and University of Tokyo. All rights reserved.
|
| 1369 |
+
|
| 1370 |
+
Redistribution and use in source and binary forms, with or without
|
| 1371 |
+
modification, are permitted provided that the following conditions are
|
| 1372 |
+
met:
|
| 1373 |
+
* Redistributions of source code must retain the above copyright
|
| 1374 |
+
notice, this list of conditions and the following disclaimer.
|
| 1375 |
+
* Redistributions in binary form must reproduce the above
|
| 1376 |
+
copyright notice, this list of conditions and the following
|
| 1377 |
+
disclaimer in the documentation and/or other materials provided
|
| 1378 |
+
with the distribution.
|
| 1379 |
+
* Neither the name of the Hiroshima University nor the names of
|
| 1380 |
+
its contributors may be used to endorse or promote products
|
| 1381 |
+
derived from this software without specific prior written
|
| 1382 |
+
permission.
|
| 1383 |
+
|
| 1384 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1385 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1386 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1387 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 1388 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 1389 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 1390 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 1391 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 1392 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 1393 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 1394 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 1395 |
+
|
| 1396 |
+
13. Some of the cuRAND library routines were derived from
|
| 1397 |
+
code developed by D. E. Shaw Research and are subject to
|
| 1398 |
+
the following license:
|
| 1399 |
+
|
| 1400 |
+
Copyright 2010-2011, D. E. Shaw Research.
|
| 1401 |
+
|
| 1402 |
+
All rights reserved.
|
| 1403 |
+
|
| 1404 |
+
Redistribution and use in source and binary forms, with or without
|
| 1405 |
+
modification, are permitted provided that the following conditions are
|
| 1406 |
+
met:
|
| 1407 |
+
* Redistributions of source code must retain the above copyright
|
| 1408 |
+
notice, this list of conditions, and the following disclaimer.
|
| 1409 |
+
* Redistributions in binary form must reproduce the above
|
| 1410 |
+
copyright notice, this list of conditions, and the following
|
| 1411 |
+
disclaimer in the documentation and/or other materials provided
|
| 1412 |
+
with the distribution.
|
| 1413 |
+
* Neither the name of D. E. Shaw Research nor the names of its
|
| 1414 |
+
contributors may be used to endorse or promote products derived
|
| 1415 |
+
from this software without specific prior written permission.
|
| 1416 |
+
|
| 1417 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1418 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1419 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1420 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 1421 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 1422 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 1423 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 1424 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 1425 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 1426 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 1427 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 1428 |
+
|
| 1429 |
+
14. Some of the Math library routines were written by or
|
| 1430 |
+
derived from code developed by Norbert Juffa and are
|
| 1431 |
+
subject to the following license:
|
| 1432 |
+
|
| 1433 |
+
Copyright (c) 2015-2017, Norbert Juffa
|
| 1434 |
+
All rights reserved.
|
| 1435 |
+
|
| 1436 |
+
Redistribution and use in source and binary forms, with or without
|
| 1437 |
+
modification, are permitted provided that the following conditions
|
| 1438 |
+
are met:
|
| 1439 |
+
|
| 1440 |
+
1. Redistributions of source code must retain the above copyright
|
| 1441 |
+
notice, this list of conditions and the following disclaimer.
|
| 1442 |
+
|
| 1443 |
+
2. Redistributions in binary form must reproduce the above copyright
|
| 1444 |
+
notice, this list of conditions and the following disclaimer in the
|
| 1445 |
+
documentation and/or other materials provided with the distribution.
|
| 1446 |
+
|
| 1447 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1448 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1449 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1450 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 1451 |
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 1452 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 1453 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 1454 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 1455 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 1456 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 1457 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 1458 |
+
|
| 1459 |
+
15. Licensee's use of the lz4 third party component is
|
| 1460 |
+
subject to the following terms and conditions:
|
| 1461 |
+
|
| 1462 |
+
Copyright (C) 2011-2013, Yann Collet.
|
| 1463 |
+
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
| 1464 |
+
|
| 1465 |
+
Redistribution and use in source and binary forms, with or without
|
| 1466 |
+
modification, are permitted provided that the following conditions are
|
| 1467 |
+
met:
|
| 1468 |
+
|
| 1469 |
+
* Redistributions of source code must retain the above copyright
|
| 1470 |
+
notice, this list of conditions and the following disclaimer.
|
| 1471 |
+
* Redistributions in binary form must reproduce the above
|
| 1472 |
+
copyright notice, this list of conditions and the following disclaimer
|
| 1473 |
+
in the documentation and/or other materials provided with the
|
| 1474 |
+
distribution.
|
| 1475 |
+
|
| 1476 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 1477 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 1478 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 1479 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 1480 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 1481 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 1482 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 1483 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 1484 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 1485 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 1486 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 1487 |
+
|
| 1488 |
+
16. The NPP library uses code from the Boost Math Toolkit,
|
| 1489 |
+
and is subject to the following license:
|
| 1490 |
+
|
| 1491 |
+
Boost Software License - Version 1.0 - August 17th, 2003
|
| 1492 |
+
. . . .
|
| 1493 |
+
|
| 1494 |
+
Permission is hereby granted, free of charge, to any person or
|
| 1495 |
+
organization obtaining a copy of the software and accompanying
|
| 1496 |
+
documentation covered by this license (the "Software") to use,
|
| 1497 |
+
reproduce, display, distribute, execute, and transmit the Software,
|
| 1498 |
+
and to prepare derivative works of the Software, and to permit
|
| 1499 |
+
third-parties to whom the Software is furnished to do so, all
|
| 1500 |
+
subject to the following:
|
| 1501 |
+
|
| 1502 |
+
The copyright notices in the Software and this entire statement,
|
| 1503 |
+
including the above license grant, this restriction and the following
|
| 1504 |
+
disclaimer, must be included in all copies of the Software, in whole
|
| 1505 |
+
or in part, and all derivative works of the Software, unless such
|
| 1506 |
+
copies or derivative works are solely in the form of machine-executable
|
| 1507 |
+
object code generated by a source language processor.
|
| 1508 |
+
|
| 1509 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 1510 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 1511 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
|
| 1512 |
+
NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
| 1513 |
+
ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR
|
| 1514 |
+
OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING
|
| 1515 |
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
| 1516 |
+
OTHER DEALINGS IN THE SOFTWARE.
|
| 1517 |
+
|
| 1518 |
+
17. Portions of the Nsight Eclipse Edition is subject to the
|
| 1519 |
+
following license:
|
| 1520 |
+
|
| 1521 |
+
The Eclipse Foundation makes available all content in this plug-in
|
| 1522 |
+
("Content"). Unless otherwise indicated below, the Content is provided
|
| 1523 |
+
to you under the terms and conditions of the Eclipse Public License
|
| 1524 |
+
Version 1.0 ("EPL"). A copy of the EPL is available at http://
|
| 1525 |
+
www.eclipse.org/legal/epl-v10.html. For purposes of the EPL, "Program"
|
| 1526 |
+
will mean the Content.
|
| 1527 |
+
|
| 1528 |
+
If you did not receive this Content directly from the Eclipse
|
| 1529 |
+
Foundation, the Content is being redistributed by another party
|
| 1530 |
+
("Redistributor") and different terms and conditions may apply to your
|
| 1531 |
+
use of any object code in the Content. Check the Redistributor's
|
| 1532 |
+
license that was provided with the Content. If no such license exists,
|
| 1533 |
+
contact the Redistributor. Unless otherwise indicated below, the terms
|
| 1534 |
+
and conditions of the EPL still apply to any source code in the
|
| 1535 |
+
Content and such source code may be obtained at http://www.eclipse.org.
|
| 1536 |
+
|
| 1537 |
+
18. Some of the cuBLAS library routines uses code from
|
| 1538 |
+
OpenAI, which is subject to the following license:
|
| 1539 |
+
|
| 1540 |
+
License URL
|
| 1541 |
+
https://github.com/openai/openai-gemm/blob/master/LICENSE
|
| 1542 |
+
|
| 1543 |
+
License Text
|
| 1544 |
+
The MIT License
|
| 1545 |
+
|
| 1546 |
+
Copyright (c) 2016 OpenAI (http://openai.com), 2016 Google Inc.
|
| 1547 |
+
|
| 1548 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 1549 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 1550 |
+
in the Software without restriction, including without limitation the rights
|
| 1551 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 1552 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 1553 |
+
furnished to do so, subject to the following conditions:
|
| 1554 |
+
|
| 1555 |
+
The above copyright notice and this permission notice shall be included in
|
| 1556 |
+
all copies or substantial portions of the Software.
|
| 1557 |
+
|
| 1558 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 1559 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 1560 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 1561 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 1562 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 1563 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 1564 |
+
THE SOFTWARE.
|
| 1565 |
+
|
| 1566 |
+
19. Licensee's use of the Visual Studio Setup Configuration
|
| 1567 |
+
Samples is subject to the following license:
|
| 1568 |
+
|
| 1569 |
+
The MIT License (MIT)
|
| 1570 |
+
Copyright (C) Microsoft Corporation. All rights reserved.
|
| 1571 |
+
|
| 1572 |
+
Permission is hereby granted, free of charge, to any person
|
| 1573 |
+
obtaining a copy of this software and associated documentation
|
| 1574 |
+
files (the "Software"), to deal in the Software without restriction,
|
| 1575 |
+
including without limitation the rights to use, copy, modify, merge,
|
| 1576 |
+
publish, distribute, sublicense, and/or sell copies of the Software,
|
| 1577 |
+
and to permit persons to whom the Software is furnished to do so,
|
| 1578 |
+
subject to the following conditions:
|
| 1579 |
+
|
| 1580 |
+
The above copyright notice and this permission notice shall be included
|
| 1581 |
+
in all copies or substantial portions of the Software.
|
| 1582 |
+
|
| 1583 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
| 1584 |
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 1585 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 1586 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 1587 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 1588 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 1589 |
+
|
| 1590 |
+
20. Licensee's use of linmath.h header for CPU functions for
|
| 1591 |
+
GL vector/matrix operations from lunarG is subject to the
|
| 1592 |
+
Apache License Version 2.0.
|
| 1593 |
+
|
| 1594 |
+
21. The DX12-CUDA sample uses the d3dx12.h header, which is
|
| 1595 |
+
subject to the MIT license.
|
| 1596 |
+
|
| 1597 |
+
22. Components of the driver and compiler used for binary management, including
|
| 1598 |
+
nvFatBin, nvcc, and cuobjdump, use the Zstandard library which is subject to
|
| 1599 |
+
the following license:
|
| 1600 |
+
|
| 1601 |
+
BSD License
|
| 1602 |
+
|
| 1603 |
+
For Zstandard software
|
| 1604 |
+
|
| 1605 |
+
Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
|
| 1606 |
+
|
| 1607 |
+
Redistribution and use in source and binary forms, with or without modification,
|
| 1608 |
+
are permitted provided that the following conditions are met:
|
| 1609 |
+
|
| 1610 |
+
* Redistributions of source code must retain the above copyright notice, this
|
| 1611 |
+
list of conditions and the following disclaimer.
|
| 1612 |
+
|
| 1613 |
+
* Redistributions in binary form must reproduce the above copyright notice,
|
| 1614 |
+
this list of conditions and the following disclaimer in the documentation
|
| 1615 |
+
and/or other materials provided with the distribution.
|
| 1616 |
+
|
| 1617 |
+
* Neither the name Facebook, nor Meta, nor the names of its contributors may
|
| 1618 |
+
be used to endorse or promote products derived from this software without
|
| 1619 |
+
specific prior written permission.
|
| 1620 |
+
|
| 1621 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
| 1622 |
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
| 1623 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 1624 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
| 1625 |
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
| 1626 |
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
| 1627 |
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
| 1628 |
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
| 1629 |
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
| 1630 |
+
OF SUCH DAMAGE.
|
| 1631 |
+
|
| 1632 |
+
-----------------
|
data/miniconda3/pkgs/cuda-compiler-12.8.1-0/info/test/run_test.sh
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
set -ex
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
which cuobjdump
|
| 8 |
+
which cu++filt
|
| 9 |
+
which nvcc
|
| 10 |
+
which nvprune
|
| 11 |
+
exit 0
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock-actions.h
ADDED
|
@@ -0,0 +1,1687 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2007, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
// Google Mock - a framework for writing C++ mock classes.
|
| 32 |
+
//
|
| 33 |
+
// The ACTION* family of macros can be used in a namespace scope to
|
| 34 |
+
// define custom actions easily. The syntax:
|
| 35 |
+
//
|
| 36 |
+
// ACTION(name) { statements; }
|
| 37 |
+
//
|
| 38 |
+
// will define an action with the given name that executes the
|
| 39 |
+
// statements. The value returned by the statements will be used as
|
| 40 |
+
// the return value of the action. Inside the statements, you can
|
| 41 |
+
// refer to the K-th (0-based) argument of the mock function by
|
| 42 |
+
// 'argK', and refer to its type by 'argK_type'. For example:
|
| 43 |
+
//
|
| 44 |
+
// ACTION(IncrementArg1) {
|
| 45 |
+
// arg1_type temp = arg1;
|
| 46 |
+
// return ++(*temp);
|
| 47 |
+
// }
|
| 48 |
+
//
|
| 49 |
+
// allows you to write
|
| 50 |
+
//
|
| 51 |
+
// ...WillOnce(IncrementArg1());
|
| 52 |
+
//
|
| 53 |
+
// You can also refer to the entire argument tuple and its type by
|
| 54 |
+
// 'args' and 'args_type', and refer to the mock function type and its
|
| 55 |
+
// return type by 'function_type' and 'return_type'.
|
| 56 |
+
//
|
| 57 |
+
// Note that you don't need to specify the types of the mock function
|
| 58 |
+
// arguments. However rest assured that your code is still type-safe:
|
| 59 |
+
// you'll get a compiler error if *arg1 doesn't support the ++
|
| 60 |
+
// operator, or if the type of ++(*arg1) isn't compatible with the
|
| 61 |
+
// mock function's return type, for example.
|
| 62 |
+
//
|
| 63 |
+
// Sometimes you'll want to parameterize the action. For that you can use
|
| 64 |
+
// another macro:
|
| 65 |
+
//
|
| 66 |
+
// ACTION_P(name, param_name) { statements; }
|
| 67 |
+
//
|
| 68 |
+
// For example:
|
| 69 |
+
//
|
| 70 |
+
// ACTION_P(Add, n) { return arg0 + n; }
|
| 71 |
+
//
|
| 72 |
+
// will allow you to write:
|
| 73 |
+
//
|
| 74 |
+
// ...WillOnce(Add(5));
|
| 75 |
+
//
|
| 76 |
+
// Note that you don't need to provide the type of the parameter
|
| 77 |
+
// either. If you need to reference the type of a parameter named
|
| 78 |
+
// 'foo', you can write 'foo_type'. For example, in the body of
|
| 79 |
+
// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type
|
| 80 |
+
// of 'n'.
|
| 81 |
+
//
|
| 82 |
+
// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support
|
| 83 |
+
// multi-parameter actions.
|
| 84 |
+
//
|
| 85 |
+
// For the purpose of typing, you can view
|
| 86 |
+
//
|
| 87 |
+
// ACTION_Pk(Foo, p1, ..., pk) { ... }
|
| 88 |
+
//
|
| 89 |
+
// as shorthand for
|
| 90 |
+
//
|
| 91 |
+
// template <typename p1_type, ..., typename pk_type>
|
| 92 |
+
// FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... }
|
| 93 |
+
//
|
| 94 |
+
// In particular, you can provide the template type arguments
|
| 95 |
+
// explicitly when invoking Foo(), as in Foo<long, bool>(5, false);
|
| 96 |
+
// although usually you can rely on the compiler to infer the types
|
| 97 |
+
// for you automatically. You can assign the result of expression
|
| 98 |
+
// Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ...,
|
| 99 |
+
// pk_type>. This can be useful when composing actions.
|
| 100 |
+
//
|
| 101 |
+
// You can also overload actions with different numbers of parameters:
|
| 102 |
+
//
|
| 103 |
+
// ACTION_P(Plus, a) { ... }
|
| 104 |
+
// ACTION_P2(Plus, a, b) { ... }
|
| 105 |
+
//
|
| 106 |
+
// While it's tempting to always use the ACTION* macros when defining
|
| 107 |
+
// a new action, you should also consider implementing ActionInterface
|
| 108 |
+
// or using MakePolymorphicAction() instead, especially if you need to
|
| 109 |
+
// use the action a lot. While these approaches require more work,
|
| 110 |
+
// they give you more control on the types of the mock function
|
| 111 |
+
// arguments and the action parameters, which in general leads to
|
| 112 |
+
// better compiler error messages that pay off in the long run. They
|
| 113 |
+
// also allow overloading actions based on parameter types (as opposed
|
| 114 |
+
// to just based on the number of parameters).
|
| 115 |
+
//
|
| 116 |
+
// CAVEAT:
|
| 117 |
+
//
|
| 118 |
+
// ACTION*() can only be used in a namespace scope as templates cannot be
|
| 119 |
+
// declared inside of a local class.
|
| 120 |
+
// Users can, however, define any local functors (e.g. a lambda) that
|
| 121 |
+
// can be used as actions.
|
| 122 |
+
//
|
| 123 |
+
// MORE INFORMATION:
|
| 124 |
+
//
|
| 125 |
+
// To learn more about using these macros, please search for 'ACTION' on
|
| 126 |
+
// https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md
|
| 127 |
+
|
| 128 |
+
// GOOGLETEST_CM0002 DO NOT DELETE
|
| 129 |
+
|
| 130 |
+
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
|
| 131 |
+
#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
|
| 132 |
+
|
| 133 |
+
#ifndef _WIN32_WCE
|
| 134 |
+
# include <errno.h>
|
| 135 |
+
#endif
|
| 136 |
+
|
| 137 |
+
#include <algorithm>
|
| 138 |
+
#include <functional>
|
| 139 |
+
#include <memory>
|
| 140 |
+
#include <string>
|
| 141 |
+
#include <tuple>
|
| 142 |
+
#include <type_traits>
|
| 143 |
+
#include <utility>
|
| 144 |
+
|
| 145 |
+
#include "gmock/internal/gmock-internal-utils.h"
|
| 146 |
+
#include "gmock/internal/gmock-port.h"
|
| 147 |
+
#include "gmock/internal/gmock-pp.h"
|
| 148 |
+
|
| 149 |
+
#ifdef _MSC_VER
|
| 150 |
+
# pragma warning(push)
|
| 151 |
+
# pragma warning(disable:4100)
|
| 152 |
+
#endif
|
| 153 |
+
|
| 154 |
+
namespace testing {
|
| 155 |
+
|
| 156 |
+
// To implement an action Foo, define:
|
| 157 |
+
// 1. a class FooAction that implements the ActionInterface interface, and
|
| 158 |
+
// 2. a factory function that creates an Action object from a
|
| 159 |
+
// const FooAction*.
|
| 160 |
+
//
|
| 161 |
+
// The two-level delegation design follows that of Matcher, providing
|
| 162 |
+
// consistency for extension developers. It also eases ownership
|
| 163 |
+
// management as Action objects can now be copied like plain values.
|
| 164 |
+
|
| 165 |
+
namespace internal {
|
| 166 |
+
|
| 167 |
+
// BuiltInDefaultValueGetter<T, true>::Get() returns a
|
| 168 |
+
// default-constructed T value. BuiltInDefaultValueGetter<T,
|
| 169 |
+
// false>::Get() crashes with an error.
|
| 170 |
+
//
|
| 171 |
+
// This primary template is used when kDefaultConstructible is true.
|
| 172 |
+
template <typename T, bool kDefaultConstructible>
|
| 173 |
+
struct BuiltInDefaultValueGetter {
|
| 174 |
+
static T Get() { return T(); }
|
| 175 |
+
};
|
| 176 |
+
template <typename T>
|
| 177 |
+
struct BuiltInDefaultValueGetter<T, false> {
|
| 178 |
+
static T Get() {
|
| 179 |
+
Assert(false, __FILE__, __LINE__,
|
| 180 |
+
"Default action undefined for the function return type.");
|
| 181 |
+
return internal::Invalid<T>();
|
| 182 |
+
// The above statement will never be reached, but is required in
|
| 183 |
+
// order for this function to compile.
|
| 184 |
+
}
|
| 185 |
+
};
|
| 186 |
+
|
| 187 |
+
// BuiltInDefaultValue<T>::Get() returns the "built-in" default value
|
| 188 |
+
// for type T, which is NULL when T is a raw pointer type, 0 when T is
|
| 189 |
+
// a numeric type, false when T is bool, or "" when T is string or
|
| 190 |
+
// std::string. In addition, in C++11 and above, it turns a
|
| 191 |
+
// default-constructed T value if T is default constructible. For any
|
| 192 |
+
// other type T, the built-in default T value is undefined, and the
|
| 193 |
+
// function will abort the process.
|
| 194 |
+
template <typename T>
|
| 195 |
+
class BuiltInDefaultValue {
|
| 196 |
+
public:
|
| 197 |
+
// This function returns true if and only if type T has a built-in default
|
| 198 |
+
// value.
|
| 199 |
+
static bool Exists() {
|
| 200 |
+
return ::std::is_default_constructible<T>::value;
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
static T Get() {
|
| 204 |
+
return BuiltInDefaultValueGetter<
|
| 205 |
+
T, ::std::is_default_constructible<T>::value>::Get();
|
| 206 |
+
}
|
| 207 |
+
};
|
| 208 |
+
|
| 209 |
+
// This partial specialization says that we use the same built-in
|
| 210 |
+
// default value for T and const T.
|
| 211 |
+
template <typename T>
|
| 212 |
+
class BuiltInDefaultValue<const T> {
|
| 213 |
+
public:
|
| 214 |
+
static bool Exists() { return BuiltInDefaultValue<T>::Exists(); }
|
| 215 |
+
static T Get() { return BuiltInDefaultValue<T>::Get(); }
|
| 216 |
+
};
|
| 217 |
+
|
| 218 |
+
// This partial specialization defines the default values for pointer
|
| 219 |
+
// types.
|
| 220 |
+
template <typename T>
|
| 221 |
+
class BuiltInDefaultValue<T*> {
|
| 222 |
+
public:
|
| 223 |
+
static bool Exists() { return true; }
|
| 224 |
+
static T* Get() { return nullptr; }
|
| 225 |
+
};
|
| 226 |
+
|
| 227 |
+
// The following specializations define the default values for
|
| 228 |
+
// specific types we care about.
|
| 229 |
+
#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value) \
|
| 230 |
+
template <> \
|
| 231 |
+
class BuiltInDefaultValue<type> { \
|
| 232 |
+
public: \
|
| 233 |
+
static bool Exists() { return true; } \
|
| 234 |
+
static type Get() { return value; } \
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(void, ); // NOLINT
|
| 238 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::std::string, "");
|
| 239 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(bool, false);
|
| 240 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned char, '\0');
|
| 241 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed char, '\0');
|
| 242 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(char, '\0');
|
| 243 |
+
|
| 244 |
+
// There's no need for a default action for signed wchar_t, as that
|
| 245 |
+
// type is the same as wchar_t for gcc, and invalid for MSVC.
|
| 246 |
+
//
|
| 247 |
+
// There's also no need for a default action for unsigned wchar_t, as
|
| 248 |
+
// that type is the same as unsigned int for gcc, and invalid for
|
| 249 |
+
// MSVC.
|
| 250 |
+
#if GMOCK_WCHAR_T_IS_NATIVE_
|
| 251 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(wchar_t, 0U); // NOLINT
|
| 252 |
+
#endif
|
| 253 |
+
|
| 254 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned short, 0U); // NOLINT
|
| 255 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed short, 0); // NOLINT
|
| 256 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned int, 0U);
|
| 257 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed int, 0);
|
| 258 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL); // NOLINT
|
| 259 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L); // NOLINT
|
| 260 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long long, 0); // NOLINT
|
| 261 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long long, 0); // NOLINT
|
| 262 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(float, 0);
|
| 263 |
+
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(double, 0);
|
| 264 |
+
|
| 265 |
+
#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_
|
| 266 |
+
|
| 267 |
+
// Simple two-arg form of std::disjunction.
|
| 268 |
+
template <typename P, typename Q>
|
| 269 |
+
using disjunction = typename ::std::conditional<P::value, P, Q>::type;
|
| 270 |
+
|
| 271 |
+
} // namespace internal
|
| 272 |
+
|
| 273 |
+
// When an unexpected function call is encountered, Google Mock will
|
| 274 |
+
// let it return a default value if the user has specified one for its
|
| 275 |
+
// return type, or if the return type has a built-in default value;
|
| 276 |
+
// otherwise Google Mock won't know what value to return and will have
|
| 277 |
+
// to abort the process.
|
| 278 |
+
//
|
| 279 |
+
// The DefaultValue<T> class allows a user to specify the
|
| 280 |
+
// default value for a type T that is both copyable and publicly
|
| 281 |
+
// destructible (i.e. anything that can be used as a function return
|
| 282 |
+
// type). The usage is:
|
| 283 |
+
//
|
| 284 |
+
// // Sets the default value for type T to be foo.
|
| 285 |
+
// DefaultValue<T>::Set(foo);
|
| 286 |
+
template <typename T>
|
| 287 |
+
class DefaultValue {
|
| 288 |
+
public:
|
| 289 |
+
// Sets the default value for type T; requires T to be
|
| 290 |
+
// copy-constructable and have a public destructor.
|
| 291 |
+
static void Set(T x) {
|
| 292 |
+
delete producer_;
|
| 293 |
+
producer_ = new FixedValueProducer(x);
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
// Provides a factory function to be called to generate the default value.
|
| 297 |
+
// This method can be used even if T is only move-constructible, but it is not
|
| 298 |
+
// limited to that case.
|
| 299 |
+
typedef T (*FactoryFunction)();
|
| 300 |
+
static void SetFactory(FactoryFunction factory) {
|
| 301 |
+
delete producer_;
|
| 302 |
+
producer_ = new FactoryValueProducer(factory);
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
// Unsets the default value for type T.
|
| 306 |
+
static void Clear() {
|
| 307 |
+
delete producer_;
|
| 308 |
+
producer_ = nullptr;
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
// Returns true if and only if the user has set the default value for type T.
|
| 312 |
+
static bool IsSet() { return producer_ != nullptr; }
|
| 313 |
+
|
| 314 |
+
// Returns true if T has a default return value set by the user or there
|
| 315 |
+
// exists a built-in default value.
|
| 316 |
+
static bool Exists() {
|
| 317 |
+
return IsSet() || internal::BuiltInDefaultValue<T>::Exists();
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
// Returns the default value for type T if the user has set one;
|
| 321 |
+
// otherwise returns the built-in default value. Requires that Exists()
|
| 322 |
+
// is true, which ensures that the return value is well-defined.
|
| 323 |
+
static T Get() {
|
| 324 |
+
return producer_ == nullptr ? internal::BuiltInDefaultValue<T>::Get()
|
| 325 |
+
: producer_->Produce();
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
private:
|
| 329 |
+
class ValueProducer {
|
| 330 |
+
public:
|
| 331 |
+
virtual ~ValueProducer() {}
|
| 332 |
+
virtual T Produce() = 0;
|
| 333 |
+
};
|
| 334 |
+
|
| 335 |
+
class FixedValueProducer : public ValueProducer {
|
| 336 |
+
public:
|
| 337 |
+
explicit FixedValueProducer(T value) : value_(value) {}
|
| 338 |
+
T Produce() override { return value_; }
|
| 339 |
+
|
| 340 |
+
private:
|
| 341 |
+
const T value_;
|
| 342 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(FixedValueProducer);
|
| 343 |
+
};
|
| 344 |
+
|
| 345 |
+
class FactoryValueProducer : public ValueProducer {
|
| 346 |
+
public:
|
| 347 |
+
explicit FactoryValueProducer(FactoryFunction factory)
|
| 348 |
+
: factory_(factory) {}
|
| 349 |
+
T Produce() override { return factory_(); }
|
| 350 |
+
|
| 351 |
+
private:
|
| 352 |
+
const FactoryFunction factory_;
|
| 353 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(FactoryValueProducer);
|
| 354 |
+
};
|
| 355 |
+
|
| 356 |
+
static ValueProducer* producer_;
|
| 357 |
+
};
|
| 358 |
+
|
| 359 |
+
// This partial specialization allows a user to set default values for
|
| 360 |
+
// reference types.
|
| 361 |
+
template <typename T>
|
| 362 |
+
class DefaultValue<T&> {
|
| 363 |
+
public:
|
| 364 |
+
// Sets the default value for type T&.
|
| 365 |
+
static void Set(T& x) { // NOLINT
|
| 366 |
+
address_ = &x;
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
// Unsets the default value for type T&.
|
| 370 |
+
static void Clear() { address_ = nullptr; }
|
| 371 |
+
|
| 372 |
+
// Returns true if and only if the user has set the default value for type T&.
|
| 373 |
+
static bool IsSet() { return address_ != nullptr; }
|
| 374 |
+
|
| 375 |
+
// Returns true if T has a default return value set by the user or there
|
| 376 |
+
// exists a built-in default value.
|
| 377 |
+
static bool Exists() {
|
| 378 |
+
return IsSet() || internal::BuiltInDefaultValue<T&>::Exists();
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
// Returns the default value for type T& if the user has set one;
|
| 382 |
+
// otherwise returns the built-in default value if there is one;
|
| 383 |
+
// otherwise aborts the process.
|
| 384 |
+
static T& Get() {
|
| 385 |
+
return address_ == nullptr ? internal::BuiltInDefaultValue<T&>::Get()
|
| 386 |
+
: *address_;
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
private:
|
| 390 |
+
static T* address_;
|
| 391 |
+
};
|
| 392 |
+
|
| 393 |
+
// This specialization allows DefaultValue<void>::Get() to
|
| 394 |
+
// compile.
|
| 395 |
+
template <>
|
| 396 |
+
class DefaultValue<void> {
|
| 397 |
+
public:
|
| 398 |
+
static bool Exists() { return true; }
|
| 399 |
+
static void Get() {}
|
| 400 |
+
};
|
| 401 |
+
|
| 402 |
+
// Points to the user-set default value for type T.
|
| 403 |
+
template <typename T>
|
| 404 |
+
typename DefaultValue<T>::ValueProducer* DefaultValue<T>::producer_ = nullptr;
|
| 405 |
+
|
| 406 |
+
// Points to the user-set default value for type T&.
|
| 407 |
+
template <typename T>
|
| 408 |
+
T* DefaultValue<T&>::address_ = nullptr;
|
| 409 |
+
|
| 410 |
+
// Implement this interface to define an action for function type F.
|
| 411 |
+
template <typename F>
|
| 412 |
+
class ActionInterface {
|
| 413 |
+
public:
|
| 414 |
+
typedef typename internal::Function<F>::Result Result;
|
| 415 |
+
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
|
| 416 |
+
|
| 417 |
+
ActionInterface() {}
|
| 418 |
+
virtual ~ActionInterface() {}
|
| 419 |
+
|
| 420 |
+
// Performs the action. This method is not const, as in general an
|
| 421 |
+
// action can have side effects and be stateful. For example, a
|
| 422 |
+
// get-the-next-element-from-the-collection action will need to
|
| 423 |
+
// remember the current element.
|
| 424 |
+
virtual Result Perform(const ArgumentTuple& args) = 0;
|
| 425 |
+
|
| 426 |
+
private:
|
| 427 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionInterface);
|
| 428 |
+
};
|
| 429 |
+
|
| 430 |
+
// An Action<F> is a copyable and IMMUTABLE (except by assignment)
|
| 431 |
+
// object that represents an action to be taken when a mock function
|
| 432 |
+
// of type F is called. The implementation of Action<T> is just a
|
| 433 |
+
// std::shared_ptr to const ActionInterface<T>. Don't inherit from Action!
|
| 434 |
+
// You can view an object implementing ActionInterface<F> as a
|
| 435 |
+
// concrete action (including its current state), and an Action<F>
|
| 436 |
+
// object as a handle to it.
|
| 437 |
+
template <typename F>
|
| 438 |
+
class Action {
|
| 439 |
+
// Adapter class to allow constructing Action from a legacy ActionInterface.
|
| 440 |
+
// New code should create Actions from functors instead.
|
| 441 |
+
struct ActionAdapter {
|
| 442 |
+
// Adapter must be copyable to satisfy std::function requirements.
|
| 443 |
+
::std::shared_ptr<ActionInterface<F>> impl_;
|
| 444 |
+
|
| 445 |
+
template <typename... Args>
|
| 446 |
+
typename internal::Function<F>::Result operator()(Args&&... args) {
|
| 447 |
+
return impl_->Perform(
|
| 448 |
+
::std::forward_as_tuple(::std::forward<Args>(args)...));
|
| 449 |
+
}
|
| 450 |
+
};
|
| 451 |
+
|
| 452 |
+
template <typename G>
|
| 453 |
+
using IsCompatibleFunctor = std::is_constructible<std::function<F>, G>;
|
| 454 |
+
|
| 455 |
+
public:
|
| 456 |
+
typedef typename internal::Function<F>::Result Result;
|
| 457 |
+
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
|
| 458 |
+
|
| 459 |
+
// Constructs a null Action. Needed for storing Action objects in
|
| 460 |
+
// STL containers.
|
| 461 |
+
Action() {}
|
| 462 |
+
|
| 463 |
+
// Construct an Action from a specified callable.
|
| 464 |
+
// This cannot take std::function directly, because then Action would not be
|
| 465 |
+
// directly constructible from lambda (it would require two conversions).
|
| 466 |
+
template <
|
| 467 |
+
typename G,
|
| 468 |
+
typename = typename std::enable_if<internal::disjunction<
|
| 469 |
+
IsCompatibleFunctor<G>, std::is_constructible<std::function<Result()>,
|
| 470 |
+
G>>::value>::type>
|
| 471 |
+
Action(G&& fun) { // NOLINT
|
| 472 |
+
Init(::std::forward<G>(fun), IsCompatibleFunctor<G>());
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
// Constructs an Action from its implementation.
|
| 476 |
+
explicit Action(ActionInterface<F>* impl)
|
| 477 |
+
: fun_(ActionAdapter{::std::shared_ptr<ActionInterface<F>>(impl)}) {}
|
| 478 |
+
|
| 479 |
+
// This constructor allows us to turn an Action<Func> object into an
|
| 480 |
+
// Action<F>, as long as F's arguments can be implicitly converted
|
| 481 |
+
// to Func's and Func's return type can be implicitly converted to F's.
|
| 482 |
+
template <typename Func>
|
| 483 |
+
explicit Action(const Action<Func>& action) : fun_(action.fun_) {}
|
| 484 |
+
|
| 485 |
+
// Returns true if and only if this is the DoDefault() action.
|
| 486 |
+
bool IsDoDefault() const { return fun_ == nullptr; }
|
| 487 |
+
|
| 488 |
+
// Performs the action. Note that this method is const even though
|
| 489 |
+
// the corresponding method in ActionInterface is not. The reason
|
| 490 |
+
// is that a const Action<F> means that it cannot be re-bound to
|
| 491 |
+
// another concrete action, not that the concrete action it binds to
|
| 492 |
+
// cannot change state. (Think of the difference between a const
|
| 493 |
+
// pointer and a pointer to const.)
|
| 494 |
+
Result Perform(ArgumentTuple args) const {
|
| 495 |
+
if (IsDoDefault()) {
|
| 496 |
+
internal::IllegalDoDefault(__FILE__, __LINE__);
|
| 497 |
+
}
|
| 498 |
+
return internal::Apply(fun_, ::std::move(args));
|
| 499 |
+
}
|
| 500 |
+
|
| 501 |
+
private:
|
| 502 |
+
template <typename G>
|
| 503 |
+
friend class Action;
|
| 504 |
+
|
| 505 |
+
template <typename G>
|
| 506 |
+
void Init(G&& g, ::std::true_type) {
|
| 507 |
+
fun_ = ::std::forward<G>(g);
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
template <typename G>
|
| 511 |
+
void Init(G&& g, ::std::false_type) {
|
| 512 |
+
fun_ = IgnoreArgs<typename ::std::decay<G>::type>{::std::forward<G>(g)};
|
| 513 |
+
}
|
| 514 |
+
|
| 515 |
+
template <typename FunctionImpl>
|
| 516 |
+
struct IgnoreArgs {
|
| 517 |
+
template <typename... Args>
|
| 518 |
+
Result operator()(const Args&...) const {
|
| 519 |
+
return function_impl();
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
FunctionImpl function_impl;
|
| 523 |
+
};
|
| 524 |
+
|
| 525 |
+
// fun_ is an empty function if and only if this is the DoDefault() action.
|
| 526 |
+
::std::function<F> fun_;
|
| 527 |
+
};
|
| 528 |
+
|
| 529 |
+
// The PolymorphicAction class template makes it easy to implement a
|
| 530 |
+
// polymorphic action (i.e. an action that can be used in mock
|
| 531 |
+
// functions of than one type, e.g. Return()).
|
| 532 |
+
//
|
| 533 |
+
// To define a polymorphic action, a user first provides a COPYABLE
|
| 534 |
+
// implementation class that has a Perform() method template:
|
| 535 |
+
//
|
| 536 |
+
// class FooAction {
|
| 537 |
+
// public:
|
| 538 |
+
// template <typename Result, typename ArgumentTuple>
|
| 539 |
+
// Result Perform(const ArgumentTuple& args) const {
|
| 540 |
+
// // Processes the arguments and returns a result, using
|
| 541 |
+
// // std::get<N>(args) to get the N-th (0-based) argument in the tuple.
|
| 542 |
+
// }
|
| 543 |
+
// ...
|
| 544 |
+
// };
|
| 545 |
+
//
|
| 546 |
+
// Then the user creates the polymorphic action using
|
| 547 |
+
// MakePolymorphicAction(object) where object has type FooAction. See
|
| 548 |
+
// the definition of Return(void) and SetArgumentPointee<N>(value) for
|
| 549 |
+
// complete examples.
|
| 550 |
+
template <typename Impl>
|
| 551 |
+
class PolymorphicAction {
|
| 552 |
+
public:
|
| 553 |
+
explicit PolymorphicAction(const Impl& impl) : impl_(impl) {}
|
| 554 |
+
|
| 555 |
+
template <typename F>
|
| 556 |
+
operator Action<F>() const {
|
| 557 |
+
return Action<F>(new MonomorphicImpl<F>(impl_));
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
private:
|
| 561 |
+
template <typename F>
|
| 562 |
+
class MonomorphicImpl : public ActionInterface<F> {
|
| 563 |
+
public:
|
| 564 |
+
typedef typename internal::Function<F>::Result Result;
|
| 565 |
+
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
|
| 566 |
+
|
| 567 |
+
explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
|
| 568 |
+
|
| 569 |
+
Result Perform(const ArgumentTuple& args) override {
|
| 570 |
+
return impl_.template Perform<Result>(args);
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
private:
|
| 574 |
+
Impl impl_;
|
| 575 |
+
};
|
| 576 |
+
|
| 577 |
+
Impl impl_;
|
| 578 |
+
};
|
| 579 |
+
|
| 580 |
+
// Creates an Action from its implementation and returns it. The
|
| 581 |
+
// created Action object owns the implementation.
|
| 582 |
+
template <typename F>
|
| 583 |
+
Action<F> MakeAction(ActionInterface<F>* impl) {
|
| 584 |
+
return Action<F>(impl);
|
| 585 |
+
}
|
| 586 |
+
|
| 587 |
+
// Creates a polymorphic action from its implementation. This is
|
| 588 |
+
// easier to use than the PolymorphicAction<Impl> constructor as it
|
| 589 |
+
// doesn't require you to explicitly write the template argument, e.g.
|
| 590 |
+
//
|
| 591 |
+
// MakePolymorphicAction(foo);
|
| 592 |
+
// vs
|
| 593 |
+
// PolymorphicAction<TypeOfFoo>(foo);
|
| 594 |
+
template <typename Impl>
|
| 595 |
+
inline PolymorphicAction<Impl> MakePolymorphicAction(const Impl& impl) {
|
| 596 |
+
return PolymorphicAction<Impl>(impl);
|
| 597 |
+
}
|
| 598 |
+
|
| 599 |
+
namespace internal {
|
| 600 |
+
|
| 601 |
+
// Helper struct to specialize ReturnAction to execute a move instead of a copy
|
| 602 |
+
// on return. Useful for move-only types, but could be used on any type.
|
| 603 |
+
template <typename T>
|
| 604 |
+
struct ByMoveWrapper {
|
| 605 |
+
explicit ByMoveWrapper(T value) : payload(std::move(value)) {}
|
| 606 |
+
T payload;
|
| 607 |
+
};
|
| 608 |
+
|
| 609 |
+
// Implements the polymorphic Return(x) action, which can be used in
|
| 610 |
+
// any function that returns the type of x, regardless of the argument
|
| 611 |
+
// types.
|
| 612 |
+
//
|
| 613 |
+
// Note: The value passed into Return must be converted into
|
| 614 |
+
// Function<F>::Result when this action is cast to Action<F> rather than
|
| 615 |
+
// when that action is performed. This is important in scenarios like
|
| 616 |
+
//
|
| 617 |
+
// MOCK_METHOD1(Method, T(U));
|
| 618 |
+
// ...
|
| 619 |
+
// {
|
| 620 |
+
// Foo foo;
|
| 621 |
+
// X x(&foo);
|
| 622 |
+
// EXPECT_CALL(mock, Method(_)).WillOnce(Return(x));
|
| 623 |
+
// }
|
| 624 |
+
//
|
| 625 |
+
// In the example above the variable x holds reference to foo which leaves
|
| 626 |
+
// scope and gets destroyed. If copying X just copies a reference to foo,
|
| 627 |
+
// that copy will be left with a hanging reference. If conversion to T
|
| 628 |
+
// makes a copy of foo, the above code is safe. To support that scenario, we
|
| 629 |
+
// need to make sure that the type conversion happens inside the EXPECT_CALL
|
| 630 |
+
// statement, and conversion of the result of Return to Action<T(U)> is a
|
| 631 |
+
// good place for that.
|
| 632 |
+
//
|
| 633 |
+
// The real life example of the above scenario happens when an invocation
|
| 634 |
+
// of gtl::Container() is passed into Return.
|
| 635 |
+
//
|
| 636 |
+
template <typename R>
|
| 637 |
+
class ReturnAction {
|
| 638 |
+
public:
|
| 639 |
+
// Constructs a ReturnAction object from the value to be returned.
|
| 640 |
+
// 'value' is passed by value instead of by const reference in order
|
| 641 |
+
// to allow Return("string literal") to compile.
|
| 642 |
+
explicit ReturnAction(R value) : value_(new R(std::move(value))) {}
|
| 643 |
+
|
| 644 |
+
// This template type conversion operator allows Return(x) to be
|
| 645 |
+
// used in ANY function that returns x's type.
|
| 646 |
+
template <typename F>
|
| 647 |
+
operator Action<F>() const { // NOLINT
|
| 648 |
+
// Assert statement belongs here because this is the best place to verify
|
| 649 |
+
// conditions on F. It produces the clearest error messages
|
| 650 |
+
// in most compilers.
|
| 651 |
+
// Impl really belongs in this scope as a local class but can't
|
| 652 |
+
// because MSVC produces duplicate symbols in different translation units
|
| 653 |
+
// in this case. Until MS fixes that bug we put Impl into the class scope
|
| 654 |
+
// and put the typedef both here (for use in assert statement) and
|
| 655 |
+
// in the Impl class. But both definitions must be the same.
|
| 656 |
+
typedef typename Function<F>::Result Result;
|
| 657 |
+
GTEST_COMPILE_ASSERT_(
|
| 658 |
+
!std::is_reference<Result>::value,
|
| 659 |
+
use_ReturnRef_instead_of_Return_to_return_a_reference);
|
| 660 |
+
static_assert(!std::is_void<Result>::value,
|
| 661 |
+
"Can't use Return() on an action expected to return `void`.");
|
| 662 |
+
return Action<F>(new Impl<R, F>(value_));
|
| 663 |
+
}
|
| 664 |
+
|
| 665 |
+
private:
|
| 666 |
+
// Implements the Return(x) action for a particular function type F.
|
| 667 |
+
template <typename R_, typename F>
|
| 668 |
+
class Impl : public ActionInterface<F> {
|
| 669 |
+
public:
|
| 670 |
+
typedef typename Function<F>::Result Result;
|
| 671 |
+
typedef typename Function<F>::ArgumentTuple ArgumentTuple;
|
| 672 |
+
|
| 673 |
+
// The implicit cast is necessary when Result has more than one
|
| 674 |
+
// single-argument constructor (e.g. Result is std::vector<int>) and R
|
| 675 |
+
// has a type conversion operator template. In that case, value_(value)
|
| 676 |
+
// won't compile as the compiler doesn't known which constructor of
|
| 677 |
+
// Result to call. ImplicitCast_ forces the compiler to convert R to
|
| 678 |
+
// Result without considering explicit constructors, thus resolving the
|
| 679 |
+
// ambiguity. value_ is then initialized using its copy constructor.
|
| 680 |
+
explicit Impl(const std::shared_ptr<R>& value)
|
| 681 |
+
: value_before_cast_(*value),
|
| 682 |
+
value_(ImplicitCast_<Result>(value_before_cast_)) {}
|
| 683 |
+
|
| 684 |
+
Result Perform(const ArgumentTuple&) override { return value_; }
|
| 685 |
+
|
| 686 |
+
private:
|
| 687 |
+
GTEST_COMPILE_ASSERT_(!std::is_reference<Result>::value,
|
| 688 |
+
Result_cannot_be_a_reference_type);
|
| 689 |
+
// We save the value before casting just in case it is being cast to a
|
| 690 |
+
// wrapper type.
|
| 691 |
+
R value_before_cast_;
|
| 692 |
+
Result value_;
|
| 693 |
+
|
| 694 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl);
|
| 695 |
+
};
|
| 696 |
+
|
| 697 |
+
// Partially specialize for ByMoveWrapper. This version of ReturnAction will
|
| 698 |
+
// move its contents instead.
|
| 699 |
+
template <typename R_, typename F>
|
| 700 |
+
class Impl<ByMoveWrapper<R_>, F> : public ActionInterface<F> {
|
| 701 |
+
public:
|
| 702 |
+
typedef typename Function<F>::Result Result;
|
| 703 |
+
typedef typename Function<F>::ArgumentTuple ArgumentTuple;
|
| 704 |
+
|
| 705 |
+
explicit Impl(const std::shared_ptr<R>& wrapper)
|
| 706 |
+
: performed_(false), wrapper_(wrapper) {}
|
| 707 |
+
|
| 708 |
+
Result Perform(const ArgumentTuple&) override {
|
| 709 |
+
GTEST_CHECK_(!performed_)
|
| 710 |
+
<< "A ByMove() action should only be performed once.";
|
| 711 |
+
performed_ = true;
|
| 712 |
+
return std::move(wrapper_->payload);
|
| 713 |
+
}
|
| 714 |
+
|
| 715 |
+
private:
|
| 716 |
+
bool performed_;
|
| 717 |
+
const std::shared_ptr<R> wrapper_;
|
| 718 |
+
};
|
| 719 |
+
|
| 720 |
+
const std::shared_ptr<R> value_;
|
| 721 |
+
};
|
| 722 |
+
|
| 723 |
+
// Implements the ReturnNull() action.
|
| 724 |
+
class ReturnNullAction {
|
| 725 |
+
public:
|
| 726 |
+
// Allows ReturnNull() to be used in any pointer-returning function. In C++11
|
| 727 |
+
// this is enforced by returning nullptr, and in non-C++11 by asserting a
|
| 728 |
+
// pointer type on compile time.
|
| 729 |
+
template <typename Result, typename ArgumentTuple>
|
| 730 |
+
static Result Perform(const ArgumentTuple&) {
|
| 731 |
+
return nullptr;
|
| 732 |
+
}
|
| 733 |
+
};
|
| 734 |
+
|
| 735 |
+
// Implements the Return() action.
|
| 736 |
+
class ReturnVoidAction {
|
| 737 |
+
public:
|
| 738 |
+
// Allows Return() to be used in any void-returning function.
|
| 739 |
+
template <typename Result, typename ArgumentTuple>
|
| 740 |
+
static void Perform(const ArgumentTuple&) {
|
| 741 |
+
static_assert(std::is_void<Result>::value, "Result should be void.");
|
| 742 |
+
}
|
| 743 |
+
};
|
| 744 |
+
|
| 745 |
+
// Implements the polymorphic ReturnRef(x) action, which can be used
|
| 746 |
+
// in any function that returns a reference to the type of x,
|
| 747 |
+
// regardless of the argument types.
|
| 748 |
+
template <typename T>
|
| 749 |
+
class ReturnRefAction {
|
| 750 |
+
public:
|
| 751 |
+
// Constructs a ReturnRefAction object from the reference to be returned.
|
| 752 |
+
explicit ReturnRefAction(T& ref) : ref_(ref) {} // NOLINT
|
| 753 |
+
|
| 754 |
+
// This template type conversion operator allows ReturnRef(x) to be
|
| 755 |
+
// used in ANY function that returns a reference to x's type.
|
| 756 |
+
template <typename F>
|
| 757 |
+
operator Action<F>() const {
|
| 758 |
+
typedef typename Function<F>::Result Result;
|
| 759 |
+
// Asserts that the function return type is a reference. This
|
| 760 |
+
// catches the user error of using ReturnRef(x) when Return(x)
|
| 761 |
+
// should be used, and generates some helpful error message.
|
| 762 |
+
GTEST_COMPILE_ASSERT_(std::is_reference<Result>::value,
|
| 763 |
+
use_Return_instead_of_ReturnRef_to_return_a_value);
|
| 764 |
+
return Action<F>(new Impl<F>(ref_));
|
| 765 |
+
}
|
| 766 |
+
|
| 767 |
+
private:
|
| 768 |
+
// Implements the ReturnRef(x) action for a particular function type F.
|
| 769 |
+
template <typename F>
|
| 770 |
+
class Impl : public ActionInterface<F> {
|
| 771 |
+
public:
|
| 772 |
+
typedef typename Function<F>::Result Result;
|
| 773 |
+
typedef typename Function<F>::ArgumentTuple ArgumentTuple;
|
| 774 |
+
|
| 775 |
+
explicit Impl(T& ref) : ref_(ref) {} // NOLINT
|
| 776 |
+
|
| 777 |
+
Result Perform(const ArgumentTuple&) override { return ref_; }
|
| 778 |
+
|
| 779 |
+
private:
|
| 780 |
+
T& ref_;
|
| 781 |
+
};
|
| 782 |
+
|
| 783 |
+
T& ref_;
|
| 784 |
+
};
|
| 785 |
+
|
| 786 |
+
// Implements the polymorphic ReturnRefOfCopy(x) action, which can be
|
| 787 |
+
// used in any function that returns a reference to the type of x,
|
| 788 |
+
// regardless of the argument types.
|
| 789 |
+
template <typename T>
|
| 790 |
+
class ReturnRefOfCopyAction {
|
| 791 |
+
public:
|
| 792 |
+
// Constructs a ReturnRefOfCopyAction object from the reference to
|
| 793 |
+
// be returned.
|
| 794 |
+
explicit ReturnRefOfCopyAction(const T& value) : value_(value) {} // NOLINT
|
| 795 |
+
|
| 796 |
+
// This template type conversion operator allows ReturnRefOfCopy(x) to be
|
| 797 |
+
// used in ANY function that returns a reference to x's type.
|
| 798 |
+
template <typename F>
|
| 799 |
+
operator Action<F>() const {
|
| 800 |
+
typedef typename Function<F>::Result Result;
|
| 801 |
+
// Asserts that the function return type is a reference. This
|
| 802 |
+
// catches the user error of using ReturnRefOfCopy(x) when Return(x)
|
| 803 |
+
// should be used, and generates some helpful error message.
|
| 804 |
+
GTEST_COMPILE_ASSERT_(
|
| 805 |
+
std::is_reference<Result>::value,
|
| 806 |
+
use_Return_instead_of_ReturnRefOfCopy_to_return_a_value);
|
| 807 |
+
return Action<F>(new Impl<F>(value_));
|
| 808 |
+
}
|
| 809 |
+
|
| 810 |
+
private:
|
| 811 |
+
// Implements the ReturnRefOfCopy(x) action for a particular function type F.
|
| 812 |
+
template <typename F>
|
| 813 |
+
class Impl : public ActionInterface<F> {
|
| 814 |
+
public:
|
| 815 |
+
typedef typename Function<F>::Result Result;
|
| 816 |
+
typedef typename Function<F>::ArgumentTuple ArgumentTuple;
|
| 817 |
+
|
| 818 |
+
explicit Impl(const T& value) : value_(value) {} // NOLINT
|
| 819 |
+
|
| 820 |
+
Result Perform(const ArgumentTuple&) override { return value_; }
|
| 821 |
+
|
| 822 |
+
private:
|
| 823 |
+
T value_;
|
| 824 |
+
};
|
| 825 |
+
|
| 826 |
+
const T value_;
|
| 827 |
+
};
|
| 828 |
+
|
| 829 |
+
// Implements the polymorphic ReturnRoundRobin(v) action, which can be
|
| 830 |
+
// used in any function that returns the element_type of v.
|
| 831 |
+
template <typename T>
|
| 832 |
+
class ReturnRoundRobinAction {
|
| 833 |
+
public:
|
| 834 |
+
explicit ReturnRoundRobinAction(std::vector<T> values) {
|
| 835 |
+
GTEST_CHECK_(!values.empty())
|
| 836 |
+
<< "ReturnRoundRobin requires at least one element.";
|
| 837 |
+
state_->values = std::move(values);
|
| 838 |
+
}
|
| 839 |
+
|
| 840 |
+
template <typename... Args>
|
| 841 |
+
T operator()(Args&&...) const {
|
| 842 |
+
return state_->Next();
|
| 843 |
+
}
|
| 844 |
+
|
| 845 |
+
private:
|
| 846 |
+
struct State {
|
| 847 |
+
T Next() {
|
| 848 |
+
T ret_val = values[i++];
|
| 849 |
+
if (i == values.size()) i = 0;
|
| 850 |
+
return ret_val;
|
| 851 |
+
}
|
| 852 |
+
|
| 853 |
+
std::vector<T> values;
|
| 854 |
+
size_t i = 0;
|
| 855 |
+
};
|
| 856 |
+
std::shared_ptr<State> state_ = std::make_shared<State>();
|
| 857 |
+
};
|
| 858 |
+
|
| 859 |
+
// Implements the polymorphic DoDefault() action.
|
| 860 |
+
class DoDefaultAction {
|
| 861 |
+
public:
|
| 862 |
+
// This template type conversion operator allows DoDefault() to be
|
| 863 |
+
// used in any function.
|
| 864 |
+
template <typename F>
|
| 865 |
+
operator Action<F>() const { return Action<F>(); } // NOLINT
|
| 866 |
+
};
|
| 867 |
+
|
| 868 |
+
// Implements the Assign action to set a given pointer referent to a
|
| 869 |
+
// particular value.
|
| 870 |
+
template <typename T1, typename T2>
|
| 871 |
+
class AssignAction {
|
| 872 |
+
public:
|
| 873 |
+
AssignAction(T1* ptr, T2 value) : ptr_(ptr), value_(value) {}
|
| 874 |
+
|
| 875 |
+
template <typename Result, typename ArgumentTuple>
|
| 876 |
+
void Perform(const ArgumentTuple& /* args */) const {
|
| 877 |
+
*ptr_ = value_;
|
| 878 |
+
}
|
| 879 |
+
|
| 880 |
+
private:
|
| 881 |
+
T1* const ptr_;
|
| 882 |
+
const T2 value_;
|
| 883 |
+
};
|
| 884 |
+
|
| 885 |
+
#if !GTEST_OS_WINDOWS_MOBILE
|
| 886 |
+
|
| 887 |
+
// Implements the SetErrnoAndReturn action to simulate return from
|
| 888 |
+
// various system calls and libc functions.
|
| 889 |
+
template <typename T>
|
| 890 |
+
class SetErrnoAndReturnAction {
|
| 891 |
+
public:
|
| 892 |
+
SetErrnoAndReturnAction(int errno_value, T result)
|
| 893 |
+
: errno_(errno_value),
|
| 894 |
+
result_(result) {}
|
| 895 |
+
template <typename Result, typename ArgumentTuple>
|
| 896 |
+
Result Perform(const ArgumentTuple& /* args */) const {
|
| 897 |
+
errno = errno_;
|
| 898 |
+
return result_;
|
| 899 |
+
}
|
| 900 |
+
|
| 901 |
+
private:
|
| 902 |
+
const int errno_;
|
| 903 |
+
const T result_;
|
| 904 |
+
};
|
| 905 |
+
|
| 906 |
+
#endif // !GTEST_OS_WINDOWS_MOBILE
|
| 907 |
+
|
| 908 |
+
// Implements the SetArgumentPointee<N>(x) action for any function
|
| 909 |
+
// whose N-th argument (0-based) is a pointer to x's type.
|
| 910 |
+
template <size_t N, typename A, typename = void>
|
| 911 |
+
struct SetArgumentPointeeAction {
|
| 912 |
+
A value;
|
| 913 |
+
|
| 914 |
+
template <typename... Args>
|
| 915 |
+
void operator()(const Args&... args) const {
|
| 916 |
+
*::std::get<N>(std::tie(args...)) = value;
|
| 917 |
+
}
|
| 918 |
+
};
|
| 919 |
+
|
| 920 |
+
// Implements the Invoke(object_ptr, &Class::Method) action.
|
| 921 |
+
template <class Class, typename MethodPtr>
|
| 922 |
+
struct InvokeMethodAction {
|
| 923 |
+
Class* const obj_ptr;
|
| 924 |
+
const MethodPtr method_ptr;
|
| 925 |
+
|
| 926 |
+
template <typename... Args>
|
| 927 |
+
auto operator()(Args&&... args) const
|
| 928 |
+
-> decltype((obj_ptr->*method_ptr)(std::forward<Args>(args)...)) {
|
| 929 |
+
return (obj_ptr->*method_ptr)(std::forward<Args>(args)...);
|
| 930 |
+
}
|
| 931 |
+
};
|
| 932 |
+
|
| 933 |
+
// Implements the InvokeWithoutArgs(f) action. The template argument
|
| 934 |
+
// FunctionImpl is the implementation type of f, which can be either a
|
| 935 |
+
// function pointer or a functor. InvokeWithoutArgs(f) can be used as an
|
| 936 |
+
// Action<F> as long as f's type is compatible with F.
|
| 937 |
+
template <typename FunctionImpl>
|
| 938 |
+
struct InvokeWithoutArgsAction {
|
| 939 |
+
FunctionImpl function_impl;
|
| 940 |
+
|
| 941 |
+
// Allows InvokeWithoutArgs(f) to be used as any action whose type is
|
| 942 |
+
// compatible with f.
|
| 943 |
+
template <typename... Args>
|
| 944 |
+
auto operator()(const Args&...) -> decltype(function_impl()) {
|
| 945 |
+
return function_impl();
|
| 946 |
+
}
|
| 947 |
+
};
|
| 948 |
+
|
| 949 |
+
// Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action.
|
| 950 |
+
template <class Class, typename MethodPtr>
|
| 951 |
+
struct InvokeMethodWithoutArgsAction {
|
| 952 |
+
Class* const obj_ptr;
|
| 953 |
+
const MethodPtr method_ptr;
|
| 954 |
+
|
| 955 |
+
using ReturnType =
|
| 956 |
+
decltype((std::declval<Class*>()->*std::declval<MethodPtr>())());
|
| 957 |
+
|
| 958 |
+
template <typename... Args>
|
| 959 |
+
ReturnType operator()(const Args&...) const {
|
| 960 |
+
return (obj_ptr->*method_ptr)();
|
| 961 |
+
}
|
| 962 |
+
};
|
| 963 |
+
|
| 964 |
+
// Implements the IgnoreResult(action) action.
|
| 965 |
+
template <typename A>
|
| 966 |
+
class IgnoreResultAction {
|
| 967 |
+
public:
|
| 968 |
+
explicit IgnoreResultAction(const A& action) : action_(action) {}
|
| 969 |
+
|
| 970 |
+
template <typename F>
|
| 971 |
+
operator Action<F>() const {
|
| 972 |
+
// Assert statement belongs here because this is the best place to verify
|
| 973 |
+
// conditions on F. It produces the clearest error messages
|
| 974 |
+
// in most compilers.
|
| 975 |
+
// Impl really belongs in this scope as a local class but can't
|
| 976 |
+
// because MSVC produces duplicate symbols in different translation units
|
| 977 |
+
// in this case. Until MS fixes that bug we put Impl into the class scope
|
| 978 |
+
// and put the typedef both here (for use in assert statement) and
|
| 979 |
+
// in the Impl class. But both definitions must be the same.
|
| 980 |
+
typedef typename internal::Function<F>::Result Result;
|
| 981 |
+
|
| 982 |
+
// Asserts at compile time that F returns void.
|
| 983 |
+
static_assert(std::is_void<Result>::value, "Result type should be void.");
|
| 984 |
+
|
| 985 |
+
return Action<F>(new Impl<F>(action_));
|
| 986 |
+
}
|
| 987 |
+
|
| 988 |
+
private:
|
| 989 |
+
template <typename F>
|
| 990 |
+
class Impl : public ActionInterface<F> {
|
| 991 |
+
public:
|
| 992 |
+
typedef typename internal::Function<F>::Result Result;
|
| 993 |
+
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
|
| 994 |
+
|
| 995 |
+
explicit Impl(const A& action) : action_(action) {}
|
| 996 |
+
|
| 997 |
+
void Perform(const ArgumentTuple& args) override {
|
| 998 |
+
// Performs the action and ignores its result.
|
| 999 |
+
action_.Perform(args);
|
| 1000 |
+
}
|
| 1001 |
+
|
| 1002 |
+
private:
|
| 1003 |
+
// Type OriginalFunction is the same as F except that its return
|
| 1004 |
+
// type is IgnoredValue.
|
| 1005 |
+
typedef typename internal::Function<F>::MakeResultIgnoredValue
|
| 1006 |
+
OriginalFunction;
|
| 1007 |
+
|
| 1008 |
+
const Action<OriginalFunction> action_;
|
| 1009 |
+
};
|
| 1010 |
+
|
| 1011 |
+
const A action_;
|
| 1012 |
+
};
|
| 1013 |
+
|
| 1014 |
+
template <typename InnerAction, size_t... I>
|
| 1015 |
+
struct WithArgsAction {
|
| 1016 |
+
InnerAction action;
|
| 1017 |
+
|
| 1018 |
+
// The inner action could be anything convertible to Action<X>.
|
| 1019 |
+
// We use the conversion operator to detect the signature of the inner Action.
|
| 1020 |
+
template <typename R, typename... Args>
|
| 1021 |
+
operator Action<R(Args...)>() const { // NOLINT
|
| 1022 |
+
using TupleType = std::tuple<Args...>;
|
| 1023 |
+
Action<R(typename std::tuple_element<I, TupleType>::type...)>
|
| 1024 |
+
converted(action);
|
| 1025 |
+
|
| 1026 |
+
return [converted](Args... args) -> R {
|
| 1027 |
+
return converted.Perform(std::forward_as_tuple(
|
| 1028 |
+
std::get<I>(std::forward_as_tuple(std::forward<Args>(args)...))...));
|
| 1029 |
+
};
|
| 1030 |
+
}
|
| 1031 |
+
};
|
| 1032 |
+
|
| 1033 |
+
template <typename... Actions>
|
| 1034 |
+
struct DoAllAction {
|
| 1035 |
+
private:
|
| 1036 |
+
template <typename T>
|
| 1037 |
+
using NonFinalType =
|
| 1038 |
+
typename std::conditional<std::is_scalar<T>::value, T, const T&>::type;
|
| 1039 |
+
|
| 1040 |
+
template <typename ActionT, size_t... I>
|
| 1041 |
+
std::vector<ActionT> Convert(IndexSequence<I...>) const {
|
| 1042 |
+
return {ActionT(std::get<I>(actions))...};
|
| 1043 |
+
}
|
| 1044 |
+
|
| 1045 |
+
public:
|
| 1046 |
+
std::tuple<Actions...> actions;
|
| 1047 |
+
|
| 1048 |
+
template <typename R, typename... Args>
|
| 1049 |
+
operator Action<R(Args...)>() const { // NOLINT
|
| 1050 |
+
struct Op {
|
| 1051 |
+
std::vector<Action<void(NonFinalType<Args>...)>> converted;
|
| 1052 |
+
Action<R(Args...)> last;
|
| 1053 |
+
R operator()(Args... args) const {
|
| 1054 |
+
auto tuple_args = std::forward_as_tuple(std::forward<Args>(args)...);
|
| 1055 |
+
for (auto& a : converted) {
|
| 1056 |
+
a.Perform(tuple_args);
|
| 1057 |
+
}
|
| 1058 |
+
return last.Perform(std::move(tuple_args));
|
| 1059 |
+
}
|
| 1060 |
+
};
|
| 1061 |
+
return Op{Convert<Action<void(NonFinalType<Args>...)>>(
|
| 1062 |
+
MakeIndexSequence<sizeof...(Actions) - 1>()),
|
| 1063 |
+
std::get<sizeof...(Actions) - 1>(actions)};
|
| 1064 |
+
}
|
| 1065 |
+
};
|
| 1066 |
+
|
| 1067 |
+
template <typename T, typename... Params>
|
| 1068 |
+
struct ReturnNewAction {
|
| 1069 |
+
T* operator()() const {
|
| 1070 |
+
return internal::Apply(
|
| 1071 |
+
[](const Params&... unpacked_params) {
|
| 1072 |
+
return new T(unpacked_params...);
|
| 1073 |
+
},
|
| 1074 |
+
params);
|
| 1075 |
+
}
|
| 1076 |
+
std::tuple<Params...> params;
|
| 1077 |
+
};
|
| 1078 |
+
|
| 1079 |
+
template <size_t k>
|
| 1080 |
+
struct ReturnArgAction {
|
| 1081 |
+
template <typename... Args>
|
| 1082 |
+
auto operator()(const Args&... args) const ->
|
| 1083 |
+
typename std::tuple_element<k, std::tuple<Args...>>::type {
|
| 1084 |
+
return std::get<k>(std::tie(args...));
|
| 1085 |
+
}
|
| 1086 |
+
};
|
| 1087 |
+
|
| 1088 |
+
template <size_t k, typename Ptr>
|
| 1089 |
+
struct SaveArgAction {
|
| 1090 |
+
Ptr pointer;
|
| 1091 |
+
|
| 1092 |
+
template <typename... Args>
|
| 1093 |
+
void operator()(const Args&... args) const {
|
| 1094 |
+
*pointer = std::get<k>(std::tie(args...));
|
| 1095 |
+
}
|
| 1096 |
+
};
|
| 1097 |
+
|
| 1098 |
+
template <size_t k, typename Ptr>
|
| 1099 |
+
struct SaveArgPointeeAction {
|
| 1100 |
+
Ptr pointer;
|
| 1101 |
+
|
| 1102 |
+
template <typename... Args>
|
| 1103 |
+
void operator()(const Args&... args) const {
|
| 1104 |
+
*pointer = *std::get<k>(std::tie(args...));
|
| 1105 |
+
}
|
| 1106 |
+
};
|
| 1107 |
+
|
| 1108 |
+
template <size_t k, typename T>
|
| 1109 |
+
struct SetArgRefereeAction {
|
| 1110 |
+
T value;
|
| 1111 |
+
|
| 1112 |
+
template <typename... Args>
|
| 1113 |
+
void operator()(Args&&... args) const {
|
| 1114 |
+
using argk_type =
|
| 1115 |
+
typename ::std::tuple_element<k, std::tuple<Args...>>::type;
|
| 1116 |
+
static_assert(std::is_lvalue_reference<argk_type>::value,
|
| 1117 |
+
"Argument must be a reference type.");
|
| 1118 |
+
std::get<k>(std::tie(args...)) = value;
|
| 1119 |
+
}
|
| 1120 |
+
};
|
| 1121 |
+
|
| 1122 |
+
template <size_t k, typename I1, typename I2>
|
| 1123 |
+
struct SetArrayArgumentAction {
|
| 1124 |
+
I1 first;
|
| 1125 |
+
I2 last;
|
| 1126 |
+
|
| 1127 |
+
template <typename... Args>
|
| 1128 |
+
void operator()(const Args&... args) const {
|
| 1129 |
+
auto value = std::get<k>(std::tie(args...));
|
| 1130 |
+
for (auto it = first; it != last; ++it, (void)++value) {
|
| 1131 |
+
*value = *it;
|
| 1132 |
+
}
|
| 1133 |
+
}
|
| 1134 |
+
};
|
| 1135 |
+
|
| 1136 |
+
template <size_t k>
|
| 1137 |
+
struct DeleteArgAction {
|
| 1138 |
+
template <typename... Args>
|
| 1139 |
+
void operator()(const Args&... args) const {
|
| 1140 |
+
delete std::get<k>(std::tie(args...));
|
| 1141 |
+
}
|
| 1142 |
+
};
|
| 1143 |
+
|
| 1144 |
+
template <typename Ptr>
|
| 1145 |
+
struct ReturnPointeeAction {
|
| 1146 |
+
Ptr pointer;
|
| 1147 |
+
template <typename... Args>
|
| 1148 |
+
auto operator()(const Args&...) const -> decltype(*pointer) {
|
| 1149 |
+
return *pointer;
|
| 1150 |
+
}
|
| 1151 |
+
};
|
| 1152 |
+
|
| 1153 |
+
#if GTEST_HAS_EXCEPTIONS
|
| 1154 |
+
template <typename T>
|
| 1155 |
+
struct ThrowAction {
|
| 1156 |
+
T exception;
|
| 1157 |
+
// We use a conversion operator to adapt to any return type.
|
| 1158 |
+
template <typename R, typename... Args>
|
| 1159 |
+
operator Action<R(Args...)>() const { // NOLINT
|
| 1160 |
+
T copy = exception;
|
| 1161 |
+
return [copy](Args...) -> R { throw copy; };
|
| 1162 |
+
}
|
| 1163 |
+
};
|
| 1164 |
+
#endif // GTEST_HAS_EXCEPTIONS
|
| 1165 |
+
|
| 1166 |
+
} // namespace internal
|
| 1167 |
+
|
| 1168 |
+
// An Unused object can be implicitly constructed from ANY value.
|
| 1169 |
+
// This is handy when defining actions that ignore some or all of the
|
| 1170 |
+
// mock function arguments. For example, given
|
| 1171 |
+
//
|
| 1172 |
+
// MOCK_METHOD3(Foo, double(const string& label, double x, double y));
|
| 1173 |
+
// MOCK_METHOD3(Bar, double(int index, double x, double y));
|
| 1174 |
+
//
|
| 1175 |
+
// instead of
|
| 1176 |
+
//
|
| 1177 |
+
// double DistanceToOriginWithLabel(const string& label, double x, double y) {
|
| 1178 |
+
// return sqrt(x*x + y*y);
|
| 1179 |
+
// }
|
| 1180 |
+
// double DistanceToOriginWithIndex(int index, double x, double y) {
|
| 1181 |
+
// return sqrt(x*x + y*y);
|
| 1182 |
+
// }
|
| 1183 |
+
// ...
|
| 1184 |
+
// EXPECT_CALL(mock, Foo("abc", _, _))
|
| 1185 |
+
// .WillOnce(Invoke(DistanceToOriginWithLabel));
|
| 1186 |
+
// EXPECT_CALL(mock, Bar(5, _, _))
|
| 1187 |
+
// .WillOnce(Invoke(DistanceToOriginWithIndex));
|
| 1188 |
+
//
|
| 1189 |
+
// you could write
|
| 1190 |
+
//
|
| 1191 |
+
// // We can declare any uninteresting argument as Unused.
|
| 1192 |
+
// double DistanceToOrigin(Unused, double x, double y) {
|
| 1193 |
+
// return sqrt(x*x + y*y);
|
| 1194 |
+
// }
|
| 1195 |
+
// ...
|
| 1196 |
+
// EXPECT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin));
|
| 1197 |
+
// EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin));
|
| 1198 |
+
typedef internal::IgnoredValue Unused;
|
| 1199 |
+
|
| 1200 |
+
// Creates an action that does actions a1, a2, ..., sequentially in
|
| 1201 |
+
// each invocation. All but the last action will have a readonly view of the
|
| 1202 |
+
// arguments.
|
| 1203 |
+
template <typename... Action>
|
| 1204 |
+
internal::DoAllAction<typename std::decay<Action>::type...> DoAll(
|
| 1205 |
+
Action&&... action) {
|
| 1206 |
+
return {std::forward_as_tuple(std::forward<Action>(action)...)};
|
| 1207 |
+
}
|
| 1208 |
+
|
| 1209 |
+
// WithArg<k>(an_action) creates an action that passes the k-th
|
| 1210 |
+
// (0-based) argument of the mock function to an_action and performs
|
| 1211 |
+
// it. It adapts an action accepting one argument to one that accepts
|
| 1212 |
+
// multiple arguments. For convenience, we also provide
|
| 1213 |
+
// WithArgs<k>(an_action) (defined below) as a synonym.
|
| 1214 |
+
template <size_t k, typename InnerAction>
|
| 1215 |
+
internal::WithArgsAction<typename std::decay<InnerAction>::type, k>
|
| 1216 |
+
WithArg(InnerAction&& action) {
|
| 1217 |
+
return {std::forward<InnerAction>(action)};
|
| 1218 |
+
}
|
| 1219 |
+
|
| 1220 |
+
// WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes
|
| 1221 |
+
// the selected arguments of the mock function to an_action and
|
| 1222 |
+
// performs it. It serves as an adaptor between actions with
|
| 1223 |
+
// different argument lists.
|
| 1224 |
+
template <size_t k, size_t... ks, typename InnerAction>
|
| 1225 |
+
internal::WithArgsAction<typename std::decay<InnerAction>::type, k, ks...>
|
| 1226 |
+
WithArgs(InnerAction&& action) {
|
| 1227 |
+
return {std::forward<InnerAction>(action)};
|
| 1228 |
+
}
|
| 1229 |
+
|
| 1230 |
+
// WithoutArgs(inner_action) can be used in a mock function with a
|
| 1231 |
+
// non-empty argument list to perform inner_action, which takes no
|
| 1232 |
+
// argument. In other words, it adapts an action accepting no
|
| 1233 |
+
// argument to one that accepts (and ignores) arguments.
|
| 1234 |
+
template <typename InnerAction>
|
| 1235 |
+
internal::WithArgsAction<typename std::decay<InnerAction>::type>
|
| 1236 |
+
WithoutArgs(InnerAction&& action) {
|
| 1237 |
+
return {std::forward<InnerAction>(action)};
|
| 1238 |
+
}
|
| 1239 |
+
|
| 1240 |
+
// Creates an action that returns 'value'. 'value' is passed by value
|
| 1241 |
+
// instead of const reference - otherwise Return("string literal")
|
| 1242 |
+
// will trigger a compiler error about using array as initializer.
|
| 1243 |
+
template <typename R>
|
| 1244 |
+
internal::ReturnAction<R> Return(R value) {
|
| 1245 |
+
return internal::ReturnAction<R>(std::move(value));
|
| 1246 |
+
}
|
| 1247 |
+
|
| 1248 |
+
// Creates an action that returns NULL.
|
| 1249 |
+
inline PolymorphicAction<internal::ReturnNullAction> ReturnNull() {
|
| 1250 |
+
return MakePolymorphicAction(internal::ReturnNullAction());
|
| 1251 |
+
}
|
| 1252 |
+
|
| 1253 |
+
// Creates an action that returns from a void function.
|
| 1254 |
+
inline PolymorphicAction<internal::ReturnVoidAction> Return() {
|
| 1255 |
+
return MakePolymorphicAction(internal::ReturnVoidAction());
|
| 1256 |
+
}
|
| 1257 |
+
|
| 1258 |
+
// Creates an action that returns the reference to a variable.
|
| 1259 |
+
template <typename R>
|
| 1260 |
+
inline internal::ReturnRefAction<R> ReturnRef(R& x) { // NOLINT
|
| 1261 |
+
return internal::ReturnRefAction<R>(x);
|
| 1262 |
+
}
|
| 1263 |
+
|
| 1264 |
+
// Prevent using ReturnRef on reference to temporary.
|
| 1265 |
+
template <typename R, R* = nullptr>
|
| 1266 |
+
internal::ReturnRefAction<R> ReturnRef(R&&) = delete;
|
| 1267 |
+
|
| 1268 |
+
// Creates an action that returns the reference to a copy of the
|
| 1269 |
+
// argument. The copy is created when the action is constructed and
|
| 1270 |
+
// lives as long as the action.
|
| 1271 |
+
template <typename R>
|
| 1272 |
+
inline internal::ReturnRefOfCopyAction<R> ReturnRefOfCopy(const R& x) {
|
| 1273 |
+
return internal::ReturnRefOfCopyAction<R>(x);
|
| 1274 |
+
}
|
| 1275 |
+
|
| 1276 |
+
// Modifies the parent action (a Return() action) to perform a move of the
|
| 1277 |
+
// argument instead of a copy.
|
| 1278 |
+
// Return(ByMove()) actions can only be executed once and will assert this
|
| 1279 |
+
// invariant.
|
| 1280 |
+
template <typename R>
|
| 1281 |
+
internal::ByMoveWrapper<R> ByMove(R x) {
|
| 1282 |
+
return internal::ByMoveWrapper<R>(std::move(x));
|
| 1283 |
+
}
|
| 1284 |
+
|
| 1285 |
+
// Creates an action that returns an element of `vals`. Calling this action will
|
| 1286 |
+
// repeatedly return the next value from `vals` until it reaches the end and
|
| 1287 |
+
// will restart from the beginning.
|
| 1288 |
+
template <typename T>
|
| 1289 |
+
internal::ReturnRoundRobinAction<T> ReturnRoundRobin(std::vector<T> vals) {
|
| 1290 |
+
return internal::ReturnRoundRobinAction<T>(std::move(vals));
|
| 1291 |
+
}
|
| 1292 |
+
|
| 1293 |
+
// Creates an action that returns an element of `vals`. Calling this action will
|
| 1294 |
+
// repeatedly return the next value from `vals` until it reaches the end and
|
| 1295 |
+
// will restart from the beginning.
|
| 1296 |
+
template <typename T>
|
| 1297 |
+
internal::ReturnRoundRobinAction<T> ReturnRoundRobin(
|
| 1298 |
+
std::initializer_list<T> vals) {
|
| 1299 |
+
return internal::ReturnRoundRobinAction<T>(std::vector<T>(vals));
|
| 1300 |
+
}
|
| 1301 |
+
|
| 1302 |
+
// Creates an action that does the default action for the give mock function.
|
| 1303 |
+
inline internal::DoDefaultAction DoDefault() {
|
| 1304 |
+
return internal::DoDefaultAction();
|
| 1305 |
+
}
|
| 1306 |
+
|
| 1307 |
+
// Creates an action that sets the variable pointed by the N-th
|
| 1308 |
+
// (0-based) function argument to 'value'.
|
| 1309 |
+
template <size_t N, typename T>
|
| 1310 |
+
internal::SetArgumentPointeeAction<N, T> SetArgPointee(T value) {
|
| 1311 |
+
return {std::move(value)};
|
| 1312 |
+
}
|
| 1313 |
+
|
| 1314 |
+
// The following version is DEPRECATED.
|
| 1315 |
+
template <size_t N, typename T>
|
| 1316 |
+
internal::SetArgumentPointeeAction<N, T> SetArgumentPointee(T value) {
|
| 1317 |
+
return {std::move(value)};
|
| 1318 |
+
}
|
| 1319 |
+
|
| 1320 |
+
// Creates an action that sets a pointer referent to a given value.
|
| 1321 |
+
template <typename T1, typename T2>
|
| 1322 |
+
PolymorphicAction<internal::AssignAction<T1, T2> > Assign(T1* ptr, T2 val) {
|
| 1323 |
+
return MakePolymorphicAction(internal::AssignAction<T1, T2>(ptr, val));
|
| 1324 |
+
}
|
| 1325 |
+
|
| 1326 |
+
#if !GTEST_OS_WINDOWS_MOBILE
|
| 1327 |
+
|
| 1328 |
+
// Creates an action that sets errno and returns the appropriate error.
|
| 1329 |
+
template <typename T>
|
| 1330 |
+
PolymorphicAction<internal::SetErrnoAndReturnAction<T> >
|
| 1331 |
+
SetErrnoAndReturn(int errval, T result) {
|
| 1332 |
+
return MakePolymorphicAction(
|
| 1333 |
+
internal::SetErrnoAndReturnAction<T>(errval, result));
|
| 1334 |
+
}
|
| 1335 |
+
|
| 1336 |
+
#endif // !GTEST_OS_WINDOWS_MOBILE
|
| 1337 |
+
|
| 1338 |
+
// Various overloads for Invoke().
|
| 1339 |
+
|
| 1340 |
+
// Legacy function.
|
| 1341 |
+
// Actions can now be implicitly constructed from callables. No need to create
|
| 1342 |
+
// wrapper objects.
|
| 1343 |
+
// This function exists for backwards compatibility.
|
| 1344 |
+
template <typename FunctionImpl>
|
| 1345 |
+
typename std::decay<FunctionImpl>::type Invoke(FunctionImpl&& function_impl) {
|
| 1346 |
+
return std::forward<FunctionImpl>(function_impl);
|
| 1347 |
+
}
|
| 1348 |
+
|
| 1349 |
+
// Creates an action that invokes the given method on the given object
|
| 1350 |
+
// with the mock function's arguments.
|
| 1351 |
+
template <class Class, typename MethodPtr>
|
| 1352 |
+
internal::InvokeMethodAction<Class, MethodPtr> Invoke(Class* obj_ptr,
|
| 1353 |
+
MethodPtr method_ptr) {
|
| 1354 |
+
return {obj_ptr, method_ptr};
|
| 1355 |
+
}
|
| 1356 |
+
|
| 1357 |
+
// Creates an action that invokes 'function_impl' with no argument.
|
| 1358 |
+
template <typename FunctionImpl>
|
| 1359 |
+
internal::InvokeWithoutArgsAction<typename std::decay<FunctionImpl>::type>
|
| 1360 |
+
InvokeWithoutArgs(FunctionImpl function_impl) {
|
| 1361 |
+
return {std::move(function_impl)};
|
| 1362 |
+
}
|
| 1363 |
+
|
| 1364 |
+
// Creates an action that invokes the given method on the given object
|
| 1365 |
+
// with no argument.
|
| 1366 |
+
template <class Class, typename MethodPtr>
|
| 1367 |
+
internal::InvokeMethodWithoutArgsAction<Class, MethodPtr> InvokeWithoutArgs(
|
| 1368 |
+
Class* obj_ptr, MethodPtr method_ptr) {
|
| 1369 |
+
return {obj_ptr, method_ptr};
|
| 1370 |
+
}
|
| 1371 |
+
|
| 1372 |
+
// Creates an action that performs an_action and throws away its
|
| 1373 |
+
// result. In other words, it changes the return type of an_action to
|
| 1374 |
+
// void. an_action MUST NOT return void, or the code won't compile.
|
| 1375 |
+
template <typename A>
|
| 1376 |
+
inline internal::IgnoreResultAction<A> IgnoreResult(const A& an_action) {
|
| 1377 |
+
return internal::IgnoreResultAction<A>(an_action);
|
| 1378 |
+
}
|
| 1379 |
+
|
| 1380 |
+
// Creates a reference wrapper for the given L-value. If necessary,
|
| 1381 |
+
// you can explicitly specify the type of the reference. For example,
|
| 1382 |
+
// suppose 'derived' is an object of type Derived, ByRef(derived)
|
| 1383 |
+
// would wrap a Derived&. If you want to wrap a const Base& instead,
|
| 1384 |
+
// where Base is a base class of Derived, just write:
|
| 1385 |
+
//
|
| 1386 |
+
// ByRef<const Base>(derived)
|
| 1387 |
+
//
|
| 1388 |
+
// N.B. ByRef is redundant with std::ref, std::cref and std::reference_wrapper.
|
| 1389 |
+
// However, it may still be used for consistency with ByMove().
|
| 1390 |
+
template <typename T>
|
| 1391 |
+
inline ::std::reference_wrapper<T> ByRef(T& l_value) { // NOLINT
|
| 1392 |
+
return ::std::reference_wrapper<T>(l_value);
|
| 1393 |
+
}
|
| 1394 |
+
|
| 1395 |
+
// The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new
|
| 1396 |
+
// instance of type T, constructed on the heap with constructor arguments
|
| 1397 |
+
// a1, a2, ..., and a_k. The caller assumes ownership of the returned value.
|
| 1398 |
+
template <typename T, typename... Params>
|
| 1399 |
+
internal::ReturnNewAction<T, typename std::decay<Params>::type...> ReturnNew(
|
| 1400 |
+
Params&&... params) {
|
| 1401 |
+
return {std::forward_as_tuple(std::forward<Params>(params)...)};
|
| 1402 |
+
}
|
| 1403 |
+
|
| 1404 |
+
// Action ReturnArg<k>() returns the k-th argument of the mock function.
|
| 1405 |
+
template <size_t k>
|
| 1406 |
+
internal::ReturnArgAction<k> ReturnArg() {
|
| 1407 |
+
return {};
|
| 1408 |
+
}
|
| 1409 |
+
|
| 1410 |
+
// Action SaveArg<k>(pointer) saves the k-th (0-based) argument of the
|
| 1411 |
+
// mock function to *pointer.
|
| 1412 |
+
template <size_t k, typename Ptr>
|
| 1413 |
+
internal::SaveArgAction<k, Ptr> SaveArg(Ptr pointer) {
|
| 1414 |
+
return {pointer};
|
| 1415 |
+
}
|
| 1416 |
+
|
| 1417 |
+
// Action SaveArgPointee<k>(pointer) saves the value pointed to
|
| 1418 |
+
// by the k-th (0-based) argument of the mock function to *pointer.
|
| 1419 |
+
template <size_t k, typename Ptr>
|
| 1420 |
+
internal::SaveArgPointeeAction<k, Ptr> SaveArgPointee(Ptr pointer) {
|
| 1421 |
+
return {pointer};
|
| 1422 |
+
}
|
| 1423 |
+
|
| 1424 |
+
// Action SetArgReferee<k>(value) assigns 'value' to the variable
|
| 1425 |
+
// referenced by the k-th (0-based) argument of the mock function.
|
| 1426 |
+
template <size_t k, typename T>
|
| 1427 |
+
internal::SetArgRefereeAction<k, typename std::decay<T>::type> SetArgReferee(
|
| 1428 |
+
T&& value) {
|
| 1429 |
+
return {std::forward<T>(value)};
|
| 1430 |
+
}
|
| 1431 |
+
|
| 1432 |
+
// Action SetArrayArgument<k>(first, last) copies the elements in
|
| 1433 |
+
// source range [first, last) to the array pointed to by the k-th
|
| 1434 |
+
// (0-based) argument, which can be either a pointer or an
|
| 1435 |
+
// iterator. The action does not take ownership of the elements in the
|
| 1436 |
+
// source range.
|
| 1437 |
+
template <size_t k, typename I1, typename I2>
|
| 1438 |
+
internal::SetArrayArgumentAction<k, I1, I2> SetArrayArgument(I1 first,
|
| 1439 |
+
I2 last) {
|
| 1440 |
+
return {first, last};
|
| 1441 |
+
}
|
| 1442 |
+
|
| 1443 |
+
// Action DeleteArg<k>() deletes the k-th (0-based) argument of the mock
|
| 1444 |
+
// function.
|
| 1445 |
+
template <size_t k>
|
| 1446 |
+
internal::DeleteArgAction<k> DeleteArg() {
|
| 1447 |
+
return {};
|
| 1448 |
+
}
|
| 1449 |
+
|
| 1450 |
+
// This action returns the value pointed to by 'pointer'.
|
| 1451 |
+
template <typename Ptr>
|
| 1452 |
+
internal::ReturnPointeeAction<Ptr> ReturnPointee(Ptr pointer) {
|
| 1453 |
+
return {pointer};
|
| 1454 |
+
}
|
| 1455 |
+
|
| 1456 |
+
// Action Throw(exception) can be used in a mock function of any type
|
| 1457 |
+
// to throw the given exception. Any copyable value can be thrown.
|
| 1458 |
+
#if GTEST_HAS_EXCEPTIONS
|
| 1459 |
+
template <typename T>
|
| 1460 |
+
internal::ThrowAction<typename std::decay<T>::type> Throw(T&& exception) {
|
| 1461 |
+
return {std::forward<T>(exception)};
|
| 1462 |
+
}
|
| 1463 |
+
#endif // GTEST_HAS_EXCEPTIONS
|
| 1464 |
+
|
| 1465 |
+
namespace internal {
|
| 1466 |
+
|
| 1467 |
+
// A macro from the ACTION* family (defined later in gmock-generated-actions.h)
|
| 1468 |
+
// defines an action that can be used in a mock function. Typically,
|
| 1469 |
+
// these actions only care about a subset of the arguments of the mock
|
| 1470 |
+
// function. For example, if such an action only uses the second
|
| 1471 |
+
// argument, it can be used in any mock function that takes >= 2
|
| 1472 |
+
// arguments where the type of the second argument is compatible.
|
| 1473 |
+
//
|
| 1474 |
+
// Therefore, the action implementation must be prepared to take more
|
| 1475 |
+
// arguments than it needs. The ExcessiveArg type is used to
|
| 1476 |
+
// represent those excessive arguments. In order to keep the compiler
|
| 1477 |
+
// error messages tractable, we define it in the testing namespace
|
| 1478 |
+
// instead of testing::internal. However, this is an INTERNAL TYPE
|
| 1479 |
+
// and subject to change without notice, so a user MUST NOT USE THIS
|
| 1480 |
+
// TYPE DIRECTLY.
|
| 1481 |
+
struct ExcessiveArg {};
|
| 1482 |
+
|
| 1483 |
+
// Builds an implementation of an Action<> for some particular signature, using
|
| 1484 |
+
// a class defined by an ACTION* macro.
|
| 1485 |
+
template <typename F, typename Impl> struct ActionImpl;
|
| 1486 |
+
|
| 1487 |
+
template <typename Impl>
|
| 1488 |
+
struct ImplBase {
|
| 1489 |
+
struct Holder {
|
| 1490 |
+
// Allows each copy of the Action<> to get to the Impl.
|
| 1491 |
+
explicit operator const Impl&() const { return *ptr; }
|
| 1492 |
+
std::shared_ptr<Impl> ptr;
|
| 1493 |
+
};
|
| 1494 |
+
using type = typename std::conditional<std::is_constructible<Impl>::value,
|
| 1495 |
+
Impl, Holder>::type;
|
| 1496 |
+
};
|
| 1497 |
+
|
| 1498 |
+
template <typename R, typename... Args, typename Impl>
|
| 1499 |
+
struct ActionImpl<R(Args...), Impl> : ImplBase<Impl>::type {
|
| 1500 |
+
using Base = typename ImplBase<Impl>::type;
|
| 1501 |
+
using function_type = R(Args...);
|
| 1502 |
+
using args_type = std::tuple<Args...>;
|
| 1503 |
+
|
| 1504 |
+
ActionImpl() = default; // Only defined if appropriate for Base.
|
| 1505 |
+
explicit ActionImpl(std::shared_ptr<Impl> impl) : Base{std::move(impl)} { }
|
| 1506 |
+
|
| 1507 |
+
R operator()(Args&&... arg) const {
|
| 1508 |
+
static constexpr size_t kMaxArgs =
|
| 1509 |
+
sizeof...(Args) <= 10 ? sizeof...(Args) : 10;
|
| 1510 |
+
return Apply(MakeIndexSequence<kMaxArgs>{},
|
| 1511 |
+
MakeIndexSequence<10 - kMaxArgs>{},
|
| 1512 |
+
args_type{std::forward<Args>(arg)...});
|
| 1513 |
+
}
|
| 1514 |
+
|
| 1515 |
+
template <std::size_t... arg_id, std::size_t... excess_id>
|
| 1516 |
+
R Apply(IndexSequence<arg_id...>, IndexSequence<excess_id...>,
|
| 1517 |
+
const args_type& args) const {
|
| 1518 |
+
// Impl need not be specific to the signature of action being implemented;
|
| 1519 |
+
// only the implementing function body needs to have all of the specific
|
| 1520 |
+
// types instantiated. Up to 10 of the args that are provided by the
|
| 1521 |
+
// args_type get passed, followed by a dummy of unspecified type for the
|
| 1522 |
+
// remainder up to 10 explicit args.
|
| 1523 |
+
static constexpr ExcessiveArg kExcessArg{};
|
| 1524 |
+
return static_cast<const Impl&>(*this).template gmock_PerformImpl<
|
| 1525 |
+
/*function_type=*/function_type, /*return_type=*/R,
|
| 1526 |
+
/*args_type=*/args_type,
|
| 1527 |
+
/*argN_type=*/typename std::tuple_element<arg_id, args_type>::type...>(
|
| 1528 |
+
/*args=*/args, std::get<arg_id>(args)...,
|
| 1529 |
+
((void)excess_id, kExcessArg)...);
|
| 1530 |
+
}
|
| 1531 |
+
};
|
| 1532 |
+
|
| 1533 |
+
// Stores a default-constructed Impl as part of the Action<>'s
|
| 1534 |
+
// std::function<>. The Impl should be trivial to copy.
|
| 1535 |
+
template <typename F, typename Impl>
|
| 1536 |
+
::testing::Action<F> MakeAction() {
|
| 1537 |
+
return ::testing::Action<F>(ActionImpl<F, Impl>());
|
| 1538 |
+
}
|
| 1539 |
+
|
| 1540 |
+
// Stores just the one given instance of Impl.
|
| 1541 |
+
template <typename F, typename Impl>
|
| 1542 |
+
::testing::Action<F> MakeAction(std::shared_ptr<Impl> impl) {
|
| 1543 |
+
return ::testing::Action<F>(ActionImpl<F, Impl>(std::move(impl)));
|
| 1544 |
+
}
|
| 1545 |
+
|
| 1546 |
+
#define GMOCK_INTERNAL_ARG_UNUSED(i, data, el) \
|
| 1547 |
+
, const arg##i##_type& arg##i GTEST_ATTRIBUTE_UNUSED_
|
| 1548 |
+
#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_ \
|
| 1549 |
+
const args_type& args GTEST_ATTRIBUTE_UNUSED_ GMOCK_PP_REPEAT( \
|
| 1550 |
+
GMOCK_INTERNAL_ARG_UNUSED, , 10)
|
| 1551 |
+
|
| 1552 |
+
#define GMOCK_INTERNAL_ARG(i, data, el) , const arg##i##_type& arg##i
|
| 1553 |
+
#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_ \
|
| 1554 |
+
const args_type& args GMOCK_PP_REPEAT(GMOCK_INTERNAL_ARG, , 10)
|
| 1555 |
+
|
| 1556 |
+
#define GMOCK_INTERNAL_TEMPLATE_ARG(i, data, el) , typename arg##i##_type
|
| 1557 |
+
#define GMOCK_ACTION_TEMPLATE_ARGS_NAMES_ \
|
| 1558 |
+
GMOCK_PP_TAIL(GMOCK_PP_REPEAT(GMOCK_INTERNAL_TEMPLATE_ARG, , 10))
|
| 1559 |
+
|
| 1560 |
+
#define GMOCK_INTERNAL_TYPENAME_PARAM(i, data, param) , typename param##_type
|
| 1561 |
+
#define GMOCK_ACTION_TYPENAME_PARAMS_(params) \
|
| 1562 |
+
GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPENAME_PARAM, , params))
|
| 1563 |
+
|
| 1564 |
+
#define GMOCK_INTERNAL_TYPE_PARAM(i, data, param) , param##_type
|
| 1565 |
+
#define GMOCK_ACTION_TYPE_PARAMS_(params) \
|
| 1566 |
+
GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_PARAM, , params))
|
| 1567 |
+
|
| 1568 |
+
#define GMOCK_INTERNAL_TYPE_GVALUE_PARAM(i, data, param) \
|
| 1569 |
+
, param##_type gmock_p##i
|
| 1570 |
+
#define GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params) \
|
| 1571 |
+
GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_GVALUE_PARAM, , params))
|
| 1572 |
+
|
| 1573 |
+
#define GMOCK_INTERNAL_GVALUE_PARAM(i, data, param) \
|
| 1574 |
+
, std::forward<param##_type>(gmock_p##i)
|
| 1575 |
+
#define GMOCK_ACTION_GVALUE_PARAMS_(params) \
|
| 1576 |
+
GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GVALUE_PARAM, , params))
|
| 1577 |
+
|
| 1578 |
+
#define GMOCK_INTERNAL_INIT_PARAM(i, data, param) \
|
| 1579 |
+
, param(::std::forward<param##_type>(gmock_p##i))
|
| 1580 |
+
#define GMOCK_ACTION_INIT_PARAMS_(params) \
|
| 1581 |
+
GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_INIT_PARAM, , params))
|
| 1582 |
+
|
| 1583 |
+
#define GMOCK_INTERNAL_FIELD_PARAM(i, data, param) param##_type param;
|
| 1584 |
+
#define GMOCK_ACTION_FIELD_PARAMS_(params) \
|
| 1585 |
+
GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_FIELD_PARAM, , params)
|
| 1586 |
+
|
| 1587 |
+
#define GMOCK_INTERNAL_ACTION(name, full_name, params) \
|
| 1588 |
+
template <GMOCK_ACTION_TYPENAME_PARAMS_(params)> \
|
| 1589 |
+
class full_name { \
|
| 1590 |
+
public: \
|
| 1591 |
+
explicit full_name(GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) \
|
| 1592 |
+
: impl_(std::make_shared<gmock_Impl>( \
|
| 1593 |
+
GMOCK_ACTION_GVALUE_PARAMS_(params))) { } \
|
| 1594 |
+
full_name(const full_name&) = default; \
|
| 1595 |
+
full_name(full_name&&) noexcept = default; \
|
| 1596 |
+
template <typename F> \
|
| 1597 |
+
operator ::testing::Action<F>() const { \
|
| 1598 |
+
return ::testing::internal::MakeAction<F>(impl_); \
|
| 1599 |
+
} \
|
| 1600 |
+
private: \
|
| 1601 |
+
class gmock_Impl { \
|
| 1602 |
+
public: \
|
| 1603 |
+
explicit gmock_Impl(GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) \
|
| 1604 |
+
: GMOCK_ACTION_INIT_PARAMS_(params) {} \
|
| 1605 |
+
template <typename function_type, typename return_type, \
|
| 1606 |
+
typename args_type, GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \
|
| 1607 |
+
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \
|
| 1608 |
+
GMOCK_ACTION_FIELD_PARAMS_(params) \
|
| 1609 |
+
}; \
|
| 1610 |
+
std::shared_ptr<const gmock_Impl> impl_; \
|
| 1611 |
+
}; \
|
| 1612 |
+
template <GMOCK_ACTION_TYPENAME_PARAMS_(params)> \
|
| 1613 |
+
inline full_name<GMOCK_ACTION_TYPE_PARAMS_(params)> name( \
|
| 1614 |
+
GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) { \
|
| 1615 |
+
return full_name<GMOCK_ACTION_TYPE_PARAMS_(params)>( \
|
| 1616 |
+
GMOCK_ACTION_GVALUE_PARAMS_(params)); \
|
| 1617 |
+
} \
|
| 1618 |
+
template <GMOCK_ACTION_TYPENAME_PARAMS_(params)> \
|
| 1619 |
+
template <typename function_type, typename return_type, typename args_type, \
|
| 1620 |
+
GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \
|
| 1621 |
+
return_type full_name<GMOCK_ACTION_TYPE_PARAMS_(params)>::gmock_Impl:: \
|
| 1622 |
+
gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
|
| 1623 |
+
|
| 1624 |
+
} // namespace internal
|
| 1625 |
+
|
| 1626 |
+
// Similar to GMOCK_INTERNAL_ACTION, but no bound parameters are stored.
|
| 1627 |
+
#define ACTION(name) \
|
| 1628 |
+
class name##Action { \
|
| 1629 |
+
public: \
|
| 1630 |
+
explicit name##Action() noexcept {} \
|
| 1631 |
+
name##Action(const name##Action&) noexcept {} \
|
| 1632 |
+
template <typename F> \
|
| 1633 |
+
operator ::testing::Action<F>() const { \
|
| 1634 |
+
return ::testing::internal::MakeAction<F, gmock_Impl>(); \
|
| 1635 |
+
} \
|
| 1636 |
+
private: \
|
| 1637 |
+
class gmock_Impl { \
|
| 1638 |
+
public: \
|
| 1639 |
+
template <typename function_type, typename return_type, \
|
| 1640 |
+
typename args_type, GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \
|
| 1641 |
+
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \
|
| 1642 |
+
}; \
|
| 1643 |
+
}; \
|
| 1644 |
+
inline name##Action name() GTEST_MUST_USE_RESULT_; \
|
| 1645 |
+
inline name##Action name() { return name##Action(); } \
|
| 1646 |
+
template <typename function_type, typename return_type, typename args_type, \
|
| 1647 |
+
GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \
|
| 1648 |
+
return_type name##Action::gmock_Impl::gmock_PerformImpl( \
|
| 1649 |
+
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
|
| 1650 |
+
|
| 1651 |
+
#define ACTION_P(name, ...) \
|
| 1652 |
+
GMOCK_INTERNAL_ACTION(name, name##ActionP, (__VA_ARGS__))
|
| 1653 |
+
|
| 1654 |
+
#define ACTION_P2(name, ...) \
|
| 1655 |
+
GMOCK_INTERNAL_ACTION(name, name##ActionP2, (__VA_ARGS__))
|
| 1656 |
+
|
| 1657 |
+
#define ACTION_P3(name, ...) \
|
| 1658 |
+
GMOCK_INTERNAL_ACTION(name, name##ActionP3, (__VA_ARGS__))
|
| 1659 |
+
|
| 1660 |
+
#define ACTION_P4(name, ...) \
|
| 1661 |
+
GMOCK_INTERNAL_ACTION(name, name##ActionP4, (__VA_ARGS__))
|
| 1662 |
+
|
| 1663 |
+
#define ACTION_P5(name, ...) \
|
| 1664 |
+
GMOCK_INTERNAL_ACTION(name, name##ActionP5, (__VA_ARGS__))
|
| 1665 |
+
|
| 1666 |
+
#define ACTION_P6(name, ...) \
|
| 1667 |
+
GMOCK_INTERNAL_ACTION(name, name##ActionP6, (__VA_ARGS__))
|
| 1668 |
+
|
| 1669 |
+
#define ACTION_P7(name, ...) \
|
| 1670 |
+
GMOCK_INTERNAL_ACTION(name, name##ActionP7, (__VA_ARGS__))
|
| 1671 |
+
|
| 1672 |
+
#define ACTION_P8(name, ...) \
|
| 1673 |
+
GMOCK_INTERNAL_ACTION(name, name##ActionP8, (__VA_ARGS__))
|
| 1674 |
+
|
| 1675 |
+
#define ACTION_P9(name, ...) \
|
| 1676 |
+
GMOCK_INTERNAL_ACTION(name, name##ActionP9, (__VA_ARGS__))
|
| 1677 |
+
|
| 1678 |
+
#define ACTION_P10(name, ...) \
|
| 1679 |
+
GMOCK_INTERNAL_ACTION(name, name##ActionP10, (__VA_ARGS__))
|
| 1680 |
+
|
| 1681 |
+
} // namespace testing
|
| 1682 |
+
|
| 1683 |
+
#ifdef _MSC_VER
|
| 1684 |
+
# pragma warning(pop)
|
| 1685 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2007, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
// Google Mock - a framework for writing C++ mock classes.
|
| 32 |
+
//
|
| 33 |
+
// This file implements some commonly used cardinalities. More
|
| 34 |
+
// cardinalities can be defined by the user implementing the
|
| 35 |
+
// CardinalityInterface interface if necessary.
|
| 36 |
+
|
| 37 |
+
// GOOGLETEST_CM0002 DO NOT DELETE
|
| 38 |
+
|
| 39 |
+
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
|
| 40 |
+
#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
|
| 41 |
+
|
| 42 |
+
#include <limits.h>
|
| 43 |
+
#include <memory>
|
| 44 |
+
#include <ostream> // NOLINT
|
| 45 |
+
#include "gmock/internal/gmock-port.h"
|
| 46 |
+
#include "gtest/gtest.h"
|
| 47 |
+
|
| 48 |
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
| 49 |
+
/* class A needs to have dll-interface to be used by clients of class B */)
|
| 50 |
+
|
| 51 |
+
namespace testing {
|
| 52 |
+
|
| 53 |
+
// To implement a cardinality Foo, define:
|
| 54 |
+
// 1. a class FooCardinality that implements the
|
| 55 |
+
// CardinalityInterface interface, and
|
| 56 |
+
// 2. a factory function that creates a Cardinality object from a
|
| 57 |
+
// const FooCardinality*.
|
| 58 |
+
//
|
| 59 |
+
// The two-level delegation design follows that of Matcher, providing
|
| 60 |
+
// consistency for extension developers. It also eases ownership
|
| 61 |
+
// management as Cardinality objects can now be copied like plain values.
|
| 62 |
+
|
| 63 |
+
// The implementation of a cardinality.
|
| 64 |
+
class CardinalityInterface {
|
| 65 |
+
public:
|
| 66 |
+
virtual ~CardinalityInterface() {}
|
| 67 |
+
|
| 68 |
+
// Conservative estimate on the lower/upper bound of the number of
|
| 69 |
+
// calls allowed.
|
| 70 |
+
virtual int ConservativeLowerBound() const { return 0; }
|
| 71 |
+
virtual int ConservativeUpperBound() const { return INT_MAX; }
|
| 72 |
+
|
| 73 |
+
// Returns true if and only if call_count calls will satisfy this
|
| 74 |
+
// cardinality.
|
| 75 |
+
virtual bool IsSatisfiedByCallCount(int call_count) const = 0;
|
| 76 |
+
|
| 77 |
+
// Returns true if and only if call_count calls will saturate this
|
| 78 |
+
// cardinality.
|
| 79 |
+
virtual bool IsSaturatedByCallCount(int call_count) const = 0;
|
| 80 |
+
|
| 81 |
+
// Describes self to an ostream.
|
| 82 |
+
virtual void DescribeTo(::std::ostream* os) const = 0;
|
| 83 |
+
};
|
| 84 |
+
|
| 85 |
+
// A Cardinality is a copyable and IMMUTABLE (except by assignment)
|
| 86 |
+
// object that specifies how many times a mock function is expected to
|
| 87 |
+
// be called. The implementation of Cardinality is just a std::shared_ptr
|
| 88 |
+
// to const CardinalityInterface. Don't inherit from Cardinality!
|
| 89 |
+
class GTEST_API_ Cardinality {
|
| 90 |
+
public:
|
| 91 |
+
// Constructs a null cardinality. Needed for storing Cardinality
|
| 92 |
+
// objects in STL containers.
|
| 93 |
+
Cardinality() {}
|
| 94 |
+
|
| 95 |
+
// Constructs a Cardinality from its implementation.
|
| 96 |
+
explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {}
|
| 97 |
+
|
| 98 |
+
// Conservative estimate on the lower/upper bound of the number of
|
| 99 |
+
// calls allowed.
|
| 100 |
+
int ConservativeLowerBound() const { return impl_->ConservativeLowerBound(); }
|
| 101 |
+
int ConservativeUpperBound() const { return impl_->ConservativeUpperBound(); }
|
| 102 |
+
|
| 103 |
+
// Returns true if and only if call_count calls will satisfy this
|
| 104 |
+
// cardinality.
|
| 105 |
+
bool IsSatisfiedByCallCount(int call_count) const {
|
| 106 |
+
return impl_->IsSatisfiedByCallCount(call_count);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
// Returns true if and only if call_count calls will saturate this
|
| 110 |
+
// cardinality.
|
| 111 |
+
bool IsSaturatedByCallCount(int call_count) const {
|
| 112 |
+
return impl_->IsSaturatedByCallCount(call_count);
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
// Returns true if and only if call_count calls will over-saturate this
|
| 116 |
+
// cardinality, i.e. exceed the maximum number of allowed calls.
|
| 117 |
+
bool IsOverSaturatedByCallCount(int call_count) const {
|
| 118 |
+
return impl_->IsSaturatedByCallCount(call_count) &&
|
| 119 |
+
!impl_->IsSatisfiedByCallCount(call_count);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
// Describes self to an ostream
|
| 123 |
+
void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); }
|
| 124 |
+
|
| 125 |
+
// Describes the given actual call count to an ostream.
|
| 126 |
+
static void DescribeActualCallCountTo(int actual_call_count,
|
| 127 |
+
::std::ostream* os);
|
| 128 |
+
|
| 129 |
+
private:
|
| 130 |
+
std::shared_ptr<const CardinalityInterface> impl_;
|
| 131 |
+
};
|
| 132 |
+
|
| 133 |
+
// Creates a cardinality that allows at least n calls.
|
| 134 |
+
GTEST_API_ Cardinality AtLeast(int n);
|
| 135 |
+
|
| 136 |
+
// Creates a cardinality that allows at most n calls.
|
| 137 |
+
GTEST_API_ Cardinality AtMost(int n);
|
| 138 |
+
|
| 139 |
+
// Creates a cardinality that allows any number of calls.
|
| 140 |
+
GTEST_API_ Cardinality AnyNumber();
|
| 141 |
+
|
| 142 |
+
// Creates a cardinality that allows between min and max calls.
|
| 143 |
+
GTEST_API_ Cardinality Between(int min, int max);
|
| 144 |
+
|
| 145 |
+
// Creates a cardinality that allows exactly n calls.
|
| 146 |
+
GTEST_API_ Cardinality Exactly(int n);
|
| 147 |
+
|
| 148 |
+
// Creates a cardinality from its implementation.
|
| 149 |
+
inline Cardinality MakeCardinality(const CardinalityInterface* c) {
|
| 150 |
+
return Cardinality(c);
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
} //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|
|
|
|
|
|
| 1 |
+
// Copyright 2007, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
// Google Mock - a framework for writing C++ mock classes.
|
| 31 |
+
//
|
| 32 |
+
// This file implements MOCK_METHOD.
|
| 33 |
+
|
| 34 |
+
// GOOGLETEST_CM0002 DO NOT DELETE
|
| 35 |
+
|
| 36 |
+
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT
|
| 37 |
+
#define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT
|
| 38 |
+
|
| 39 |
+
#include <type_traits> // IWYU pragma: keep
|
| 40 |
+
#include <utility> // IWYU pragma: keep
|
| 41 |
+
|
| 42 |
+
#include "gmock/gmock-spec-builders.h"
|
| 43 |
+
#include "gmock/internal/gmock-internal-utils.h"
|
| 44 |
+
#include "gmock/internal/gmock-pp.h"
|
| 45 |
+
|
| 46 |
+
namespace testing {
|
| 47 |
+
namespace internal {
|
| 48 |
+
template <typename T>
|
| 49 |
+
using identity_t = T;
|
| 50 |
+
|
| 51 |
+
template <typename Pattern>
|
| 52 |
+
struct ThisRefAdjuster {
|
| 53 |
+
template <typename T>
|
| 54 |
+
using AdjustT = typename std::conditional<
|
| 55 |
+
std::is_const<typename std::remove_reference<Pattern>::type>::value,
|
| 56 |
+
typename std::conditional<std::is_lvalue_reference<Pattern>::value,
|
| 57 |
+
const T&, const T&&>::type,
|
| 58 |
+
typename std::conditional<std::is_lvalue_reference<Pattern>::value, T&,
|
| 59 |
+
T&&>::type>::type;
|
| 60 |
+
|
| 61 |
+
template <typename MockType>
|
| 62 |
+
static AdjustT<MockType> Adjust(const MockType& mock) {
|
| 63 |
+
return static_cast<AdjustT<MockType>>(const_cast<MockType&>(mock));
|
| 64 |
+
}
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
} // namespace internal
|
| 68 |
+
|
| 69 |
+
// The style guide prohibits "using" statements in a namespace scope
|
| 70 |
+
// inside a header file. However, the FunctionMocker class template
|
| 71 |
+
// is meant to be defined in the ::testing namespace. The following
|
| 72 |
+
// line is just a trick for working around a bug in MSVC 8.0, which
|
| 73 |
+
// cannot handle it if we define FunctionMocker in ::testing.
|
| 74 |
+
using internal::FunctionMocker;
|
| 75 |
+
} // namespace testing
|
| 76 |
+
|
| 77 |
+
#define MOCK_METHOD(...) \
|
| 78 |
+
GMOCK_PP_VARIADIC_CALL(GMOCK_INTERNAL_MOCK_METHOD_ARG_, __VA_ARGS__)
|
| 79 |
+
|
| 80 |
+
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_1(...) \
|
| 81 |
+
GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
|
| 82 |
+
|
| 83 |
+
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_2(...) \
|
| 84 |
+
GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
|
| 85 |
+
|
| 86 |
+
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_3(_Ret, _MethodName, _Args) \
|
| 87 |
+
GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, ())
|
| 88 |
+
|
| 89 |
+
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, _Spec) \
|
| 90 |
+
GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Args); \
|
| 91 |
+
GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Spec); \
|
| 92 |
+
GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \
|
| 93 |
+
GMOCK_PP_NARG0 _Args, GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)); \
|
| 94 |
+
GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \
|
| 95 |
+
GMOCK_INTERNAL_MOCK_METHOD_IMPL( \
|
| 96 |
+
GMOCK_PP_NARG0 _Args, _MethodName, GMOCK_INTERNAL_HAS_CONST(_Spec), \
|
| 97 |
+
GMOCK_INTERNAL_HAS_OVERRIDE(_Spec), GMOCK_INTERNAL_HAS_FINAL(_Spec), \
|
| 98 |
+
GMOCK_INTERNAL_GET_NOEXCEPT_SPEC(_Spec), \
|
| 99 |
+
GMOCK_INTERNAL_GET_CALLTYPE(_Spec), GMOCK_INTERNAL_GET_REF_SPEC(_Spec), \
|
| 100 |
+
(GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)))
|
| 101 |
+
|
| 102 |
+
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_5(...) \
|
| 103 |
+
GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
|
| 104 |
+
|
| 105 |
+
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_6(...) \
|
| 106 |
+
GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
|
| 107 |
+
|
| 108 |
+
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_7(...) \
|
| 109 |
+
GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
|
| 110 |
+
|
| 111 |
+
#define GMOCK_INTERNAL_WRONG_ARITY(...) \
|
| 112 |
+
static_assert( \
|
| 113 |
+
false, \
|
| 114 |
+
"MOCK_METHOD must be called with 3 or 4 arguments. _Ret, " \
|
| 115 |
+
"_MethodName, _Args and optionally _Spec. _Args and _Spec must be " \
|
| 116 |
+
"enclosed in parentheses. If _Ret is a type with unprotected commas, " \
|
| 117 |
+
"it must also be enclosed in parentheses.")
|
| 118 |
+
|
| 119 |
+
#define GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Tuple) \
|
| 120 |
+
static_assert( \
|
| 121 |
+
GMOCK_PP_IS_ENCLOSED_PARENS(_Tuple), \
|
| 122 |
+
GMOCK_PP_STRINGIZE(_Tuple) " should be enclosed in parentheses.")
|
| 123 |
+
|
| 124 |
+
#define GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE(_N, ...) \
|
| 125 |
+
static_assert( \
|
| 126 |
+
std::is_function<__VA_ARGS__>::value, \
|
| 127 |
+
"Signature must be a function type, maybe return type contains " \
|
| 128 |
+
"unprotected comma."); \
|
| 129 |
+
static_assert( \
|
| 130 |
+
::testing::tuple_size<typename ::testing::internal::Function< \
|
| 131 |
+
__VA_ARGS__>::ArgumentTuple>::value == _N, \
|
| 132 |
+
"This method does not take " GMOCK_PP_STRINGIZE( \
|
| 133 |
+
_N) " arguments. Parenthesize all types with unprotected commas.")
|
| 134 |
+
|
| 135 |
+
#define GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \
|
| 136 |
+
GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT, ~, _Spec)
|
| 137 |
+
|
| 138 |
+
#define GMOCK_INTERNAL_MOCK_METHOD_IMPL(_N, _MethodName, _Constness, \
|
| 139 |
+
_Override, _Final, _NoexceptSpec, \
|
| 140 |
+
_CallType, _RefSpec, _Signature) \
|
| 141 |
+
typename ::testing::internal::Function<GMOCK_PP_REMOVE_PARENS( \
|
| 142 |
+
_Signature)>::Result \
|
| 143 |
+
GMOCK_INTERNAL_EXPAND(_CallType) \
|
| 144 |
+
_MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \
|
| 145 |
+
GMOCK_PP_IF(_Constness, const, ) _RefSpec _NoexceptSpec \
|
| 146 |
+
GMOCK_PP_IF(_Override, override, ) GMOCK_PP_IF(_Final, final, ) { \
|
| 147 |
+
GMOCK_MOCKER_(_N, _Constness, _MethodName) \
|
| 148 |
+
.SetOwnerAndName(this, #_MethodName); \
|
| 149 |
+
return GMOCK_MOCKER_(_N, _Constness, _MethodName) \
|
| 150 |
+
.Invoke(GMOCK_PP_REPEAT(GMOCK_INTERNAL_FORWARD_ARG, _Signature, _N)); \
|
| 151 |
+
} \
|
| 152 |
+
::testing::MockSpec<GMOCK_PP_REMOVE_PARENS(_Signature)> gmock_##_MethodName( \
|
| 153 |
+
GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_PARAMETER, _Signature, _N)) \
|
| 154 |
+
GMOCK_PP_IF(_Constness, const, ) _RefSpec { \
|
| 155 |
+
GMOCK_MOCKER_(_N, _Constness, _MethodName).RegisterOwner(this); \
|
| 156 |
+
return GMOCK_MOCKER_(_N, _Constness, _MethodName) \
|
| 157 |
+
.With(GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_ARGUMENT, , _N)); \
|
| 158 |
+
} \
|
| 159 |
+
::testing::MockSpec<GMOCK_PP_REMOVE_PARENS(_Signature)> gmock_##_MethodName( \
|
| 160 |
+
const ::testing::internal::WithoutMatchers&, \
|
| 161 |
+
GMOCK_PP_IF(_Constness, const, )::testing::internal::Function< \
|
| 162 |
+
GMOCK_PP_REMOVE_PARENS(_Signature)>*) const _RefSpec _NoexceptSpec { \
|
| 163 |
+
return ::testing::internal::ThisRefAdjuster<GMOCK_PP_IF( \
|
| 164 |
+
_Constness, const, ) int _RefSpec>::Adjust(*this) \
|
| 165 |
+
.gmock_##_MethodName(GMOCK_PP_REPEAT( \
|
| 166 |
+
GMOCK_INTERNAL_A_MATCHER_ARGUMENT, _Signature, _N)); \
|
| 167 |
+
} \
|
| 168 |
+
mutable ::testing::FunctionMocker<GMOCK_PP_REMOVE_PARENS(_Signature)> \
|
| 169 |
+
GMOCK_MOCKER_(_N, _Constness, _MethodName)
|
| 170 |
+
|
| 171 |
+
#define GMOCK_INTERNAL_EXPAND(...) __VA_ARGS__
|
| 172 |
+
|
| 173 |
+
// Five Valid modifiers.
|
| 174 |
+
#define GMOCK_INTERNAL_HAS_CONST(_Tuple) \
|
| 175 |
+
GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_CONST, ~, _Tuple))
|
| 176 |
+
|
| 177 |
+
#define GMOCK_INTERNAL_HAS_OVERRIDE(_Tuple) \
|
| 178 |
+
GMOCK_PP_HAS_COMMA( \
|
| 179 |
+
GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_OVERRIDE, ~, _Tuple))
|
| 180 |
+
|
| 181 |
+
#define GMOCK_INTERNAL_HAS_FINAL(_Tuple) \
|
| 182 |
+
GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_FINAL, ~, _Tuple))
|
| 183 |
+
|
| 184 |
+
#define GMOCK_INTERNAL_GET_NOEXCEPT_SPEC(_Tuple) \
|
| 185 |
+
GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT, ~, _Tuple)
|
| 186 |
+
|
| 187 |
+
#define GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT(_i, _, _elem) \
|
| 188 |
+
GMOCK_PP_IF( \
|
| 189 |
+
GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)), \
|
| 190 |
+
_elem, )
|
| 191 |
+
|
| 192 |
+
#define GMOCK_INTERNAL_GET_REF_SPEC(_Tuple) \
|
| 193 |
+
GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_REF_SPEC_IF_REF, ~, _Tuple)
|
| 194 |
+
|
| 195 |
+
#define GMOCK_INTERNAL_REF_SPEC_IF_REF(_i, _, _elem) \
|
| 196 |
+
GMOCK_PP_IF(GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_REF(_i, _, _elem)), \
|
| 197 |
+
GMOCK_PP_CAT(GMOCK_INTERNAL_UNPACK_, _elem), )
|
| 198 |
+
|
| 199 |
+
#define GMOCK_INTERNAL_GET_CALLTYPE(_Tuple) \
|
| 200 |
+
GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_CALLTYPE_IMPL, ~, _Tuple)
|
| 201 |
+
|
| 202 |
+
#define GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT(_i, _, _elem) \
|
| 203 |
+
static_assert( \
|
| 204 |
+
(GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem)) + \
|
| 205 |
+
GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem)) + \
|
| 206 |
+
GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem)) + \
|
| 207 |
+
GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)) + \
|
| 208 |
+
GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_REF(_i, _, _elem)) + \
|
| 209 |
+
GMOCK_INTERNAL_IS_CALLTYPE(_elem)) == 1, \
|
| 210 |
+
GMOCK_PP_STRINGIZE( \
|
| 211 |
+
_elem) " cannot be recognized as a valid specification modifier.");
|
| 212 |
+
|
| 213 |
+
// Modifiers implementation.
|
| 214 |
+
#define GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem) \
|
| 215 |
+
GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_CONST_I_, _elem)
|
| 216 |
+
|
| 217 |
+
#define GMOCK_INTERNAL_DETECT_CONST_I_const ,
|
| 218 |
+
|
| 219 |
+
#define GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem) \
|
| 220 |
+
GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_OVERRIDE_I_, _elem)
|
| 221 |
+
|
| 222 |
+
#define GMOCK_INTERNAL_DETECT_OVERRIDE_I_override ,
|
| 223 |
+
|
| 224 |
+
#define GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem) \
|
| 225 |
+
GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_FINAL_I_, _elem)
|
| 226 |
+
|
| 227 |
+
#define GMOCK_INTERNAL_DETECT_FINAL_I_final ,
|
| 228 |
+
|
| 229 |
+
#define GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem) \
|
| 230 |
+
GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_NOEXCEPT_I_, _elem)
|
| 231 |
+
|
| 232 |
+
#define GMOCK_INTERNAL_DETECT_NOEXCEPT_I_noexcept ,
|
| 233 |
+
|
| 234 |
+
#define GMOCK_INTERNAL_DETECT_REF(_i, _, _elem) \
|
| 235 |
+
GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_REF_I_, _elem)
|
| 236 |
+
|
| 237 |
+
#define GMOCK_INTERNAL_DETECT_REF_I_ref ,
|
| 238 |
+
|
| 239 |
+
#define GMOCK_INTERNAL_UNPACK_ref(x) x
|
| 240 |
+
|
| 241 |
+
#define GMOCK_INTERNAL_GET_CALLTYPE_IMPL(_i, _, _elem) \
|
| 242 |
+
GMOCK_PP_IF(GMOCK_INTERNAL_IS_CALLTYPE(_elem), \
|
| 243 |
+
GMOCK_INTERNAL_GET_VALUE_CALLTYPE, GMOCK_PP_EMPTY) \
|
| 244 |
+
(_elem)
|
| 245 |
+
|
| 246 |
+
// TODO(iserna): GMOCK_INTERNAL_IS_CALLTYPE and
|
| 247 |
+
// GMOCK_INTERNAL_GET_VALUE_CALLTYPE needed more expansions to work on windows
|
| 248 |
+
// maybe they can be simplified somehow.
|
| 249 |
+
#define GMOCK_INTERNAL_IS_CALLTYPE(_arg) \
|
| 250 |
+
GMOCK_INTERNAL_IS_CALLTYPE_I( \
|
| 251 |
+
GMOCK_PP_CAT(GMOCK_INTERNAL_IS_CALLTYPE_HELPER_, _arg))
|
| 252 |
+
#define GMOCK_INTERNAL_IS_CALLTYPE_I(_arg) GMOCK_PP_IS_ENCLOSED_PARENS(_arg)
|
| 253 |
+
|
| 254 |
+
#define GMOCK_INTERNAL_GET_VALUE_CALLTYPE(_arg) \
|
| 255 |
+
GMOCK_INTERNAL_GET_VALUE_CALLTYPE_I( \
|
| 256 |
+
GMOCK_PP_CAT(GMOCK_INTERNAL_IS_CALLTYPE_HELPER_, _arg))
|
| 257 |
+
#define GMOCK_INTERNAL_GET_VALUE_CALLTYPE_I(_arg) \
|
| 258 |
+
GMOCK_PP_IDENTITY _arg
|
| 259 |
+
|
| 260 |
+
#define GMOCK_INTERNAL_IS_CALLTYPE_HELPER_Calltype
|
| 261 |
+
|
| 262 |
+
// Note: The use of `identity_t` here allows _Ret to represent return types that
|
| 263 |
+
// would normally need to be specified in a different way. For example, a method
|
| 264 |
+
// returning a function pointer must be written as
|
| 265 |
+
//
|
| 266 |
+
// fn_ptr_return_t (*method(method_args_t...))(fn_ptr_args_t...)
|
| 267 |
+
//
|
| 268 |
+
// But we only support placing the return type at the beginning. To handle this,
|
| 269 |
+
// we wrap all calls in identity_t, so that a declaration will be expanded to
|
| 270 |
+
//
|
| 271 |
+
// identity_t<fn_ptr_return_t (*)(fn_ptr_args_t...)> method(method_args_t...)
|
| 272 |
+
//
|
| 273 |
+
// This allows us to work around the syntactic oddities of function/method
|
| 274 |
+
// types.
|
| 275 |
+
#define GMOCK_INTERNAL_SIGNATURE(_Ret, _Args) \
|
| 276 |
+
::testing::internal::identity_t<GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_Ret), \
|
| 277 |
+
GMOCK_PP_REMOVE_PARENS, \
|
| 278 |
+
GMOCK_PP_IDENTITY)(_Ret)>( \
|
| 279 |
+
GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_TYPE, _, _Args))
|
| 280 |
+
|
| 281 |
+
#define GMOCK_INTERNAL_GET_TYPE(_i, _, _elem) \
|
| 282 |
+
GMOCK_PP_COMMA_IF(_i) \
|
| 283 |
+
GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_elem), GMOCK_PP_REMOVE_PARENS, \
|
| 284 |
+
GMOCK_PP_IDENTITY) \
|
| 285 |
+
(_elem)
|
| 286 |
+
|
| 287 |
+
#define GMOCK_INTERNAL_PARAMETER(_i, _Signature, _) \
|
| 288 |
+
GMOCK_PP_COMMA_IF(_i) \
|
| 289 |
+
GMOCK_INTERNAL_ARG_O(_i, GMOCK_PP_REMOVE_PARENS(_Signature)) \
|
| 290 |
+
gmock_a##_i
|
| 291 |
+
|
| 292 |
+
#define GMOCK_INTERNAL_FORWARD_ARG(_i, _Signature, _) \
|
| 293 |
+
GMOCK_PP_COMMA_IF(_i) \
|
| 294 |
+
::std::forward<GMOCK_INTERNAL_ARG_O( \
|
| 295 |
+
_i, GMOCK_PP_REMOVE_PARENS(_Signature))>(gmock_a##_i)
|
| 296 |
+
|
| 297 |
+
#define GMOCK_INTERNAL_MATCHER_PARAMETER(_i, _Signature, _) \
|
| 298 |
+
GMOCK_PP_COMMA_IF(_i) \
|
| 299 |
+
GMOCK_INTERNAL_MATCHER_O(_i, GMOCK_PP_REMOVE_PARENS(_Signature)) \
|
| 300 |
+
gmock_a##_i
|
| 301 |
+
|
| 302 |
+
#define GMOCK_INTERNAL_MATCHER_ARGUMENT(_i, _1, _2) \
|
| 303 |
+
GMOCK_PP_COMMA_IF(_i) \
|
| 304 |
+
gmock_a##_i
|
| 305 |
+
|
| 306 |
+
#define GMOCK_INTERNAL_A_MATCHER_ARGUMENT(_i, _Signature, _) \
|
| 307 |
+
GMOCK_PP_COMMA_IF(_i) \
|
| 308 |
+
::testing::A<GMOCK_INTERNAL_ARG_O(_i, GMOCK_PP_REMOVE_PARENS(_Signature))>()
|
| 309 |
+
|
| 310 |
+
#define GMOCK_INTERNAL_ARG_O(_i, ...) \
|
| 311 |
+
typename ::testing::internal::Function<__VA_ARGS__>::template Arg<_i>::type
|
| 312 |
+
|
| 313 |
+
#define GMOCK_INTERNAL_MATCHER_O(_i, ...) \
|
| 314 |
+
const ::testing::Matcher<typename ::testing::internal::Function< \
|
| 315 |
+
__VA_ARGS__>::template Arg<_i>::type>&
|
| 316 |
+
|
| 317 |
+
#define MOCK_METHOD0(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 0, __VA_ARGS__)
|
| 318 |
+
#define MOCK_METHOD1(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 1, __VA_ARGS__)
|
| 319 |
+
#define MOCK_METHOD2(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 2, __VA_ARGS__)
|
| 320 |
+
#define MOCK_METHOD3(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 3, __VA_ARGS__)
|
| 321 |
+
#define MOCK_METHOD4(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 4, __VA_ARGS__)
|
| 322 |
+
#define MOCK_METHOD5(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 5, __VA_ARGS__)
|
| 323 |
+
#define MOCK_METHOD6(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 6, __VA_ARGS__)
|
| 324 |
+
#define MOCK_METHOD7(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 7, __VA_ARGS__)
|
| 325 |
+
#define MOCK_METHOD8(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 8, __VA_ARGS__)
|
| 326 |
+
#define MOCK_METHOD9(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 9, __VA_ARGS__)
|
| 327 |
+
#define MOCK_METHOD10(m, ...) \
|
| 328 |
+
GMOCK_INTERNAL_MOCK_METHODN(, , m, 10, __VA_ARGS__)
|
| 329 |
+
|
| 330 |
+
#define MOCK_CONST_METHOD0(m, ...) \
|
| 331 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, , m, 0, __VA_ARGS__)
|
| 332 |
+
#define MOCK_CONST_METHOD1(m, ...) \
|
| 333 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, , m, 1, __VA_ARGS__)
|
| 334 |
+
#define MOCK_CONST_METHOD2(m, ...) \
|
| 335 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, , m, 2, __VA_ARGS__)
|
| 336 |
+
#define MOCK_CONST_METHOD3(m, ...) \
|
| 337 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, , m, 3, __VA_ARGS__)
|
| 338 |
+
#define MOCK_CONST_METHOD4(m, ...) \
|
| 339 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, , m, 4, __VA_ARGS__)
|
| 340 |
+
#define MOCK_CONST_METHOD5(m, ...) \
|
| 341 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, , m, 5, __VA_ARGS__)
|
| 342 |
+
#define MOCK_CONST_METHOD6(m, ...) \
|
| 343 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, , m, 6, __VA_ARGS__)
|
| 344 |
+
#define MOCK_CONST_METHOD7(m, ...) \
|
| 345 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, , m, 7, __VA_ARGS__)
|
| 346 |
+
#define MOCK_CONST_METHOD8(m, ...) \
|
| 347 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, , m, 8, __VA_ARGS__)
|
| 348 |
+
#define MOCK_CONST_METHOD9(m, ...) \
|
| 349 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, , m, 9, __VA_ARGS__)
|
| 350 |
+
#define MOCK_CONST_METHOD10(m, ...) \
|
| 351 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, , m, 10, __VA_ARGS__)
|
| 352 |
+
|
| 353 |
+
#define MOCK_METHOD0_T(m, ...) MOCK_METHOD0(m, __VA_ARGS__)
|
| 354 |
+
#define MOCK_METHOD1_T(m, ...) MOCK_METHOD1(m, __VA_ARGS__)
|
| 355 |
+
#define MOCK_METHOD2_T(m, ...) MOCK_METHOD2(m, __VA_ARGS__)
|
| 356 |
+
#define MOCK_METHOD3_T(m, ...) MOCK_METHOD3(m, __VA_ARGS__)
|
| 357 |
+
#define MOCK_METHOD4_T(m, ...) MOCK_METHOD4(m, __VA_ARGS__)
|
| 358 |
+
#define MOCK_METHOD5_T(m, ...) MOCK_METHOD5(m, __VA_ARGS__)
|
| 359 |
+
#define MOCK_METHOD6_T(m, ...) MOCK_METHOD6(m, __VA_ARGS__)
|
| 360 |
+
#define MOCK_METHOD7_T(m, ...) MOCK_METHOD7(m, __VA_ARGS__)
|
| 361 |
+
#define MOCK_METHOD8_T(m, ...) MOCK_METHOD8(m, __VA_ARGS__)
|
| 362 |
+
#define MOCK_METHOD9_T(m, ...) MOCK_METHOD9(m, __VA_ARGS__)
|
| 363 |
+
#define MOCK_METHOD10_T(m, ...) MOCK_METHOD10(m, __VA_ARGS__)
|
| 364 |
+
|
| 365 |
+
#define MOCK_CONST_METHOD0_T(m, ...) MOCK_CONST_METHOD0(m, __VA_ARGS__)
|
| 366 |
+
#define MOCK_CONST_METHOD1_T(m, ...) MOCK_CONST_METHOD1(m, __VA_ARGS__)
|
| 367 |
+
#define MOCK_CONST_METHOD2_T(m, ...) MOCK_CONST_METHOD2(m, __VA_ARGS__)
|
| 368 |
+
#define MOCK_CONST_METHOD3_T(m, ...) MOCK_CONST_METHOD3(m, __VA_ARGS__)
|
| 369 |
+
#define MOCK_CONST_METHOD4_T(m, ...) MOCK_CONST_METHOD4(m, __VA_ARGS__)
|
| 370 |
+
#define MOCK_CONST_METHOD5_T(m, ...) MOCK_CONST_METHOD5(m, __VA_ARGS__)
|
| 371 |
+
#define MOCK_CONST_METHOD6_T(m, ...) MOCK_CONST_METHOD6(m, __VA_ARGS__)
|
| 372 |
+
#define MOCK_CONST_METHOD7_T(m, ...) MOCK_CONST_METHOD7(m, __VA_ARGS__)
|
| 373 |
+
#define MOCK_CONST_METHOD8_T(m, ...) MOCK_CONST_METHOD8(m, __VA_ARGS__)
|
| 374 |
+
#define MOCK_CONST_METHOD9_T(m, ...) MOCK_CONST_METHOD9(m, __VA_ARGS__)
|
| 375 |
+
#define MOCK_CONST_METHOD10_T(m, ...) MOCK_CONST_METHOD10(m, __VA_ARGS__)
|
| 376 |
+
|
| 377 |
+
#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \
|
| 378 |
+
GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 0, __VA_ARGS__)
|
| 379 |
+
#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \
|
| 380 |
+
GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 1, __VA_ARGS__)
|
| 381 |
+
#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \
|
| 382 |
+
GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 2, __VA_ARGS__)
|
| 383 |
+
#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \
|
| 384 |
+
GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 3, __VA_ARGS__)
|
| 385 |
+
#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \
|
| 386 |
+
GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 4, __VA_ARGS__)
|
| 387 |
+
#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \
|
| 388 |
+
GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 5, __VA_ARGS__)
|
| 389 |
+
#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \
|
| 390 |
+
GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 6, __VA_ARGS__)
|
| 391 |
+
#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \
|
| 392 |
+
GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 7, __VA_ARGS__)
|
| 393 |
+
#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \
|
| 394 |
+
GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 8, __VA_ARGS__)
|
| 395 |
+
#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \
|
| 396 |
+
GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 9, __VA_ARGS__)
|
| 397 |
+
#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \
|
| 398 |
+
GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 10, __VA_ARGS__)
|
| 399 |
+
|
| 400 |
+
#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \
|
| 401 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 0, __VA_ARGS__)
|
| 402 |
+
#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \
|
| 403 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 1, __VA_ARGS__)
|
| 404 |
+
#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \
|
| 405 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 2, __VA_ARGS__)
|
| 406 |
+
#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \
|
| 407 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 3, __VA_ARGS__)
|
| 408 |
+
#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \
|
| 409 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 4, __VA_ARGS__)
|
| 410 |
+
#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \
|
| 411 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 5, __VA_ARGS__)
|
| 412 |
+
#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \
|
| 413 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 6, __VA_ARGS__)
|
| 414 |
+
#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \
|
| 415 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 7, __VA_ARGS__)
|
| 416 |
+
#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \
|
| 417 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 8, __VA_ARGS__)
|
| 418 |
+
#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \
|
| 419 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 9, __VA_ARGS__)
|
| 420 |
+
#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \
|
| 421 |
+
GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 10, __VA_ARGS__)
|
| 422 |
+
|
| 423 |
+
#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
|
| 424 |
+
MOCK_METHOD0_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 425 |
+
#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
|
| 426 |
+
MOCK_METHOD1_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 427 |
+
#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
|
| 428 |
+
MOCK_METHOD2_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 429 |
+
#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
|
| 430 |
+
MOCK_METHOD3_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 431 |
+
#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
|
| 432 |
+
MOCK_METHOD4_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 433 |
+
#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
|
| 434 |
+
MOCK_METHOD5_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 435 |
+
#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
|
| 436 |
+
MOCK_METHOD6_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 437 |
+
#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
|
| 438 |
+
MOCK_METHOD7_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 439 |
+
#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
|
| 440 |
+
MOCK_METHOD8_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 441 |
+
#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
|
| 442 |
+
MOCK_METHOD9_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 443 |
+
#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
|
| 444 |
+
MOCK_METHOD10_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 445 |
+
|
| 446 |
+
#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
|
| 447 |
+
MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 448 |
+
#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
|
| 449 |
+
MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 450 |
+
#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
|
| 451 |
+
MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 452 |
+
#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
|
| 453 |
+
MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 454 |
+
#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
|
| 455 |
+
MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 456 |
+
#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
|
| 457 |
+
MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 458 |
+
#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
|
| 459 |
+
MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 460 |
+
#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
|
| 461 |
+
MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 462 |
+
#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
|
| 463 |
+
MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 464 |
+
#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
|
| 465 |
+
MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 466 |
+
#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
|
| 467 |
+
MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, __VA_ARGS__)
|
| 468 |
+
|
| 469 |
+
#define GMOCK_INTERNAL_MOCK_METHODN(constness, ct, Method, args_num, ...) \
|
| 470 |
+
GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \
|
| 471 |
+
args_num, ::testing::internal::identity_t<__VA_ARGS__>); \
|
| 472 |
+
GMOCK_INTERNAL_MOCK_METHOD_IMPL( \
|
| 473 |
+
args_num, Method, GMOCK_PP_NARG0(constness), 0, 0, , ct, , \
|
| 474 |
+
(::testing::internal::identity_t<__VA_ARGS__>))
|
| 475 |
+
|
| 476 |
+
#define GMOCK_MOCKER_(arity, constness, Method) \
|
| 477 |
+
GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
|
| 478 |
+
|
| 479 |
+
#endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock-matchers.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock-more-actions.h
ADDED
|
@@ -0,0 +1,573 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2007, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
// Google Mock - a framework for writing C++ mock classes.
|
| 32 |
+
//
|
| 33 |
+
// This file implements some commonly used variadic actions.
|
| 34 |
+
|
| 35 |
+
// GOOGLETEST_CM0002 DO NOT DELETE
|
| 36 |
+
|
| 37 |
+
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
|
| 38 |
+
#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
|
| 39 |
+
|
| 40 |
+
#include <memory>
|
| 41 |
+
#include <utility>
|
| 42 |
+
|
| 43 |
+
#include "gmock/gmock-actions.h"
|
| 44 |
+
#include "gmock/internal/gmock-port.h"
|
| 45 |
+
|
| 46 |
+
// Include any custom callback actions added by the local installation.
|
| 47 |
+
#include "gmock/internal/custom/gmock-generated-actions.h"
|
| 48 |
+
|
| 49 |
+
// Sometimes you want to give an action explicit template parameters
|
| 50 |
+
// that cannot be inferred from its value parameters. ACTION() and
|
| 51 |
+
// ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that
|
| 52 |
+
// and can be viewed as an extension to ACTION() and ACTION_P*().
|
| 53 |
+
//
|
| 54 |
+
// The syntax:
|
| 55 |
+
//
|
| 56 |
+
// ACTION_TEMPLATE(ActionName,
|
| 57 |
+
// HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m),
|
| 58 |
+
// AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; }
|
| 59 |
+
//
|
| 60 |
+
// defines an action template that takes m explicit template
|
| 61 |
+
// parameters and n value parameters. name_i is the name of the i-th
|
| 62 |
+
// template parameter, and kind_i specifies whether it's a typename,
|
| 63 |
+
// an integral constant, or a template. p_i is the name of the i-th
|
| 64 |
+
// value parameter.
|
| 65 |
+
//
|
| 66 |
+
// Example:
|
| 67 |
+
//
|
| 68 |
+
// // DuplicateArg<k, T>(output) converts the k-th argument of the mock
|
| 69 |
+
// // function to type T and copies it to *output.
|
| 70 |
+
// ACTION_TEMPLATE(DuplicateArg,
|
| 71 |
+
// HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
|
| 72 |
+
// AND_1_VALUE_PARAMS(output)) {
|
| 73 |
+
// *output = T(::std::get<k>(args));
|
| 74 |
+
// }
|
| 75 |
+
// ...
|
| 76 |
+
// int n;
|
| 77 |
+
// EXPECT_CALL(mock, Foo(_, _))
|
| 78 |
+
// .WillOnce(DuplicateArg<1, unsigned char>(&n));
|
| 79 |
+
//
|
| 80 |
+
// To create an instance of an action template, write:
|
| 81 |
+
//
|
| 82 |
+
// ActionName<t1, ..., t_m>(v1, ..., v_n)
|
| 83 |
+
//
|
| 84 |
+
// where the ts are the template arguments and the vs are the value
|
| 85 |
+
// arguments. The value argument types are inferred by the compiler.
|
| 86 |
+
// If you want to explicitly specify the value argument types, you can
|
| 87 |
+
// provide additional template arguments:
|
| 88 |
+
//
|
| 89 |
+
// ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n)
|
| 90 |
+
//
|
| 91 |
+
// where u_i is the desired type of v_i.
|
| 92 |
+
//
|
| 93 |
+
// ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the
|
| 94 |
+
// number of value parameters, but not on the number of template
|
| 95 |
+
// parameters. Without the restriction, the meaning of the following
|
| 96 |
+
// is unclear:
|
| 97 |
+
//
|
| 98 |
+
// OverloadedAction<int, bool>(x);
|
| 99 |
+
//
|
| 100 |
+
// Are we using a single-template-parameter action where 'bool' refers
|
| 101 |
+
// to the type of x, or are we using a two-template-parameter action
|
| 102 |
+
// where the compiler is asked to infer the type of x?
|
| 103 |
+
//
|
| 104 |
+
// Implementation notes:
|
| 105 |
+
//
|
| 106 |
+
// GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and
|
| 107 |
+
// GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for
|
| 108 |
+
// implementing ACTION_TEMPLATE. The main trick we use is to create
|
| 109 |
+
// new macro invocations when expanding a macro. For example, we have
|
| 110 |
+
//
|
| 111 |
+
// #define ACTION_TEMPLATE(name, template_params, value_params)
|
| 112 |
+
// ... GMOCK_INTERNAL_DECL_##template_params ...
|
| 113 |
+
//
|
| 114 |
+
// which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...)
|
| 115 |
+
// to expand to
|
| 116 |
+
//
|
| 117 |
+
// ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ...
|
| 118 |
+
//
|
| 119 |
+
// Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the
|
| 120 |
+
// preprocessor will continue to expand it to
|
| 121 |
+
//
|
| 122 |
+
// ... typename T ...
|
| 123 |
+
//
|
| 124 |
+
// This technique conforms to the C++ standard and is portable. It
|
| 125 |
+
// allows us to implement action templates using O(N) code, where N is
|
| 126 |
+
// the maximum number of template/value parameters supported. Without
|
| 127 |
+
// using it, we'd have to devote O(N^2) amount of code to implement all
|
| 128 |
+
// combinations of m and n.
|
| 129 |
+
|
| 130 |
+
// Declares the template parameters.
|
| 131 |
+
#define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0
|
| 132 |
+
#define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
|
| 133 |
+
name1) kind0 name0, kind1 name1
|
| 134 |
+
#define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 135 |
+
kind2, name2) kind0 name0, kind1 name1, kind2 name2
|
| 136 |
+
#define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 137 |
+
kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \
|
| 138 |
+
kind3 name3
|
| 139 |
+
#define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 140 |
+
kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \
|
| 141 |
+
kind2 name2, kind3 name3, kind4 name4
|
| 142 |
+
#define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 143 |
+
kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \
|
| 144 |
+
kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5
|
| 145 |
+
#define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 146 |
+
kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
|
| 147 |
+
name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \
|
| 148 |
+
kind5 name5, kind6 name6
|
| 149 |
+
#define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 150 |
+
kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
|
| 151 |
+
kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \
|
| 152 |
+
kind4 name4, kind5 name5, kind6 name6, kind7 name7
|
| 153 |
+
#define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 154 |
+
kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
|
| 155 |
+
kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \
|
| 156 |
+
kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \
|
| 157 |
+
kind8 name8
|
| 158 |
+
#define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
|
| 159 |
+
name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
|
| 160 |
+
name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \
|
| 161 |
+
kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \
|
| 162 |
+
kind6 name6, kind7 name7, kind8 name8, kind9 name9
|
| 163 |
+
|
| 164 |
+
// Lists the template parameters.
|
| 165 |
+
#define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0
|
| 166 |
+
#define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
|
| 167 |
+
name1) name0, name1
|
| 168 |
+
#define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 169 |
+
kind2, name2) name0, name1, name2
|
| 170 |
+
#define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 171 |
+
kind2, name2, kind3, name3) name0, name1, name2, name3
|
| 172 |
+
#define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 173 |
+
kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \
|
| 174 |
+
name4
|
| 175 |
+
#define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 176 |
+
kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \
|
| 177 |
+
name2, name3, name4, name5
|
| 178 |
+
#define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 179 |
+
kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
|
| 180 |
+
name6) name0, name1, name2, name3, name4, name5, name6
|
| 181 |
+
#define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 182 |
+
kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
|
| 183 |
+
kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7
|
| 184 |
+
#define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
|
| 185 |
+
kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
|
| 186 |
+
kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \
|
| 187 |
+
name6, name7, name8
|
| 188 |
+
#define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
|
| 189 |
+
name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
|
| 190 |
+
name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \
|
| 191 |
+
name3, name4, name5, name6, name7, name8, name9
|
| 192 |
+
|
| 193 |
+
// Declares the types of value parameters.
|
| 194 |
+
#define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS()
|
| 195 |
+
#define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type
|
| 196 |
+
#define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \
|
| 197 |
+
typename p0##_type, typename p1##_type
|
| 198 |
+
#define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \
|
| 199 |
+
typename p0##_type, typename p1##_type, typename p2##_type
|
| 200 |
+
#define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
|
| 201 |
+
typename p0##_type, typename p1##_type, typename p2##_type, \
|
| 202 |
+
typename p3##_type
|
| 203 |
+
#define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
|
| 204 |
+
typename p0##_type, typename p1##_type, typename p2##_type, \
|
| 205 |
+
typename p3##_type, typename p4##_type
|
| 206 |
+
#define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
|
| 207 |
+
typename p0##_type, typename p1##_type, typename p2##_type, \
|
| 208 |
+
typename p3##_type, typename p4##_type, typename p5##_type
|
| 209 |
+
#define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
|
| 210 |
+
p6) , typename p0##_type, typename p1##_type, typename p2##_type, \
|
| 211 |
+
typename p3##_type, typename p4##_type, typename p5##_type, \
|
| 212 |
+
typename p6##_type
|
| 213 |
+
#define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
|
| 214 |
+
p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \
|
| 215 |
+
typename p3##_type, typename p4##_type, typename p5##_type, \
|
| 216 |
+
typename p6##_type, typename p7##_type
|
| 217 |
+
#define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
|
| 218 |
+
p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \
|
| 219 |
+
typename p3##_type, typename p4##_type, typename p5##_type, \
|
| 220 |
+
typename p6##_type, typename p7##_type, typename p8##_type
|
| 221 |
+
#define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
|
| 222 |
+
p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \
|
| 223 |
+
typename p2##_type, typename p3##_type, typename p4##_type, \
|
| 224 |
+
typename p5##_type, typename p6##_type, typename p7##_type, \
|
| 225 |
+
typename p8##_type, typename p9##_type
|
| 226 |
+
|
| 227 |
+
// Initializes the value parameters.
|
| 228 |
+
#define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\
|
| 229 |
+
()
|
| 230 |
+
#define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\
|
| 231 |
+
(p0##_type gmock_p0) : p0(::std::move(gmock_p0))
|
| 232 |
+
#define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\
|
| 233 |
+
(p0##_type gmock_p0, p1##_type gmock_p1) : p0(::std::move(gmock_p0)), \
|
| 234 |
+
p1(::std::move(gmock_p1))
|
| 235 |
+
#define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\
|
| 236 |
+
(p0##_type gmock_p0, p1##_type gmock_p1, \
|
| 237 |
+
p2##_type gmock_p2) : p0(::std::move(gmock_p0)), \
|
| 238 |
+
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2))
|
| 239 |
+
#define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\
|
| 240 |
+
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
|
| 241 |
+
p3##_type gmock_p3) : p0(::std::move(gmock_p0)), \
|
| 242 |
+
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
|
| 243 |
+
p3(::std::move(gmock_p3))
|
| 244 |
+
#define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\
|
| 245 |
+
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
|
| 246 |
+
p3##_type gmock_p3, p4##_type gmock_p4) : p0(::std::move(gmock_p0)), \
|
| 247 |
+
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
|
| 248 |
+
p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4))
|
| 249 |
+
#define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\
|
| 250 |
+
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
|
| 251 |
+
p3##_type gmock_p3, p4##_type gmock_p4, \
|
| 252 |
+
p5##_type gmock_p5) : p0(::std::move(gmock_p0)), \
|
| 253 |
+
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
|
| 254 |
+
p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
|
| 255 |
+
p5(::std::move(gmock_p5))
|
| 256 |
+
#define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\
|
| 257 |
+
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
|
| 258 |
+
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
|
| 259 |
+
p6##_type gmock_p6) : p0(::std::move(gmock_p0)), \
|
| 260 |
+
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
|
| 261 |
+
p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
|
| 262 |
+
p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6))
|
| 263 |
+
#define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\
|
| 264 |
+
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
|
| 265 |
+
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
|
| 266 |
+
p6##_type gmock_p6, p7##_type gmock_p7) : p0(::std::move(gmock_p0)), \
|
| 267 |
+
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
|
| 268 |
+
p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
|
| 269 |
+
p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \
|
| 270 |
+
p7(::std::move(gmock_p7))
|
| 271 |
+
#define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 272 |
+
p7, p8)\
|
| 273 |
+
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
|
| 274 |
+
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
|
| 275 |
+
p6##_type gmock_p6, p7##_type gmock_p7, \
|
| 276 |
+
p8##_type gmock_p8) : p0(::std::move(gmock_p0)), \
|
| 277 |
+
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
|
| 278 |
+
p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
|
| 279 |
+
p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \
|
| 280 |
+
p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8))
|
| 281 |
+
#define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 282 |
+
p7, p8, p9)\
|
| 283 |
+
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
|
| 284 |
+
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
|
| 285 |
+
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
|
| 286 |
+
p9##_type gmock_p9) : p0(::std::move(gmock_p0)), \
|
| 287 |
+
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
|
| 288 |
+
p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
|
| 289 |
+
p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \
|
| 290 |
+
p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8)), \
|
| 291 |
+
p9(::std::move(gmock_p9))
|
| 292 |
+
|
| 293 |
+
// Defines the copy constructor
|
| 294 |
+
#define GMOCK_INTERNAL_DEFN_COPY_AND_0_VALUE_PARAMS() \
|
| 295 |
+
{} // Avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82134
|
| 296 |
+
#define GMOCK_INTERNAL_DEFN_COPY_AND_1_VALUE_PARAMS(...) = default;
|
| 297 |
+
#define GMOCK_INTERNAL_DEFN_COPY_AND_2_VALUE_PARAMS(...) = default;
|
| 298 |
+
#define GMOCK_INTERNAL_DEFN_COPY_AND_3_VALUE_PARAMS(...) = default;
|
| 299 |
+
#define GMOCK_INTERNAL_DEFN_COPY_AND_4_VALUE_PARAMS(...) = default;
|
| 300 |
+
#define GMOCK_INTERNAL_DEFN_COPY_AND_5_VALUE_PARAMS(...) = default;
|
| 301 |
+
#define GMOCK_INTERNAL_DEFN_COPY_AND_6_VALUE_PARAMS(...) = default;
|
| 302 |
+
#define GMOCK_INTERNAL_DEFN_COPY_AND_7_VALUE_PARAMS(...) = default;
|
| 303 |
+
#define GMOCK_INTERNAL_DEFN_COPY_AND_8_VALUE_PARAMS(...) = default;
|
| 304 |
+
#define GMOCK_INTERNAL_DEFN_COPY_AND_9_VALUE_PARAMS(...) = default;
|
| 305 |
+
#define GMOCK_INTERNAL_DEFN_COPY_AND_10_VALUE_PARAMS(...) = default;
|
| 306 |
+
|
| 307 |
+
// Declares the fields for storing the value parameters.
|
| 308 |
+
#define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS()
|
| 309 |
+
#define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0;
|
| 310 |
+
#define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \
|
| 311 |
+
p1##_type p1;
|
| 312 |
+
#define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \
|
| 313 |
+
p1##_type p1; p2##_type p2;
|
| 314 |
+
#define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \
|
| 315 |
+
p1##_type p1; p2##_type p2; p3##_type p3;
|
| 316 |
+
#define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
|
| 317 |
+
p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4;
|
| 318 |
+
#define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
|
| 319 |
+
p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
|
| 320 |
+
p5##_type p5;
|
| 321 |
+
#define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
|
| 322 |
+
p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
|
| 323 |
+
p5##_type p5; p6##_type p6;
|
| 324 |
+
#define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 325 |
+
p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
|
| 326 |
+
p5##_type p5; p6##_type p6; p7##_type p7;
|
| 327 |
+
#define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 328 |
+
p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
|
| 329 |
+
p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8;
|
| 330 |
+
#define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 331 |
+
p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
|
| 332 |
+
p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \
|
| 333 |
+
p9##_type p9;
|
| 334 |
+
|
| 335 |
+
// Lists the value parameters.
|
| 336 |
+
#define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS()
|
| 337 |
+
#define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0
|
| 338 |
+
#define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1
|
| 339 |
+
#define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2
|
| 340 |
+
#define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3
|
| 341 |
+
#define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \
|
| 342 |
+
p2, p3, p4
|
| 343 |
+
#define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \
|
| 344 |
+
p1, p2, p3, p4, p5
|
| 345 |
+
#define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
|
| 346 |
+
p6) p0, p1, p2, p3, p4, p5, p6
|
| 347 |
+
#define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 348 |
+
p7) p0, p1, p2, p3, p4, p5, p6, p7
|
| 349 |
+
#define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 350 |
+
p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8
|
| 351 |
+
#define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 352 |
+
p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9
|
| 353 |
+
|
| 354 |
+
// Lists the value parameter types.
|
| 355 |
+
#define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS()
|
| 356 |
+
#define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type
|
| 357 |
+
#define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \
|
| 358 |
+
p1##_type
|
| 359 |
+
#define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \
|
| 360 |
+
p1##_type, p2##_type
|
| 361 |
+
#define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
|
| 362 |
+
p0##_type, p1##_type, p2##_type, p3##_type
|
| 363 |
+
#define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
|
| 364 |
+
p0##_type, p1##_type, p2##_type, p3##_type, p4##_type
|
| 365 |
+
#define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
|
| 366 |
+
p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type
|
| 367 |
+
#define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
|
| 368 |
+
p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \
|
| 369 |
+
p6##_type
|
| 370 |
+
#define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
|
| 371 |
+
p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
|
| 372 |
+
p5##_type, p6##_type, p7##_type
|
| 373 |
+
#define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
|
| 374 |
+
p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
|
| 375 |
+
p5##_type, p6##_type, p7##_type, p8##_type
|
| 376 |
+
#define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
|
| 377 |
+
p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
|
| 378 |
+
p5##_type, p6##_type, p7##_type, p8##_type, p9##_type
|
| 379 |
+
|
| 380 |
+
// Declares the value parameters.
|
| 381 |
+
#define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS()
|
| 382 |
+
#define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0
|
| 383 |
+
#define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \
|
| 384 |
+
p1##_type p1
|
| 385 |
+
#define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \
|
| 386 |
+
p1##_type p1, p2##_type p2
|
| 387 |
+
#define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \
|
| 388 |
+
p1##_type p1, p2##_type p2, p3##_type p3
|
| 389 |
+
#define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
|
| 390 |
+
p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4
|
| 391 |
+
#define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
|
| 392 |
+
p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
|
| 393 |
+
p5##_type p5
|
| 394 |
+
#define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
|
| 395 |
+
p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
|
| 396 |
+
p5##_type p5, p6##_type p6
|
| 397 |
+
#define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 398 |
+
p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
|
| 399 |
+
p5##_type p5, p6##_type p6, p7##_type p7
|
| 400 |
+
#define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 401 |
+
p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
|
| 402 |
+
p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8
|
| 403 |
+
#define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 404 |
+
p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
|
| 405 |
+
p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
|
| 406 |
+
p9##_type p9
|
| 407 |
+
|
| 408 |
+
// The suffix of the class template implementing the action template.
|
| 409 |
+
#define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS()
|
| 410 |
+
#define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P
|
| 411 |
+
#define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2
|
| 412 |
+
#define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3
|
| 413 |
+
#define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4
|
| 414 |
+
#define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5
|
| 415 |
+
#define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6
|
| 416 |
+
#define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7
|
| 417 |
+
#define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 418 |
+
p7) P8
|
| 419 |
+
#define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 420 |
+
p7, p8) P9
|
| 421 |
+
#define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
|
| 422 |
+
p7, p8, p9) P10
|
| 423 |
+
|
| 424 |
+
// The name of the class template implementing the action template.
|
| 425 |
+
#define GMOCK_ACTION_CLASS_(name, value_params)\
|
| 426 |
+
GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params)
|
| 427 |
+
|
| 428 |
+
#define ACTION_TEMPLATE(name, template_params, value_params) \
|
| 429 |
+
template <GMOCK_INTERNAL_DECL_##template_params \
|
| 430 |
+
GMOCK_INTERNAL_DECL_TYPE_##value_params> \
|
| 431 |
+
class GMOCK_ACTION_CLASS_(name, value_params) { \
|
| 432 |
+
public: \
|
| 433 |
+
explicit GMOCK_ACTION_CLASS_(name, value_params)( \
|
| 434 |
+
GMOCK_INTERNAL_DECL_##value_params) \
|
| 435 |
+
GMOCK_PP_IF(GMOCK_PP_IS_EMPTY(GMOCK_INTERNAL_COUNT_##value_params), \
|
| 436 |
+
= default; , \
|
| 437 |
+
: impl_(std::make_shared<gmock_Impl>( \
|
| 438 |
+
GMOCK_INTERNAL_LIST_##value_params)) { }) \
|
| 439 |
+
GMOCK_ACTION_CLASS_(name, value_params)( \
|
| 440 |
+
const GMOCK_ACTION_CLASS_(name, value_params)&) noexcept \
|
| 441 |
+
GMOCK_INTERNAL_DEFN_COPY_##value_params \
|
| 442 |
+
GMOCK_ACTION_CLASS_(name, value_params)( \
|
| 443 |
+
GMOCK_ACTION_CLASS_(name, value_params)&&) noexcept \
|
| 444 |
+
GMOCK_INTERNAL_DEFN_COPY_##value_params \
|
| 445 |
+
template <typename F> \
|
| 446 |
+
operator ::testing::Action<F>() const { \
|
| 447 |
+
return GMOCK_PP_IF( \
|
| 448 |
+
GMOCK_PP_IS_EMPTY(GMOCK_INTERNAL_COUNT_##value_params), \
|
| 449 |
+
(::testing::internal::MakeAction<F, gmock_Impl>()), \
|
| 450 |
+
(::testing::internal::MakeAction<F>(impl_))); \
|
| 451 |
+
} \
|
| 452 |
+
private: \
|
| 453 |
+
class gmock_Impl { \
|
| 454 |
+
public: \
|
| 455 |
+
explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {} \
|
| 456 |
+
template <typename function_type, typename return_type, \
|
| 457 |
+
typename args_type, GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \
|
| 458 |
+
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \
|
| 459 |
+
GMOCK_INTERNAL_DEFN_##value_params \
|
| 460 |
+
}; \
|
| 461 |
+
GMOCK_PP_IF(GMOCK_PP_IS_EMPTY(GMOCK_INTERNAL_COUNT_##value_params), \
|
| 462 |
+
, std::shared_ptr<const gmock_Impl> impl_;) \
|
| 463 |
+
}; \
|
| 464 |
+
template <GMOCK_INTERNAL_DECL_##template_params \
|
| 465 |
+
GMOCK_INTERNAL_DECL_TYPE_##value_params> \
|
| 466 |
+
GMOCK_ACTION_CLASS_(name, value_params)< \
|
| 467 |
+
GMOCK_INTERNAL_LIST_##template_params \
|
| 468 |
+
GMOCK_INTERNAL_LIST_TYPE_##value_params> name( \
|
| 469 |
+
GMOCK_INTERNAL_DECL_##value_params) GTEST_MUST_USE_RESULT_; \
|
| 470 |
+
template <GMOCK_INTERNAL_DECL_##template_params \
|
| 471 |
+
GMOCK_INTERNAL_DECL_TYPE_##value_params> \
|
| 472 |
+
inline GMOCK_ACTION_CLASS_(name, value_params)< \
|
| 473 |
+
GMOCK_INTERNAL_LIST_##template_params \
|
| 474 |
+
GMOCK_INTERNAL_LIST_TYPE_##value_params> name( \
|
| 475 |
+
GMOCK_INTERNAL_DECL_##value_params) { \
|
| 476 |
+
return GMOCK_ACTION_CLASS_(name, value_params)< \
|
| 477 |
+
GMOCK_INTERNAL_LIST_##template_params \
|
| 478 |
+
GMOCK_INTERNAL_LIST_TYPE_##value_params>( \
|
| 479 |
+
GMOCK_INTERNAL_LIST_##value_params); \
|
| 480 |
+
} \
|
| 481 |
+
template <GMOCK_INTERNAL_DECL_##template_params \
|
| 482 |
+
GMOCK_INTERNAL_DECL_TYPE_##value_params> \
|
| 483 |
+
template <typename function_type, typename return_type, typename args_type, \
|
| 484 |
+
GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \
|
| 485 |
+
return_type GMOCK_ACTION_CLASS_(name, value_params)< \
|
| 486 |
+
GMOCK_INTERNAL_LIST_##template_params \
|
| 487 |
+
GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl::gmock_PerformImpl( \
|
| 488 |
+
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
|
| 489 |
+
|
| 490 |
+
namespace testing {
|
| 491 |
+
|
| 492 |
+
// The ACTION*() macros trigger warning C4100 (unreferenced formal
|
| 493 |
+
// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
|
| 494 |
+
// the macro definition, as the warnings are generated when the macro
|
| 495 |
+
// is expanded and macro expansion cannot contain #pragma. Therefore
|
| 496 |
+
// we suppress them here.
|
| 497 |
+
#ifdef _MSC_VER
|
| 498 |
+
# pragma warning(push)
|
| 499 |
+
# pragma warning(disable:4100)
|
| 500 |
+
#endif
|
| 501 |
+
|
| 502 |
+
namespace internal {
|
| 503 |
+
|
| 504 |
+
// internal::InvokeArgument - a helper for InvokeArgument action.
|
| 505 |
+
// The basic overloads are provided here for generic functors.
|
| 506 |
+
// Overloads for other custom-callables are provided in the
|
| 507 |
+
// internal/custom/gmock-generated-actions.h header.
|
| 508 |
+
template <typename F, typename... Args>
|
| 509 |
+
auto InvokeArgument(F f, Args... args) -> decltype(f(args...)) {
|
| 510 |
+
return f(args...);
|
| 511 |
+
}
|
| 512 |
+
|
| 513 |
+
template <std::size_t index, typename... Params>
|
| 514 |
+
struct InvokeArgumentAction {
|
| 515 |
+
template <typename... Args>
|
| 516 |
+
auto operator()(Args&&... args) const -> decltype(internal::InvokeArgument(
|
| 517 |
+
std::get<index>(std::forward_as_tuple(std::forward<Args>(args)...)),
|
| 518 |
+
std::declval<const Params&>()...)) {
|
| 519 |
+
internal::FlatTuple<Args&&...> args_tuple(FlatTupleConstructTag{},
|
| 520 |
+
std::forward<Args>(args)...);
|
| 521 |
+
return params.Apply([&](const Params&... unpacked_params) {
|
| 522 |
+
auto&& callable = args_tuple.template Get<index>();
|
| 523 |
+
return internal::InvokeArgument(
|
| 524 |
+
std::forward<decltype(callable)>(callable), unpacked_params...);
|
| 525 |
+
});
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
internal::FlatTuple<Params...> params;
|
| 529 |
+
};
|
| 530 |
+
|
| 531 |
+
} // namespace internal
|
| 532 |
+
|
| 533 |
+
// The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
|
| 534 |
+
// (0-based) argument, which must be a k-ary callable, of the mock
|
| 535 |
+
// function, with arguments a1, a2, ..., a_k.
|
| 536 |
+
//
|
| 537 |
+
// Notes:
|
| 538 |
+
//
|
| 539 |
+
// 1. The arguments are passed by value by default. If you need to
|
| 540 |
+
// pass an argument by reference, wrap it inside std::ref(). For
|
| 541 |
+
// example,
|
| 542 |
+
//
|
| 543 |
+
// InvokeArgument<1>(5, string("Hello"), std::ref(foo))
|
| 544 |
+
//
|
| 545 |
+
// passes 5 and string("Hello") by value, and passes foo by
|
| 546 |
+
// reference.
|
| 547 |
+
//
|
| 548 |
+
// 2. If the callable takes an argument by reference but std::ref() is
|
| 549 |
+
// not used, it will receive the reference to a copy of the value,
|
| 550 |
+
// instead of the original value. For example, when the 0-th
|
| 551 |
+
// argument of the mock function takes a const string&, the action
|
| 552 |
+
//
|
| 553 |
+
// InvokeArgument<0>(string("Hello"))
|
| 554 |
+
//
|
| 555 |
+
// makes a copy of the temporary string("Hello") object and passes a
|
| 556 |
+
// reference of the copy, instead of the original temporary object,
|
| 557 |
+
// to the callable. This makes it easy for a user to define an
|
| 558 |
+
// InvokeArgument action from temporary values and have it performed
|
| 559 |
+
// later.
|
| 560 |
+
template <std::size_t index, typename... Params>
|
| 561 |
+
internal::InvokeArgumentAction<index, typename std::decay<Params>::type...>
|
| 562 |
+
InvokeArgument(Params&&... params) {
|
| 563 |
+
return {internal::FlatTuple<typename std::decay<Params>::type...>(
|
| 564 |
+
internal::FlatTupleConstructTag{}, std::forward<Params>(params)...)};
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
#ifdef _MSC_VER
|
| 568 |
+
# pragma warning(pop)
|
| 569 |
+
#endif
|
| 570 |
+
|
| 571 |
+
} // namespace testing
|
| 572 |
+
|
| 573 |
+
#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock-more-matchers.h
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2013, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
// Google Mock - a framework for writing C++ mock classes.
|
| 32 |
+
//
|
| 33 |
+
// This file implements some matchers that depend on gmock-matchers.h.
|
| 34 |
+
//
|
| 35 |
+
// Note that tests are implemented in gmock-matchers_test.cc rather than
|
| 36 |
+
// gmock-more-matchers-test.cc.
|
| 37 |
+
|
| 38 |
+
// GOOGLETEST_CM0002 DO NOT DELETE
|
| 39 |
+
|
| 40 |
+
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_MATCHERS_H_
|
| 41 |
+
#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_MATCHERS_H_
|
| 42 |
+
|
| 43 |
+
#include "gmock/gmock-matchers.h"
|
| 44 |
+
|
| 45 |
+
namespace testing {
|
| 46 |
+
|
| 47 |
+
// Silence C4100 (unreferenced formal
|
| 48 |
+
// parameter) for MSVC
|
| 49 |
+
#ifdef _MSC_VER
|
| 50 |
+
# pragma warning(push)
|
| 51 |
+
# pragma warning(disable:4100)
|
| 52 |
+
#if (_MSC_VER == 1900)
|
| 53 |
+
// and silence C4800 (C4800: 'int *const ': forcing value
|
| 54 |
+
// to bool 'true' or 'false') for MSVC 14
|
| 55 |
+
# pragma warning(disable:4800)
|
| 56 |
+
#endif
|
| 57 |
+
#endif
|
| 58 |
+
|
| 59 |
+
// Defines a matcher that matches an empty container. The container must
|
| 60 |
+
// support both size() and empty(), which all STL-like containers provide.
|
| 61 |
+
MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") {
|
| 62 |
+
if (arg.empty()) {
|
| 63 |
+
return true;
|
| 64 |
+
}
|
| 65 |
+
*result_listener << "whose size is " << arg.size();
|
| 66 |
+
return false;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
// Define a matcher that matches a value that evaluates in boolean
|
| 70 |
+
// context to true. Useful for types that define "explicit operator
|
| 71 |
+
// bool" operators and so can't be compared for equality with true
|
| 72 |
+
// and false.
|
| 73 |
+
MATCHER(IsTrue, negation ? "is false" : "is true") {
|
| 74 |
+
return static_cast<bool>(arg);
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
// Define a matcher that matches a value that evaluates in boolean
|
| 78 |
+
// context to false. Useful for types that define "explicit operator
|
| 79 |
+
// bool" operators and so can't be compared for equality with true
|
| 80 |
+
// and false.
|
| 81 |
+
MATCHER(IsFalse, negation ? "is true" : "is false") {
|
| 82 |
+
return !static_cast<bool>(arg);
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
#ifdef _MSC_VER
|
| 86 |
+
# pragma warning(pop)
|
| 87 |
+
#endif
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
} // namespace testing
|
| 91 |
+
|
| 92 |
+
#endif // GOOG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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2008, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
// Implements class templates NiceMock, NaggyMock, and StrictMock.
|
| 32 |
+
//
|
| 33 |
+
// Given a mock class MockFoo that is created using Google Mock,
|
| 34 |
+
// NiceMock<MockFoo> is a subclass of MockFoo that allows
|
| 35 |
+
// uninteresting calls (i.e. calls to mock methods that have no
|
| 36 |
+
// EXPECT_CALL specs), NaggyMock<MockFoo> is a subclass of MockFoo
|
| 37 |
+
// that prints a warning when an uninteresting call occurs, and
|
| 38 |
+
// StrictMock<MockFoo> is a subclass of MockFoo that treats all
|
| 39 |
+
// uninteresting calls as errors.
|
| 40 |
+
//
|
| 41 |
+
// Currently a mock is naggy by default, so MockFoo and
|
| 42 |
+
// NaggyMock<MockFoo> behave like the same. However, we will soon
|
| 43 |
+
// switch the default behavior of mocks to be nice, as that in general
|
| 44 |
+
// leads to more maintainable tests. When that happens, MockFoo will
|
| 45 |
+
// stop behaving like NaggyMock<MockFoo> and start behaving like
|
| 46 |
+
// NiceMock<MockFoo>.
|
| 47 |
+
//
|
| 48 |
+
// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
|
| 49 |
+
// their respective base class. Therefore you can write
|
| 50 |
+
// NiceMock<MockFoo>(5, "a") to construct a nice mock where MockFoo
|
| 51 |
+
// has a constructor that accepts (int, const char*), for example.
|
| 52 |
+
//
|
| 53 |
+
// A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>,
|
| 54 |
+
// and StrictMock<MockFoo> only works for mock methods defined using
|
| 55 |
+
// the MOCK_METHOD* family of macros DIRECTLY in the MockFoo class.
|
| 56 |
+
// If a mock method is defined in a base class of MockFoo, the "nice"
|
| 57 |
+
// or "strict" modifier may not affect it, depending on the compiler.
|
| 58 |
+
// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT
|
| 59 |
+
// supported.
|
| 60 |
+
|
| 61 |
+
// GOOGLETEST_CM0002 DO NOT DELETE
|
| 62 |
+
|
| 63 |
+
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_NICE_STRICT_H_
|
| 64 |
+
#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_NICE_STRICT_H_
|
| 65 |
+
|
| 66 |
+
#include <type_traits>
|
| 67 |
+
|
| 68 |
+
#include "gmock/gmock-spec-builders.h"
|
| 69 |
+
#include "gmock/internal/gmock-port.h"
|
| 70 |
+
|
| 71 |
+
namespace testing {
|
| 72 |
+
template <class MockClass>
|
| 73 |
+
class NiceMock;
|
| 74 |
+
template <class MockClass>
|
| 75 |
+
class NaggyMock;
|
| 76 |
+
template <class MockClass>
|
| 77 |
+
class StrictMock;
|
| 78 |
+
|
| 79 |
+
namespace internal {
|
| 80 |
+
template <typename T>
|
| 81 |
+
std::true_type StrictnessModifierProbe(const NiceMock<T>&);
|
| 82 |
+
template <typename T>
|
| 83 |
+
std::true_type StrictnessModifierProbe(const NaggyMock<T>&);
|
| 84 |
+
template <typename T>
|
| 85 |
+
std::true_type StrictnessModifierProbe(const StrictMock<T>&);
|
| 86 |
+
std::false_type StrictnessModifierProbe(...);
|
| 87 |
+
|
| 88 |
+
template <typename T>
|
| 89 |
+
constexpr bool HasStrictnessModifier() {
|
| 90 |
+
return decltype(StrictnessModifierProbe(std::declval<const T&>()))::value;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
// Base classes that register and deregister with testing::Mock to alter the
|
| 94 |
+
// default behavior around uninteresting calls. Inheriting from one of these
|
| 95 |
+
// classes first and then MockClass ensures the MockClass constructor is run
|
| 96 |
+
// after registration, and that the MockClass destructor runs before
|
| 97 |
+
// deregistration. This guarantees that MockClass's constructor and destructor
|
| 98 |
+
// run with the same level of strictness as its instance methods.
|
| 99 |
+
|
| 100 |
+
#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW && \
|
| 101 |
+
(defined(_MSC_VER) || defined(__clang__))
|
| 102 |
+
// We need to mark these classes with this declspec to ensure that
|
| 103 |
+
// the empty base class optimization is performed.
|
| 104 |
+
#define GTEST_INTERNAL_EMPTY_BASE_CLASS __declspec(empty_bases)
|
| 105 |
+
#else
|
| 106 |
+
#define GTEST_INTERNAL_EMPTY_BASE_CLASS
|
| 107 |
+
#endif
|
| 108 |
+
|
| 109 |
+
template <typename Base>
|
| 110 |
+
class NiceMockImpl {
|
| 111 |
+
public:
|
| 112 |
+
NiceMockImpl() { ::testing::Mock::AllowUninterestingCalls(this); }
|
| 113 |
+
|
| 114 |
+
~NiceMockImpl() { ::testing::Mock::UnregisterCallReaction(this); }
|
| 115 |
+
};
|
| 116 |
+
|
| 117 |
+
template <typename Base>
|
| 118 |
+
class NaggyMockImpl {
|
| 119 |
+
public:
|
| 120 |
+
NaggyMockImpl() { ::testing::Mock::WarnUninterestingCalls(this); }
|
| 121 |
+
|
| 122 |
+
~NaggyMockImpl() { ::testing::Mock::UnregisterCallReaction(this); }
|
| 123 |
+
};
|
| 124 |
+
|
| 125 |
+
template <typename Base>
|
| 126 |
+
class StrictMockImpl {
|
| 127 |
+
public:
|
| 128 |
+
StrictMockImpl() { ::testing::Mock::FailUninterestingCalls(this); }
|
| 129 |
+
|
| 130 |
+
~StrictMockImpl() { ::testing::Mock::UnregisterCallReaction(this); }
|
| 131 |
+
};
|
| 132 |
+
|
| 133 |
+
} // namespace internal
|
| 134 |
+
|
| 135 |
+
template <class MockClass>
|
| 136 |
+
class GTEST_INTERNAL_EMPTY_BASE_CLASS NiceMock
|
| 137 |
+
: private internal::NiceMockImpl<MockClass>,
|
| 138 |
+
public MockClass {
|
| 139 |
+
public:
|
| 140 |
+
static_assert(!internal::HasStrictnessModifier<MockClass>(),
|
| 141 |
+
"Can't apply NiceMock to a class hierarchy that already has a "
|
| 142 |
+
"strictness modifier. See "
|
| 143 |
+
"https://google.github.io/googletest/"
|
| 144 |
+
"gmock_cook_book.html#NiceStrictNaggy");
|
| 145 |
+
NiceMock() : MockClass() {
|
| 146 |
+
static_assert(sizeof(*this) == sizeof(MockClass),
|
| 147 |
+
"The impl subclass shouldn't introduce any padding");
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
// Ideally, we would inherit base class's constructors through a using
|
| 151 |
+
// declaration, which would preserve their visibility. However, many existing
|
| 152 |
+
// tests rely on the fact that current implementation reexports protected
|
| 153 |
+
// constructors as public. These tests would need to be cleaned up first.
|
| 154 |
+
|
| 155 |
+
// Single argument constructor is special-cased so that it can be
|
| 156 |
+
// made explicit.
|
| 157 |
+
template <typename A>
|
| 158 |
+
explicit NiceMock(A&& arg) : MockClass(std::forward<A>(arg)) {
|
| 159 |
+
static_assert(sizeof(*this) == sizeof(MockClass),
|
| 160 |
+
"The impl subclass shouldn't introduce any padding");
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
template <typename TArg1, typename TArg2, typename... An>
|
| 164 |
+
NiceMock(TArg1&& arg1, TArg2&& arg2, An&&... args)
|
| 165 |
+
: MockClass(std::forward<TArg1>(arg1), std::forward<TArg2>(arg2),
|
| 166 |
+
std::forward<An>(args)...) {
|
| 167 |
+
static_assert(sizeof(*this) == sizeof(MockClass),
|
| 168 |
+
"The impl subclass shouldn't introduce any padding");
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
private:
|
| 172 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock);
|
| 173 |
+
};
|
| 174 |
+
|
| 175 |
+
template <class MockClass>
|
| 176 |
+
class GTEST_INTERNAL_EMPTY_BASE_CLASS NaggyMock
|
| 177 |
+
: private internal::NaggyMockImpl<MockClass>,
|
| 178 |
+
public MockClass {
|
| 179 |
+
static_assert(!internal::HasStrictnessModifier<MockClass>(),
|
| 180 |
+
"Can't apply NaggyMock to a class hierarchy that already has a "
|
| 181 |
+
"strictness modifier. See "
|
| 182 |
+
"https://google.github.io/googletest/"
|
| 183 |
+
"gmock_cook_book.html#NiceStrictNaggy");
|
| 184 |
+
|
| 185 |
+
public:
|
| 186 |
+
NaggyMock() : MockClass() {
|
| 187 |
+
static_assert(sizeof(*this) == sizeof(MockClass),
|
| 188 |
+
"The impl subclass shouldn't introduce any padding");
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
// Ideally, we would inherit base class's constructors through a using
|
| 192 |
+
// declaration, which would preserve their visibility. However, many existing
|
| 193 |
+
// tests rely on the fact that current implementation reexports protected
|
| 194 |
+
// constructors as public. These tests would need to be cleaned up first.
|
| 195 |
+
|
| 196 |
+
// Single argument constructor is special-cased so that it can be
|
| 197 |
+
// made explicit.
|
| 198 |
+
template <typename A>
|
| 199 |
+
explicit NaggyMock(A&& arg) : MockClass(std::forward<A>(arg)) {
|
| 200 |
+
static_assert(sizeof(*this) == sizeof(MockClass),
|
| 201 |
+
"The impl subclass shouldn't introduce any padding");
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
template <typename TArg1, typename TArg2, typename... An>
|
| 205 |
+
NaggyMock(TArg1&& arg1, TArg2&& arg2, An&&... args)
|
| 206 |
+
: MockClass(std::forward<TArg1>(arg1), std::forward<TArg2>(arg2),
|
| 207 |
+
std::forward<An>(args)...) {
|
| 208 |
+
static_assert(sizeof(*this) == sizeof(MockClass),
|
| 209 |
+
"The impl subclass shouldn't introduce any padding");
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
private:
|
| 213 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(NaggyMock);
|
| 214 |
+
};
|
| 215 |
+
|
| 216 |
+
template <class MockClass>
|
| 217 |
+
class GTEST_INTERNAL_EMPTY_BASE_CLASS StrictMock
|
| 218 |
+
: private internal::StrictMockImpl<MockClass>,
|
| 219 |
+
public MockClass {
|
| 220 |
+
public:
|
| 221 |
+
static_assert(
|
| 222 |
+
!internal::HasStrictnessModifier<MockClass>(),
|
| 223 |
+
"Can't apply StrictMock to a class hierarchy that already has a "
|
| 224 |
+
"strictness modifier. See "
|
| 225 |
+
"https://google.github.io/googletest/"
|
| 226 |
+
"gmock_cook_book.html#NiceStrictNaggy");
|
| 227 |
+
StrictMock() : MockClass() {
|
| 228 |
+
static_assert(sizeof(*this) == sizeof(MockClass),
|
| 229 |
+
"The impl subclass shouldn't introduce any padding");
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
// Ideally, we would inherit base class's constructors through a using
|
| 233 |
+
// declaration, which would preserve their visibility. However, many existing
|
| 234 |
+
// tests rely on the fact that current implementation reexports protected
|
| 235 |
+
// constructors as public. These tests would need to be cleaned up first.
|
| 236 |
+
|
| 237 |
+
// Single argument constructor is special-cased so that it can be
|
| 238 |
+
// made explicit.
|
| 239 |
+
template <typename A>
|
| 240 |
+
explicit StrictMock(A&& arg) : MockClass(std::forward<A>(arg)) {
|
| 241 |
+
static_assert(sizeof(*this) == sizeof(MockClass),
|
| 242 |
+
"The impl subclass shouldn't introduce any padding");
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
template <typename TArg1, typename TArg2, typename... An>
|
| 246 |
+
StrictMock(TArg1&& arg1, TArg2&& arg2, An&&... args)
|
| 247 |
+
: MockClass(std::forward<TArg1>(arg1), std::forward<TArg2>(arg2),
|
| 248 |
+
std::forward<An>(args)...) {
|
| 249 |
+
static_assert(sizeof(*this) == sizeof(MockClass),
|
| 250 |
+
"The impl subclass shouldn't introduce any padding");
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
private:
|
| 254 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(StrictMock);
|
| 255 |
+
};
|
| 256 |
+
|
| 257 |
+
#undef GTEST_INTERNAL_EMPTY_BASE_CLASS
|
| 258 |
+
|
| 259 |
+
} // namespace testing
|
| 260 |
+
|
| 261 |
+
#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_NICE_STRICT_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock-spec-builders.h
ADDED
|
@@ -0,0 +1,2038 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2007, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
// Google Mock - a framework for writing C++ mock classes.
|
| 32 |
+
//
|
| 33 |
+
// This file implements the ON_CALL() and EXPECT_CALL() macros.
|
| 34 |
+
//
|
| 35 |
+
// A user can use the ON_CALL() macro to specify the default action of
|
| 36 |
+
// a mock method. The syntax is:
|
| 37 |
+
//
|
| 38 |
+
// ON_CALL(mock_object, Method(argument-matchers))
|
| 39 |
+
// .With(multi-argument-matcher)
|
| 40 |
+
// .WillByDefault(action);
|
| 41 |
+
//
|
| 42 |
+
// where the .With() clause is optional.
|
| 43 |
+
//
|
| 44 |
+
// A user can use the EXPECT_CALL() macro to specify an expectation on
|
| 45 |
+
// a mock method. The syntax is:
|
| 46 |
+
//
|
| 47 |
+
// EXPECT_CALL(mock_object, Method(argument-matchers))
|
| 48 |
+
// .With(multi-argument-matchers)
|
| 49 |
+
// .Times(cardinality)
|
| 50 |
+
// .InSequence(sequences)
|
| 51 |
+
// .After(expectations)
|
| 52 |
+
// .WillOnce(action)
|
| 53 |
+
// .WillRepeatedly(action)
|
| 54 |
+
// .RetiresOnSaturation();
|
| 55 |
+
//
|
| 56 |
+
// where all clauses are optional, and .InSequence()/.After()/
|
| 57 |
+
// .WillOnce() can appear any number of times.
|
| 58 |
+
|
| 59 |
+
// GOOGLETEST_CM0002 DO NOT DELETE
|
| 60 |
+
|
| 61 |
+
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
|
| 62 |
+
#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
|
| 63 |
+
|
| 64 |
+
#include <functional>
|
| 65 |
+
#include <map>
|
| 66 |
+
#include <memory>
|
| 67 |
+
#include <set>
|
| 68 |
+
#include <sstream>
|
| 69 |
+
#include <string>
|
| 70 |
+
#include <type_traits>
|
| 71 |
+
#include <utility>
|
| 72 |
+
#include <vector>
|
| 73 |
+
#include "gmock/gmock-actions.h"
|
| 74 |
+
#include "gmock/gmock-cardinalities.h"
|
| 75 |
+
#include "gmock/gmock-matchers.h"
|
| 76 |
+
#include "gmock/internal/gmock-internal-utils.h"
|
| 77 |
+
#include "gmock/internal/gmock-port.h"
|
| 78 |
+
#include "gtest/gtest.h"
|
| 79 |
+
|
| 80 |
+
#if GTEST_HAS_EXCEPTIONS
|
| 81 |
+
# include <stdexcept> // NOLINT
|
| 82 |
+
#endif
|
| 83 |
+
|
| 84 |
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
| 85 |
+
/* class A needs to have dll-interface to be used by clients of class B */)
|
| 86 |
+
|
| 87 |
+
namespace testing {
|
| 88 |
+
|
| 89 |
+
// An abstract handle of an expectation.
|
| 90 |
+
class Expectation;
|
| 91 |
+
|
| 92 |
+
// A set of expectation handles.
|
| 93 |
+
class ExpectationSet;
|
| 94 |
+
|
| 95 |
+
// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION
|
| 96 |
+
// and MUST NOT BE USED IN USER CODE!!!
|
| 97 |
+
namespace internal {
|
| 98 |
+
|
| 99 |
+
// Implements a mock function.
|
| 100 |
+
template <typename F> class FunctionMocker;
|
| 101 |
+
|
| 102 |
+
// Base class for expectations.
|
| 103 |
+
class ExpectationBase;
|
| 104 |
+
|
| 105 |
+
// Implements an expectation.
|
| 106 |
+
template <typename F> class TypedExpectation;
|
| 107 |
+
|
| 108 |
+
// Helper class for testing the Expectation class template.
|
| 109 |
+
class ExpectationTester;
|
| 110 |
+
|
| 111 |
+
// Helper classes for implementing NiceMock, StrictMock, and NaggyMock.
|
| 112 |
+
template <typename MockClass>
|
| 113 |
+
class NiceMockImpl;
|
| 114 |
+
template <typename MockClass>
|
| 115 |
+
class StrictMockImpl;
|
| 116 |
+
template <typename MockClass>
|
| 117 |
+
class NaggyMockImpl;
|
| 118 |
+
|
| 119 |
+
// Protects the mock object registry (in class Mock), all function
|
| 120 |
+
// mockers, and all expectations.
|
| 121 |
+
//
|
| 122 |
+
// The reason we don't use more fine-grained protection is: when a
|
| 123 |
+
// mock function Foo() is called, it needs to consult its expectations
|
| 124 |
+
// to see which one should be picked. If another thread is allowed to
|
| 125 |
+
// call a mock function (either Foo() or a different one) at the same
|
| 126 |
+
// time, it could affect the "retired" attributes of Foo()'s
|
| 127 |
+
// expectations when InSequence() is used, and thus affect which
|
| 128 |
+
// expectation gets picked. Therefore, we sequence all mock function
|
| 129 |
+
// calls to ensure the integrity of the mock objects' states.
|
| 130 |
+
GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex);
|
| 131 |
+
|
| 132 |
+
// Untyped base class for ActionResultHolder<R>.
|
| 133 |
+
class UntypedActionResultHolderBase;
|
| 134 |
+
|
| 135 |
+
// Abstract base class of FunctionMocker. This is the
|
| 136 |
+
// type-agnostic part of the function mocker interface. Its pure
|
| 137 |
+
// virtual methods are implemented by FunctionMocker.
|
| 138 |
+
class GTEST_API_ UntypedFunctionMockerBase {
|
| 139 |
+
public:
|
| 140 |
+
UntypedFunctionMockerBase();
|
| 141 |
+
virtual ~UntypedFunctionMockerBase();
|
| 142 |
+
|
| 143 |
+
// Verifies that all expectations on this mock function have been
|
| 144 |
+
// satisfied. Reports one or more Google Test non-fatal failures
|
| 145 |
+
// and returns false if not.
|
| 146 |
+
bool VerifyAndClearExpectationsLocked()
|
| 147 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
|
| 148 |
+
|
| 149 |
+
// Clears the ON_CALL()s set on this mock function.
|
| 150 |
+
virtual void ClearDefaultActionsLocked()
|
| 151 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) = 0;
|
| 152 |
+
|
| 153 |
+
// In all of the following Untyped* functions, it's the caller's
|
| 154 |
+
// responsibility to guarantee the correctness of the arguments'
|
| 155 |
+
// types.
|
| 156 |
+
|
| 157 |
+
// Performs the default action with the given arguments and returns
|
| 158 |
+
// the action's result. The call description string will be used in
|
| 159 |
+
// the error message to describe the call in the case the default
|
| 160 |
+
// action fails.
|
| 161 |
+
// L = *
|
| 162 |
+
virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
|
| 163 |
+
void* untyped_args, const std::string& call_description) const = 0;
|
| 164 |
+
|
| 165 |
+
// Performs the given action with the given arguments and returns
|
| 166 |
+
// the action's result.
|
| 167 |
+
// L = *
|
| 168 |
+
virtual UntypedActionResultHolderBase* UntypedPerformAction(
|
| 169 |
+
const void* untyped_action, void* untyped_args) const = 0;
|
| 170 |
+
|
| 171 |
+
// Writes a message that the call is uninteresting (i.e. neither
|
| 172 |
+
// explicitly expected nor explicitly unexpected) to the given
|
| 173 |
+
// ostream.
|
| 174 |
+
virtual void UntypedDescribeUninterestingCall(
|
| 175 |
+
const void* untyped_args,
|
| 176 |
+
::std::ostream* os) const
|
| 177 |
+
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0;
|
| 178 |
+
|
| 179 |
+
// Returns the expectation that matches the given function arguments
|
| 180 |
+
// (or NULL is there's no match); when a match is found,
|
| 181 |
+
// untyped_action is set to point to the action that should be
|
| 182 |
+
// performed (or NULL if the action is "do default"), and
|
| 183 |
+
// is_excessive is modified to indicate whether the call exceeds the
|
| 184 |
+
// expected number.
|
| 185 |
+
virtual const ExpectationBase* UntypedFindMatchingExpectation(
|
| 186 |
+
const void* untyped_args,
|
| 187 |
+
const void** untyped_action, bool* is_excessive,
|
| 188 |
+
::std::ostream* what, ::std::ostream* why)
|
| 189 |
+
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0;
|
| 190 |
+
|
| 191 |
+
// Prints the given function arguments to the ostream.
|
| 192 |
+
virtual void UntypedPrintArgs(const void* untyped_args,
|
| 193 |
+
::std::ostream* os) const = 0;
|
| 194 |
+
|
| 195 |
+
// Sets the mock object this mock method belongs to, and registers
|
| 196 |
+
// this information in the global mock registry. Will be called
|
| 197 |
+
// whenever an EXPECT_CALL() or ON_CALL() is executed on this mock
|
| 198 |
+
// method.
|
| 199 |
+
void RegisterOwner(const void* mock_obj)
|
| 200 |
+
GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
|
| 201 |
+
|
| 202 |
+
// Sets the mock object this mock method belongs to, and sets the
|
| 203 |
+
// name of the mock function. Will be called upon each invocation
|
| 204 |
+
// of this mock function.
|
| 205 |
+
void SetOwnerAndName(const void* mock_obj, const char* name)
|
| 206 |
+
GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
|
| 207 |
+
|
| 208 |
+
// Returns the mock object this mock method belongs to. Must be
|
| 209 |
+
// called after RegisterOwner() or SetOwnerAndName() has been
|
| 210 |
+
// called.
|
| 211 |
+
const void* MockObject() const
|
| 212 |
+
GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
|
| 213 |
+
|
| 214 |
+
// Returns the name of this mock method. Must be called after
|
| 215 |
+
// SetOwnerAndName() has been called.
|
| 216 |
+
const char* Name() const
|
| 217 |
+
GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
|
| 218 |
+
|
| 219 |
+
// Returns the result of invoking this mock function with the given
|
| 220 |
+
// arguments. This function can be safely called from multiple
|
| 221 |
+
// threads concurrently. The caller is responsible for deleting the
|
| 222 |
+
// result.
|
| 223 |
+
UntypedActionResultHolderBase* UntypedInvokeWith(void* untyped_args)
|
| 224 |
+
GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
|
| 225 |
+
|
| 226 |
+
protected:
|
| 227 |
+
typedef std::vector<const void*> UntypedOnCallSpecs;
|
| 228 |
+
|
| 229 |
+
using UntypedExpectations = std::vector<std::shared_ptr<ExpectationBase>>;
|
| 230 |
+
|
| 231 |
+
// Returns an Expectation object that references and co-owns exp,
|
| 232 |
+
// which must be an expectation on this mock function.
|
| 233 |
+
Expectation GetHandleOf(ExpectationBase* exp);
|
| 234 |
+
|
| 235 |
+
// Address of the mock object this mock method belongs to. Only
|
| 236 |
+
// valid after this mock method has been called or
|
| 237 |
+
// ON_CALL/EXPECT_CALL has been invoked on it.
|
| 238 |
+
const void* mock_obj_; // Protected by g_gmock_mutex.
|
| 239 |
+
|
| 240 |
+
// Name of the function being mocked. Only valid after this mock
|
| 241 |
+
// method has been called.
|
| 242 |
+
const char* name_; // Protected by g_gmock_mutex.
|
| 243 |
+
|
| 244 |
+
// All default action specs for this function mocker.
|
| 245 |
+
UntypedOnCallSpecs untyped_on_call_specs_;
|
| 246 |
+
|
| 247 |
+
// All expectations for this function mocker.
|
| 248 |
+
//
|
| 249 |
+
// It's undefined behavior to interleave expectations (EXPECT_CALLs
|
| 250 |
+
// or ON_CALLs) and mock function calls. Also, the order of
|
| 251 |
+
// expectations is important. Therefore it's a logic race condition
|
| 252 |
+
// to read/write untyped_expectations_ concurrently. In order for
|
| 253 |
+
// tools like tsan to catch concurrent read/write accesses to
|
| 254 |
+
// untyped_expectations, we deliberately leave accesses to it
|
| 255 |
+
// unprotected.
|
| 256 |
+
UntypedExpectations untyped_expectations_;
|
| 257 |
+
}; // class UntypedFunctionMockerBase
|
| 258 |
+
|
| 259 |
+
// Untyped base class for OnCallSpec<F>.
|
| 260 |
+
class UntypedOnCallSpecBase {
|
| 261 |
+
public:
|
| 262 |
+
// The arguments are the location of the ON_CALL() statement.
|
| 263 |
+
UntypedOnCallSpecBase(const char* a_file, int a_line)
|
| 264 |
+
: file_(a_file), line_(a_line), last_clause_(kNone) {}
|
| 265 |
+
|
| 266 |
+
// Where in the source file was the default action spec defined?
|
| 267 |
+
const char* file() const { return file_; }
|
| 268 |
+
int line() const { return line_; }
|
| 269 |
+
|
| 270 |
+
protected:
|
| 271 |
+
// Gives each clause in the ON_CALL() statement a name.
|
| 272 |
+
enum Clause {
|
| 273 |
+
// Do not change the order of the enum members! The run-time
|
| 274 |
+
// syntax checking relies on it.
|
| 275 |
+
kNone,
|
| 276 |
+
kWith,
|
| 277 |
+
kWillByDefault
|
| 278 |
+
};
|
| 279 |
+
|
| 280 |
+
// Asserts that the ON_CALL() statement has a certain property.
|
| 281 |
+
void AssertSpecProperty(bool property,
|
| 282 |
+
const std::string& failure_message) const {
|
| 283 |
+
Assert(property, file_, line_, failure_message);
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
// Expects that the ON_CALL() statement has a certain property.
|
| 287 |
+
void ExpectSpecProperty(bool property,
|
| 288 |
+
const std::string& failure_message) const {
|
| 289 |
+
Expect(property, file_, line_, failure_message);
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
const char* file_;
|
| 293 |
+
int line_;
|
| 294 |
+
|
| 295 |
+
// The last clause in the ON_CALL() statement as seen so far.
|
| 296 |
+
// Initially kNone and changes as the statement is parsed.
|
| 297 |
+
Clause last_clause_;
|
| 298 |
+
}; // class UntypedOnCallSpecBase
|
| 299 |
+
|
| 300 |
+
// This template class implements an ON_CALL spec.
|
| 301 |
+
template <typename F>
|
| 302 |
+
class OnCallSpec : public UntypedOnCallSpecBase {
|
| 303 |
+
public:
|
| 304 |
+
typedef typename Function<F>::ArgumentTuple ArgumentTuple;
|
| 305 |
+
typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
|
| 306 |
+
|
| 307 |
+
// Constructs an OnCallSpec object from the information inside
|
| 308 |
+
// the parenthesis of an ON_CALL() statement.
|
| 309 |
+
OnCallSpec(const char* a_file, int a_line,
|
| 310 |
+
const ArgumentMatcherTuple& matchers)
|
| 311 |
+
: UntypedOnCallSpecBase(a_file, a_line),
|
| 312 |
+
matchers_(matchers),
|
| 313 |
+
// By default, extra_matcher_ should match anything. However,
|
| 314 |
+
// we cannot initialize it with _ as that causes ambiguity between
|
| 315 |
+
// Matcher's copy and move constructor for some argument types.
|
| 316 |
+
extra_matcher_(A<const ArgumentTuple&>()) {}
|
| 317 |
+
|
| 318 |
+
// Implements the .With() clause.
|
| 319 |
+
OnCallSpec& With(const Matcher<const ArgumentTuple&>& m) {
|
| 320 |
+
// Makes sure this is called at most once.
|
| 321 |
+
ExpectSpecProperty(last_clause_ < kWith,
|
| 322 |
+
".With() cannot appear "
|
| 323 |
+
"more than once in an ON_CALL().");
|
| 324 |
+
last_clause_ = kWith;
|
| 325 |
+
|
| 326 |
+
extra_matcher_ = m;
|
| 327 |
+
return *this;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
// Implements the .WillByDefault() clause.
|
| 331 |
+
OnCallSpec& WillByDefault(const Action<F>& action) {
|
| 332 |
+
ExpectSpecProperty(last_clause_ < kWillByDefault,
|
| 333 |
+
".WillByDefault() must appear "
|
| 334 |
+
"exactly once in an ON_CALL().");
|
| 335 |
+
last_clause_ = kWillByDefault;
|
| 336 |
+
|
| 337 |
+
ExpectSpecProperty(!action.IsDoDefault(),
|
| 338 |
+
"DoDefault() cannot be used in ON_CALL().");
|
| 339 |
+
action_ = action;
|
| 340 |
+
return *this;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
// Returns true if and only if the given arguments match the matchers.
|
| 344 |
+
bool Matches(const ArgumentTuple& args) const {
|
| 345 |
+
return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
// Returns the action specified by the user.
|
| 349 |
+
const Action<F>& GetAction() const {
|
| 350 |
+
AssertSpecProperty(last_clause_ == kWillByDefault,
|
| 351 |
+
".WillByDefault() must appear exactly "
|
| 352 |
+
"once in an ON_CALL().");
|
| 353 |
+
return action_;
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
private:
|
| 357 |
+
// The information in statement
|
| 358 |
+
//
|
| 359 |
+
// ON_CALL(mock_object, Method(matchers))
|
| 360 |
+
// .With(multi-argument-matcher)
|
| 361 |
+
// .WillByDefault(action);
|
| 362 |
+
//
|
| 363 |
+
// is recorded in the data members like this:
|
| 364 |
+
//
|
| 365 |
+
// source file that contains the statement => file_
|
| 366 |
+
// line number of the statement => line_
|
| 367 |
+
// matchers => matchers_
|
| 368 |
+
// multi-argument-matcher => extra_matcher_
|
| 369 |
+
// action => action_
|
| 370 |
+
ArgumentMatcherTuple matchers_;
|
| 371 |
+
Matcher<const ArgumentTuple&> extra_matcher_;
|
| 372 |
+
Action<F> action_;
|
| 373 |
+
}; // class OnCallSpec
|
| 374 |
+
|
| 375 |
+
// Possible reactions on uninteresting calls.
|
| 376 |
+
enum CallReaction {
|
| 377 |
+
kAllow,
|
| 378 |
+
kWarn,
|
| 379 |
+
kFail,
|
| 380 |
+
};
|
| 381 |
+
|
| 382 |
+
} // namespace internal
|
| 383 |
+
|
| 384 |
+
// Utilities for manipulating mock objects.
|
| 385 |
+
class GTEST_API_ Mock {
|
| 386 |
+
public:
|
| 387 |
+
// The following public methods can be called concurrently.
|
| 388 |
+
|
| 389 |
+
// Tells Google Mock to ignore mock_obj when checking for leaked
|
| 390 |
+
// mock objects.
|
| 391 |
+
static void AllowLeak(const void* mock_obj)
|
| 392 |
+
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
| 393 |
+
|
| 394 |
+
// Verifies and clears all expectations on the given mock object.
|
| 395 |
+
// If the expectations aren't satisfied, generates one or more
|
| 396 |
+
// Google Test non-fatal failures and returns false.
|
| 397 |
+
static bool VerifyAndClearExpectations(void* mock_obj)
|
| 398 |
+
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
| 399 |
+
|
| 400 |
+
// Verifies all expectations on the given mock object and clears its
|
| 401 |
+
// default actions and expectations. Returns true if and only if the
|
| 402 |
+
// verification was successful.
|
| 403 |
+
static bool VerifyAndClear(void* mock_obj)
|
| 404 |
+
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
| 405 |
+
|
| 406 |
+
// Returns whether the mock was created as a naggy mock (default)
|
| 407 |
+
static bool IsNaggy(void* mock_obj)
|
| 408 |
+
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
| 409 |
+
// Returns whether the mock was created as a nice mock
|
| 410 |
+
static bool IsNice(void* mock_obj)
|
| 411 |
+
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
| 412 |
+
// Returns whether the mock was created as a strict mock
|
| 413 |
+
static bool IsStrict(void* mock_obj)
|
| 414 |
+
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
| 415 |
+
|
| 416 |
+
private:
|
| 417 |
+
friend class internal::UntypedFunctionMockerBase;
|
| 418 |
+
|
| 419 |
+
// Needed for a function mocker to register itself (so that we know
|
| 420 |
+
// how to clear a mock object).
|
| 421 |
+
template <typename F>
|
| 422 |
+
friend class internal::FunctionMocker;
|
| 423 |
+
|
| 424 |
+
template <typename MockClass>
|
| 425 |
+
friend class internal::NiceMockImpl;
|
| 426 |
+
template <typename MockClass>
|
| 427 |
+
friend class internal::NaggyMockImpl;
|
| 428 |
+
template <typename MockClass>
|
| 429 |
+
friend class internal::StrictMockImpl;
|
| 430 |
+
|
| 431 |
+
// Tells Google Mock to allow uninteresting calls on the given mock
|
| 432 |
+
// object.
|
| 433 |
+
static void AllowUninterestingCalls(const void* mock_obj)
|
| 434 |
+
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
| 435 |
+
|
| 436 |
+
// Tells Google Mock to warn the user about uninteresting calls on
|
| 437 |
+
// the given mock object.
|
| 438 |
+
static void WarnUninterestingCalls(const void* mock_obj)
|
| 439 |
+
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
| 440 |
+
|
| 441 |
+
// Tells Google Mock to fail uninteresting calls on the given mock
|
| 442 |
+
// object.
|
| 443 |
+
static void FailUninterestingCalls(const void* mock_obj)
|
| 444 |
+
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
| 445 |
+
|
| 446 |
+
// Tells Google Mock the given mock object is being destroyed and
|
| 447 |
+
// its entry in the call-reaction table should be removed.
|
| 448 |
+
static void UnregisterCallReaction(const void* mock_obj)
|
| 449 |
+
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
| 450 |
+
|
| 451 |
+
// Returns the reaction Google Mock will have on uninteresting calls
|
| 452 |
+
// made on the given mock object.
|
| 453 |
+
static internal::CallReaction GetReactionOnUninterestingCalls(
|
| 454 |
+
const void* mock_obj)
|
| 455 |
+
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
| 456 |
+
|
| 457 |
+
// Verifies that all expectations on the given mock object have been
|
| 458 |
+
// satisfied. Reports one or more Google Test non-fatal failures
|
| 459 |
+
// and returns false if not.
|
| 460 |
+
static bool VerifyAndClearExpectationsLocked(void* mock_obj)
|
| 461 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
|
| 462 |
+
|
| 463 |
+
// Clears all ON_CALL()s set on the given mock object.
|
| 464 |
+
static void ClearDefaultActionsLocked(void* mock_obj)
|
| 465 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
|
| 466 |
+
|
| 467 |
+
// Registers a mock object and a mock method it owns.
|
| 468 |
+
static void Register(
|
| 469 |
+
const void* mock_obj,
|
| 470 |
+
internal::UntypedFunctionMockerBase* mocker)
|
| 471 |
+
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
| 472 |
+
|
| 473 |
+
// Tells Google Mock where in the source code mock_obj is used in an
|
| 474 |
+
// ON_CALL or EXPECT_CALL. In case mock_obj is leaked, this
|
| 475 |
+
// information helps the user identify which object it is.
|
| 476 |
+
static void RegisterUseByOnCallOrExpectCall(
|
| 477 |
+
const void* mock_obj, const char* file, int line)
|
| 478 |
+
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
| 479 |
+
|
| 480 |
+
// Unregisters a mock method; removes the owning mock object from
|
| 481 |
+
// the registry when the last mock method associated with it has
|
| 482 |
+
// been unregistered. This is called only in the destructor of
|
| 483 |
+
// FunctionMocker.
|
| 484 |
+
static void UnregisterLocked(internal::UntypedFunctionMockerBase* mocker)
|
| 485 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
|
| 486 |
+
}; // class Mock
|
| 487 |
+
|
| 488 |
+
// An abstract handle of an expectation. Useful in the .After()
|
| 489 |
+
// clause of EXPECT_CALL() for setting the (partial) order of
|
| 490 |
+
// expectations. The syntax:
|
| 491 |
+
//
|
| 492 |
+
// Expectation e1 = EXPECT_CALL(...)...;
|
| 493 |
+
// EXPECT_CALL(...).After(e1)...;
|
| 494 |
+
//
|
| 495 |
+
// sets two expectations where the latter can only be matched after
|
| 496 |
+
// the former has been satisfied.
|
| 497 |
+
//
|
| 498 |
+
// Notes:
|
| 499 |
+
// - This class is copyable and has value semantics.
|
| 500 |
+
// - Constness is shallow: a const Expectation object itself cannot
|
| 501 |
+
// be modified, but the mutable methods of the ExpectationBase
|
| 502 |
+
// object it references can be called via expectation_base().
|
| 503 |
+
|
| 504 |
+
class GTEST_API_ Expectation {
|
| 505 |
+
public:
|
| 506 |
+
// Constructs a null object that doesn't reference any expectation.
|
| 507 |
+
Expectation();
|
| 508 |
+
Expectation(Expectation&&) = default;
|
| 509 |
+
Expectation(const Expectation&) = default;
|
| 510 |
+
Expectation& operator=(Expectation&&) = default;
|
| 511 |
+
Expectation& operator=(const Expectation&) = default;
|
| 512 |
+
~Expectation();
|
| 513 |
+
|
| 514 |
+
// This single-argument ctor must not be explicit, in order to support the
|
| 515 |
+
// Expectation e = EXPECT_CALL(...);
|
| 516 |
+
// syntax.
|
| 517 |
+
//
|
| 518 |
+
// A TypedExpectation object stores its pre-requisites as
|
| 519 |
+
// Expectation objects, and needs to call the non-const Retire()
|
| 520 |
+
// method on the ExpectationBase objects they reference. Therefore
|
| 521 |
+
// Expectation must receive a *non-const* reference to the
|
| 522 |
+
// ExpectationBase object.
|
| 523 |
+
Expectation(internal::ExpectationBase& exp); // NOLINT
|
| 524 |
+
|
| 525 |
+
// The compiler-generated copy ctor and operator= work exactly as
|
| 526 |
+
// intended, so we don't need to define our own.
|
| 527 |
+
|
| 528 |
+
// Returns true if and only if rhs references the same expectation as this
|
| 529 |
+
// object does.
|
| 530 |
+
bool operator==(const Expectation& rhs) const {
|
| 531 |
+
return expectation_base_ == rhs.expectation_base_;
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
bool operator!=(const Expectation& rhs) const { return !(*this == rhs); }
|
| 535 |
+
|
| 536 |
+
private:
|
| 537 |
+
friend class ExpectationSet;
|
| 538 |
+
friend class Sequence;
|
| 539 |
+
friend class ::testing::internal::ExpectationBase;
|
| 540 |
+
friend class ::testing::internal::UntypedFunctionMockerBase;
|
| 541 |
+
|
| 542 |
+
template <typename F>
|
| 543 |
+
friend class ::testing::internal::FunctionMocker;
|
| 544 |
+
|
| 545 |
+
template <typename F>
|
| 546 |
+
friend class ::testing::internal::TypedExpectation;
|
| 547 |
+
|
| 548 |
+
// This comparator is needed for putting Expectation objects into a set.
|
| 549 |
+
class Less {
|
| 550 |
+
public:
|
| 551 |
+
bool operator()(const Expectation& lhs, const Expectation& rhs) const {
|
| 552 |
+
return lhs.expectation_base_.get() < rhs.expectation_base_.get();
|
| 553 |
+
}
|
| 554 |
+
};
|
| 555 |
+
|
| 556 |
+
typedef ::std::set<Expectation, Less> Set;
|
| 557 |
+
|
| 558 |
+
Expectation(
|
| 559 |
+
const std::shared_ptr<internal::ExpectationBase>& expectation_base);
|
| 560 |
+
|
| 561 |
+
// Returns the expectation this object references.
|
| 562 |
+
const std::shared_ptr<internal::ExpectationBase>& expectation_base() const {
|
| 563 |
+
return expectation_base_;
|
| 564 |
+
}
|
| 565 |
+
|
| 566 |
+
// A shared_ptr that co-owns the expectation this handle references.
|
| 567 |
+
std::shared_ptr<internal::ExpectationBase> expectation_base_;
|
| 568 |
+
};
|
| 569 |
+
|
| 570 |
+
// A set of expectation handles. Useful in the .After() clause of
|
| 571 |
+
// EXPECT_CALL() for setting the (partial) order of expectations. The
|
| 572 |
+
// syntax:
|
| 573 |
+
//
|
| 574 |
+
// ExpectationSet es;
|
| 575 |
+
// es += EXPECT_CALL(...)...;
|
| 576 |
+
// es += EXPECT_CALL(...)...;
|
| 577 |
+
// EXPECT_CALL(...).After(es)...;
|
| 578 |
+
//
|
| 579 |
+
// sets three expectations where the last one can only be matched
|
| 580 |
+
// after the first two have both been satisfied.
|
| 581 |
+
//
|
| 582 |
+
// This class is copyable and has value semantics.
|
| 583 |
+
class ExpectationSet {
|
| 584 |
+
public:
|
| 585 |
+
// A bidirectional iterator that can read a const element in the set.
|
| 586 |
+
typedef Expectation::Set::const_iterator const_iterator;
|
| 587 |
+
|
| 588 |
+
// An object stored in the set. This is an alias of Expectation.
|
| 589 |
+
typedef Expectation::Set::value_type value_type;
|
| 590 |
+
|
| 591 |
+
// Constructs an empty set.
|
| 592 |
+
ExpectationSet() {}
|
| 593 |
+
|
| 594 |
+
// This single-argument ctor must not be explicit, in order to support the
|
| 595 |
+
// ExpectationSet es = EXPECT_CALL(...);
|
| 596 |
+
// syntax.
|
| 597 |
+
ExpectationSet(internal::ExpectationBase& exp) { // NOLINT
|
| 598 |
+
*this += Expectation(exp);
|
| 599 |
+
}
|
| 600 |
+
|
| 601 |
+
// This single-argument ctor implements implicit conversion from
|
| 602 |
+
// Expectation and thus must not be explicit. This allows either an
|
| 603 |
+
// Expectation or an ExpectationSet to be used in .After().
|
| 604 |
+
ExpectationSet(const Expectation& e) { // NOLINT
|
| 605 |
+
*this += e;
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
// The compiler-generator ctor and operator= works exactly as
|
| 609 |
+
// intended, so we don't need to define our own.
|
| 610 |
+
|
| 611 |
+
// Returns true if and only if rhs contains the same set of Expectation
|
| 612 |
+
// objects as this does.
|
| 613 |
+
bool operator==(const ExpectationSet& rhs) const {
|
| 614 |
+
return expectations_ == rhs.expectations_;
|
| 615 |
+
}
|
| 616 |
+
|
| 617 |
+
bool operator!=(const ExpectationSet& rhs) const { return !(*this == rhs); }
|
| 618 |
+
|
| 619 |
+
// Implements the syntax
|
| 620 |
+
// expectation_set += EXPECT_CALL(...);
|
| 621 |
+
ExpectationSet& operator+=(const Expectation& e) {
|
| 622 |
+
expectations_.insert(e);
|
| 623 |
+
return *this;
|
| 624 |
+
}
|
| 625 |
+
|
| 626 |
+
int size() const { return static_cast<int>(expectations_.size()); }
|
| 627 |
+
|
| 628 |
+
const_iterator begin() const { return expectations_.begin(); }
|
| 629 |
+
const_iterator end() const { return expectations_.end(); }
|
| 630 |
+
|
| 631 |
+
private:
|
| 632 |
+
Expectation::Set expectations_;
|
| 633 |
+
};
|
| 634 |
+
|
| 635 |
+
|
| 636 |
+
// Sequence objects are used by a user to specify the relative order
|
| 637 |
+
// in which the expectations should match. They are copyable (we rely
|
| 638 |
+
// on the compiler-defined copy constructor and assignment operator).
|
| 639 |
+
class GTEST_API_ Sequence {
|
| 640 |
+
public:
|
| 641 |
+
// Constructs an empty sequence.
|
| 642 |
+
Sequence() : last_expectation_(new Expectation) {}
|
| 643 |
+
|
| 644 |
+
// Adds an expectation to this sequence. The caller must ensure
|
| 645 |
+
// that no other thread is accessing this Sequence object.
|
| 646 |
+
void AddExpectation(const Expectation& expectation) const;
|
| 647 |
+
|
| 648 |
+
private:
|
| 649 |
+
// The last expectation in this sequence.
|
| 650 |
+
std::shared_ptr<Expectation> last_expectation_;
|
| 651 |
+
}; // class Sequence
|
| 652 |
+
|
| 653 |
+
// An object of this type causes all EXPECT_CALL() statements
|
| 654 |
+
// encountered in its scope to be put in an anonymous sequence. The
|
| 655 |
+
// work is done in the constructor and destructor. You should only
|
| 656 |
+
// create an InSequence object on the stack.
|
| 657 |
+
//
|
| 658 |
+
// The sole purpose for this class is to support easy definition of
|
| 659 |
+
// sequential expectations, e.g.
|
| 660 |
+
//
|
| 661 |
+
// {
|
| 662 |
+
// InSequence dummy; // The name of the object doesn't matter.
|
| 663 |
+
//
|
| 664 |
+
// // The following expectations must match in the order they appear.
|
| 665 |
+
// EXPECT_CALL(a, Bar())...;
|
| 666 |
+
// EXPECT_CALL(a, Baz())...;
|
| 667 |
+
// ...
|
| 668 |
+
// EXPECT_CALL(b, Xyz())...;
|
| 669 |
+
// }
|
| 670 |
+
//
|
| 671 |
+
// You can create InSequence objects in multiple threads, as long as
|
| 672 |
+
// they are used to affect different mock objects. The idea is that
|
| 673 |
+
// each thread can create and set up its own mocks as if it's the only
|
| 674 |
+
// thread. However, for clarity of your tests we recommend you to set
|
| 675 |
+
// up mocks in the main thread unless you have a good reason not to do
|
| 676 |
+
// so.
|
| 677 |
+
class GTEST_API_ InSequence {
|
| 678 |
+
public:
|
| 679 |
+
InSequence();
|
| 680 |
+
~InSequence();
|
| 681 |
+
private:
|
| 682 |
+
bool sequence_created_;
|
| 683 |
+
|
| 684 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(InSequence); // NOLINT
|
| 685 |
+
} GTEST_ATTRIBUTE_UNUSED_;
|
| 686 |
+
|
| 687 |
+
namespace internal {
|
| 688 |
+
|
| 689 |
+
// Points to the implicit sequence introduced by a living InSequence
|
| 690 |
+
// object (if any) in the current thread or NULL.
|
| 691 |
+
GTEST_API_ extern ThreadLocal<Sequence*> g_gmock_implicit_sequence;
|
| 692 |
+
|
| 693 |
+
// Base class for implementing expectations.
|
| 694 |
+
//
|
| 695 |
+
// There are two reasons for having a type-agnostic base class for
|
| 696 |
+
// Expectation:
|
| 697 |
+
//
|
| 698 |
+
// 1. We need to store collections of expectations of different
|
| 699 |
+
// types (e.g. all pre-requisites of a particular expectation, all
|
| 700 |
+
// expectations in a sequence). Therefore these expectation objects
|
| 701 |
+
// must share a common base class.
|
| 702 |
+
//
|
| 703 |
+
// 2. We can avoid binary code bloat by moving methods not depending
|
| 704 |
+
// on the template argument of Expectation to the base class.
|
| 705 |
+
//
|
| 706 |
+
// This class is internal and mustn't be used by user code directly.
|
| 707 |
+
class GTEST_API_ ExpectationBase {
|
| 708 |
+
public:
|
| 709 |
+
// source_text is the EXPECT_CALL(...) source that created this Expectation.
|
| 710 |
+
ExpectationBase(const char* file, int line, const std::string& source_text);
|
| 711 |
+
|
| 712 |
+
virtual ~ExpectationBase();
|
| 713 |
+
|
| 714 |
+
// Where in the source file was the expectation spec defined?
|
| 715 |
+
const char* file() const { return file_; }
|
| 716 |
+
int line() const { return line_; }
|
| 717 |
+
const char* source_text() const { return source_text_.c_str(); }
|
| 718 |
+
// Returns the cardinality specified in the expectation spec.
|
| 719 |
+
const Cardinality& cardinality() const { return cardinality_; }
|
| 720 |
+
|
| 721 |
+
// Describes the source file location of this expectation.
|
| 722 |
+
void DescribeLocationTo(::std::ostream* os) const {
|
| 723 |
+
*os << FormatFileLocation(file(), line()) << " ";
|
| 724 |
+
}
|
| 725 |
+
|
| 726 |
+
// Describes how many times a function call matching this
|
| 727 |
+
// expectation has occurred.
|
| 728 |
+
void DescribeCallCountTo(::std::ostream* os) const
|
| 729 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
|
| 730 |
+
|
| 731 |
+
// If this mock method has an extra matcher (i.e. .With(matcher)),
|
| 732 |
+
// describes it to the ostream.
|
| 733 |
+
virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) = 0;
|
| 734 |
+
|
| 735 |
+
protected:
|
| 736 |
+
friend class ::testing::Expectation;
|
| 737 |
+
friend class UntypedFunctionMockerBase;
|
| 738 |
+
|
| 739 |
+
enum Clause {
|
| 740 |
+
// Don't change the order of the enum members!
|
| 741 |
+
kNone,
|
| 742 |
+
kWith,
|
| 743 |
+
kTimes,
|
| 744 |
+
kInSequence,
|
| 745 |
+
kAfter,
|
| 746 |
+
kWillOnce,
|
| 747 |
+
kWillRepeatedly,
|
| 748 |
+
kRetiresOnSaturation
|
| 749 |
+
};
|
| 750 |
+
|
| 751 |
+
typedef std::vector<const void*> UntypedActions;
|
| 752 |
+
|
| 753 |
+
// Returns an Expectation object that references and co-owns this
|
| 754 |
+
// expectation.
|
| 755 |
+
virtual Expectation GetHandle() = 0;
|
| 756 |
+
|
| 757 |
+
// Asserts that the EXPECT_CALL() statement has the given property.
|
| 758 |
+
void AssertSpecProperty(bool property,
|
| 759 |
+
const std::string& failure_message) const {
|
| 760 |
+
Assert(property, file_, line_, failure_message);
|
| 761 |
+
}
|
| 762 |
+
|
| 763 |
+
// Expects that the EXPECT_CALL() statement has the given property.
|
| 764 |
+
void ExpectSpecProperty(bool property,
|
| 765 |
+
const std::string& failure_message) const {
|
| 766 |
+
Expect(property, file_, line_, failure_message);
|
| 767 |
+
}
|
| 768 |
+
|
| 769 |
+
// Explicitly specifies the cardinality of this expectation. Used
|
| 770 |
+
// by the subclasses to implement the .Times() clause.
|
| 771 |
+
void SpecifyCardinality(const Cardinality& cardinality);
|
| 772 |
+
|
| 773 |
+
// Returns true if and only if the user specified the cardinality
|
| 774 |
+
// explicitly using a .Times().
|
| 775 |
+
bool cardinality_specified() const { return cardinality_specified_; }
|
| 776 |
+
|
| 777 |
+
// Sets the cardinality of this expectation spec.
|
| 778 |
+
void set_cardinality(const Cardinality& a_cardinality) {
|
| 779 |
+
cardinality_ = a_cardinality;
|
| 780 |
+
}
|
| 781 |
+
|
| 782 |
+
// The following group of methods should only be called after the
|
| 783 |
+
// EXPECT_CALL() statement, and only when g_gmock_mutex is held by
|
| 784 |
+
// the current thread.
|
| 785 |
+
|
| 786 |
+
// Retires all pre-requisites of this expectation.
|
| 787 |
+
void RetireAllPreRequisites()
|
| 788 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
|
| 789 |
+
|
| 790 |
+
// Returns true if and only if this expectation is retired.
|
| 791 |
+
bool is_retired() const
|
| 792 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 793 |
+
g_gmock_mutex.AssertHeld();
|
| 794 |
+
return retired_;
|
| 795 |
+
}
|
| 796 |
+
|
| 797 |
+
// Retires this expectation.
|
| 798 |
+
void Retire()
|
| 799 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 800 |
+
g_gmock_mutex.AssertHeld();
|
| 801 |
+
retired_ = true;
|
| 802 |
+
}
|
| 803 |
+
|
| 804 |
+
// Returns true if and only if this expectation is satisfied.
|
| 805 |
+
bool IsSatisfied() const
|
| 806 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 807 |
+
g_gmock_mutex.AssertHeld();
|
| 808 |
+
return cardinality().IsSatisfiedByCallCount(call_count_);
|
| 809 |
+
}
|
| 810 |
+
|
| 811 |
+
// Returns true if and only if this expectation is saturated.
|
| 812 |
+
bool IsSaturated() const
|
| 813 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 814 |
+
g_gmock_mutex.AssertHeld();
|
| 815 |
+
return cardinality().IsSaturatedByCallCount(call_count_);
|
| 816 |
+
}
|
| 817 |
+
|
| 818 |
+
// Returns true if and only if this expectation is over-saturated.
|
| 819 |
+
bool IsOverSaturated() const
|
| 820 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 821 |
+
g_gmock_mutex.AssertHeld();
|
| 822 |
+
return cardinality().IsOverSaturatedByCallCount(call_count_);
|
| 823 |
+
}
|
| 824 |
+
|
| 825 |
+
// Returns true if and only if all pre-requisites of this expectation are
|
| 826 |
+
// satisfied.
|
| 827 |
+
bool AllPrerequisitesAreSatisfied() const
|
| 828 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
|
| 829 |
+
|
| 830 |
+
// Adds unsatisfied pre-requisites of this expectation to 'result'.
|
| 831 |
+
void FindUnsatisfiedPrerequisites(ExpectationSet* result) const
|
| 832 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
|
| 833 |
+
|
| 834 |
+
// Returns the number this expectation has been invoked.
|
| 835 |
+
int call_count() const
|
| 836 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 837 |
+
g_gmock_mutex.AssertHeld();
|
| 838 |
+
return call_count_;
|
| 839 |
+
}
|
| 840 |
+
|
| 841 |
+
// Increments the number this expectation has been invoked.
|
| 842 |
+
void IncrementCallCount()
|
| 843 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 844 |
+
g_gmock_mutex.AssertHeld();
|
| 845 |
+
call_count_++;
|
| 846 |
+
}
|
| 847 |
+
|
| 848 |
+
// Checks the action count (i.e. the number of WillOnce() and
|
| 849 |
+
// WillRepeatedly() clauses) against the cardinality if this hasn't
|
| 850 |
+
// been done before. Prints a warning if there are too many or too
|
| 851 |
+
// few actions.
|
| 852 |
+
void CheckActionCountIfNotDone() const
|
| 853 |
+
GTEST_LOCK_EXCLUDED_(mutex_);
|
| 854 |
+
|
| 855 |
+
friend class ::testing::Sequence;
|
| 856 |
+
friend class ::testing::internal::ExpectationTester;
|
| 857 |
+
|
| 858 |
+
template <typename Function>
|
| 859 |
+
friend class TypedExpectation;
|
| 860 |
+
|
| 861 |
+
// Implements the .Times() clause.
|
| 862 |
+
void UntypedTimes(const Cardinality& a_cardinality);
|
| 863 |
+
|
| 864 |
+
// This group of fields are part of the spec and won't change after
|
| 865 |
+
// an EXPECT_CALL() statement finishes.
|
| 866 |
+
const char* file_; // The file that contains the expectation.
|
| 867 |
+
int line_; // The line number of the expectation.
|
| 868 |
+
const std::string source_text_; // The EXPECT_CALL(...) source text.
|
| 869 |
+
// True if and only if the cardinality is specified explicitly.
|
| 870 |
+
bool cardinality_specified_;
|
| 871 |
+
Cardinality cardinality_; // The cardinality of the expectation.
|
| 872 |
+
// The immediate pre-requisites (i.e. expectations that must be
|
| 873 |
+
// satisfied before this expectation can be matched) of this
|
| 874 |
+
// expectation. We use std::shared_ptr in the set because we want an
|
| 875 |
+
// Expectation object to be co-owned by its FunctionMocker and its
|
| 876 |
+
// successors. This allows multiple mock objects to be deleted at
|
| 877 |
+
// different times.
|
| 878 |
+
ExpectationSet immediate_prerequisites_;
|
| 879 |
+
|
| 880 |
+
// This group of fields are the current state of the expectation,
|
| 881 |
+
// and can change as the mock function is called.
|
| 882 |
+
int call_count_; // How many times this expectation has been invoked.
|
| 883 |
+
bool retired_; // True if and only if this expectation has retired.
|
| 884 |
+
UntypedActions untyped_actions_;
|
| 885 |
+
bool extra_matcher_specified_;
|
| 886 |
+
bool repeated_action_specified_; // True if a WillRepeatedly() was specified.
|
| 887 |
+
bool retires_on_saturation_;
|
| 888 |
+
Clause last_clause_;
|
| 889 |
+
mutable bool action_count_checked_; // Under mutex_.
|
| 890 |
+
mutable Mutex mutex_; // Protects action_count_checked_.
|
| 891 |
+
}; // class ExpectationBase
|
| 892 |
+
|
| 893 |
+
// Impements an expectation for the given function type.
|
| 894 |
+
template <typename F>
|
| 895 |
+
class TypedExpectation : public ExpectationBase {
|
| 896 |
+
public:
|
| 897 |
+
typedef typename Function<F>::ArgumentTuple ArgumentTuple;
|
| 898 |
+
typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
|
| 899 |
+
typedef typename Function<F>::Result Result;
|
| 900 |
+
|
| 901 |
+
TypedExpectation(FunctionMocker<F>* owner, const char* a_file, int a_line,
|
| 902 |
+
const std::string& a_source_text,
|
| 903 |
+
const ArgumentMatcherTuple& m)
|
| 904 |
+
: ExpectationBase(a_file, a_line, a_source_text),
|
| 905 |
+
owner_(owner),
|
| 906 |
+
matchers_(m),
|
| 907 |
+
// By default, extra_matcher_ should match anything. However,
|
| 908 |
+
// we cannot initialize it with _ as that causes ambiguity between
|
| 909 |
+
// Matcher's copy and move constructor for some argument types.
|
| 910 |
+
extra_matcher_(A<const ArgumentTuple&>()),
|
| 911 |
+
repeated_action_(DoDefault()) {}
|
| 912 |
+
|
| 913 |
+
~TypedExpectation() override {
|
| 914 |
+
// Check the validity of the action count if it hasn't been done
|
| 915 |
+
// yet (for example, if the expectation was never used).
|
| 916 |
+
CheckActionCountIfNotDone();
|
| 917 |
+
for (UntypedActions::const_iterator it = untyped_actions_.begin();
|
| 918 |
+
it != untyped_actions_.end(); ++it) {
|
| 919 |
+
delete static_cast<const Action<F>*>(*it);
|
| 920 |
+
}
|
| 921 |
+
}
|
| 922 |
+
|
| 923 |
+
// Implements the .With() clause.
|
| 924 |
+
TypedExpectation& With(const Matcher<const ArgumentTuple&>& m) {
|
| 925 |
+
if (last_clause_ == kWith) {
|
| 926 |
+
ExpectSpecProperty(false,
|
| 927 |
+
".With() cannot appear "
|
| 928 |
+
"more than once in an EXPECT_CALL().");
|
| 929 |
+
} else {
|
| 930 |
+
ExpectSpecProperty(last_clause_ < kWith,
|
| 931 |
+
".With() must be the first "
|
| 932 |
+
"clause in an EXPECT_CALL().");
|
| 933 |
+
}
|
| 934 |
+
last_clause_ = kWith;
|
| 935 |
+
|
| 936 |
+
extra_matcher_ = m;
|
| 937 |
+
extra_matcher_specified_ = true;
|
| 938 |
+
return *this;
|
| 939 |
+
}
|
| 940 |
+
|
| 941 |
+
// Implements the .Times() clause.
|
| 942 |
+
TypedExpectation& Times(const Cardinality& a_cardinality) {
|
| 943 |
+
ExpectationBase::UntypedTimes(a_cardinality);
|
| 944 |
+
return *this;
|
| 945 |
+
}
|
| 946 |
+
|
| 947 |
+
// Implements the .Times() clause.
|
| 948 |
+
TypedExpectation& Times(int n) {
|
| 949 |
+
return Times(Exactly(n));
|
| 950 |
+
}
|
| 951 |
+
|
| 952 |
+
// Implements the .InSequence() clause.
|
| 953 |
+
TypedExpectation& InSequence(const Sequence& s) {
|
| 954 |
+
ExpectSpecProperty(last_clause_ <= kInSequence,
|
| 955 |
+
".InSequence() cannot appear after .After(),"
|
| 956 |
+
" .WillOnce(), .WillRepeatedly(), or "
|
| 957 |
+
".RetiresOnSaturation().");
|
| 958 |
+
last_clause_ = kInSequence;
|
| 959 |
+
|
| 960 |
+
s.AddExpectation(GetHandle());
|
| 961 |
+
return *this;
|
| 962 |
+
}
|
| 963 |
+
TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2) {
|
| 964 |
+
return InSequence(s1).InSequence(s2);
|
| 965 |
+
}
|
| 966 |
+
TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
|
| 967 |
+
const Sequence& s3) {
|
| 968 |
+
return InSequence(s1, s2).InSequence(s3);
|
| 969 |
+
}
|
| 970 |
+
TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
|
| 971 |
+
const Sequence& s3, const Sequence& s4) {
|
| 972 |
+
return InSequence(s1, s2, s3).InSequence(s4);
|
| 973 |
+
}
|
| 974 |
+
TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
|
| 975 |
+
const Sequence& s3, const Sequence& s4,
|
| 976 |
+
const Sequence& s5) {
|
| 977 |
+
return InSequence(s1, s2, s3, s4).InSequence(s5);
|
| 978 |
+
}
|
| 979 |
+
|
| 980 |
+
// Implements that .After() clause.
|
| 981 |
+
TypedExpectation& After(const ExpectationSet& s) {
|
| 982 |
+
ExpectSpecProperty(last_clause_ <= kAfter,
|
| 983 |
+
".After() cannot appear after .WillOnce(),"
|
| 984 |
+
" .WillRepeatedly(), or "
|
| 985 |
+
".RetiresOnSaturation().");
|
| 986 |
+
last_clause_ = kAfter;
|
| 987 |
+
|
| 988 |
+
for (ExpectationSet::const_iterator it = s.begin(); it != s.end(); ++it) {
|
| 989 |
+
immediate_prerequisites_ += *it;
|
| 990 |
+
}
|
| 991 |
+
return *this;
|
| 992 |
+
}
|
| 993 |
+
TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2) {
|
| 994 |
+
return After(s1).After(s2);
|
| 995 |
+
}
|
| 996 |
+
TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
|
| 997 |
+
const ExpectationSet& s3) {
|
| 998 |
+
return After(s1, s2).After(s3);
|
| 999 |
+
}
|
| 1000 |
+
TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
|
| 1001 |
+
const ExpectationSet& s3, const ExpectationSet& s4) {
|
| 1002 |
+
return After(s1, s2, s3).After(s4);
|
| 1003 |
+
}
|
| 1004 |
+
TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
|
| 1005 |
+
const ExpectationSet& s3, const ExpectationSet& s4,
|
| 1006 |
+
const ExpectationSet& s5) {
|
| 1007 |
+
return After(s1, s2, s3, s4).After(s5);
|
| 1008 |
+
}
|
| 1009 |
+
|
| 1010 |
+
// Implements the .WillOnce() clause.
|
| 1011 |
+
TypedExpectation& WillOnce(const Action<F>& action) {
|
| 1012 |
+
ExpectSpecProperty(last_clause_ <= kWillOnce,
|
| 1013 |
+
".WillOnce() cannot appear after "
|
| 1014 |
+
".WillRepeatedly() or .RetiresOnSaturation().");
|
| 1015 |
+
last_clause_ = kWillOnce;
|
| 1016 |
+
|
| 1017 |
+
untyped_actions_.push_back(new Action<F>(action));
|
| 1018 |
+
if (!cardinality_specified()) {
|
| 1019 |
+
set_cardinality(Exactly(static_cast<int>(untyped_actions_.size())));
|
| 1020 |
+
}
|
| 1021 |
+
return *this;
|
| 1022 |
+
}
|
| 1023 |
+
|
| 1024 |
+
// Implements the .WillRepeatedly() clause.
|
| 1025 |
+
TypedExpectation& WillRepeatedly(const Action<F>& action) {
|
| 1026 |
+
if (last_clause_ == kWillRepeatedly) {
|
| 1027 |
+
ExpectSpecProperty(false,
|
| 1028 |
+
".WillRepeatedly() cannot appear "
|
| 1029 |
+
"more than once in an EXPECT_CALL().");
|
| 1030 |
+
} else {
|
| 1031 |
+
ExpectSpecProperty(last_clause_ < kWillRepeatedly,
|
| 1032 |
+
".WillRepeatedly() cannot appear "
|
| 1033 |
+
"after .RetiresOnSaturation().");
|
| 1034 |
+
}
|
| 1035 |
+
last_clause_ = kWillRepeatedly;
|
| 1036 |
+
repeated_action_specified_ = true;
|
| 1037 |
+
|
| 1038 |
+
repeated_action_ = action;
|
| 1039 |
+
if (!cardinality_specified()) {
|
| 1040 |
+
set_cardinality(AtLeast(static_cast<int>(untyped_actions_.size())));
|
| 1041 |
+
}
|
| 1042 |
+
|
| 1043 |
+
// Now that no more action clauses can be specified, we check
|
| 1044 |
+
// whether their count makes sense.
|
| 1045 |
+
CheckActionCountIfNotDone();
|
| 1046 |
+
return *this;
|
| 1047 |
+
}
|
| 1048 |
+
|
| 1049 |
+
// Implements the .RetiresOnSaturation() clause.
|
| 1050 |
+
TypedExpectation& RetiresOnSaturation() {
|
| 1051 |
+
ExpectSpecProperty(last_clause_ < kRetiresOnSaturation,
|
| 1052 |
+
".RetiresOnSaturation() cannot appear "
|
| 1053 |
+
"more than once.");
|
| 1054 |
+
last_clause_ = kRetiresOnSaturation;
|
| 1055 |
+
retires_on_saturation_ = true;
|
| 1056 |
+
|
| 1057 |
+
// Now that no more action clauses can be specified, we check
|
| 1058 |
+
// whether their count makes sense.
|
| 1059 |
+
CheckActionCountIfNotDone();
|
| 1060 |
+
return *this;
|
| 1061 |
+
}
|
| 1062 |
+
|
| 1063 |
+
// Returns the matchers for the arguments as specified inside the
|
| 1064 |
+
// EXPECT_CALL() macro.
|
| 1065 |
+
const ArgumentMatcherTuple& matchers() const {
|
| 1066 |
+
return matchers_;
|
| 1067 |
+
}
|
| 1068 |
+
|
| 1069 |
+
// Returns the matcher specified by the .With() clause.
|
| 1070 |
+
const Matcher<const ArgumentTuple&>& extra_matcher() const {
|
| 1071 |
+
return extra_matcher_;
|
| 1072 |
+
}
|
| 1073 |
+
|
| 1074 |
+
// Returns the action specified by the .WillRepeatedly() clause.
|
| 1075 |
+
const Action<F>& repeated_action() const { return repeated_action_; }
|
| 1076 |
+
|
| 1077 |
+
// If this mock method has an extra matcher (i.e. .With(matcher)),
|
| 1078 |
+
// describes it to the ostream.
|
| 1079 |
+
void MaybeDescribeExtraMatcherTo(::std::ostream* os) override {
|
| 1080 |
+
if (extra_matcher_specified_) {
|
| 1081 |
+
*os << " Expected args: ";
|
| 1082 |
+
extra_matcher_.DescribeTo(os);
|
| 1083 |
+
*os << "\n";
|
| 1084 |
+
}
|
| 1085 |
+
}
|
| 1086 |
+
|
| 1087 |
+
private:
|
| 1088 |
+
template <typename Function>
|
| 1089 |
+
friend class FunctionMocker;
|
| 1090 |
+
|
| 1091 |
+
// Returns an Expectation object that references and co-owns this
|
| 1092 |
+
// expectation.
|
| 1093 |
+
Expectation GetHandle() override { return owner_->GetHandleOf(this); }
|
| 1094 |
+
|
| 1095 |
+
// The following methods will be called only after the EXPECT_CALL()
|
| 1096 |
+
// statement finishes and when the current thread holds
|
| 1097 |
+
// g_gmock_mutex.
|
| 1098 |
+
|
| 1099 |
+
// Returns true if and only if this expectation matches the given arguments.
|
| 1100 |
+
bool Matches(const ArgumentTuple& args) const
|
| 1101 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 1102 |
+
g_gmock_mutex.AssertHeld();
|
| 1103 |
+
return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
|
| 1104 |
+
}
|
| 1105 |
+
|
| 1106 |
+
// Returns true if and only if this expectation should handle the given
|
| 1107 |
+
// arguments.
|
| 1108 |
+
bool ShouldHandleArguments(const ArgumentTuple& args) const
|
| 1109 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 1110 |
+
g_gmock_mutex.AssertHeld();
|
| 1111 |
+
|
| 1112 |
+
// In case the action count wasn't checked when the expectation
|
| 1113 |
+
// was defined (e.g. if this expectation has no WillRepeatedly()
|
| 1114 |
+
// or RetiresOnSaturation() clause), we check it when the
|
| 1115 |
+
// expectation is used for the first time.
|
| 1116 |
+
CheckActionCountIfNotDone();
|
| 1117 |
+
return !is_retired() && AllPrerequisitesAreSatisfied() && Matches(args);
|
| 1118 |
+
}
|
| 1119 |
+
|
| 1120 |
+
// Describes the result of matching the arguments against this
|
| 1121 |
+
// expectation to the given ostream.
|
| 1122 |
+
void ExplainMatchResultTo(
|
| 1123 |
+
const ArgumentTuple& args,
|
| 1124 |
+
::std::ostream* os) const
|
| 1125 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 1126 |
+
g_gmock_mutex.AssertHeld();
|
| 1127 |
+
|
| 1128 |
+
if (is_retired()) {
|
| 1129 |
+
*os << " Expected: the expectation is active\n"
|
| 1130 |
+
<< " Actual: it is retired\n";
|
| 1131 |
+
} else if (!Matches(args)) {
|
| 1132 |
+
if (!TupleMatches(matchers_, args)) {
|
| 1133 |
+
ExplainMatchFailureTupleTo(matchers_, args, os);
|
| 1134 |
+
}
|
| 1135 |
+
StringMatchResultListener listener;
|
| 1136 |
+
if (!extra_matcher_.MatchAndExplain(args, &listener)) {
|
| 1137 |
+
*os << " Expected args: ";
|
| 1138 |
+
extra_matcher_.DescribeTo(os);
|
| 1139 |
+
*os << "\n Actual: don't match";
|
| 1140 |
+
|
| 1141 |
+
internal::PrintIfNotEmpty(listener.str(), os);
|
| 1142 |
+
*os << "\n";
|
| 1143 |
+
}
|
| 1144 |
+
} else if (!AllPrerequisitesAreSatisfied()) {
|
| 1145 |
+
*os << " Expected: all pre-requisites are satisfied\n"
|
| 1146 |
+
<< " Actual: the following immediate pre-requisites "
|
| 1147 |
+
<< "are not satisfied:\n";
|
| 1148 |
+
ExpectationSet unsatisfied_prereqs;
|
| 1149 |
+
FindUnsatisfiedPrerequisites(&unsatisfied_prereqs);
|
| 1150 |
+
int i = 0;
|
| 1151 |
+
for (ExpectationSet::const_iterator it = unsatisfied_prereqs.begin();
|
| 1152 |
+
it != unsatisfied_prereqs.end(); ++it) {
|
| 1153 |
+
it->expectation_base()->DescribeLocationTo(os);
|
| 1154 |
+
*os << "pre-requisite #" << i++ << "\n";
|
| 1155 |
+
}
|
| 1156 |
+
*os << " (end of pre-requisites)\n";
|
| 1157 |
+
} else {
|
| 1158 |
+
// This line is here just for completeness' sake. It will never
|
| 1159 |
+
// be executed as currently the ExplainMatchResultTo() function
|
| 1160 |
+
// is called only when the mock function call does NOT match the
|
| 1161 |
+
// expectation.
|
| 1162 |
+
*os << "The call matches the expectation.\n";
|
| 1163 |
+
}
|
| 1164 |
+
}
|
| 1165 |
+
|
| 1166 |
+
// Returns the action that should be taken for the current invocation.
|
| 1167 |
+
const Action<F>& GetCurrentAction(const FunctionMocker<F>* mocker,
|
| 1168 |
+
const ArgumentTuple& args) const
|
| 1169 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 1170 |
+
g_gmock_mutex.AssertHeld();
|
| 1171 |
+
const int count = call_count();
|
| 1172 |
+
Assert(count >= 1, __FILE__, __LINE__,
|
| 1173 |
+
"call_count() is <= 0 when GetCurrentAction() is "
|
| 1174 |
+
"called - this should never happen.");
|
| 1175 |
+
|
| 1176 |
+
const int action_count = static_cast<int>(untyped_actions_.size());
|
| 1177 |
+
if (action_count > 0 && !repeated_action_specified_ &&
|
| 1178 |
+
count > action_count) {
|
| 1179 |
+
// If there is at least one WillOnce() and no WillRepeatedly(),
|
| 1180 |
+
// we warn the user when the WillOnce() clauses ran out.
|
| 1181 |
+
::std::stringstream ss;
|
| 1182 |
+
DescribeLocationTo(&ss);
|
| 1183 |
+
ss << "Actions ran out in " << source_text() << "...\n"
|
| 1184 |
+
<< "Called " << count << " times, but only "
|
| 1185 |
+
<< action_count << " WillOnce()"
|
| 1186 |
+
<< (action_count == 1 ? " is" : "s are") << " specified - ";
|
| 1187 |
+
mocker->DescribeDefaultActionTo(args, &ss);
|
| 1188 |
+
Log(kWarning, ss.str(), 1);
|
| 1189 |
+
}
|
| 1190 |
+
|
| 1191 |
+
return count <= action_count
|
| 1192 |
+
? *static_cast<const Action<F>*>(
|
| 1193 |
+
untyped_actions_[static_cast<size_t>(count - 1)])
|
| 1194 |
+
: repeated_action();
|
| 1195 |
+
}
|
| 1196 |
+
|
| 1197 |
+
// Given the arguments of a mock function call, if the call will
|
| 1198 |
+
// over-saturate this expectation, returns the default action;
|
| 1199 |
+
// otherwise, returns the next action in this expectation. Also
|
| 1200 |
+
// describes *what* happened to 'what', and explains *why* Google
|
| 1201 |
+
// Mock does it to 'why'. This method is not const as it calls
|
| 1202 |
+
// IncrementCallCount(). A return value of NULL means the default
|
| 1203 |
+
// action.
|
| 1204 |
+
const Action<F>* GetActionForArguments(const FunctionMocker<F>* mocker,
|
| 1205 |
+
const ArgumentTuple& args,
|
| 1206 |
+
::std::ostream* what,
|
| 1207 |
+
::std::ostream* why)
|
| 1208 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 1209 |
+
g_gmock_mutex.AssertHeld();
|
| 1210 |
+
if (IsSaturated()) {
|
| 1211 |
+
// We have an excessive call.
|
| 1212 |
+
IncrementCallCount();
|
| 1213 |
+
*what << "Mock function called more times than expected - ";
|
| 1214 |
+
mocker->DescribeDefaultActionTo(args, what);
|
| 1215 |
+
DescribeCallCountTo(why);
|
| 1216 |
+
|
| 1217 |
+
return nullptr;
|
| 1218 |
+
}
|
| 1219 |
+
|
| 1220 |
+
IncrementCallCount();
|
| 1221 |
+
RetireAllPreRequisites();
|
| 1222 |
+
|
| 1223 |
+
if (retires_on_saturation_ && IsSaturated()) {
|
| 1224 |
+
Retire();
|
| 1225 |
+
}
|
| 1226 |
+
|
| 1227 |
+
// Must be done after IncrementCount()!
|
| 1228 |
+
*what << "Mock function call matches " << source_text() <<"...\n";
|
| 1229 |
+
return &(GetCurrentAction(mocker, args));
|
| 1230 |
+
}
|
| 1231 |
+
|
| 1232 |
+
// All the fields below won't change once the EXPECT_CALL()
|
| 1233 |
+
// statement finishes.
|
| 1234 |
+
FunctionMocker<F>* const owner_;
|
| 1235 |
+
ArgumentMatcherTuple matchers_;
|
| 1236 |
+
Matcher<const ArgumentTuple&> extra_matcher_;
|
| 1237 |
+
Action<F> repeated_action_;
|
| 1238 |
+
|
| 1239 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(TypedExpectation);
|
| 1240 |
+
}; // class TypedExpectation
|
| 1241 |
+
|
| 1242 |
+
// A MockSpec object is used by ON_CALL() or EXPECT_CALL() for
|
| 1243 |
+
// specifying the default behavior of, or expectation on, a mock
|
| 1244 |
+
// function.
|
| 1245 |
+
|
| 1246 |
+
// Note: class MockSpec really belongs to the ::testing namespace.
|
| 1247 |
+
// However if we define it in ::testing, MSVC will complain when
|
| 1248 |
+
// classes in ::testing::internal declare it as a friend class
|
| 1249 |
+
// template. To workaround this compiler bug, we define MockSpec in
|
| 1250 |
+
// ::testing::internal and import it into ::testing.
|
| 1251 |
+
|
| 1252 |
+
// Logs a message including file and line number information.
|
| 1253 |
+
GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
|
| 1254 |
+
const char* file, int line,
|
| 1255 |
+
const std::string& message);
|
| 1256 |
+
|
| 1257 |
+
template <typename F>
|
| 1258 |
+
class MockSpec {
|
| 1259 |
+
public:
|
| 1260 |
+
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
|
| 1261 |
+
typedef typename internal::Function<F>::ArgumentMatcherTuple
|
| 1262 |
+
ArgumentMatcherTuple;
|
| 1263 |
+
|
| 1264 |
+
// Constructs a MockSpec object, given the function mocker object
|
| 1265 |
+
// that the spec is associated with.
|
| 1266 |
+
MockSpec(internal::FunctionMocker<F>* function_mocker,
|
| 1267 |
+
const ArgumentMatcherTuple& matchers)
|
| 1268 |
+
: function_mocker_(function_mocker), matchers_(matchers) {}
|
| 1269 |
+
|
| 1270 |
+
// Adds a new default action spec to the function mocker and returns
|
| 1271 |
+
// the newly created spec.
|
| 1272 |
+
internal::OnCallSpec<F>& InternalDefaultActionSetAt(
|
| 1273 |
+
const char* file, int line, const char* obj, const char* call) {
|
| 1274 |
+
LogWithLocation(internal::kInfo, file, line,
|
| 1275 |
+
std::string("ON_CALL(") + obj + ", " + call + ") invoked");
|
| 1276 |
+
return function_mocker_->AddNewOnCallSpec(file, line, matchers_);
|
| 1277 |
+
}
|
| 1278 |
+
|
| 1279 |
+
// Adds a new expectation spec to the function mocker and returns
|
| 1280 |
+
// the newly created spec.
|
| 1281 |
+
internal::TypedExpectation<F>& InternalExpectedAt(
|
| 1282 |
+
const char* file, int line, const char* obj, const char* call) {
|
| 1283 |
+
const std::string source_text(std::string("EXPECT_CALL(") + obj + ", " +
|
| 1284 |
+
call + ")");
|
| 1285 |
+
LogWithLocation(internal::kInfo, file, line, source_text + " invoked");
|
| 1286 |
+
return function_mocker_->AddNewExpectation(
|
| 1287 |
+
file, line, source_text, matchers_);
|
| 1288 |
+
}
|
| 1289 |
+
|
| 1290 |
+
// This operator overload is used to swallow the superfluous parameter list
|
| 1291 |
+
// introduced by the ON/EXPECT_CALL macros. See the macro comments for more
|
| 1292 |
+
// explanation.
|
| 1293 |
+
MockSpec<F>& operator()(const internal::WithoutMatchers&, void* const) {
|
| 1294 |
+
return *this;
|
| 1295 |
+
}
|
| 1296 |
+
|
| 1297 |
+
private:
|
| 1298 |
+
template <typename Function>
|
| 1299 |
+
friend class internal::FunctionMocker;
|
| 1300 |
+
|
| 1301 |
+
// The function mocker that owns this spec.
|
| 1302 |
+
internal::FunctionMocker<F>* const function_mocker_;
|
| 1303 |
+
// The argument matchers specified in the spec.
|
| 1304 |
+
ArgumentMatcherTuple matchers_;
|
| 1305 |
+
}; // class MockSpec
|
| 1306 |
+
|
| 1307 |
+
// Wrapper type for generically holding an ordinary value or lvalue reference.
|
| 1308 |
+
// If T is not a reference type, it must be copyable or movable.
|
| 1309 |
+
// ReferenceOrValueWrapper<T> is movable, and will also be copyable unless
|
| 1310 |
+
// T is a move-only value type (which means that it will always be copyable
|
| 1311 |
+
// if the current platform does not support move semantics).
|
| 1312 |
+
//
|
| 1313 |
+
// The primary template defines handling for values, but function header
|
| 1314 |
+
// comments describe the contract for the whole template (including
|
| 1315 |
+
// specializations).
|
| 1316 |
+
template <typename T>
|
| 1317 |
+
class ReferenceOrValueWrapper {
|
| 1318 |
+
public:
|
| 1319 |
+
// Constructs a wrapper from the given value/reference.
|
| 1320 |
+
explicit ReferenceOrValueWrapper(T value)
|
| 1321 |
+
: value_(std::move(value)) {
|
| 1322 |
+
}
|
| 1323 |
+
|
| 1324 |
+
// Unwraps and returns the underlying value/reference, exactly as
|
| 1325 |
+
// originally passed. The behavior of calling this more than once on
|
| 1326 |
+
// the same object is unspecified.
|
| 1327 |
+
T Unwrap() { return std::move(value_); }
|
| 1328 |
+
|
| 1329 |
+
// Provides nondestructive access to the underlying value/reference.
|
| 1330 |
+
// Always returns a const reference (more precisely,
|
| 1331 |
+
// const std::add_lvalue_reference<T>::type). The behavior of calling this
|
| 1332 |
+
// after calling Unwrap on the same object is unspecified.
|
| 1333 |
+
const T& Peek() const {
|
| 1334 |
+
return value_;
|
| 1335 |
+
}
|
| 1336 |
+
|
| 1337 |
+
private:
|
| 1338 |
+
T value_;
|
| 1339 |
+
};
|
| 1340 |
+
|
| 1341 |
+
// Specialization for lvalue reference types. See primary template
|
| 1342 |
+
// for documentation.
|
| 1343 |
+
template <typename T>
|
| 1344 |
+
class ReferenceOrValueWrapper<T&> {
|
| 1345 |
+
public:
|
| 1346 |
+
// Workaround for debatable pass-by-reference lint warning (c-library-team
|
| 1347 |
+
// policy precludes NOLINT in this context)
|
| 1348 |
+
typedef T& reference;
|
| 1349 |
+
explicit ReferenceOrValueWrapper(reference ref)
|
| 1350 |
+
: value_ptr_(&ref) {}
|
| 1351 |
+
T& Unwrap() { return *value_ptr_; }
|
| 1352 |
+
const T& Peek() const { return *value_ptr_; }
|
| 1353 |
+
|
| 1354 |
+
private:
|
| 1355 |
+
T* value_ptr_;
|
| 1356 |
+
};
|
| 1357 |
+
|
| 1358 |
+
// C++ treats the void type specially. For example, you cannot define
|
| 1359 |
+
// a void-typed variable or pass a void value to a function.
|
| 1360 |
+
// ActionResultHolder<T> holds a value of type T, where T must be a
|
| 1361 |
+
// copyable type or void (T doesn't need to be default-constructable).
|
| 1362 |
+
// It hides the syntactic difference between void and other types, and
|
| 1363 |
+
// is used to unify the code for invoking both void-returning and
|
| 1364 |
+
// non-void-returning mock functions.
|
| 1365 |
+
|
| 1366 |
+
// Untyped base class for ActionResultHolder<T>.
|
| 1367 |
+
class UntypedActionResultHolderBase {
|
| 1368 |
+
public:
|
| 1369 |
+
virtual ~UntypedActionResultHolderBase() {}
|
| 1370 |
+
|
| 1371 |
+
// Prints the held value as an action's result to os.
|
| 1372 |
+
virtual void PrintAsActionResult(::std::ostream* os) const = 0;
|
| 1373 |
+
};
|
| 1374 |
+
|
| 1375 |
+
// This generic definition is used when T is not void.
|
| 1376 |
+
template <typename T>
|
| 1377 |
+
class ActionResultHolder : public UntypedActionResultHolderBase {
|
| 1378 |
+
public:
|
| 1379 |
+
// Returns the held value. Must not be called more than once.
|
| 1380 |
+
T Unwrap() {
|
| 1381 |
+
return result_.Unwrap();
|
| 1382 |
+
}
|
| 1383 |
+
|
| 1384 |
+
// Prints the held value as an action's result to os.
|
| 1385 |
+
void PrintAsActionResult(::std::ostream* os) const override {
|
| 1386 |
+
*os << "\n Returns: ";
|
| 1387 |
+
// T may be a reference type, so we don't use UniversalPrint().
|
| 1388 |
+
UniversalPrinter<T>::Print(result_.Peek(), os);
|
| 1389 |
+
}
|
| 1390 |
+
|
| 1391 |
+
// Performs the given mock function's default action and returns the
|
| 1392 |
+
// result in a new-ed ActionResultHolder.
|
| 1393 |
+
template <typename F>
|
| 1394 |
+
static ActionResultHolder* PerformDefaultAction(
|
| 1395 |
+
const FunctionMocker<F>* func_mocker,
|
| 1396 |
+
typename Function<F>::ArgumentTuple&& args,
|
| 1397 |
+
const std::string& call_description) {
|
| 1398 |
+
return new ActionResultHolder(Wrapper(func_mocker->PerformDefaultAction(
|
| 1399 |
+
std::move(args), call_description)));
|
| 1400 |
+
}
|
| 1401 |
+
|
| 1402 |
+
// Performs the given action and returns the result in a new-ed
|
| 1403 |
+
// ActionResultHolder.
|
| 1404 |
+
template <typename F>
|
| 1405 |
+
static ActionResultHolder* PerformAction(
|
| 1406 |
+
const Action<F>& action, typename Function<F>::ArgumentTuple&& args) {
|
| 1407 |
+
return new ActionResultHolder(
|
| 1408 |
+
Wrapper(action.Perform(std::move(args))));
|
| 1409 |
+
}
|
| 1410 |
+
|
| 1411 |
+
private:
|
| 1412 |
+
typedef ReferenceOrValueWrapper<T> Wrapper;
|
| 1413 |
+
|
| 1414 |
+
explicit ActionResultHolder(Wrapper result)
|
| 1415 |
+
: result_(std::move(result)) {
|
| 1416 |
+
}
|
| 1417 |
+
|
| 1418 |
+
Wrapper result_;
|
| 1419 |
+
|
| 1420 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionResultHolder);
|
| 1421 |
+
};
|
| 1422 |
+
|
| 1423 |
+
// Specialization for T = void.
|
| 1424 |
+
template <>
|
| 1425 |
+
class ActionResultHolder<void> : public UntypedActionResultHolderBase {
|
| 1426 |
+
public:
|
| 1427 |
+
void Unwrap() { }
|
| 1428 |
+
|
| 1429 |
+
void PrintAsActionResult(::std::ostream* /* os */) const override {}
|
| 1430 |
+
|
| 1431 |
+
// Performs the given mock function's default action and returns ownership
|
| 1432 |
+
// of an empty ActionResultHolder*.
|
| 1433 |
+
template <typename F>
|
| 1434 |
+
static ActionResultHolder* PerformDefaultAction(
|
| 1435 |
+
const FunctionMocker<F>* func_mocker,
|
| 1436 |
+
typename Function<F>::ArgumentTuple&& args,
|
| 1437 |
+
const std::string& call_description) {
|
| 1438 |
+
func_mocker->PerformDefaultAction(std::move(args), call_description);
|
| 1439 |
+
return new ActionResultHolder;
|
| 1440 |
+
}
|
| 1441 |
+
|
| 1442 |
+
// Performs the given action and returns ownership of an empty
|
| 1443 |
+
// ActionResultHolder*.
|
| 1444 |
+
template <typename F>
|
| 1445 |
+
static ActionResultHolder* PerformAction(
|
| 1446 |
+
const Action<F>& action, typename Function<F>::ArgumentTuple&& args) {
|
| 1447 |
+
action.Perform(std::move(args));
|
| 1448 |
+
return new ActionResultHolder;
|
| 1449 |
+
}
|
| 1450 |
+
|
| 1451 |
+
private:
|
| 1452 |
+
ActionResultHolder() {}
|
| 1453 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionResultHolder);
|
| 1454 |
+
};
|
| 1455 |
+
|
| 1456 |
+
template <typename F>
|
| 1457 |
+
class FunctionMocker;
|
| 1458 |
+
|
| 1459 |
+
template <typename R, typename... Args>
|
| 1460 |
+
class FunctionMocker<R(Args...)> final : public UntypedFunctionMockerBase {
|
| 1461 |
+
using F = R(Args...);
|
| 1462 |
+
|
| 1463 |
+
public:
|
| 1464 |
+
using Result = R;
|
| 1465 |
+
using ArgumentTuple = std::tuple<Args...>;
|
| 1466 |
+
using ArgumentMatcherTuple = std::tuple<Matcher<Args>...>;
|
| 1467 |
+
|
| 1468 |
+
FunctionMocker() {}
|
| 1469 |
+
|
| 1470 |
+
// There is no generally useful and implementable semantics of
|
| 1471 |
+
// copying a mock object, so copying a mock is usually a user error.
|
| 1472 |
+
// Thus we disallow copying function mockers. If the user really
|
| 1473 |
+
// wants to copy a mock object, they should implement their own copy
|
| 1474 |
+
// operation, for example:
|
| 1475 |
+
//
|
| 1476 |
+
// class MockFoo : public Foo {
|
| 1477 |
+
// public:
|
| 1478 |
+
// // Defines a copy constructor explicitly.
|
| 1479 |
+
// MockFoo(const MockFoo& src) {}
|
| 1480 |
+
// ...
|
| 1481 |
+
// };
|
| 1482 |
+
FunctionMocker(const FunctionMocker&) = delete;
|
| 1483 |
+
FunctionMocker& operator=(const FunctionMocker&) = delete;
|
| 1484 |
+
|
| 1485 |
+
// The destructor verifies that all expectations on this mock
|
| 1486 |
+
// function have been satisfied. If not, it will report Google Test
|
| 1487 |
+
// non-fatal failures for the violations.
|
| 1488 |
+
~FunctionMocker() override GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
|
| 1489 |
+
MutexLock l(&g_gmock_mutex);
|
| 1490 |
+
VerifyAndClearExpectationsLocked();
|
| 1491 |
+
Mock::UnregisterLocked(this);
|
| 1492 |
+
ClearDefaultActionsLocked();
|
| 1493 |
+
}
|
| 1494 |
+
|
| 1495 |
+
// Returns the ON_CALL spec that matches this mock function with the
|
| 1496 |
+
// given arguments; returns NULL if no matching ON_CALL is found.
|
| 1497 |
+
// L = *
|
| 1498 |
+
const OnCallSpec<F>* FindOnCallSpec(
|
| 1499 |
+
const ArgumentTuple& args) const {
|
| 1500 |
+
for (UntypedOnCallSpecs::const_reverse_iterator it
|
| 1501 |
+
= untyped_on_call_specs_.rbegin();
|
| 1502 |
+
it != untyped_on_call_specs_.rend(); ++it) {
|
| 1503 |
+
const OnCallSpec<F>* spec = static_cast<const OnCallSpec<F>*>(*it);
|
| 1504 |
+
if (spec->Matches(args))
|
| 1505 |
+
return spec;
|
| 1506 |
+
}
|
| 1507 |
+
|
| 1508 |
+
return nullptr;
|
| 1509 |
+
}
|
| 1510 |
+
|
| 1511 |
+
// Performs the default action of this mock function on the given
|
| 1512 |
+
// arguments and returns the result. Asserts (or throws if
|
| 1513 |
+
// exceptions are enabled) with a helpful call descrption if there
|
| 1514 |
+
// is no valid return value. This method doesn't depend on the
|
| 1515 |
+
// mutable state of this object, and thus can be called concurrently
|
| 1516 |
+
// without locking.
|
| 1517 |
+
// L = *
|
| 1518 |
+
Result PerformDefaultAction(ArgumentTuple&& args,
|
| 1519 |
+
const std::string& call_description) const {
|
| 1520 |
+
const OnCallSpec<F>* const spec =
|
| 1521 |
+
this->FindOnCallSpec(args);
|
| 1522 |
+
if (spec != nullptr) {
|
| 1523 |
+
return spec->GetAction().Perform(std::move(args));
|
| 1524 |
+
}
|
| 1525 |
+
const std::string message =
|
| 1526 |
+
call_description +
|
| 1527 |
+
"\n The mock function has no default action "
|
| 1528 |
+
"set, and its return type has no default value set.";
|
| 1529 |
+
#if GTEST_HAS_EXCEPTIONS
|
| 1530 |
+
if (!DefaultValue<Result>::Exists()) {
|
| 1531 |
+
throw std::runtime_error(message);
|
| 1532 |
+
}
|
| 1533 |
+
#else
|
| 1534 |
+
Assert(DefaultValue<Result>::Exists(), "", -1, message);
|
| 1535 |
+
#endif
|
| 1536 |
+
return DefaultValue<Result>::Get();
|
| 1537 |
+
}
|
| 1538 |
+
|
| 1539 |
+
// Performs the default action with the given arguments and returns
|
| 1540 |
+
// the action's result. The call description string will be used in
|
| 1541 |
+
// the error message to describe the call in the case the default
|
| 1542 |
+
// action fails. The caller is responsible for deleting the result.
|
| 1543 |
+
// L = *
|
| 1544 |
+
UntypedActionResultHolderBase* UntypedPerformDefaultAction(
|
| 1545 |
+
void* untyped_args, // must point to an ArgumentTuple
|
| 1546 |
+
const std::string& call_description) const override {
|
| 1547 |
+
ArgumentTuple* args = static_cast<ArgumentTuple*>(untyped_args);
|
| 1548 |
+
return ResultHolder::PerformDefaultAction(this, std::move(*args),
|
| 1549 |
+
call_description);
|
| 1550 |
+
}
|
| 1551 |
+
|
| 1552 |
+
// Performs the given action with the given arguments and returns
|
| 1553 |
+
// the action's result. The caller is responsible for deleting the
|
| 1554 |
+
// result.
|
| 1555 |
+
// L = *
|
| 1556 |
+
UntypedActionResultHolderBase* UntypedPerformAction(
|
| 1557 |
+
const void* untyped_action, void* untyped_args) const override {
|
| 1558 |
+
// Make a copy of the action before performing it, in case the
|
| 1559 |
+
// action deletes the mock object (and thus deletes itself).
|
| 1560 |
+
const Action<F> action = *static_cast<const Action<F>*>(untyped_action);
|
| 1561 |
+
ArgumentTuple* args = static_cast<ArgumentTuple*>(untyped_args);
|
| 1562 |
+
return ResultHolder::PerformAction(action, std::move(*args));
|
| 1563 |
+
}
|
| 1564 |
+
|
| 1565 |
+
// Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked():
|
| 1566 |
+
// clears the ON_CALL()s set on this mock function.
|
| 1567 |
+
void ClearDefaultActionsLocked() override
|
| 1568 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 1569 |
+
g_gmock_mutex.AssertHeld();
|
| 1570 |
+
|
| 1571 |
+
// Deleting our default actions may trigger other mock objects to be
|
| 1572 |
+
// deleted, for example if an action contains a reference counted smart
|
| 1573 |
+
// pointer to that mock object, and that is the last reference. So if we
|
| 1574 |
+
// delete our actions within the context of the global mutex we may deadlock
|
| 1575 |
+
// when this method is called again. Instead, make a copy of the set of
|
| 1576 |
+
// actions to delete, clear our set within the mutex, and then delete the
|
| 1577 |
+
// actions outside of the mutex.
|
| 1578 |
+
UntypedOnCallSpecs specs_to_delete;
|
| 1579 |
+
untyped_on_call_specs_.swap(specs_to_delete);
|
| 1580 |
+
|
| 1581 |
+
g_gmock_mutex.Unlock();
|
| 1582 |
+
for (UntypedOnCallSpecs::const_iterator it =
|
| 1583 |
+
specs_to_delete.begin();
|
| 1584 |
+
it != specs_to_delete.end(); ++it) {
|
| 1585 |
+
delete static_cast<const OnCallSpec<F>*>(*it);
|
| 1586 |
+
}
|
| 1587 |
+
|
| 1588 |
+
// Lock the mutex again, since the caller expects it to be locked when we
|
| 1589 |
+
// return.
|
| 1590 |
+
g_gmock_mutex.Lock();
|
| 1591 |
+
}
|
| 1592 |
+
|
| 1593 |
+
// Returns the result of invoking this mock function with the given
|
| 1594 |
+
// arguments. This function can be safely called from multiple
|
| 1595 |
+
// threads concurrently.
|
| 1596 |
+
Result Invoke(Args... args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
|
| 1597 |
+
ArgumentTuple tuple(std::forward<Args>(args)...);
|
| 1598 |
+
std::unique_ptr<ResultHolder> holder(DownCast_<ResultHolder*>(
|
| 1599 |
+
this->UntypedInvokeWith(static_cast<void*>(&tuple))));
|
| 1600 |
+
return holder->Unwrap();
|
| 1601 |
+
}
|
| 1602 |
+
|
| 1603 |
+
MockSpec<F> With(Matcher<Args>... m) {
|
| 1604 |
+
return MockSpec<F>(this, ::std::make_tuple(std::move(m)...));
|
| 1605 |
+
}
|
| 1606 |
+
|
| 1607 |
+
protected:
|
| 1608 |
+
template <typename Function>
|
| 1609 |
+
friend class MockSpec;
|
| 1610 |
+
|
| 1611 |
+
typedef ActionResultHolder<Result> ResultHolder;
|
| 1612 |
+
|
| 1613 |
+
// Adds and returns a default action spec for this mock function.
|
| 1614 |
+
OnCallSpec<F>& AddNewOnCallSpec(
|
| 1615 |
+
const char* file, int line,
|
| 1616 |
+
const ArgumentMatcherTuple& m)
|
| 1617 |
+
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
|
| 1618 |
+
Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
|
| 1619 |
+
OnCallSpec<F>* const on_call_spec = new OnCallSpec<F>(file, line, m);
|
| 1620 |
+
untyped_on_call_specs_.push_back(on_call_spec);
|
| 1621 |
+
return *on_call_spec;
|
| 1622 |
+
}
|
| 1623 |
+
|
| 1624 |
+
// Adds and returns an expectation spec for this mock function.
|
| 1625 |
+
TypedExpectation<F>& AddNewExpectation(const char* file, int line,
|
| 1626 |
+
const std::string& source_text,
|
| 1627 |
+
const ArgumentMatcherTuple& m)
|
| 1628 |
+
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
|
| 1629 |
+
Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
|
| 1630 |
+
TypedExpectation<F>* const expectation =
|
| 1631 |
+
new TypedExpectation<F>(this, file, line, source_text, m);
|
| 1632 |
+
const std::shared_ptr<ExpectationBase> untyped_expectation(expectation);
|
| 1633 |
+
// See the definition of untyped_expectations_ for why access to
|
| 1634 |
+
// it is unprotected here.
|
| 1635 |
+
untyped_expectations_.push_back(untyped_expectation);
|
| 1636 |
+
|
| 1637 |
+
// Adds this expectation into the implicit sequence if there is one.
|
| 1638 |
+
Sequence* const implicit_sequence = g_gmock_implicit_sequence.get();
|
| 1639 |
+
if (implicit_sequence != nullptr) {
|
| 1640 |
+
implicit_sequence->AddExpectation(Expectation(untyped_expectation));
|
| 1641 |
+
}
|
| 1642 |
+
|
| 1643 |
+
return *expectation;
|
| 1644 |
+
}
|
| 1645 |
+
|
| 1646 |
+
private:
|
| 1647 |
+
template <typename Func> friend class TypedExpectation;
|
| 1648 |
+
|
| 1649 |
+
// Some utilities needed for implementing UntypedInvokeWith().
|
| 1650 |
+
|
| 1651 |
+
// Describes what default action will be performed for the given
|
| 1652 |
+
// arguments.
|
| 1653 |
+
// L = *
|
| 1654 |
+
void DescribeDefaultActionTo(const ArgumentTuple& args,
|
| 1655 |
+
::std::ostream* os) const {
|
| 1656 |
+
const OnCallSpec<F>* const spec = FindOnCallSpec(args);
|
| 1657 |
+
|
| 1658 |
+
if (spec == nullptr) {
|
| 1659 |
+
*os << (std::is_void<Result>::value ? "returning directly.\n"
|
| 1660 |
+
: "returning default value.\n");
|
| 1661 |
+
} else {
|
| 1662 |
+
*os << "taking default action specified at:\n"
|
| 1663 |
+
<< FormatFileLocation(spec->file(), spec->line()) << "\n";
|
| 1664 |
+
}
|
| 1665 |
+
}
|
| 1666 |
+
|
| 1667 |
+
// Writes a message that the call is uninteresting (i.e. neither
|
| 1668 |
+
// explicitly expected nor explicitly unexpected) to the given
|
| 1669 |
+
// ostream.
|
| 1670 |
+
void UntypedDescribeUninterestingCall(const void* untyped_args,
|
| 1671 |
+
::std::ostream* os) const override
|
| 1672 |
+
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
|
| 1673 |
+
const ArgumentTuple& args =
|
| 1674 |
+
*static_cast<const ArgumentTuple*>(untyped_args);
|
| 1675 |
+
*os << "Uninteresting mock function call - ";
|
| 1676 |
+
DescribeDefaultActionTo(args, os);
|
| 1677 |
+
*os << " Function call: " << Name();
|
| 1678 |
+
UniversalPrint(args, os);
|
| 1679 |
+
}
|
| 1680 |
+
|
| 1681 |
+
// Returns the expectation that matches the given function arguments
|
| 1682 |
+
// (or NULL is there's no match); when a match is found,
|
| 1683 |
+
// untyped_action is set to point to the action that should be
|
| 1684 |
+
// performed (or NULL if the action is "do default"), and
|
| 1685 |
+
// is_excessive is modified to indicate whether the call exceeds the
|
| 1686 |
+
// expected number.
|
| 1687 |
+
//
|
| 1688 |
+
// Critical section: We must find the matching expectation and the
|
| 1689 |
+
// corresponding action that needs to be taken in an ATOMIC
|
| 1690 |
+
// transaction. Otherwise another thread may call this mock
|
| 1691 |
+
// method in the middle and mess up the state.
|
| 1692 |
+
//
|
| 1693 |
+
// However, performing the action has to be left out of the critical
|
| 1694 |
+
// section. The reason is that we have no control on what the
|
| 1695 |
+
// action does (it can invoke an arbitrary user function or even a
|
| 1696 |
+
// mock function) and excessive locking could cause a dead lock.
|
| 1697 |
+
const ExpectationBase* UntypedFindMatchingExpectation(
|
| 1698 |
+
const void* untyped_args, const void** untyped_action, bool* is_excessive,
|
| 1699 |
+
::std::ostream* what, ::std::ostream* why) override
|
| 1700 |
+
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
|
| 1701 |
+
const ArgumentTuple& args =
|
| 1702 |
+
*static_cast<const ArgumentTuple*>(untyped_args);
|
| 1703 |
+
MutexLock l(&g_gmock_mutex);
|
| 1704 |
+
TypedExpectation<F>* exp = this->FindMatchingExpectationLocked(args);
|
| 1705 |
+
if (exp == nullptr) { // A match wasn't found.
|
| 1706 |
+
this->FormatUnexpectedCallMessageLocked(args, what, why);
|
| 1707 |
+
return nullptr;
|
| 1708 |
+
}
|
| 1709 |
+
|
| 1710 |
+
// This line must be done before calling GetActionForArguments(),
|
| 1711 |
+
// which will increment the call count for *exp and thus affect
|
| 1712 |
+
// its saturation status.
|
| 1713 |
+
*is_excessive = exp->IsSaturated();
|
| 1714 |
+
const Action<F>* action = exp->GetActionForArguments(this, args, what, why);
|
| 1715 |
+
if (action != nullptr && action->IsDoDefault())
|
| 1716 |
+
action = nullptr; // Normalize "do default" to NULL.
|
| 1717 |
+
*untyped_action = action;
|
| 1718 |
+
return exp;
|
| 1719 |
+
}
|
| 1720 |
+
|
| 1721 |
+
// Prints the given function arguments to the ostream.
|
| 1722 |
+
void UntypedPrintArgs(const void* untyped_args,
|
| 1723 |
+
::std::ostream* os) const override {
|
| 1724 |
+
const ArgumentTuple& args =
|
| 1725 |
+
*static_cast<const ArgumentTuple*>(untyped_args);
|
| 1726 |
+
UniversalPrint(args, os);
|
| 1727 |
+
}
|
| 1728 |
+
|
| 1729 |
+
// Returns the expectation that matches the arguments, or NULL if no
|
| 1730 |
+
// expectation matches them.
|
| 1731 |
+
TypedExpectation<F>* FindMatchingExpectationLocked(
|
| 1732 |
+
const ArgumentTuple& args) const
|
| 1733 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 1734 |
+
g_gmock_mutex.AssertHeld();
|
| 1735 |
+
// See the definition of untyped_expectations_ for why access to
|
| 1736 |
+
// it is unprotected here.
|
| 1737 |
+
for (typename UntypedExpectations::const_reverse_iterator it =
|
| 1738 |
+
untyped_expectations_.rbegin();
|
| 1739 |
+
it != untyped_expectations_.rend(); ++it) {
|
| 1740 |
+
TypedExpectation<F>* const exp =
|
| 1741 |
+
static_cast<TypedExpectation<F>*>(it->get());
|
| 1742 |
+
if (exp->ShouldHandleArguments(args)) {
|
| 1743 |
+
return exp;
|
| 1744 |
+
}
|
| 1745 |
+
}
|
| 1746 |
+
return nullptr;
|
| 1747 |
+
}
|
| 1748 |
+
|
| 1749 |
+
// Returns a message that the arguments don't match any expectation.
|
| 1750 |
+
void FormatUnexpectedCallMessageLocked(
|
| 1751 |
+
const ArgumentTuple& args,
|
| 1752 |
+
::std::ostream* os,
|
| 1753 |
+
::std::ostream* why) const
|
| 1754 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 1755 |
+
g_gmock_mutex.AssertHeld();
|
| 1756 |
+
*os << "\nUnexpected mock function call - ";
|
| 1757 |
+
DescribeDefaultActionTo(args, os);
|
| 1758 |
+
PrintTriedExpectationsLocked(args, why);
|
| 1759 |
+
}
|
| 1760 |
+
|
| 1761 |
+
// Prints a list of expectations that have been tried against the
|
| 1762 |
+
// current mock function call.
|
| 1763 |
+
void PrintTriedExpectationsLocked(
|
| 1764 |
+
const ArgumentTuple& args,
|
| 1765 |
+
::std::ostream* why) const
|
| 1766 |
+
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
|
| 1767 |
+
g_gmock_mutex.AssertHeld();
|
| 1768 |
+
const size_t count = untyped_expectations_.size();
|
| 1769 |
+
*why << "Google Mock tried the following " << count << " "
|
| 1770 |
+
<< (count == 1 ? "expectation, but it didn't match" :
|
| 1771 |
+
"expectations, but none matched")
|
| 1772 |
+
<< ":\n";
|
| 1773 |
+
for (size_t i = 0; i < count; i++) {
|
| 1774 |
+
TypedExpectation<F>* const expectation =
|
| 1775 |
+
static_cast<TypedExpectation<F>*>(untyped_expectations_[i].get());
|
| 1776 |
+
*why << "\n";
|
| 1777 |
+
expectation->DescribeLocationTo(why);
|
| 1778 |
+
if (count > 1) {
|
| 1779 |
+
*why << "tried expectation #" << i << ": ";
|
| 1780 |
+
}
|
| 1781 |
+
*why << expectation->source_text() << "...\n";
|
| 1782 |
+
expectation->ExplainMatchResultTo(args, why);
|
| 1783 |
+
expectation->DescribeCallCountTo(why);
|
| 1784 |
+
}
|
| 1785 |
+
}
|
| 1786 |
+
}; // class FunctionMocker
|
| 1787 |
+
|
| 1788 |
+
// Reports an uninteresting call (whose description is in msg) in the
|
| 1789 |
+
// manner specified by 'reaction'.
|
| 1790 |
+
void ReportUninterestingCall(CallReaction reaction, const std::string& msg);
|
| 1791 |
+
|
| 1792 |
+
} // namespace internal
|
| 1793 |
+
|
| 1794 |
+
namespace internal {
|
| 1795 |
+
|
| 1796 |
+
template <typename F>
|
| 1797 |
+
class MockFunction;
|
| 1798 |
+
|
| 1799 |
+
template <typename R, typename... Args>
|
| 1800 |
+
class MockFunction<R(Args...)> {
|
| 1801 |
+
public:
|
| 1802 |
+
MockFunction(const MockFunction&) = delete;
|
| 1803 |
+
MockFunction& operator=(const MockFunction&) = delete;
|
| 1804 |
+
|
| 1805 |
+
std::function<R(Args...)> AsStdFunction() {
|
| 1806 |
+
return [this](Args... args) -> R {
|
| 1807 |
+
return this->Call(std::forward<Args>(args)...);
|
| 1808 |
+
};
|
| 1809 |
+
}
|
| 1810 |
+
|
| 1811 |
+
// Implementation detail: the expansion of the MOCK_METHOD macro.
|
| 1812 |
+
R Call(Args... args) {
|
| 1813 |
+
mock_.SetOwnerAndName(this, "Call");
|
| 1814 |
+
return mock_.Invoke(std::forward<Args>(args)...);
|
| 1815 |
+
}
|
| 1816 |
+
|
| 1817 |
+
MockSpec<R(Args...)> gmock_Call(Matcher<Args>... m) {
|
| 1818 |
+
mock_.RegisterOwner(this);
|
| 1819 |
+
return mock_.With(std::move(m)...);
|
| 1820 |
+
}
|
| 1821 |
+
|
| 1822 |
+
MockSpec<R(Args...)> gmock_Call(const WithoutMatchers&, R (*)(Args...)) {
|
| 1823 |
+
return this->gmock_Call(::testing::A<Args>()...);
|
| 1824 |
+
}
|
| 1825 |
+
|
| 1826 |
+
protected:
|
| 1827 |
+
MockFunction() = default;
|
| 1828 |
+
~MockFunction() = default;
|
| 1829 |
+
|
| 1830 |
+
private:
|
| 1831 |
+
FunctionMocker<R(Args...)> mock_;
|
| 1832 |
+
};
|
| 1833 |
+
|
| 1834 |
+
/*
|
| 1835 |
+
The SignatureOf<F> struct is a meta-function returning function signature
|
| 1836 |
+
corresponding to the provided F argument.
|
| 1837 |
+
|
| 1838 |
+
It makes use of MockFunction easier by allowing it to accept more F arguments
|
| 1839 |
+
than just function signatures.
|
| 1840 |
+
|
| 1841 |
+
Specializations provided here cover a signature type itself and any template
|
| 1842 |
+
that can be parameterized with a signature, including std::function and
|
| 1843 |
+
boost::function.
|
| 1844 |
+
*/
|
| 1845 |
+
|
| 1846 |
+
template <typename F, typename = void>
|
| 1847 |
+
struct SignatureOf;
|
| 1848 |
+
|
| 1849 |
+
template <typename R, typename... Args>
|
| 1850 |
+
struct SignatureOf<R(Args...)> {
|
| 1851 |
+
using type = R(Args...);
|
| 1852 |
+
};
|
| 1853 |
+
|
| 1854 |
+
template <template <typename> class C, typename F>
|
| 1855 |
+
struct SignatureOf<C<F>,
|
| 1856 |
+
typename std::enable_if<std::is_function<F>::value>::type>
|
| 1857 |
+
: SignatureOf<F> {};
|
| 1858 |
+
|
| 1859 |
+
template <typename F>
|
| 1860 |
+
using SignatureOfT = typename SignatureOf<F>::type;
|
| 1861 |
+
|
| 1862 |
+
} // namespace internal
|
| 1863 |
+
|
| 1864 |
+
// A MockFunction<F> type has one mock method whose type is
|
| 1865 |
+
// internal::SignatureOfT<F>. It is useful when you just want your
|
| 1866 |
+
// test code to emit some messages and have Google Mock verify the
|
| 1867 |
+
// right messages are sent (and perhaps at the right times). For
|
| 1868 |
+
// example, if you are exercising code:
|
| 1869 |
+
//
|
| 1870 |
+
// Foo(1);
|
| 1871 |
+
// Foo(2);
|
| 1872 |
+
// Foo(3);
|
| 1873 |
+
//
|
| 1874 |
+
// and want to verify that Foo(1) and Foo(3) both invoke
|
| 1875 |
+
// mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write:
|
| 1876 |
+
//
|
| 1877 |
+
// TEST(FooTest, InvokesBarCorrectly) {
|
| 1878 |
+
// MyMock mock;
|
| 1879 |
+
// MockFunction<void(string check_point_name)> check;
|
| 1880 |
+
// {
|
| 1881 |
+
// InSequence s;
|
| 1882 |
+
//
|
| 1883 |
+
// EXPECT_CALL(mock, Bar("a"));
|
| 1884 |
+
// EXPECT_CALL(check, Call("1"));
|
| 1885 |
+
// EXPECT_CALL(check, Call("2"));
|
| 1886 |
+
// EXPECT_CALL(mock, Bar("a"));
|
| 1887 |
+
// }
|
| 1888 |
+
// Foo(1);
|
| 1889 |
+
// check.Call("1");
|
| 1890 |
+
// Foo(2);
|
| 1891 |
+
// check.Call("2");
|
| 1892 |
+
// Foo(3);
|
| 1893 |
+
// }
|
| 1894 |
+
//
|
| 1895 |
+
// The expectation spec says that the first Bar("a") must happen
|
| 1896 |
+
// before check point "1", the second Bar("a") must happen after check
|
| 1897 |
+
// point "2", and nothing should happen between the two check
|
| 1898 |
+
// points. The explicit check points make it easy to tell which
|
| 1899 |
+
// Bar("a") is called by which call to Foo().
|
| 1900 |
+
//
|
| 1901 |
+
// MockFunction<F> can also be used to exercise code that accepts
|
| 1902 |
+
// std::function<internal::SignatureOfT<F>> callbacks. To do so, use
|
| 1903 |
+
// AsStdFunction() method to create std::function proxy forwarding to
|
| 1904 |
+
// original object's Call. Example:
|
| 1905 |
+
//
|
| 1906 |
+
// TEST(FooTest, RunsCallbackWithBarArgument) {
|
| 1907 |
+
// MockFunction<int(string)> callback;
|
| 1908 |
+
// EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1));
|
| 1909 |
+
// Foo(callback.AsStdFunction());
|
| 1910 |
+
// }
|
| 1911 |
+
//
|
| 1912 |
+
// The internal::SignatureOfT<F> indirection allows to use other types
|
| 1913 |
+
// than just function signature type. This is typically useful when
|
| 1914 |
+
// providing a mock for a predefined std::function type. Example:
|
| 1915 |
+
//
|
| 1916 |
+
// using FilterPredicate = std::function<bool(string)>;
|
| 1917 |
+
// void MyFilterAlgorithm(FilterPredicate predicate);
|
| 1918 |
+
//
|
| 1919 |
+
// TEST(FooTest, FilterPredicateAlwaysAccepts) {
|
| 1920 |
+
// MockFunction<FilterPredicate> predicateMock;
|
| 1921 |
+
// EXPECT_CALL(predicateMock, Call(_)).WillRepeatedly(Return(true));
|
| 1922 |
+
// MyFilterAlgorithm(predicateMock.AsStdFunction());
|
| 1923 |
+
// }
|
| 1924 |
+
template <typename F>
|
| 1925 |
+
class MockFunction : public internal::MockFunction<internal::SignatureOfT<F>> {
|
| 1926 |
+
using Base = internal::MockFunction<internal::SignatureOfT<F>>;
|
| 1927 |
+
|
| 1928 |
+
public:
|
| 1929 |
+
using Base::Base;
|
| 1930 |
+
};
|
| 1931 |
+
|
| 1932 |
+
// The style guide prohibits "using" statements in a namespace scope
|
| 1933 |
+
// inside a header file. However, the MockSpec class template is
|
| 1934 |
+
// meant to be defined in the ::testing namespace. The following line
|
| 1935 |
+
// is just a trick for working around a bug in MSVC 8.0, which cannot
|
| 1936 |
+
// handle it if we define MockSpec in ::testing.
|
| 1937 |
+
using internal::MockSpec;
|
| 1938 |
+
|
| 1939 |
+
// Const(x) is a convenient function for obtaining a const reference
|
| 1940 |
+
// to x. This is useful for setting expectations on an overloaded
|
| 1941 |
+
// const mock method, e.g.
|
| 1942 |
+
//
|
| 1943 |
+
// class MockFoo : public FooInterface {
|
| 1944 |
+
// public:
|
| 1945 |
+
// MOCK_METHOD0(Bar, int());
|
| 1946 |
+
// MOCK_CONST_METHOD0(Bar, int&());
|
| 1947 |
+
// };
|
| 1948 |
+
//
|
| 1949 |
+
// MockFoo foo;
|
| 1950 |
+
// // Expects a call to non-const MockFoo::Bar().
|
| 1951 |
+
// EXPECT_CALL(foo, Bar());
|
| 1952 |
+
// // Expects a call to const MockFoo::Bar().
|
| 1953 |
+
// EXPECT_CALL(Const(foo), Bar());
|
| 1954 |
+
template <typename T>
|
| 1955 |
+
inline const T& Const(const T& x) { return x; }
|
| 1956 |
+
|
| 1957 |
+
// Constructs an Expectation object that references and co-owns exp.
|
| 1958 |
+
inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
|
| 1959 |
+
: expectation_base_(exp.GetHandle().expectation_base()) {}
|
| 1960 |
+
|
| 1961 |
+
} // namespace testing
|
| 1962 |
+
|
| 1963 |
+
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
| 1964 |
+
|
| 1965 |
+
// Implementation for ON_CALL and EXPECT_CALL macros. A separate macro is
|
| 1966 |
+
// required to avoid compile errors when the name of the method used in call is
|
| 1967 |
+
// a result of macro expansion. See CompilesWithMethodNameExpandedFromMacro
|
| 1968 |
+
// tests in internal/gmock-spec-builders_test.cc for more details.
|
| 1969 |
+
//
|
| 1970 |
+
// This macro supports statements both with and without parameter matchers. If
|
| 1971 |
+
// the parameter list is omitted, gMock will accept any parameters, which allows
|
| 1972 |
+
// tests to be written that don't need to encode the number of method
|
| 1973 |
+
// parameter. This technique may only be used for non-overloaded methods.
|
| 1974 |
+
//
|
| 1975 |
+
// // These are the same:
|
| 1976 |
+
// ON_CALL(mock, NoArgsMethod()).WillByDefault(...);
|
| 1977 |
+
// ON_CALL(mock, NoArgsMethod).WillByDefault(...);
|
| 1978 |
+
//
|
| 1979 |
+
// // As are these:
|
| 1980 |
+
// ON_CALL(mock, TwoArgsMethod(_, _)).WillByDefault(...);
|
| 1981 |
+
// ON_CALL(mock, TwoArgsMethod).WillByDefault(...);
|
| 1982 |
+
//
|
| 1983 |
+
// // Can also specify args if you want, of course:
|
| 1984 |
+
// ON_CALL(mock, TwoArgsMethod(_, 45)).WillByDefault(...);
|
| 1985 |
+
//
|
| 1986 |
+
// // Overloads work as long as you specify parameters:
|
| 1987 |
+
// ON_CALL(mock, OverloadedMethod(_)).WillByDefault(...);
|
| 1988 |
+
// ON_CALL(mock, OverloadedMethod(_, _)).WillByDefault(...);
|
| 1989 |
+
//
|
| 1990 |
+
// // Oops! Which overload did you want?
|
| 1991 |
+
// ON_CALL(mock, OverloadedMethod).WillByDefault(...);
|
| 1992 |
+
// => ERROR: call to member function 'gmock_OverloadedMethod' is ambiguous
|
| 1993 |
+
//
|
| 1994 |
+
// How this works: The mock class uses two overloads of the gmock_Method
|
| 1995 |
+
// expectation setter method plus an operator() overload on the MockSpec object.
|
| 1996 |
+
// In the matcher list form, the macro expands to:
|
| 1997 |
+
//
|
| 1998 |
+
// // This statement:
|
| 1999 |
+
// ON_CALL(mock, TwoArgsMethod(_, 45))...
|
| 2000 |
+
//
|
| 2001 |
+
// // ...expands to:
|
| 2002 |
+
// mock.gmock_TwoArgsMethod(_, 45)(WithoutMatchers(), nullptr)...
|
| 2003 |
+
// |-------------v---------------||------------v-------------|
|
| 2004 |
+
// invokes first overload swallowed by operator()
|
| 2005 |
+
//
|
| 2006 |
+
// // ...which is essentially:
|
| 2007 |
+
// mock.gmock_TwoArgsMethod(_, 45)...
|
| 2008 |
+
//
|
| 2009 |
+
// Whereas the form without a matcher list:
|
| 2010 |
+
//
|
| 2011 |
+
// // This statement:
|
| 2012 |
+
// ON_CALL(mock, TwoArgsMethod)...
|
| 2013 |
+
//
|
| 2014 |
+
// // ...expands to:
|
| 2015 |
+
// mock.gmock_TwoArgsMethod(WithoutMatchers(), nullptr)...
|
| 2016 |
+
// |-----------------------v--------------------------|
|
| 2017 |
+
// invokes second overload
|
| 2018 |
+
//
|
| 2019 |
+
// // ...which is essentially:
|
| 2020 |
+
// mock.gmock_TwoArgsMethod(_, _)...
|
| 2021 |
+
//
|
| 2022 |
+
// The WithoutMatchers() argument is used to disambiguate overloads and to
|
| 2023 |
+
// block the caller from accidentally invoking the second overload directly. The
|
| 2024 |
+
// second argument is an internal type derived from the method signature. The
|
| 2025 |
+
// failure to disambiguate two overloads of this method in the ON_CALL statement
|
| 2026 |
+
// is how we block callers from setting expectations on overloaded methods.
|
| 2027 |
+
#define GMOCK_ON_CALL_IMPL_(mock_expr, Setter, call) \
|
| 2028 |
+
((mock_expr).gmock_##call)(::testing::internal::GetWithoutMatchers(), \
|
| 2029 |
+
nullptr) \
|
| 2030 |
+
.Setter(__FILE__, __LINE__, #mock_expr, #call)
|
| 2031 |
+
|
| 2032 |
+
#define ON_CALL(obj, call) \
|
| 2033 |
+
GMOCK_ON_CALL_IMPL_(obj, InternalDefaultActionSetAt, call)
|
| 2034 |
+
|
| 2035 |
+
#define EXPECT_CALL(obj, call) \
|
| 2036 |
+
GMOCK_ON_CALL_IMPL_(obj, InternalExpectedAt, call)
|
| 2037 |
+
|
| 2038 |
+
#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gmock/gmock.h
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2007, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
// Google Mock - a framework for writing C++ mock classes.
|
| 32 |
+
//
|
| 33 |
+
// This is the main header file a user should include.
|
| 34 |
+
|
| 35 |
+
// GOOGLETEST_CM0002 DO NOT DELETE
|
| 36 |
+
|
| 37 |
+
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_H_
|
| 38 |
+
#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_H_
|
| 39 |
+
|
| 40 |
+
// This file implements the following syntax:
|
| 41 |
+
//
|
| 42 |
+
// ON_CALL(mock_object, Method(...))
|
| 43 |
+
// .With(...) ?
|
| 44 |
+
// .WillByDefault(...);
|
| 45 |
+
//
|
| 46 |
+
// where With() is optional and WillByDefault() must appear exactly
|
| 47 |
+
// once.
|
| 48 |
+
//
|
| 49 |
+
// EXPECT_CALL(mock_object, Method(...))
|
| 50 |
+
// .With(...) ?
|
| 51 |
+
// .Times(...) ?
|
| 52 |
+
// .InSequence(...) *
|
| 53 |
+
// .WillOnce(...) *
|
| 54 |
+
// .WillRepeatedly(...) ?
|
| 55 |
+
// .RetiresOnSaturation() ? ;
|
| 56 |
+
//
|
| 57 |
+
// where all clauses are optional and WillOnce() can be repeated.
|
| 58 |
+
|
| 59 |
+
#include "gmock/gmock-actions.h"
|
| 60 |
+
#include "gmock/gmock-cardinalities.h"
|
| 61 |
+
#include "gmock/gmock-function-mocker.h"
|
| 62 |
+
#include "gmock/gmock-matchers.h"
|
| 63 |
+
#include "gmock/gmock-more-actions.h"
|
| 64 |
+
#include "gmock/gmock-more-matchers.h"
|
| 65 |
+
#include "gmock/gmock-nice-strict.h"
|
| 66 |
+
#include "gmock/internal/gmock-internal-utils.h"
|
| 67 |
+
|
| 68 |
+
namespace testing {
|
| 69 |
+
|
| 70 |
+
// Declares Google Mock flags that we want a user to use programmatically.
|
| 71 |
+
GMOCK_DECLARE_bool_(catch_leaked_mocks);
|
| 72 |
+
GMOCK_DECLARE_string_(verbose);
|
| 73 |
+
GMOCK_DECLARE_int32_(default_mock_behavior);
|
| 74 |
+
|
| 75 |
+
// Initializes Google Mock. This must be called before running the
|
| 76 |
+
// tests. In particular, it parses the command line for the flags
|
| 77 |
+
// that Google Mock recognizes. Whenever a Google Mock flag is seen,
|
| 78 |
+
// it is removed from argv, and *argc is decremented.
|
| 79 |
+
//
|
| 80 |
+
// No value is returned. Instead, the Google Mock flag variables are
|
| 81 |
+
// updated.
|
| 82 |
+
//
|
| 83 |
+
// Since Google Test is needed for Google Mock to work, this function
|
| 84 |
+
// also initializes Google Test and parses its flags, if that hasn't
|
| 85 |
+
// been done.
|
| 86 |
+
GTEST_API_ void InitGoogleMock(int* argc, char** argv);
|
| 87 |
+
|
| 88 |
+
// This overloaded version can be used in Windows programs compiled in
|
| 89 |
+
// UNICODE mode.
|
| 90 |
+
GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv);
|
| 91 |
+
|
| 92 |
+
// This overloaded version can be used on Arduino/embedded platforms where
|
| 93 |
+
// there is no argc/argv.
|
| 94 |
+
GTEST_API_ void InitGoogleMock();
|
| 95 |
+
|
| 96 |
+
} // namespace testing
|
| 97 |
+
|
| 98 |
+
#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-death-test.h
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2005, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
//
|
| 31 |
+
// The Google C++ Testing and Mocking Framework (Google Test)
|
| 32 |
+
//
|
| 33 |
+
// This header file defines the public API for death tests. It is
|
| 34 |
+
// #included by gtest.h so a user doesn't need to include this
|
| 35 |
+
// directly.
|
| 36 |
+
// GOOGLETEST_CM0001 DO NOT DELETE
|
| 37 |
+
|
| 38 |
+
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
|
| 39 |
+
#define GOOGLETEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
|
| 40 |
+
|
| 41 |
+
#include "gtest/internal/gtest-death-test-internal.h"
|
| 42 |
+
|
| 43 |
+
namespace testing {
|
| 44 |
+
|
| 45 |
+
// This flag controls the style of death tests. Valid values are "threadsafe",
|
| 46 |
+
// meaning that the death test child process will re-execute the test binary
|
| 47 |
+
// from the start, running only a single death test, or "fast",
|
| 48 |
+
// meaning that the child process will execute the test logic immediately
|
| 49 |
+
// after forking.
|
| 50 |
+
GTEST_DECLARE_string_(death_test_style);
|
| 51 |
+
|
| 52 |
+
#if GTEST_HAS_DEATH_TEST
|
| 53 |
+
|
| 54 |
+
namespace internal {
|
| 55 |
+
|
| 56 |
+
// Returns a Boolean value indicating whether the caller is currently
|
| 57 |
+
// executing in the context of the death test child process. Tools such as
|
| 58 |
+
// Valgrind heap checkers may need this to modify their behavior in death
|
| 59 |
+
// tests. IMPORTANT: This is an internal utility. Using it may break the
|
| 60 |
+
// implementation of death tests. User code MUST NOT use it.
|
| 61 |
+
GTEST_API_ bool InDeathTestChild();
|
| 62 |
+
|
| 63 |
+
} // namespace internal
|
| 64 |
+
|
| 65 |
+
// The following macros are useful for writing death tests.
|
| 66 |
+
|
| 67 |
+
// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
|
| 68 |
+
// executed:
|
| 69 |
+
//
|
| 70 |
+
// 1. It generates a warning if there is more than one active
|
| 71 |
+
// thread. This is because it's safe to fork() or clone() only
|
| 72 |
+
// when there is a single thread.
|
| 73 |
+
//
|
| 74 |
+
// 2. The parent process clone()s a sub-process and runs the death
|
| 75 |
+
// test in it; the sub-process exits with code 0 at the end of the
|
| 76 |
+
// death test, if it hasn't exited already.
|
| 77 |
+
//
|
| 78 |
+
// 3. The parent process waits for the sub-process to terminate.
|
| 79 |
+
//
|
| 80 |
+
// 4. The parent process checks the exit code and error message of
|
| 81 |
+
// the sub-process.
|
| 82 |
+
//
|
| 83 |
+
// Examples:
|
| 84 |
+
//
|
| 85 |
+
// ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
|
| 86 |
+
// for (int i = 0; i < 5; i++) {
|
| 87 |
+
// EXPECT_DEATH(server.ProcessRequest(i),
|
| 88 |
+
// "Invalid request .* in ProcessRequest()")
|
| 89 |
+
// << "Failed to die on request " << i;
|
| 90 |
+
// }
|
| 91 |
+
//
|
| 92 |
+
// ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
|
| 93 |
+
//
|
| 94 |
+
// bool KilledBySIGHUP(int exit_code) {
|
| 95 |
+
// return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
|
| 96 |
+
// }
|
| 97 |
+
//
|
| 98 |
+
// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
|
| 99 |
+
//
|
| 100 |
+
// The final parameter to each of these macros is a matcher applied to any data
|
| 101 |
+
// the sub-process wrote to stderr. For compatibility with existing tests, a
|
| 102 |
+
// bare string is interpreted as a regular expression matcher.
|
| 103 |
+
//
|
| 104 |
+
// On the regular expressions used in death tests:
|
| 105 |
+
//
|
| 106 |
+
// GOOGLETEST_CM0005 DO NOT DELETE
|
| 107 |
+
// On POSIX-compliant systems (*nix), we use the <regex.h> library,
|
| 108 |
+
// which uses the POSIX extended regex syntax.
|
| 109 |
+
//
|
| 110 |
+
// On other platforms (e.g. Windows or Mac), we only support a simple regex
|
| 111 |
+
// syntax implemented as part of Google Test. This limited
|
| 112 |
+
// implementation should be enough most of the time when writing
|
| 113 |
+
// death tests; though it lacks many features you can find in PCRE
|
| 114 |
+
// or POSIX extended regex syntax. For example, we don't support
|
| 115 |
+
// union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
|
| 116 |
+
// repetition count ("x{5,7}"), among others.
|
| 117 |
+
//
|
| 118 |
+
// Below is the syntax that we do support. We chose it to be a
|
| 119 |
+
// subset of both PCRE and POSIX extended regex, so it's easy to
|
| 120 |
+
// learn wherever you come from. In the following: 'A' denotes a
|
| 121 |
+
// literal character, period (.), or a single \\ escape sequence;
|
| 122 |
+
// 'x' and 'y' denote regular expressions; 'm' and 'n' are for
|
| 123 |
+
// natural numbers.
|
| 124 |
+
//
|
| 125 |
+
// c matches any literal character c
|
| 126 |
+
// \\d matches any decimal digit
|
| 127 |
+
// \\D matches any character that's not a decimal digit
|
| 128 |
+
// \\f matches \f
|
| 129 |
+
// \\n matches \n
|
| 130 |
+
// \\r matches \r
|
| 131 |
+
// \\s matches any ASCII whitespace, including \n
|
| 132 |
+
// \\S matches any character that's not a whitespace
|
| 133 |
+
// \\t matches \t
|
| 134 |
+
// \\v matches \v
|
| 135 |
+
// \\w matches any letter, _, or decimal digit
|
| 136 |
+
// \\W matches any character that \\w doesn't match
|
| 137 |
+
// \\c matches any literal character c, which must be a punctuation
|
| 138 |
+
// . matches any single character except \n
|
| 139 |
+
// A? matches 0 or 1 occurrences of A
|
| 140 |
+
// A* matches 0 or many occurrences of A
|
| 141 |
+
// A+ matches 1 or many occurrences of A
|
| 142 |
+
// ^ matches the beginning of a string (not that of each line)
|
| 143 |
+
// $ matches the end of a string (not that of each line)
|
| 144 |
+
// xy matches x followed by y
|
| 145 |
+
//
|
| 146 |
+
// If you accidentally use PCRE or POSIX extended regex features
|
| 147 |
+
// not implemented by us, you will get a run-time failure. In that
|
| 148 |
+
// case, please try to rewrite your regular expression within the
|
| 149 |
+
// above syntax.
|
| 150 |
+
//
|
| 151 |
+
// This implementation is *not* meant to be as highly tuned or robust
|
| 152 |
+
// as a compiled regex library, but should perform well enough for a
|
| 153 |
+
// death test, which already incurs significant overhead by launching
|
| 154 |
+
// a child process.
|
| 155 |
+
//
|
| 156 |
+
// Known caveats:
|
| 157 |
+
//
|
| 158 |
+
// A "threadsafe" style death test obtains the path to the test
|
| 159 |
+
// program from argv[0] and re-executes it in the sub-process. For
|
| 160 |
+
// simplicity, the current implementation doesn't search the PATH
|
| 161 |
+
// when launching the sub-process. This means that the user must
|
| 162 |
+
// invoke the test program via a path that contains at least one
|
| 163 |
+
// path separator (e.g. path/to/foo_test and
|
| 164 |
+
// /absolute/path/to/bar_test are fine, but foo_test is not). This
|
| 165 |
+
// is rarely a problem as people usually don't put the test binary
|
| 166 |
+
// directory in PATH.
|
| 167 |
+
//
|
| 168 |
+
|
| 169 |
+
// Asserts that a given `statement` causes the program to exit, with an
|
| 170 |
+
// integer exit status that satisfies `predicate`, and emitting error output
|
| 171 |
+
// that matches `matcher`.
|
| 172 |
+
# define ASSERT_EXIT(statement, predicate, matcher) \
|
| 173 |
+
GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_FATAL_FAILURE_)
|
| 174 |
+
|
| 175 |
+
// Like `ASSERT_EXIT`, but continues on to successive tests in the
|
| 176 |
+
// test suite, if any:
|
| 177 |
+
# define EXPECT_EXIT(statement, predicate, matcher) \
|
| 178 |
+
GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_NONFATAL_FAILURE_)
|
| 179 |
+
|
| 180 |
+
// Asserts that a given `statement` causes the program to exit, either by
|
| 181 |
+
// explicitly exiting with a nonzero exit code or being killed by a
|
| 182 |
+
// signal, and emitting error output that matches `matcher`.
|
| 183 |
+
# define ASSERT_DEATH(statement, matcher) \
|
| 184 |
+
ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
|
| 185 |
+
|
| 186 |
+
// Like `ASSERT_DEATH`, but continues on to successive tests in the
|
| 187 |
+
// test suite, if any:
|
| 188 |
+
# define EXPECT_DEATH(statement, matcher) \
|
| 189 |
+
EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
|
| 190 |
+
|
| 191 |
+
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
|
| 192 |
+
|
| 193 |
+
// Tests that an exit code describes a normal exit with a given exit code.
|
| 194 |
+
class GTEST_API_ ExitedWithCode {
|
| 195 |
+
public:
|
| 196 |
+
explicit ExitedWithCode(int exit_code);
|
| 197 |
+
ExitedWithCode(const ExitedWithCode&) = default;
|
| 198 |
+
void operator=(const ExitedWithCode& other) = delete;
|
| 199 |
+
bool operator()(int exit_status) const;
|
| 200 |
+
private:
|
| 201 |
+
const int exit_code_;
|
| 202 |
+
};
|
| 203 |
+
|
| 204 |
+
# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
|
| 205 |
+
// Tests that an exit code describes an exit due to termination by a
|
| 206 |
+
// given signal.
|
| 207 |
+
// GOOGLETEST_CM0006 DO NOT DELETE
|
| 208 |
+
class GTEST_API_ KilledBySignal {
|
| 209 |
+
public:
|
| 210 |
+
explicit KilledBySignal(int signum);
|
| 211 |
+
bool operator()(int exit_status) const;
|
| 212 |
+
private:
|
| 213 |
+
const int signum_;
|
| 214 |
+
};
|
| 215 |
+
# endif // !GTEST_OS_WINDOWS
|
| 216 |
+
|
| 217 |
+
// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
|
| 218 |
+
// The death testing framework causes this to have interesting semantics,
|
| 219 |
+
// since the sideeffects of the call are only visible in opt mode, and not
|
| 220 |
+
// in debug mode.
|
| 221 |
+
//
|
| 222 |
+
// In practice, this can be used to test functions that utilize the
|
| 223 |
+
// LOG(DFATAL) macro using the following style:
|
| 224 |
+
//
|
| 225 |
+
// int DieInDebugOr12(int* sideeffect) {
|
| 226 |
+
// if (sideeffect) {
|
| 227 |
+
// *sideeffect = 12;
|
| 228 |
+
// }
|
| 229 |
+
// LOG(DFATAL) << "death";
|
| 230 |
+
// return 12;
|
| 231 |
+
// }
|
| 232 |
+
//
|
| 233 |
+
// TEST(TestSuite, TestDieOr12WorksInDgbAndOpt) {
|
| 234 |
+
// int sideeffect = 0;
|
| 235 |
+
// // Only asserts in dbg.
|
| 236 |
+
// EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
|
| 237 |
+
//
|
| 238 |
+
// #ifdef NDEBUG
|
| 239 |
+
// // opt-mode has sideeffect visible.
|
| 240 |
+
// EXPECT_EQ(12, sideeffect);
|
| 241 |
+
// #else
|
| 242 |
+
// // dbg-mode no visible sideeffect.
|
| 243 |
+
// EXPECT_EQ(0, sideeffect);
|
| 244 |
+
// #endif
|
| 245 |
+
// }
|
| 246 |
+
//
|
| 247 |
+
// This will assert that DieInDebugReturn12InOpt() crashes in debug
|
| 248 |
+
// mode, usually due to a DCHECK or LOG(DFATAL), but returns the
|
| 249 |
+
// appropriate fallback value (12 in this case) in opt mode. If you
|
| 250 |
+
// need to test that a function has appropriate side-effects in opt
|
| 251 |
+
// mode, include assertions against the side-effects. A general
|
| 252 |
+
// pattern for this is:
|
| 253 |
+
//
|
| 254 |
+
// EXPECT_DEBUG_DEATH({
|
| 255 |
+
// // Side-effects here will have an effect after this statement in
|
| 256 |
+
// // opt mode, but none in debug mode.
|
| 257 |
+
// EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
|
| 258 |
+
// }, "death");
|
| 259 |
+
//
|
| 260 |
+
# ifdef NDEBUG
|
| 261 |
+
|
| 262 |
+
# define EXPECT_DEBUG_DEATH(statement, regex) \
|
| 263 |
+
GTEST_EXECUTE_STATEMENT_(statement, regex)
|
| 264 |
+
|
| 265 |
+
# define ASSERT_DEBUG_DEATH(statement, regex) \
|
| 266 |
+
GTEST_EXECUTE_STATEMENT_(statement, regex)
|
| 267 |
+
|
| 268 |
+
# else
|
| 269 |
+
|
| 270 |
+
# define EXPECT_DEBUG_DEATH(statement, regex) \
|
| 271 |
+
EXPECT_DEATH(statement, regex)
|
| 272 |
+
|
| 273 |
+
# define ASSERT_DEBUG_DEATH(statement, regex) \
|
| 274 |
+
ASSERT_DEATH(statement, regex)
|
| 275 |
+
|
| 276 |
+
# endif // NDEBUG for EXPECT_DEBUG_DEATH
|
| 277 |
+
#endif // GTEST_HAS_DEATH_TEST
|
| 278 |
+
|
| 279 |
+
// This macro is used for implementing macros such as
|
| 280 |
+
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
|
| 281 |
+
// death tests are not supported. Those macros must compile on such systems
|
| 282 |
+
// if and only if EXPECT_DEATH and ASSERT_DEATH compile with the same parameters
|
| 283 |
+
// on systems that support death tests. This allows one to write such a macro on
|
| 284 |
+
// a system that does not support death tests and be sure that it will compile
|
| 285 |
+
// on a death-test supporting system. It is exposed publicly so that systems
|
| 286 |
+
// that have death-tests with stricter requirements than GTEST_HAS_DEATH_TEST
|
| 287 |
+
// can write their own equivalent of EXPECT_DEATH_IF_SUPPORTED and
|
| 288 |
+
// ASSERT_DEATH_IF_SUPPORTED.
|
| 289 |
+
//
|
| 290 |
+
// Parameters:
|
| 291 |
+
// statement - A statement that a macro such as EXPECT_DEATH would test
|
| 292 |
+
// for program termination. This macro has to make sure this
|
| 293 |
+
// statement is compiled but not executed, to ensure that
|
| 294 |
+
// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
|
| 295 |
+
// parameter if and only if EXPECT_DEATH compiles with it.
|
| 296 |
+
// regex - A regex that a macro such as EXPECT_DEATH would use to test
|
| 297 |
+
// the output of statement. This parameter has to be
|
| 298 |
+
// compiled but not evaluated by this macro, to ensure that
|
| 299 |
+
// this macro only accepts expressions that a macro such as
|
| 300 |
+
// EXPECT_DEATH would accept.
|
| 301 |
+
// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
|
| 302 |
+
// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
|
| 303 |
+
// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
|
| 304 |
+
// compile inside functions where ASSERT_DEATH doesn't
|
| 305 |
+
// compile.
|
| 306 |
+
//
|
| 307 |
+
// The branch that has an always false condition is used to ensure that
|
| 308 |
+
// statement and regex are compiled (and thus syntactically correct) but
|
| 309 |
+
// never executed. The unreachable code macro protects the terminator
|
| 310 |
+
// statement from generating an 'unreachable code' warning in case
|
| 311 |
+
// statement unconditionally returns or throws. The Message constructor at
|
| 312 |
+
// the end allows the syntax of streaming additional messages into the
|
| 313 |
+
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
|
| 314 |
+
# define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
|
| 315 |
+
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
| 316 |
+
if (::testing::internal::AlwaysTrue()) { \
|
| 317 |
+
GTEST_LOG_(WARNING) \
|
| 318 |
+
<< "Death tests are not supported on this platform.\n" \
|
| 319 |
+
<< "Statement '" #statement "' cannot be verified."; \
|
| 320 |
+
} else if (::testing::internal::AlwaysFalse()) { \
|
| 321 |
+
::testing::internal::RE::PartialMatch(".*", (regex)); \
|
| 322 |
+
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
| 323 |
+
terminator; \
|
| 324 |
+
} else \
|
| 325 |
+
::testing::Message()
|
| 326 |
+
|
| 327 |
+
// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
|
| 328 |
+
// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
|
| 329 |
+
// death tests are supported; otherwise they just issue a warning. This is
|
| 330 |
+
// useful when you are combining death test assertions with normal test
|
| 331 |
+
// assertions in one test.
|
| 332 |
+
#if GTEST_HAS_DEATH_TEST
|
| 333 |
+
# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
| 334 |
+
EXPECT_DEATH(statement, regex)
|
| 335 |
+
# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
| 336 |
+
ASSERT_DEATH(statement, regex)
|
| 337 |
+
#else
|
| 338 |
+
# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
| 339 |
+
GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, )
|
| 340 |
+
# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
| 341 |
+
GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return)
|
| 342 |
+
#endif
|
| 343 |
+
|
| 344 |
+
} // namespace testing
|
| 345 |
+
|
| 346 |
+
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-matchers.h
ADDED
|
@@ -0,0 +1,930 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2007, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
// The Google C++ Testing and Mocking Framework (Google Test)
|
| 31 |
+
//
|
| 32 |
+
// This file implements just enough of the matcher interface to allow
|
| 33 |
+
// EXPECT_DEATH and friends to accept a matcher argument.
|
| 34 |
+
|
| 35 |
+
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
|
| 36 |
+
#define GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
|
| 37 |
+
|
| 38 |
+
#include <atomic>
|
| 39 |
+
#include <memory>
|
| 40 |
+
#include <ostream>
|
| 41 |
+
#include <string>
|
| 42 |
+
#include <type_traits>
|
| 43 |
+
|
| 44 |
+
#include "gtest/gtest-printers.h"
|
| 45 |
+
#include "gtest/internal/gtest-internal.h"
|
| 46 |
+
#include "gtest/internal/gtest-port.h"
|
| 47 |
+
|
| 48 |
+
// MSVC warning C5046 is new as of VS2017 version 15.8.
|
| 49 |
+
#if defined(_MSC_VER) && _MSC_VER >= 1915
|
| 50 |
+
#define GTEST_MAYBE_5046_ 5046
|
| 51 |
+
#else
|
| 52 |
+
#define GTEST_MAYBE_5046_
|
| 53 |
+
#endif
|
| 54 |
+
|
| 55 |
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(
|
| 56 |
+
4251 GTEST_MAYBE_5046_ /* class A needs to have dll-interface to be used by
|
| 57 |
+
clients of class B */
|
| 58 |
+
/* Symbol involving type with internal linkage not defined */)
|
| 59 |
+
|
| 60 |
+
namespace testing {
|
| 61 |
+
|
| 62 |
+
// To implement a matcher Foo for type T, define:
|
| 63 |
+
// 1. a class FooMatcherMatcher that implements the matcher interface:
|
| 64 |
+
// using is_gtest_matcher = void;
|
| 65 |
+
// bool MatchAndExplain(const T&, std::ostream*);
|
| 66 |
+
// (MatchResultListener* can also be used instead of std::ostream*)
|
| 67 |
+
// void DescribeTo(std::ostream*);
|
| 68 |
+
// void DescribeNegationTo(std::ostream*);
|
| 69 |
+
//
|
| 70 |
+
// 2. a factory function that creates a Matcher<T> object from a
|
| 71 |
+
// FooMatcherMatcher.
|
| 72 |
+
|
| 73 |
+
class MatchResultListener {
|
| 74 |
+
public:
|
| 75 |
+
// Creates a listener object with the given underlying ostream. The
|
| 76 |
+
// listener does not own the ostream, and does not dereference it
|
| 77 |
+
// in the constructor or destructor.
|
| 78 |
+
explicit MatchResultListener(::std::ostream* os) : stream_(os) {}
|
| 79 |
+
virtual ~MatchResultListener() = 0; // Makes this class abstract.
|
| 80 |
+
|
| 81 |
+
// Streams x to the underlying ostream; does nothing if the ostream
|
| 82 |
+
// is NULL.
|
| 83 |
+
template <typename T>
|
| 84 |
+
MatchResultListener& operator<<(const T& x) {
|
| 85 |
+
if (stream_ != nullptr) *stream_ << x;
|
| 86 |
+
return *this;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
// Returns the underlying ostream.
|
| 90 |
+
::std::ostream* stream() { return stream_; }
|
| 91 |
+
|
| 92 |
+
// Returns true if and only if the listener is interested in an explanation
|
| 93 |
+
// of the match result. A matcher's MatchAndExplain() method can use
|
| 94 |
+
// this information to avoid generating the explanation when no one
|
| 95 |
+
// intends to hear it.
|
| 96 |
+
bool IsInterested() const { return stream_ != nullptr; }
|
| 97 |
+
|
| 98 |
+
private:
|
| 99 |
+
::std::ostream* const stream_;
|
| 100 |
+
|
| 101 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener);
|
| 102 |
+
};
|
| 103 |
+
|
| 104 |
+
inline MatchResultListener::~MatchResultListener() {
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
// An instance of a subclass of this knows how to describe itself as a
|
| 108 |
+
// matcher.
|
| 109 |
+
class GTEST_API_ MatcherDescriberInterface {
|
| 110 |
+
public:
|
| 111 |
+
virtual ~MatcherDescriberInterface() {}
|
| 112 |
+
|
| 113 |
+
// Describes this matcher to an ostream. The function should print
|
| 114 |
+
// a verb phrase that describes the property a value matching this
|
| 115 |
+
// matcher should have. The subject of the verb phrase is the value
|
| 116 |
+
// being matched. For example, the DescribeTo() method of the Gt(7)
|
| 117 |
+
// matcher prints "is greater than 7".
|
| 118 |
+
virtual void DescribeTo(::std::ostream* os) const = 0;
|
| 119 |
+
|
| 120 |
+
// Describes the negation of this matcher to an ostream. For
|
| 121 |
+
// example, if the description of this matcher is "is greater than
|
| 122 |
+
// 7", the negated description could be "is not greater than 7".
|
| 123 |
+
// You are not required to override this when implementing
|
| 124 |
+
// MatcherInterface, but it is highly advised so that your matcher
|
| 125 |
+
// can produce good error messages.
|
| 126 |
+
virtual void DescribeNegationTo(::std::ostream* os) const {
|
| 127 |
+
*os << "not (";
|
| 128 |
+
DescribeTo(os);
|
| 129 |
+
*os << ")";
|
| 130 |
+
}
|
| 131 |
+
};
|
| 132 |
+
|
| 133 |
+
// The implementation of a matcher.
|
| 134 |
+
template <typename T>
|
| 135 |
+
class MatcherInterface : public MatcherDescriberInterface {
|
| 136 |
+
public:
|
| 137 |
+
// Returns true if and only if the matcher matches x; also explains the
|
| 138 |
+
// match result to 'listener' if necessary (see the next paragraph), in
|
| 139 |
+
// the form of a non-restrictive relative clause ("which ...",
|
| 140 |
+
// "whose ...", etc) that describes x. For example, the
|
| 141 |
+
// MatchAndExplain() method of the Pointee(...) matcher should
|
| 142 |
+
// generate an explanation like "which points to ...".
|
| 143 |
+
//
|
| 144 |
+
// Implementations of MatchAndExplain() should add an explanation of
|
| 145 |
+
// the match result *if and only if* they can provide additional
|
| 146 |
+
// information that's not already present (or not obvious) in the
|
| 147 |
+
// print-out of x and the matcher's description. Whether the match
|
| 148 |
+
// succeeds is not a factor in deciding whether an explanation is
|
| 149 |
+
// needed, as sometimes the caller needs to print a failure message
|
| 150 |
+
// when the match succeeds (e.g. when the matcher is used inside
|
| 151 |
+
// Not()).
|
| 152 |
+
//
|
| 153 |
+
// For example, a "has at least 10 elements" matcher should explain
|
| 154 |
+
// what the actual element count is, regardless of the match result,
|
| 155 |
+
// as it is useful information to the reader; on the other hand, an
|
| 156 |
+
// "is empty" matcher probably only needs to explain what the actual
|
| 157 |
+
// size is when the match fails, as it's redundant to say that the
|
| 158 |
+
// size is 0 when the value is already known to be empty.
|
| 159 |
+
//
|
| 160 |
+
// You should override this method when defining a new matcher.
|
| 161 |
+
//
|
| 162 |
+
// It's the responsibility of the caller (Google Test) to guarantee
|
| 163 |
+
// that 'listener' is not NULL. This helps to simplify a matcher's
|
| 164 |
+
// implementation when it doesn't care about the performance, as it
|
| 165 |
+
// can talk to 'listener' without checking its validity first.
|
| 166 |
+
// However, in order to implement dummy listeners efficiently,
|
| 167 |
+
// listener->stream() may be NULL.
|
| 168 |
+
virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0;
|
| 169 |
+
|
| 170 |
+
// Inherits these methods from MatcherDescriberInterface:
|
| 171 |
+
// virtual void DescribeTo(::std::ostream* os) const = 0;
|
| 172 |
+
// virtual void DescribeNegationTo(::std::ostream* os) const;
|
| 173 |
+
};
|
| 174 |
+
|
| 175 |
+
namespace internal {
|
| 176 |
+
|
| 177 |
+
struct AnyEq {
|
| 178 |
+
template <typename A, typename B>
|
| 179 |
+
bool operator()(const A& a, const B& b) const { return a == b; }
|
| 180 |
+
};
|
| 181 |
+
struct AnyNe {
|
| 182 |
+
template <typename A, typename B>
|
| 183 |
+
bool operator()(const A& a, const B& b) const { return a != b; }
|
| 184 |
+
};
|
| 185 |
+
struct AnyLt {
|
| 186 |
+
template <typename A, typename B>
|
| 187 |
+
bool operator()(const A& a, const B& b) const { return a < b; }
|
| 188 |
+
};
|
| 189 |
+
struct AnyGt {
|
| 190 |
+
template <typename A, typename B>
|
| 191 |
+
bool operator()(const A& a, const B& b) const { return a > b; }
|
| 192 |
+
};
|
| 193 |
+
struct AnyLe {
|
| 194 |
+
template <typename A, typename B>
|
| 195 |
+
bool operator()(const A& a, const B& b) const { return a <= b; }
|
| 196 |
+
};
|
| 197 |
+
struct AnyGe {
|
| 198 |
+
template <typename A, typename B>
|
| 199 |
+
bool operator()(const A& a, const B& b) const { return a >= b; }
|
| 200 |
+
};
|
| 201 |
+
|
| 202 |
+
// A match result listener that ignores the explanation.
|
| 203 |
+
class DummyMatchResultListener : public MatchResultListener {
|
| 204 |
+
public:
|
| 205 |
+
DummyMatchResultListener() : MatchResultListener(nullptr) {}
|
| 206 |
+
|
| 207 |
+
private:
|
| 208 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener);
|
| 209 |
+
};
|
| 210 |
+
|
| 211 |
+
// A match result listener that forwards the explanation to a given
|
| 212 |
+
// ostream. The difference between this and MatchResultListener is
|
| 213 |
+
// that the former is concrete.
|
| 214 |
+
class StreamMatchResultListener : public MatchResultListener {
|
| 215 |
+
public:
|
| 216 |
+
explicit StreamMatchResultListener(::std::ostream* os)
|
| 217 |
+
: MatchResultListener(os) {}
|
| 218 |
+
|
| 219 |
+
private:
|
| 220 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener);
|
| 221 |
+
};
|
| 222 |
+
|
| 223 |
+
struct SharedPayloadBase {
|
| 224 |
+
std::atomic<int> ref{1};
|
| 225 |
+
void Ref() { ref.fetch_add(1, std::memory_order_relaxed); }
|
| 226 |
+
bool Unref() { return ref.fetch_sub(1, std::memory_order_acq_rel) == 1; }
|
| 227 |
+
};
|
| 228 |
+
|
| 229 |
+
template <typename T>
|
| 230 |
+
struct SharedPayload : SharedPayloadBase {
|
| 231 |
+
explicit SharedPayload(const T& v) : value(v) {}
|
| 232 |
+
explicit SharedPayload(T&& v) : value(std::move(v)) {}
|
| 233 |
+
|
| 234 |
+
static void Destroy(SharedPayloadBase* shared) {
|
| 235 |
+
delete static_cast<SharedPayload*>(shared);
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
T value;
|
| 239 |
+
};
|
| 240 |
+
|
| 241 |
+
// An internal class for implementing Matcher<T>, which will derive
|
| 242 |
+
// from it. We put functionalities common to all Matcher<T>
|
| 243 |
+
// specializations here to avoid code duplication.
|
| 244 |
+
template <typename T>
|
| 245 |
+
class MatcherBase : private MatcherDescriberInterface {
|
| 246 |
+
public:
|
| 247 |
+
// Returns true if and only if the matcher matches x; also explains the
|
| 248 |
+
// match result to 'listener'.
|
| 249 |
+
bool MatchAndExplain(const T& x, MatchResultListener* listener) const {
|
| 250 |
+
GTEST_CHECK_(vtable_ != nullptr);
|
| 251 |
+
return vtable_->match_and_explain(*this, x, listener);
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
// Returns true if and only if this matcher matches x.
|
| 255 |
+
bool Matches(const T& x) const {
|
| 256 |
+
DummyMatchResultListener dummy;
|
| 257 |
+
return MatchAndExplain(x, &dummy);
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
// Describes this matcher to an ostream.
|
| 261 |
+
void DescribeTo(::std::ostream* os) const final {
|
| 262 |
+
GTEST_CHECK_(vtable_ != nullptr);
|
| 263 |
+
vtable_->describe(*this, os, false);
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
// Describes the negation of this matcher to an ostream.
|
| 267 |
+
void DescribeNegationTo(::std::ostream* os) const final {
|
| 268 |
+
GTEST_CHECK_(vtable_ != nullptr);
|
| 269 |
+
vtable_->describe(*this, os, true);
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
// Explains why x matches, or doesn't match, the matcher.
|
| 273 |
+
void ExplainMatchResultTo(const T& x, ::std::ostream* os) const {
|
| 274 |
+
StreamMatchResultListener listener(os);
|
| 275 |
+
MatchAndExplain(x, &listener);
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
// Returns the describer for this matcher object; retains ownership
|
| 279 |
+
// of the describer, which is only guaranteed to be alive when
|
| 280 |
+
// this matcher object is alive.
|
| 281 |
+
const MatcherDescriberInterface* GetDescriber() const {
|
| 282 |
+
if (vtable_ == nullptr) return nullptr;
|
| 283 |
+
return vtable_->get_describer(*this);
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
protected:
|
| 287 |
+
MatcherBase() : vtable_(nullptr) {}
|
| 288 |
+
|
| 289 |
+
// Constructs a matcher from its implementation.
|
| 290 |
+
template <typename U>
|
| 291 |
+
explicit MatcherBase(const MatcherInterface<U>* impl) {
|
| 292 |
+
Init(impl);
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
template <typename M, typename = typename std::remove_reference<
|
| 296 |
+
M>::type::is_gtest_matcher>
|
| 297 |
+
MatcherBase(M&& m) { // NOLINT
|
| 298 |
+
Init(std::forward<M>(m));
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
MatcherBase(const MatcherBase& other)
|
| 302 |
+
: vtable_(other.vtable_), buffer_(other.buffer_) {
|
| 303 |
+
if (IsShared()) buffer_.shared->Ref();
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
MatcherBase& operator=(const MatcherBase& other) {
|
| 307 |
+
if (this == &other) return *this;
|
| 308 |
+
Destroy();
|
| 309 |
+
vtable_ = other.vtable_;
|
| 310 |
+
buffer_ = other.buffer_;
|
| 311 |
+
if (IsShared()) buffer_.shared->Ref();
|
| 312 |
+
return *this;
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
MatcherBase(MatcherBase&& other)
|
| 316 |
+
: vtable_(other.vtable_), buffer_(other.buffer_) {
|
| 317 |
+
other.vtable_ = nullptr;
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
MatcherBase& operator=(MatcherBase&& other) {
|
| 321 |
+
if (this == &other) return *this;
|
| 322 |
+
Destroy();
|
| 323 |
+
vtable_ = other.vtable_;
|
| 324 |
+
buffer_ = other.buffer_;
|
| 325 |
+
other.vtable_ = nullptr;
|
| 326 |
+
return *this;
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
~MatcherBase() override { Destroy(); }
|
| 330 |
+
|
| 331 |
+
private:
|
| 332 |
+
struct VTable {
|
| 333 |
+
bool (*match_and_explain)(const MatcherBase&, const T&,
|
| 334 |
+
MatchResultListener*);
|
| 335 |
+
void (*describe)(const MatcherBase&, std::ostream*, bool negation);
|
| 336 |
+
// Returns the captured object if it implements the interface, otherwise
|
| 337 |
+
// returns the MatcherBase itself.
|
| 338 |
+
const MatcherDescriberInterface* (*get_describer)(const MatcherBase&);
|
| 339 |
+
// Called on shared instances when the reference count reaches 0.
|
| 340 |
+
void (*shared_destroy)(SharedPayloadBase*);
|
| 341 |
+
};
|
| 342 |
+
|
| 343 |
+
bool IsShared() const {
|
| 344 |
+
return vtable_ != nullptr && vtable_->shared_destroy != nullptr;
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
// If the implementation uses a listener, call that.
|
| 348 |
+
template <typename P>
|
| 349 |
+
static auto MatchAndExplainImpl(const MatcherBase& m, const T& value,
|
| 350 |
+
MatchResultListener* listener)
|
| 351 |
+
-> decltype(P::Get(m).MatchAndExplain(value, listener->stream())) {
|
| 352 |
+
return P::Get(m).MatchAndExplain(value, listener->stream());
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
template <typename P>
|
| 356 |
+
static auto MatchAndExplainImpl(const MatcherBase& m, const T& value,
|
| 357 |
+
MatchResultListener* listener)
|
| 358 |
+
-> decltype(P::Get(m).MatchAndExplain(value, listener)) {
|
| 359 |
+
return P::Get(m).MatchAndExplain(value, listener);
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
template <typename P>
|
| 363 |
+
static void DescribeImpl(const MatcherBase& m, std::ostream* os,
|
| 364 |
+
bool negation) {
|
| 365 |
+
if (negation) {
|
| 366 |
+
P::Get(m).DescribeNegationTo(os);
|
| 367 |
+
} else {
|
| 368 |
+
P::Get(m).DescribeTo(os);
|
| 369 |
+
}
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
template <typename P>
|
| 373 |
+
static const MatcherDescriberInterface* GetDescriberImpl(
|
| 374 |
+
const MatcherBase& m) {
|
| 375 |
+
// If the impl is a MatcherDescriberInterface, then return it.
|
| 376 |
+
// Otherwise use MatcherBase itself.
|
| 377 |
+
// This allows us to implement the GetDescriber() function without support
|
| 378 |
+
// from the impl, but some users really want to get their impl back when
|
| 379 |
+
// they call GetDescriber().
|
| 380 |
+
// We use std::get on a tuple as a workaround of not having `if constexpr`.
|
| 381 |
+
return std::get<(
|
| 382 |
+
std::is_convertible<decltype(&P::Get(m)),
|
| 383 |
+
const MatcherDescriberInterface*>::value
|
| 384 |
+
? 1
|
| 385 |
+
: 0)>(std::make_tuple(&m, &P::Get(m)));
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
template <typename P>
|
| 389 |
+
const VTable* GetVTable() {
|
| 390 |
+
static constexpr VTable kVTable = {&MatchAndExplainImpl<P>,
|
| 391 |
+
&DescribeImpl<P>, &GetDescriberImpl<P>,
|
| 392 |
+
P::shared_destroy};
|
| 393 |
+
return &kVTable;
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
union Buffer {
|
| 397 |
+
// Add some types to give Buffer some common alignment/size use cases.
|
| 398 |
+
void* ptr;
|
| 399 |
+
double d;
|
| 400 |
+
int64_t i;
|
| 401 |
+
// And add one for the out-of-line cases.
|
| 402 |
+
SharedPayloadBase* shared;
|
| 403 |
+
};
|
| 404 |
+
|
| 405 |
+
void Destroy() {
|
| 406 |
+
if (IsShared() && buffer_.shared->Unref()) {
|
| 407 |
+
vtable_->shared_destroy(buffer_.shared);
|
| 408 |
+
}
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
template <typename M>
|
| 412 |
+
static constexpr bool IsInlined() {
|
| 413 |
+
return sizeof(M) <= sizeof(Buffer) && alignof(M) <= alignof(Buffer) &&
|
| 414 |
+
std::is_trivially_copy_constructible<M>::value &&
|
| 415 |
+
std::is_trivially_destructible<M>::value;
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
template <typename M, bool = MatcherBase::IsInlined<M>()>
|
| 419 |
+
struct ValuePolicy {
|
| 420 |
+
static const M& Get(const MatcherBase& m) {
|
| 421 |
+
// When inlined along with Init, need to be explicit to avoid violating
|
| 422 |
+
// strict aliasing rules.
|
| 423 |
+
const M *ptr = static_cast<const M*>(
|
| 424 |
+
static_cast<const void*>(&m.buffer_));
|
| 425 |
+
return *ptr;
|
| 426 |
+
}
|
| 427 |
+
static void Init(MatcherBase& m, M impl) {
|
| 428 |
+
::new (static_cast<void*>(&m.buffer_)) M(impl);
|
| 429 |
+
}
|
| 430 |
+
static constexpr auto shared_destroy = nullptr;
|
| 431 |
+
};
|
| 432 |
+
|
| 433 |
+
template <typename M>
|
| 434 |
+
struct ValuePolicy<M, false> {
|
| 435 |
+
using Shared = SharedPayload<M>;
|
| 436 |
+
static const M& Get(const MatcherBase& m) {
|
| 437 |
+
return static_cast<Shared*>(m.buffer_.shared)->value;
|
| 438 |
+
}
|
| 439 |
+
template <typename Arg>
|
| 440 |
+
static void Init(MatcherBase& m, Arg&& arg) {
|
| 441 |
+
m.buffer_.shared = new Shared(std::forward<Arg>(arg));
|
| 442 |
+
}
|
| 443 |
+
static constexpr auto shared_destroy = &Shared::Destroy;
|
| 444 |
+
};
|
| 445 |
+
|
| 446 |
+
template <typename U, bool B>
|
| 447 |
+
struct ValuePolicy<const MatcherInterface<U>*, B> {
|
| 448 |
+
using M = const MatcherInterface<U>;
|
| 449 |
+
using Shared = SharedPayload<std::unique_ptr<M>>;
|
| 450 |
+
static const M& Get(const MatcherBase& m) {
|
| 451 |
+
return *static_cast<Shared*>(m.buffer_.shared)->value;
|
| 452 |
+
}
|
| 453 |
+
static void Init(MatcherBase& m, M* impl) {
|
| 454 |
+
m.buffer_.shared = new Shared(std::unique_ptr<M>(impl));
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
static constexpr auto shared_destroy = &Shared::Destroy;
|
| 458 |
+
};
|
| 459 |
+
|
| 460 |
+
template <typename M>
|
| 461 |
+
void Init(M&& m) {
|
| 462 |
+
using MM = typename std::decay<M>::type;
|
| 463 |
+
using Policy = ValuePolicy<MM>;
|
| 464 |
+
vtable_ = GetVTable<Policy>();
|
| 465 |
+
Policy::Init(*this, std::forward<M>(m));
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
const VTable* vtable_;
|
| 469 |
+
Buffer buffer_;
|
| 470 |
+
};
|
| 471 |
+
|
| 472 |
+
} // namespace internal
|
| 473 |
+
|
| 474 |
+
// A Matcher<T> is a copyable and IMMUTABLE (except by assignment)
|
| 475 |
+
// object that can check whether a value of type T matches. The
|
| 476 |
+
// implementation of Matcher<T> is just a std::shared_ptr to const
|
| 477 |
+
// MatcherInterface<T>. Don't inherit from Matcher!
|
| 478 |
+
template <typename T>
|
| 479 |
+
class Matcher : public internal::MatcherBase<T> {
|
| 480 |
+
public:
|
| 481 |
+
// Constructs a null matcher. Needed for storing Matcher objects in STL
|
| 482 |
+
// containers. A default-constructed matcher is not yet initialized. You
|
| 483 |
+
// cannot use it until a valid value has been assigned to it.
|
| 484 |
+
explicit Matcher() {} // NOLINT
|
| 485 |
+
|
| 486 |
+
// Constructs a matcher from its implementation.
|
| 487 |
+
explicit Matcher(const MatcherInterface<const T&>* impl)
|
| 488 |
+
: internal::MatcherBase<T>(impl) {}
|
| 489 |
+
|
| 490 |
+
template <typename U>
|
| 491 |
+
explicit Matcher(
|
| 492 |
+
const MatcherInterface<U>* impl,
|
| 493 |
+
typename std::enable_if<!std::is_same<U, const U&>::value>::type* =
|
| 494 |
+
nullptr)
|
| 495 |
+
: internal::MatcherBase<T>(impl) {}
|
| 496 |
+
|
| 497 |
+
template <typename M, typename = typename std::remove_reference<
|
| 498 |
+
M>::type::is_gtest_matcher>
|
| 499 |
+
Matcher(M&& m) : internal::MatcherBase<T>(std::forward<M>(m)) {} // NOLINT
|
| 500 |
+
|
| 501 |
+
// Implicit constructor here allows people to write
|
| 502 |
+
// EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes
|
| 503 |
+
Matcher(T value); // NOLINT
|
| 504 |
+
};
|
| 505 |
+
|
| 506 |
+
// The following two specializations allow the user to write str
|
| 507 |
+
// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string
|
| 508 |
+
// matcher is expected.
|
| 509 |
+
template <>
|
| 510 |
+
class GTEST_API_ Matcher<const std::string&>
|
| 511 |
+
: public internal::MatcherBase<const std::string&> {
|
| 512 |
+
public:
|
| 513 |
+
Matcher() {}
|
| 514 |
+
|
| 515 |
+
explicit Matcher(const MatcherInterface<const std::string&>* impl)
|
| 516 |
+
: internal::MatcherBase<const std::string&>(impl) {}
|
| 517 |
+
|
| 518 |
+
template <typename M, typename = typename std::remove_reference<
|
| 519 |
+
M>::type::is_gtest_matcher>
|
| 520 |
+
Matcher(M&& m) // NOLINT
|
| 521 |
+
: internal::MatcherBase<const std::string&>(std::forward<M>(m)) {}
|
| 522 |
+
|
| 523 |
+
// Allows the user to write str instead of Eq(str) sometimes, where
|
| 524 |
+
// str is a std::string object.
|
| 525 |
+
Matcher(const std::string& s); // NOLINT
|
| 526 |
+
|
| 527 |
+
// Allows the user to write "foo" instead of Eq("foo") sometimes.
|
| 528 |
+
Matcher(const char* s); // NOLINT
|
| 529 |
+
};
|
| 530 |
+
|
| 531 |
+
template <>
|
| 532 |
+
class GTEST_API_ Matcher<std::string>
|
| 533 |
+
: public internal::MatcherBase<std::string> {
|
| 534 |
+
public:
|
| 535 |
+
Matcher() {}
|
| 536 |
+
|
| 537 |
+
explicit Matcher(const MatcherInterface<const std::string&>* impl)
|
| 538 |
+
: internal::MatcherBase<std::string>(impl) {}
|
| 539 |
+
explicit Matcher(const MatcherInterface<std::string>* impl)
|
| 540 |
+
: internal::MatcherBase<std::string>(impl) {}
|
| 541 |
+
|
| 542 |
+
template <typename M, typename = typename std::remove_reference<
|
| 543 |
+
M>::type::is_gtest_matcher>
|
| 544 |
+
Matcher(M&& m) // NOLINT
|
| 545 |
+
: internal::MatcherBase<std::string>(std::forward<M>(m)) {}
|
| 546 |
+
|
| 547 |
+
// Allows the user to write str instead of Eq(str) sometimes, where
|
| 548 |
+
// str is a string object.
|
| 549 |
+
Matcher(const std::string& s); // NOLINT
|
| 550 |
+
|
| 551 |
+
// Allows the user to write "foo" instead of Eq("foo") sometimes.
|
| 552 |
+
Matcher(const char* s); // NOLINT
|
| 553 |
+
};
|
| 554 |
+
|
| 555 |
+
#if GTEST_INTERNAL_HAS_STRING_VIEW
|
| 556 |
+
// The following two specializations allow the user to write str
|
| 557 |
+
// instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
|
| 558 |
+
// matcher is expected.
|
| 559 |
+
template <>
|
| 560 |
+
class GTEST_API_ Matcher<const internal::StringView&>
|
| 561 |
+
: public internal::MatcherBase<const internal::StringView&> {
|
| 562 |
+
public:
|
| 563 |
+
Matcher() {}
|
| 564 |
+
|
| 565 |
+
explicit Matcher(const MatcherInterface<const internal::StringView&>* impl)
|
| 566 |
+
: internal::MatcherBase<const internal::StringView&>(impl) {}
|
| 567 |
+
|
| 568 |
+
template <typename M, typename = typename std::remove_reference<
|
| 569 |
+
M>::type::is_gtest_matcher>
|
| 570 |
+
Matcher(M&& m) // NOLINT
|
| 571 |
+
: internal::MatcherBase<const internal::StringView&>(std::forward<M>(m)) {
|
| 572 |
+
}
|
| 573 |
+
|
| 574 |
+
// Allows the user to write str instead of Eq(str) sometimes, where
|
| 575 |
+
// str is a std::string object.
|
| 576 |
+
Matcher(const std::string& s); // NOLINT
|
| 577 |
+
|
| 578 |
+
// Allows the user to write "foo" instead of Eq("foo") sometimes.
|
| 579 |
+
Matcher(const char* s); // NOLINT
|
| 580 |
+
|
| 581 |
+
// Allows the user to pass absl::string_views or std::string_views directly.
|
| 582 |
+
Matcher(internal::StringView s); // NOLINT
|
| 583 |
+
};
|
| 584 |
+
|
| 585 |
+
template <>
|
| 586 |
+
class GTEST_API_ Matcher<internal::StringView>
|
| 587 |
+
: public internal::MatcherBase<internal::StringView> {
|
| 588 |
+
public:
|
| 589 |
+
Matcher() {}
|
| 590 |
+
|
| 591 |
+
explicit Matcher(const MatcherInterface<const internal::StringView&>* impl)
|
| 592 |
+
: internal::MatcherBase<internal::StringView>(impl) {}
|
| 593 |
+
explicit Matcher(const MatcherInterface<internal::StringView>* impl)
|
| 594 |
+
: internal::MatcherBase<internal::StringView>(impl) {}
|
| 595 |
+
|
| 596 |
+
template <typename M, typename = typename std::remove_reference<
|
| 597 |
+
M>::type::is_gtest_matcher>
|
| 598 |
+
Matcher(M&& m) // NOLINT
|
| 599 |
+
: internal::MatcherBase<internal::StringView>(std::forward<M>(m)) {}
|
| 600 |
+
|
| 601 |
+
// Allows the user to write str instead of Eq(str) sometimes, where
|
| 602 |
+
// str is a std::string object.
|
| 603 |
+
Matcher(const std::string& s); // NOLINT
|
| 604 |
+
|
| 605 |
+
// Allows the user to write "foo" instead of Eq("foo") sometimes.
|
| 606 |
+
Matcher(const char* s); // NOLINT
|
| 607 |
+
|
| 608 |
+
// Allows the user to pass absl::string_views or std::string_views directly.
|
| 609 |
+
Matcher(internal::StringView s); // NOLINT
|
| 610 |
+
};
|
| 611 |
+
#endif // GTEST_INTERNAL_HAS_STRING_VIEW
|
| 612 |
+
|
| 613 |
+
// Prints a matcher in a human-readable format.
|
| 614 |
+
template <typename T>
|
| 615 |
+
std::ostream& operator<<(std::ostream& os, const Matcher<T>& matcher) {
|
| 616 |
+
matcher.DescribeTo(&os);
|
| 617 |
+
return os;
|
| 618 |
+
}
|
| 619 |
+
|
| 620 |
+
// The PolymorphicMatcher class template makes it easy to implement a
|
| 621 |
+
// polymorphic matcher (i.e. a matcher that can match values of more
|
| 622 |
+
// than one type, e.g. Eq(n) and NotNull()).
|
| 623 |
+
//
|
| 624 |
+
// To define a polymorphic matcher, a user should provide an Impl
|
| 625 |
+
// class that has a DescribeTo() method and a DescribeNegationTo()
|
| 626 |
+
// method, and define a member function (or member function template)
|
| 627 |
+
//
|
| 628 |
+
// bool MatchAndExplain(const Value& value,
|
| 629 |
+
// MatchResultListener* listener) const;
|
| 630 |
+
//
|
| 631 |
+
// See the definition of NotNull() for a complete example.
|
| 632 |
+
template <class Impl>
|
| 633 |
+
class PolymorphicMatcher {
|
| 634 |
+
public:
|
| 635 |
+
explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {}
|
| 636 |
+
|
| 637 |
+
// Returns a mutable reference to the underlying matcher
|
| 638 |
+
// implementation object.
|
| 639 |
+
Impl& mutable_impl() { return impl_; }
|
| 640 |
+
|
| 641 |
+
// Returns an immutable reference to the underlying matcher
|
| 642 |
+
// implementation object.
|
| 643 |
+
const Impl& impl() const { return impl_; }
|
| 644 |
+
|
| 645 |
+
template <typename T>
|
| 646 |
+
operator Matcher<T>() const {
|
| 647 |
+
return Matcher<T>(new MonomorphicImpl<const T&>(impl_));
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
private:
|
| 651 |
+
template <typename T>
|
| 652 |
+
class MonomorphicImpl : public MatcherInterface<T> {
|
| 653 |
+
public:
|
| 654 |
+
explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
|
| 655 |
+
|
| 656 |
+
void DescribeTo(::std::ostream* os) const override { impl_.DescribeTo(os); }
|
| 657 |
+
|
| 658 |
+
void DescribeNegationTo(::std::ostream* os) const override {
|
| 659 |
+
impl_.DescribeNegationTo(os);
|
| 660 |
+
}
|
| 661 |
+
|
| 662 |
+
bool MatchAndExplain(T x, MatchResultListener* listener) const override {
|
| 663 |
+
return impl_.MatchAndExplain(x, listener);
|
| 664 |
+
}
|
| 665 |
+
|
| 666 |
+
private:
|
| 667 |
+
const Impl impl_;
|
| 668 |
+
};
|
| 669 |
+
|
| 670 |
+
Impl impl_;
|
| 671 |
+
};
|
| 672 |
+
|
| 673 |
+
// Creates a matcher from its implementation.
|
| 674 |
+
// DEPRECATED: Especially in the generic code, prefer:
|
| 675 |
+
// Matcher<T>(new MyMatcherImpl<const T&>(...));
|
| 676 |
+
//
|
| 677 |
+
// MakeMatcher may create a Matcher that accepts its argument by value, which
|
| 678 |
+
// leads to unnecessary copies & lack of support for non-copyable types.
|
| 679 |
+
template <typename T>
|
| 680 |
+
inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) {
|
| 681 |
+
return Matcher<T>(impl);
|
| 682 |
+
}
|
| 683 |
+
|
| 684 |
+
// Creates a polymorphic matcher from its implementation. This is
|
| 685 |
+
// easier to use than the PolymorphicMatcher<Impl> constructor as it
|
| 686 |
+
// doesn't require you to explicitly write the template argument, e.g.
|
| 687 |
+
//
|
| 688 |
+
// MakePolymorphicMatcher(foo);
|
| 689 |
+
// vs
|
| 690 |
+
// PolymorphicMatcher<TypeOfFoo>(foo);
|
| 691 |
+
template <class Impl>
|
| 692 |
+
inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) {
|
| 693 |
+
return PolymorphicMatcher<Impl>(impl);
|
| 694 |
+
}
|
| 695 |
+
|
| 696 |
+
namespace internal {
|
| 697 |
+
// Implements a matcher that compares a given value with a
|
| 698 |
+
// pre-supplied value using one of the ==, <=, <, etc, operators. The
|
| 699 |
+
// two values being compared don't have to have the same type.
|
| 700 |
+
//
|
| 701 |
+
// The matcher defined here is polymorphic (for example, Eq(5) can be
|
| 702 |
+
// used to match an int, a short, a double, etc). Therefore we use
|
| 703 |
+
// a template type conversion operator in the implementation.
|
| 704 |
+
//
|
| 705 |
+
// The following template definition assumes that the Rhs parameter is
|
| 706 |
+
// a "bare" type (i.e. neither 'const T' nor 'T&').
|
| 707 |
+
template <typename D, typename Rhs, typename Op>
|
| 708 |
+
class ComparisonBase {
|
| 709 |
+
public:
|
| 710 |
+
explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {}
|
| 711 |
+
|
| 712 |
+
using is_gtest_matcher = void;
|
| 713 |
+
|
| 714 |
+
template <typename Lhs>
|
| 715 |
+
bool MatchAndExplain(const Lhs& lhs, std::ostream*) const {
|
| 716 |
+
return Op()(lhs, Unwrap(rhs_));
|
| 717 |
+
}
|
| 718 |
+
void DescribeTo(std::ostream* os) const {
|
| 719 |
+
*os << D::Desc() << " ";
|
| 720 |
+
UniversalPrint(Unwrap(rhs_), os);
|
| 721 |
+
}
|
| 722 |
+
void DescribeNegationTo(std::ostream* os) const {
|
| 723 |
+
*os << D::NegatedDesc() << " ";
|
| 724 |
+
UniversalPrint(Unwrap(rhs_), os);
|
| 725 |
+
}
|
| 726 |
+
|
| 727 |
+
private:
|
| 728 |
+
template <typename T>
|
| 729 |
+
static const T& Unwrap(const T& v) {
|
| 730 |
+
return v;
|
| 731 |
+
}
|
| 732 |
+
template <typename T>
|
| 733 |
+
static const T& Unwrap(std::reference_wrapper<T> v) {
|
| 734 |
+
return v;
|
| 735 |
+
}
|
| 736 |
+
|
| 737 |
+
Rhs rhs_;
|
| 738 |
+
};
|
| 739 |
+
|
| 740 |
+
template <typename Rhs>
|
| 741 |
+
class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq> {
|
| 742 |
+
public:
|
| 743 |
+
explicit EqMatcher(const Rhs& rhs)
|
| 744 |
+
: ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq>(rhs) { }
|
| 745 |
+
static const char* Desc() { return "is equal to"; }
|
| 746 |
+
static const char* NegatedDesc() { return "isn't equal to"; }
|
| 747 |
+
};
|
| 748 |
+
template <typename Rhs>
|
| 749 |
+
class NeMatcher : public ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe> {
|
| 750 |
+
public:
|
| 751 |
+
explicit NeMatcher(const Rhs& rhs)
|
| 752 |
+
: ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe>(rhs) { }
|
| 753 |
+
static const char* Desc() { return "isn't equal to"; }
|
| 754 |
+
static const char* NegatedDesc() { return "is equal to"; }
|
| 755 |
+
};
|
| 756 |
+
template <typename Rhs>
|
| 757 |
+
class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt> {
|
| 758 |
+
public:
|
| 759 |
+
explicit LtMatcher(const Rhs& rhs)
|
| 760 |
+
: ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt>(rhs) { }
|
| 761 |
+
static const char* Desc() { return "is <"; }
|
| 762 |
+
static const char* NegatedDesc() { return "isn't <"; }
|
| 763 |
+
};
|
| 764 |
+
template <typename Rhs>
|
| 765 |
+
class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt> {
|
| 766 |
+
public:
|
| 767 |
+
explicit GtMatcher(const Rhs& rhs)
|
| 768 |
+
: ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt>(rhs) { }
|
| 769 |
+
static const char* Desc() { return "is >"; }
|
| 770 |
+
static const char* NegatedDesc() { return "isn't >"; }
|
| 771 |
+
};
|
| 772 |
+
template <typename Rhs>
|
| 773 |
+
class LeMatcher : public ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe> {
|
| 774 |
+
public:
|
| 775 |
+
explicit LeMatcher(const Rhs& rhs)
|
| 776 |
+
: ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe>(rhs) { }
|
| 777 |
+
static const char* Desc() { return "is <="; }
|
| 778 |
+
static const char* NegatedDesc() { return "isn't <="; }
|
| 779 |
+
};
|
| 780 |
+
template <typename Rhs>
|
| 781 |
+
class GeMatcher : public ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe> {
|
| 782 |
+
public:
|
| 783 |
+
explicit GeMatcher(const Rhs& rhs)
|
| 784 |
+
: ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe>(rhs) { }
|
| 785 |
+
static const char* Desc() { return "is >="; }
|
| 786 |
+
static const char* NegatedDesc() { return "isn't >="; }
|
| 787 |
+
};
|
| 788 |
+
|
| 789 |
+
template <typename T, typename = typename std::enable_if<
|
| 790 |
+
std::is_constructible<std::string, T>::value>::type>
|
| 791 |
+
using StringLike = T;
|
| 792 |
+
|
| 793 |
+
// Implements polymorphic matchers MatchesRegex(regex) and
|
| 794 |
+
// ContainsRegex(regex), which can be used as a Matcher<T> as long as
|
| 795 |
+
// T can be converted to a string.
|
| 796 |
+
class MatchesRegexMatcher {
|
| 797 |
+
public:
|
| 798 |
+
MatchesRegexMatcher(const RE* regex, bool full_match)
|
| 799 |
+
: regex_(regex), full_match_(full_match) {}
|
| 800 |
+
|
| 801 |
+
#if GTEST_INTERNAL_HAS_STRING_VIEW
|
| 802 |
+
bool MatchAndExplain(const internal::StringView& s,
|
| 803 |
+
MatchResultListener* listener) const {
|
| 804 |
+
return MatchAndExplain(std::string(s), listener);
|
| 805 |
+
}
|
| 806 |
+
#endif // GTEST_INTERNAL_HAS_STRING_VIEW
|
| 807 |
+
|
| 808 |
+
// Accepts pointer types, particularly:
|
| 809 |
+
// const char*
|
| 810 |
+
// char*
|
| 811 |
+
// const wchar_t*
|
| 812 |
+
// wchar_t*
|
| 813 |
+
template <typename CharType>
|
| 814 |
+
bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
|
| 815 |
+
return s != nullptr && MatchAndExplain(std::string(s), listener);
|
| 816 |
+
}
|
| 817 |
+
|
| 818 |
+
// Matches anything that can convert to std::string.
|
| 819 |
+
//
|
| 820 |
+
// This is a template, not just a plain function with const std::string&,
|
| 821 |
+
// because absl::string_view has some interfering non-explicit constructors.
|
| 822 |
+
template <class MatcheeStringType>
|
| 823 |
+
bool MatchAndExplain(const MatcheeStringType& s,
|
| 824 |
+
MatchResultListener* /* listener */) const {
|
| 825 |
+
const std::string& s2(s);
|
| 826 |
+
return full_match_ ? RE::FullMatch(s2, *regex_)
|
| 827 |
+
: RE::PartialMatch(s2, *regex_);
|
| 828 |
+
}
|
| 829 |
+
|
| 830 |
+
void DescribeTo(::std::ostream* os) const {
|
| 831 |
+
*os << (full_match_ ? "matches" : "contains") << " regular expression ";
|
| 832 |
+
UniversalPrinter<std::string>::Print(regex_->pattern(), os);
|
| 833 |
+
}
|
| 834 |
+
|
| 835 |
+
void DescribeNegationTo(::std::ostream* os) const {
|
| 836 |
+
*os << "doesn't " << (full_match_ ? "match" : "contain")
|
| 837 |
+
<< " regular expression ";
|
| 838 |
+
UniversalPrinter<std::string>::Print(regex_->pattern(), os);
|
| 839 |
+
}
|
| 840 |
+
|
| 841 |
+
private:
|
| 842 |
+
const std::shared_ptr<const RE> regex_;
|
| 843 |
+
const bool full_match_;
|
| 844 |
+
};
|
| 845 |
+
} // namespace internal
|
| 846 |
+
|
| 847 |
+
// Matches a string that fully matches regular expression 'regex'.
|
| 848 |
+
// The matcher takes ownership of 'regex'.
|
| 849 |
+
inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
|
| 850 |
+
const internal::RE* regex) {
|
| 851 |
+
return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
|
| 852 |
+
}
|
| 853 |
+
template <typename T = std::string>
|
| 854 |
+
PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
|
| 855 |
+
const internal::StringLike<T>& regex) {
|
| 856 |
+
return MatchesRegex(new internal::RE(std::string(regex)));
|
| 857 |
+
}
|
| 858 |
+
|
| 859 |
+
// Matches a string that contains regular expression 'regex'.
|
| 860 |
+
// The matcher takes ownership of 'regex'.
|
| 861 |
+
inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
|
| 862 |
+
const internal::RE* regex) {
|
| 863 |
+
return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
|
| 864 |
+
}
|
| 865 |
+
template <typename T = std::string>
|
| 866 |
+
PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
|
| 867 |
+
const internal::StringLike<T>& regex) {
|
| 868 |
+
return ContainsRegex(new internal::RE(std::string(regex)));
|
| 869 |
+
}
|
| 870 |
+
|
| 871 |
+
// Creates a polymorphic matcher that matches anything equal to x.
|
| 872 |
+
// Note: if the parameter of Eq() were declared as const T&, Eq("foo")
|
| 873 |
+
// wouldn't compile.
|
| 874 |
+
template <typename T>
|
| 875 |
+
inline internal::EqMatcher<T> Eq(T x) { return internal::EqMatcher<T>(x); }
|
| 876 |
+
|
| 877 |
+
// Constructs a Matcher<T> from a 'value' of type T. The constructed
|
| 878 |
+
// matcher matches any value that's equal to 'value'.
|
| 879 |
+
template <typename T>
|
| 880 |
+
Matcher<T>::Matcher(T value) { *this = Eq(value); }
|
| 881 |
+
|
| 882 |
+
// Creates a monomorphic matcher that matches anything with type Lhs
|
| 883 |
+
// and equal to rhs. A user may need to use this instead of Eq(...)
|
| 884 |
+
// in order to resolve an overloading ambiguity.
|
| 885 |
+
//
|
| 886 |
+
// TypedEq<T>(x) is just a convenient short-hand for Matcher<T>(Eq(x))
|
| 887 |
+
// or Matcher<T>(x), but more readable than the latter.
|
| 888 |
+
//
|
| 889 |
+
// We could define similar monomorphic matchers for other comparison
|
| 890 |
+
// operations (e.g. TypedLt, TypedGe, and etc), but decided not to do
|
| 891 |
+
// it yet as those are used much less than Eq() in practice. A user
|
| 892 |
+
// can always write Matcher<T>(Lt(5)) to be explicit about the type,
|
| 893 |
+
// for example.
|
| 894 |
+
template <typename Lhs, typename Rhs>
|
| 895 |
+
inline Matcher<Lhs> TypedEq(const Rhs& rhs) { return Eq(rhs); }
|
| 896 |
+
|
| 897 |
+
// Creates a polymorphic matcher that matches anything >= x.
|
| 898 |
+
template <typename Rhs>
|
| 899 |
+
inline internal::GeMatcher<Rhs> Ge(Rhs x) {
|
| 900 |
+
return internal::GeMatcher<Rhs>(x);
|
| 901 |
+
}
|
| 902 |
+
|
| 903 |
+
// Creates a polymorphic matcher that matches anything > x.
|
| 904 |
+
template <typename Rhs>
|
| 905 |
+
inline internal::GtMatcher<Rhs> Gt(Rhs x) {
|
| 906 |
+
return internal::GtMatcher<Rhs>(x);
|
| 907 |
+
}
|
| 908 |
+
|
| 909 |
+
// Creates a polymorphic matcher that matches anything <= x.
|
| 910 |
+
template <typename Rhs>
|
| 911 |
+
inline internal::LeMatcher<Rhs> Le(Rhs x) {
|
| 912 |
+
return internal::LeMatcher<Rhs>(x);
|
| 913 |
+
}
|
| 914 |
+
|
| 915 |
+
// Creates a polymorphic matcher that matches anything < x.
|
| 916 |
+
template <typename Rhs>
|
| 917 |
+
inline internal::LtMatcher<Rhs> Lt(Rhs x) {
|
| 918 |
+
return internal::LtMatcher<Rhs>(x);
|
| 919 |
+
}
|
| 920 |
+
|
| 921 |
+
// Creates a polymorphic matcher that matches anything != x.
|
| 922 |
+
template <typename Rhs>
|
| 923 |
+
inline internal::NeMatcher<Rhs> Ne(Rhs x) {
|
| 924 |
+
return internal::NeMatcher<Rhs>(x);
|
| 925 |
+
}
|
| 926 |
+
} // namespace testing
|
| 927 |
+
|
| 928 |
+
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 5046
|
| 929 |
+
|
| 930 |
+
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-message.h
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2005, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
//
|
| 31 |
+
// The Google C++ Testing and Mocking Framework (Google Test)
|
| 32 |
+
//
|
| 33 |
+
// This header file defines the Message class.
|
| 34 |
+
//
|
| 35 |
+
// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
|
| 36 |
+
// leave some internal implementation details in this header file.
|
| 37 |
+
// They are clearly marked by comments like this:
|
| 38 |
+
//
|
| 39 |
+
// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 40 |
+
//
|
| 41 |
+
// Such code is NOT meant to be used by a user directly, and is subject
|
| 42 |
+
// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
|
| 43 |
+
// program!
|
| 44 |
+
|
| 45 |
+
// GOOGLETEST_CM0001 DO NOT DELETE
|
| 46 |
+
|
| 47 |
+
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
|
| 48 |
+
#define GOOGLETEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
|
| 49 |
+
|
| 50 |
+
#include <limits>
|
| 51 |
+
#include <memory>
|
| 52 |
+
#include <sstream>
|
| 53 |
+
|
| 54 |
+
#include "gtest/internal/gtest-port.h"
|
| 55 |
+
|
| 56 |
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
| 57 |
+
/* class A needs to have dll-interface to be used by clients of class B */)
|
| 58 |
+
|
| 59 |
+
// Ensures that there is at least one operator<< in the global namespace.
|
| 60 |
+
// See Message& operator<<(...) below for why.
|
| 61 |
+
void operator<<(const testing::internal::Secret&, int);
|
| 62 |
+
|
| 63 |
+
namespace testing {
|
| 64 |
+
|
| 65 |
+
// The Message class works like an ostream repeater.
|
| 66 |
+
//
|
| 67 |
+
// Typical usage:
|
| 68 |
+
//
|
| 69 |
+
// 1. You stream a bunch of values to a Message object.
|
| 70 |
+
// It will remember the text in a stringstream.
|
| 71 |
+
// 2. Then you stream the Message object to an ostream.
|
| 72 |
+
// This causes the text in the Message to be streamed
|
| 73 |
+
// to the ostream.
|
| 74 |
+
//
|
| 75 |
+
// For example;
|
| 76 |
+
//
|
| 77 |
+
// testing::Message foo;
|
| 78 |
+
// foo << 1 << " != " << 2;
|
| 79 |
+
// std::cout << foo;
|
| 80 |
+
//
|
| 81 |
+
// will print "1 != 2".
|
| 82 |
+
//
|
| 83 |
+
// Message is not intended to be inherited from. In particular, its
|
| 84 |
+
// destructor is not virtual.
|
| 85 |
+
//
|
| 86 |
+
// Note that stringstream behaves differently in gcc and in MSVC. You
|
| 87 |
+
// can stream a NULL char pointer to it in the former, but not in the
|
| 88 |
+
// latter (it causes an access violation if you do). The Message
|
| 89 |
+
// class hides this difference by treating a NULL char pointer as
|
| 90 |
+
// "(null)".
|
| 91 |
+
class GTEST_API_ Message {
|
| 92 |
+
private:
|
| 93 |
+
// The type of basic IO manipulators (endl, ends, and flush) for
|
| 94 |
+
// narrow streams.
|
| 95 |
+
typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
|
| 96 |
+
|
| 97 |
+
public:
|
| 98 |
+
// Constructs an empty Message.
|
| 99 |
+
Message();
|
| 100 |
+
|
| 101 |
+
// Copy constructor.
|
| 102 |
+
Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT
|
| 103 |
+
*ss_ << msg.GetString();
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
// Constructs a Message from a C-string.
|
| 107 |
+
explicit Message(const char* str) : ss_(new ::std::stringstream) {
|
| 108 |
+
*ss_ << str;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
// Streams a non-pointer value to this object.
|
| 112 |
+
template <typename T>
|
| 113 |
+
inline Message& operator <<(const T& val) {
|
| 114 |
+
// Some libraries overload << for STL containers. These
|
| 115 |
+
// overloads are defined in the global namespace instead of ::std.
|
| 116 |
+
//
|
| 117 |
+
// C++'s symbol lookup rule (i.e. Koenig lookup) says that these
|
| 118 |
+
// overloads are visible in either the std namespace or the global
|
| 119 |
+
// namespace, but not other namespaces, including the testing
|
| 120 |
+
// namespace which Google Test's Message class is in.
|
| 121 |
+
//
|
| 122 |
+
// To allow STL containers (and other types that has a << operator
|
| 123 |
+
// defined in the global namespace) to be used in Google Test
|
| 124 |
+
// assertions, testing::Message must access the custom << operator
|
| 125 |
+
// from the global namespace. With this using declaration,
|
| 126 |
+
// overloads of << defined in the global namespace and those
|
| 127 |
+
// visible via Koenig lookup are both exposed in this function.
|
| 128 |
+
using ::operator <<;
|
| 129 |
+
*ss_ << val;
|
| 130 |
+
return *this;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
// Streams a pointer value to this object.
|
| 134 |
+
//
|
| 135 |
+
// This function is an overload of the previous one. When you
|
| 136 |
+
// stream a pointer to a Message, this definition will be used as it
|
| 137 |
+
// is more specialized. (The C++ Standard, section
|
| 138 |
+
// [temp.func.order].) If you stream a non-pointer, then the
|
| 139 |
+
// previous definition will be used.
|
| 140 |
+
//
|
| 141 |
+
// The reason for this overload is that streaming a NULL pointer to
|
| 142 |
+
// ostream is undefined behavior. Depending on the compiler, you
|
| 143 |
+
// may get "0", "(nil)", "(null)", or an access violation. To
|
| 144 |
+
// ensure consistent result across compilers, we always treat NULL
|
| 145 |
+
// as "(null)".
|
| 146 |
+
template <typename T>
|
| 147 |
+
inline Message& operator <<(T* const& pointer) { // NOLINT
|
| 148 |
+
if (pointer == nullptr) {
|
| 149 |
+
*ss_ << "(null)";
|
| 150 |
+
} else {
|
| 151 |
+
*ss_ << pointer;
|
| 152 |
+
}
|
| 153 |
+
return *this;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
// Since the basic IO manipulators are overloaded for both narrow
|
| 157 |
+
// and wide streams, we have to provide this specialized definition
|
| 158 |
+
// of operator <<, even though its body is the same as the
|
| 159 |
+
// templatized version above. Without this definition, streaming
|
| 160 |
+
// endl or other basic IO manipulators to Message will confuse the
|
| 161 |
+
// compiler.
|
| 162 |
+
Message& operator <<(BasicNarrowIoManip val) {
|
| 163 |
+
*ss_ << val;
|
| 164 |
+
return *this;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
// Instead of 1/0, we want to see true/false for bool values.
|
| 168 |
+
Message& operator <<(bool b) {
|
| 169 |
+
return *this << (b ? "true" : "false");
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
// These two overloads allow streaming a wide C string to a Message
|
| 173 |
+
// using the UTF-8 encoding.
|
| 174 |
+
Message& operator <<(const wchar_t* wide_c_str);
|
| 175 |
+
Message& operator <<(wchar_t* wide_c_str);
|
| 176 |
+
|
| 177 |
+
#if GTEST_HAS_STD_WSTRING
|
| 178 |
+
// Converts the given wide string to a narrow string using the UTF-8
|
| 179 |
+
// encoding, and streams the result to this Message object.
|
| 180 |
+
Message& operator <<(const ::std::wstring& wstr);
|
| 181 |
+
#endif // GTEST_HAS_STD_WSTRING
|
| 182 |
+
|
| 183 |
+
// Gets the text streamed to this object so far as an std::string.
|
| 184 |
+
// Each '\0' character in the buffer is replaced with "\\0".
|
| 185 |
+
//
|
| 186 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 187 |
+
std::string GetString() const;
|
| 188 |
+
|
| 189 |
+
private:
|
| 190 |
+
// We'll hold the text streamed to this object here.
|
| 191 |
+
const std::unique_ptr< ::std::stringstream> ss_;
|
| 192 |
+
|
| 193 |
+
// We declare (but don't implement) this to prevent the compiler
|
| 194 |
+
// from implementing the assignment operator.
|
| 195 |
+
void operator=(const Message&);
|
| 196 |
+
};
|
| 197 |
+
|
| 198 |
+
// Streams a Message to an ostream.
|
| 199 |
+
inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
|
| 200 |
+
return os << sb.GetString();
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
namespace internal {
|
| 204 |
+
|
| 205 |
+
// Converts a streamable value to an std::string. A NULL pointer is
|
| 206 |
+
// converted to "(null)". When the input value is a ::string,
|
| 207 |
+
// ::std::string, ::wstring, or ::std::wstring object, each NUL
|
| 208 |
+
// character in it is replaced with "\\0".
|
| 209 |
+
template <typename T>
|
| 210 |
+
std::string StreamableToString(const T& streamable) {
|
| 211 |
+
return (Message() << streamable).GetString();
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
} // namespace internal
|
| 215 |
+
} // namespace testing
|
| 216 |
+
|
| 217 |
+
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
| 218 |
+
|
| 219 |
+
#endif // GOOGLETEST_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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2008, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
//
|
| 30 |
+
// Macros and functions for implementing parameterized tests
|
| 31 |
+
// in Google C++ Testing and Mocking Framework (Google Test)
|
| 32 |
+
//
|
| 33 |
+
// GOOGLETEST_CM0001 DO NOT DELETE
|
| 34 |
+
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
|
| 35 |
+
#define GOOGLETEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
|
| 36 |
+
|
| 37 |
+
// Value-parameterized tests allow you to test your code with different
|
| 38 |
+
// parameters without writing multiple copies of the same test.
|
| 39 |
+
//
|
| 40 |
+
// Here is how you use value-parameterized tests:
|
| 41 |
+
|
| 42 |
+
#if 0
|
| 43 |
+
|
| 44 |
+
// To write value-parameterized tests, first you should define a fixture
|
| 45 |
+
// class. It is usually derived from testing::TestWithParam<T> (see below for
|
| 46 |
+
// another inheritance scheme that's sometimes useful in more complicated
|
| 47 |
+
// class hierarchies), where the type of your parameter values.
|
| 48 |
+
// TestWithParam<T> is itself derived from testing::Test. T can be any
|
| 49 |
+
// copyable type. If it's a raw pointer, you are responsible for managing the
|
| 50 |
+
// lifespan of the pointed values.
|
| 51 |
+
|
| 52 |
+
class FooTest : public ::testing::TestWithParam<const char*> {
|
| 53 |
+
// You can implement all the usual class fixture members here.
|
| 54 |
+
};
|
| 55 |
+
|
| 56 |
+
// Then, use the TEST_P macro to define as many parameterized tests
|
| 57 |
+
// for this fixture as you want. The _P suffix is for "parameterized"
|
| 58 |
+
// or "pattern", whichever you prefer to think.
|
| 59 |
+
|
| 60 |
+
TEST_P(FooTest, DoesBlah) {
|
| 61 |
+
// Inside a test, access the test parameter with the GetParam() method
|
| 62 |
+
// of the TestWithParam<T> class:
|
| 63 |
+
EXPECT_TRUE(foo.Blah(GetParam()));
|
| 64 |
+
...
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
TEST_P(FooTest, HasBlahBlah) {
|
| 68 |
+
...
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
// Finally, you can use INSTANTIATE_TEST_SUITE_P to instantiate the test
|
| 72 |
+
// case with any set of parameters you want. Google Test defines a number
|
| 73 |
+
// of functions for generating test parameters. They return what we call
|
| 74 |
+
// (surprise!) parameter generators. Here is a summary of them, which
|
| 75 |
+
// are all in the testing namespace:
|
| 76 |
+
//
|
| 77 |
+
//
|
| 78 |
+
// Range(begin, end [, step]) - Yields values {begin, begin+step,
|
| 79 |
+
// begin+step+step, ...}. The values do not
|
| 80 |
+
// include end. step defaults to 1.
|
| 81 |
+
// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
|
| 82 |
+
// ValuesIn(container) - Yields values from a C-style array, an STL
|
| 83 |
+
// ValuesIn(begin,end) container, or an iterator range [begin, end).
|
| 84 |
+
// Bool() - Yields sequence {false, true}.
|
| 85 |
+
// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
|
| 86 |
+
// for the math savvy) of the values generated
|
| 87 |
+
// by the N generators.
|
| 88 |
+
//
|
| 89 |
+
// For more details, see comments at the definitions of these functions below
|
| 90 |
+
// in this file.
|
| 91 |
+
//
|
| 92 |
+
// The following statement will instantiate tests from the FooTest test suite
|
| 93 |
+
// each with parameter values "meeny", "miny", and "moe".
|
| 94 |
+
|
| 95 |
+
INSTANTIATE_TEST_SUITE_P(InstantiationName,
|
| 96 |
+
FooTest,
|
| 97 |
+
Values("meeny", "miny", "moe"));
|
| 98 |
+
|
| 99 |
+
// To distinguish different instances of the pattern, (yes, you
|
| 100 |
+
// can instantiate it more than once) the first argument to the
|
| 101 |
+
// INSTANTIATE_TEST_SUITE_P macro is a prefix that will be added to the
|
| 102 |
+
// actual test suite name. Remember to pick unique prefixes for different
|
| 103 |
+
// instantiations. The tests from the instantiation above will have
|
| 104 |
+
// these names:
|
| 105 |
+
//
|
| 106 |
+
// * InstantiationName/FooTest.DoesBlah/0 for "meeny"
|
| 107 |
+
// * InstantiationName/FooTest.DoesBlah/1 for "miny"
|
| 108 |
+
// * InstantiationName/FooTest.DoesBlah/2 for "moe"
|
| 109 |
+
// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
|
| 110 |
+
// * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
|
| 111 |
+
// * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
|
| 112 |
+
//
|
| 113 |
+
// You can use these names in --gtest_filter.
|
| 114 |
+
//
|
| 115 |
+
// This statement will instantiate all tests from FooTest again, each
|
| 116 |
+
// with parameter values "cat" and "dog":
|
| 117 |
+
|
| 118 |
+
const char* pets[] = {"cat", "dog"};
|
| 119 |
+
INSTANTIATE_TEST_SUITE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
|
| 120 |
+
|
| 121 |
+
// The tests from the instantiation above will have these names:
|
| 122 |
+
//
|
| 123 |
+
// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
|
| 124 |
+
// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
|
| 125 |
+
// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
|
| 126 |
+
// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
|
| 127 |
+
//
|
| 128 |
+
// Please note that INSTANTIATE_TEST_SUITE_P will instantiate all tests
|
| 129 |
+
// in the given test suite, whether their definitions come before or
|
| 130 |
+
// AFTER the INSTANTIATE_TEST_SUITE_P statement.
|
| 131 |
+
//
|
| 132 |
+
// Please also note that generator expressions (including parameters to the
|
| 133 |
+
// generators) are evaluated in InitGoogleTest(), after main() has started.
|
| 134 |
+
// This allows the user on one hand, to adjust generator parameters in order
|
| 135 |
+
// to dynamically determine a set of tests to run and on the other hand,
|
| 136 |
+
// give the user a chance to inspect the generated tests with Google Test
|
| 137 |
+
// reflection API before RUN_ALL_TESTS() is executed.
|
| 138 |
+
//
|
| 139 |
+
// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
|
| 140 |
+
// for more examples.
|
| 141 |
+
//
|
| 142 |
+
// In the future, we plan to publish the API for defining new parameter
|
| 143 |
+
// generators. But for now this interface remains part of the internal
|
| 144 |
+
// implementation and is subject to change.
|
| 145 |
+
//
|
| 146 |
+
//
|
| 147 |
+
// A parameterized test fixture must be derived from testing::Test and from
|
| 148 |
+
// testing::WithParamInterface<T>, where T is the type of the parameter
|
| 149 |
+
// values. Inheriting from TestWithParam<T> satisfies that requirement because
|
| 150 |
+
// TestWithParam<T> inherits from both Test and WithParamInterface. In more
|
| 151 |
+
// complicated hierarchies, however, it is occasionally useful to inherit
|
| 152 |
+
// separately from Test and WithParamInterface. For example:
|
| 153 |
+
|
| 154 |
+
class BaseTest : public ::testing::Test {
|
| 155 |
+
// You can inherit all the usual members for a non-parameterized test
|
| 156 |
+
// fixture here.
|
| 157 |
+
};
|
| 158 |
+
|
| 159 |
+
class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
|
| 160 |
+
// The usual test fixture members go here too.
|
| 161 |
+
};
|
| 162 |
+
|
| 163 |
+
TEST_F(BaseTest, HasFoo) {
|
| 164 |
+
// This is an ordinary non-parameterized test.
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
TEST_P(DerivedTest, DoesBlah) {
|
| 168 |
+
// GetParam works just the same here as if you inherit from TestWithParam.
|
| 169 |
+
EXPECT_TRUE(foo.Blah(GetParam()));
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
#endif // 0
|
| 173 |
+
|
| 174 |
+
#include <iterator>
|
| 175 |
+
#include <utility>
|
| 176 |
+
|
| 177 |
+
#include "gtest/internal/gtest-internal.h"
|
| 178 |
+
#include "gtest/internal/gtest-param-util.h"
|
| 179 |
+
#include "gtest/internal/gtest-port.h"
|
| 180 |
+
|
| 181 |
+
namespace testing {
|
| 182 |
+
|
| 183 |
+
// Functions producing parameter generators.
|
| 184 |
+
//
|
| 185 |
+
// Google Test uses these generators to produce parameters for value-
|
| 186 |
+
// parameterized tests. When a parameterized test suite is instantiated
|
| 187 |
+
// with a particular generator, Google Test creates and runs tests
|
| 188 |
+
// for each element in the sequence produced by the generator.
|
| 189 |
+
//
|
| 190 |
+
// In the following sample, tests from test suite FooTest are instantiated
|
| 191 |
+
// each three times with parameter values 3, 5, and 8:
|
| 192 |
+
//
|
| 193 |
+
// class FooTest : public TestWithParam<int> { ... };
|
| 194 |
+
//
|
| 195 |
+
// TEST_P(FooTest, TestThis) {
|
| 196 |
+
// }
|
| 197 |
+
// TEST_P(FooTest, TestThat) {
|
| 198 |
+
// }
|
| 199 |
+
// INSTANTIATE_TEST_SUITE_P(TestSequence, FooTest, Values(3, 5, 8));
|
| 200 |
+
//
|
| 201 |
+
|
| 202 |
+
// Range() returns generators providing sequences of values in a range.
|
| 203 |
+
//
|
| 204 |
+
// Synopsis:
|
| 205 |
+
// Range(start, end)
|
| 206 |
+
// - returns a generator producing a sequence of values {start, start+1,
|
| 207 |
+
// start+2, ..., }.
|
| 208 |
+
// Range(start, end, step)
|
| 209 |
+
// - returns a generator producing a sequence of values {start, start+step,
|
| 210 |
+
// start+step+step, ..., }.
|
| 211 |
+
// Notes:
|
| 212 |
+
// * The generated sequences never include end. For example, Range(1, 5)
|
| 213 |
+
// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
|
| 214 |
+
// returns a generator producing {1, 3, 5, 7}.
|
| 215 |
+
// * start and end must have the same type. That type may be any integral or
|
| 216 |
+
// floating-point type or a user defined type satisfying these conditions:
|
| 217 |
+
// * It must be assignable (have operator=() defined).
|
| 218 |
+
// * It must have operator+() (operator+(int-compatible type) for
|
| 219 |
+
// two-operand version).
|
| 220 |
+
// * It must have operator<() defined.
|
| 221 |
+
// Elements in the resulting sequences will also have that type.
|
| 222 |
+
// * Condition start < end must be satisfied in order for resulting sequences
|
| 223 |
+
// to contain any elements.
|
| 224 |
+
//
|
| 225 |
+
template <typename T, typename IncrementT>
|
| 226 |
+
internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
|
| 227 |
+
return internal::ParamGenerator<T>(
|
| 228 |
+
new internal::RangeGenerator<T, IncrementT>(start, end, step));
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
template <typename T>
|
| 232 |
+
internal::ParamGenerator<T> Range(T start, T end) {
|
| 233 |
+
return Range(start, end, 1);
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
// ValuesIn() function allows generation of tests with parameters coming from
|
| 237 |
+
// a container.
|
| 238 |
+
//
|
| 239 |
+
// Synopsis:
|
| 240 |
+
// ValuesIn(const T (&array)[N])
|
| 241 |
+
// - returns a generator producing sequences with elements from
|
| 242 |
+
// a C-style array.
|
| 243 |
+
// ValuesIn(const Container& container)
|
| 244 |
+
// - returns a generator producing sequences with elements from
|
| 245 |
+
// an STL-style container.
|
| 246 |
+
// ValuesIn(Iterator begin, Iterator end)
|
| 247 |
+
// - returns a generator producing sequences with elements from
|
| 248 |
+
// a range [begin, end) defined by a pair of STL-style iterators. These
|
| 249 |
+
// iterators can also be plain C pointers.
|
| 250 |
+
//
|
| 251 |
+
// Please note that ValuesIn copies the values from the containers
|
| 252 |
+
// passed in and keeps them to generate tests in RUN_ALL_TESTS().
|
| 253 |
+
//
|
| 254 |
+
// Examples:
|
| 255 |
+
//
|
| 256 |
+
// This instantiates tests from test suite StringTest
|
| 257 |
+
// each with C-string values of "foo", "bar", and "baz":
|
| 258 |
+
//
|
| 259 |
+
// const char* strings[] = {"foo", "bar", "baz"};
|
| 260 |
+
// INSTANTIATE_TEST_SUITE_P(StringSequence, StringTest, ValuesIn(strings));
|
| 261 |
+
//
|
| 262 |
+
// This instantiates tests from test suite StlStringTest
|
| 263 |
+
// each with STL strings with values "a" and "b":
|
| 264 |
+
//
|
| 265 |
+
// ::std::vector< ::std::string> GetParameterStrings() {
|
| 266 |
+
// ::std::vector< ::std::string> v;
|
| 267 |
+
// v.push_back("a");
|
| 268 |
+
// v.push_back("b");
|
| 269 |
+
// return v;
|
| 270 |
+
// }
|
| 271 |
+
//
|
| 272 |
+
// INSTANTIATE_TEST_SUITE_P(CharSequence,
|
| 273 |
+
// StlStringTest,
|
| 274 |
+
// ValuesIn(GetParameterStrings()));
|
| 275 |
+
//
|
| 276 |
+
//
|
| 277 |
+
// This will also instantiate tests from CharTest
|
| 278 |
+
// each with parameter values 'a' and 'b':
|
| 279 |
+
//
|
| 280 |
+
// ::std::list<char> GetParameterChars() {
|
| 281 |
+
// ::std::list<char> list;
|
| 282 |
+
// list.push_back('a');
|
| 283 |
+
// list.push_back('b');
|
| 284 |
+
// return list;
|
| 285 |
+
// }
|
| 286 |
+
// ::std::list<char> l = GetParameterChars();
|
| 287 |
+
// INSTANTIATE_TEST_SUITE_P(CharSequence2,
|
| 288 |
+
// CharTest,
|
| 289 |
+
// ValuesIn(l.begin(), l.end()));
|
| 290 |
+
//
|
| 291 |
+
template <typename ForwardIterator>
|
| 292 |
+
internal::ParamGenerator<
|
| 293 |
+
typename std::iterator_traits<ForwardIterator>::value_type>
|
| 294 |
+
ValuesIn(ForwardIterator begin, ForwardIterator end) {
|
| 295 |
+
typedef typename std::iterator_traits<ForwardIterator>::value_type ParamType;
|
| 296 |
+
return internal::ParamGenerator<ParamType>(
|
| 297 |
+
new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
template <typename T, size_t N>
|
| 301 |
+
internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
|
| 302 |
+
return ValuesIn(array, array + N);
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
template <class Container>
|
| 306 |
+
internal::ParamGenerator<typename Container::value_type> ValuesIn(
|
| 307 |
+
const Container& container) {
|
| 308 |
+
return ValuesIn(container.begin(), container.end());
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
// Values() allows generating tests from explicitly specified list of
|
| 312 |
+
// parameters.
|
| 313 |
+
//
|
| 314 |
+
// Synopsis:
|
| 315 |
+
// Values(T v1, T v2, ..., T vN)
|
| 316 |
+
// - returns a generator producing sequences with elements v1, v2, ..., vN.
|
| 317 |
+
//
|
| 318 |
+
// For example, this instantiates tests from test suite BarTest each
|
| 319 |
+
// with values "one", "two", and "three":
|
| 320 |
+
//
|
| 321 |
+
// INSTANTIATE_TEST_SUITE_P(NumSequence,
|
| 322 |
+
// BarTest,
|
| 323 |
+
// Values("one", "two", "three"));
|
| 324 |
+
//
|
| 325 |
+
// This instantiates tests from test suite BazTest each with values 1, 2, 3.5.
|
| 326 |
+
// The exact type of values will depend on the type of parameter in BazTest.
|
| 327 |
+
//
|
| 328 |
+
// INSTANTIATE_TEST_SUITE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
|
| 329 |
+
//
|
| 330 |
+
//
|
| 331 |
+
template <typename... T>
|
| 332 |
+
internal::ValueArray<T...> Values(T... v) {
|
| 333 |
+
return internal::ValueArray<T...>(std::move(v)...);
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
// Bool() allows generating tests with parameters in a set of (false, true).
|
| 337 |
+
//
|
| 338 |
+
// Synopsis:
|
| 339 |
+
// Bool()
|
| 340 |
+
// - returns a generator producing sequences with elements {false, true}.
|
| 341 |
+
//
|
| 342 |
+
// It is useful when testing code that depends on Boolean flags. Combinations
|
| 343 |
+
// of multiple flags can be tested when several Bool()'s are combined using
|
| 344 |
+
// Combine() function.
|
| 345 |
+
//
|
| 346 |
+
// In the following example all tests in the test suite FlagDependentTest
|
| 347 |
+
// will be instantiated twice with parameters false and true.
|
| 348 |
+
//
|
| 349 |
+
// class FlagDependentTest : public testing::TestWithParam<bool> {
|
| 350 |
+
// virtual void SetUp() {
|
| 351 |
+
// external_flag = GetParam();
|
| 352 |
+
// }
|
| 353 |
+
// }
|
| 354 |
+
// INSTANTIATE_TEST_SUITE_P(BoolSequence, FlagDependentTest, Bool());
|
| 355 |
+
//
|
| 356 |
+
inline internal::ParamGenerator<bool> Bool() {
|
| 357 |
+
return Values(false, true);
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
// Combine() allows the user to combine two or more sequences to produce
|
| 361 |
+
// values of a Cartesian product of those sequences' elements.
|
| 362 |
+
//
|
| 363 |
+
// Synopsis:
|
| 364 |
+
// Combine(gen1, gen2, ..., genN)
|
| 365 |
+
// - returns a generator producing sequences with elements coming from
|
| 366 |
+
// the Cartesian product of elements from the sequences generated by
|
| 367 |
+
// gen1, gen2, ..., genN. The sequence elements will have a type of
|
| 368 |
+
// std::tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
|
| 369 |
+
// of elements from sequences produces by gen1, gen2, ..., genN.
|
| 370 |
+
//
|
| 371 |
+
// Example:
|
| 372 |
+
//
|
| 373 |
+
// This will instantiate tests in test suite AnimalTest each one with
|
| 374 |
+
// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
|
| 375 |
+
// tuple("dog", BLACK), and tuple("dog", WHITE):
|
| 376 |
+
//
|
| 377 |
+
// enum Color { BLACK, GRAY, WHITE };
|
| 378 |
+
// class AnimalTest
|
| 379 |
+
// : public testing::TestWithParam<std::tuple<const char*, Color> > {...};
|
| 380 |
+
//
|
| 381 |
+
// TEST_P(AnimalTest, AnimalLooksNice) {...}
|
| 382 |
+
//
|
| 383 |
+
// INSTANTIATE_TEST_SUITE_P(AnimalVariations, AnimalTest,
|
| 384 |
+
// Combine(Values("cat", "dog"),
|
| 385 |
+
// Values(BLACK, WHITE)));
|
| 386 |
+
//
|
| 387 |
+
// This will instantiate tests in FlagDependentTest with all variations of two
|
| 388 |
+
// Boolean flags:
|
| 389 |
+
//
|
| 390 |
+
// class FlagDependentTest
|
| 391 |
+
// : public testing::TestWithParam<std::tuple<bool, bool> > {
|
| 392 |
+
// virtual void SetUp() {
|
| 393 |
+
// // Assigns external_flag_1 and external_flag_2 values from the tuple.
|
| 394 |
+
// std::tie(external_flag_1, external_flag_2) = GetParam();
|
| 395 |
+
// }
|
| 396 |
+
// };
|
| 397 |
+
//
|
| 398 |
+
// TEST_P(FlagDependentTest, TestFeature1) {
|
| 399 |
+
// // Test your code using external_flag_1 and external_flag_2 here.
|
| 400 |
+
// }
|
| 401 |
+
// INSTANTIATE_TEST_SUITE_P(TwoBoolSequence, FlagDependentTest,
|
| 402 |
+
// Combine(Bool(), Bool()));
|
| 403 |
+
//
|
| 404 |
+
template <typename... Generator>
|
| 405 |
+
internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) {
|
| 406 |
+
return internal::CartesianProductHolder<Generator...>(g...);
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
#define TEST_P(test_suite_name, test_name) \
|
| 410 |
+
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
|
| 411 |
+
: public test_suite_name { \
|
| 412 |
+
public: \
|
| 413 |
+
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
|
| 414 |
+
void TestBody() override; \
|
| 415 |
+
\
|
| 416 |
+
private: \
|
| 417 |
+
static int AddToRegistry() { \
|
| 418 |
+
::testing::UnitTest::GetInstance() \
|
| 419 |
+
->parameterized_test_registry() \
|
| 420 |
+
.GetTestSuitePatternHolder<test_suite_name>( \
|
| 421 |
+
GTEST_STRINGIFY_(test_suite_name), \
|
| 422 |
+
::testing::internal::CodeLocation(__FILE__, __LINE__)) \
|
| 423 |
+
->AddTestPattern( \
|
| 424 |
+
GTEST_STRINGIFY_(test_suite_name), GTEST_STRINGIFY_(test_name), \
|
| 425 |
+
new ::testing::internal::TestMetaFactory<GTEST_TEST_CLASS_NAME_( \
|
| 426 |
+
test_suite_name, test_name)>(), \
|
| 427 |
+
::testing::internal::CodeLocation(__FILE__, __LINE__)); \
|
| 428 |
+
return 0; \
|
| 429 |
+
} \
|
| 430 |
+
static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
|
| 431 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
| 432 |
+
test_name)); \
|
| 433 |
+
}; \
|
| 434 |
+
int GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
| 435 |
+
test_name)::gtest_registering_dummy_ = \
|
| 436 |
+
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \
|
| 437 |
+
void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
|
| 438 |
+
|
| 439 |
+
// The last argument to INSTANTIATE_TEST_SUITE_P allows the user to specify
|
| 440 |
+
// generator and an optional function or functor that generates custom test name
|
| 441 |
+
// suffixes based on the test parameters. Such a function or functor should
|
| 442 |
+
// accept one argument of type testing::TestParamInfo<class ParamType>, and
|
| 443 |
+
// return std::string.
|
| 444 |
+
//
|
| 445 |
+
// testing::PrintToStringParamName is a builtin test suffix generator that
|
| 446 |
+
// returns the value of testing::PrintToString(GetParam()).
|
| 447 |
+
//
|
| 448 |
+
// Note: test names must be non-empty, unique, and may only contain ASCII
|
| 449 |
+
// alphanumeric characters or underscore. Because PrintToString adds quotes
|
| 450 |
+
// to std::string and C strings, it won't work for these types.
|
| 451 |
+
|
| 452 |
+
#define GTEST_EXPAND_(arg) arg
|
| 453 |
+
#define GTEST_GET_FIRST_(first, ...) first
|
| 454 |
+
#define GTEST_GET_SECOND_(first, second, ...) second
|
| 455 |
+
|
| 456 |
+
#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \
|
| 457 |
+
static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \
|
| 458 |
+
gtest_##prefix##test_suite_name##_EvalGenerator_() { \
|
| 459 |
+
return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \
|
| 460 |
+
} \
|
| 461 |
+
static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \
|
| 462 |
+
const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \
|
| 463 |
+
if (::testing::internal::AlwaysFalse()) { \
|
| 464 |
+
::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \
|
| 465 |
+
__VA_ARGS__, \
|
| 466 |
+
::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
|
| 467 |
+
DUMMY_PARAM_))); \
|
| 468 |
+
auto t = std::make_tuple(__VA_ARGS__); \
|
| 469 |
+
static_assert(std::tuple_size<decltype(t)>::value <= 2, \
|
| 470 |
+
"Too Many Args!"); \
|
| 471 |
+
} \
|
| 472 |
+
return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \
|
| 473 |
+
__VA_ARGS__, \
|
| 474 |
+
::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
|
| 475 |
+
DUMMY_PARAM_))))(info); \
|
| 476 |
+
} \
|
| 477 |
+
static int gtest_##prefix##test_suite_name##_dummy_ \
|
| 478 |
+
GTEST_ATTRIBUTE_UNUSED_ = \
|
| 479 |
+
::testing::UnitTest::GetInstance() \
|
| 480 |
+
->parameterized_test_registry() \
|
| 481 |
+
.GetTestSuitePatternHolder<test_suite_name>( \
|
| 482 |
+
GTEST_STRINGIFY_(test_suite_name), \
|
| 483 |
+
::testing::internal::CodeLocation(__FILE__, __LINE__)) \
|
| 484 |
+
->AddTestSuiteInstantiation( \
|
| 485 |
+
GTEST_STRINGIFY_(prefix), \
|
| 486 |
+
>est_##prefix##test_suite_name##_EvalGenerator_, \
|
| 487 |
+
>est_##prefix##test_suite_name##_EvalGenerateName_, \
|
| 488 |
+
__FILE__, __LINE__)
|
| 489 |
+
|
| 490 |
+
|
| 491 |
+
// Allow Marking a Parameterized test class as not needing to be instantiated.
|
| 492 |
+
#define GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(T) \
|
| 493 |
+
namespace gtest_do_not_use_outside_namespace_scope {} \
|
| 494 |
+
static const ::testing::internal::MarkAsIgnored gtest_allow_ignore_##T( \
|
| 495 |
+
GTEST_STRINGIFY_(T))
|
| 496 |
+
|
| 497 |
+
// Legacy API is deprecated but still available
|
| 498 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 499 |
+
#define INSTANTIATE_TEST_CASE_P \
|
| 500 |
+
static_assert(::testing::internal::InstantiateTestCase_P_IsDeprecated(), \
|
| 501 |
+
""); \
|
| 502 |
+
INSTANTIATE_TEST_SUITE_P
|
| 503 |
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 504 |
+
|
| 505 |
+
} // namespace testing
|
| 506 |
+
|
| 507 |
+
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-printers.h
ADDED
|
@@ -0,0 +1,1029 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2007, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
// Google Test - The Google C++ Testing and Mocking Framework
|
| 32 |
+
//
|
| 33 |
+
// This file implements a universal value printer that can print a
|
| 34 |
+
// value of any type T:
|
| 35 |
+
//
|
| 36 |
+
// void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
|
| 37 |
+
//
|
| 38 |
+
// A user can teach this function how to print a class type T by
|
| 39 |
+
// defining either operator<<() or PrintTo() in the namespace that
|
| 40 |
+
// defines T. More specifically, the FIRST defined function in the
|
| 41 |
+
// following list will be used (assuming T is defined in namespace
|
| 42 |
+
// foo):
|
| 43 |
+
//
|
| 44 |
+
// 1. foo::PrintTo(const T&, ostream*)
|
| 45 |
+
// 2. operator<<(ostream&, const T&) defined in either foo or the
|
| 46 |
+
// global namespace.
|
| 47 |
+
//
|
| 48 |
+
// However if T is an STL-style container then it is printed element-wise
|
| 49 |
+
// unless foo::PrintTo(const T&, ostream*) is defined. Note that
|
| 50 |
+
// operator<<() is ignored for container types.
|
| 51 |
+
//
|
| 52 |
+
// If none of the above is defined, it will print the debug string of
|
| 53 |
+
// the value if it is a protocol buffer, or print the raw bytes in the
|
| 54 |
+
// value otherwise.
|
| 55 |
+
//
|
| 56 |
+
// To aid debugging: when T is a reference type, the address of the
|
| 57 |
+
// value is also printed; when T is a (const) char pointer, both the
|
| 58 |
+
// pointer value and the NUL-terminated string it points to are
|
| 59 |
+
// printed.
|
| 60 |
+
//
|
| 61 |
+
// We also provide some convenient wrappers:
|
| 62 |
+
//
|
| 63 |
+
// // Prints a value to a string. For a (const or not) char
|
| 64 |
+
// // pointer, the NUL-terminated string (but not the pointer) is
|
| 65 |
+
// // printed.
|
| 66 |
+
// std::string ::testing::PrintToString(const T& value);
|
| 67 |
+
//
|
| 68 |
+
// // Prints a value tersely: for a reference type, the referenced
|
| 69 |
+
// // value (but not the address) is printed; for a (const or not) char
|
| 70 |
+
// // pointer, the NUL-terminated string (but not the pointer) is
|
| 71 |
+
// // printed.
|
| 72 |
+
// void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
|
| 73 |
+
//
|
| 74 |
+
// // Prints value using the type inferred by the compiler. The difference
|
| 75 |
+
// // from UniversalTersePrint() is that this function prints both the
|
| 76 |
+
// // pointer and the NUL-terminated string for a (const or not) char pointer.
|
| 77 |
+
// void ::testing::internal::UniversalPrint(const T& value, ostream*);
|
| 78 |
+
//
|
| 79 |
+
// // Prints the fields of a tuple tersely to a string vector, one
|
| 80 |
+
// // element for each field. Tuple support must be enabled in
|
| 81 |
+
// // gtest-port.h.
|
| 82 |
+
// std::vector<string> UniversalTersePrintTupleFieldsToStrings(
|
| 83 |
+
// const Tuple& value);
|
| 84 |
+
//
|
| 85 |
+
// Known limitation:
|
| 86 |
+
//
|
| 87 |
+
// The print primitives print the elements of an STL-style container
|
| 88 |
+
// using the compiler-inferred type of *iter where iter is a
|
| 89 |
+
// const_iterator of the container. When const_iterator is an input
|
| 90 |
+
// iterator but not a forward iterator, this inferred type may not
|
| 91 |
+
// match value_type, and the print output may be incorrect. In
|
| 92 |
+
// practice, this is rarely a problem as for most containers
|
| 93 |
+
// const_iterator is a forward iterator. We'll fix this if there's an
|
| 94 |
+
// actual need for it. Note that this fix cannot rely on value_type
|
| 95 |
+
// being defined as many user-defined container types don't have
|
| 96 |
+
// value_type.
|
| 97 |
+
|
| 98 |
+
// GOOGLETEST_CM0001 DO NOT DELETE
|
| 99 |
+
|
| 100 |
+
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
|
| 101 |
+
#define GOOGLETEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
|
| 102 |
+
|
| 103 |
+
#include <functional>
|
| 104 |
+
#include <memory>
|
| 105 |
+
#include <ostream> // NOLINT
|
| 106 |
+
#include <sstream>
|
| 107 |
+
#include <string>
|
| 108 |
+
#include <tuple>
|
| 109 |
+
#include <type_traits>
|
| 110 |
+
#include <utility>
|
| 111 |
+
#include <vector>
|
| 112 |
+
|
| 113 |
+
#include "gtest/internal/gtest-internal.h"
|
| 114 |
+
#include "gtest/internal/gtest-port.h"
|
| 115 |
+
|
| 116 |
+
namespace testing {
|
| 117 |
+
|
| 118 |
+
// Definitions in the internal* namespaces are subject to change without notice.
|
| 119 |
+
// DO NOT USE THEM IN USER CODE!
|
| 120 |
+
namespace internal {
|
| 121 |
+
|
| 122 |
+
template <typename T>
|
| 123 |
+
void UniversalPrint(const T& value, ::std::ostream* os);
|
| 124 |
+
|
| 125 |
+
// Used to print an STL-style container when the user doesn't define
|
| 126 |
+
// a PrintTo() for it.
|
| 127 |
+
struct ContainerPrinter {
|
| 128 |
+
template <typename T,
|
| 129 |
+
typename = typename std::enable_if<
|
| 130 |
+
(sizeof(IsContainerTest<T>(0)) == sizeof(IsContainer)) &&
|
| 131 |
+
!IsRecursiveContainer<T>::value>::type>
|
| 132 |
+
static void PrintValue(const T& container, std::ostream* os) {
|
| 133 |
+
const size_t kMaxCount = 32; // The maximum number of elements to print.
|
| 134 |
+
*os << '{';
|
| 135 |
+
size_t count = 0;
|
| 136 |
+
for (auto&& elem : container) {
|
| 137 |
+
if (count > 0) {
|
| 138 |
+
*os << ',';
|
| 139 |
+
if (count == kMaxCount) { // Enough has been printed.
|
| 140 |
+
*os << " ...";
|
| 141 |
+
break;
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
*os << ' ';
|
| 145 |
+
// We cannot call PrintTo(elem, os) here as PrintTo() doesn't
|
| 146 |
+
// handle `elem` being a native array.
|
| 147 |
+
internal::UniversalPrint(elem, os);
|
| 148 |
+
++count;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
if (count > 0) {
|
| 152 |
+
*os << ' ';
|
| 153 |
+
}
|
| 154 |
+
*os << '}';
|
| 155 |
+
}
|
| 156 |
+
};
|
| 157 |
+
|
| 158 |
+
// Used to print a pointer that is neither a char pointer nor a member
|
| 159 |
+
// pointer, when the user doesn't define PrintTo() for it. (A member
|
| 160 |
+
// variable pointer or member function pointer doesn't really point to
|
| 161 |
+
// a location in the address space. Their representation is
|
| 162 |
+
// implementation-defined. Therefore they will be printed as raw
|
| 163 |
+
// bytes.)
|
| 164 |
+
struct FunctionPointerPrinter {
|
| 165 |
+
template <typename T, typename = typename std::enable_if<
|
| 166 |
+
std::is_function<T>::value>::type>
|
| 167 |
+
static void PrintValue(T* p, ::std::ostream* os) {
|
| 168 |
+
if (p == nullptr) {
|
| 169 |
+
*os << "NULL";
|
| 170 |
+
} else {
|
| 171 |
+
// T is a function type, so '*os << p' doesn't do what we want
|
| 172 |
+
// (it just prints p as bool). We want to print p as a const
|
| 173 |
+
// void*.
|
| 174 |
+
*os << reinterpret_cast<const void*>(p);
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
};
|
| 178 |
+
|
| 179 |
+
struct PointerPrinter {
|
| 180 |
+
template <typename T>
|
| 181 |
+
static void PrintValue(T* p, ::std::ostream* os) {
|
| 182 |
+
if (p == nullptr) {
|
| 183 |
+
*os << "NULL";
|
| 184 |
+
} else {
|
| 185 |
+
// T is not a function type. We just call << to print p,
|
| 186 |
+
// relying on ADL to pick up user-defined << for their pointer
|
| 187 |
+
// types, if any.
|
| 188 |
+
*os << p;
|
| 189 |
+
}
|
| 190 |
+
}
|
| 191 |
+
};
|
| 192 |
+
|
| 193 |
+
namespace internal_stream_operator_without_lexical_name_lookup {
|
| 194 |
+
|
| 195 |
+
// The presence of an operator<< here will terminate lexical scope lookup
|
| 196 |
+
// straight away (even though it cannot be a match because of its argument
|
| 197 |
+
// types). Thus, the two operator<< calls in StreamPrinter will find only ADL
|
| 198 |
+
// candidates.
|
| 199 |
+
struct LookupBlocker {};
|
| 200 |
+
void operator<<(LookupBlocker, LookupBlocker);
|
| 201 |
+
|
| 202 |
+
struct StreamPrinter {
|
| 203 |
+
template <typename T,
|
| 204 |
+
// Don't accept member pointers here. We'd print them via implicit
|
| 205 |
+
// conversion to bool, which isn't useful.
|
| 206 |
+
typename = typename std::enable_if<
|
| 207 |
+
!std::is_member_pointer<T>::value>::type,
|
| 208 |
+
// Only accept types for which we can find a streaming operator via
|
| 209 |
+
// ADL (possibly involving implicit conversions).
|
| 210 |
+
typename = decltype(std::declval<std::ostream&>()
|
| 211 |
+
<< std::declval<const T&>())>
|
| 212 |
+
static void PrintValue(const T& value, ::std::ostream* os) {
|
| 213 |
+
// Call streaming operator found by ADL, possibly with implicit conversions
|
| 214 |
+
// of the arguments.
|
| 215 |
+
*os << value;
|
| 216 |
+
}
|
| 217 |
+
};
|
| 218 |
+
|
| 219 |
+
} // namespace internal_stream_operator_without_lexical_name_lookup
|
| 220 |
+
|
| 221 |
+
struct ProtobufPrinter {
|
| 222 |
+
// We print a protobuf using its ShortDebugString() when the string
|
| 223 |
+
// doesn't exceed this many characters; otherwise we print it using
|
| 224 |
+
// DebugString() for better readability.
|
| 225 |
+
static const size_t kProtobufOneLinerMaxLength = 50;
|
| 226 |
+
|
| 227 |
+
template <typename T,
|
| 228 |
+
typename = typename std::enable_if<
|
| 229 |
+
internal::HasDebugStringAndShortDebugString<T>::value>::type>
|
| 230 |
+
static void PrintValue(const T& value, ::std::ostream* os) {
|
| 231 |
+
std::string pretty_str = value.ShortDebugString();
|
| 232 |
+
if (pretty_str.length() > kProtobufOneLinerMaxLength) {
|
| 233 |
+
pretty_str = "\n" + value.DebugString();
|
| 234 |
+
}
|
| 235 |
+
*os << ("<" + pretty_str + ">");
|
| 236 |
+
}
|
| 237 |
+
};
|
| 238 |
+
|
| 239 |
+
struct ConvertibleToIntegerPrinter {
|
| 240 |
+
// Since T has no << operator or PrintTo() but can be implicitly
|
| 241 |
+
// converted to BiggestInt, we print it as a BiggestInt.
|
| 242 |
+
//
|
| 243 |
+
// Most likely T is an enum type (either named or unnamed), in which
|
| 244 |
+
// case printing it as an integer is the desired behavior. In case
|
| 245 |
+
// T is not an enum, printing it as an integer is the best we can do
|
| 246 |
+
// given that it has no user-defined printer.
|
| 247 |
+
static void PrintValue(internal::BiggestInt value, ::std::ostream* os) {
|
| 248 |
+
*os << value;
|
| 249 |
+
}
|
| 250 |
+
};
|
| 251 |
+
|
| 252 |
+
struct ConvertibleToStringViewPrinter {
|
| 253 |
+
#if GTEST_INTERNAL_HAS_STRING_VIEW
|
| 254 |
+
static void PrintValue(internal::StringView value, ::std::ostream* os) {
|
| 255 |
+
internal::UniversalPrint(value, os);
|
| 256 |
+
}
|
| 257 |
+
#endif
|
| 258 |
+
};
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
// Prints the given number of bytes in the given object to the given
|
| 262 |
+
// ostream.
|
| 263 |
+
GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
|
| 264 |
+
size_t count,
|
| 265 |
+
::std::ostream* os);
|
| 266 |
+
struct RawBytesPrinter {
|
| 267 |
+
// SFINAE on `sizeof` to make sure we have a complete type.
|
| 268 |
+
template <typename T, size_t = sizeof(T)>
|
| 269 |
+
static void PrintValue(const T& value, ::std::ostream* os) {
|
| 270 |
+
PrintBytesInObjectTo(
|
| 271 |
+
static_cast<const unsigned char*>(
|
| 272 |
+
// Load bearing cast to void* to support iOS
|
| 273 |
+
reinterpret_cast<const void*>(std::addressof(value))),
|
| 274 |
+
sizeof(value), os);
|
| 275 |
+
}
|
| 276 |
+
};
|
| 277 |
+
|
| 278 |
+
struct FallbackPrinter {
|
| 279 |
+
template <typename T>
|
| 280 |
+
static void PrintValue(const T&, ::std::ostream* os) {
|
| 281 |
+
*os << "(incomplete type)";
|
| 282 |
+
}
|
| 283 |
+
};
|
| 284 |
+
|
| 285 |
+
// Try every printer in order and return the first one that works.
|
| 286 |
+
template <typename T, typename E, typename Printer, typename... Printers>
|
| 287 |
+
struct FindFirstPrinter : FindFirstPrinter<T, E, Printers...> {};
|
| 288 |
+
|
| 289 |
+
template <typename T, typename Printer, typename... Printers>
|
| 290 |
+
struct FindFirstPrinter<
|
| 291 |
+
T, decltype(Printer::PrintValue(std::declval<const T&>(), nullptr)),
|
| 292 |
+
Printer, Printers...> {
|
| 293 |
+
using type = Printer;
|
| 294 |
+
};
|
| 295 |
+
|
| 296 |
+
// Select the best printer in the following order:
|
| 297 |
+
// - Print containers (they have begin/end/etc).
|
| 298 |
+
// - Print function pointers.
|
| 299 |
+
// - Print object pointers.
|
| 300 |
+
// - Use the stream operator, if available.
|
| 301 |
+
// - Print protocol buffers.
|
| 302 |
+
// - Print types convertible to BiggestInt.
|
| 303 |
+
// - Print types convertible to StringView, if available.
|
| 304 |
+
// - Fallback to printing the raw bytes of the object.
|
| 305 |
+
template <typename T>
|
| 306 |
+
void PrintWithFallback(const T& value, ::std::ostream* os) {
|
| 307 |
+
using Printer = typename FindFirstPrinter<
|
| 308 |
+
T, void, ContainerPrinter, FunctionPointerPrinter, PointerPrinter,
|
| 309 |
+
internal_stream_operator_without_lexical_name_lookup::StreamPrinter,
|
| 310 |
+
ProtobufPrinter, ConvertibleToIntegerPrinter,
|
| 311 |
+
ConvertibleToStringViewPrinter, RawBytesPrinter, FallbackPrinter>::type;
|
| 312 |
+
Printer::PrintValue(value, os);
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
// FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
|
| 316 |
+
// value of type ToPrint that is an operand of a comparison assertion
|
| 317 |
+
// (e.g. ASSERT_EQ). OtherOperand is the type of the other operand in
|
| 318 |
+
// the comparison, and is used to help determine the best way to
|
| 319 |
+
// format the value. In particular, when the value is a C string
|
| 320 |
+
// (char pointer) and the other operand is an STL string object, we
|
| 321 |
+
// want to format the C string as a string, since we know it is
|
| 322 |
+
// compared by value with the string object. If the value is a char
|
| 323 |
+
// pointer but the other operand is not an STL string object, we don't
|
| 324 |
+
// know whether the pointer is supposed to point to a NUL-terminated
|
| 325 |
+
// string, and thus want to print it as a pointer to be safe.
|
| 326 |
+
//
|
| 327 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 328 |
+
|
| 329 |
+
// The default case.
|
| 330 |
+
template <typename ToPrint, typename OtherOperand>
|
| 331 |
+
class FormatForComparison {
|
| 332 |
+
public:
|
| 333 |
+
static ::std::string Format(const ToPrint& value) {
|
| 334 |
+
return ::testing::PrintToString(value);
|
| 335 |
+
}
|
| 336 |
+
};
|
| 337 |
+
|
| 338 |
+
// Array.
|
| 339 |
+
template <typename ToPrint, size_t N, typename OtherOperand>
|
| 340 |
+
class FormatForComparison<ToPrint[N], OtherOperand> {
|
| 341 |
+
public:
|
| 342 |
+
static ::std::string Format(const ToPrint* value) {
|
| 343 |
+
return FormatForComparison<const ToPrint*, OtherOperand>::Format(value);
|
| 344 |
+
}
|
| 345 |
+
};
|
| 346 |
+
|
| 347 |
+
// By default, print C string as pointers to be safe, as we don't know
|
| 348 |
+
// whether they actually point to a NUL-terminated string.
|
| 349 |
+
|
| 350 |
+
#define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType) \
|
| 351 |
+
template <typename OtherOperand> \
|
| 352 |
+
class FormatForComparison<CharType*, OtherOperand> { \
|
| 353 |
+
public: \
|
| 354 |
+
static ::std::string Format(CharType* value) { \
|
| 355 |
+
return ::testing::PrintToString(static_cast<const void*>(value)); \
|
| 356 |
+
} \
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
|
| 360 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
|
| 361 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
|
| 362 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
|
| 363 |
+
#ifdef __cpp_char8_t
|
| 364 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char8_t);
|
| 365 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char8_t);
|
| 366 |
+
#endif
|
| 367 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char16_t);
|
| 368 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char16_t);
|
| 369 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char32_t);
|
| 370 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char32_t);
|
| 371 |
+
|
| 372 |
+
#undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
|
| 373 |
+
|
| 374 |
+
// If a C string is compared with an STL string object, we know it's meant
|
| 375 |
+
// to point to a NUL-terminated string, and thus can print it as a string.
|
| 376 |
+
|
| 377 |
+
#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
|
| 378 |
+
template <> \
|
| 379 |
+
class FormatForComparison<CharType*, OtherStringType> { \
|
| 380 |
+
public: \
|
| 381 |
+
static ::std::string Format(CharType* value) { \
|
| 382 |
+
return ::testing::PrintToString(value); \
|
| 383 |
+
} \
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
|
| 387 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
|
| 388 |
+
#ifdef __cpp_char8_t
|
| 389 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char8_t, ::std::u8string);
|
| 390 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char8_t, ::std::u8string);
|
| 391 |
+
#endif
|
| 392 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char16_t, ::std::u16string);
|
| 393 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char16_t, ::std::u16string);
|
| 394 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char32_t, ::std::u32string);
|
| 395 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char32_t, ::std::u32string);
|
| 396 |
+
|
| 397 |
+
#if GTEST_HAS_STD_WSTRING
|
| 398 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);
|
| 399 |
+
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
|
| 400 |
+
#endif
|
| 401 |
+
|
| 402 |
+
#undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
|
| 403 |
+
|
| 404 |
+
// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
|
| 405 |
+
// operand to be used in a failure message. The type (but not value)
|
| 406 |
+
// of the other operand may affect the format. This allows us to
|
| 407 |
+
// print a char* as a raw pointer when it is compared against another
|
| 408 |
+
// char* or void*, and print it as a C string when it is compared
|
| 409 |
+
// against an std::string object, for example.
|
| 410 |
+
//
|
| 411 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 412 |
+
template <typename T1, typename T2>
|
| 413 |
+
std::string FormatForComparisonFailureMessage(
|
| 414 |
+
const T1& value, const T2& /* other_operand */) {
|
| 415 |
+
return FormatForComparison<T1, T2>::Format(value);
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
// UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
|
| 419 |
+
// value to the given ostream. The caller must ensure that
|
| 420 |
+
// 'ostream_ptr' is not NULL, or the behavior is undefined.
|
| 421 |
+
//
|
| 422 |
+
// We define UniversalPrinter as a class template (as opposed to a
|
| 423 |
+
// function template), as we need to partially specialize it for
|
| 424 |
+
// reference types, which cannot be done with function templates.
|
| 425 |
+
template <typename T>
|
| 426 |
+
class UniversalPrinter;
|
| 427 |
+
|
| 428 |
+
// Prints the given value using the << operator if it has one;
|
| 429 |
+
// otherwise prints the bytes in it. This is what
|
| 430 |
+
// UniversalPrinter<T>::Print() does when PrintTo() is not specialized
|
| 431 |
+
// or overloaded for type T.
|
| 432 |
+
//
|
| 433 |
+
// A user can override this behavior for a class type Foo by defining
|
| 434 |
+
// an overload of PrintTo() in the namespace where Foo is defined. We
|
| 435 |
+
// give the user this option as sometimes defining a << operator for
|
| 436 |
+
// Foo is not desirable (e.g. the coding style may prevent doing it,
|
| 437 |
+
// or there is already a << operator but it doesn't do what the user
|
| 438 |
+
// wants).
|
| 439 |
+
template <typename T>
|
| 440 |
+
void PrintTo(const T& value, ::std::ostream* os) {
|
| 441 |
+
internal::PrintWithFallback(value, os);
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
// The following list of PrintTo() overloads tells
|
| 445 |
+
// UniversalPrinter<T>::Print() how to print standard types (built-in
|
| 446 |
+
// types, strings, plain arrays, and pointers).
|
| 447 |
+
|
| 448 |
+
// Overloads for various char types.
|
| 449 |
+
GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);
|
| 450 |
+
GTEST_API_ void PrintTo(signed char c, ::std::ostream* os);
|
| 451 |
+
inline void PrintTo(char c, ::std::ostream* os) {
|
| 452 |
+
// When printing a plain char, we always treat it as unsigned. This
|
| 453 |
+
// way, the output won't be affected by whether the compiler thinks
|
| 454 |
+
// char is signed or not.
|
| 455 |
+
PrintTo(static_cast<unsigned char>(c), os);
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
// Overloads for other simple built-in types.
|
| 459 |
+
inline void PrintTo(bool x, ::std::ostream* os) {
|
| 460 |
+
*os << (x ? "true" : "false");
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
// Overload for wchar_t type.
|
| 464 |
+
// Prints a wchar_t as a symbol if it is printable or as its internal
|
| 465 |
+
// code otherwise and also as its decimal code (except for L'\0').
|
| 466 |
+
// The L'\0' char is printed as "L'\\0'". The decimal code is printed
|
| 467 |
+
// as signed integer when wchar_t is implemented by the compiler
|
| 468 |
+
// as a signed type and is printed as an unsigned integer when wchar_t
|
| 469 |
+
// is implemented as an unsigned type.
|
| 470 |
+
GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
|
| 471 |
+
|
| 472 |
+
GTEST_API_ void PrintTo(char32_t c, ::std::ostream* os);
|
| 473 |
+
inline void PrintTo(char16_t c, ::std::ostream* os) {
|
| 474 |
+
PrintTo(ImplicitCast_<char32_t>(c), os);
|
| 475 |
+
}
|
| 476 |
+
#ifdef __cpp_char8_t
|
| 477 |
+
inline void PrintTo(char8_t c, ::std::ostream* os) {
|
| 478 |
+
PrintTo(ImplicitCast_<char32_t>(c), os);
|
| 479 |
+
}
|
| 480 |
+
#endif
|
| 481 |
+
|
| 482 |
+
// Overloads for C strings.
|
| 483 |
+
GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
|
| 484 |
+
inline void PrintTo(char* s, ::std::ostream* os) {
|
| 485 |
+
PrintTo(ImplicitCast_<const char*>(s), os);
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
// signed/unsigned char is often used for representing binary data, so
|
| 489 |
+
// we print pointers to it as void* to be safe.
|
| 490 |
+
inline void PrintTo(const signed char* s, ::std::ostream* os) {
|
| 491 |
+
PrintTo(ImplicitCast_<const void*>(s), os);
|
| 492 |
+
}
|
| 493 |
+
inline void PrintTo(signed char* s, ::std::ostream* os) {
|
| 494 |
+
PrintTo(ImplicitCast_<const void*>(s), os);
|
| 495 |
+
}
|
| 496 |
+
inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
|
| 497 |
+
PrintTo(ImplicitCast_<const void*>(s), os);
|
| 498 |
+
}
|
| 499 |
+
inline void PrintTo(unsigned char* s, ::std::ostream* os) {
|
| 500 |
+
PrintTo(ImplicitCast_<const void*>(s), os);
|
| 501 |
+
}
|
| 502 |
+
#ifdef __cpp_char8_t
|
| 503 |
+
// Overloads for u8 strings.
|
| 504 |
+
GTEST_API_ void PrintTo(const char8_t* s, ::std::ostream* os);
|
| 505 |
+
inline void PrintTo(char8_t* s, ::std::ostream* os) {
|
| 506 |
+
PrintTo(ImplicitCast_<const char8_t*>(s), os);
|
| 507 |
+
}
|
| 508 |
+
#endif
|
| 509 |
+
// Overloads for u16 strings.
|
| 510 |
+
GTEST_API_ void PrintTo(const char16_t* s, ::std::ostream* os);
|
| 511 |
+
inline void PrintTo(char16_t* s, ::std::ostream* os) {
|
| 512 |
+
PrintTo(ImplicitCast_<const char16_t*>(s), os);
|
| 513 |
+
}
|
| 514 |
+
// Overloads for u32 strings.
|
| 515 |
+
GTEST_API_ void PrintTo(const char32_t* s, ::std::ostream* os);
|
| 516 |
+
inline void PrintTo(char32_t* s, ::std::ostream* os) {
|
| 517 |
+
PrintTo(ImplicitCast_<const char32_t*>(s), os);
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
// MSVC can be configured to define wchar_t as a typedef of unsigned
|
| 521 |
+
// short. It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
|
| 522 |
+
// type. When wchar_t is a typedef, defining an overload for const
|
| 523 |
+
// wchar_t* would cause unsigned short* be printed as a wide string,
|
| 524 |
+
// possibly causing invalid memory accesses.
|
| 525 |
+
#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
|
| 526 |
+
// Overloads for wide C strings
|
| 527 |
+
GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);
|
| 528 |
+
inline void PrintTo(wchar_t* s, ::std::ostream* os) {
|
| 529 |
+
PrintTo(ImplicitCast_<const wchar_t*>(s), os);
|
| 530 |
+
}
|
| 531 |
+
#endif
|
| 532 |
+
|
| 533 |
+
// Overload for C arrays. Multi-dimensional arrays are printed
|
| 534 |
+
// properly.
|
| 535 |
+
|
| 536 |
+
// Prints the given number of elements in an array, without printing
|
| 537 |
+
// the curly braces.
|
| 538 |
+
template <typename T>
|
| 539 |
+
void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
|
| 540 |
+
UniversalPrint(a[0], os);
|
| 541 |
+
for (size_t i = 1; i != count; i++) {
|
| 542 |
+
*os << ", ";
|
| 543 |
+
UniversalPrint(a[i], os);
|
| 544 |
+
}
|
| 545 |
+
}
|
| 546 |
+
|
| 547 |
+
// Overloads for ::std::string.
|
| 548 |
+
GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);
|
| 549 |
+
inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
|
| 550 |
+
PrintStringTo(s, os);
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
// Overloads for ::std::u8string
|
| 554 |
+
#ifdef __cpp_char8_t
|
| 555 |
+
GTEST_API_ void PrintU8StringTo(const ::std::u8string& s, ::std::ostream* os);
|
| 556 |
+
inline void PrintTo(const ::std::u8string& s, ::std::ostream* os) {
|
| 557 |
+
PrintU8StringTo(s, os);
|
| 558 |
+
}
|
| 559 |
+
#endif
|
| 560 |
+
|
| 561 |
+
// Overloads for ::std::u16string
|
| 562 |
+
GTEST_API_ void PrintU16StringTo(const ::std::u16string& s, ::std::ostream* os);
|
| 563 |
+
inline void PrintTo(const ::std::u16string& s, ::std::ostream* os) {
|
| 564 |
+
PrintU16StringTo(s, os);
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
// Overloads for ::std::u32string
|
| 568 |
+
GTEST_API_ void PrintU32StringTo(const ::std::u32string& s, ::std::ostream* os);
|
| 569 |
+
inline void PrintTo(const ::std::u32string& s, ::std::ostream* os) {
|
| 570 |
+
PrintU32StringTo(s, os);
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
// Overloads for ::std::wstring.
|
| 574 |
+
#if GTEST_HAS_STD_WSTRING
|
| 575 |
+
GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
|
| 576 |
+
inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
|
| 577 |
+
PrintWideStringTo(s, os);
|
| 578 |
+
}
|
| 579 |
+
#endif // GTEST_HAS_STD_WSTRING
|
| 580 |
+
|
| 581 |
+
#if GTEST_INTERNAL_HAS_STRING_VIEW
|
| 582 |
+
// Overload for internal::StringView.
|
| 583 |
+
inline void PrintTo(internal::StringView sp, ::std::ostream* os) {
|
| 584 |
+
PrintTo(::std::string(sp), os);
|
| 585 |
+
}
|
| 586 |
+
#endif // GTEST_INTERNAL_HAS_STRING_VIEW
|
| 587 |
+
|
| 588 |
+
inline void PrintTo(std::nullptr_t, ::std::ostream* os) { *os << "(nullptr)"; }
|
| 589 |
+
|
| 590 |
+
template <typename T>
|
| 591 |
+
void PrintTo(std::reference_wrapper<T> ref, ::std::ostream* os) {
|
| 592 |
+
UniversalPrinter<T&>::Print(ref.get(), os);
|
| 593 |
+
}
|
| 594 |
+
|
| 595 |
+
inline const void* VoidifyPointer(const void* p) { return p; }
|
| 596 |
+
inline const void* VoidifyPointer(volatile const void* p) {
|
| 597 |
+
return const_cast<const void*>(p);
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
template <typename T, typename Ptr>
|
| 601 |
+
void PrintSmartPointer(const Ptr& ptr, std::ostream* os, char) {
|
| 602 |
+
if (ptr == nullptr) {
|
| 603 |
+
*os << "(nullptr)";
|
| 604 |
+
} else {
|
| 605 |
+
// We can't print the value. Just print the pointer..
|
| 606 |
+
*os << "(" << (VoidifyPointer)(ptr.get()) << ")";
|
| 607 |
+
}
|
| 608 |
+
}
|
| 609 |
+
template <typename T, typename Ptr,
|
| 610 |
+
typename = typename std::enable_if<!std::is_void<T>::value &&
|
| 611 |
+
!std::is_array<T>::value>::type>
|
| 612 |
+
void PrintSmartPointer(const Ptr& ptr, std::ostream* os, int) {
|
| 613 |
+
if (ptr == nullptr) {
|
| 614 |
+
*os << "(nullptr)";
|
| 615 |
+
} else {
|
| 616 |
+
*os << "(ptr = " << (VoidifyPointer)(ptr.get()) << ", value = ";
|
| 617 |
+
UniversalPrinter<T>::Print(*ptr, os);
|
| 618 |
+
*os << ")";
|
| 619 |
+
}
|
| 620 |
+
}
|
| 621 |
+
|
| 622 |
+
template <typename T, typename D>
|
| 623 |
+
void PrintTo(const std::unique_ptr<T, D>& ptr, std::ostream* os) {
|
| 624 |
+
(PrintSmartPointer<T>)(ptr, os, 0);
|
| 625 |
+
}
|
| 626 |
+
|
| 627 |
+
template <typename T>
|
| 628 |
+
void PrintTo(const std::shared_ptr<T>& ptr, std::ostream* os) {
|
| 629 |
+
(PrintSmartPointer<T>)(ptr, os, 0);
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
// Helper function for printing a tuple. T must be instantiated with
|
| 633 |
+
// a tuple type.
|
| 634 |
+
template <typename T>
|
| 635 |
+
void PrintTupleTo(const T&, std::integral_constant<size_t, 0>,
|
| 636 |
+
::std::ostream*) {}
|
| 637 |
+
|
| 638 |
+
template <typename T, size_t I>
|
| 639 |
+
void PrintTupleTo(const T& t, std::integral_constant<size_t, I>,
|
| 640 |
+
::std::ostream* os) {
|
| 641 |
+
PrintTupleTo(t, std::integral_constant<size_t, I - 1>(), os);
|
| 642 |
+
GTEST_INTENTIONAL_CONST_COND_PUSH_()
|
| 643 |
+
if (I > 1) {
|
| 644 |
+
GTEST_INTENTIONAL_CONST_COND_POP_()
|
| 645 |
+
*os << ", ";
|
| 646 |
+
}
|
| 647 |
+
UniversalPrinter<typename std::tuple_element<I - 1, T>::type>::Print(
|
| 648 |
+
std::get<I - 1>(t), os);
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
template <typename... Types>
|
| 652 |
+
void PrintTo(const ::std::tuple<Types...>& t, ::std::ostream* os) {
|
| 653 |
+
*os << "(";
|
| 654 |
+
PrintTupleTo(t, std::integral_constant<size_t, sizeof...(Types)>(), os);
|
| 655 |
+
*os << ")";
|
| 656 |
+
}
|
| 657 |
+
|
| 658 |
+
// Overload for std::pair.
|
| 659 |
+
template <typename T1, typename T2>
|
| 660 |
+
void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
|
| 661 |
+
*os << '(';
|
| 662 |
+
// We cannot use UniversalPrint(value.first, os) here, as T1 may be
|
| 663 |
+
// a reference type. The same for printing value.second.
|
| 664 |
+
UniversalPrinter<T1>::Print(value.first, os);
|
| 665 |
+
*os << ", ";
|
| 666 |
+
UniversalPrinter<T2>::Print(value.second, os);
|
| 667 |
+
*os << ')';
|
| 668 |
+
}
|
| 669 |
+
|
| 670 |
+
// Implements printing a non-reference type T by letting the compiler
|
| 671 |
+
// pick the right overload of PrintTo() for T.
|
| 672 |
+
template <typename T>
|
| 673 |
+
class UniversalPrinter {
|
| 674 |
+
public:
|
| 675 |
+
// MSVC warns about adding const to a function type, so we want to
|
| 676 |
+
// disable the warning.
|
| 677 |
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180)
|
| 678 |
+
|
| 679 |
+
// Note: we deliberately don't call this PrintTo(), as that name
|
| 680 |
+
// conflicts with ::testing::internal::PrintTo in the body of the
|
| 681 |
+
// function.
|
| 682 |
+
static void Print(const T& value, ::std::ostream* os) {
|
| 683 |
+
// By default, ::testing::internal::PrintTo() is used for printing
|
| 684 |
+
// the value.
|
| 685 |
+
//
|
| 686 |
+
// Thanks to Koenig look-up, if T is a class and has its own
|
| 687 |
+
// PrintTo() function defined in its namespace, that function will
|
| 688 |
+
// be visible here. Since it is more specific than the generic ones
|
| 689 |
+
// in ::testing::internal, it will be picked by the compiler in the
|
| 690 |
+
// following statement - exactly what we want.
|
| 691 |
+
PrintTo(value, os);
|
| 692 |
+
}
|
| 693 |
+
|
| 694 |
+
GTEST_DISABLE_MSC_WARNINGS_POP_()
|
| 695 |
+
};
|
| 696 |
+
|
| 697 |
+
// Remove any const-qualifiers before passing a type to UniversalPrinter.
|
| 698 |
+
template <typename T>
|
| 699 |
+
class UniversalPrinter<const T> : public UniversalPrinter<T> {};
|
| 700 |
+
|
| 701 |
+
#if GTEST_INTERNAL_HAS_ANY
|
| 702 |
+
|
| 703 |
+
// Printer for std::any / absl::any
|
| 704 |
+
|
| 705 |
+
template <>
|
| 706 |
+
class UniversalPrinter<Any> {
|
| 707 |
+
public:
|
| 708 |
+
static void Print(const Any& value, ::std::ostream* os) {
|
| 709 |
+
if (value.has_value()) {
|
| 710 |
+
*os << "value of type " << GetTypeName(value);
|
| 711 |
+
} else {
|
| 712 |
+
*os << "no value";
|
| 713 |
+
}
|
| 714 |
+
}
|
| 715 |
+
|
| 716 |
+
private:
|
| 717 |
+
static std::string GetTypeName(const Any& value) {
|
| 718 |
+
#if GTEST_HAS_RTTI
|
| 719 |
+
return internal::GetTypeName(value.type());
|
| 720 |
+
#else
|
| 721 |
+
static_cast<void>(value); // possibly unused
|
| 722 |
+
return "<unknown_type>";
|
| 723 |
+
#endif // GTEST_HAS_RTTI
|
| 724 |
+
}
|
| 725 |
+
};
|
| 726 |
+
|
| 727 |
+
#endif // GTEST_INTERNAL_HAS_ANY
|
| 728 |
+
|
| 729 |
+
#if GTEST_INTERNAL_HAS_OPTIONAL
|
| 730 |
+
|
| 731 |
+
// Printer for std::optional / absl::optional
|
| 732 |
+
|
| 733 |
+
template <typename T>
|
| 734 |
+
class UniversalPrinter<Optional<T>> {
|
| 735 |
+
public:
|
| 736 |
+
static void Print(const Optional<T>& value, ::std::ostream* os) {
|
| 737 |
+
*os << '(';
|
| 738 |
+
if (!value) {
|
| 739 |
+
*os << "nullopt";
|
| 740 |
+
} else {
|
| 741 |
+
UniversalPrint(*value, os);
|
| 742 |
+
}
|
| 743 |
+
*os << ')';
|
| 744 |
+
}
|
| 745 |
+
};
|
| 746 |
+
|
| 747 |
+
#endif // GTEST_INTERNAL_HAS_OPTIONAL
|
| 748 |
+
|
| 749 |
+
#if GTEST_INTERNAL_HAS_VARIANT
|
| 750 |
+
|
| 751 |
+
// Printer for std::variant / absl::variant
|
| 752 |
+
|
| 753 |
+
template <typename... T>
|
| 754 |
+
class UniversalPrinter<Variant<T...>> {
|
| 755 |
+
public:
|
| 756 |
+
static void Print(const Variant<T...>& value, ::std::ostream* os) {
|
| 757 |
+
*os << '(';
|
| 758 |
+
#if GTEST_HAS_ABSL
|
| 759 |
+
absl::visit(Visitor{os, value.index()}, value);
|
| 760 |
+
#else
|
| 761 |
+
std::visit(Visitor{os, value.index()}, value);
|
| 762 |
+
#endif // GTEST_HAS_ABSL
|
| 763 |
+
*os << ')';
|
| 764 |
+
}
|
| 765 |
+
|
| 766 |
+
private:
|
| 767 |
+
struct Visitor {
|
| 768 |
+
template <typename U>
|
| 769 |
+
void operator()(const U& u) const {
|
| 770 |
+
*os << "'" << GetTypeName<U>() << "(index = " << index
|
| 771 |
+
<< ")' with value ";
|
| 772 |
+
UniversalPrint(u, os);
|
| 773 |
+
}
|
| 774 |
+
::std::ostream* os;
|
| 775 |
+
std::size_t index;
|
| 776 |
+
};
|
| 777 |
+
};
|
| 778 |
+
|
| 779 |
+
#endif // GTEST_INTERNAL_HAS_VARIANT
|
| 780 |
+
|
| 781 |
+
// UniversalPrintArray(begin, len, os) prints an array of 'len'
|
| 782 |
+
// elements, starting at address 'begin'.
|
| 783 |
+
template <typename T>
|
| 784 |
+
void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
|
| 785 |
+
if (len == 0) {
|
| 786 |
+
*os << "{}";
|
| 787 |
+
} else {
|
| 788 |
+
*os << "{ ";
|
| 789 |
+
const size_t kThreshold = 18;
|
| 790 |
+
const size_t kChunkSize = 8;
|
| 791 |
+
// If the array has more than kThreshold elements, we'll have to
|
| 792 |
+
// omit some details by printing only the first and the last
|
| 793 |
+
// kChunkSize elements.
|
| 794 |
+
if (len <= kThreshold) {
|
| 795 |
+
PrintRawArrayTo(begin, len, os);
|
| 796 |
+
} else {
|
| 797 |
+
PrintRawArrayTo(begin, kChunkSize, os);
|
| 798 |
+
*os << ", ..., ";
|
| 799 |
+
PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
|
| 800 |
+
}
|
| 801 |
+
*os << " }";
|
| 802 |
+
}
|
| 803 |
+
}
|
| 804 |
+
// This overload prints a (const) char array compactly.
|
| 805 |
+
GTEST_API_ void UniversalPrintArray(
|
| 806 |
+
const char* begin, size_t len, ::std::ostream* os);
|
| 807 |
+
|
| 808 |
+
#ifdef __cpp_char8_t
|
| 809 |
+
// This overload prints a (const) char8_t array compactly.
|
| 810 |
+
GTEST_API_ void UniversalPrintArray(const char8_t* begin, size_t len,
|
| 811 |
+
::std::ostream* os);
|
| 812 |
+
#endif
|
| 813 |
+
|
| 814 |
+
// This overload prints a (const) char16_t array compactly.
|
| 815 |
+
GTEST_API_ void UniversalPrintArray(const char16_t* begin, size_t len,
|
| 816 |
+
::std::ostream* os);
|
| 817 |
+
|
| 818 |
+
// This overload prints a (const) char32_t array compactly.
|
| 819 |
+
GTEST_API_ void UniversalPrintArray(const char32_t* begin, size_t len,
|
| 820 |
+
::std::ostream* os);
|
| 821 |
+
|
| 822 |
+
// This overload prints a (const) wchar_t array compactly.
|
| 823 |
+
GTEST_API_ void UniversalPrintArray(
|
| 824 |
+
const wchar_t* begin, size_t len, ::std::ostream* os);
|
| 825 |
+
|
| 826 |
+
// Implements printing an array type T[N].
|
| 827 |
+
template <typename T, size_t N>
|
| 828 |
+
class UniversalPrinter<T[N]> {
|
| 829 |
+
public:
|
| 830 |
+
// Prints the given array, omitting some elements when there are too
|
| 831 |
+
// many.
|
| 832 |
+
static void Print(const T (&a)[N], ::std::ostream* os) {
|
| 833 |
+
UniversalPrintArray(a, N, os);
|
| 834 |
+
}
|
| 835 |
+
};
|
| 836 |
+
|
| 837 |
+
// Implements printing a reference type T&.
|
| 838 |
+
template <typename T>
|
| 839 |
+
class UniversalPrinter<T&> {
|
| 840 |
+
public:
|
| 841 |
+
// MSVC warns about adding const to a function type, so we want to
|
| 842 |
+
// disable the warning.
|
| 843 |
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180)
|
| 844 |
+
|
| 845 |
+
static void Print(const T& value, ::std::ostream* os) {
|
| 846 |
+
// Prints the address of the value. We use reinterpret_cast here
|
| 847 |
+
// as static_cast doesn't compile when T is a function type.
|
| 848 |
+
*os << "@" << reinterpret_cast<const void*>(&value) << " ";
|
| 849 |
+
|
| 850 |
+
// Then prints the value itself.
|
| 851 |
+
UniversalPrint(value, os);
|
| 852 |
+
}
|
| 853 |
+
|
| 854 |
+
GTEST_DISABLE_MSC_WARNINGS_POP_()
|
| 855 |
+
};
|
| 856 |
+
|
| 857 |
+
// Prints a value tersely: for a reference type, the referenced value
|
| 858 |
+
// (but not the address) is printed; for a (const) char pointer, the
|
| 859 |
+
// NUL-terminated string (but not the pointer) is printed.
|
| 860 |
+
|
| 861 |
+
template <typename T>
|
| 862 |
+
class UniversalTersePrinter {
|
| 863 |
+
public:
|
| 864 |
+
static void Print(const T& value, ::std::ostream* os) {
|
| 865 |
+
UniversalPrint(value, os);
|
| 866 |
+
}
|
| 867 |
+
};
|
| 868 |
+
template <typename T>
|
| 869 |
+
class UniversalTersePrinter<T&> {
|
| 870 |
+
public:
|
| 871 |
+
static void Print(const T& value, ::std::ostream* os) {
|
| 872 |
+
UniversalPrint(value, os);
|
| 873 |
+
}
|
| 874 |
+
};
|
| 875 |
+
template <typename T, size_t N>
|
| 876 |
+
class UniversalTersePrinter<T[N]> {
|
| 877 |
+
public:
|
| 878 |
+
static void Print(const T (&value)[N], ::std::ostream* os) {
|
| 879 |
+
UniversalPrinter<T[N]>::Print(value, os);
|
| 880 |
+
}
|
| 881 |
+
};
|
| 882 |
+
template <>
|
| 883 |
+
class UniversalTersePrinter<const char*> {
|
| 884 |
+
public:
|
| 885 |
+
static void Print(const char* str, ::std::ostream* os) {
|
| 886 |
+
if (str == nullptr) {
|
| 887 |
+
*os << "NULL";
|
| 888 |
+
} else {
|
| 889 |
+
UniversalPrint(std::string(str), os);
|
| 890 |
+
}
|
| 891 |
+
}
|
| 892 |
+
};
|
| 893 |
+
template <>
|
| 894 |
+
class UniversalTersePrinter<char*> : public UniversalTersePrinter<const char*> {
|
| 895 |
+
};
|
| 896 |
+
|
| 897 |
+
#ifdef __cpp_char8_t
|
| 898 |
+
template <>
|
| 899 |
+
class UniversalTersePrinter<const char8_t*> {
|
| 900 |
+
public:
|
| 901 |
+
static void Print(const char8_t* str, ::std::ostream* os) {
|
| 902 |
+
if (str == nullptr) {
|
| 903 |
+
*os << "NULL";
|
| 904 |
+
} else {
|
| 905 |
+
UniversalPrint(::std::u8string(str), os);
|
| 906 |
+
}
|
| 907 |
+
}
|
| 908 |
+
};
|
| 909 |
+
template <>
|
| 910 |
+
class UniversalTersePrinter<char8_t*>
|
| 911 |
+
: public UniversalTersePrinter<const char8_t*> {};
|
| 912 |
+
#endif
|
| 913 |
+
|
| 914 |
+
template <>
|
| 915 |
+
class UniversalTersePrinter<const char16_t*> {
|
| 916 |
+
public:
|
| 917 |
+
static void Print(const char16_t* str, ::std::ostream* os) {
|
| 918 |
+
if (str == nullptr) {
|
| 919 |
+
*os << "NULL";
|
| 920 |
+
} else {
|
| 921 |
+
UniversalPrint(::std::u16string(str), os);
|
| 922 |
+
}
|
| 923 |
+
}
|
| 924 |
+
};
|
| 925 |
+
template <>
|
| 926 |
+
class UniversalTersePrinter<char16_t*>
|
| 927 |
+
: public UniversalTersePrinter<const char16_t*> {};
|
| 928 |
+
|
| 929 |
+
template <>
|
| 930 |
+
class UniversalTersePrinter<const char32_t*> {
|
| 931 |
+
public:
|
| 932 |
+
static void Print(const char32_t* str, ::std::ostream* os) {
|
| 933 |
+
if (str == nullptr) {
|
| 934 |
+
*os << "NULL";
|
| 935 |
+
} else {
|
| 936 |
+
UniversalPrint(::std::u32string(str), os);
|
| 937 |
+
}
|
| 938 |
+
}
|
| 939 |
+
};
|
| 940 |
+
template <>
|
| 941 |
+
class UniversalTersePrinter<char32_t*>
|
| 942 |
+
: public UniversalTersePrinter<const char32_t*> {};
|
| 943 |
+
|
| 944 |
+
#if GTEST_HAS_STD_WSTRING
|
| 945 |
+
template <>
|
| 946 |
+
class UniversalTersePrinter<const wchar_t*> {
|
| 947 |
+
public:
|
| 948 |
+
static void Print(const wchar_t* str, ::std::ostream* os) {
|
| 949 |
+
if (str == nullptr) {
|
| 950 |
+
*os << "NULL";
|
| 951 |
+
} else {
|
| 952 |
+
UniversalPrint(::std::wstring(str), os);
|
| 953 |
+
}
|
| 954 |
+
}
|
| 955 |
+
};
|
| 956 |
+
#endif
|
| 957 |
+
|
| 958 |
+
template <>
|
| 959 |
+
class UniversalTersePrinter<wchar_t*> {
|
| 960 |
+
public:
|
| 961 |
+
static void Print(wchar_t* str, ::std::ostream* os) {
|
| 962 |
+
UniversalTersePrinter<const wchar_t*>::Print(str, os);
|
| 963 |
+
}
|
| 964 |
+
};
|
| 965 |
+
|
| 966 |
+
template <typename T>
|
| 967 |
+
void UniversalTersePrint(const T& value, ::std::ostream* os) {
|
| 968 |
+
UniversalTersePrinter<T>::Print(value, os);
|
| 969 |
+
}
|
| 970 |
+
|
| 971 |
+
// Prints a value using the type inferred by the compiler. The
|
| 972 |
+
// difference between this and UniversalTersePrint() is that for a
|
| 973 |
+
// (const) char pointer, this prints both the pointer and the
|
| 974 |
+
// NUL-terminated string.
|
| 975 |
+
template <typename T>
|
| 976 |
+
void UniversalPrint(const T& value, ::std::ostream* os) {
|
| 977 |
+
// A workarond for the bug in VC++ 7.1 that prevents us from instantiating
|
| 978 |
+
// UniversalPrinter with T directly.
|
| 979 |
+
typedef T T1;
|
| 980 |
+
UniversalPrinter<T1>::Print(value, os);
|
| 981 |
+
}
|
| 982 |
+
|
| 983 |
+
typedef ::std::vector< ::std::string> Strings;
|
| 984 |
+
|
| 985 |
+
// Tersely prints the first N fields of a tuple to a string vector,
|
| 986 |
+
// one element for each field.
|
| 987 |
+
template <typename Tuple>
|
| 988 |
+
void TersePrintPrefixToStrings(const Tuple&, std::integral_constant<size_t, 0>,
|
| 989 |
+
Strings*) {}
|
| 990 |
+
template <typename Tuple, size_t I>
|
| 991 |
+
void TersePrintPrefixToStrings(const Tuple& t,
|
| 992 |
+
std::integral_constant<size_t, I>,
|
| 993 |
+
Strings* strings) {
|
| 994 |
+
TersePrintPrefixToStrings(t, std::integral_constant<size_t, I - 1>(),
|
| 995 |
+
strings);
|
| 996 |
+
::std::stringstream ss;
|
| 997 |
+
UniversalTersePrint(std::get<I - 1>(t), &ss);
|
| 998 |
+
strings->push_back(ss.str());
|
| 999 |
+
}
|
| 1000 |
+
|
| 1001 |
+
// Prints the fields of a tuple tersely to a string vector, one
|
| 1002 |
+
// element for each field. See the comment before
|
| 1003 |
+
// UniversalTersePrint() for how we define "tersely".
|
| 1004 |
+
template <typename Tuple>
|
| 1005 |
+
Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
|
| 1006 |
+
Strings result;
|
| 1007 |
+
TersePrintPrefixToStrings(
|
| 1008 |
+
value, std::integral_constant<size_t, std::tuple_size<Tuple>::value>(),
|
| 1009 |
+
&result);
|
| 1010 |
+
return result;
|
| 1011 |
+
}
|
| 1012 |
+
|
| 1013 |
+
} // namespace internal
|
| 1014 |
+
|
| 1015 |
+
template <typename T>
|
| 1016 |
+
::std::string PrintToString(const T& value) {
|
| 1017 |
+
::std::stringstream ss;
|
| 1018 |
+
internal::UniversalTersePrinter<T>::Print(value, &ss);
|
| 1019 |
+
return ss.str();
|
| 1020 |
+
}
|
| 1021 |
+
|
| 1022 |
+
} // namespace testing
|
| 1023 |
+
|
| 1024 |
+
// Include any custom printer added by the local installation.
|
| 1025 |
+
// We must include this header at the end to make sure it can use the
|
| 1026 |
+
// declarations from this file.
|
| 1027 |
+
#include "gtest/internal/custom/gtest-printers.h"
|
| 1028 |
+
|
| 1029 |
+
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-spi.h
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2007, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
//
|
| 31 |
+
// Utilities for testing Google Test itself and code that uses Google Test
|
| 32 |
+
// (e.g. frameworks built on top of Google Test).
|
| 33 |
+
|
| 34 |
+
// GOOGLETEST_CM0004 DO NOT DELETE
|
| 35 |
+
|
| 36 |
+
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_SPI_H_
|
| 37 |
+
#define GOOGLETEST_INCLUDE_GTEST_GTEST_SPI_H_
|
| 38 |
+
|
| 39 |
+
#include "gtest/gtest.h"
|
| 40 |
+
|
| 41 |
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
| 42 |
+
/* class A needs to have dll-interface to be used by clients of class B */)
|
| 43 |
+
|
| 44 |
+
namespace testing {
|
| 45 |
+
|
| 46 |
+
// This helper class can be used to mock out Google Test failure reporting
|
| 47 |
+
// so that we can test Google Test or code that builds on Google Test.
|
| 48 |
+
//
|
| 49 |
+
// An object of this class appends a TestPartResult object to the
|
| 50 |
+
// TestPartResultArray object given in the constructor whenever a Google Test
|
| 51 |
+
// failure is reported. It can either intercept only failures that are
|
| 52 |
+
// generated in the same thread that created this object or it can intercept
|
| 53 |
+
// all generated failures. The scope of this mock object can be controlled with
|
| 54 |
+
// the second argument to the two arguments constructor.
|
| 55 |
+
class GTEST_API_ ScopedFakeTestPartResultReporter
|
| 56 |
+
: public TestPartResultReporterInterface {
|
| 57 |
+
public:
|
| 58 |
+
// The two possible mocking modes of this object.
|
| 59 |
+
enum InterceptMode {
|
| 60 |
+
INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures.
|
| 61 |
+
INTERCEPT_ALL_THREADS // Intercepts all failures.
|
| 62 |
+
};
|
| 63 |
+
|
| 64 |
+
// The c'tor sets this object as the test part result reporter used
|
| 65 |
+
// by Google Test. The 'result' parameter specifies where to report the
|
| 66 |
+
// results. This reporter will only catch failures generated in the current
|
| 67 |
+
// thread. DEPRECATED
|
| 68 |
+
explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
|
| 69 |
+
|
| 70 |
+
// Same as above, but you can choose the interception scope of this object.
|
| 71 |
+
ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
|
| 72 |
+
TestPartResultArray* result);
|
| 73 |
+
|
| 74 |
+
// The d'tor restores the previous test part result reporter.
|
| 75 |
+
~ScopedFakeTestPartResultReporter() override;
|
| 76 |
+
|
| 77 |
+
// Appends the TestPartResult object to the TestPartResultArray
|
| 78 |
+
// received in the constructor.
|
| 79 |
+
//
|
| 80 |
+
// This method is from the TestPartResultReporterInterface
|
| 81 |
+
// interface.
|
| 82 |
+
void ReportTestPartResult(const TestPartResult& result) override;
|
| 83 |
+
|
| 84 |
+
private:
|
| 85 |
+
void Init();
|
| 86 |
+
|
| 87 |
+
const InterceptMode intercept_mode_;
|
| 88 |
+
TestPartResultReporterInterface* old_reporter_;
|
| 89 |
+
TestPartResultArray* const result_;
|
| 90 |
+
|
| 91 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
|
| 92 |
+
};
|
| 93 |
+
|
| 94 |
+
namespace internal {
|
| 95 |
+
|
| 96 |
+
// A helper class for implementing EXPECT_FATAL_FAILURE() and
|
| 97 |
+
// EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given
|
| 98 |
+
// TestPartResultArray contains exactly one failure that has the given
|
| 99 |
+
// type and contains the given substring. If that's not the case, a
|
| 100 |
+
// non-fatal failure will be generated.
|
| 101 |
+
class GTEST_API_ SingleFailureChecker {
|
| 102 |
+
public:
|
| 103 |
+
// The constructor remembers the arguments.
|
| 104 |
+
SingleFailureChecker(const TestPartResultArray* results,
|
| 105 |
+
TestPartResult::Type type, const std::string& substr);
|
| 106 |
+
~SingleFailureChecker();
|
| 107 |
+
private:
|
| 108 |
+
const TestPartResultArray* const results_;
|
| 109 |
+
const TestPartResult::Type type_;
|
| 110 |
+
const std::string substr_;
|
| 111 |
+
|
| 112 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
|
| 113 |
+
};
|
| 114 |
+
|
| 115 |
+
} // namespace internal
|
| 116 |
+
|
| 117 |
+
} // namespace testing
|
| 118 |
+
|
| 119 |
+
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
| 120 |
+
|
| 121 |
+
// A set of macros for testing Google Test assertions or code that's expected
|
| 122 |
+
// to generate Google Test fatal failures. It verifies that the given
|
| 123 |
+
// statement will cause exactly one fatal Google Test failure with 'substr'
|
| 124 |
+
// being part of the failure message.
|
| 125 |
+
//
|
| 126 |
+
// There are two different versions of this macro. EXPECT_FATAL_FAILURE only
|
| 127 |
+
// affects and considers failures generated in the current thread and
|
| 128 |
+
// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
|
| 129 |
+
//
|
| 130 |
+
// The verification of the assertion is done correctly even when the statement
|
| 131 |
+
// throws an exception or aborts the current function.
|
| 132 |
+
//
|
| 133 |
+
// Known restrictions:
|
| 134 |
+
// - 'statement' cannot reference local non-static variables or
|
| 135 |
+
// non-static members of the current object.
|
| 136 |
+
// - 'statement' cannot return a value.
|
| 137 |
+
// - You cannot stream a failure message to this macro.
|
| 138 |
+
//
|
| 139 |
+
// Note that even though the implementations of the following two
|
| 140 |
+
// macros are much alike, we cannot refactor them to use a common
|
| 141 |
+
// helper macro, due to some peculiarity in how the preprocessor
|
| 142 |
+
// works. The AcceptsMacroThatExpandsToUnprotectedComma test in
|
| 143 |
+
// gtest_unittest.cc will fail to compile if we do that.
|
| 144 |
+
#define EXPECT_FATAL_FAILURE(statement, substr) \
|
| 145 |
+
do { \
|
| 146 |
+
class GTestExpectFatalFailureHelper {\
|
| 147 |
+
public:\
|
| 148 |
+
static void Execute() { statement; }\
|
| 149 |
+
};\
|
| 150 |
+
::testing::TestPartResultArray gtest_failures;\
|
| 151 |
+
::testing::internal::SingleFailureChecker gtest_checker(\
|
| 152 |
+
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
|
| 153 |
+
{\
|
| 154 |
+
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
| 155 |
+
::testing::ScopedFakeTestPartResultReporter:: \
|
| 156 |
+
INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
|
| 157 |
+
GTestExpectFatalFailureHelper::Execute();\
|
| 158 |
+
}\
|
| 159 |
+
} while (::testing::internal::AlwaysFalse())
|
| 160 |
+
|
| 161 |
+
#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
| 162 |
+
do { \
|
| 163 |
+
class GTestExpectFatalFailureHelper {\
|
| 164 |
+
public:\
|
| 165 |
+
static void Execute() { statement; }\
|
| 166 |
+
};\
|
| 167 |
+
::testing::TestPartResultArray gtest_failures;\
|
| 168 |
+
::testing::internal::SingleFailureChecker gtest_checker(\
|
| 169 |
+
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
|
| 170 |
+
{\
|
| 171 |
+
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
| 172 |
+
::testing::ScopedFakeTestPartResultReporter:: \
|
| 173 |
+
INTERCEPT_ALL_THREADS, >est_failures);\
|
| 174 |
+
GTestExpectFatalFailureHelper::Execute();\
|
| 175 |
+
}\
|
| 176 |
+
} while (::testing::internal::AlwaysFalse())
|
| 177 |
+
|
| 178 |
+
// A macro for testing Google Test assertions or code that's expected to
|
| 179 |
+
// generate Google Test non-fatal failures. It asserts that the given
|
| 180 |
+
// statement will cause exactly one non-fatal Google Test failure with 'substr'
|
| 181 |
+
// being part of the failure message.
|
| 182 |
+
//
|
| 183 |
+
// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
|
| 184 |
+
// affects and considers failures generated in the current thread and
|
| 185 |
+
// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
|
| 186 |
+
//
|
| 187 |
+
// 'statement' is allowed to reference local variables and members of
|
| 188 |
+
// the current object.
|
| 189 |
+
//
|
| 190 |
+
// The verification of the assertion is done correctly even when the statement
|
| 191 |
+
// throws an exception or aborts the current function.
|
| 192 |
+
//
|
| 193 |
+
// Known restrictions:
|
| 194 |
+
// - You cannot stream a failure message to this macro.
|
| 195 |
+
//
|
| 196 |
+
// Note that even though the implementations of the following two
|
| 197 |
+
// macros are much alike, we cannot refactor them to use a common
|
| 198 |
+
// helper macro, due to some peculiarity in how the preprocessor
|
| 199 |
+
// works. If we do that, the code won't compile when the user gives
|
| 200 |
+
// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that
|
| 201 |
+
// expands to code containing an unprotected comma. The
|
| 202 |
+
// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc
|
| 203 |
+
// catches that.
|
| 204 |
+
//
|
| 205 |
+
// For the same reason, we have to write
|
| 206 |
+
// if (::testing::internal::AlwaysTrue()) { statement; }
|
| 207 |
+
// instead of
|
| 208 |
+
// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
|
| 209 |
+
// to avoid an MSVC warning on unreachable code.
|
| 210 |
+
#define EXPECT_NONFATAL_FAILURE(statement, substr) \
|
| 211 |
+
do {\
|
| 212 |
+
::testing::TestPartResultArray gtest_failures;\
|
| 213 |
+
::testing::internal::SingleFailureChecker gtest_checker(\
|
| 214 |
+
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \
|
| 215 |
+
(substr));\
|
| 216 |
+
{\
|
| 217 |
+
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
| 218 |
+
::testing::ScopedFakeTestPartResultReporter:: \
|
| 219 |
+
INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
|
| 220 |
+
if (::testing::internal::AlwaysTrue()) { statement; }\
|
| 221 |
+
}\
|
| 222 |
+
} while (::testing::internal::AlwaysFalse())
|
| 223 |
+
|
| 224 |
+
#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
| 225 |
+
do {\
|
| 226 |
+
::testing::TestPartResultArray gtest_failures;\
|
| 227 |
+
::testing::internal::SingleFailureChecker gtest_checker(\
|
| 228 |
+
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \
|
| 229 |
+
(substr));\
|
| 230 |
+
{\
|
| 231 |
+
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
| 232 |
+
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
|
| 233 |
+
>est_failures);\
|
| 234 |
+
if (::testing::internal::AlwaysTrue()) { statement; }\
|
| 235 |
+
}\
|
| 236 |
+
} while (::testing::internal::AlwaysFalse())
|
| 237 |
+
|
| 238 |
+
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_SPI_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-test-part.h
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2008, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
//
|
| 30 |
+
// GOOGLETEST_CM0001 DO NOT DELETE
|
| 31 |
+
|
| 32 |
+
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
| 33 |
+
#define GOOGLETEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
| 34 |
+
|
| 35 |
+
#include <iosfwd>
|
| 36 |
+
#include <vector>
|
| 37 |
+
#include "gtest/internal/gtest-internal.h"
|
| 38 |
+
#include "gtest/internal/gtest-string.h"
|
| 39 |
+
|
| 40 |
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
| 41 |
+
/* class A needs to have dll-interface to be used by clients of class B */)
|
| 42 |
+
|
| 43 |
+
namespace testing {
|
| 44 |
+
|
| 45 |
+
// A copyable object representing the result of a test part (i.e. an
|
| 46 |
+
// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
|
| 47 |
+
//
|
| 48 |
+
// Don't inherit from TestPartResult as its destructor is not virtual.
|
| 49 |
+
class GTEST_API_ TestPartResult {
|
| 50 |
+
public:
|
| 51 |
+
// The possible outcomes of a test part (i.e. an assertion or an
|
| 52 |
+
// explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
|
| 53 |
+
enum Type {
|
| 54 |
+
kSuccess, // Succeeded.
|
| 55 |
+
kNonFatalFailure, // Failed but the test can continue.
|
| 56 |
+
kFatalFailure, // Failed and the test should be terminated.
|
| 57 |
+
kSkip // Skipped.
|
| 58 |
+
};
|
| 59 |
+
|
| 60 |
+
// C'tor. TestPartResult does NOT have a default constructor.
|
| 61 |
+
// Always use this constructor (with parameters) to create a
|
| 62 |
+
// TestPartResult object.
|
| 63 |
+
TestPartResult(Type a_type, const char* a_file_name, int a_line_number,
|
| 64 |
+
const char* a_message)
|
| 65 |
+
: type_(a_type),
|
| 66 |
+
file_name_(a_file_name == nullptr ? "" : a_file_name),
|
| 67 |
+
line_number_(a_line_number),
|
| 68 |
+
summary_(ExtractSummary(a_message)),
|
| 69 |
+
message_(a_message) {}
|
| 70 |
+
|
| 71 |
+
// Gets the outcome of the test part.
|
| 72 |
+
Type type() const { return type_; }
|
| 73 |
+
|
| 74 |
+
// Gets the name of the source file where the test part took place, or
|
| 75 |
+
// NULL if it's unknown.
|
| 76 |
+
const char* file_name() const {
|
| 77 |
+
return file_name_.empty() ? nullptr : file_name_.c_str();
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
// Gets the line in the source file where the test part took place,
|
| 81 |
+
// or -1 if it's unknown.
|
| 82 |
+
int line_number() const { return line_number_; }
|
| 83 |
+
|
| 84 |
+
// Gets the summary of the failure message.
|
| 85 |
+
const char* summary() const { return summary_.c_str(); }
|
| 86 |
+
|
| 87 |
+
// Gets the message associated with the test part.
|
| 88 |
+
const char* message() const { return message_.c_str(); }
|
| 89 |
+
|
| 90 |
+
// Returns true if and only if the test part was skipped.
|
| 91 |
+
bool skipped() const { return type_ == kSkip; }
|
| 92 |
+
|
| 93 |
+
// Returns true if and only if the test part passed.
|
| 94 |
+
bool passed() const { return type_ == kSuccess; }
|
| 95 |
+
|
| 96 |
+
// Returns true if and only if the test part non-fatally failed.
|
| 97 |
+
bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
|
| 98 |
+
|
| 99 |
+
// Returns true if and only if the test part fatally failed.
|
| 100 |
+
bool fatally_failed() const { return type_ == kFatalFailure; }
|
| 101 |
+
|
| 102 |
+
// Returns true if and only if the test part failed.
|
| 103 |
+
bool failed() const { return fatally_failed() || nonfatally_failed(); }
|
| 104 |
+
|
| 105 |
+
private:
|
| 106 |
+
Type type_;
|
| 107 |
+
|
| 108 |
+
// Gets the summary of the failure message by omitting the stack
|
| 109 |
+
// trace in it.
|
| 110 |
+
static std::string ExtractSummary(const char* message);
|
| 111 |
+
|
| 112 |
+
// The name of the source file where the test part took place, or
|
| 113 |
+
// "" if the source file is unknown.
|
| 114 |
+
std::string file_name_;
|
| 115 |
+
// The line in the source file where the test part took place, or -1
|
| 116 |
+
// if the line number is unknown.
|
| 117 |
+
int line_number_;
|
| 118 |
+
std::string summary_; // The test failure summary.
|
| 119 |
+
std::string message_; // The test failure message.
|
| 120 |
+
};
|
| 121 |
+
|
| 122 |
+
// Prints a TestPartResult object.
|
| 123 |
+
std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
|
| 124 |
+
|
| 125 |
+
// An array of TestPartResult objects.
|
| 126 |
+
//
|
| 127 |
+
// Don't inherit from TestPartResultArray as its destructor is not
|
| 128 |
+
// virtual.
|
| 129 |
+
class GTEST_API_ TestPartResultArray {
|
| 130 |
+
public:
|
| 131 |
+
TestPartResultArray() {}
|
| 132 |
+
|
| 133 |
+
// Appends the given TestPartResult to the array.
|
| 134 |
+
void Append(const TestPartResult& result);
|
| 135 |
+
|
| 136 |
+
// Returns the TestPartResult at the given index (0-based).
|
| 137 |
+
const TestPartResult& GetTestPartResult(int index) const;
|
| 138 |
+
|
| 139 |
+
// Returns the number of TestPartResult objects in the array.
|
| 140 |
+
int size() const;
|
| 141 |
+
|
| 142 |
+
private:
|
| 143 |
+
std::vector<TestPartResult> array_;
|
| 144 |
+
|
| 145 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
|
| 146 |
+
};
|
| 147 |
+
|
| 148 |
+
// This interface knows how to report a test part result.
|
| 149 |
+
class GTEST_API_ TestPartResultReporterInterface {
|
| 150 |
+
public:
|
| 151 |
+
virtual ~TestPartResultReporterInterface() {}
|
| 152 |
+
|
| 153 |
+
virtual void ReportTestPartResult(const TestPartResult& result) = 0;
|
| 154 |
+
};
|
| 155 |
+
|
| 156 |
+
namespace internal {
|
| 157 |
+
|
| 158 |
+
// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
|
| 159 |
+
// statement generates new fatal failures. To do so it registers itself as the
|
| 160 |
+
// current test part result reporter. Besides checking if fatal failures were
|
| 161 |
+
// reported, it only delegates the reporting to the former result reporter.
|
| 162 |
+
// The original result reporter is restored in the destructor.
|
| 163 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 164 |
+
class GTEST_API_ HasNewFatalFailureHelper
|
| 165 |
+
: public TestPartResultReporterInterface {
|
| 166 |
+
public:
|
| 167 |
+
HasNewFatalFailureHelper();
|
| 168 |
+
~HasNewFatalFailureHelper() override;
|
| 169 |
+
void ReportTestPartResult(const TestPartResult& result) override;
|
| 170 |
+
bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
|
| 171 |
+
private:
|
| 172 |
+
bool has_new_fatal_failure_;
|
| 173 |
+
TestPartResultReporterInterface* original_reporter_;
|
| 174 |
+
|
| 175 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
|
| 176 |
+
};
|
| 177 |
+
|
| 178 |
+
} // namespace internal
|
| 179 |
+
|
| 180 |
+
} // namespace testing
|
| 181 |
+
|
| 182 |
+
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
| 183 |
+
|
| 184 |
+
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest-typed-test.h
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2008 Google Inc.
|
| 2 |
+
// All Rights Reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
// GOOGLETEST_CM0001 DO NOT DELETE
|
| 31 |
+
|
| 32 |
+
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
|
| 33 |
+
#define GOOGLETEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
|
| 34 |
+
|
| 35 |
+
// This header implements typed tests and type-parameterized tests.
|
| 36 |
+
|
| 37 |
+
// Typed (aka type-driven) tests repeat the same test for types in a
|
| 38 |
+
// list. You must know which types you want to test with when writing
|
| 39 |
+
// typed tests. Here's how you do it:
|
| 40 |
+
|
| 41 |
+
#if 0
|
| 42 |
+
|
| 43 |
+
// First, define a fixture class template. It should be parameterized
|
| 44 |
+
// by a type. Remember to derive it from testing::Test.
|
| 45 |
+
template <typename T>
|
| 46 |
+
class FooTest : public testing::Test {
|
| 47 |
+
public:
|
| 48 |
+
...
|
| 49 |
+
typedef std::list<T> List;
|
| 50 |
+
static T shared_;
|
| 51 |
+
T value_;
|
| 52 |
+
};
|
| 53 |
+
|
| 54 |
+
// Next, associate a list of types with the test suite, which will be
|
| 55 |
+
// repeated for each type in the list. The typedef is necessary for
|
| 56 |
+
// the macro to parse correctly.
|
| 57 |
+
typedef testing::Types<char, int, unsigned int> MyTypes;
|
| 58 |
+
TYPED_TEST_SUITE(FooTest, MyTypes);
|
| 59 |
+
|
| 60 |
+
// If the type list contains only one type, you can write that type
|
| 61 |
+
// directly without Types<...>:
|
| 62 |
+
// TYPED_TEST_SUITE(FooTest, int);
|
| 63 |
+
|
| 64 |
+
// Then, use TYPED_TEST() instead of TEST_F() to define as many typed
|
| 65 |
+
// tests for this test suite as you want.
|
| 66 |
+
TYPED_TEST(FooTest, DoesBlah) {
|
| 67 |
+
// Inside a test, refer to the special name TypeParam to get the type
|
| 68 |
+
// parameter. Since we are inside a derived class template, C++ requires
|
| 69 |
+
// us to visit the members of FooTest via 'this'.
|
| 70 |
+
TypeParam n = this->value_;
|
| 71 |
+
|
| 72 |
+
// To visit static members of the fixture, add the TestFixture::
|
| 73 |
+
// prefix.
|
| 74 |
+
n += TestFixture::shared_;
|
| 75 |
+
|
| 76 |
+
// To refer to typedefs in the fixture, add the "typename
|
| 77 |
+
// TestFixture::" prefix.
|
| 78 |
+
typename TestFixture::List values;
|
| 79 |
+
values.push_back(n);
|
| 80 |
+
...
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
TYPED_TEST(FooTest, HasPropertyA) { ... }
|
| 84 |
+
|
| 85 |
+
// TYPED_TEST_SUITE takes an optional third argument which allows to specify a
|
| 86 |
+
// class that generates custom test name suffixes based on the type. This should
|
| 87 |
+
// be a class which has a static template function GetName(int index) returning
|
| 88 |
+
// a string for each type. The provided integer index equals the index of the
|
| 89 |
+
// type in the provided type list. In many cases the index can be ignored.
|
| 90 |
+
//
|
| 91 |
+
// For example:
|
| 92 |
+
// class MyTypeNames {
|
| 93 |
+
// public:
|
| 94 |
+
// template <typename T>
|
| 95 |
+
// static std::string GetName(int) {
|
| 96 |
+
// if (std::is_same<T, char>()) return "char";
|
| 97 |
+
// if (std::is_same<T, int>()) return "int";
|
| 98 |
+
// if (std::is_same<T, unsigned int>()) return "unsignedInt";
|
| 99 |
+
// }
|
| 100 |
+
// };
|
| 101 |
+
// TYPED_TEST_SUITE(FooTest, MyTypes, MyTypeNames);
|
| 102 |
+
|
| 103 |
+
#endif // 0
|
| 104 |
+
|
| 105 |
+
// Type-parameterized tests are abstract test patterns parameterized
|
| 106 |
+
// by a type. Compared with typed tests, type-parameterized tests
|
| 107 |
+
// allow you to define the test pattern without knowing what the type
|
| 108 |
+
// parameters are. The defined pattern can be instantiated with
|
| 109 |
+
// different types any number of times, in any number of translation
|
| 110 |
+
// units.
|
| 111 |
+
//
|
| 112 |
+
// If you are designing an interface or concept, you can define a
|
| 113 |
+
// suite of type-parameterized tests to verify properties that any
|
| 114 |
+
// valid implementation of the interface/concept should have. Then,
|
| 115 |
+
// each implementation can easily instantiate the test suite to verify
|
| 116 |
+
// that it conforms to the requirements, without having to write
|
| 117 |
+
// similar tests repeatedly. Here's an example:
|
| 118 |
+
|
| 119 |
+
#if 0
|
| 120 |
+
|
| 121 |
+
// First, define a fixture class template. It should be parameterized
|
| 122 |
+
// by a type. Remember to derive it from testing::Test.
|
| 123 |
+
template <typename T>
|
| 124 |
+
class FooTest : public testing::Test {
|
| 125 |
+
...
|
| 126 |
+
};
|
| 127 |
+
|
| 128 |
+
// Next, declare that you will define a type-parameterized test suite
|
| 129 |
+
// (the _P suffix is for "parameterized" or "pattern", whichever you
|
| 130 |
+
// prefer):
|
| 131 |
+
TYPED_TEST_SUITE_P(FooTest);
|
| 132 |
+
|
| 133 |
+
// Then, use TYPED_TEST_P() to define as many type-parameterized tests
|
| 134 |
+
// for this type-parameterized test suite as you want.
|
| 135 |
+
TYPED_TEST_P(FooTest, DoesBlah) {
|
| 136 |
+
// Inside a test, refer to TypeParam to get the type parameter.
|
| 137 |
+
TypeParam n = 0;
|
| 138 |
+
...
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
TYPED_TEST_P(FooTest, HasPropertyA) { ... }
|
| 142 |
+
|
| 143 |
+
// Now the tricky part: you need to register all test patterns before
|
| 144 |
+
// you can instantiate them. The first argument of the macro is the
|
| 145 |
+
// test suite name; the rest are the names of the tests in this test
|
| 146 |
+
// case.
|
| 147 |
+
REGISTER_TYPED_TEST_SUITE_P(FooTest,
|
| 148 |
+
DoesBlah, HasPropertyA);
|
| 149 |
+
|
| 150 |
+
// Finally, you are free to instantiate the pattern with the types you
|
| 151 |
+
// want. If you put the above code in a header file, you can #include
|
| 152 |
+
// it in multiple C++ source files and instantiate it multiple times.
|
| 153 |
+
//
|
| 154 |
+
// To distinguish different instances of the pattern, the first
|
| 155 |
+
// argument to the INSTANTIATE_* macro is a prefix that will be added
|
| 156 |
+
// to the actual test suite name. Remember to pick unique prefixes for
|
| 157 |
+
// different instances.
|
| 158 |
+
typedef testing::Types<char, int, unsigned int> MyTypes;
|
| 159 |
+
INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
|
| 160 |
+
|
| 161 |
+
// If the type list contains only one type, you can write that type
|
| 162 |
+
// directly without Types<...>:
|
| 163 |
+
// INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, int);
|
| 164 |
+
//
|
| 165 |
+
// Similar to the optional argument of TYPED_TEST_SUITE above,
|
| 166 |
+
// INSTANTIATE_TEST_SUITE_P takes an optional fourth argument which allows to
|
| 167 |
+
// generate custom names.
|
| 168 |
+
// INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes, MyTypeNames);
|
| 169 |
+
|
| 170 |
+
#endif // 0
|
| 171 |
+
|
| 172 |
+
#include "gtest/internal/gtest-internal.h"
|
| 173 |
+
#include "gtest/internal/gtest-port.h"
|
| 174 |
+
#include "gtest/internal/gtest-type-util.h"
|
| 175 |
+
|
| 176 |
+
// Implements typed tests.
|
| 177 |
+
|
| 178 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
| 179 |
+
//
|
| 180 |
+
// Expands to the name of the typedef for the type parameters of the
|
| 181 |
+
// given test suite.
|
| 182 |
+
#define GTEST_TYPE_PARAMS_(TestSuiteName) gtest_type_params_##TestSuiteName##_
|
| 183 |
+
|
| 184 |
+
// Expands to the name of the typedef for the NameGenerator, responsible for
|
| 185 |
+
// creating the suffixes of the name.
|
| 186 |
+
#define GTEST_NAME_GENERATOR_(TestSuiteName) \
|
| 187 |
+
gtest_type_params_##TestSuiteName##_NameGenerator
|
| 188 |
+
|
| 189 |
+
#define TYPED_TEST_SUITE(CaseName, Types, ...) \
|
| 190 |
+
typedef ::testing::internal::GenerateTypeList<Types>::type \
|
| 191 |
+
GTEST_TYPE_PARAMS_(CaseName); \
|
| 192 |
+
typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \
|
| 193 |
+
GTEST_NAME_GENERATOR_(CaseName)
|
| 194 |
+
|
| 195 |
+
#define TYPED_TEST(CaseName, TestName) \
|
| 196 |
+
static_assert(sizeof(GTEST_STRINGIFY_(TestName)) > 1, \
|
| 197 |
+
"test-name must not be empty"); \
|
| 198 |
+
template <typename gtest_TypeParam_> \
|
| 199 |
+
class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
|
| 200 |
+
: public CaseName<gtest_TypeParam_> { \
|
| 201 |
+
private: \
|
| 202 |
+
typedef CaseName<gtest_TypeParam_> TestFixture; \
|
| 203 |
+
typedef gtest_TypeParam_ TypeParam; \
|
| 204 |
+
void TestBody() override; \
|
| 205 |
+
}; \
|
| 206 |
+
static bool gtest_##CaseName##_##TestName##_registered_ \
|
| 207 |
+
GTEST_ATTRIBUTE_UNUSED_ = ::testing::internal::TypeParameterizedTest< \
|
| 208 |
+
CaseName, \
|
| 209 |
+
::testing::internal::TemplateSel<GTEST_TEST_CLASS_NAME_(CaseName, \
|
| 210 |
+
TestName)>, \
|
| 211 |
+
GTEST_TYPE_PARAMS_( \
|
| 212 |
+
CaseName)>::Register("", \
|
| 213 |
+
::testing::internal::CodeLocation( \
|
| 214 |
+
__FILE__, __LINE__), \
|
| 215 |
+
GTEST_STRINGIFY_(CaseName), \
|
| 216 |
+
GTEST_STRINGIFY_(TestName), 0, \
|
| 217 |
+
::testing::internal::GenerateNames< \
|
| 218 |
+
GTEST_NAME_GENERATOR_(CaseName), \
|
| 219 |
+
GTEST_TYPE_PARAMS_(CaseName)>()); \
|
| 220 |
+
template <typename gtest_TypeParam_> \
|
| 221 |
+
void GTEST_TEST_CLASS_NAME_(CaseName, \
|
| 222 |
+
TestName)<gtest_TypeParam_>::TestBody()
|
| 223 |
+
|
| 224 |
+
// Legacy API is deprecated but still available
|
| 225 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 226 |
+
#define TYPED_TEST_CASE \
|
| 227 |
+
static_assert(::testing::internal::TypedTestCaseIsDeprecated(), ""); \
|
| 228 |
+
TYPED_TEST_SUITE
|
| 229 |
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 230 |
+
|
| 231 |
+
// Implements type-parameterized tests.
|
| 232 |
+
|
| 233 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
| 234 |
+
//
|
| 235 |
+
// Expands to the namespace name that the type-parameterized tests for
|
| 236 |
+
// the given type-parameterized test suite are defined in. The exact
|
| 237 |
+
// name of the namespace is subject to change without notice.
|
| 238 |
+
#define GTEST_SUITE_NAMESPACE_(TestSuiteName) gtest_suite_##TestSuiteName##_
|
| 239 |
+
|
| 240 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
| 241 |
+
//
|
| 242 |
+
// Expands to the name of the variable used to remember the names of
|
| 243 |
+
// the defined tests in the given test suite.
|
| 244 |
+
#define GTEST_TYPED_TEST_SUITE_P_STATE_(TestSuiteName) \
|
| 245 |
+
gtest_typed_test_suite_p_state_##TestSuiteName##_
|
| 246 |
+
|
| 247 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
|
| 248 |
+
//
|
| 249 |
+
// Expands to the name of the variable used to remember the names of
|
| 250 |
+
// the registered tests in the given test suite.
|
| 251 |
+
#define GTEST_REGISTERED_TEST_NAMES_(TestSuiteName) \
|
| 252 |
+
gtest_registered_test_names_##TestSuiteName##_
|
| 253 |
+
|
| 254 |
+
// The variables defined in the type-parameterized test macros are
|
| 255 |
+
// static as typically these macros are used in a .h file that can be
|
| 256 |
+
// #included in multiple translation units linked together.
|
| 257 |
+
#define TYPED_TEST_SUITE_P(SuiteName) \
|
| 258 |
+
static ::testing::internal::TypedTestSuitePState \
|
| 259 |
+
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName)
|
| 260 |
+
|
| 261 |
+
// Legacy API is deprecated but still available
|
| 262 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 263 |
+
#define TYPED_TEST_CASE_P \
|
| 264 |
+
static_assert(::testing::internal::TypedTestCase_P_IsDeprecated(), ""); \
|
| 265 |
+
TYPED_TEST_SUITE_P
|
| 266 |
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 267 |
+
|
| 268 |
+
#define TYPED_TEST_P(SuiteName, TestName) \
|
| 269 |
+
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
|
| 270 |
+
template <typename gtest_TypeParam_> \
|
| 271 |
+
class TestName : public SuiteName<gtest_TypeParam_> { \
|
| 272 |
+
private: \
|
| 273 |
+
typedef SuiteName<gtest_TypeParam_> TestFixture; \
|
| 274 |
+
typedef gtest_TypeParam_ TypeParam; \
|
| 275 |
+
void TestBody() override; \
|
| 276 |
+
}; \
|
| 277 |
+
static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
|
| 278 |
+
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \
|
| 279 |
+
__FILE__, __LINE__, GTEST_STRINGIFY_(SuiteName), \
|
| 280 |
+
GTEST_STRINGIFY_(TestName)); \
|
| 281 |
+
} \
|
| 282 |
+
template <typename gtest_TypeParam_> \
|
| 283 |
+
void GTEST_SUITE_NAMESPACE_( \
|
| 284 |
+
SuiteName)::TestName<gtest_TypeParam_>::TestBody()
|
| 285 |
+
|
| 286 |
+
// Note: this won't work correctly if the trailing arguments are macros.
|
| 287 |
+
#define REGISTER_TYPED_TEST_SUITE_P(SuiteName, ...) \
|
| 288 |
+
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
|
| 289 |
+
typedef ::testing::internal::Templates<__VA_ARGS__> gtest_AllTests_; \
|
| 290 |
+
} \
|
| 291 |
+
static const char* const GTEST_REGISTERED_TEST_NAMES_( \
|
| 292 |
+
SuiteName) GTEST_ATTRIBUTE_UNUSED_ = \
|
| 293 |
+
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).VerifyRegisteredTestNames( \
|
| 294 |
+
GTEST_STRINGIFY_(SuiteName), __FILE__, __LINE__, #__VA_ARGS__)
|
| 295 |
+
|
| 296 |
+
// Legacy API is deprecated but still available
|
| 297 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 298 |
+
#define REGISTER_TYPED_TEST_CASE_P \
|
| 299 |
+
static_assert(::testing::internal::RegisterTypedTestCase_P_IsDeprecated(), \
|
| 300 |
+
""); \
|
| 301 |
+
REGISTER_TYPED_TEST_SUITE_P
|
| 302 |
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 303 |
+
|
| 304 |
+
#define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types, ...) \
|
| 305 |
+
static_assert(sizeof(GTEST_STRINGIFY_(Prefix)) > 1, \
|
| 306 |
+
"test-suit-prefix must not be empty"); \
|
| 307 |
+
static bool gtest_##Prefix##_##SuiteName GTEST_ATTRIBUTE_UNUSED_ = \
|
| 308 |
+
::testing::internal::TypeParameterizedTestSuite< \
|
| 309 |
+
SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \
|
| 310 |
+
::testing::internal::GenerateTypeList<Types>::type>:: \
|
| 311 |
+
Register(GTEST_STRINGIFY_(Prefix), \
|
| 312 |
+
::testing::internal::CodeLocation(__FILE__, __LINE__), \
|
| 313 |
+
>EST_TYPED_TEST_SUITE_P_STATE_(SuiteName), \
|
| 314 |
+
GTEST_STRINGIFY_(SuiteName), \
|
| 315 |
+
GTEST_REGISTERED_TEST_NAMES_(SuiteName), \
|
| 316 |
+
::testing::internal::GenerateNames< \
|
| 317 |
+
::testing::internal::NameGeneratorSelector< \
|
| 318 |
+
__VA_ARGS__>::type, \
|
| 319 |
+
::testing::internal::GenerateTypeList<Types>::type>())
|
| 320 |
+
|
| 321 |
+
// Legacy API is deprecated but still available
|
| 322 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 323 |
+
#define INSTANTIATE_TYPED_TEST_CASE_P \
|
| 324 |
+
static_assert( \
|
| 325 |
+
::testing::internal::InstantiateTypedTestCase_P_IsDeprecated(), ""); \
|
| 326 |
+
INSTANTIATE_TYPED_TEST_SUITE_P
|
| 327 |
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 328 |
+
|
| 329 |
+
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest.h
ADDED
|
@@ -0,0 +1,2495 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2005, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
//
|
| 31 |
+
// The Google C++ Testing and Mocking Framework (Google Test)
|
| 32 |
+
//
|
| 33 |
+
// This header file defines the public API for Google Test. It should be
|
| 34 |
+
// included by any test program that uses Google Test.
|
| 35 |
+
//
|
| 36 |
+
// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
|
| 37 |
+
// leave some internal implementation details in this header file.
|
| 38 |
+
// They are clearly marked by comments like this:
|
| 39 |
+
//
|
| 40 |
+
// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 41 |
+
//
|
| 42 |
+
// Such code is NOT meant to be used by a user directly, and is subject
|
| 43 |
+
// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
|
| 44 |
+
// program!
|
| 45 |
+
//
|
| 46 |
+
// Acknowledgment: Google Test borrowed the idea of automatic test
|
| 47 |
+
// registration from Barthelemy Dagenais' (barthelemy@prologique.com)
|
| 48 |
+
// easyUnit framework.
|
| 49 |
+
|
| 50 |
+
// GOOGLETEST_CM0001 DO NOT DELETE
|
| 51 |
+
|
| 52 |
+
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_H_
|
| 53 |
+
#define GOOGLETEST_INCLUDE_GTEST_GTEST_H_
|
| 54 |
+
|
| 55 |
+
#include <cstddef>
|
| 56 |
+
#include <limits>
|
| 57 |
+
#include <memory>
|
| 58 |
+
#include <ostream>
|
| 59 |
+
#include <type_traits>
|
| 60 |
+
#include <vector>
|
| 61 |
+
|
| 62 |
+
#include "gtest/internal/gtest-internal.h"
|
| 63 |
+
#include "gtest/internal/gtest-string.h"
|
| 64 |
+
#include "gtest/gtest-death-test.h"
|
| 65 |
+
#include "gtest/gtest-matchers.h"
|
| 66 |
+
#include "gtest/gtest-message.h"
|
| 67 |
+
#include "gtest/gtest-param-test.h"
|
| 68 |
+
#include "gtest/gtest-printers.h"
|
| 69 |
+
#include "gtest/gtest_prod.h"
|
| 70 |
+
#include "gtest/gtest-test-part.h"
|
| 71 |
+
#include "gtest/gtest-typed-test.h"
|
| 72 |
+
|
| 73 |
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
| 74 |
+
/* class A needs to have dll-interface to be used by clients of class B */)
|
| 75 |
+
|
| 76 |
+
namespace testing {
|
| 77 |
+
|
| 78 |
+
// Silence C4100 (unreferenced formal parameter) and 4805
|
| 79 |
+
// unsafe mix of type 'const int' and type 'const bool'
|
| 80 |
+
#ifdef _MSC_VER
|
| 81 |
+
# pragma warning(push)
|
| 82 |
+
# pragma warning(disable:4805)
|
| 83 |
+
# pragma warning(disable:4100)
|
| 84 |
+
#endif
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
// Declares the flags.
|
| 88 |
+
|
| 89 |
+
// This flag temporary enables the disabled tests.
|
| 90 |
+
GTEST_DECLARE_bool_(also_run_disabled_tests);
|
| 91 |
+
|
| 92 |
+
// This flag brings the debugger on an assertion failure.
|
| 93 |
+
GTEST_DECLARE_bool_(break_on_failure);
|
| 94 |
+
|
| 95 |
+
// This flag controls whether Google Test catches all test-thrown exceptions
|
| 96 |
+
// and logs them as failures.
|
| 97 |
+
GTEST_DECLARE_bool_(catch_exceptions);
|
| 98 |
+
|
| 99 |
+
// This flag enables using colors in terminal output. Available values are
|
| 100 |
+
// "yes" to enable colors, "no" (disable colors), or "auto" (the default)
|
| 101 |
+
// to let Google Test decide.
|
| 102 |
+
GTEST_DECLARE_string_(color);
|
| 103 |
+
|
| 104 |
+
// This flag controls whether the test runner should continue execution past
|
| 105 |
+
// first failure.
|
| 106 |
+
GTEST_DECLARE_bool_(fail_fast);
|
| 107 |
+
|
| 108 |
+
// This flag sets up the filter to select by name using a glob pattern
|
| 109 |
+
// the tests to run. If the filter is not given all tests are executed.
|
| 110 |
+
GTEST_DECLARE_string_(filter);
|
| 111 |
+
|
| 112 |
+
// This flag controls whether Google Test installs a signal handler that dumps
|
| 113 |
+
// debugging information when fatal signals are raised.
|
| 114 |
+
GTEST_DECLARE_bool_(install_failure_signal_handler);
|
| 115 |
+
|
| 116 |
+
// This flag causes the Google Test to list tests. None of the tests listed
|
| 117 |
+
// are actually run if the flag is provided.
|
| 118 |
+
GTEST_DECLARE_bool_(list_tests);
|
| 119 |
+
|
| 120 |
+
// This flag controls whether Google Test emits a detailed XML report to a file
|
| 121 |
+
// in addition to its normal textual output.
|
| 122 |
+
GTEST_DECLARE_string_(output);
|
| 123 |
+
|
| 124 |
+
// This flags control whether Google Test prints only test failures.
|
| 125 |
+
GTEST_DECLARE_bool_(brief);
|
| 126 |
+
|
| 127 |
+
// This flags control whether Google Test prints the elapsed time for each
|
| 128 |
+
// test.
|
| 129 |
+
GTEST_DECLARE_bool_(print_time);
|
| 130 |
+
|
| 131 |
+
// This flags control whether Google Test prints UTF8 characters as text.
|
| 132 |
+
GTEST_DECLARE_bool_(print_utf8);
|
| 133 |
+
|
| 134 |
+
// This flag specifies the random number seed.
|
| 135 |
+
GTEST_DECLARE_int32_(random_seed);
|
| 136 |
+
|
| 137 |
+
// This flag sets how many times the tests are repeated. The default value
|
| 138 |
+
// is 1. If the value is -1 the tests are repeating forever.
|
| 139 |
+
GTEST_DECLARE_int32_(repeat);
|
| 140 |
+
|
| 141 |
+
// This flag controls whether Google Test includes Google Test internal
|
| 142 |
+
// stack frames in failure stack traces.
|
| 143 |
+
GTEST_DECLARE_bool_(show_internal_stack_frames);
|
| 144 |
+
|
| 145 |
+
// When this flag is specified, tests' order is randomized on every iteration.
|
| 146 |
+
GTEST_DECLARE_bool_(shuffle);
|
| 147 |
+
|
| 148 |
+
// This flag specifies the maximum number of stack frames to be
|
| 149 |
+
// printed in a failure message.
|
| 150 |
+
GTEST_DECLARE_int32_(stack_trace_depth);
|
| 151 |
+
|
| 152 |
+
// When this flag is specified, a failed assertion will throw an
|
| 153 |
+
// exception if exceptions are enabled, or exit the program with a
|
| 154 |
+
// non-zero code otherwise. For use with an external test framework.
|
| 155 |
+
GTEST_DECLARE_bool_(throw_on_failure);
|
| 156 |
+
|
| 157 |
+
// When this flag is set with a "host:port" string, on supported
|
| 158 |
+
// platforms test results are streamed to the specified port on
|
| 159 |
+
// the specified host machine.
|
| 160 |
+
GTEST_DECLARE_string_(stream_result_to);
|
| 161 |
+
|
| 162 |
+
#if GTEST_USE_OWN_FLAGFILE_FLAG_
|
| 163 |
+
GTEST_DECLARE_string_(flagfile);
|
| 164 |
+
#endif // GTEST_USE_OWN_FLAGFILE_FLAG_
|
| 165 |
+
|
| 166 |
+
// The upper limit for valid stack trace depths.
|
| 167 |
+
const int kMaxStackTraceDepth = 100;
|
| 168 |
+
|
| 169 |
+
namespace internal {
|
| 170 |
+
|
| 171 |
+
class AssertHelper;
|
| 172 |
+
class DefaultGlobalTestPartResultReporter;
|
| 173 |
+
class ExecDeathTest;
|
| 174 |
+
class NoExecDeathTest;
|
| 175 |
+
class FinalSuccessChecker;
|
| 176 |
+
class GTestFlagSaver;
|
| 177 |
+
class StreamingListenerTest;
|
| 178 |
+
class TestResultAccessor;
|
| 179 |
+
class TestEventListenersAccessor;
|
| 180 |
+
class TestEventRepeater;
|
| 181 |
+
class UnitTestRecordPropertyTestHelper;
|
| 182 |
+
class WindowsDeathTest;
|
| 183 |
+
class FuchsiaDeathTest;
|
| 184 |
+
class UnitTestImpl* GetUnitTestImpl();
|
| 185 |
+
void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
|
| 186 |
+
const std::string& message);
|
| 187 |
+
std::set<std::string>* GetIgnoredParameterizedTestSuites();
|
| 188 |
+
|
| 189 |
+
} // namespace internal
|
| 190 |
+
|
| 191 |
+
// The friend relationship of some of these classes is cyclic.
|
| 192 |
+
// If we don't forward declare them the compiler might confuse the classes
|
| 193 |
+
// in friendship clauses with same named classes on the scope.
|
| 194 |
+
class Test;
|
| 195 |
+
class TestSuite;
|
| 196 |
+
|
| 197 |
+
// Old API is still available but deprecated
|
| 198 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 199 |
+
using TestCase = TestSuite;
|
| 200 |
+
#endif
|
| 201 |
+
class TestInfo;
|
| 202 |
+
class UnitTest;
|
| 203 |
+
|
| 204 |
+
// A class for indicating whether an assertion was successful. When
|
| 205 |
+
// the assertion wasn't successful, the AssertionResult object
|
| 206 |
+
// remembers a non-empty message that describes how it failed.
|
| 207 |
+
//
|
| 208 |
+
// To create an instance of this class, use one of the factory functions
|
| 209 |
+
// (AssertionSuccess() and AssertionFailure()).
|
| 210 |
+
//
|
| 211 |
+
// This class is useful for two purposes:
|
| 212 |
+
// 1. Defining predicate functions to be used with Boolean test assertions
|
| 213 |
+
// EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
|
| 214 |
+
// 2. Defining predicate-format functions to be
|
| 215 |
+
// used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
|
| 216 |
+
//
|
| 217 |
+
// For example, if you define IsEven predicate:
|
| 218 |
+
//
|
| 219 |
+
// testing::AssertionResult IsEven(int n) {
|
| 220 |
+
// if ((n % 2) == 0)
|
| 221 |
+
// return testing::AssertionSuccess();
|
| 222 |
+
// else
|
| 223 |
+
// return testing::AssertionFailure() << n << " is odd";
|
| 224 |
+
// }
|
| 225 |
+
//
|
| 226 |
+
// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
|
| 227 |
+
// will print the message
|
| 228 |
+
//
|
| 229 |
+
// Value of: IsEven(Fib(5))
|
| 230 |
+
// Actual: false (5 is odd)
|
| 231 |
+
// Expected: true
|
| 232 |
+
//
|
| 233 |
+
// instead of a more opaque
|
| 234 |
+
//
|
| 235 |
+
// Value of: IsEven(Fib(5))
|
| 236 |
+
// Actual: false
|
| 237 |
+
// Expected: true
|
| 238 |
+
//
|
| 239 |
+
// in case IsEven is a simple Boolean predicate.
|
| 240 |
+
//
|
| 241 |
+
// If you expect your predicate to be reused and want to support informative
|
| 242 |
+
// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
|
| 243 |
+
// about half as often as positive ones in our tests), supply messages for
|
| 244 |
+
// both success and failure cases:
|
| 245 |
+
//
|
| 246 |
+
// testing::AssertionResult IsEven(int n) {
|
| 247 |
+
// if ((n % 2) == 0)
|
| 248 |
+
// return testing::AssertionSuccess() << n << " is even";
|
| 249 |
+
// else
|
| 250 |
+
// return testing::AssertionFailure() << n << " is odd";
|
| 251 |
+
// }
|
| 252 |
+
//
|
| 253 |
+
// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
|
| 254 |
+
//
|
| 255 |
+
// Value of: IsEven(Fib(6))
|
| 256 |
+
// Actual: true (8 is even)
|
| 257 |
+
// Expected: false
|
| 258 |
+
//
|
| 259 |
+
// NB: Predicates that support negative Boolean assertions have reduced
|
| 260 |
+
// performance in positive ones so be careful not to use them in tests
|
| 261 |
+
// that have lots (tens of thousands) of positive Boolean assertions.
|
| 262 |
+
//
|
| 263 |
+
// To use this class with EXPECT_PRED_FORMAT assertions such as:
|
| 264 |
+
//
|
| 265 |
+
// // Verifies that Foo() returns an even number.
|
| 266 |
+
// EXPECT_PRED_FORMAT1(IsEven, Foo());
|
| 267 |
+
//
|
| 268 |
+
// you need to define:
|
| 269 |
+
//
|
| 270 |
+
// testing::AssertionResult IsEven(const char* expr, int n) {
|
| 271 |
+
// if ((n % 2) == 0)
|
| 272 |
+
// return testing::AssertionSuccess();
|
| 273 |
+
// else
|
| 274 |
+
// return testing::AssertionFailure()
|
| 275 |
+
// << "Expected: " << expr << " is even\n Actual: it's " << n;
|
| 276 |
+
// }
|
| 277 |
+
//
|
| 278 |
+
// If Foo() returns 5, you will see the following message:
|
| 279 |
+
//
|
| 280 |
+
// Expected: Foo() is even
|
| 281 |
+
// Actual: it's 5
|
| 282 |
+
//
|
| 283 |
+
class GTEST_API_ AssertionResult {
|
| 284 |
+
public:
|
| 285 |
+
// Copy constructor.
|
| 286 |
+
// Used in EXPECT_TRUE/FALSE(assertion_result).
|
| 287 |
+
AssertionResult(const AssertionResult& other);
|
| 288 |
+
|
| 289 |
+
// C4800 is a level 3 warning in Visual Studio 2015 and earlier.
|
| 290 |
+
// This warning is not emitted in Visual Studio 2017.
|
| 291 |
+
// This warning is off by default starting in Visual Studio 2019 but can be
|
| 292 |
+
// enabled with command-line options.
|
| 293 |
+
#if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
|
| 294 |
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
|
| 295 |
+
#endif
|
| 296 |
+
|
| 297 |
+
// Used in the EXPECT_TRUE/FALSE(bool_expression).
|
| 298 |
+
//
|
| 299 |
+
// T must be contextually convertible to bool.
|
| 300 |
+
//
|
| 301 |
+
// The second parameter prevents this overload from being considered if
|
| 302 |
+
// the argument is implicitly convertible to AssertionResult. In that case
|
| 303 |
+
// we want AssertionResult's copy constructor to be used.
|
| 304 |
+
template <typename T>
|
| 305 |
+
explicit AssertionResult(
|
| 306 |
+
const T& success,
|
| 307 |
+
typename std::enable_if<
|
| 308 |
+
!std::is_convertible<T, AssertionResult>::value>::type*
|
| 309 |
+
/*enabler*/
|
| 310 |
+
= nullptr)
|
| 311 |
+
: success_(success) {}
|
| 312 |
+
|
| 313 |
+
#if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
|
| 314 |
+
GTEST_DISABLE_MSC_WARNINGS_POP_()
|
| 315 |
+
#endif
|
| 316 |
+
|
| 317 |
+
// Assignment operator.
|
| 318 |
+
AssertionResult& operator=(AssertionResult other) {
|
| 319 |
+
swap(other);
|
| 320 |
+
return *this;
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
// Returns true if and only if the assertion succeeded.
|
| 324 |
+
operator bool() const { return success_; } // NOLINT
|
| 325 |
+
|
| 326 |
+
// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
|
| 327 |
+
AssertionResult operator!() const;
|
| 328 |
+
|
| 329 |
+
// Returns the text streamed into this AssertionResult. Test assertions
|
| 330 |
+
// use it when they fail (i.e., the predicate's outcome doesn't match the
|
| 331 |
+
// assertion's expectation). When nothing has been streamed into the
|
| 332 |
+
// object, returns an empty string.
|
| 333 |
+
const char* message() const {
|
| 334 |
+
return message_.get() != nullptr ? message_->c_str() : "";
|
| 335 |
+
}
|
| 336 |
+
// Deprecated; please use message() instead.
|
| 337 |
+
const char* failure_message() const { return message(); }
|
| 338 |
+
|
| 339 |
+
// Streams a custom failure message into this object.
|
| 340 |
+
template <typename T> AssertionResult& operator<<(const T& value) {
|
| 341 |
+
AppendMessage(Message() << value);
|
| 342 |
+
return *this;
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
// Allows streaming basic output manipulators such as endl or flush into
|
| 346 |
+
// this object.
|
| 347 |
+
AssertionResult& operator<<(
|
| 348 |
+
::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
|
| 349 |
+
AppendMessage(Message() << basic_manipulator);
|
| 350 |
+
return *this;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
private:
|
| 354 |
+
// Appends the contents of message to message_.
|
| 355 |
+
void AppendMessage(const Message& a_message) {
|
| 356 |
+
if (message_.get() == nullptr) message_.reset(new ::std::string);
|
| 357 |
+
message_->append(a_message.GetString().c_str());
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
// Swap the contents of this AssertionResult with other.
|
| 361 |
+
void swap(AssertionResult& other);
|
| 362 |
+
|
| 363 |
+
// Stores result of the assertion predicate.
|
| 364 |
+
bool success_;
|
| 365 |
+
// Stores the message describing the condition in case the expectation
|
| 366 |
+
// construct is not satisfied with the predicate's outcome.
|
| 367 |
+
// Referenced via a pointer to avoid taking too much stack frame space
|
| 368 |
+
// with test assertions.
|
| 369 |
+
std::unique_ptr< ::std::string> message_;
|
| 370 |
+
};
|
| 371 |
+
|
| 372 |
+
// Makes a successful assertion result.
|
| 373 |
+
GTEST_API_ AssertionResult AssertionSuccess();
|
| 374 |
+
|
| 375 |
+
// Makes a failed assertion result.
|
| 376 |
+
GTEST_API_ AssertionResult AssertionFailure();
|
| 377 |
+
|
| 378 |
+
// Makes a failed assertion result with the given failure message.
|
| 379 |
+
// Deprecated; use AssertionFailure() << msg.
|
| 380 |
+
GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
|
| 381 |
+
|
| 382 |
+
} // namespace testing
|
| 383 |
+
|
| 384 |
+
// Includes the auto-generated header that implements a family of generic
|
| 385 |
+
// predicate assertion macros. This include comes late because it relies on
|
| 386 |
+
// APIs declared above.
|
| 387 |
+
#include "gtest/gtest_pred_impl.h"
|
| 388 |
+
|
| 389 |
+
namespace testing {
|
| 390 |
+
|
| 391 |
+
// The abstract class that all tests inherit from.
|
| 392 |
+
//
|
| 393 |
+
// In Google Test, a unit test program contains one or many TestSuites, and
|
| 394 |
+
// each TestSuite contains one or many Tests.
|
| 395 |
+
//
|
| 396 |
+
// When you define a test using the TEST macro, you don't need to
|
| 397 |
+
// explicitly derive from Test - the TEST macro automatically does
|
| 398 |
+
// this for you.
|
| 399 |
+
//
|
| 400 |
+
// The only time you derive from Test is when defining a test fixture
|
| 401 |
+
// to be used in a TEST_F. For example:
|
| 402 |
+
//
|
| 403 |
+
// class FooTest : public testing::Test {
|
| 404 |
+
// protected:
|
| 405 |
+
// void SetUp() override { ... }
|
| 406 |
+
// void TearDown() override { ... }
|
| 407 |
+
// ...
|
| 408 |
+
// };
|
| 409 |
+
//
|
| 410 |
+
// TEST_F(FooTest, Bar) { ... }
|
| 411 |
+
// TEST_F(FooTest, Baz) { ... }
|
| 412 |
+
//
|
| 413 |
+
// Test is not copyable.
|
| 414 |
+
class GTEST_API_ Test {
|
| 415 |
+
public:
|
| 416 |
+
friend class TestInfo;
|
| 417 |
+
|
| 418 |
+
// The d'tor is virtual as we intend to inherit from Test.
|
| 419 |
+
virtual ~Test();
|
| 420 |
+
|
| 421 |
+
// Sets up the stuff shared by all tests in this test suite.
|
| 422 |
+
//
|
| 423 |
+
// Google Test will call Foo::SetUpTestSuite() before running the first
|
| 424 |
+
// test in test suite Foo. Hence a sub-class can define its own
|
| 425 |
+
// SetUpTestSuite() method to shadow the one defined in the super
|
| 426 |
+
// class.
|
| 427 |
+
static void SetUpTestSuite() {}
|
| 428 |
+
|
| 429 |
+
// Tears down the stuff shared by all tests in this test suite.
|
| 430 |
+
//
|
| 431 |
+
// Google Test will call Foo::TearDownTestSuite() after running the last
|
| 432 |
+
// test in test suite Foo. Hence a sub-class can define its own
|
| 433 |
+
// TearDownTestSuite() method to shadow the one defined in the super
|
| 434 |
+
// class.
|
| 435 |
+
static void TearDownTestSuite() {}
|
| 436 |
+
|
| 437 |
+
// Legacy API is deprecated but still available. Use SetUpTestSuite and
|
| 438 |
+
// TearDownTestSuite instead.
|
| 439 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 440 |
+
static void TearDownTestCase() {}
|
| 441 |
+
static void SetUpTestCase() {}
|
| 442 |
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 443 |
+
|
| 444 |
+
// Returns true if and only if the current test has a fatal failure.
|
| 445 |
+
static bool HasFatalFailure();
|
| 446 |
+
|
| 447 |
+
// Returns true if and only if the current test has a non-fatal failure.
|
| 448 |
+
static bool HasNonfatalFailure();
|
| 449 |
+
|
| 450 |
+
// Returns true if and only if the current test was skipped.
|
| 451 |
+
static bool IsSkipped();
|
| 452 |
+
|
| 453 |
+
// Returns true if and only if the current test has a (either fatal or
|
| 454 |
+
// non-fatal) failure.
|
| 455 |
+
static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
|
| 456 |
+
|
| 457 |
+
// Logs a property for the current test, test suite, or for the entire
|
| 458 |
+
// invocation of the test program when used outside of the context of a
|
| 459 |
+
// test suite. Only the last value for a given key is remembered. These
|
| 460 |
+
// are public static so they can be called from utility functions that are
|
| 461 |
+
// not members of the test fixture. Calls to RecordProperty made during
|
| 462 |
+
// lifespan of the test (from the moment its constructor starts to the
|
| 463 |
+
// moment its destructor finishes) will be output in XML as attributes of
|
| 464 |
+
// the <testcase> element. Properties recorded from fixture's
|
| 465 |
+
// SetUpTestSuite or TearDownTestSuite are logged as attributes of the
|
| 466 |
+
// corresponding <testsuite> element. Calls to RecordProperty made in the
|
| 467 |
+
// global context (before or after invocation of RUN_ALL_TESTS and from
|
| 468 |
+
// SetUp/TearDown method of Environment objects registered with Google
|
| 469 |
+
// Test) will be output as attributes of the <testsuites> element.
|
| 470 |
+
static void RecordProperty(const std::string& key, const std::string& value);
|
| 471 |
+
static void RecordProperty(const std::string& key, int value);
|
| 472 |
+
|
| 473 |
+
protected:
|
| 474 |
+
// Creates a Test object.
|
| 475 |
+
Test();
|
| 476 |
+
|
| 477 |
+
// Sets up the test fixture.
|
| 478 |
+
virtual void SetUp();
|
| 479 |
+
|
| 480 |
+
// Tears down the test fixture.
|
| 481 |
+
virtual void TearDown();
|
| 482 |
+
|
| 483 |
+
private:
|
| 484 |
+
// Returns true if and only if the current test has the same fixture class
|
| 485 |
+
// as the first test in the current test suite.
|
| 486 |
+
static bool HasSameFixtureClass();
|
| 487 |
+
|
| 488 |
+
// Runs the test after the test fixture has been set up.
|
| 489 |
+
//
|
| 490 |
+
// A sub-class must implement this to define the test logic.
|
| 491 |
+
//
|
| 492 |
+
// DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
|
| 493 |
+
// Instead, use the TEST or TEST_F macro.
|
| 494 |
+
virtual void TestBody() = 0;
|
| 495 |
+
|
| 496 |
+
// Sets up, executes, and tears down the test.
|
| 497 |
+
void Run();
|
| 498 |
+
|
| 499 |
+
// Deletes self. We deliberately pick an unusual name for this
|
| 500 |
+
// internal method to avoid clashing with names used in user TESTs.
|
| 501 |
+
void DeleteSelf_() { delete this; }
|
| 502 |
+
|
| 503 |
+
const std::unique_ptr<GTEST_FLAG_SAVER_> gtest_flag_saver_;
|
| 504 |
+
|
| 505 |
+
// Often a user misspells SetUp() as Setup() and spends a long time
|
| 506 |
+
// wondering why it is never called by Google Test. The declaration of
|
| 507 |
+
// the following method is solely for catching such an error at
|
| 508 |
+
// compile time:
|
| 509 |
+
//
|
| 510 |
+
// - The return type is deliberately chosen to be not void, so it
|
| 511 |
+
// will be a conflict if void Setup() is declared in the user's
|
| 512 |
+
// test fixture.
|
| 513 |
+
//
|
| 514 |
+
// - This method is private, so it will be another compiler error
|
| 515 |
+
// if the method is called from the user's test fixture.
|
| 516 |
+
//
|
| 517 |
+
// DO NOT OVERRIDE THIS FUNCTION.
|
| 518 |
+
//
|
| 519 |
+
// If you see an error about overriding the following function or
|
| 520 |
+
// about it being private, you have mis-spelled SetUp() as Setup().
|
| 521 |
+
struct Setup_should_be_spelled_SetUp {};
|
| 522 |
+
virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; }
|
| 523 |
+
|
| 524 |
+
// We disallow copying Tests.
|
| 525 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
|
| 526 |
+
};
|
| 527 |
+
|
| 528 |
+
typedef internal::TimeInMillis TimeInMillis;
|
| 529 |
+
|
| 530 |
+
// A copyable object representing a user specified test property which can be
|
| 531 |
+
// output as a key/value string pair.
|
| 532 |
+
//
|
| 533 |
+
// Don't inherit from TestProperty as its destructor is not virtual.
|
| 534 |
+
class TestProperty {
|
| 535 |
+
public:
|
| 536 |
+
// C'tor. TestProperty does NOT have a default constructor.
|
| 537 |
+
// Always use this constructor (with parameters) to create a
|
| 538 |
+
// TestProperty object.
|
| 539 |
+
TestProperty(const std::string& a_key, const std::string& a_value) :
|
| 540 |
+
key_(a_key), value_(a_value) {
|
| 541 |
+
}
|
| 542 |
+
|
| 543 |
+
// Gets the user supplied key.
|
| 544 |
+
const char* key() const {
|
| 545 |
+
return key_.c_str();
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
// Gets the user supplied value.
|
| 549 |
+
const char* value() const {
|
| 550 |
+
return value_.c_str();
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
// Sets a new value, overriding the one supplied in the constructor.
|
| 554 |
+
void SetValue(const std::string& new_value) {
|
| 555 |
+
value_ = new_value;
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
private:
|
| 559 |
+
// The key supplied by the user.
|
| 560 |
+
std::string key_;
|
| 561 |
+
// The value supplied by the user.
|
| 562 |
+
std::string value_;
|
| 563 |
+
};
|
| 564 |
+
|
| 565 |
+
// The result of a single Test. This includes a list of
|
| 566 |
+
// TestPartResults, a list of TestProperties, a count of how many
|
| 567 |
+
// death tests there are in the Test, and how much time it took to run
|
| 568 |
+
// the Test.
|
| 569 |
+
//
|
| 570 |
+
// TestResult is not copyable.
|
| 571 |
+
class GTEST_API_ TestResult {
|
| 572 |
+
public:
|
| 573 |
+
// Creates an empty TestResult.
|
| 574 |
+
TestResult();
|
| 575 |
+
|
| 576 |
+
// D'tor. Do not inherit from TestResult.
|
| 577 |
+
~TestResult();
|
| 578 |
+
|
| 579 |
+
// Gets the number of all test parts. This is the sum of the number
|
| 580 |
+
// of successful test parts and the number of failed test parts.
|
| 581 |
+
int total_part_count() const;
|
| 582 |
+
|
| 583 |
+
// Returns the number of the test properties.
|
| 584 |
+
int test_property_count() const;
|
| 585 |
+
|
| 586 |
+
// Returns true if and only if the test passed (i.e. no test part failed).
|
| 587 |
+
bool Passed() const { return !Skipped() && !Failed(); }
|
| 588 |
+
|
| 589 |
+
// Returns true if and only if the test was skipped.
|
| 590 |
+
bool Skipped() const;
|
| 591 |
+
|
| 592 |
+
// Returns true if and only if the test failed.
|
| 593 |
+
bool Failed() const;
|
| 594 |
+
|
| 595 |
+
// Returns true if and only if the test fatally failed.
|
| 596 |
+
bool HasFatalFailure() const;
|
| 597 |
+
|
| 598 |
+
// Returns true if and only if the test has a non-fatal failure.
|
| 599 |
+
bool HasNonfatalFailure() const;
|
| 600 |
+
|
| 601 |
+
// Returns the elapsed time, in milliseconds.
|
| 602 |
+
TimeInMillis elapsed_time() const { return elapsed_time_; }
|
| 603 |
+
|
| 604 |
+
// Gets the time of the test case start, in ms from the start of the
|
| 605 |
+
// UNIX epoch.
|
| 606 |
+
TimeInMillis start_timestamp() const { return start_timestamp_; }
|
| 607 |
+
|
| 608 |
+
// Returns the i-th test part result among all the results. i can range from 0
|
| 609 |
+
// to total_part_count() - 1. If i is not in that range, aborts the program.
|
| 610 |
+
const TestPartResult& GetTestPartResult(int i) const;
|
| 611 |
+
|
| 612 |
+
// Returns the i-th test property. i can range from 0 to
|
| 613 |
+
// test_property_count() - 1. If i is not in that range, aborts the
|
| 614 |
+
// program.
|
| 615 |
+
const TestProperty& GetTestProperty(int i) const;
|
| 616 |
+
|
| 617 |
+
private:
|
| 618 |
+
friend class TestInfo;
|
| 619 |
+
friend class TestSuite;
|
| 620 |
+
friend class UnitTest;
|
| 621 |
+
friend class internal::DefaultGlobalTestPartResultReporter;
|
| 622 |
+
friend class internal::ExecDeathTest;
|
| 623 |
+
friend class internal::TestResultAccessor;
|
| 624 |
+
friend class internal::UnitTestImpl;
|
| 625 |
+
friend class internal::WindowsDeathTest;
|
| 626 |
+
friend class internal::FuchsiaDeathTest;
|
| 627 |
+
|
| 628 |
+
// Gets the vector of TestPartResults.
|
| 629 |
+
const std::vector<TestPartResult>& test_part_results() const {
|
| 630 |
+
return test_part_results_;
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
// Gets the vector of TestProperties.
|
| 634 |
+
const std::vector<TestProperty>& test_properties() const {
|
| 635 |
+
return test_properties_;
|
| 636 |
+
}
|
| 637 |
+
|
| 638 |
+
// Sets the start time.
|
| 639 |
+
void set_start_timestamp(TimeInMillis start) { start_timestamp_ = start; }
|
| 640 |
+
|
| 641 |
+
// Sets the elapsed time.
|
| 642 |
+
void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
|
| 643 |
+
|
| 644 |
+
// Adds a test property to the list. The property is validated and may add
|
| 645 |
+
// a non-fatal failure if invalid (e.g., if it conflicts with reserved
|
| 646 |
+
// key names). If a property is already recorded for the same key, the
|
| 647 |
+
// value will be updated, rather than storing multiple values for the same
|
| 648 |
+
// key. xml_element specifies the element for which the property is being
|
| 649 |
+
// recorded and is used for validation.
|
| 650 |
+
void RecordProperty(const std::string& xml_element,
|
| 651 |
+
const TestProperty& test_property);
|
| 652 |
+
|
| 653 |
+
// Adds a failure if the key is a reserved attribute of Google Test
|
| 654 |
+
// testsuite tags. Returns true if the property is valid.
|
| 655 |
+
// FIXME: Validate attribute names are legal and human readable.
|
| 656 |
+
static bool ValidateTestProperty(const std::string& xml_element,
|
| 657 |
+
const TestProperty& test_property);
|
| 658 |
+
|
| 659 |
+
// Adds a test part result to the list.
|
| 660 |
+
void AddTestPartResult(const TestPartResult& test_part_result);
|
| 661 |
+
|
| 662 |
+
// Returns the death test count.
|
| 663 |
+
int death_test_count() const { return death_test_count_; }
|
| 664 |
+
|
| 665 |
+
// Increments the death test count, returning the new count.
|
| 666 |
+
int increment_death_test_count() { return ++death_test_count_; }
|
| 667 |
+
|
| 668 |
+
// Clears the test part results.
|
| 669 |
+
void ClearTestPartResults();
|
| 670 |
+
|
| 671 |
+
// Clears the object.
|
| 672 |
+
void Clear();
|
| 673 |
+
|
| 674 |
+
// Protects mutable state of the property vector and of owned
|
| 675 |
+
// properties, whose values may be updated.
|
| 676 |
+
internal::Mutex test_properties_mutex_;
|
| 677 |
+
|
| 678 |
+
// The vector of TestPartResults
|
| 679 |
+
std::vector<TestPartResult> test_part_results_;
|
| 680 |
+
// The vector of TestProperties
|
| 681 |
+
std::vector<TestProperty> test_properties_;
|
| 682 |
+
// Running count of death tests.
|
| 683 |
+
int death_test_count_;
|
| 684 |
+
// The start time, in milliseconds since UNIX Epoch.
|
| 685 |
+
TimeInMillis start_timestamp_;
|
| 686 |
+
// The elapsed time, in milliseconds.
|
| 687 |
+
TimeInMillis elapsed_time_;
|
| 688 |
+
|
| 689 |
+
// We disallow copying TestResult.
|
| 690 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
|
| 691 |
+
}; // class TestResult
|
| 692 |
+
|
| 693 |
+
// A TestInfo object stores the following information about a test:
|
| 694 |
+
//
|
| 695 |
+
// Test suite name
|
| 696 |
+
// Test name
|
| 697 |
+
// Whether the test should be run
|
| 698 |
+
// A function pointer that creates the test object when invoked
|
| 699 |
+
// Test result
|
| 700 |
+
//
|
| 701 |
+
// The constructor of TestInfo registers itself with the UnitTest
|
| 702 |
+
// singleton such that the RUN_ALL_TESTS() macro knows which tests to
|
| 703 |
+
// run.
|
| 704 |
+
class GTEST_API_ TestInfo {
|
| 705 |
+
public:
|
| 706 |
+
// Destructs a TestInfo object. This function is not virtual, so
|
| 707 |
+
// don't inherit from TestInfo.
|
| 708 |
+
~TestInfo();
|
| 709 |
+
|
| 710 |
+
// Returns the test suite name.
|
| 711 |
+
const char* test_suite_name() const { return test_suite_name_.c_str(); }
|
| 712 |
+
|
| 713 |
+
// Legacy API is deprecated but still available
|
| 714 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 715 |
+
const char* test_case_name() const { return test_suite_name(); }
|
| 716 |
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 717 |
+
|
| 718 |
+
// Returns the test name.
|
| 719 |
+
const char* name() const { return name_.c_str(); }
|
| 720 |
+
|
| 721 |
+
// Returns the name of the parameter type, or NULL if this is not a typed
|
| 722 |
+
// or a type-parameterized test.
|
| 723 |
+
const char* type_param() const {
|
| 724 |
+
if (type_param_.get() != nullptr) return type_param_->c_str();
|
| 725 |
+
return nullptr;
|
| 726 |
+
}
|
| 727 |
+
|
| 728 |
+
// Returns the text representation of the value parameter, or NULL if this
|
| 729 |
+
// is not a value-parameterized test.
|
| 730 |
+
const char* value_param() const {
|
| 731 |
+
if (value_param_.get() != nullptr) return value_param_->c_str();
|
| 732 |
+
return nullptr;
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
// Returns the file name where this test is defined.
|
| 736 |
+
const char* file() const { return location_.file.c_str(); }
|
| 737 |
+
|
| 738 |
+
// Returns the line where this test is defined.
|
| 739 |
+
int line() const { return location_.line; }
|
| 740 |
+
|
| 741 |
+
// Return true if this test should not be run because it's in another shard.
|
| 742 |
+
bool is_in_another_shard() const { return is_in_another_shard_; }
|
| 743 |
+
|
| 744 |
+
// Returns true if this test should run, that is if the test is not
|
| 745 |
+
// disabled (or it is disabled but the also_run_disabled_tests flag has
|
| 746 |
+
// been specified) and its full name matches the user-specified filter.
|
| 747 |
+
//
|
| 748 |
+
// Google Test allows the user to filter the tests by their full names.
|
| 749 |
+
// The full name of a test Bar in test suite Foo is defined as
|
| 750 |
+
// "Foo.Bar". Only the tests that match the filter will run.
|
| 751 |
+
//
|
| 752 |
+
// A filter is a colon-separated list of glob (not regex) patterns,
|
| 753 |
+
// optionally followed by a '-' and a colon-separated list of
|
| 754 |
+
// negative patterns (tests to exclude). A test is run if it
|
| 755 |
+
// matches one of the positive patterns and does not match any of
|
| 756 |
+
// the negative patterns.
|
| 757 |
+
//
|
| 758 |
+
// For example, *A*:Foo.* is a filter that matches any string that
|
| 759 |
+
// contains the character 'A' or starts with "Foo.".
|
| 760 |
+
bool should_run() const { return should_run_; }
|
| 761 |
+
|
| 762 |
+
// Returns true if and only if this test will appear in the XML report.
|
| 763 |
+
bool is_reportable() const {
|
| 764 |
+
// The XML report includes tests matching the filter, excluding those
|
| 765 |
+
// run in other shards.
|
| 766 |
+
return matches_filter_ && !is_in_another_shard_;
|
| 767 |
+
}
|
| 768 |
+
|
| 769 |
+
// Returns the result of the test.
|
| 770 |
+
const TestResult* result() const { return &result_; }
|
| 771 |
+
|
| 772 |
+
private:
|
| 773 |
+
#if GTEST_HAS_DEATH_TEST
|
| 774 |
+
friend class internal::DefaultDeathTestFactory;
|
| 775 |
+
#endif // GTEST_HAS_DEATH_TEST
|
| 776 |
+
friend class Test;
|
| 777 |
+
friend class TestSuite;
|
| 778 |
+
friend class internal::UnitTestImpl;
|
| 779 |
+
friend class internal::StreamingListenerTest;
|
| 780 |
+
friend TestInfo* internal::MakeAndRegisterTestInfo(
|
| 781 |
+
const char* test_suite_name, const char* name, const char* type_param,
|
| 782 |
+
const char* value_param, internal::CodeLocation code_location,
|
| 783 |
+
internal::TypeId fixture_class_id, internal::SetUpTestSuiteFunc set_up_tc,
|
| 784 |
+
internal::TearDownTestSuiteFunc tear_down_tc,
|
| 785 |
+
internal::TestFactoryBase* factory);
|
| 786 |
+
|
| 787 |
+
// Constructs a TestInfo object. The newly constructed instance assumes
|
| 788 |
+
// ownership of the factory object.
|
| 789 |
+
TestInfo(const std::string& test_suite_name, const std::string& name,
|
| 790 |
+
const char* a_type_param, // NULL if not a type-parameterized test
|
| 791 |
+
const char* a_value_param, // NULL if not a value-parameterized test
|
| 792 |
+
internal::CodeLocation a_code_location,
|
| 793 |
+
internal::TypeId fixture_class_id,
|
| 794 |
+
internal::TestFactoryBase* factory);
|
| 795 |
+
|
| 796 |
+
// Increments the number of death tests encountered in this test so
|
| 797 |
+
// far.
|
| 798 |
+
int increment_death_test_count() {
|
| 799 |
+
return result_.increment_death_test_count();
|
| 800 |
+
}
|
| 801 |
+
|
| 802 |
+
// Creates the test object, runs it, records its result, and then
|
| 803 |
+
// deletes it.
|
| 804 |
+
void Run();
|
| 805 |
+
|
| 806 |
+
// Skip and records the test result for this object.
|
| 807 |
+
void Skip();
|
| 808 |
+
|
| 809 |
+
static void ClearTestResult(TestInfo* test_info) {
|
| 810 |
+
test_info->result_.Clear();
|
| 811 |
+
}
|
| 812 |
+
|
| 813 |
+
// These fields are immutable properties of the test.
|
| 814 |
+
const std::string test_suite_name_; // test suite name
|
| 815 |
+
const std::string name_; // Test name
|
| 816 |
+
// Name of the parameter type, or NULL if this is not a typed or a
|
| 817 |
+
// type-parameterized test.
|
| 818 |
+
const std::unique_ptr<const ::std::string> type_param_;
|
| 819 |
+
// Text representation of the value parameter, or NULL if this is not a
|
| 820 |
+
// value-parameterized test.
|
| 821 |
+
const std::unique_ptr<const ::std::string> value_param_;
|
| 822 |
+
internal::CodeLocation location_;
|
| 823 |
+
const internal::TypeId fixture_class_id_; // ID of the test fixture class
|
| 824 |
+
bool should_run_; // True if and only if this test should run
|
| 825 |
+
bool is_disabled_; // True if and only if this test is disabled
|
| 826 |
+
bool matches_filter_; // True if this test matches the
|
| 827 |
+
// user-specified filter.
|
| 828 |
+
bool is_in_another_shard_; // Will be run in another shard.
|
| 829 |
+
internal::TestFactoryBase* const factory_; // The factory that creates
|
| 830 |
+
// the test object
|
| 831 |
+
|
| 832 |
+
// This field is mutable and needs to be reset before running the
|
| 833 |
+
// test for the second time.
|
| 834 |
+
TestResult result_;
|
| 835 |
+
|
| 836 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
|
| 837 |
+
};
|
| 838 |
+
|
| 839 |
+
// A test suite, which consists of a vector of TestInfos.
|
| 840 |
+
//
|
| 841 |
+
// TestSuite is not copyable.
|
| 842 |
+
class GTEST_API_ TestSuite {
|
| 843 |
+
public:
|
| 844 |
+
// Creates a TestSuite with the given name.
|
| 845 |
+
//
|
| 846 |
+
// TestSuite does NOT have a default constructor. Always use this
|
| 847 |
+
// constructor to create a TestSuite object.
|
| 848 |
+
//
|
| 849 |
+
// Arguments:
|
| 850 |
+
//
|
| 851 |
+
// name: name of the test suite
|
| 852 |
+
// a_type_param: the name of the test's type parameter, or NULL if
|
| 853 |
+
// this is not a type-parameterized test.
|
| 854 |
+
// set_up_tc: pointer to the function that sets up the test suite
|
| 855 |
+
// tear_down_tc: pointer to the function that tears down the test suite
|
| 856 |
+
TestSuite(const char* name, const char* a_type_param,
|
| 857 |
+
internal::SetUpTestSuiteFunc set_up_tc,
|
| 858 |
+
internal::TearDownTestSuiteFunc tear_down_tc);
|
| 859 |
+
|
| 860 |
+
// Destructor of TestSuite.
|
| 861 |
+
virtual ~TestSuite();
|
| 862 |
+
|
| 863 |
+
// Gets the name of the TestSuite.
|
| 864 |
+
const char* name() const { return name_.c_str(); }
|
| 865 |
+
|
| 866 |
+
// Returns the name of the parameter type, or NULL if this is not a
|
| 867 |
+
// type-parameterized test suite.
|
| 868 |
+
const char* type_param() const {
|
| 869 |
+
if (type_param_.get() != nullptr) return type_param_->c_str();
|
| 870 |
+
return nullptr;
|
| 871 |
+
}
|
| 872 |
+
|
| 873 |
+
// Returns true if any test in this test suite should run.
|
| 874 |
+
bool should_run() const { return should_run_; }
|
| 875 |
+
|
| 876 |
+
// Gets the number of successful tests in this test suite.
|
| 877 |
+
int successful_test_count() const;
|
| 878 |
+
|
| 879 |
+
// Gets the number of skipped tests in this test suite.
|
| 880 |
+
int skipped_test_count() const;
|
| 881 |
+
|
| 882 |
+
// Gets the number of failed tests in this test suite.
|
| 883 |
+
int failed_test_count() const;
|
| 884 |
+
|
| 885 |
+
// Gets the number of disabled tests that will be reported in the XML report.
|
| 886 |
+
int reportable_disabled_test_count() const;
|
| 887 |
+
|
| 888 |
+
// Gets the number of disabled tests in this test suite.
|
| 889 |
+
int disabled_test_count() const;
|
| 890 |
+
|
| 891 |
+
// Gets the number of tests to be printed in the XML report.
|
| 892 |
+
int reportable_test_count() const;
|
| 893 |
+
|
| 894 |
+
// Get the number of tests in this test suite that should run.
|
| 895 |
+
int test_to_run_count() const;
|
| 896 |
+
|
| 897 |
+
// Gets the number of all tests in this test suite.
|
| 898 |
+
int total_test_count() const;
|
| 899 |
+
|
| 900 |
+
// Returns true if and only if the test suite passed.
|
| 901 |
+
bool Passed() const { return !Failed(); }
|
| 902 |
+
|
| 903 |
+
// Returns true if and only if the test suite failed.
|
| 904 |
+
bool Failed() const {
|
| 905 |
+
return failed_test_count() > 0 || ad_hoc_test_result().Failed();
|
| 906 |
+
}
|
| 907 |
+
|
| 908 |
+
// Returns the elapsed time, in milliseconds.
|
| 909 |
+
TimeInMillis elapsed_time() const { return elapsed_time_; }
|
| 910 |
+
|
| 911 |
+
// Gets the time of the test suite start, in ms from the start of the
|
| 912 |
+
// UNIX epoch.
|
| 913 |
+
TimeInMillis start_timestamp() const { return start_timestamp_; }
|
| 914 |
+
|
| 915 |
+
// Returns the i-th test among all the tests. i can range from 0 to
|
| 916 |
+
// total_test_count() - 1. If i is not in that range, returns NULL.
|
| 917 |
+
const TestInfo* GetTestInfo(int i) const;
|
| 918 |
+
|
| 919 |
+
// Returns the TestResult that holds test properties recorded during
|
| 920 |
+
// execution of SetUpTestSuite and TearDownTestSuite.
|
| 921 |
+
const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }
|
| 922 |
+
|
| 923 |
+
private:
|
| 924 |
+
friend class Test;
|
| 925 |
+
friend class internal::UnitTestImpl;
|
| 926 |
+
|
| 927 |
+
// Gets the (mutable) vector of TestInfos in this TestSuite.
|
| 928 |
+
std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
|
| 929 |
+
|
| 930 |
+
// Gets the (immutable) vector of TestInfos in this TestSuite.
|
| 931 |
+
const std::vector<TestInfo*>& test_info_list() const {
|
| 932 |
+
return test_info_list_;
|
| 933 |
+
}
|
| 934 |
+
|
| 935 |
+
// Returns the i-th test among all the tests. i can range from 0 to
|
| 936 |
+
// total_test_count() - 1. If i is not in that range, returns NULL.
|
| 937 |
+
TestInfo* GetMutableTestInfo(int i);
|
| 938 |
+
|
| 939 |
+
// Sets the should_run member.
|
| 940 |
+
void set_should_run(bool should) { should_run_ = should; }
|
| 941 |
+
|
| 942 |
+
// Adds a TestInfo to this test suite. Will delete the TestInfo upon
|
| 943 |
+
// destruction of the TestSuite object.
|
| 944 |
+
void AddTestInfo(TestInfo * test_info);
|
| 945 |
+
|
| 946 |
+
// Clears the results of all tests in this test suite.
|
| 947 |
+
void ClearResult();
|
| 948 |
+
|
| 949 |
+
// Clears the results of all tests in the given test suite.
|
| 950 |
+
static void ClearTestSuiteResult(TestSuite* test_suite) {
|
| 951 |
+
test_suite->ClearResult();
|
| 952 |
+
}
|
| 953 |
+
|
| 954 |
+
// Runs every test in this TestSuite.
|
| 955 |
+
void Run();
|
| 956 |
+
|
| 957 |
+
// Skips the execution of tests under this TestSuite
|
| 958 |
+
void Skip();
|
| 959 |
+
|
| 960 |
+
// Runs SetUpTestSuite() for this TestSuite. This wrapper is needed
|
| 961 |
+
// for catching exceptions thrown from SetUpTestSuite().
|
| 962 |
+
void RunSetUpTestSuite() {
|
| 963 |
+
if (set_up_tc_ != nullptr) {
|
| 964 |
+
(*set_up_tc_)();
|
| 965 |
+
}
|
| 966 |
+
}
|
| 967 |
+
|
| 968 |
+
// Runs TearDownTestSuite() for this TestSuite. This wrapper is
|
| 969 |
+
// needed for catching exceptions thrown from TearDownTestSuite().
|
| 970 |
+
void RunTearDownTestSuite() {
|
| 971 |
+
if (tear_down_tc_ != nullptr) {
|
| 972 |
+
(*tear_down_tc_)();
|
| 973 |
+
}
|
| 974 |
+
}
|
| 975 |
+
|
| 976 |
+
// Returns true if and only if test passed.
|
| 977 |
+
static bool TestPassed(const TestInfo* test_info) {
|
| 978 |
+
return test_info->should_run() && test_info->result()->Passed();
|
| 979 |
+
}
|
| 980 |
+
|
| 981 |
+
// Returns true if and only if test skipped.
|
| 982 |
+
static bool TestSkipped(const TestInfo* test_info) {
|
| 983 |
+
return test_info->should_run() && test_info->result()->Skipped();
|
| 984 |
+
}
|
| 985 |
+
|
| 986 |
+
// Returns true if and only if test failed.
|
| 987 |
+
static bool TestFailed(const TestInfo* test_info) {
|
| 988 |
+
return test_info->should_run() && test_info->result()->Failed();
|
| 989 |
+
}
|
| 990 |
+
|
| 991 |
+
// Returns true if and only if the test is disabled and will be reported in
|
| 992 |
+
// the XML report.
|
| 993 |
+
static bool TestReportableDisabled(const TestInfo* test_info) {
|
| 994 |
+
return test_info->is_reportable() && test_info->is_disabled_;
|
| 995 |
+
}
|
| 996 |
+
|
| 997 |
+
// Returns true if and only if test is disabled.
|
| 998 |
+
static bool TestDisabled(const TestInfo* test_info) {
|
| 999 |
+
return test_info->is_disabled_;
|
| 1000 |
+
}
|
| 1001 |
+
|
| 1002 |
+
// Returns true if and only if this test will appear in the XML report.
|
| 1003 |
+
static bool TestReportable(const TestInfo* test_info) {
|
| 1004 |
+
return test_info->is_reportable();
|
| 1005 |
+
}
|
| 1006 |
+
|
| 1007 |
+
// Returns true if the given test should run.
|
| 1008 |
+
static bool ShouldRunTest(const TestInfo* test_info) {
|
| 1009 |
+
return test_info->should_run();
|
| 1010 |
+
}
|
| 1011 |
+
|
| 1012 |
+
// Shuffles the tests in this test suite.
|
| 1013 |
+
void ShuffleTests(internal::Random* random);
|
| 1014 |
+
|
| 1015 |
+
// Restores the test order to before the first shuffle.
|
| 1016 |
+
void UnshuffleTests();
|
| 1017 |
+
|
| 1018 |
+
// Name of the test suite.
|
| 1019 |
+
std::string name_;
|
| 1020 |
+
// Name of the parameter type, or NULL if this is not a typed or a
|
| 1021 |
+
// type-parameterized test.
|
| 1022 |
+
const std::unique_ptr<const ::std::string> type_param_;
|
| 1023 |
+
// The vector of TestInfos in their original order. It owns the
|
| 1024 |
+
// elements in the vector.
|
| 1025 |
+
std::vector<TestInfo*> test_info_list_;
|
| 1026 |
+
// Provides a level of indirection for the test list to allow easy
|
| 1027 |
+
// shuffling and restoring the test order. The i-th element in this
|
| 1028 |
+
// vector is the index of the i-th test in the shuffled test list.
|
| 1029 |
+
std::vector<int> test_indices_;
|
| 1030 |
+
// Pointer to the function that sets up the test suite.
|
| 1031 |
+
internal::SetUpTestSuiteFunc set_up_tc_;
|
| 1032 |
+
// Pointer to the function that tears down the test suite.
|
| 1033 |
+
internal::TearDownTestSuiteFunc tear_down_tc_;
|
| 1034 |
+
// True if and only if any test in this test suite should run.
|
| 1035 |
+
bool should_run_;
|
| 1036 |
+
// The start time, in milliseconds since UNIX Epoch.
|
| 1037 |
+
TimeInMillis start_timestamp_;
|
| 1038 |
+
// Elapsed time, in milliseconds.
|
| 1039 |
+
TimeInMillis elapsed_time_;
|
| 1040 |
+
// Holds test properties recorded during execution of SetUpTestSuite and
|
| 1041 |
+
// TearDownTestSuite.
|
| 1042 |
+
TestResult ad_hoc_test_result_;
|
| 1043 |
+
|
| 1044 |
+
// We disallow copying TestSuites.
|
| 1045 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestSuite);
|
| 1046 |
+
};
|
| 1047 |
+
|
| 1048 |
+
// An Environment object is capable of setting up and tearing down an
|
| 1049 |
+
// environment. You should subclass this to define your own
|
| 1050 |
+
// environment(s).
|
| 1051 |
+
//
|
| 1052 |
+
// An Environment object does the set-up and tear-down in virtual
|
| 1053 |
+
// methods SetUp() and TearDown() instead of the constructor and the
|
| 1054 |
+
// destructor, as:
|
| 1055 |
+
//
|
| 1056 |
+
// 1. You cannot safely throw from a destructor. This is a problem
|
| 1057 |
+
// as in some cases Google Test is used where exceptions are enabled, and
|
| 1058 |
+
// we may want to implement ASSERT_* using exceptions where they are
|
| 1059 |
+
// available.
|
| 1060 |
+
// 2. You cannot use ASSERT_* directly in a constructor or
|
| 1061 |
+
// destructor.
|
| 1062 |
+
class Environment {
|
| 1063 |
+
public:
|
| 1064 |
+
// The d'tor is virtual as we need to subclass Environment.
|
| 1065 |
+
virtual ~Environment() {}
|
| 1066 |
+
|
| 1067 |
+
// Override this to define how to set up the environment.
|
| 1068 |
+
virtual void SetUp() {}
|
| 1069 |
+
|
| 1070 |
+
// Override this to define how to tear down the environment.
|
| 1071 |
+
virtual void TearDown() {}
|
| 1072 |
+
private:
|
| 1073 |
+
// If you see an error about overriding the following function or
|
| 1074 |
+
// about it being private, you have mis-spelled SetUp() as Setup().
|
| 1075 |
+
struct Setup_should_be_spelled_SetUp {};
|
| 1076 |
+
virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; }
|
| 1077 |
+
};
|
| 1078 |
+
|
| 1079 |
+
#if GTEST_HAS_EXCEPTIONS
|
| 1080 |
+
|
| 1081 |
+
// Exception which can be thrown from TestEventListener::OnTestPartResult.
|
| 1082 |
+
class GTEST_API_ AssertionException
|
| 1083 |
+
: public internal::GoogleTestFailureException {
|
| 1084 |
+
public:
|
| 1085 |
+
explicit AssertionException(const TestPartResult& result)
|
| 1086 |
+
: GoogleTestFailureException(result) {}
|
| 1087 |
+
};
|
| 1088 |
+
|
| 1089 |
+
#endif // GTEST_HAS_EXCEPTIONS
|
| 1090 |
+
|
| 1091 |
+
// The interface for tracing execution of tests. The methods are organized in
|
| 1092 |
+
// the order the corresponding events are fired.
|
| 1093 |
+
class TestEventListener {
|
| 1094 |
+
public:
|
| 1095 |
+
virtual ~TestEventListener() {}
|
| 1096 |
+
|
| 1097 |
+
// Fired before any test activity starts.
|
| 1098 |
+
virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
|
| 1099 |
+
|
| 1100 |
+
// Fired before each iteration of tests starts. There may be more than
|
| 1101 |
+
// one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
|
| 1102 |
+
// index, starting from 0.
|
| 1103 |
+
virtual void OnTestIterationStart(const UnitTest& unit_test,
|
| 1104 |
+
int iteration) = 0;
|
| 1105 |
+
|
| 1106 |
+
// Fired before environment set-up for each iteration of tests starts.
|
| 1107 |
+
virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
|
| 1108 |
+
|
| 1109 |
+
// Fired after environment set-up for each iteration of tests ends.
|
| 1110 |
+
virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
|
| 1111 |
+
|
| 1112 |
+
// Fired before the test suite starts.
|
| 1113 |
+
virtual void OnTestSuiteStart(const TestSuite& /*test_suite*/) {}
|
| 1114 |
+
|
| 1115 |
+
// Legacy API is deprecated but still available
|
| 1116 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 1117 |
+
virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
|
| 1118 |
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 1119 |
+
|
| 1120 |
+
// Fired before the test starts.
|
| 1121 |
+
virtual void OnTestStart(const TestInfo& test_info) = 0;
|
| 1122 |
+
|
| 1123 |
+
// Fired after a failed assertion or a SUCCEED() invocation.
|
| 1124 |
+
// If you want to throw an exception from this function to skip to the next
|
| 1125 |
+
// TEST, it must be AssertionException defined above, or inherited from it.
|
| 1126 |
+
virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
|
| 1127 |
+
|
| 1128 |
+
// Fired after the test ends.
|
| 1129 |
+
virtual void OnTestEnd(const TestInfo& test_info) = 0;
|
| 1130 |
+
|
| 1131 |
+
// Fired after the test suite ends.
|
| 1132 |
+
virtual void OnTestSuiteEnd(const TestSuite& /*test_suite*/) {}
|
| 1133 |
+
|
| 1134 |
+
// Legacy API is deprecated but still available
|
| 1135 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 1136 |
+
virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
|
| 1137 |
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 1138 |
+
|
| 1139 |
+
// Fired before environment tear-down for each iteration of tests starts.
|
| 1140 |
+
virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
|
| 1141 |
+
|
| 1142 |
+
// Fired after environment tear-down for each iteration of tests ends.
|
| 1143 |
+
virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
|
| 1144 |
+
|
| 1145 |
+
// Fired after each iteration of tests finishes.
|
| 1146 |
+
virtual void OnTestIterationEnd(const UnitTest& unit_test,
|
| 1147 |
+
int iteration) = 0;
|
| 1148 |
+
|
| 1149 |
+
// Fired after all test activities have ended.
|
| 1150 |
+
virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
|
| 1151 |
+
};
|
| 1152 |
+
|
| 1153 |
+
// The convenience class for users who need to override just one or two
|
| 1154 |
+
// methods and are not concerned that a possible change to a signature of
|
| 1155 |
+
// the methods they override will not be caught during the build. For
|
| 1156 |
+
// comments about each method please see the definition of TestEventListener
|
| 1157 |
+
// above.
|
| 1158 |
+
class EmptyTestEventListener : public TestEventListener {
|
| 1159 |
+
public:
|
| 1160 |
+
void OnTestProgramStart(const UnitTest& /*unit_test*/) override {}
|
| 1161 |
+
void OnTestIterationStart(const UnitTest& /*unit_test*/,
|
| 1162 |
+
int /*iteration*/) override {}
|
| 1163 |
+
void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) override {}
|
| 1164 |
+
void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
|
| 1165 |
+
void OnTestSuiteStart(const TestSuite& /*test_suite*/) override {}
|
| 1166 |
+
// Legacy API is deprecated but still available
|
| 1167 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 1168 |
+
void OnTestCaseStart(const TestCase& /*test_case*/) override {}
|
| 1169 |
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 1170 |
+
|
| 1171 |
+
void OnTestStart(const TestInfo& /*test_info*/) override {}
|
| 1172 |
+
void OnTestPartResult(const TestPartResult& /*test_part_result*/) override {}
|
| 1173 |
+
void OnTestEnd(const TestInfo& /*test_info*/) override {}
|
| 1174 |
+
void OnTestSuiteEnd(const TestSuite& /*test_suite*/) override {}
|
| 1175 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 1176 |
+
void OnTestCaseEnd(const TestCase& /*test_case*/) override {}
|
| 1177 |
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 1178 |
+
|
| 1179 |
+
void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) override {}
|
| 1180 |
+
void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) override {}
|
| 1181 |
+
void OnTestIterationEnd(const UnitTest& /*unit_test*/,
|
| 1182 |
+
int /*iteration*/) override {}
|
| 1183 |
+
void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {}
|
| 1184 |
+
};
|
| 1185 |
+
|
| 1186 |
+
// TestEventListeners lets users add listeners to track events in Google Test.
|
| 1187 |
+
class GTEST_API_ TestEventListeners {
|
| 1188 |
+
public:
|
| 1189 |
+
TestEventListeners();
|
| 1190 |
+
~TestEventListeners();
|
| 1191 |
+
|
| 1192 |
+
// Appends an event listener to the end of the list. Google Test assumes
|
| 1193 |
+
// the ownership of the listener (i.e. it will delete the listener when
|
| 1194 |
+
// the test program finishes).
|
| 1195 |
+
void Append(TestEventListener* listener);
|
| 1196 |
+
|
| 1197 |
+
// Removes the given event listener from the list and returns it. It then
|
| 1198 |
+
// becomes the caller's responsibility to delete the listener. Returns
|
| 1199 |
+
// NULL if the listener is not found in the list.
|
| 1200 |
+
TestEventListener* Release(TestEventListener* listener);
|
| 1201 |
+
|
| 1202 |
+
// Returns the standard listener responsible for the default console
|
| 1203 |
+
// output. Can be removed from the listeners list to shut down default
|
| 1204 |
+
// console output. Note that removing this object from the listener list
|
| 1205 |
+
// with Release transfers its ownership to the caller and makes this
|
| 1206 |
+
// function return NULL the next time.
|
| 1207 |
+
TestEventListener* default_result_printer() const {
|
| 1208 |
+
return default_result_printer_;
|
| 1209 |
+
}
|
| 1210 |
+
|
| 1211 |
+
// Returns the standard listener responsible for the default XML output
|
| 1212 |
+
// controlled by the --gtest_output=xml flag. Can be removed from the
|
| 1213 |
+
// listeners list by users who want to shut down the default XML output
|
| 1214 |
+
// controlled by this flag and substitute it with custom one. Note that
|
| 1215 |
+
// removing this object from the listener list with Release transfers its
|
| 1216 |
+
// ownership to the caller and makes this function return NULL the next
|
| 1217 |
+
// time.
|
| 1218 |
+
TestEventListener* default_xml_generator() const {
|
| 1219 |
+
return default_xml_generator_;
|
| 1220 |
+
}
|
| 1221 |
+
|
| 1222 |
+
private:
|
| 1223 |
+
friend class TestSuite;
|
| 1224 |
+
friend class TestInfo;
|
| 1225 |
+
friend class internal::DefaultGlobalTestPartResultReporter;
|
| 1226 |
+
friend class internal::NoExecDeathTest;
|
| 1227 |
+
friend class internal::TestEventListenersAccessor;
|
| 1228 |
+
friend class internal::UnitTestImpl;
|
| 1229 |
+
|
| 1230 |
+
// Returns repeater that broadcasts the TestEventListener events to all
|
| 1231 |
+
// subscribers.
|
| 1232 |
+
TestEventListener* repeater();
|
| 1233 |
+
|
| 1234 |
+
// Sets the default_result_printer attribute to the provided listener.
|
| 1235 |
+
// The listener is also added to the listener list and previous
|
| 1236 |
+
// default_result_printer is removed from it and deleted. The listener can
|
| 1237 |
+
// also be NULL in which case it will not be added to the list. Does
|
| 1238 |
+
// nothing if the previous and the current listener objects are the same.
|
| 1239 |
+
void SetDefaultResultPrinter(TestEventListener* listener);
|
| 1240 |
+
|
| 1241 |
+
// Sets the default_xml_generator attribute to the provided listener. The
|
| 1242 |
+
// listener is also added to the listener list and previous
|
| 1243 |
+
// default_xml_generator is removed from it and deleted. The listener can
|
| 1244 |
+
// also be NULL in which case it will not be added to the list. Does
|
| 1245 |
+
// nothing if the previous and the current listener objects are the same.
|
| 1246 |
+
void SetDefaultXmlGenerator(TestEventListener* listener);
|
| 1247 |
+
|
| 1248 |
+
// Controls whether events will be forwarded by the repeater to the
|
| 1249 |
+
// listeners in the list.
|
| 1250 |
+
bool EventForwardingEnabled() const;
|
| 1251 |
+
void SuppressEventForwarding();
|
| 1252 |
+
|
| 1253 |
+
// The actual list of listeners.
|
| 1254 |
+
internal::TestEventRepeater* repeater_;
|
| 1255 |
+
// Listener responsible for the standard result output.
|
| 1256 |
+
TestEventListener* default_result_printer_;
|
| 1257 |
+
// Listener responsible for the creation of the XML output file.
|
| 1258 |
+
TestEventListener* default_xml_generator_;
|
| 1259 |
+
|
| 1260 |
+
// We disallow copying TestEventListeners.
|
| 1261 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
|
| 1262 |
+
};
|
| 1263 |
+
|
| 1264 |
+
// A UnitTest consists of a vector of TestSuites.
|
| 1265 |
+
//
|
| 1266 |
+
// This is a singleton class. The only instance of UnitTest is
|
| 1267 |
+
// created when UnitTest::GetInstance() is first called. This
|
| 1268 |
+
// instance is never deleted.
|
| 1269 |
+
//
|
| 1270 |
+
// UnitTest is not copyable.
|
| 1271 |
+
//
|
| 1272 |
+
// This class is thread-safe as long as the methods are called
|
| 1273 |
+
// according to their specification.
|
| 1274 |
+
class GTEST_API_ UnitTest {
|
| 1275 |
+
public:
|
| 1276 |
+
// Gets the singleton UnitTest object. The first time this method
|
| 1277 |
+
// is called, a UnitTest object is constructed and returned.
|
| 1278 |
+
// Consecutive calls will return the same object.
|
| 1279 |
+
static UnitTest* GetInstance();
|
| 1280 |
+
|
| 1281 |
+
// Runs all tests in this UnitTest object and prints the result.
|
| 1282 |
+
// Returns 0 if successful, or 1 otherwise.
|
| 1283 |
+
//
|
| 1284 |
+
// This method can only be called from the main thread.
|
| 1285 |
+
//
|
| 1286 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 1287 |
+
int Run() GTEST_MUST_USE_RESULT_;
|
| 1288 |
+
|
| 1289 |
+
// Returns the working directory when the first TEST() or TEST_F()
|
| 1290 |
+
// was executed. The UnitTest object owns the string.
|
| 1291 |
+
const char* original_working_dir() const;
|
| 1292 |
+
|
| 1293 |
+
// Returns the TestSuite object for the test that's currently running,
|
| 1294 |
+
// or NULL if no test is running.
|
| 1295 |
+
const TestSuite* current_test_suite() const GTEST_LOCK_EXCLUDED_(mutex_);
|
| 1296 |
+
|
| 1297 |
+
// Legacy API is still available but deprecated
|
| 1298 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 1299 |
+
const TestCase* current_test_case() const GTEST_LOCK_EXCLUDED_(mutex_);
|
| 1300 |
+
#endif
|
| 1301 |
+
|
| 1302 |
+
// Returns the TestInfo object for the test that's currently running,
|
| 1303 |
+
// or NULL if no test is running.
|
| 1304 |
+
const TestInfo* current_test_info() const
|
| 1305 |
+
GTEST_LOCK_EXCLUDED_(mutex_);
|
| 1306 |
+
|
| 1307 |
+
// Returns the random seed used at the start of the current test run.
|
| 1308 |
+
int random_seed() const;
|
| 1309 |
+
|
| 1310 |
+
// Returns the ParameterizedTestSuiteRegistry object used to keep track of
|
| 1311 |
+
// value-parameterized tests and instantiate and register them.
|
| 1312 |
+
//
|
| 1313 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 1314 |
+
internal::ParameterizedTestSuiteRegistry& parameterized_test_registry()
|
| 1315 |
+
GTEST_LOCK_EXCLUDED_(mutex_);
|
| 1316 |
+
|
| 1317 |
+
// Gets the number of successful test suites.
|
| 1318 |
+
int successful_test_suite_count() const;
|
| 1319 |
+
|
| 1320 |
+
// Gets the number of failed test suites.
|
| 1321 |
+
int failed_test_suite_count() const;
|
| 1322 |
+
|
| 1323 |
+
// Gets the number of all test suites.
|
| 1324 |
+
int total_test_suite_count() const;
|
| 1325 |
+
|
| 1326 |
+
// Gets the number of all test suites that contain at least one test
|
| 1327 |
+
// that should run.
|
| 1328 |
+
int test_suite_to_run_count() const;
|
| 1329 |
+
|
| 1330 |
+
// Legacy API is deprecated but still available
|
| 1331 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 1332 |
+
int successful_test_case_count() const;
|
| 1333 |
+
int failed_test_case_count() const;
|
| 1334 |
+
int total_test_case_count() const;
|
| 1335 |
+
int test_case_to_run_count() const;
|
| 1336 |
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 1337 |
+
|
| 1338 |
+
// Gets the number of successful tests.
|
| 1339 |
+
int successful_test_count() const;
|
| 1340 |
+
|
| 1341 |
+
// Gets the number of skipped tests.
|
| 1342 |
+
int skipped_test_count() const;
|
| 1343 |
+
|
| 1344 |
+
// Gets the number of failed tests.
|
| 1345 |
+
int failed_test_count() const;
|
| 1346 |
+
|
| 1347 |
+
// Gets the number of disabled tests that will be reported in the XML report.
|
| 1348 |
+
int reportable_disabled_test_count() const;
|
| 1349 |
+
|
| 1350 |
+
// Gets the number of disabled tests.
|
| 1351 |
+
int disabled_test_count() const;
|
| 1352 |
+
|
| 1353 |
+
// Gets the number of tests to be printed in the XML report.
|
| 1354 |
+
int reportable_test_count() const;
|
| 1355 |
+
|
| 1356 |
+
// Gets the number of all tests.
|
| 1357 |
+
int total_test_count() const;
|
| 1358 |
+
|
| 1359 |
+
// Gets the number of tests that should run.
|
| 1360 |
+
int test_to_run_count() const;
|
| 1361 |
+
|
| 1362 |
+
// Gets the time of the test program start, in ms from the start of the
|
| 1363 |
+
// UNIX epoch.
|
| 1364 |
+
TimeInMillis start_timestamp() const;
|
| 1365 |
+
|
| 1366 |
+
// Gets the elapsed time, in milliseconds.
|
| 1367 |
+
TimeInMillis elapsed_time() const;
|
| 1368 |
+
|
| 1369 |
+
// Returns true if and only if the unit test passed (i.e. all test suites
|
| 1370 |
+
// passed).
|
| 1371 |
+
bool Passed() const;
|
| 1372 |
+
|
| 1373 |
+
// Returns true if and only if the unit test failed (i.e. some test suite
|
| 1374 |
+
// failed or something outside of all tests failed).
|
| 1375 |
+
bool Failed() const;
|
| 1376 |
+
|
| 1377 |
+
// Gets the i-th test suite among all the test suites. i can range from 0 to
|
| 1378 |
+
// total_test_suite_count() - 1. If i is not in that range, returns NULL.
|
| 1379 |
+
const TestSuite* GetTestSuite(int i) const;
|
| 1380 |
+
|
| 1381 |
+
// Legacy API is deprecated but still available
|
| 1382 |
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 1383 |
+
const TestCase* GetTestCase(int i) const;
|
| 1384 |
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
| 1385 |
+
|
| 1386 |
+
// Returns the TestResult containing information on test failures and
|
| 1387 |
+
// properties logged outside of individual test suites.
|
| 1388 |
+
const TestResult& ad_hoc_test_result() const;
|
| 1389 |
+
|
| 1390 |
+
// Returns the list of event listeners that can be used to track events
|
| 1391 |
+
// inside Google Test.
|
| 1392 |
+
TestEventListeners& listeners();
|
| 1393 |
+
|
| 1394 |
+
private:
|
| 1395 |
+
// Registers and returns a global test environment. When a test
|
| 1396 |
+
// program is run, all global test environments will be set-up in
|
| 1397 |
+
// the order they were registered. After all tests in the program
|
| 1398 |
+
// have finished, all global test environments will be torn-down in
|
| 1399 |
+
// the *reverse* order they were registered.
|
| 1400 |
+
//
|
| 1401 |
+
// The UnitTest object takes ownership of the given environment.
|
| 1402 |
+
//
|
| 1403 |
+
// This method can only be called from the main thread.
|
| 1404 |
+
Environment* AddEnvironment(Environment* env);
|
| 1405 |
+
|
| 1406 |
+
// Adds a TestPartResult to the current TestResult object. All
|
| 1407 |
+
// Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
|
| 1408 |
+
// eventually call this to report their results. The user code
|
| 1409 |
+
// should use the assertion macros instead of calling this directly.
|
| 1410 |
+
void AddTestPartResult(TestPartResult::Type result_type,
|
| 1411 |
+
const char* file_name,
|
| 1412 |
+
int line_number,
|
| 1413 |
+
const std::string& message,
|
| 1414 |
+
const std::string& os_stack_trace)
|
| 1415 |
+
GTEST_LOCK_EXCLUDED_(mutex_);
|
| 1416 |
+
|
| 1417 |
+
// Adds a TestProperty to the current TestResult object when invoked from
|
| 1418 |
+
// inside a test, to current TestSuite's ad_hoc_test_result_ when invoked
|
| 1419 |
+
// from SetUpTestSuite or TearDownTestSuite, or to the global property set
|
| 1420 |
+
// when invoked elsewhere. If the result already contains a property with
|
| 1421 |
+
// the same key, the value will be updated.
|
| 1422 |
+
void RecordProperty(const std::string& key, const std::string& value);
|
| 1423 |
+
|
| 1424 |
+
// Gets the i-th test suite among all the test suites. i can range from 0 to
|
| 1425 |
+
// total_test_suite_count() - 1. If i is not in that range, returns NULL.
|
| 1426 |
+
TestSuite* GetMutableTestSuite(int i);
|
| 1427 |
+
|
| 1428 |
+
// Accessors for the implementation object.
|
| 1429 |
+
internal::UnitTestImpl* impl() { return impl_; }
|
| 1430 |
+
const internal::UnitTestImpl* impl() const { return impl_; }
|
| 1431 |
+
|
| 1432 |
+
// These classes and functions are friends as they need to access private
|
| 1433 |
+
// members of UnitTest.
|
| 1434 |
+
friend class ScopedTrace;
|
| 1435 |
+
friend class Test;
|
| 1436 |
+
friend class internal::AssertHelper;
|
| 1437 |
+
friend class internal::StreamingListenerTest;
|
| 1438 |
+
friend class internal::UnitTestRecordPropertyTestHelper;
|
| 1439 |
+
friend Environment* AddGlobalTestEnvironment(Environment* env);
|
| 1440 |
+
friend std::set<std::string>* internal::GetIgnoredParameterizedTestSuites();
|
| 1441 |
+
friend internal::UnitTestImpl* internal::GetUnitTestImpl();
|
| 1442 |
+
friend void internal::ReportFailureInUnknownLocation(
|
| 1443 |
+
TestPartResult::Type result_type,
|
| 1444 |
+
const std::string& message);
|
| 1445 |
+
|
| 1446 |
+
// Creates an empty UnitTest.
|
| 1447 |
+
UnitTest();
|
| 1448 |
+
|
| 1449 |
+
// D'tor
|
| 1450 |
+
virtual ~UnitTest();
|
| 1451 |
+
|
| 1452 |
+
// Pushes a trace defined by SCOPED_TRACE() on to the per-thread
|
| 1453 |
+
// Google Test trace stack.
|
| 1454 |
+
void PushGTestTrace(const internal::TraceInfo& trace)
|
| 1455 |
+
GTEST_LOCK_EXCLUDED_(mutex_);
|
| 1456 |
+
|
| 1457 |
+
// Pops a trace from the per-thread Google Test trace stack.
|
| 1458 |
+
void PopGTestTrace()
|
| 1459 |
+
GTEST_LOCK_EXCLUDED_(mutex_);
|
| 1460 |
+
|
| 1461 |
+
// Protects mutable state in *impl_. This is mutable as some const
|
| 1462 |
+
// methods need to lock it too.
|
| 1463 |
+
mutable internal::Mutex mutex_;
|
| 1464 |
+
|
| 1465 |
+
// Opaque implementation object. This field is never changed once
|
| 1466 |
+
// the object is constructed. We don't mark it as const here, as
|
| 1467 |
+
// doing so will cause a warning in the constructor of UnitTest.
|
| 1468 |
+
// Mutable state in *impl_ is protected by mutex_.
|
| 1469 |
+
internal::UnitTestImpl* impl_;
|
| 1470 |
+
|
| 1471 |
+
// We disallow copying UnitTest.
|
| 1472 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
|
| 1473 |
+
};
|
| 1474 |
+
|
| 1475 |
+
// A convenient wrapper for adding an environment for the test
|
| 1476 |
+
// program.
|
| 1477 |
+
//
|
| 1478 |
+
// You should call this before RUN_ALL_TESTS() is called, probably in
|
| 1479 |
+
// main(). If you use gtest_main, you need to call this before main()
|
| 1480 |
+
// starts for it to take effect. For example, you can define a global
|
| 1481 |
+
// variable like this:
|
| 1482 |
+
//
|
| 1483 |
+
// testing::Environment* const foo_env =
|
| 1484 |
+
// testing::AddGlobalTestEnvironment(new FooEnvironment);
|
| 1485 |
+
//
|
| 1486 |
+
// However, we strongly recommend you to write your own main() and
|
| 1487 |
+
// call AddGlobalTestEnvironment() there, as relying on initialization
|
| 1488 |
+
// of global variables makes the code harder to read and may cause
|
| 1489 |
+
// problems when you register multiple environments from different
|
| 1490 |
+
// translation units and the environments have dependencies among them
|
| 1491 |
+
// (remember that the compiler doesn't guarantee the order in which
|
| 1492 |
+
// global variables from different translation units are initialized).
|
| 1493 |
+
inline Environment* AddGlobalTestEnvironment(Environment* env) {
|
| 1494 |
+
return UnitTest::GetInstance()->AddEnvironment(env);
|
| 1495 |
+
}
|
| 1496 |
+
|
| 1497 |
+
// Initializes Google Test. This must be called before calling
|
| 1498 |
+
// RUN_ALL_TESTS(). In particular, it parses a command line for the
|
| 1499 |
+
// flags that Google Test recognizes. Whenever a Google Test flag is
|
| 1500 |
+
// seen, it is removed from argv, and *argc is decremented.
|
| 1501 |
+
//
|
| 1502 |
+
// No value is returned. Instead, the Google Test flag variables are
|
| 1503 |
+
// updated.
|
| 1504 |
+
//
|
| 1505 |
+
// Calling the function for the second time has no user-visible effect.
|
| 1506 |
+
GTEST_API_ void InitGoogleTest(int* argc, char** argv);
|
| 1507 |
+
|
| 1508 |
+
// This overloaded version can be used in Windows programs compiled in
|
| 1509 |
+
// UNICODE mode.
|
| 1510 |
+
GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
|
| 1511 |
+
|
| 1512 |
+
// This overloaded version can be used on Arduino/embedded platforms where
|
| 1513 |
+
// there is no argc/argv.
|
| 1514 |
+
GTEST_API_ void InitGoogleTest();
|
| 1515 |
+
|
| 1516 |
+
namespace internal {
|
| 1517 |
+
|
| 1518 |
+
// Separate the error generating code from the code path to reduce the stack
|
| 1519 |
+
// frame size of CmpHelperEQ. This helps reduce the overhead of some sanitizers
|
| 1520 |
+
// when calling EXPECT_* in a tight loop.
|
| 1521 |
+
template <typename T1, typename T2>
|
| 1522 |
+
AssertionResult CmpHelperEQFailure(const char* lhs_expression,
|
| 1523 |
+
const char* rhs_expression,
|
| 1524 |
+
const T1& lhs, const T2& rhs) {
|
| 1525 |
+
return EqFailure(lhs_expression,
|
| 1526 |
+
rhs_expression,
|
| 1527 |
+
FormatForComparisonFailureMessage(lhs, rhs),
|
| 1528 |
+
FormatForComparisonFailureMessage(rhs, lhs),
|
| 1529 |
+
false);
|
| 1530 |
+
}
|
| 1531 |
+
|
| 1532 |
+
// This block of code defines operator==/!=
|
| 1533 |
+
// to block lexical scope lookup.
|
| 1534 |
+
// It prevents using invalid operator==/!= defined at namespace scope.
|
| 1535 |
+
struct faketype {};
|
| 1536 |
+
inline bool operator==(faketype, faketype) { return true; }
|
| 1537 |
+
inline bool operator!=(faketype, faketype) { return false; }
|
| 1538 |
+
|
| 1539 |
+
// The helper function for {ASSERT|EXPECT}_EQ.
|
| 1540 |
+
template <typename T1, typename T2>
|
| 1541 |
+
AssertionResult CmpHelperEQ(const char* lhs_expression,
|
| 1542 |
+
const char* rhs_expression,
|
| 1543 |
+
const T1& lhs,
|
| 1544 |
+
const T2& rhs) {
|
| 1545 |
+
if (lhs == rhs) {
|
| 1546 |
+
return AssertionSuccess();
|
| 1547 |
+
}
|
| 1548 |
+
|
| 1549 |
+
return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);
|
| 1550 |
+
}
|
| 1551 |
+
|
| 1552 |
+
class EqHelper {
|
| 1553 |
+
public:
|
| 1554 |
+
// This templatized version is for the general case.
|
| 1555 |
+
template <
|
| 1556 |
+
typename T1, typename T2,
|
| 1557 |
+
// Disable this overload for cases where one argument is a pointer
|
| 1558 |
+
// and the other is the null pointer constant.
|
| 1559 |
+
typename std::enable_if<!std::is_integral<T1>::value ||
|
| 1560 |
+
!std::is_pointer<T2>::value>::type* = nullptr>
|
| 1561 |
+
static AssertionResult Compare(const char* lhs_expression,
|
| 1562 |
+
const char* rhs_expression, const T1& lhs,
|
| 1563 |
+
const T2& rhs) {
|
| 1564 |
+
return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
|
| 1565 |
+
}
|
| 1566 |
+
|
| 1567 |
+
// With this overloaded version, we allow anonymous enums to be used
|
| 1568 |
+
// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
|
| 1569 |
+
// enums can be implicitly cast to BiggestInt.
|
| 1570 |
+
//
|
| 1571 |
+
// Even though its body looks the same as the above version, we
|
| 1572 |
+
// cannot merge the two, as it will make anonymous enums unhappy.
|
| 1573 |
+
static AssertionResult Compare(const char* lhs_expression,
|
| 1574 |
+
const char* rhs_expression,
|
| 1575 |
+
BiggestInt lhs,
|
| 1576 |
+
BiggestInt rhs) {
|
| 1577 |
+
return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
|
| 1578 |
+
}
|
| 1579 |
+
|
| 1580 |
+
template <typename T>
|
| 1581 |
+
static AssertionResult Compare(
|
| 1582 |
+
const char* lhs_expression, const char* rhs_expression,
|
| 1583 |
+
// Handle cases where '0' is used as a null pointer literal.
|
| 1584 |
+
std::nullptr_t /* lhs */, T* rhs) {
|
| 1585 |
+
// We already know that 'lhs' is a null pointer.
|
| 1586 |
+
return CmpHelperEQ(lhs_expression, rhs_expression, static_cast<T*>(nullptr),
|
| 1587 |
+
rhs);
|
| 1588 |
+
}
|
| 1589 |
+
};
|
| 1590 |
+
|
| 1591 |
+
// Separate the error generating code from the code path to reduce the stack
|
| 1592 |
+
// frame size of CmpHelperOP. This helps reduce the overhead of some sanitizers
|
| 1593 |
+
// when calling EXPECT_OP in a tight loop.
|
| 1594 |
+
template <typename T1, typename T2>
|
| 1595 |
+
AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2,
|
| 1596 |
+
const T1& val1, const T2& val2,
|
| 1597 |
+
const char* op) {
|
| 1598 |
+
return AssertionFailure()
|
| 1599 |
+
<< "Expected: (" << expr1 << ") " << op << " (" << expr2
|
| 1600 |
+
<< "), actual: " << FormatForComparisonFailureMessage(val1, val2)
|
| 1601 |
+
<< " vs " << FormatForComparisonFailureMessage(val2, val1);
|
| 1602 |
+
}
|
| 1603 |
+
|
| 1604 |
+
// A macro for implementing the helper functions needed to implement
|
| 1605 |
+
// ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste
|
| 1606 |
+
// of similar code.
|
| 1607 |
+
//
|
| 1608 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 1609 |
+
|
| 1610 |
+
#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
|
| 1611 |
+
template <typename T1, typename T2>\
|
| 1612 |
+
AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
|
| 1613 |
+
const T1& val1, const T2& val2) {\
|
| 1614 |
+
if (val1 op val2) {\
|
| 1615 |
+
return AssertionSuccess();\
|
| 1616 |
+
} else {\
|
| 1617 |
+
return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
|
| 1618 |
+
}\
|
| 1619 |
+
}
|
| 1620 |
+
|
| 1621 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 1622 |
+
|
| 1623 |
+
// Implements the helper function for {ASSERT|EXPECT}_NE
|
| 1624 |
+
GTEST_IMPL_CMP_HELPER_(NE, !=)
|
| 1625 |
+
// Implements the helper function for {ASSERT|EXPECT}_LE
|
| 1626 |
+
GTEST_IMPL_CMP_HELPER_(LE, <=)
|
| 1627 |
+
// Implements the helper function for {ASSERT|EXPECT}_LT
|
| 1628 |
+
GTEST_IMPL_CMP_HELPER_(LT, <)
|
| 1629 |
+
// Implements the helper function for {ASSERT|EXPECT}_GE
|
| 1630 |
+
GTEST_IMPL_CMP_HELPER_(GE, >=)
|
| 1631 |
+
// Implements the helper function for {ASSERT|EXPECT}_GT
|
| 1632 |
+
GTEST_IMPL_CMP_HELPER_(GT, >)
|
| 1633 |
+
|
| 1634 |
+
#undef GTEST_IMPL_CMP_HELPER_
|
| 1635 |
+
|
| 1636 |
+
// The helper function for {ASSERT|EXPECT}_STREQ.
|
| 1637 |
+
//
|
| 1638 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 1639 |
+
GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
|
| 1640 |
+
const char* s2_expression,
|
| 1641 |
+
const char* s1,
|
| 1642 |
+
const char* s2);
|
| 1643 |
+
|
| 1644 |
+
// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
|
| 1645 |
+
//
|
| 1646 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 1647 |
+
GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression,
|
| 1648 |
+
const char* s2_expression,
|
| 1649 |
+
const char* s1,
|
| 1650 |
+
const char* s2);
|
| 1651 |
+
|
| 1652 |
+
// The helper function for {ASSERT|EXPECT}_STRNE.
|
| 1653 |
+
//
|
| 1654 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 1655 |
+
GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
|
| 1656 |
+
const char* s2_expression,
|
| 1657 |
+
const char* s1,
|
| 1658 |
+
const char* s2);
|
| 1659 |
+
|
| 1660 |
+
// The helper function for {ASSERT|EXPECT}_STRCASENE.
|
| 1661 |
+
//
|
| 1662 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 1663 |
+
GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
|
| 1664 |
+
const char* s2_expression,
|
| 1665 |
+
const char* s1,
|
| 1666 |
+
const char* s2);
|
| 1667 |
+
|
| 1668 |
+
|
| 1669 |
+
// Helper function for *_STREQ on wide strings.
|
| 1670 |
+
//
|
| 1671 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 1672 |
+
GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
|
| 1673 |
+
const char* s2_expression,
|
| 1674 |
+
const wchar_t* s1,
|
| 1675 |
+
const wchar_t* s2);
|
| 1676 |
+
|
| 1677 |
+
// Helper function for *_STRNE on wide strings.
|
| 1678 |
+
//
|
| 1679 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 1680 |
+
GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
|
| 1681 |
+
const char* s2_expression,
|
| 1682 |
+
const wchar_t* s1,
|
| 1683 |
+
const wchar_t* s2);
|
| 1684 |
+
|
| 1685 |
+
} // namespace internal
|
| 1686 |
+
|
| 1687 |
+
// IsSubstring() and IsNotSubstring() are intended to be used as the
|
| 1688 |
+
// first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
|
| 1689 |
+
// themselves. They check whether needle is a substring of haystack
|
| 1690 |
+
// (NULL is considered a substring of itself only), and return an
|
| 1691 |
+
// appropriate error message when they fail.
|
| 1692 |
+
//
|
| 1693 |
+
// The {needle,haystack}_expr arguments are the stringified
|
| 1694 |
+
// expressions that generated the two real arguments.
|
| 1695 |
+
GTEST_API_ AssertionResult IsSubstring(
|
| 1696 |
+
const char* needle_expr, const char* haystack_expr,
|
| 1697 |
+
const char* needle, const char* haystack);
|
| 1698 |
+
GTEST_API_ AssertionResult IsSubstring(
|
| 1699 |
+
const char* needle_expr, const char* haystack_expr,
|
| 1700 |
+
const wchar_t* needle, const wchar_t* haystack);
|
| 1701 |
+
GTEST_API_ AssertionResult IsNotSubstring(
|
| 1702 |
+
const char* needle_expr, const char* haystack_expr,
|
| 1703 |
+
const char* needle, const char* haystack);
|
| 1704 |
+
GTEST_API_ AssertionResult IsNotSubstring(
|
| 1705 |
+
const char* needle_expr, const char* haystack_expr,
|
| 1706 |
+
const wchar_t* needle, const wchar_t* haystack);
|
| 1707 |
+
GTEST_API_ AssertionResult IsSubstring(
|
| 1708 |
+
const char* needle_expr, const char* haystack_expr,
|
| 1709 |
+
const ::std::string& needle, const ::std::string& haystack);
|
| 1710 |
+
GTEST_API_ AssertionResult IsNotSubstring(
|
| 1711 |
+
const char* needle_expr, const char* haystack_expr,
|
| 1712 |
+
const ::std::string& needle, const ::std::string& haystack);
|
| 1713 |
+
|
| 1714 |
+
#if GTEST_HAS_STD_WSTRING
|
| 1715 |
+
GTEST_API_ AssertionResult IsSubstring(
|
| 1716 |
+
const char* needle_expr, const char* haystack_expr,
|
| 1717 |
+
const ::std::wstring& needle, const ::std::wstring& haystack);
|
| 1718 |
+
GTEST_API_ AssertionResult IsNotSubstring(
|
| 1719 |
+
const char* needle_expr, const char* haystack_expr,
|
| 1720 |
+
const ::std::wstring& needle, const ::std::wstring& haystack);
|
| 1721 |
+
#endif // GTEST_HAS_STD_WSTRING
|
| 1722 |
+
|
| 1723 |
+
namespace internal {
|
| 1724 |
+
|
| 1725 |
+
// Helper template function for comparing floating-points.
|
| 1726 |
+
//
|
| 1727 |
+
// Template parameter:
|
| 1728 |
+
//
|
| 1729 |
+
// RawType: the raw floating-point type (either float or double)
|
| 1730 |
+
//
|
| 1731 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 1732 |
+
template <typename RawType>
|
| 1733 |
+
AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
|
| 1734 |
+
const char* rhs_expression,
|
| 1735 |
+
RawType lhs_value,
|
| 1736 |
+
RawType rhs_value) {
|
| 1737 |
+
const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
|
| 1738 |
+
|
| 1739 |
+
if (lhs.AlmostEquals(rhs)) {
|
| 1740 |
+
return AssertionSuccess();
|
| 1741 |
+
}
|
| 1742 |
+
|
| 1743 |
+
::std::stringstream lhs_ss;
|
| 1744 |
+
lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
|
| 1745 |
+
<< lhs_value;
|
| 1746 |
+
|
| 1747 |
+
::std::stringstream rhs_ss;
|
| 1748 |
+
rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
|
| 1749 |
+
<< rhs_value;
|
| 1750 |
+
|
| 1751 |
+
return EqFailure(lhs_expression,
|
| 1752 |
+
rhs_expression,
|
| 1753 |
+
StringStreamToString(&lhs_ss),
|
| 1754 |
+
StringStreamToString(&rhs_ss),
|
| 1755 |
+
false);
|
| 1756 |
+
}
|
| 1757 |
+
|
| 1758 |
+
// Helper function for implementing ASSERT_NEAR.
|
| 1759 |
+
//
|
| 1760 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
| 1761 |
+
GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
|
| 1762 |
+
const char* expr2,
|
| 1763 |
+
const char* abs_error_expr,
|
| 1764 |
+
double val1,
|
| 1765 |
+
double val2,
|
| 1766 |
+
double abs_error);
|
| 1767 |
+
|
| 1768 |
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
| 1769 |
+
// A class that enables one to stream messages to assertion macros
|
| 1770 |
+
class GTEST_API_ AssertHelper {
|
| 1771 |
+
public:
|
| 1772 |
+
// Constructor.
|
| 1773 |
+
AssertHelper(TestPartResult::Type type,
|
| 1774 |
+
const char* file,
|
| 1775 |
+
int line,
|
| 1776 |
+
const char* message);
|
| 1777 |
+
~AssertHelper();
|
| 1778 |
+
|
| 1779 |
+
// Message assignment is a semantic trick to enable assertion
|
| 1780 |
+
// streaming; see the GTEST_MESSAGE_ macro below.
|
| 1781 |
+
void operator=(const Message& message) const;
|
| 1782 |
+
|
| 1783 |
+
private:
|
| 1784 |
+
// We put our data in a struct so that the size of the AssertHelper class can
|
| 1785 |
+
// be as small as possible. This is important because gcc is incapable of
|
| 1786 |
+
// re-using stack space even for temporary variables, so every EXPECT_EQ
|
| 1787 |
+
// reserves stack space for another AssertHelper.
|
| 1788 |
+
struct AssertHelperData {
|
| 1789 |
+
AssertHelperData(TestPartResult::Type t,
|
| 1790 |
+
const char* srcfile,
|
| 1791 |
+
int line_num,
|
| 1792 |
+
const char* msg)
|
| 1793 |
+
: type(t), file(srcfile), line(line_num), message(msg) { }
|
| 1794 |
+
|
| 1795 |
+
TestPartResult::Type const type;
|
| 1796 |
+
const char* const file;
|
| 1797 |
+
int const line;
|
| 1798 |
+
std::string const message;
|
| 1799 |
+
|
| 1800 |
+
private:
|
| 1801 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
|
| 1802 |
+
};
|
| 1803 |
+
|
| 1804 |
+
AssertHelperData* const data_;
|
| 1805 |
+
|
| 1806 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
|
| 1807 |
+
};
|
| 1808 |
+
|
| 1809 |
+
} // namespace internal
|
| 1810 |
+
|
| 1811 |
+
// The pure interface class that all value-parameterized tests inherit from.
|
| 1812 |
+
// A value-parameterized class must inherit from both ::testing::Test and
|
| 1813 |
+
// ::testing::WithParamInterface. In most cases that just means inheriting
|
| 1814 |
+
// from ::testing::TestWithParam, but more complicated test hierarchies
|
| 1815 |
+
// may need to inherit from Test and WithParamInterface at different levels.
|
| 1816 |
+
//
|
| 1817 |
+
// This interface has support for accessing the test parameter value via
|
| 1818 |
+
// the GetParam() method.
|
| 1819 |
+
//
|
| 1820 |
+
// Use it with one of the parameter generator defining functions, like Range(),
|
| 1821 |
+
// Values(), ValuesIn(), Bool(), and Combine().
|
| 1822 |
+
//
|
| 1823 |
+
// class FooTest : public ::testing::TestWithParam<int> {
|
| 1824 |
+
// protected:
|
| 1825 |
+
// FooTest() {
|
| 1826 |
+
// // Can use GetParam() here.
|
| 1827 |
+
// }
|
| 1828 |
+
// ~FooTest() override {
|
| 1829 |
+
// // Can use GetParam() here.
|
| 1830 |
+
// }
|
| 1831 |
+
// void SetUp() override {
|
| 1832 |
+
// // Can use GetParam() here.
|
| 1833 |
+
// }
|
| 1834 |
+
// void TearDown override {
|
| 1835 |
+
// // Can use GetParam() here.
|
| 1836 |
+
// }
|
| 1837 |
+
// };
|
| 1838 |
+
// TEST_P(FooTest, DoesBar) {
|
| 1839 |
+
// // Can use GetParam() method here.
|
| 1840 |
+
// Foo foo;
|
| 1841 |
+
// ASSERT_TRUE(foo.DoesBar(GetParam()));
|
| 1842 |
+
// }
|
| 1843 |
+
// INSTANTIATE_TEST_SUITE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
|
| 1844 |
+
|
| 1845 |
+
template <typename T>
|
| 1846 |
+
class WithParamInterface {
|
| 1847 |
+
public:
|
| 1848 |
+
typedef T ParamType;
|
| 1849 |
+
virtual ~WithParamInterface() {}
|
| 1850 |
+
|
| 1851 |
+
// The current parameter value. Is also available in the test fixture's
|
| 1852 |
+
// constructor.
|
| 1853 |
+
static const ParamType& GetParam() {
|
| 1854 |
+
GTEST_CHECK_(parameter_ != nullptr)
|
| 1855 |
+
<< "GetParam() can only be called inside a value-parameterized test "
|
| 1856 |
+
<< "-- did you intend to write TEST_P instead of TEST_F?";
|
| 1857 |
+
return *parameter_;
|
| 1858 |
+
}
|
| 1859 |
+
|
| 1860 |
+
private:
|
| 1861 |
+
// Sets parameter value. The caller is responsible for making sure the value
|
| 1862 |
+
// remains alive and unchanged throughout the current test.
|
| 1863 |
+
static void SetParam(const ParamType* parameter) {
|
| 1864 |
+
parameter_ = parameter;
|
| 1865 |
+
}
|
| 1866 |
+
|
| 1867 |
+
// Static value used for accessing parameter during a test lifetime.
|
| 1868 |
+
static const ParamType* parameter_;
|
| 1869 |
+
|
| 1870 |
+
// TestClass must be a subclass of WithParamInterface<T> and Test.
|
| 1871 |
+
template <class TestClass> friend class internal::ParameterizedTestFactory;
|
| 1872 |
+
};
|
| 1873 |
+
|
| 1874 |
+
template <typename T>
|
| 1875 |
+
const T* WithParamInterface<T>::parameter_ = nullptr;
|
| 1876 |
+
|
| 1877 |
+
// Most value-parameterized classes can ignore the existence of
|
| 1878 |
+
// WithParamInterface, and can just inherit from ::testing::TestWithParam.
|
| 1879 |
+
|
| 1880 |
+
template <typename T>
|
| 1881 |
+
class TestWithParam : public Test, public WithParamInterface<T> {
|
| 1882 |
+
};
|
| 1883 |
+
|
| 1884 |
+
// Macros for indicating success/failure in test code.
|
| 1885 |
+
|
| 1886 |
+
// Skips test in runtime.
|
| 1887 |
+
// Skipping test aborts current function.
|
| 1888 |
+
// Skipped tests are neither successful nor failed.
|
| 1889 |
+
#define GTEST_SKIP() GTEST_SKIP_("")
|
| 1890 |
+
|
| 1891 |
+
// ADD_FAILURE unconditionally adds a failure to the current test.
|
| 1892 |
+
// SUCCEED generates a success - it doesn't automatically make the
|
| 1893 |
+
// current test successful, as a test is only successful when it has
|
| 1894 |
+
// no failure.
|
| 1895 |
+
//
|
| 1896 |
+
// EXPECT_* verifies that a certain condition is satisfied. If not,
|
| 1897 |
+
// it behaves like ADD_FAILURE. In particular:
|
| 1898 |
+
//
|
| 1899 |
+
// EXPECT_TRUE verifies that a Boolean condition is true.
|
| 1900 |
+
// EXPECT_FALSE verifies that a Boolean condition is false.
|
| 1901 |
+
//
|
| 1902 |
+
// FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
|
| 1903 |
+
// that they will also abort the current function on failure. People
|
| 1904 |
+
// usually want the fail-fast behavior of FAIL and ASSERT_*, but those
|
| 1905 |
+
// writing data-driven tests often find themselves using ADD_FAILURE
|
| 1906 |
+
// and EXPECT_* more.
|
| 1907 |
+
|
| 1908 |
+
// Generates a nonfatal failure with a generic message.
|
| 1909 |
+
#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
|
| 1910 |
+
|
| 1911 |
+
// Generates a nonfatal failure at the given source file location with
|
| 1912 |
+
// a generic message.
|
| 1913 |
+
#define ADD_FAILURE_AT(file, line) \
|
| 1914 |
+
GTEST_MESSAGE_AT_(file, line, "Failed", \
|
| 1915 |
+
::testing::TestPartResult::kNonFatalFailure)
|
| 1916 |
+
|
| 1917 |
+
// Generates a fatal failure with a generic message.
|
| 1918 |
+
#define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
|
| 1919 |
+
|
| 1920 |
+
// Like GTEST_FAIL(), but at the given source file location.
|
| 1921 |
+
#define GTEST_FAIL_AT(file, line) \
|
| 1922 |
+
GTEST_MESSAGE_AT_(file, line, "Failed", \
|
| 1923 |
+
::testing::TestPartResult::kFatalFailure)
|
| 1924 |
+
|
| 1925 |
+
// Define this macro to 1 to omit the definition of FAIL(), which is a
|
| 1926 |
+
// generic name and clashes with some other libraries.
|
| 1927 |
+
#if !GTEST_DONT_DEFINE_FAIL
|
| 1928 |
+
# define FAIL() GTEST_FAIL()
|
| 1929 |
+
#endif
|
| 1930 |
+
|
| 1931 |
+
// Generates a success with a generic message.
|
| 1932 |
+
#define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
|
| 1933 |
+
|
| 1934 |
+
// Define this macro to 1 to omit the definition of SUCCEED(), which
|
| 1935 |
+
// is a generic name and clashes with some other libraries.
|
| 1936 |
+
#if !GTEST_DONT_DEFINE_SUCCEED
|
| 1937 |
+
# define SUCCEED() GTEST_SUCCEED()
|
| 1938 |
+
#endif
|
| 1939 |
+
|
| 1940 |
+
// Macros for testing exceptions.
|
| 1941 |
+
//
|
| 1942 |
+
// * {ASSERT|EXPECT}_THROW(statement, expected_exception):
|
| 1943 |
+
// Tests that the statement throws the expected exception.
|
| 1944 |
+
// * {ASSERT|EXPECT}_NO_THROW(statement):
|
| 1945 |
+
// Tests that the statement doesn't throw any exception.
|
| 1946 |
+
// * {ASSERT|EXPECT}_ANY_THROW(statement):
|
| 1947 |
+
// Tests that the statement throws an exception.
|
| 1948 |
+
|
| 1949 |
+
#define EXPECT_THROW(statement, expected_exception) \
|
| 1950 |
+
GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
|
| 1951 |
+
#define EXPECT_NO_THROW(statement) \
|
| 1952 |
+
GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
|
| 1953 |
+
#define EXPECT_ANY_THROW(statement) \
|
| 1954 |
+
GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
|
| 1955 |
+
#define ASSERT_THROW(statement, expected_exception) \
|
| 1956 |
+
GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
|
| 1957 |
+
#define ASSERT_NO_THROW(statement) \
|
| 1958 |
+
GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
|
| 1959 |
+
#define ASSERT_ANY_THROW(statement) \
|
| 1960 |
+
GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
|
| 1961 |
+
|
| 1962 |
+
// Boolean assertions. Condition can be either a Boolean expression or an
|
| 1963 |
+
// AssertionResult. For more information on how to use AssertionResult with
|
| 1964 |
+
// these macros see comments on that class.
|
| 1965 |
+
#define GTEST_EXPECT_TRUE(condition) \
|
| 1966 |
+
GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
|
| 1967 |
+
GTEST_NONFATAL_FAILURE_)
|
| 1968 |
+
#define GTEST_EXPECT_FALSE(condition) \
|
| 1969 |
+
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
|
| 1970 |
+
GTEST_NONFATAL_FAILURE_)
|
| 1971 |
+
#define GTEST_ASSERT_TRUE(condition) \
|
| 1972 |
+
GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
|
| 1973 |
+
GTEST_FATAL_FAILURE_)
|
| 1974 |
+
#define GTEST_ASSERT_FALSE(condition) \
|
| 1975 |
+
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
|
| 1976 |
+
GTEST_FATAL_FAILURE_)
|
| 1977 |
+
|
| 1978 |
+
// Define these macros to 1 to omit the definition of the corresponding
|
| 1979 |
+
// EXPECT or ASSERT, which clashes with some users' own code.
|
| 1980 |
+
|
| 1981 |
+
#if !GTEST_DONT_DEFINE_EXPECT_TRUE
|
| 1982 |
+
#define EXPECT_TRUE(condition) GTEST_EXPECT_TRUE(condition)
|
| 1983 |
+
#endif
|
| 1984 |
+
|
| 1985 |
+
#if !GTEST_DONT_DEFINE_EXPECT_FALSE
|
| 1986 |
+
#define EXPECT_FALSE(condition) GTEST_EXPECT_FALSE(condition)
|
| 1987 |
+
#endif
|
| 1988 |
+
|
| 1989 |
+
#if !GTEST_DONT_DEFINE_ASSERT_TRUE
|
| 1990 |
+
#define ASSERT_TRUE(condition) GTEST_ASSERT_TRUE(condition)
|
| 1991 |
+
#endif
|
| 1992 |
+
|
| 1993 |
+
#if !GTEST_DONT_DEFINE_ASSERT_FALSE
|
| 1994 |
+
#define ASSERT_FALSE(condition) GTEST_ASSERT_FALSE(condition)
|
| 1995 |
+
#endif
|
| 1996 |
+
|
| 1997 |
+
// Macros for testing equalities and inequalities.
|
| 1998 |
+
//
|
| 1999 |
+
// * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2
|
| 2000 |
+
// * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
|
| 2001 |
+
// * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
|
| 2002 |
+
// * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
|
| 2003 |
+
// * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
|
| 2004 |
+
// * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
|
| 2005 |
+
//
|
| 2006 |
+
// When they are not, Google Test prints both the tested expressions and
|
| 2007 |
+
// their actual values. The values must be compatible built-in types,
|
| 2008 |
+
// or you will get a compiler error. By "compatible" we mean that the
|
| 2009 |
+
// values can be compared by the respective operator.
|
| 2010 |
+
//
|
| 2011 |
+
// Note:
|
| 2012 |
+
//
|
| 2013 |
+
// 1. It is possible to make a user-defined type work with
|
| 2014 |
+
// {ASSERT|EXPECT}_??(), but that requires overloading the
|
| 2015 |
+
// comparison operators and is thus discouraged by the Google C++
|
| 2016 |
+
// Usage Guide. Therefore, you are advised to use the
|
| 2017 |
+
// {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
|
| 2018 |
+
// equal.
|
| 2019 |
+
//
|
| 2020 |
+
// 2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
|
| 2021 |
+
// pointers (in particular, C strings). Therefore, if you use it
|
| 2022 |
+
// with two C strings, you are testing how their locations in memory
|
| 2023 |
+
// are related, not how their content is related. To compare two C
|
| 2024 |
+
// strings by content, use {ASSERT|EXPECT}_STR*().
|
| 2025 |
+
//
|
| 2026 |
+
// 3. {ASSERT|EXPECT}_EQ(v1, v2) is preferred to
|
| 2027 |
+
// {ASSERT|EXPECT}_TRUE(v1 == v2), as the former tells you
|
| 2028 |
+
// what the actual value is when it fails, and similarly for the
|
| 2029 |
+
// other comparisons.
|
| 2030 |
+
//
|
| 2031 |
+
// 4. Do not depend on the order in which {ASSERT|EXPECT}_??()
|
| 2032 |
+
// evaluate their arguments, which is undefined.
|
| 2033 |
+
//
|
| 2034 |
+
// 5. These macros evaluate their arguments exactly once.
|
| 2035 |
+
//
|
| 2036 |
+
// Examples:
|
| 2037 |
+
//
|
| 2038 |
+
// EXPECT_NE(Foo(), 5);
|
| 2039 |
+
// EXPECT_EQ(a_pointer, NULL);
|
| 2040 |
+
// ASSERT_LT(i, array_size);
|
| 2041 |
+
// ASSERT_GT(records.size(), 0) << "There is no record left.";
|
| 2042 |
+
|
| 2043 |
+
#define EXPECT_EQ(val1, val2) \
|
| 2044 |
+
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
|
| 2045 |
+
#define EXPECT_NE(val1, val2) \
|
| 2046 |
+
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
|
| 2047 |
+
#define EXPECT_LE(val1, val2) \
|
| 2048 |
+
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
|
| 2049 |
+
#define EXPECT_LT(val1, val2) \
|
| 2050 |
+
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
|
| 2051 |
+
#define EXPECT_GE(val1, val2) \
|
| 2052 |
+
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
|
| 2053 |
+
#define EXPECT_GT(val1, val2) \
|
| 2054 |
+
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
|
| 2055 |
+
|
| 2056 |
+
#define GTEST_ASSERT_EQ(val1, val2) \
|
| 2057 |
+
ASSERT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
|
| 2058 |
+
#define GTEST_ASSERT_NE(val1, val2) \
|
| 2059 |
+
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
|
| 2060 |
+
#define GTEST_ASSERT_LE(val1, val2) \
|
| 2061 |
+
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
|
| 2062 |
+
#define GTEST_ASSERT_LT(val1, val2) \
|
| 2063 |
+
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
|
| 2064 |
+
#define GTEST_ASSERT_GE(val1, val2) \
|
| 2065 |
+
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
|
| 2066 |
+
#define GTEST_ASSERT_GT(val1, val2) \
|
| 2067 |
+
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
|
| 2068 |
+
|
| 2069 |
+
// Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
|
| 2070 |
+
// ASSERT_XY(), which clashes with some users' own code.
|
| 2071 |
+
|
| 2072 |
+
#if !GTEST_DONT_DEFINE_ASSERT_EQ
|
| 2073 |
+
# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
|
| 2074 |
+
#endif
|
| 2075 |
+
|
| 2076 |
+
#if !GTEST_DONT_DEFINE_ASSERT_NE
|
| 2077 |
+
# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
|
| 2078 |
+
#endif
|
| 2079 |
+
|
| 2080 |
+
#if !GTEST_DONT_DEFINE_ASSERT_LE
|
| 2081 |
+
# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
|
| 2082 |
+
#endif
|
| 2083 |
+
|
| 2084 |
+
#if !GTEST_DONT_DEFINE_ASSERT_LT
|
| 2085 |
+
# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
|
| 2086 |
+
#endif
|
| 2087 |
+
|
| 2088 |
+
#if !GTEST_DONT_DEFINE_ASSERT_GE
|
| 2089 |
+
# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
|
| 2090 |
+
#endif
|
| 2091 |
+
|
| 2092 |
+
#if !GTEST_DONT_DEFINE_ASSERT_GT
|
| 2093 |
+
# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
|
| 2094 |
+
#endif
|
| 2095 |
+
|
| 2096 |
+
// C-string Comparisons. All tests treat NULL and any non-NULL string
|
| 2097 |
+
// as different. Two NULLs are equal.
|
| 2098 |
+
//
|
| 2099 |
+
// * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2
|
| 2100 |
+
// * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2
|
| 2101 |
+
// * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
|
| 2102 |
+
// * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
|
| 2103 |
+
//
|
| 2104 |
+
// For wide or narrow string objects, you can use the
|
| 2105 |
+
// {ASSERT|EXPECT}_??() macros.
|
| 2106 |
+
//
|
| 2107 |
+
// Don't depend on the order in which the arguments are evaluated,
|
| 2108 |
+
// which is undefined.
|
| 2109 |
+
//
|
| 2110 |
+
// These macros evaluate their arguments exactly once.
|
| 2111 |
+
|
| 2112 |
+
#define EXPECT_STREQ(s1, s2) \
|
| 2113 |
+
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
|
| 2114 |
+
#define EXPECT_STRNE(s1, s2) \
|
| 2115 |
+
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
|
| 2116 |
+
#define EXPECT_STRCASEEQ(s1, s2) \
|
| 2117 |
+
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
|
| 2118 |
+
#define EXPECT_STRCASENE(s1, s2)\
|
| 2119 |
+
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
|
| 2120 |
+
|
| 2121 |
+
#define ASSERT_STREQ(s1, s2) \
|
| 2122 |
+
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
|
| 2123 |
+
#define ASSERT_STRNE(s1, s2) \
|
| 2124 |
+
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
|
| 2125 |
+
#define ASSERT_STRCASEEQ(s1, s2) \
|
| 2126 |
+
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
|
| 2127 |
+
#define ASSERT_STRCASENE(s1, s2)\
|
| 2128 |
+
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
|
| 2129 |
+
|
| 2130 |
+
// Macros for comparing floating-point numbers.
|
| 2131 |
+
//
|
| 2132 |
+
// * {ASSERT|EXPECT}_FLOAT_EQ(val1, val2):
|
| 2133 |
+
// Tests that two float values are almost equal.
|
| 2134 |
+
// * {ASSERT|EXPECT}_DOUBLE_EQ(val1, val2):
|
| 2135 |
+
// Tests that two double values are almost equal.
|
| 2136 |
+
// * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
|
| 2137 |
+
// Tests that v1 and v2 are within the given distance to each other.
|
| 2138 |
+
//
|
| 2139 |
+
// Google Test uses ULP-based comparison to automatically pick a default
|
| 2140 |
+
// error bound that is appropriate for the operands. See the
|
| 2141 |
+
// FloatingPoint template class in gtest-internal.h if you are
|
| 2142 |
+
// interested in the implementation details.
|
| 2143 |
+
|
| 2144 |
+
#define EXPECT_FLOAT_EQ(val1, val2)\
|
| 2145 |
+
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
|
| 2146 |
+
val1, val2)
|
| 2147 |
+
|
| 2148 |
+
#define EXPECT_DOUBLE_EQ(val1, val2)\
|
| 2149 |
+
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
|
| 2150 |
+
val1, val2)
|
| 2151 |
+
|
| 2152 |
+
#define ASSERT_FLOAT_EQ(val1, val2)\
|
| 2153 |
+
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
|
| 2154 |
+
val1, val2)
|
| 2155 |
+
|
| 2156 |
+
#define ASSERT_DOUBLE_EQ(val1, val2)\
|
| 2157 |
+
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
|
| 2158 |
+
val1, val2)
|
| 2159 |
+
|
| 2160 |
+
#define EXPECT_NEAR(val1, val2, abs_error)\
|
| 2161 |
+
EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
|
| 2162 |
+
val1, val2, abs_error)
|
| 2163 |
+
|
| 2164 |
+
#define ASSERT_NEAR(val1, val2, abs_error)\
|
| 2165 |
+
ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
|
| 2166 |
+
val1, val2, abs_error)
|
| 2167 |
+
|
| 2168 |
+
// These predicate format functions work on floating-point values, and
|
| 2169 |
+
// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
|
| 2170 |
+
//
|
| 2171 |
+
// EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
|
| 2172 |
+
|
| 2173 |
+
// Asserts that val1 is less than, or almost equal to, val2. Fails
|
| 2174 |
+
// otherwise. In particular, it fails if either val1 or val2 is NaN.
|
| 2175 |
+
GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
|
| 2176 |
+
float val1, float val2);
|
| 2177 |
+
GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
| 2178 |
+
double val1, double val2);
|
| 2179 |
+
|
| 2180 |
+
|
| 2181 |
+
#if GTEST_OS_WINDOWS
|
| 2182 |
+
|
| 2183 |
+
// Macros that test for HRESULT failure and success, these are only useful
|
| 2184 |
+
// on Windows, and rely on Windows SDK macros and APIs to compile.
|
| 2185 |
+
//
|
| 2186 |
+
// * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
|
| 2187 |
+
//
|
| 2188 |
+
// When expr unexpectedly fails or succeeds, Google Test prints the
|
| 2189 |
+
// expected result and the actual result with both a human-readable
|
| 2190 |
+
// string representation of the error, if available, as well as the
|
| 2191 |
+
// hex result code.
|
| 2192 |
+
# define EXPECT_HRESULT_SUCCEEDED(expr) \
|
| 2193 |
+
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
| 2194 |
+
|
| 2195 |
+
# define ASSERT_HRESULT_SUCCEEDED(expr) \
|
| 2196 |
+
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
| 2197 |
+
|
| 2198 |
+
# define EXPECT_HRESULT_FAILED(expr) \
|
| 2199 |
+
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
| 2200 |
+
|
| 2201 |
+
# define ASSERT_HRESULT_FAILED(expr) \
|
| 2202 |
+
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
| 2203 |
+
|
| 2204 |
+
#endif // GTEST_OS_WINDOWS
|
| 2205 |
+
|
| 2206 |
+
// Macros that execute statement and check that it doesn't generate new fatal
|
| 2207 |
+
// failures in the current thread.
|
| 2208 |
+
//
|
| 2209 |
+
// * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
|
| 2210 |
+
//
|
| 2211 |
+
// Examples:
|
| 2212 |
+
//
|
| 2213 |
+
// EXPECT_NO_FATAL_FAILURE(Process());
|
| 2214 |
+
// ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
|
| 2215 |
+
//
|
| 2216 |
+
#define ASSERT_NO_FATAL_FAILURE(statement) \
|
| 2217 |
+
GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
|
| 2218 |
+
#define EXPECT_NO_FATAL_FAILURE(statement) \
|
| 2219 |
+
GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
|
| 2220 |
+
|
| 2221 |
+
// Causes a trace (including the given source file path and line number,
|
| 2222 |
+
// and the given message) to be included in every test failure message generated
|
| 2223 |
+
// by code in the scope of the lifetime of an instance of this class. The effect
|
| 2224 |
+
// is undone with the destruction of the instance.
|
| 2225 |
+
//
|
| 2226 |
+
// The message argument can be anything streamable to std::ostream.
|
| 2227 |
+
//
|
| 2228 |
+
// Example:
|
| 2229 |
+
// testing::ScopedTrace trace("file.cc", 123, "message");
|
| 2230 |
+
//
|
| 2231 |
+
class GTEST_API_ ScopedTrace {
|
| 2232 |
+
public:
|
| 2233 |
+
// The c'tor pushes the given source file location and message onto
|
| 2234 |
+
// a trace stack maintained by Google Test.
|
| 2235 |
+
|
| 2236 |
+
// Template version. Uses Message() to convert the values into strings.
|
| 2237 |
+
// Slow, but flexible.
|
| 2238 |
+
template <typename T>
|
| 2239 |
+
ScopedTrace(const char* file, int line, const T& message) {
|
| 2240 |
+
PushTrace(file, line, (Message() << message).GetString());
|
| 2241 |
+
}
|
| 2242 |
+
|
| 2243 |
+
// Optimize for some known types.
|
| 2244 |
+
ScopedTrace(const char* file, int line, const char* message) {
|
| 2245 |
+
PushTrace(file, line, message ? message : "(null)");
|
| 2246 |
+
}
|
| 2247 |
+
|
| 2248 |
+
ScopedTrace(const char* file, int line, const std::string& message) {
|
| 2249 |
+
PushTrace(file, line, message);
|
| 2250 |
+
}
|
| 2251 |
+
|
| 2252 |
+
// The d'tor pops the info pushed by the c'tor.
|
| 2253 |
+
//
|
| 2254 |
+
// Note that the d'tor is not virtual in order to be efficient.
|
| 2255 |
+
// Don't inherit from ScopedTrace!
|
| 2256 |
+
~ScopedTrace();
|
| 2257 |
+
|
| 2258 |
+
private:
|
| 2259 |
+
void PushTrace(const char* file, int line, std::string message);
|
| 2260 |
+
|
| 2261 |
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
|
| 2262 |
+
} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
|
| 2263 |
+
// c'tor and d'tor. Therefore it doesn't
|
| 2264 |
+
// need to be used otherwise.
|
| 2265 |
+
|
| 2266 |
+
// Causes a trace (including the source file path, the current line
|
| 2267 |
+
// number, and the given message) to be included in every test failure
|
| 2268 |
+
// message generated by code in the current scope. The effect is
|
| 2269 |
+
// undone when the control leaves the current scope.
|
| 2270 |
+
//
|
| 2271 |
+
// The message argument can be anything streamable to std::ostream.
|
| 2272 |
+
//
|
| 2273 |
+
// In the implementation, we include the current line number as part
|
| 2274 |
+
// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
|
| 2275 |
+
// to appear in the same block - as long as they are on different
|
| 2276 |
+
// lines.
|
| 2277 |
+
//
|
| 2278 |
+
// Assuming that each thread maintains its own stack of traces.
|
| 2279 |
+
// Therefore, a SCOPED_TRACE() would (correctly) only affect the
|
| 2280 |
+
// assertions in its own thread.
|
| 2281 |
+
#define SCOPED_TRACE(message) \
|
| 2282 |
+
::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
|
| 2283 |
+
__FILE__, __LINE__, (message))
|
| 2284 |
+
|
| 2285 |
+
// Compile-time assertion for type equality.
|
| 2286 |
+
// StaticAssertTypeEq<type1, type2>() compiles if and only if type1 and type2
|
| 2287 |
+
// are the same type. The value it returns is not interesting.
|
| 2288 |
+
//
|
| 2289 |
+
// Instead of making StaticAssertTypeEq a class template, we make it a
|
| 2290 |
+
// function template that invokes a helper class template. This
|
| 2291 |
+
// prevents a user from misusing StaticAssertTypeEq<T1, T2> by
|
| 2292 |
+
// defining objects of that type.
|
| 2293 |
+
//
|
| 2294 |
+
// CAVEAT:
|
| 2295 |
+
//
|
| 2296 |
+
// When used inside a method of a class template,
|
| 2297 |
+
// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
|
| 2298 |
+
// instantiated. For example, given:
|
| 2299 |
+
//
|
| 2300 |
+
// template <typename T> class Foo {
|
| 2301 |
+
// public:
|
| 2302 |
+
// void Bar() { testing::StaticAssertTypeEq<int, T>(); }
|
| 2303 |
+
// };
|
| 2304 |
+
//
|
| 2305 |
+
// the code:
|
| 2306 |
+
//
|
| 2307 |
+
// void Test1() { Foo<bool> foo; }
|
| 2308 |
+
//
|
| 2309 |
+
// will NOT generate a compiler error, as Foo<bool>::Bar() is never
|
| 2310 |
+
// actually instantiated. Instead, you need:
|
| 2311 |
+
//
|
| 2312 |
+
// void Test2() { Foo<bool> foo; foo.Bar(); }
|
| 2313 |
+
//
|
| 2314 |
+
// to cause a compiler error.
|
| 2315 |
+
template <typename T1, typename T2>
|
| 2316 |
+
constexpr bool StaticAssertTypeEq() noexcept {
|
| 2317 |
+
static_assert(std::is_same<T1, T2>::value, "T1 and T2 are not the same type");
|
| 2318 |
+
return true;
|
| 2319 |
+
}
|
| 2320 |
+
|
| 2321 |
+
// Defines a test.
|
| 2322 |
+
//
|
| 2323 |
+
// The first parameter is the name of the test suite, and the second
|
| 2324 |
+
// parameter is the name of the test within the test suite.
|
| 2325 |
+
//
|
| 2326 |
+
// The convention is to end the test suite name with "Test". For
|
| 2327 |
+
// example, a test suite for the Foo class can be named FooTest.
|
| 2328 |
+
//
|
| 2329 |
+
// Test code should appear between braces after an invocation of
|
| 2330 |
+
// this macro. Example:
|
| 2331 |
+
//
|
| 2332 |
+
// TEST(FooTest, InitializesCorrectly) {
|
| 2333 |
+
// Foo foo;
|
| 2334 |
+
// EXPECT_TRUE(foo.StatusIsOK());
|
| 2335 |
+
// }
|
| 2336 |
+
|
| 2337 |
+
// Note that we call GetTestTypeId() instead of GetTypeId<
|
| 2338 |
+
// ::testing::Test>() here to get the type ID of testing::Test. This
|
| 2339 |
+
// is to work around a suspected linker bug when using Google Test as
|
| 2340 |
+
// a framework on Mac OS X. The bug causes GetTypeId<
|
| 2341 |
+
// ::testing::Test>() to return different values depending on whether
|
| 2342 |
+
// the call is from the Google Test framework itself or from user test
|
| 2343 |
+
// code. GetTestTypeId() is guaranteed to always return the same
|
| 2344 |
+
// value, as it always calls GetTypeId<>() from the Google Test
|
| 2345 |
+
// framework.
|
| 2346 |
+
#define GTEST_TEST(test_suite_name, test_name) \
|
| 2347 |
+
GTEST_TEST_(test_suite_name, test_name, ::testing::Test, \
|
| 2348 |
+
::testing::internal::GetTestTypeId())
|
| 2349 |
+
|
| 2350 |
+
// Define this macro to 1 to omit the definition of TEST(), which
|
| 2351 |
+
// is a generic name and clashes with some other libraries.
|
| 2352 |
+
#if !GTEST_DONT_DEFINE_TEST
|
| 2353 |
+
#define TEST(test_suite_name, test_name) GTEST_TEST(test_suite_name, test_name)
|
| 2354 |
+
#endif
|
| 2355 |
+
|
| 2356 |
+
// Defines a test that uses a test fixture.
|
| 2357 |
+
//
|
| 2358 |
+
// The first parameter is the name of the test fixture class, which
|
| 2359 |
+
// also doubles as the test suite name. The second parameter is the
|
| 2360 |
+
// name of the test within the test suite.
|
| 2361 |
+
//
|
| 2362 |
+
// A test fixture class must be declared earlier. The user should put
|
| 2363 |
+
// the test code between braces after using this macro. Example:
|
| 2364 |
+
//
|
| 2365 |
+
// class FooTest : public testing::Test {
|
| 2366 |
+
// protected:
|
| 2367 |
+
// void SetUp() override { b_.AddElement(3); }
|
| 2368 |
+
//
|
| 2369 |
+
// Foo a_;
|
| 2370 |
+
// Foo b_;
|
| 2371 |
+
// };
|
| 2372 |
+
//
|
| 2373 |
+
// TEST_F(FooTest, InitializesCorrectly) {
|
| 2374 |
+
// EXPECT_TRUE(a_.StatusIsOK());
|
| 2375 |
+
// }
|
| 2376 |
+
//
|
| 2377 |
+
// TEST_F(FooTest, ReturnsElementCountCorrectly) {
|
| 2378 |
+
// EXPECT_EQ(a_.size(), 0);
|
| 2379 |
+
// EXPECT_EQ(b_.size(), 1);
|
| 2380 |
+
// }
|
| 2381 |
+
//
|
| 2382 |
+
// GOOGLETEST_CM0011 DO NOT DELETE
|
| 2383 |
+
#if !GTEST_DONT_DEFINE_TEST
|
| 2384 |
+
#define TEST_F(test_fixture, test_name)\
|
| 2385 |
+
GTEST_TEST_(test_fixture, test_name, test_fixture, \
|
| 2386 |
+
::testing::internal::GetTypeId<test_fixture>())
|
| 2387 |
+
#endif // !GTEST_DONT_DEFINE_TEST
|
| 2388 |
+
|
| 2389 |
+
// Returns a path to temporary directory.
|
| 2390 |
+
// Tries to determine an appropriate directory for the platform.
|
| 2391 |
+
GTEST_API_ std::string TempDir();
|
| 2392 |
+
|
| 2393 |
+
#ifdef _MSC_VER
|
| 2394 |
+
# pragma warning(pop)
|
| 2395 |
+
#endif
|
| 2396 |
+
|
| 2397 |
+
// Dynamically registers a test with the framework.
|
| 2398 |
+
//
|
| 2399 |
+
// This is an advanced API only to be used when the `TEST` macros are
|
| 2400 |
+
// insufficient. The macros should be preferred when possible, as they avoid
|
| 2401 |
+
// most of the complexity of calling this function.
|
| 2402 |
+
//
|
| 2403 |
+
// The `factory` argument is a factory callable (move-constructible) object or
|
| 2404 |
+
// function pointer that creates a new instance of the Test object. It
|
| 2405 |
+
// handles ownership to the caller. The signature of the callable is
|
| 2406 |
+
// `Fixture*()`, where `Fixture` is the test fixture class for the test. All
|
| 2407 |
+
// tests registered with the same `test_suite_name` must return the same
|
| 2408 |
+
// fixture type. This is checked at runtime.
|
| 2409 |
+
//
|
| 2410 |
+
// The framework will infer the fixture class from the factory and will call
|
| 2411 |
+
// the `SetUpTestSuite` and `TearDownTestSuite` for it.
|
| 2412 |
+
//
|
| 2413 |
+
// Must be called before `RUN_ALL_TESTS()` is invoked, otherwise behavior is
|
| 2414 |
+
// undefined.
|
| 2415 |
+
//
|
| 2416 |
+
// Use case example:
|
| 2417 |
+
//
|
| 2418 |
+
// class MyFixture : public ::testing::Test {
|
| 2419 |
+
// public:
|
| 2420 |
+
// // All of these optional, just like in regular macro usage.
|
| 2421 |
+
// static void SetUpTestSuite() { ... }
|
| 2422 |
+
// static void TearDownTestSuite() { ... }
|
| 2423 |
+
// void SetUp() override { ... }
|
| 2424 |
+
// void TearDown() override { ... }
|
| 2425 |
+
// };
|
| 2426 |
+
//
|
| 2427 |
+
// class MyTest : public MyFixture {
|
| 2428 |
+
// public:
|
| 2429 |
+
// explicit MyTest(int data) : data_(data) {}
|
| 2430 |
+
// void TestBody() override { ... }
|
| 2431 |
+
//
|
| 2432 |
+
// private:
|
| 2433 |
+
// int data_;
|
| 2434 |
+
// };
|
| 2435 |
+
//
|
| 2436 |
+
// void RegisterMyTests(const std::vector<int>& values) {
|
| 2437 |
+
// for (int v : values) {
|
| 2438 |
+
// ::testing::RegisterTest(
|
| 2439 |
+
// "MyFixture", ("Test" + std::to_string(v)).c_str(), nullptr,
|
| 2440 |
+
// std::to_string(v).c_str(),
|
| 2441 |
+
// __FILE__, __LINE__,
|
| 2442 |
+
// // Important to use the fixture type as the return type here.
|
| 2443 |
+
// [=]() -> MyFixture* { return new MyTest(v); });
|
| 2444 |
+
// }
|
| 2445 |
+
// }
|
| 2446 |
+
// ...
|
| 2447 |
+
// int main(int argc, char** argv) {
|
| 2448 |
+
// std::vector<int> values_to_test = LoadValuesFromConfig();
|
| 2449 |
+
// RegisterMyTests(values_to_test);
|
| 2450 |
+
// ...
|
| 2451 |
+
// return RUN_ALL_TESTS();
|
| 2452 |
+
// }
|
| 2453 |
+
//
|
| 2454 |
+
template <int&... ExplicitParameterBarrier, typename Factory>
|
| 2455 |
+
TestInfo* RegisterTest(const char* test_suite_name, const char* test_name,
|
| 2456 |
+
const char* type_param, const char* value_param,
|
| 2457 |
+
const char* file, int line, Factory factory) {
|
| 2458 |
+
using TestT = typename std::remove_pointer<decltype(factory())>::type;
|
| 2459 |
+
|
| 2460 |
+
class FactoryImpl : public internal::TestFactoryBase {
|
| 2461 |
+
public:
|
| 2462 |
+
explicit FactoryImpl(Factory f) : factory_(std::move(f)) {}
|
| 2463 |
+
Test* CreateTest() override { return factory_(); }
|
| 2464 |
+
|
| 2465 |
+
private:
|
| 2466 |
+
Factory factory_;
|
| 2467 |
+
};
|
| 2468 |
+
|
| 2469 |
+
return internal::MakeAndRegisterTestInfo(
|
| 2470 |
+
test_suite_name, test_name, type_param, value_param,
|
| 2471 |
+
internal::CodeLocation(file, line), internal::GetTypeId<TestT>(),
|
| 2472 |
+
internal::SuiteApiResolver<TestT>::GetSetUpCaseOrSuite(file, line),
|
| 2473 |
+
internal::SuiteApiResolver<TestT>::GetTearDownCaseOrSuite(file, line),
|
| 2474 |
+
new FactoryImpl{std::move(factory)});
|
| 2475 |
+
}
|
| 2476 |
+
|
| 2477 |
+
} // namespace testing
|
| 2478 |
+
|
| 2479 |
+
// Use this function in main() to run all tests. It returns 0 if all
|
| 2480 |
+
// tests are successful, or 1 otherwise.
|
| 2481 |
+
//
|
| 2482 |
+
// RUN_ALL_TESTS() should be invoked after the command line has been
|
| 2483 |
+
// parsed by InitGoogleTest().
|
| 2484 |
+
//
|
| 2485 |
+
// This function was formerly a macro; thus, it is in the global
|
| 2486 |
+
// namespace and has an all-caps name.
|
| 2487 |
+
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
|
| 2488 |
+
|
| 2489 |
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2006, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
// This file is AUTOMATICALLY GENERATED on 01/02/2019 by command
|
| 31 |
+
// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
|
| 32 |
+
//
|
| 33 |
+
// Implements a family of generic predicate assertion macros.
|
| 34 |
+
// GOOGLETEST_CM0001 DO NOT DELETE
|
| 35 |
+
|
| 36 |
+
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
|
| 37 |
+
#define GOOGLETEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
|
| 38 |
+
|
| 39 |
+
#include "gtest/gtest.h"
|
| 40 |
+
|
| 41 |
+
namespace testing {
|
| 42 |
+
|
| 43 |
+
// This header implements a family of generic predicate assertion
|
| 44 |
+
// macros:
|
| 45 |
+
//
|
| 46 |
+
// ASSERT_PRED_FORMAT1(pred_format, v1)
|
| 47 |
+
// ASSERT_PRED_FORMAT2(pred_format, v1, v2)
|
| 48 |
+
// ...
|
| 49 |
+
//
|
| 50 |
+
// where pred_format is a function or functor that takes n (in the
|
| 51 |
+
// case of ASSERT_PRED_FORMATn) values and their source expression
|
| 52 |
+
// text, and returns a testing::AssertionResult. See the definition
|
| 53 |
+
// of ASSERT_EQ in gtest.h for an example.
|
| 54 |
+
//
|
| 55 |
+
// If you don't care about formatting, you can use the more
|
| 56 |
+
// restrictive version:
|
| 57 |
+
//
|
| 58 |
+
// ASSERT_PRED1(pred, v1)
|
| 59 |
+
// ASSERT_PRED2(pred, v1, v2)
|
| 60 |
+
// ...
|
| 61 |
+
//
|
| 62 |
+
// where pred is an n-ary function or functor that returns bool,
|
| 63 |
+
// and the values v1, v2, ..., must support the << operator for
|
| 64 |
+
// streaming to std::ostream.
|
| 65 |
+
//
|
| 66 |
+
// We also define the EXPECT_* variations.
|
| 67 |
+
//
|
| 68 |
+
// For now we only support predicates whose arity is at most 5.
|
| 69 |
+
// Please email googletestframework@googlegroups.com if you need
|
| 70 |
+
// support for higher arities.
|
| 71 |
+
|
| 72 |
+
// GTEST_ASSERT_ is the basic statement to which all of the assertions
|
| 73 |
+
// in this file reduce. Don't use this in your code.
|
| 74 |
+
|
| 75 |
+
#define GTEST_ASSERT_(expression, on_failure) \
|
| 76 |
+
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
| 77 |
+
if (const ::testing::AssertionResult gtest_ar = (expression)) \
|
| 78 |
+
; \
|
| 79 |
+
else \
|
| 80 |
+
on_failure(gtest_ar.failure_message())
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
// Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use
|
| 84 |
+
// this in your code.
|
| 85 |
+
template <typename Pred,
|
| 86 |
+
typename T1>
|
| 87 |
+
AssertionResult AssertPred1Helper(const char* pred_text,
|
| 88 |
+
const char* e1,
|
| 89 |
+
Pred pred,
|
| 90 |
+
const T1& v1) {
|
| 91 |
+
if (pred(v1)) return AssertionSuccess();
|
| 92 |
+
|
| 93 |
+
return AssertionFailure()
|
| 94 |
+
<< pred_text << "(" << e1 << ") evaluates to false, where"
|
| 95 |
+
<< "\n"
|
| 96 |
+
<< e1 << " evaluates to " << ::testing::PrintToString(v1);
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
|
| 100 |
+
// Don't use this in your code.
|
| 101 |
+
#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
|
| 102 |
+
GTEST_ASSERT_(pred_format(#v1, v1), \
|
| 103 |
+
on_failure)
|
| 104 |
+
|
| 105 |
+
// Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use
|
| 106 |
+
// this in your code.
|
| 107 |
+
#define GTEST_PRED1_(pred, v1, on_failure)\
|
| 108 |
+
GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
|
| 109 |
+
#v1, \
|
| 110 |
+
pred, \
|
| 111 |
+
v1), on_failure)
|
| 112 |
+
|
| 113 |
+
// Unary predicate assertion macros.
|
| 114 |
+
#define EXPECT_PRED_FORMAT1(pred_format, v1) \
|
| 115 |
+
GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
|
| 116 |
+
#define EXPECT_PRED1(pred, v1) \
|
| 117 |
+
GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
|
| 118 |
+
#define ASSERT_PRED_FORMAT1(pred_format, v1) \
|
| 119 |
+
GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
|
| 120 |
+
#define ASSERT_PRED1(pred, v1) \
|
| 121 |
+
GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
// Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use
|
| 126 |
+
// this in your code.
|
| 127 |
+
template <typename Pred,
|
| 128 |
+
typename T1,
|
| 129 |
+
typename T2>
|
| 130 |
+
AssertionResult AssertPred2Helper(const char* pred_text,
|
| 131 |
+
const char* e1,
|
| 132 |
+
const char* e2,
|
| 133 |
+
Pred pred,
|
| 134 |
+
const T1& v1,
|
| 135 |
+
const T2& v2) {
|
| 136 |
+
if (pred(v1, v2)) return AssertionSuccess();
|
| 137 |
+
|
| 138 |
+
return AssertionFailure()
|
| 139 |
+
<< pred_text << "(" << e1 << ", " << e2
|
| 140 |
+
<< ") evaluates to false, where"
|
| 141 |
+
<< "\n"
|
| 142 |
+
<< e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
|
| 143 |
+
<< e2 << " evaluates to " << ::testing::PrintToString(v2);
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
|
| 147 |
+
// Don't use this in your code.
|
| 148 |
+
#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
|
| 149 |
+
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
|
| 150 |
+
on_failure)
|
| 151 |
+
|
| 152 |
+
// Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use
|
| 153 |
+
// this in your code.
|
| 154 |
+
#define GTEST_PRED2_(pred, v1, v2, on_failure)\
|
| 155 |
+
GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
|
| 156 |
+
#v1, \
|
| 157 |
+
#v2, \
|
| 158 |
+
pred, \
|
| 159 |
+
v1, \
|
| 160 |
+
v2), on_failure)
|
| 161 |
+
|
| 162 |
+
// Binary predicate assertion macros.
|
| 163 |
+
#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
|
| 164 |
+
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
|
| 165 |
+
#define EXPECT_PRED2(pred, v1, v2) \
|
| 166 |
+
GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
|
| 167 |
+
#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
|
| 168 |
+
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
|
| 169 |
+
#define ASSERT_PRED2(pred, v1, v2) \
|
| 170 |
+
GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
// Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use
|
| 175 |
+
// this in your code.
|
| 176 |
+
template <typename Pred,
|
| 177 |
+
typename T1,
|
| 178 |
+
typename T2,
|
| 179 |
+
typename T3>
|
| 180 |
+
AssertionResult AssertPred3Helper(const char* pred_text,
|
| 181 |
+
const char* e1,
|
| 182 |
+
const char* e2,
|
| 183 |
+
const char* e3,
|
| 184 |
+
Pred pred,
|
| 185 |
+
const T1& v1,
|
| 186 |
+
const T2& v2,
|
| 187 |
+
const T3& v3) {
|
| 188 |
+
if (pred(v1, v2, v3)) return AssertionSuccess();
|
| 189 |
+
|
| 190 |
+
return AssertionFailure()
|
| 191 |
+
<< pred_text << "(" << e1 << ", " << e2 << ", " << e3
|
| 192 |
+
<< ") evaluates to false, where"
|
| 193 |
+
<< "\n"
|
| 194 |
+
<< e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
|
| 195 |
+
<< e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
|
| 196 |
+
<< e3 << " evaluates to " << ::testing::PrintToString(v3);
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
|
| 200 |
+
// Don't use this in your code.
|
| 201 |
+
#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
|
| 202 |
+
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
|
| 203 |
+
on_failure)
|
| 204 |
+
|
| 205 |
+
// Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use
|
| 206 |
+
// this in your code.
|
| 207 |
+
#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
|
| 208 |
+
GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
|
| 209 |
+
#v1, \
|
| 210 |
+
#v2, \
|
| 211 |
+
#v3, \
|
| 212 |
+
pred, \
|
| 213 |
+
v1, \
|
| 214 |
+
v2, \
|
| 215 |
+
v3), on_failure)
|
| 216 |
+
|
| 217 |
+
// Ternary predicate assertion macros.
|
| 218 |
+
#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
|
| 219 |
+
GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
|
| 220 |
+
#define EXPECT_PRED3(pred, v1, v2, v3) \
|
| 221 |
+
GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
|
| 222 |
+
#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
|
| 223 |
+
GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
|
| 224 |
+
#define ASSERT_PRED3(pred, v1, v2, v3) \
|
| 225 |
+
GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
// Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use
|
| 230 |
+
// this in your code.
|
| 231 |
+
template <typename Pred,
|
| 232 |
+
typename T1,
|
| 233 |
+
typename T2,
|
| 234 |
+
typename T3,
|
| 235 |
+
typename T4>
|
| 236 |
+
AssertionResult AssertPred4Helper(const char* pred_text,
|
| 237 |
+
const char* e1,
|
| 238 |
+
const char* e2,
|
| 239 |
+
const char* e3,
|
| 240 |
+
const char* e4,
|
| 241 |
+
Pred pred,
|
| 242 |
+
const T1& v1,
|
| 243 |
+
const T2& v2,
|
| 244 |
+
const T3& v3,
|
| 245 |
+
const T4& v4) {
|
| 246 |
+
if (pred(v1, v2, v3, v4)) return AssertionSuccess();
|
| 247 |
+
|
| 248 |
+
return AssertionFailure()
|
| 249 |
+
<< pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4
|
| 250 |
+
<< ") evaluates to false, where"
|
| 251 |
+
<< "\n"
|
| 252 |
+
<< e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
|
| 253 |
+
<< e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
|
| 254 |
+
<< e3 << " evaluates to " << ::testing::PrintToString(v3) << "\n"
|
| 255 |
+
<< e4 << " evaluates to " << ::testing::PrintToString(v4);
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
|
| 259 |
+
// Don't use this in your code.
|
| 260 |
+
#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
|
| 261 |
+
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
|
| 262 |
+
on_failure)
|
| 263 |
+
|
| 264 |
+
// Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use
|
| 265 |
+
// this in your code.
|
| 266 |
+
#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
|
| 267 |
+
GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
|
| 268 |
+
#v1, \
|
| 269 |
+
#v2, \
|
| 270 |
+
#v3, \
|
| 271 |
+
#v4, \
|
| 272 |
+
pred, \
|
| 273 |
+
v1, \
|
| 274 |
+
v2, \
|
| 275 |
+
v3, \
|
| 276 |
+
v4), on_failure)
|
| 277 |
+
|
| 278 |
+
// 4-ary predicate assertion macros.
|
| 279 |
+
#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
|
| 280 |
+
GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
|
| 281 |
+
#define EXPECT_PRED4(pred, v1, v2, v3, v4) \
|
| 282 |
+
GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
|
| 283 |
+
#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
|
| 284 |
+
GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
|
| 285 |
+
#define ASSERT_PRED4(pred, v1, v2, v3, v4) \
|
| 286 |
+
GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
|
| 287 |
+
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
// Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use
|
| 291 |
+
// this in your code.
|
| 292 |
+
template <typename Pred,
|
| 293 |
+
typename T1,
|
| 294 |
+
typename T2,
|
| 295 |
+
typename T3,
|
| 296 |
+
typename T4,
|
| 297 |
+
typename T5>
|
| 298 |
+
AssertionResult AssertPred5Helper(const char* pred_text,
|
| 299 |
+
const char* e1,
|
| 300 |
+
const char* e2,
|
| 301 |
+
const char* e3,
|
| 302 |
+
const char* e4,
|
| 303 |
+
const char* e5,
|
| 304 |
+
Pred pred,
|
| 305 |
+
const T1& v1,
|
| 306 |
+
const T2& v2,
|
| 307 |
+
const T3& v3,
|
| 308 |
+
const T4& v4,
|
| 309 |
+
const T5& v5) {
|
| 310 |
+
if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
|
| 311 |
+
|
| 312 |
+
return AssertionFailure()
|
| 313 |
+
<< pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4
|
| 314 |
+
<< ", " << e5 << ") evaluates to false, where"
|
| 315 |
+
<< "\n"
|
| 316 |
+
<< e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
|
| 317 |
+
<< e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
|
| 318 |
+
<< e3 << " evaluates to " << ::testing::PrintToString(v3) << "\n"
|
| 319 |
+
<< e4 << " evaluates to " << ::testing::PrintToString(v4) << "\n"
|
| 320 |
+
<< e5 << " evaluates to " << ::testing::PrintToString(v5);
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
|
| 324 |
+
// Don't use this in your code.
|
| 325 |
+
#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
|
| 326 |
+
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
|
| 327 |
+
on_failure)
|
| 328 |
+
|
| 329 |
+
// Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use
|
| 330 |
+
// this in your code.
|
| 331 |
+
#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
|
| 332 |
+
GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
|
| 333 |
+
#v1, \
|
| 334 |
+
#v2, \
|
| 335 |
+
#v3, \
|
| 336 |
+
#v4, \
|
| 337 |
+
#v5, \
|
| 338 |
+
pred, \
|
| 339 |
+
v1, \
|
| 340 |
+
v2, \
|
| 341 |
+
v3, \
|
| 342 |
+
v4, \
|
| 343 |
+
v5), on_failure)
|
| 344 |
+
|
| 345 |
+
// 5-ary predicate assertion macros.
|
| 346 |
+
#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
|
| 347 |
+
GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
|
| 348 |
+
#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
|
| 349 |
+
GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
|
| 350 |
+
#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
|
| 351 |
+
GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
|
| 352 |
+
#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
|
| 353 |
+
GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
|
| 354 |
+
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
} // namespace testing
|
| 358 |
+
|
| 359 |
+
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/gtest/gtest_prod.h
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2006, Google Inc.
|
| 2 |
+
// All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// Redistribution and use in source and binary forms, with or without
|
| 5 |
+
// modification, are permitted provided that the following conditions are
|
| 6 |
+
// met:
|
| 7 |
+
//
|
| 8 |
+
// * Redistributions of source code must retain the above copyright
|
| 9 |
+
// notice, this list of conditions and the following disclaimer.
|
| 10 |
+
// * Redistributions in binary form must reproduce the above
|
| 11 |
+
// copyright notice, this list of conditions and the following disclaimer
|
| 12 |
+
// in the documentation and/or other materials provided with the
|
| 13 |
+
// distribution.
|
| 14 |
+
// * Neither the name of Google Inc. nor the names of its
|
| 15 |
+
// contributors may be used to endorse or promote products derived from
|
| 16 |
+
// this software without specific prior written permission.
|
| 17 |
+
//
|
| 18 |
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 21 |
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 24 |
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 25 |
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 26 |
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
+
|
| 30 |
+
//
|
| 31 |
+
// Google C++ Testing and Mocking Framework definitions useful in production code.
|
| 32 |
+
// GOOGLETEST_CM0003 DO NOT DELETE
|
| 33 |
+
|
| 34 |
+
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_
|
| 35 |
+
#define GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_
|
| 36 |
+
|
| 37 |
+
// When you need to test the private or protected members of a class,
|
| 38 |
+
// use the FRIEND_TEST macro to declare your tests as friends of the
|
| 39 |
+
// class. For example:
|
| 40 |
+
//
|
| 41 |
+
// class MyClass {
|
| 42 |
+
// private:
|
| 43 |
+
// void PrivateMethod();
|
| 44 |
+
// FRIEND_TEST(MyClassTest, PrivateMethodWorks);
|
| 45 |
+
// };
|
| 46 |
+
//
|
| 47 |
+
// class MyClassTest : public testing::Test {
|
| 48 |
+
// // ...
|
| 49 |
+
// };
|
| 50 |
+
//
|
| 51 |
+
// TEST_F(MyClassTest, PrivateMethodWorks) {
|
| 52 |
+
// // Can call MyClass::PrivateMethod() here.
|
| 53 |
+
// }
|
| 54 |
+
//
|
| 55 |
+
// Note: The test class must be in the same namespace as the class being tested.
|
| 56 |
+
// For example, putting MyClassTest in an anonymous namespace will not work.
|
| 57 |
+
|
| 58 |
+
#define FRIEND_TEST(test_case_name, test_name)\
|
| 59 |
+
friend class test_case_name##_##test_name##_Test
|
| 60 |
+
|
| 61 |
+
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/anchor.h
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <cstddef>
|
| 11 |
+
|
| 12 |
+
namespace YAML {
|
| 13 |
+
using anchor_t = std::size_t;
|
| 14 |
+
const anchor_t NullAnchor = 0;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
#endif // ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/binary.h
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <string>
|
| 11 |
+
#include <vector>
|
| 12 |
+
|
| 13 |
+
#include "yaml-cpp/dll.h"
|
| 14 |
+
|
| 15 |
+
namespace YAML {
|
| 16 |
+
YAML_CPP_API std::string EncodeBase64(const unsigned char *data,
|
| 17 |
+
std::size_t size);
|
| 18 |
+
YAML_CPP_API std::vector<unsigned char> DecodeBase64(const std::string &input);
|
| 19 |
+
|
| 20 |
+
class YAML_CPP_API Binary {
|
| 21 |
+
public:
|
| 22 |
+
Binary(const unsigned char *data_, std::size_t size_)
|
| 23 |
+
: m_data{}, m_unownedData(data_), m_unownedSize(size_) {}
|
| 24 |
+
Binary() : Binary(nullptr, 0) {}
|
| 25 |
+
Binary(const Binary &) = default;
|
| 26 |
+
Binary(Binary &&) = default;
|
| 27 |
+
Binary &operator=(const Binary &) = default;
|
| 28 |
+
Binary &operator=(Binary &&) = default;
|
| 29 |
+
|
| 30 |
+
bool owned() const { return !m_unownedData; }
|
| 31 |
+
std::size_t size() const { return owned() ? m_data.size() : m_unownedSize; }
|
| 32 |
+
const unsigned char *data() const {
|
| 33 |
+
return owned() ? &m_data[0] : m_unownedData;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
void swap(std::vector<unsigned char> &rhs) {
|
| 37 |
+
if (m_unownedData) {
|
| 38 |
+
m_data.swap(rhs);
|
| 39 |
+
rhs.clear();
|
| 40 |
+
rhs.resize(m_unownedSize);
|
| 41 |
+
std::copy(m_unownedData, m_unownedData + m_unownedSize, rhs.begin());
|
| 42 |
+
m_unownedData = nullptr;
|
| 43 |
+
m_unownedSize = 0;
|
| 44 |
+
} else {
|
| 45 |
+
m_data.swap(rhs);
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
bool operator==(const Binary &rhs) const {
|
| 50 |
+
const std::size_t s = size();
|
| 51 |
+
if (s != rhs.size())
|
| 52 |
+
return false;
|
| 53 |
+
const unsigned char *d1 = data();
|
| 54 |
+
const unsigned char *d2 = rhs.data();
|
| 55 |
+
for (std::size_t i = 0; i < s; i++) {
|
| 56 |
+
if (*d1++ != *d2++)
|
| 57 |
+
return false;
|
| 58 |
+
}
|
| 59 |
+
return true;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
bool operator!=(const Binary &rhs) const { return !(*this == rhs); }
|
| 63 |
+
|
| 64 |
+
private:
|
| 65 |
+
std::vector<unsigned char> m_data;
|
| 66 |
+
const unsigned char *m_unownedData;
|
| 67 |
+
std::size_t m_unownedSize;
|
| 68 |
+
};
|
| 69 |
+
} // namespace YAML
|
| 70 |
+
|
| 71 |
+
#endif // BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/contrib/anchordict.h
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <vector>
|
| 11 |
+
|
| 12 |
+
#include "../anchor.h"
|
| 13 |
+
|
| 14 |
+
namespace YAML {
|
| 15 |
+
/**
|
| 16 |
+
* An object that stores and retrieves values correlating to {@link anchor_t}
|
| 17 |
+
* values.
|
| 18 |
+
*
|
| 19 |
+
* <p>Efficient implementation that can make assumptions about how
|
| 20 |
+
* {@code anchor_t} values are assigned by the {@link Parser} class.
|
| 21 |
+
*/
|
| 22 |
+
template <class T>
|
| 23 |
+
class AnchorDict {
|
| 24 |
+
public:
|
| 25 |
+
AnchorDict() : m_data{} {}
|
| 26 |
+
void Register(anchor_t anchor, T value) {
|
| 27 |
+
if (anchor > m_data.size()) {
|
| 28 |
+
m_data.resize(anchor);
|
| 29 |
+
}
|
| 30 |
+
m_data[anchor - 1] = value;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
T Get(anchor_t anchor) const { return m_data[anchor - 1]; }
|
| 34 |
+
|
| 35 |
+
private:
|
| 36 |
+
std::vector<T> m_data;
|
| 37 |
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include "yaml-cpp/mark.h"
|
| 11 |
+
#include <string>
|
| 12 |
+
|
| 13 |
+
namespace YAML {
|
| 14 |
+
class Parser;
|
| 15 |
+
|
| 16 |
+
// GraphBuilderInterface
|
| 17 |
+
// . Abstraction of node creation
|
| 18 |
+
// . pParentNode is always nullptr or the return value of one of the NewXXX()
|
| 19 |
+
// functions.
|
| 20 |
+
class GraphBuilderInterface {
|
| 21 |
+
public:
|
| 22 |
+
virtual ~GraphBuilderInterface() = 0;
|
| 23 |
+
|
| 24 |
+
// Create and return a new node with a null value.
|
| 25 |
+
virtual void *NewNull(const Mark &mark, void *pParentNode) = 0;
|
| 26 |
+
|
| 27 |
+
// Create and return a new node with the given tag and value.
|
| 28 |
+
virtual void *NewScalar(const Mark &mark, const std::string &tag,
|
| 29 |
+
void *pParentNode, const std::string &value) = 0;
|
| 30 |
+
|
| 31 |
+
// Create and return a new sequence node
|
| 32 |
+
virtual void *NewSequence(const Mark &mark, const std::string &tag,
|
| 33 |
+
void *pParentNode) = 0;
|
| 34 |
+
|
| 35 |
+
// Add pNode to pSequence. pNode was created with one of the NewXxx()
|
| 36 |
+
// functions and pSequence with NewSequence().
|
| 37 |
+
virtual void AppendToSequence(void *pSequence, void *pNode) = 0;
|
| 38 |
+
|
| 39 |
+
// Note that no moew entries will be added to pSequence
|
| 40 |
+
virtual void SequenceComplete(void *pSequence) { (void)pSequence; }
|
| 41 |
+
|
| 42 |
+
// Create and return a new map node
|
| 43 |
+
virtual void *NewMap(const Mark &mark, const std::string &tag,
|
| 44 |
+
void *pParentNode) = 0;
|
| 45 |
+
|
| 46 |
+
// Add the pKeyNode => pValueNode mapping to pMap. pKeyNode and pValueNode
|
| 47 |
+
// were created with one of the NewXxx() methods and pMap with NewMap().
|
| 48 |
+
virtual void AssignInMap(void *pMap, void *pKeyNode, void *pValueNode) = 0;
|
| 49 |
+
|
| 50 |
+
// Note that no more assignments will be made in pMap
|
| 51 |
+
virtual void MapComplete(void *pMap) { (void)pMap; }
|
| 52 |
+
|
| 53 |
+
// Return the node that should be used in place of an alias referencing
|
| 54 |
+
// pNode (pNode by default)
|
| 55 |
+
virtual void *AnchorReference(const Mark &mark, void *pNode) {
|
| 56 |
+
(void)mark;
|
| 57 |
+
return pNode;
|
| 58 |
+
}
|
| 59 |
+
};
|
| 60 |
+
|
| 61 |
+
// Typesafe wrapper for GraphBuilderInterface. Assumes that Impl defines
|
| 62 |
+
// Node, Sequence, and Map types. Sequence and Map must derive from Node
|
| 63 |
+
// (unless Node is defined as void). Impl must also implement function with
|
| 64 |
+
// all of the same names as the virtual functions in GraphBuilderInterface
|
| 65 |
+
// -- including the ones with default implementations -- but with the
|
| 66 |
+
// prototypes changed to accept an explicit Node*, Sequence*, or Map* where
|
| 67 |
+
// appropriate.
|
| 68 |
+
template <class Impl>
|
| 69 |
+
class GraphBuilder : public GraphBuilderInterface {
|
| 70 |
+
public:
|
| 71 |
+
typedef typename Impl::Node Node;
|
| 72 |
+
typedef typename Impl::Sequence Sequence;
|
| 73 |
+
typedef typename Impl::Map Map;
|
| 74 |
+
|
| 75 |
+
GraphBuilder(Impl &impl) : m_impl(impl) {
|
| 76 |
+
Map *pMap = nullptr;
|
| 77 |
+
Sequence *pSeq = nullptr;
|
| 78 |
+
Node *pNode = nullptr;
|
| 79 |
+
|
| 80 |
+
// Type consistency checks
|
| 81 |
+
pNode = pMap;
|
| 82 |
+
pNode = pSeq;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
GraphBuilderInterface &AsBuilderInterface() { return *this; }
|
| 86 |
+
|
| 87 |
+
virtual void *NewNull(const Mark &mark, void *pParentNode) {
|
| 88 |
+
return CheckType<Node>(m_impl.NewNull(mark, AsNode(pParentNode)));
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
virtual void *NewScalar(const Mark &mark, const std::string &tag,
|
| 92 |
+
void *pParentNode, const std::string &value) {
|
| 93 |
+
return CheckType<Node>(
|
| 94 |
+
m_impl.NewScalar(mark, tag, AsNode(pParentNode), value));
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
virtual void *NewSequence(const Mark &mark, const std::string &tag,
|
| 98 |
+
void *pParentNode) {
|
| 99 |
+
return CheckType<Sequence>(
|
| 100 |
+
m_impl.NewSequence(mark, tag, AsNode(pParentNode)));
|
| 101 |
+
}
|
| 102 |
+
virtual void AppendToSequence(void *pSequence, void *pNode) {
|
| 103 |
+
m_impl.AppendToSequence(AsSequence(pSequence), AsNode(pNode));
|
| 104 |
+
}
|
| 105 |
+
virtual void SequenceComplete(void *pSequence) {
|
| 106 |
+
m_impl.SequenceComplete(AsSequence(pSequence));
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
virtual void *NewMap(const Mark &mark, const std::string &tag,
|
| 110 |
+
void *pParentNode) {
|
| 111 |
+
return CheckType<Map>(m_impl.NewMap(mark, tag, AsNode(pParentNode)));
|
| 112 |
+
}
|
| 113 |
+
virtual void AssignInMap(void *pMap, void *pKeyNode, void *pValueNode) {
|
| 114 |
+
m_impl.AssignInMap(AsMap(pMap), AsNode(pKeyNode), AsNode(pValueNode));
|
| 115 |
+
}
|
| 116 |
+
virtual void MapComplete(void *pMap) { m_impl.MapComplete(AsMap(pMap)); }
|
| 117 |
+
|
| 118 |
+
virtual void *AnchorReference(const Mark &mark, void *pNode) {
|
| 119 |
+
return CheckType<Node>(m_impl.AnchorReference(mark, AsNode(pNode)));
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
private:
|
| 123 |
+
Impl &m_impl;
|
| 124 |
+
|
| 125 |
+
// Static check for pointer to T
|
| 126 |
+
template <class T, class U>
|
| 127 |
+
static T *CheckType(U *p) {
|
| 128 |
+
return p;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
static Node *AsNode(void *pNode) { return static_cast<Node *>(pNode); }
|
| 132 |
+
static Sequence *AsSequence(void *pSeq) {
|
| 133 |
+
return static_cast<Sequence *>(pSeq);
|
| 134 |
+
}
|
| 135 |
+
static Map *AsMap(void *pMap) { return static_cast<Map *>(pMap); }
|
| 136 |
+
};
|
| 137 |
+
|
| 138 |
+
void *BuildGraphOfNextDocument(Parser &parser,
|
| 139 |
+
GraphBuilderInterface &graphBuilder);
|
| 140 |
+
|
| 141 |
+
template <class Impl>
|
| 142 |
+
typename Impl::Node *BuildGraphOfNextDocument(Parser &parser, Impl &impl) {
|
| 143 |
+
GraphBuilder<Impl> graphBuilder(impl);
|
| 144 |
+
return static_cast<typename Impl::Node *>(
|
| 145 |
+
BuildGraphOfNextDocument(parser, graphBuilder));
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
#endif // GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/depthguard.h
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef DEPTH_GUARD_H_00000000000000000000000000000000000000000000000000000000
|
| 2 |
+
#define DEPTH_GUARD_H_00000000000000000000000000000000000000000000000000000000
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include "exceptions.h"
|
| 11 |
+
|
| 12 |
+
namespace YAML {
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* @brief The DeepRecursion class
|
| 16 |
+
* An exception class which is thrown by DepthGuard. Ideally it should be
|
| 17 |
+
* a member of DepthGuard. However, DepthGuard is a templated class which means
|
| 18 |
+
* that any catch points would then need to know the template parameters. It is
|
| 19 |
+
* simpler for clients to not have to know at the catch point what was the
|
| 20 |
+
* maximum depth.
|
| 21 |
+
*/
|
| 22 |
+
class DeepRecursion : public ParserException {
|
| 23 |
+
public:
|
| 24 |
+
virtual ~DeepRecursion() = default;
|
| 25 |
+
|
| 26 |
+
DeepRecursion(int depth, const Mark& mark_, const std::string& msg_);
|
| 27 |
+
|
| 28 |
+
// Returns the recursion depth when the exception was thrown
|
| 29 |
+
int depth() const {
|
| 30 |
+
return m_depth;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
private:
|
| 34 |
+
int m_depth = 0;
|
| 35 |
+
};
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* @brief The DepthGuard class
|
| 39 |
+
* DepthGuard takes a reference to an integer. It increments the integer upon
|
| 40 |
+
* construction of DepthGuard and decrements the integer upon destruction.
|
| 41 |
+
*
|
| 42 |
+
* If the integer would be incremented past max_depth, then an exception is
|
| 43 |
+
* thrown. This is ideally geared toward guarding against deep recursion.
|
| 44 |
+
*
|
| 45 |
+
* @param max_depth
|
| 46 |
+
* compile-time configurable maximum depth.
|
| 47 |
+
*/
|
| 48 |
+
template <int max_depth = 2000>
|
| 49 |
+
class DepthGuard final {
|
| 50 |
+
public:
|
| 51 |
+
DepthGuard(int & depth_, const Mark& mark_, const std::string& msg_) : m_depth(depth_) {
|
| 52 |
+
++m_depth;
|
| 53 |
+
if ( max_depth <= m_depth ) {
|
| 54 |
+
throw DeepRecursion{m_depth, mark_, msg_};
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
DepthGuard(const DepthGuard & copy_ctor) = delete;
|
| 59 |
+
DepthGuard(DepthGuard && move_ctor) = delete;
|
| 60 |
+
DepthGuard & operator=(const DepthGuard & copy_assign) = delete;
|
| 61 |
+
DepthGuard & operator=(DepthGuard && move_assign) = delete;
|
| 62 |
+
|
| 63 |
+
~DepthGuard() {
|
| 64 |
+
--m_depth;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
int current_depth() const {
|
| 68 |
+
return m_depth;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
private:
|
| 72 |
+
int & m_depth;
|
| 73 |
+
};
|
| 74 |
+
|
| 75 |
+
} // namespace YAML
|
| 76 |
+
|
| 77 |
+
#endif // DEPTH_GUARD_H_00000000000000000000000000000000000000000000000000000000
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/dll.h
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
// Definition YAML_CPP_STATIC_DEFINE using to building YAML-CPP as static
|
| 5 |
+
// library (definition created by CMake or defined manually)
|
| 6 |
+
|
| 7 |
+
// Definition yaml_cpp_EXPORTS using to building YAML-CPP as dll/so library
|
| 8 |
+
// (definition created by CMake or defined manually)
|
| 9 |
+
|
| 10 |
+
#ifdef YAML_CPP_STATIC_DEFINE
|
| 11 |
+
# define YAML_CPP_API
|
| 12 |
+
# define YAML_CPP_NO_EXPORT
|
| 13 |
+
#else
|
| 14 |
+
# if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
|
| 15 |
+
# ifndef YAML_CPP_API
|
| 16 |
+
# ifdef yaml_cpp_EXPORTS
|
| 17 |
+
/* We are building this library */
|
| 18 |
+
# pragma message( "Defining YAML_CPP_API for DLL export" )
|
| 19 |
+
# define YAML_CPP_API __declspec(dllexport)
|
| 20 |
+
# else
|
| 21 |
+
/* We are using this library */
|
| 22 |
+
# pragma message( "Defining YAML_CPP_API for DLL import" )
|
| 23 |
+
# define YAML_CPP_API __declspec(dllimport)
|
| 24 |
+
# endif
|
| 25 |
+
# endif
|
| 26 |
+
# ifndef YAML_CPP_NO_EXPORT
|
| 27 |
+
# define YAML_CPP_NO_EXPORT
|
| 28 |
+
# endif
|
| 29 |
+
# else /* No _MSC_VER */
|
| 30 |
+
# ifndef YAML_CPP_API
|
| 31 |
+
# ifdef yaml_cpp_EXPORTS
|
| 32 |
+
/* We are building this library */
|
| 33 |
+
# define YAML_CPP_API __attribute__((visibility("default")))
|
| 34 |
+
# else
|
| 35 |
+
/* We are using this library */
|
| 36 |
+
# define YAML_CPP_API __attribute__((visibility("default")))
|
| 37 |
+
# endif
|
| 38 |
+
# endif
|
| 39 |
+
# ifndef YAML_CPP_NO_EXPORT
|
| 40 |
+
# define YAML_CPP_NO_EXPORT __attribute__((visibility("hidden")))
|
| 41 |
+
# endif
|
| 42 |
+
# endif /* _MSC_VER */
|
| 43 |
+
#endif /* YAML_CPP_STATIC_DEFINE */
|
| 44 |
+
|
| 45 |
+
#ifndef YAML_CPP_DEPRECATED
|
| 46 |
+
# ifdef _MSC_VER
|
| 47 |
+
# define YAML_CPP_DEPRECATED __declspec(deprecated)
|
| 48 |
+
# else
|
| 49 |
+
# define YAML_CPP_DEPRECATED __attribute__ ((__deprecated__))
|
| 50 |
+
# endif
|
| 51 |
+
#endif
|
| 52 |
+
|
| 53 |
+
#ifndef YAML_CPP_DEPRECATED_EXPORT
|
| 54 |
+
# define YAML_CPP_DEPRECATED_EXPORT YAML_CPP_API YAML_CPP_DEPRECATED
|
| 55 |
+
#endif
|
| 56 |
+
|
| 57 |
+
#ifndef YAML_CPP_DEPRECATED_NO_EXPORT
|
| 58 |
+
# define YAML_CPP_DEPRECATED_NO_EXPORT YAML_CPP_NO_EXPORT YAML_CPP_DEPRECATED
|
| 59 |
+
#endif
|
| 60 |
+
|
| 61 |
+
#endif /* DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 */
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/emitfromevents.h
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <stack>
|
| 11 |
+
|
| 12 |
+
#include "yaml-cpp/anchor.h"
|
| 13 |
+
#include "yaml-cpp/emitterstyle.h"
|
| 14 |
+
#include "yaml-cpp/eventhandler.h"
|
| 15 |
+
|
| 16 |
+
namespace YAML {
|
| 17 |
+
struct Mark;
|
| 18 |
+
} // namespace YAML
|
| 19 |
+
|
| 20 |
+
namespace YAML {
|
| 21 |
+
class Emitter;
|
| 22 |
+
|
| 23 |
+
class EmitFromEvents : public EventHandler {
|
| 24 |
+
public:
|
| 25 |
+
EmitFromEvents(Emitter& emitter);
|
| 26 |
+
|
| 27 |
+
void OnDocumentStart(const Mark& mark) override;
|
| 28 |
+
void OnDocumentEnd() override;
|
| 29 |
+
|
| 30 |
+
void OnNull(const Mark& mark, anchor_t anchor) override;
|
| 31 |
+
void OnAlias(const Mark& mark, anchor_t anchor) override;
|
| 32 |
+
void OnScalar(const Mark& mark, const std::string& tag,
|
| 33 |
+
anchor_t anchor, const std::string& value) override;
|
| 34 |
+
|
| 35 |
+
void OnSequenceStart(const Mark& mark, const std::string& tag,
|
| 36 |
+
anchor_t anchor, EmitterStyle::value style) override;
|
| 37 |
+
void OnSequenceEnd() override;
|
| 38 |
+
|
| 39 |
+
void OnMapStart(const Mark& mark, const std::string& tag,
|
| 40 |
+
anchor_t anchor, EmitterStyle::value style) override;
|
| 41 |
+
void OnMapEnd() override;
|
| 42 |
+
|
| 43 |
+
private:
|
| 44 |
+
void BeginNode();
|
| 45 |
+
void EmitProps(const std::string& tag, anchor_t anchor);
|
| 46 |
+
|
| 47 |
+
private:
|
| 48 |
+
Emitter& m_emitter;
|
| 49 |
+
|
| 50 |
+
struct State {
|
| 51 |
+
enum value { WaitingForSequenceEntry, WaitingForKey, WaitingForValue };
|
| 52 |
+
};
|
| 53 |
+
std::stack<State::value> m_stateStack;
|
| 54 |
+
};
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
#endif // EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/emitter.h
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <cmath>
|
| 11 |
+
#include <cstddef>
|
| 12 |
+
#include <limits>
|
| 13 |
+
#include <memory>
|
| 14 |
+
#include <sstream>
|
| 15 |
+
#include <string>
|
| 16 |
+
#include <type_traits>
|
| 17 |
+
|
| 18 |
+
#include "yaml-cpp/binary.h"
|
| 19 |
+
#include "yaml-cpp/dll.h"
|
| 20 |
+
#include "yaml-cpp/emitterdef.h"
|
| 21 |
+
#include "yaml-cpp/emittermanip.h"
|
| 22 |
+
#include "yaml-cpp/null.h"
|
| 23 |
+
#include "yaml-cpp/ostream_wrapper.h"
|
| 24 |
+
|
| 25 |
+
namespace YAML {
|
| 26 |
+
class Binary;
|
| 27 |
+
struct _Null;
|
| 28 |
+
} // namespace YAML
|
| 29 |
+
|
| 30 |
+
namespace YAML {
|
| 31 |
+
class EmitterState;
|
| 32 |
+
|
| 33 |
+
class YAML_CPP_API Emitter {
|
| 34 |
+
public:
|
| 35 |
+
Emitter();
|
| 36 |
+
explicit Emitter(std::ostream& stream);
|
| 37 |
+
Emitter(const Emitter&) = delete;
|
| 38 |
+
Emitter& operator=(const Emitter&) = delete;
|
| 39 |
+
~Emitter();
|
| 40 |
+
|
| 41 |
+
// output
|
| 42 |
+
const char* c_str() const;
|
| 43 |
+
std::size_t size() const;
|
| 44 |
+
|
| 45 |
+
// state checking
|
| 46 |
+
bool good() const;
|
| 47 |
+
const std::string GetLastError() const;
|
| 48 |
+
|
| 49 |
+
// global setters
|
| 50 |
+
bool SetOutputCharset(EMITTER_MANIP value);
|
| 51 |
+
bool SetStringFormat(EMITTER_MANIP value);
|
| 52 |
+
bool SetBoolFormat(EMITTER_MANIP value);
|
| 53 |
+
bool SetNullFormat(EMITTER_MANIP value);
|
| 54 |
+
bool SetIntBase(EMITTER_MANIP value);
|
| 55 |
+
bool SetSeqFormat(EMITTER_MANIP value);
|
| 56 |
+
bool SetMapFormat(EMITTER_MANIP value);
|
| 57 |
+
bool SetIndent(std::size_t n);
|
| 58 |
+
bool SetPreCommentIndent(std::size_t n);
|
| 59 |
+
bool SetPostCommentIndent(std::size_t n);
|
| 60 |
+
bool SetFloatPrecision(std::size_t n);
|
| 61 |
+
bool SetDoublePrecision(std::size_t n);
|
| 62 |
+
void RestoreGlobalModifiedSettings();
|
| 63 |
+
|
| 64 |
+
// local setters
|
| 65 |
+
Emitter& SetLocalValue(EMITTER_MANIP value);
|
| 66 |
+
Emitter& SetLocalIndent(const _Indent& indent);
|
| 67 |
+
Emitter& SetLocalPrecision(const _Precision& precision);
|
| 68 |
+
|
| 69 |
+
// overloads of write
|
| 70 |
+
Emitter& Write(const std::string& str);
|
| 71 |
+
Emitter& Write(bool b);
|
| 72 |
+
Emitter& Write(char ch);
|
| 73 |
+
Emitter& Write(const _Alias& alias);
|
| 74 |
+
Emitter& Write(const _Anchor& anchor);
|
| 75 |
+
Emitter& Write(const _Tag& tag);
|
| 76 |
+
Emitter& Write(const _Comment& comment);
|
| 77 |
+
Emitter& Write(const _Null& n);
|
| 78 |
+
Emitter& Write(const Binary& binary);
|
| 79 |
+
|
| 80 |
+
template <typename T>
|
| 81 |
+
Emitter& WriteIntegralType(T value);
|
| 82 |
+
|
| 83 |
+
template <typename T>
|
| 84 |
+
Emitter& WriteStreamable(T value);
|
| 85 |
+
|
| 86 |
+
private:
|
| 87 |
+
template <typename T>
|
| 88 |
+
void SetStreamablePrecision(std::stringstream&) {}
|
| 89 |
+
std::size_t GetFloatPrecision() const;
|
| 90 |
+
std::size_t GetDoublePrecision() const;
|
| 91 |
+
|
| 92 |
+
void PrepareIntegralStream(std::stringstream& stream) const;
|
| 93 |
+
void StartedScalar();
|
| 94 |
+
|
| 95 |
+
private:
|
| 96 |
+
void EmitBeginDoc();
|
| 97 |
+
void EmitEndDoc();
|
| 98 |
+
void EmitBeginSeq();
|
| 99 |
+
void EmitEndSeq();
|
| 100 |
+
void EmitBeginMap();
|
| 101 |
+
void EmitEndMap();
|
| 102 |
+
void EmitNewline();
|
| 103 |
+
void EmitKindTag();
|
| 104 |
+
void EmitTag(bool verbatim, const _Tag& tag);
|
| 105 |
+
|
| 106 |
+
void PrepareNode(EmitterNodeType::value child);
|
| 107 |
+
void PrepareTopNode(EmitterNodeType::value child);
|
| 108 |
+
void FlowSeqPrepareNode(EmitterNodeType::value child);
|
| 109 |
+
void BlockSeqPrepareNode(EmitterNodeType::value child);
|
| 110 |
+
|
| 111 |
+
void FlowMapPrepareNode(EmitterNodeType::value child);
|
| 112 |
+
|
| 113 |
+
void FlowMapPrepareLongKey(EmitterNodeType::value child);
|
| 114 |
+
void FlowMapPrepareLongKeyValue(EmitterNodeType::value child);
|
| 115 |
+
void FlowMapPrepareSimpleKey(EmitterNodeType::value child);
|
| 116 |
+
void FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child);
|
| 117 |
+
|
| 118 |
+
void BlockMapPrepareNode(EmitterNodeType::value child);
|
| 119 |
+
|
| 120 |
+
void BlockMapPrepareLongKey(EmitterNodeType::value child);
|
| 121 |
+
void BlockMapPrepareLongKeyValue(EmitterNodeType::value child);
|
| 122 |
+
void BlockMapPrepareSimpleKey(EmitterNodeType::value child);
|
| 123 |
+
void BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child);
|
| 124 |
+
|
| 125 |
+
void SpaceOrIndentTo(bool requireSpace, std::size_t indent);
|
| 126 |
+
|
| 127 |
+
const char* ComputeFullBoolName(bool b) const;
|
| 128 |
+
const char* ComputeNullName() const;
|
| 129 |
+
bool CanEmitNewline() const;
|
| 130 |
+
|
| 131 |
+
private:
|
| 132 |
+
std::unique_ptr<EmitterState> m_pState;
|
| 133 |
+
ostream_wrapper m_stream;
|
| 134 |
+
};
|
| 135 |
+
|
| 136 |
+
template <typename T>
|
| 137 |
+
inline Emitter& Emitter::WriteIntegralType(T value) {
|
| 138 |
+
if (!good())
|
| 139 |
+
return *this;
|
| 140 |
+
|
| 141 |
+
PrepareNode(EmitterNodeType::Scalar);
|
| 142 |
+
|
| 143 |
+
std::stringstream stream;
|
| 144 |
+
PrepareIntegralStream(stream);
|
| 145 |
+
stream << value;
|
| 146 |
+
m_stream << stream.str();
|
| 147 |
+
|
| 148 |
+
StartedScalar();
|
| 149 |
+
|
| 150 |
+
return *this;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
template <typename T>
|
| 154 |
+
inline Emitter& Emitter::WriteStreamable(T value) {
|
| 155 |
+
if (!good())
|
| 156 |
+
return *this;
|
| 157 |
+
|
| 158 |
+
PrepareNode(EmitterNodeType::Scalar);
|
| 159 |
+
|
| 160 |
+
std::stringstream stream;
|
| 161 |
+
SetStreamablePrecision<T>(stream);
|
| 162 |
+
|
| 163 |
+
bool special = false;
|
| 164 |
+
if (std::is_floating_point<T>::value) {
|
| 165 |
+
if ((std::numeric_limits<T>::has_quiet_NaN ||
|
| 166 |
+
std::numeric_limits<T>::has_signaling_NaN) &&
|
| 167 |
+
std::isnan(value)) {
|
| 168 |
+
special = true;
|
| 169 |
+
stream << ".nan";
|
| 170 |
+
} else if (std::numeric_limits<T>::has_infinity && std::isinf(value)) {
|
| 171 |
+
special = true;
|
| 172 |
+
if (std::signbit(value)) {
|
| 173 |
+
stream << "-.inf";
|
| 174 |
+
} else {
|
| 175 |
+
stream << ".inf";
|
| 176 |
+
}
|
| 177 |
+
}
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
if (!special) {
|
| 181 |
+
stream << value;
|
| 182 |
+
}
|
| 183 |
+
m_stream << stream.str();
|
| 184 |
+
|
| 185 |
+
StartedScalar();
|
| 186 |
+
|
| 187 |
+
return *this;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
template <>
|
| 191 |
+
inline void Emitter::SetStreamablePrecision<float>(std::stringstream& stream) {
|
| 192 |
+
stream.precision(static_cast<std::streamsize>(GetFloatPrecision()));
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
template <>
|
| 196 |
+
inline void Emitter::SetStreamablePrecision<double>(std::stringstream& stream) {
|
| 197 |
+
stream.precision(static_cast<std::streamsize>(GetDoublePrecision()));
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
// overloads of insertion
|
| 201 |
+
inline Emitter& operator<<(Emitter& emitter, const std::string& v) {
|
| 202 |
+
return emitter.Write(v);
|
| 203 |
+
}
|
| 204 |
+
inline Emitter& operator<<(Emitter& emitter, bool v) {
|
| 205 |
+
return emitter.Write(v);
|
| 206 |
+
}
|
| 207 |
+
inline Emitter& operator<<(Emitter& emitter, char v) {
|
| 208 |
+
return emitter.Write(v);
|
| 209 |
+
}
|
| 210 |
+
inline Emitter& operator<<(Emitter& emitter, unsigned char v) {
|
| 211 |
+
return emitter.Write(static_cast<char>(v));
|
| 212 |
+
}
|
| 213 |
+
inline Emitter& operator<<(Emitter& emitter, const _Alias& v) {
|
| 214 |
+
return emitter.Write(v);
|
| 215 |
+
}
|
| 216 |
+
inline Emitter& operator<<(Emitter& emitter, const _Anchor& v) {
|
| 217 |
+
return emitter.Write(v);
|
| 218 |
+
}
|
| 219 |
+
inline Emitter& operator<<(Emitter& emitter, const _Tag& v) {
|
| 220 |
+
return emitter.Write(v);
|
| 221 |
+
}
|
| 222 |
+
inline Emitter& operator<<(Emitter& emitter, const _Comment& v) {
|
| 223 |
+
return emitter.Write(v);
|
| 224 |
+
}
|
| 225 |
+
inline Emitter& operator<<(Emitter& emitter, const _Null& v) {
|
| 226 |
+
return emitter.Write(v);
|
| 227 |
+
}
|
| 228 |
+
inline Emitter& operator<<(Emitter& emitter, const Binary& b) {
|
| 229 |
+
return emitter.Write(b);
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
inline Emitter& operator<<(Emitter& emitter, const char* v) {
|
| 233 |
+
return emitter.Write(std::string(v));
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
inline Emitter& operator<<(Emitter& emitter, int v) {
|
| 237 |
+
return emitter.WriteIntegralType(v);
|
| 238 |
+
}
|
| 239 |
+
inline Emitter& operator<<(Emitter& emitter, unsigned int v) {
|
| 240 |
+
return emitter.WriteIntegralType(v);
|
| 241 |
+
}
|
| 242 |
+
inline Emitter& operator<<(Emitter& emitter, short v) {
|
| 243 |
+
return emitter.WriteIntegralType(v);
|
| 244 |
+
}
|
| 245 |
+
inline Emitter& operator<<(Emitter& emitter, unsigned short v) {
|
| 246 |
+
return emitter.WriteIntegralType(v);
|
| 247 |
+
}
|
| 248 |
+
inline Emitter& operator<<(Emitter& emitter, long v) {
|
| 249 |
+
return emitter.WriteIntegralType(v);
|
| 250 |
+
}
|
| 251 |
+
inline Emitter& operator<<(Emitter& emitter, unsigned long v) {
|
| 252 |
+
return emitter.WriteIntegralType(v);
|
| 253 |
+
}
|
| 254 |
+
inline Emitter& operator<<(Emitter& emitter, long long v) {
|
| 255 |
+
return emitter.WriteIntegralType(v);
|
| 256 |
+
}
|
| 257 |
+
inline Emitter& operator<<(Emitter& emitter, unsigned long long v) {
|
| 258 |
+
return emitter.WriteIntegralType(v);
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
inline Emitter& operator<<(Emitter& emitter, float v) {
|
| 262 |
+
return emitter.WriteStreamable(v);
|
| 263 |
+
}
|
| 264 |
+
inline Emitter& operator<<(Emitter& emitter, double v) {
|
| 265 |
+
return emitter.WriteStreamable(v);
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
inline Emitter& operator<<(Emitter& emitter, EMITTER_MANIP value) {
|
| 269 |
+
return emitter.SetLocalValue(value);
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
inline Emitter& operator<<(Emitter& emitter, _Indent indent) {
|
| 273 |
+
return emitter.SetLocalIndent(indent);
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
inline Emitter& operator<<(Emitter& emitter, _Precision precision) {
|
| 277 |
+
return emitter.SetLocalPrecision(precision);
|
| 278 |
+
}
|
| 279 |
+
} // namespace YAML
|
| 280 |
+
|
| 281 |
+
#endif // EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/emitterdef.h
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
namespace YAML {
|
| 11 |
+
struct EmitterNodeType {
|
| 12 |
+
enum value { NoType, Property, Scalar, FlowSeq, BlockSeq, FlowMap, BlockMap };
|
| 13 |
+
};
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
#endif // EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/emittermanip.h
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <string>
|
| 11 |
+
|
| 12 |
+
namespace YAML {
|
| 13 |
+
enum EMITTER_MANIP {
|
| 14 |
+
// general manipulators
|
| 15 |
+
Auto,
|
| 16 |
+
TagByKind,
|
| 17 |
+
Newline,
|
| 18 |
+
|
| 19 |
+
// output character set
|
| 20 |
+
EmitNonAscii,
|
| 21 |
+
EscapeNonAscii,
|
| 22 |
+
EscapeAsJson,
|
| 23 |
+
|
| 24 |
+
// string manipulators
|
| 25 |
+
// Auto, // duplicate
|
| 26 |
+
SingleQuoted,
|
| 27 |
+
DoubleQuoted,
|
| 28 |
+
Literal,
|
| 29 |
+
|
| 30 |
+
// null manipulators
|
| 31 |
+
LowerNull,
|
| 32 |
+
UpperNull,
|
| 33 |
+
CamelNull,
|
| 34 |
+
TildeNull,
|
| 35 |
+
|
| 36 |
+
// bool manipulators
|
| 37 |
+
YesNoBool, // yes, no
|
| 38 |
+
TrueFalseBool, // true, false
|
| 39 |
+
OnOffBool, // on, off
|
| 40 |
+
UpperCase, // TRUE, N
|
| 41 |
+
LowerCase, // f, yes
|
| 42 |
+
CamelCase, // No, Off
|
| 43 |
+
LongBool, // yes, On
|
| 44 |
+
ShortBool, // y, t
|
| 45 |
+
|
| 46 |
+
// int manipulators
|
| 47 |
+
Dec,
|
| 48 |
+
Hex,
|
| 49 |
+
Oct,
|
| 50 |
+
|
| 51 |
+
// document manipulators
|
| 52 |
+
BeginDoc,
|
| 53 |
+
EndDoc,
|
| 54 |
+
|
| 55 |
+
// sequence manipulators
|
| 56 |
+
BeginSeq,
|
| 57 |
+
EndSeq,
|
| 58 |
+
Flow,
|
| 59 |
+
Block,
|
| 60 |
+
|
| 61 |
+
// map manipulators
|
| 62 |
+
BeginMap,
|
| 63 |
+
EndMap,
|
| 64 |
+
Key,
|
| 65 |
+
Value,
|
| 66 |
+
// Flow, // duplicate
|
| 67 |
+
// Block, // duplicate
|
| 68 |
+
// Auto, // duplicate
|
| 69 |
+
LongKey
|
| 70 |
+
};
|
| 71 |
+
|
| 72 |
+
struct _Indent {
|
| 73 |
+
_Indent(int value_) : value(value_) {}
|
| 74 |
+
int value;
|
| 75 |
+
};
|
| 76 |
+
|
| 77 |
+
inline _Indent Indent(int value) { return _Indent(value); }
|
| 78 |
+
|
| 79 |
+
struct _Alias {
|
| 80 |
+
_Alias(const std::string& content_) : content(content_) {}
|
| 81 |
+
std::string content;
|
| 82 |
+
};
|
| 83 |
+
|
| 84 |
+
inline _Alias Alias(const std::string& content) { return _Alias(content); }
|
| 85 |
+
|
| 86 |
+
struct _Anchor {
|
| 87 |
+
_Anchor(const std::string& content_) : content(content_) {}
|
| 88 |
+
std::string content;
|
| 89 |
+
};
|
| 90 |
+
|
| 91 |
+
inline _Anchor Anchor(const std::string& content) { return _Anchor(content); }
|
| 92 |
+
|
| 93 |
+
struct _Tag {
|
| 94 |
+
struct Type {
|
| 95 |
+
enum value { Verbatim, PrimaryHandle, NamedHandle };
|
| 96 |
+
};
|
| 97 |
+
|
| 98 |
+
explicit _Tag(const std::string& prefix_, const std::string& content_,
|
| 99 |
+
Type::value type_)
|
| 100 |
+
: prefix(prefix_), content(content_), type(type_) {}
|
| 101 |
+
std::string prefix;
|
| 102 |
+
std::string content;
|
| 103 |
+
Type::value type;
|
| 104 |
+
};
|
| 105 |
+
|
| 106 |
+
inline _Tag VerbatimTag(const std::string& content) {
|
| 107 |
+
return _Tag("", content, _Tag::Type::Verbatim);
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
inline _Tag LocalTag(const std::string& content) {
|
| 111 |
+
return _Tag("", content, _Tag::Type::PrimaryHandle);
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
inline _Tag LocalTag(const std::string& prefix, const std::string content) {
|
| 115 |
+
return _Tag(prefix, content, _Tag::Type::NamedHandle);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
inline _Tag SecondaryTag(const std::string& content) {
|
| 119 |
+
return _Tag("", content, _Tag::Type::NamedHandle);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
struct _Comment {
|
| 123 |
+
_Comment(const std::string& content_) : content(content_) {}
|
| 124 |
+
std::string content;
|
| 125 |
+
};
|
| 126 |
+
|
| 127 |
+
inline _Comment Comment(const std::string& content) { return _Comment(content); }
|
| 128 |
+
|
| 129 |
+
struct _Precision {
|
| 130 |
+
_Precision(int floatPrecision_, int doublePrecision_)
|
| 131 |
+
: floatPrecision(floatPrecision_), doublePrecision(doublePrecision_) {}
|
| 132 |
+
|
| 133 |
+
int floatPrecision;
|
| 134 |
+
int doublePrecision;
|
| 135 |
+
};
|
| 136 |
+
|
| 137 |
+
inline _Precision FloatPrecision(int n) { return _Precision(n, -1); }
|
| 138 |
+
|
| 139 |
+
inline _Precision DoublePrecision(int n) { return _Precision(-1, n); }
|
| 140 |
+
|
| 141 |
+
inline _Precision Precision(int n) { return _Precision(n, n); }
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
#endif // EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/emitterstyle.h
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
namespace YAML {
|
| 11 |
+
struct EmitterStyle {
|
| 12 |
+
enum value { Default, Block, Flow };
|
| 13 |
+
};
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
#endif // EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/eventhandler.h
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <string>
|
| 11 |
+
|
| 12 |
+
#include "yaml-cpp/anchor.h"
|
| 13 |
+
#include "yaml-cpp/emitterstyle.h"
|
| 14 |
+
|
| 15 |
+
namespace YAML {
|
| 16 |
+
struct Mark;
|
| 17 |
+
|
| 18 |
+
class EventHandler {
|
| 19 |
+
public:
|
| 20 |
+
virtual ~EventHandler() = default;
|
| 21 |
+
|
| 22 |
+
virtual void OnDocumentStart(const Mark& mark) = 0;
|
| 23 |
+
virtual void OnDocumentEnd() = 0;
|
| 24 |
+
|
| 25 |
+
virtual void OnNull(const Mark& mark, anchor_t anchor) = 0;
|
| 26 |
+
virtual void OnAlias(const Mark& mark, anchor_t anchor) = 0;
|
| 27 |
+
virtual void OnScalar(const Mark& mark, const std::string& tag,
|
| 28 |
+
anchor_t anchor, const std::string& value) = 0;
|
| 29 |
+
|
| 30 |
+
virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
|
| 31 |
+
anchor_t anchor, EmitterStyle::value style) = 0;
|
| 32 |
+
virtual void OnSequenceEnd() = 0;
|
| 33 |
+
|
| 34 |
+
virtual void OnMapStart(const Mark& mark, const std::string& tag,
|
| 35 |
+
anchor_t anchor, EmitterStyle::value style) = 0;
|
| 36 |
+
virtual void OnMapEnd() = 0;
|
| 37 |
+
|
| 38 |
+
virtual void OnAnchor(const Mark& /*mark*/,
|
| 39 |
+
const std::string& /*anchor_name*/) {
|
| 40 |
+
// empty default implementation for compatibility
|
| 41 |
+
}
|
| 42 |
+
};
|
| 43 |
+
} // namespace YAML
|
| 44 |
+
|
| 45 |
+
#endif // EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/exceptions.h
ADDED
|
@@ -0,0 +1,303 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C supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include "yaml-cpp/mark.h"
|
| 11 |
+
#include "yaml-cpp/noexcept.h"
|
| 12 |
+
#include "yaml-cpp/traits.h"
|
| 13 |
+
#include <sstream>
|
| 14 |
+
#include <stdexcept>
|
| 15 |
+
#include <string>
|
| 16 |
+
|
| 17 |
+
namespace YAML {
|
| 18 |
+
// error messages
|
| 19 |
+
namespace ErrorMsg {
|
| 20 |
+
const char* const YAML_DIRECTIVE_ARGS =
|
| 21 |
+
"YAML directives must have exactly one argument";
|
| 22 |
+
const char* const YAML_VERSION = "bad YAML version: ";
|
| 23 |
+
const char* const YAML_MAJOR_VERSION = "YAML major version too large";
|
| 24 |
+
const char* const REPEATED_YAML_DIRECTIVE = "repeated YAML directive";
|
| 25 |
+
const char* const TAG_DIRECTIVE_ARGS =
|
| 26 |
+
"TAG directives must have exactly two arguments";
|
| 27 |
+
const char* const REPEATED_TAG_DIRECTIVE = "repeated TAG directive";
|
| 28 |
+
const char* const CHAR_IN_TAG_HANDLE =
|
| 29 |
+
"illegal character found while scanning tag handle";
|
| 30 |
+
const char* const TAG_WITH_NO_SUFFIX = "tag handle with no suffix";
|
| 31 |
+
const char* const END_OF_VERBATIM_TAG = "end of verbatim tag not found";
|
| 32 |
+
const char* const END_OF_MAP = "end of map not found";
|
| 33 |
+
const char* const END_OF_MAP_FLOW = "end of map flow not found";
|
| 34 |
+
const char* const END_OF_SEQ = "end of sequence not found";
|
| 35 |
+
const char* const END_OF_SEQ_FLOW = "end of sequence flow not found";
|
| 36 |
+
const char* const MULTIPLE_TAGS =
|
| 37 |
+
"cannot assign multiple tags to the same node";
|
| 38 |
+
const char* const MULTIPLE_ANCHORS =
|
| 39 |
+
"cannot assign multiple anchors to the same node";
|
| 40 |
+
const char* const MULTIPLE_ALIASES =
|
| 41 |
+
"cannot assign multiple aliases to the same node";
|
| 42 |
+
const char* const ALIAS_CONTENT =
|
| 43 |
+
"aliases can't have any content, *including* tags";
|
| 44 |
+
const char* const INVALID_HEX = "bad character found while scanning hex number";
|
| 45 |
+
const char* const INVALID_UNICODE = "invalid unicode: ";
|
| 46 |
+
const char* const INVALID_ESCAPE = "unknown escape character: ";
|
| 47 |
+
const char* const UNKNOWN_TOKEN = "unknown token";
|
| 48 |
+
const char* const DOC_IN_SCALAR = "illegal document indicator in scalar";
|
| 49 |
+
const char* const EOF_IN_SCALAR = "illegal EOF in scalar";
|
| 50 |
+
const char* const CHAR_IN_SCALAR = "illegal character in scalar";
|
| 51 |
+
const char* const TAB_IN_INDENTATION =
|
| 52 |
+
"illegal tab when looking for indentation";
|
| 53 |
+
const char* const FLOW_END = "illegal flow end";
|
| 54 |
+
const char* const BLOCK_ENTRY = "illegal block entry";
|
| 55 |
+
const char* const MAP_KEY = "illegal map key";
|
| 56 |
+
const char* const MAP_VALUE = "illegal map value";
|
| 57 |
+
const char* const ALIAS_NOT_FOUND = "alias not found after *";
|
| 58 |
+
const char* const ANCHOR_NOT_FOUND = "anchor not found after &";
|
| 59 |
+
const char* const CHAR_IN_ALIAS =
|
| 60 |
+
"illegal character found while scanning alias";
|
| 61 |
+
const char* const CHAR_IN_ANCHOR =
|
| 62 |
+
"illegal character found while scanning anchor";
|
| 63 |
+
const char* const ZERO_INDENT_IN_BLOCK =
|
| 64 |
+
"cannot set zero indentation for a block scalar";
|
| 65 |
+
const char* const CHAR_IN_BLOCK = "unexpected character in block scalar";
|
| 66 |
+
const char* const AMBIGUOUS_ANCHOR =
|
| 67 |
+
"cannot assign the same alias to multiple nodes";
|
| 68 |
+
const char* const UNKNOWN_ANCHOR = "the referenced anchor is not defined: ";
|
| 69 |
+
|
| 70 |
+
const char* const INVALID_NODE =
|
| 71 |
+
"invalid node; this may result from using a map iterator as a sequence "
|
| 72 |
+
"iterator, or vice-versa";
|
| 73 |
+
const char* const INVALID_SCALAR = "invalid scalar";
|
| 74 |
+
const char* const KEY_NOT_FOUND = "key not found";
|
| 75 |
+
const char* const BAD_CONVERSION = "bad conversion";
|
| 76 |
+
const char* const BAD_DEREFERENCE = "bad dereference";
|
| 77 |
+
const char* const BAD_SUBSCRIPT = "operator[] call on a scalar";
|
| 78 |
+
const char* const BAD_PUSHBACK = "appending to a non-sequence";
|
| 79 |
+
const char* const BAD_INSERT = "inserting in a non-convertible-to-map";
|
| 80 |
+
|
| 81 |
+
const char* const UNMATCHED_GROUP_TAG = "unmatched group tag";
|
| 82 |
+
const char* const UNEXPECTED_END_SEQ = "unexpected end sequence token";
|
| 83 |
+
const char* const UNEXPECTED_END_MAP = "unexpected end map token";
|
| 84 |
+
const char* const SINGLE_QUOTED_CHAR =
|
| 85 |
+
"invalid character in single-quoted string";
|
| 86 |
+
const char* const INVALID_ANCHOR = "invalid anchor";
|
| 87 |
+
const char* const INVALID_ALIAS = "invalid alias";
|
| 88 |
+
const char* const INVALID_TAG = "invalid tag";
|
| 89 |
+
const char* const BAD_FILE = "bad file";
|
| 90 |
+
|
| 91 |
+
template <typename T>
|
| 92 |
+
inline const std::string KEY_NOT_FOUND_WITH_KEY(
|
| 93 |
+
const T&, typename disable_if<is_numeric<T>>::type* = 0) {
|
| 94 |
+
return KEY_NOT_FOUND;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string& key) {
|
| 98 |
+
std::stringstream stream;
|
| 99 |
+
stream << KEY_NOT_FOUND << ": " << key;
|
| 100 |
+
return stream.str();
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
inline const std::string KEY_NOT_FOUND_WITH_KEY(const char* key) {
|
| 104 |
+
std::stringstream stream;
|
| 105 |
+
stream << KEY_NOT_FOUND << ": " << key;
|
| 106 |
+
return stream.str();
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
template <typename T>
|
| 110 |
+
inline const std::string KEY_NOT_FOUND_WITH_KEY(
|
| 111 |
+
const T& key, typename enable_if<is_numeric<T>>::type* = 0) {
|
| 112 |
+
std::stringstream stream;
|
| 113 |
+
stream << KEY_NOT_FOUND << ": " << key;
|
| 114 |
+
return stream.str();
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
template <typename T>
|
| 118 |
+
inline const std::string BAD_SUBSCRIPT_WITH_KEY(
|
| 119 |
+
const T&, typename disable_if<is_numeric<T>>::type* = nullptr) {
|
| 120 |
+
return BAD_SUBSCRIPT;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
inline const std::string BAD_SUBSCRIPT_WITH_KEY(const std::string& key) {
|
| 124 |
+
std::stringstream stream;
|
| 125 |
+
stream << BAD_SUBSCRIPT << " (key: \"" << key << "\")";
|
| 126 |
+
return stream.str();
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
inline const std::string BAD_SUBSCRIPT_WITH_KEY(const char* key) {
|
| 130 |
+
std::stringstream stream;
|
| 131 |
+
stream << BAD_SUBSCRIPT << " (key: \"" << key << "\")";
|
| 132 |
+
return stream.str();
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
template <typename T>
|
| 136 |
+
inline const std::string BAD_SUBSCRIPT_WITH_KEY(
|
| 137 |
+
const T& key, typename enable_if<is_numeric<T>>::type* = nullptr) {
|
| 138 |
+
std::stringstream stream;
|
| 139 |
+
stream << BAD_SUBSCRIPT << " (key: \"" << key << "\")";
|
| 140 |
+
return stream.str();
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
inline const std::string INVALID_NODE_WITH_KEY(const std::string& key) {
|
| 144 |
+
std::stringstream stream;
|
| 145 |
+
if (key.empty()) {
|
| 146 |
+
return INVALID_NODE;
|
| 147 |
+
}
|
| 148 |
+
stream << "invalid node; first invalid key: \"" << key << "\"";
|
| 149 |
+
return stream.str();
|
| 150 |
+
}
|
| 151 |
+
} // namespace ErrorMsg
|
| 152 |
+
|
| 153 |
+
class YAML_CPP_API Exception : public std::runtime_error {
|
| 154 |
+
public:
|
| 155 |
+
Exception(const Mark& mark_, const std::string& msg_)
|
| 156 |
+
: std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}
|
| 157 |
+
~Exception() YAML_CPP_NOEXCEPT override;
|
| 158 |
+
|
| 159 |
+
Exception(const Exception&) = default;
|
| 160 |
+
|
| 161 |
+
Mark mark;
|
| 162 |
+
std::string msg;
|
| 163 |
+
|
| 164 |
+
private:
|
| 165 |
+
static const std::string build_what(const Mark& mark,
|
| 166 |
+
const std::string& msg) {
|
| 167 |
+
if (mark.is_null()) {
|
| 168 |
+
return msg;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
std::stringstream output;
|
| 172 |
+
output << "yaml-cpp: error at line " << mark.line + 1 << ", column "
|
| 173 |
+
<< mark.column + 1 << ": " << msg;
|
| 174 |
+
return output.str();
|
| 175 |
+
}
|
| 176 |
+
};
|
| 177 |
+
|
| 178 |
+
class YAML_CPP_API ParserException : public Exception {
|
| 179 |
+
public:
|
| 180 |
+
ParserException(const Mark& mark_, const std::string& msg_)
|
| 181 |
+
: Exception(mark_, msg_) {}
|
| 182 |
+
ParserException(const ParserException&) = default;
|
| 183 |
+
~ParserException() YAML_CPP_NOEXCEPT override;
|
| 184 |
+
};
|
| 185 |
+
|
| 186 |
+
class YAML_CPP_API RepresentationException : public Exception {
|
| 187 |
+
public:
|
| 188 |
+
RepresentationException(const Mark& mark_, const std::string& msg_)
|
| 189 |
+
: Exception(mark_, msg_) {}
|
| 190 |
+
RepresentationException(const RepresentationException&) = default;
|
| 191 |
+
~RepresentationException() YAML_CPP_NOEXCEPT override;
|
| 192 |
+
};
|
| 193 |
+
|
| 194 |
+
// representation exceptions
|
| 195 |
+
class YAML_CPP_API InvalidScalar : public RepresentationException {
|
| 196 |
+
public:
|
| 197 |
+
InvalidScalar(const Mark& mark_)
|
| 198 |
+
: RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {}
|
| 199 |
+
InvalidScalar(const InvalidScalar&) = default;
|
| 200 |
+
~InvalidScalar() YAML_CPP_NOEXCEPT override;
|
| 201 |
+
};
|
| 202 |
+
|
| 203 |
+
class YAML_CPP_API KeyNotFound : public RepresentationException {
|
| 204 |
+
public:
|
| 205 |
+
template <typename T>
|
| 206 |
+
KeyNotFound(const Mark& mark_, const T& key_)
|
| 207 |
+
: RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) {
|
| 208 |
+
}
|
| 209 |
+
KeyNotFound(const KeyNotFound&) = default;
|
| 210 |
+
~KeyNotFound() YAML_CPP_NOEXCEPT override;
|
| 211 |
+
};
|
| 212 |
+
|
| 213 |
+
template <typename T>
|
| 214 |
+
class YAML_CPP_API TypedKeyNotFound : public KeyNotFound {
|
| 215 |
+
public:
|
| 216 |
+
TypedKeyNotFound(const Mark& mark_, const T& key_)
|
| 217 |
+
: KeyNotFound(mark_, key_), key(key_) {}
|
| 218 |
+
~TypedKeyNotFound() YAML_CPP_NOEXCEPT override = default;
|
| 219 |
+
|
| 220 |
+
T key;
|
| 221 |
+
};
|
| 222 |
+
|
| 223 |
+
template <typename T>
|
| 224 |
+
inline TypedKeyNotFound<T> MakeTypedKeyNotFound(const Mark& mark,
|
| 225 |
+
const T& key) {
|
| 226 |
+
return TypedKeyNotFound<T>(mark, key);
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
class YAML_CPP_API InvalidNode : public RepresentationException {
|
| 230 |
+
public:
|
| 231 |
+
InvalidNode(const std::string& key)
|
| 232 |
+
: RepresentationException(Mark::null_mark(),
|
| 233 |
+
ErrorMsg::INVALID_NODE_WITH_KEY(key)) {}
|
| 234 |
+
InvalidNode(const InvalidNode&) = default;
|
| 235 |
+
~InvalidNode() YAML_CPP_NOEXCEPT override;
|
| 236 |
+
};
|
| 237 |
+
|
| 238 |
+
class YAML_CPP_API BadConversion : public RepresentationException {
|
| 239 |
+
public:
|
| 240 |
+
explicit BadConversion(const Mark& mark_)
|
| 241 |
+
: RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {}
|
| 242 |
+
BadConversion(const BadConversion&) = default;
|
| 243 |
+
~BadConversion() YAML_CPP_NOEXCEPT override;
|
| 244 |
+
};
|
| 245 |
+
|
| 246 |
+
template <typename T>
|
| 247 |
+
class TypedBadConversion : public BadConversion {
|
| 248 |
+
public:
|
| 249 |
+
explicit TypedBadConversion(const Mark& mark_) : BadConversion(mark_) {}
|
| 250 |
+
};
|
| 251 |
+
|
| 252 |
+
class YAML_CPP_API BadDereference : public RepresentationException {
|
| 253 |
+
public:
|
| 254 |
+
BadDereference()
|
| 255 |
+
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {}
|
| 256 |
+
BadDereference(const BadDereference&) = default;
|
| 257 |
+
~BadDereference() YAML_CPP_NOEXCEPT override;
|
| 258 |
+
};
|
| 259 |
+
|
| 260 |
+
class YAML_CPP_API BadSubscript : public RepresentationException {
|
| 261 |
+
public:
|
| 262 |
+
template <typename Key>
|
| 263 |
+
BadSubscript(const Mark& mark_, const Key& key)
|
| 264 |
+
: RepresentationException(mark_, ErrorMsg::BAD_SUBSCRIPT_WITH_KEY(key)) {}
|
| 265 |
+
BadSubscript(const BadSubscript&) = default;
|
| 266 |
+
~BadSubscript() YAML_CPP_NOEXCEPT override;
|
| 267 |
+
};
|
| 268 |
+
|
| 269 |
+
class YAML_CPP_API BadPushback : public RepresentationException {
|
| 270 |
+
public:
|
| 271 |
+
BadPushback()
|
| 272 |
+
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {}
|
| 273 |
+
BadPushback(const BadPushback&) = default;
|
| 274 |
+
~BadPushback() YAML_CPP_NOEXCEPT override;
|
| 275 |
+
};
|
| 276 |
+
|
| 277 |
+
class YAML_CPP_API BadInsert : public RepresentationException {
|
| 278 |
+
public:
|
| 279 |
+
BadInsert()
|
| 280 |
+
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {}
|
| 281 |
+
BadInsert(const BadInsert&) = default;
|
| 282 |
+
~BadInsert() YAML_CPP_NOEXCEPT override;
|
| 283 |
+
};
|
| 284 |
+
|
| 285 |
+
class YAML_CPP_API EmitterException : public Exception {
|
| 286 |
+
public:
|
| 287 |
+
EmitterException(const std::string& msg_)
|
| 288 |
+
: Exception(Mark::null_mark(), msg_) {}
|
| 289 |
+
EmitterException(const EmitterException&) = default;
|
| 290 |
+
~EmitterException() YAML_CPP_NOEXCEPT override;
|
| 291 |
+
};
|
| 292 |
+
|
| 293 |
+
class YAML_CPP_API BadFile : public Exception {
|
| 294 |
+
public:
|
| 295 |
+
explicit BadFile(const std::string& filename)
|
| 296 |
+
: Exception(Mark::null_mark(),
|
| 297 |
+
std::string(ErrorMsg::BAD_FILE) + ": " + filename) {}
|
| 298 |
+
BadFile(const BadFile&) = default;
|
| 299 |
+
~BadFile() YAML_CPP_NOEXCEPT override;
|
| 300 |
+
};
|
| 301 |
+
} // namespace YAML
|
| 302 |
+
|
| 303 |
+
#endif // EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/mark.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include "yaml-cpp/dll.h"
|
| 11 |
+
|
| 12 |
+
namespace YAML {
|
| 13 |
+
struct YAML_CPP_API Mark {
|
| 14 |
+
Mark() : pos(0), line(0), column(0) {}
|
| 15 |
+
|
| 16 |
+
static const Mark null_mark() { return Mark(-1, -1, -1); }
|
| 17 |
+
|
| 18 |
+
bool is_null() const { return pos == -1 && line == -1 && column == -1; }
|
| 19 |
+
|
| 20 |
+
int pos;
|
| 21 |
+
int line, column;
|
| 22 |
+
|
| 23 |
+
private:
|
| 24 |
+
Mark(int pos_, int line_, int column_)
|
| 25 |
+
: pos(pos_), line(line_), column(column_) {}
|
| 26 |
+
};
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
#endif // MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/convert.h
ADDED
|
@@ -0,0 +1,469 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <array>
|
| 11 |
+
#include <cmath>
|
| 12 |
+
#include <limits>
|
| 13 |
+
#include <list>
|
| 14 |
+
#include <map>
|
| 15 |
+
#include <unordered_map>
|
| 16 |
+
#include <sstream>
|
| 17 |
+
#include <type_traits>
|
| 18 |
+
#include <valarray>
|
| 19 |
+
#include <vector>
|
| 20 |
+
|
| 21 |
+
#if __cplusplus >= 201703L
|
| 22 |
+
#include <string_view>
|
| 23 |
+
#endif
|
| 24 |
+
|
| 25 |
+
#include "yaml-cpp/binary.h"
|
| 26 |
+
#include "yaml-cpp/node/impl.h"
|
| 27 |
+
#include "yaml-cpp/node/iterator.h"
|
| 28 |
+
#include "yaml-cpp/node/node.h"
|
| 29 |
+
#include "yaml-cpp/node/type.h"
|
| 30 |
+
#include "yaml-cpp/null.h"
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
namespace YAML {
|
| 34 |
+
class Binary;
|
| 35 |
+
struct _Null;
|
| 36 |
+
template <typename T>
|
| 37 |
+
struct convert;
|
| 38 |
+
} // namespace YAML
|
| 39 |
+
|
| 40 |
+
namespace YAML {
|
| 41 |
+
namespace conversion {
|
| 42 |
+
inline bool IsInfinity(const std::string& input) {
|
| 43 |
+
return input == ".inf" || input == ".Inf" || input == ".INF" ||
|
| 44 |
+
input == "+.inf" || input == "+.Inf" || input == "+.INF";
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
inline bool IsNegativeInfinity(const std::string& input) {
|
| 48 |
+
return input == "-.inf" || input == "-.Inf" || input == "-.INF";
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
inline bool IsNaN(const std::string& input) {
|
| 52 |
+
return input == ".nan" || input == ".NaN" || input == ".NAN";
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
// Node
|
| 57 |
+
template <>
|
| 58 |
+
struct convert<Node> {
|
| 59 |
+
static Node encode(const Node& rhs) { return rhs; }
|
| 60 |
+
|
| 61 |
+
static bool decode(const Node& node, Node& rhs) {
|
| 62 |
+
rhs.reset(node);
|
| 63 |
+
return true;
|
| 64 |
+
}
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
// std::string
|
| 68 |
+
template <>
|
| 69 |
+
struct convert<std::string> {
|
| 70 |
+
static Node encode(const std::string& rhs) { return Node(rhs); }
|
| 71 |
+
|
| 72 |
+
static bool decode(const Node& node, std::string& rhs) {
|
| 73 |
+
if (!node.IsScalar())
|
| 74 |
+
return false;
|
| 75 |
+
rhs = node.Scalar();
|
| 76 |
+
return true;
|
| 77 |
+
}
|
| 78 |
+
};
|
| 79 |
+
|
| 80 |
+
// C-strings can only be encoded
|
| 81 |
+
template <>
|
| 82 |
+
struct convert<const char*> {
|
| 83 |
+
static Node encode(const char* rhs) { return Node(rhs); }
|
| 84 |
+
};
|
| 85 |
+
|
| 86 |
+
template <>
|
| 87 |
+
struct convert<char*> {
|
| 88 |
+
static Node encode(const char* rhs) { return Node(rhs); }
|
| 89 |
+
};
|
| 90 |
+
|
| 91 |
+
template <std::size_t N>
|
| 92 |
+
struct convert<char[N]> {
|
| 93 |
+
static Node encode(const char* rhs) { return Node(rhs); }
|
| 94 |
+
};
|
| 95 |
+
|
| 96 |
+
#if __cplusplus >= 201703L
|
| 97 |
+
template <>
|
| 98 |
+
struct convert<std::string_view> {
|
| 99 |
+
static Node encode(std::string_view rhs) { return Node(std::string(rhs)); }
|
| 100 |
+
|
| 101 |
+
static bool decode(const Node& node, std::string_view& rhs) {
|
| 102 |
+
if (!node.IsScalar())
|
| 103 |
+
return false;
|
| 104 |
+
rhs = node.Scalar();
|
| 105 |
+
return true;
|
| 106 |
+
}
|
| 107 |
+
};
|
| 108 |
+
#endif
|
| 109 |
+
|
| 110 |
+
template <>
|
| 111 |
+
struct convert<_Null> {
|
| 112 |
+
static Node encode(const _Null& /* rhs */) { return Node(); }
|
| 113 |
+
|
| 114 |
+
static bool decode(const Node& node, _Null& /* rhs */) {
|
| 115 |
+
return node.IsNull();
|
| 116 |
+
}
|
| 117 |
+
};
|
| 118 |
+
|
| 119 |
+
namespace conversion {
|
| 120 |
+
template <typename T>
|
| 121 |
+
typename std::enable_if< std::is_floating_point<T>::value, void>::type
|
| 122 |
+
inner_encode(const T& rhs, std::stringstream& stream){
|
| 123 |
+
if (std::isnan(rhs)) {
|
| 124 |
+
stream << ".nan";
|
| 125 |
+
} else if (std::isinf(rhs)) {
|
| 126 |
+
if (std::signbit(rhs)) {
|
| 127 |
+
stream << "-.inf";
|
| 128 |
+
} else {
|
| 129 |
+
stream << ".inf";
|
| 130 |
+
}
|
| 131 |
+
} else {
|
| 132 |
+
stream << rhs;
|
| 133 |
+
}
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
template <typename T>
|
| 137 |
+
typename std::enable_if<!std::is_floating_point<T>::value, void>::type
|
| 138 |
+
inner_encode(const T& rhs, std::stringstream& stream){
|
| 139 |
+
stream << rhs;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
template <typename T>
|
| 143 |
+
typename std::enable_if<(std::is_same<T, unsigned char>::value ||
|
| 144 |
+
std::is_same<T, signed char>::value), bool>::type
|
| 145 |
+
ConvertStreamTo(std::stringstream& stream, T& rhs) {
|
| 146 |
+
int num;
|
| 147 |
+
if ((stream >> std::noskipws >> num) && (stream >> std::ws).eof()) {
|
| 148 |
+
if (num >= (std::numeric_limits<T>::min)() &&
|
| 149 |
+
num <= (std::numeric_limits<T>::max)()) {
|
| 150 |
+
rhs = static_cast<T>(num);
|
| 151 |
+
return true;
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
return false;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
template <typename T>
|
| 158 |
+
typename std::enable_if<!(std::is_same<T, unsigned char>::value ||
|
| 159 |
+
std::is_same<T, signed char>::value), bool>::type
|
| 160 |
+
ConvertStreamTo(std::stringstream& stream, T& rhs) {
|
| 161 |
+
if ((stream >> std::noskipws >> rhs) && (stream >> std::ws).eof()) {
|
| 162 |
+
return true;
|
| 163 |
+
}
|
| 164 |
+
return false;
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
#define YAML_DEFINE_CONVERT_STREAMABLE(type, negative_op) \
|
| 169 |
+
template <> \
|
| 170 |
+
struct convert<type> { \
|
| 171 |
+
\
|
| 172 |
+
static Node encode(const type& rhs) { \
|
| 173 |
+
std::stringstream stream; \
|
| 174 |
+
stream.precision(std::numeric_limits<type>::max_digits10); \
|
| 175 |
+
conversion::inner_encode(rhs, stream); \
|
| 176 |
+
return Node(stream.str()); \
|
| 177 |
+
} \
|
| 178 |
+
\
|
| 179 |
+
static bool decode(const Node& node, type& rhs) { \
|
| 180 |
+
if (node.Type() != NodeType::Scalar) { \
|
| 181 |
+
return false; \
|
| 182 |
+
} \
|
| 183 |
+
const std::string& input = node.Scalar(); \
|
| 184 |
+
std::stringstream stream(input); \
|
| 185 |
+
stream.unsetf(std::ios::dec); \
|
| 186 |
+
if ((stream.peek() == '-') && std::is_unsigned<type>::value) { \
|
| 187 |
+
return false; \
|
| 188 |
+
} \
|
| 189 |
+
if (conversion::ConvertStreamTo(stream, rhs)) { \
|
| 190 |
+
return true; \
|
| 191 |
+
} \
|
| 192 |
+
if (std::numeric_limits<type>::has_infinity) { \
|
| 193 |
+
if (conversion::IsInfinity(input)) { \
|
| 194 |
+
rhs = std::numeric_limits<type>::infinity(); \
|
| 195 |
+
return true; \
|
| 196 |
+
} else if (conversion::IsNegativeInfinity(input)) { \
|
| 197 |
+
rhs = negative_op std::numeric_limits<type>::infinity(); \
|
| 198 |
+
return true; \
|
| 199 |
+
} \
|
| 200 |
+
} \
|
| 201 |
+
\
|
| 202 |
+
if (std::numeric_limits<type>::has_quiet_NaN) { \
|
| 203 |
+
if (conversion::IsNaN(input)) { \
|
| 204 |
+
rhs = std::numeric_limits<type>::quiet_NaN(); \
|
| 205 |
+
return true; \
|
| 206 |
+
} \
|
| 207 |
+
} \
|
| 208 |
+
\
|
| 209 |
+
return false; \
|
| 210 |
+
} \
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
#define YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(type) \
|
| 214 |
+
YAML_DEFINE_CONVERT_STREAMABLE(type, -)
|
| 215 |
+
|
| 216 |
+
#define YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(type) \
|
| 217 |
+
YAML_DEFINE_CONVERT_STREAMABLE(type, +)
|
| 218 |
+
|
| 219 |
+
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(int);
|
| 220 |
+
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(short);
|
| 221 |
+
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long);
|
| 222 |
+
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long long);
|
| 223 |
+
YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned);
|
| 224 |
+
YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned short);
|
| 225 |
+
YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long);
|
| 226 |
+
YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long long);
|
| 227 |
+
|
| 228 |
+
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(char);
|
| 229 |
+
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(signed char);
|
| 230 |
+
YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned char);
|
| 231 |
+
|
| 232 |
+
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(float);
|
| 233 |
+
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(double);
|
| 234 |
+
YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long double);
|
| 235 |
+
|
| 236 |
+
#undef YAML_DEFINE_CONVERT_STREAMABLE_SIGNED
|
| 237 |
+
#undef YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED
|
| 238 |
+
#undef YAML_DEFINE_CONVERT_STREAMABLE
|
| 239 |
+
|
| 240 |
+
// bool
|
| 241 |
+
template <>
|
| 242 |
+
struct convert<bool> {
|
| 243 |
+
static Node encode(bool rhs) { return rhs ? Node("true") : Node("false"); }
|
| 244 |
+
|
| 245 |
+
YAML_CPP_API static bool decode(const Node& node, bool& rhs);
|
| 246 |
+
};
|
| 247 |
+
|
| 248 |
+
// std::map
|
| 249 |
+
template <typename K, typename V, typename C, typename A>
|
| 250 |
+
struct convert<std::map<K, V, C, A>> {
|
| 251 |
+
static Node encode(const std::map<K, V, C, A>& rhs) {
|
| 252 |
+
Node node(NodeType::Map);
|
| 253 |
+
for (const auto& element : rhs)
|
| 254 |
+
node.force_insert(element.first, element.second);
|
| 255 |
+
return node;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
static bool decode(const Node& node, std::map<K, V, C, A>& rhs) {
|
| 259 |
+
if (!node.IsMap())
|
| 260 |
+
return false;
|
| 261 |
+
|
| 262 |
+
rhs.clear();
|
| 263 |
+
for (const auto& element : node)
|
| 264 |
+
#if defined(__GNUC__) && __GNUC__ < 4
|
| 265 |
+
// workaround for GCC 3:
|
| 266 |
+
rhs[element.first.template as<K>()] = element.second.template as<V>();
|
| 267 |
+
#else
|
| 268 |
+
rhs[element.first.as<K>()] = element.second.as<V>();
|
| 269 |
+
#endif
|
| 270 |
+
return true;
|
| 271 |
+
}
|
| 272 |
+
};
|
| 273 |
+
|
| 274 |
+
// std::unordered_map
|
| 275 |
+
template <typename K, typename V, typename H, typename P, typename A>
|
| 276 |
+
struct convert<std::unordered_map<K, V, H, P, A>> {
|
| 277 |
+
static Node encode(const std::unordered_map<K, V, H, P, A>& rhs) {
|
| 278 |
+
Node node(NodeType::Map);
|
| 279 |
+
for (const auto& element : rhs)
|
| 280 |
+
node.force_insert(element.first, element.second);
|
| 281 |
+
return node;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
static bool decode(const Node& node, std::unordered_map<K, V, H, P, A>& rhs) {
|
| 285 |
+
if (!node.IsMap())
|
| 286 |
+
return false;
|
| 287 |
+
|
| 288 |
+
rhs.clear();
|
| 289 |
+
for (const auto& element : node)
|
| 290 |
+
#if defined(__GNUC__) && __GNUC__ < 4
|
| 291 |
+
// workaround for GCC 3:
|
| 292 |
+
rhs[element.first.template as<K>()] = element.second.template as<V>();
|
| 293 |
+
#else
|
| 294 |
+
rhs[element.first.as<K>()] = element.second.as<V>();
|
| 295 |
+
#endif
|
| 296 |
+
return true;
|
| 297 |
+
}
|
| 298 |
+
};
|
| 299 |
+
|
| 300 |
+
// std::vector
|
| 301 |
+
template <typename T, typename A>
|
| 302 |
+
struct convert<std::vector<T, A>> {
|
| 303 |
+
static Node encode(const std::vector<T, A>& rhs) {
|
| 304 |
+
Node node(NodeType::Sequence);
|
| 305 |
+
for (const auto& element : rhs)
|
| 306 |
+
node.push_back(element);
|
| 307 |
+
return node;
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
static bool decode(const Node& node, std::vector<T, A>& rhs) {
|
| 311 |
+
if (!node.IsSequence())
|
| 312 |
+
return false;
|
| 313 |
+
|
| 314 |
+
rhs.clear();
|
| 315 |
+
for (const auto& element : node)
|
| 316 |
+
#if defined(__GNUC__) && __GNUC__ < 4
|
| 317 |
+
// workaround for GCC 3:
|
| 318 |
+
rhs.push_back(element.template as<T>());
|
| 319 |
+
#else
|
| 320 |
+
rhs.push_back(element.as<T>());
|
| 321 |
+
#endif
|
| 322 |
+
return true;
|
| 323 |
+
}
|
| 324 |
+
};
|
| 325 |
+
|
| 326 |
+
// std::list
|
| 327 |
+
template <typename T, typename A>
|
| 328 |
+
struct convert<std::list<T,A>> {
|
| 329 |
+
static Node encode(const std::list<T,A>& rhs) {
|
| 330 |
+
Node node(NodeType::Sequence);
|
| 331 |
+
for (const auto& element : rhs)
|
| 332 |
+
node.push_back(element);
|
| 333 |
+
return node;
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
static bool decode(const Node& node, std::list<T,A>& rhs) {
|
| 337 |
+
if (!node.IsSequence())
|
| 338 |
+
return false;
|
| 339 |
+
|
| 340 |
+
rhs.clear();
|
| 341 |
+
for (const auto& element : node)
|
| 342 |
+
#if defined(__GNUC__) && __GNUC__ < 4
|
| 343 |
+
// workaround for GCC 3:
|
| 344 |
+
rhs.push_back(element.template as<T>());
|
| 345 |
+
#else
|
| 346 |
+
rhs.push_back(element.as<T>());
|
| 347 |
+
#endif
|
| 348 |
+
return true;
|
| 349 |
+
}
|
| 350 |
+
};
|
| 351 |
+
|
| 352 |
+
// std::array
|
| 353 |
+
template <typename T, std::size_t N>
|
| 354 |
+
struct convert<std::array<T, N>> {
|
| 355 |
+
static Node encode(const std::array<T, N>& rhs) {
|
| 356 |
+
Node node(NodeType::Sequence);
|
| 357 |
+
for (const auto& element : rhs) {
|
| 358 |
+
node.push_back(element);
|
| 359 |
+
}
|
| 360 |
+
return node;
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
static bool decode(const Node& node, std::array<T, N>& rhs) {
|
| 364 |
+
if (!isNodeValid(node)) {
|
| 365 |
+
return false;
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
for (auto i = 0u; i < node.size(); ++i) {
|
| 369 |
+
#if defined(__GNUC__) && __GNUC__ < 4
|
| 370 |
+
// workaround for GCC 3:
|
| 371 |
+
rhs[i] = node[i].template as<T>();
|
| 372 |
+
#else
|
| 373 |
+
rhs[i] = node[i].as<T>();
|
| 374 |
+
#endif
|
| 375 |
+
}
|
| 376 |
+
return true;
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
private:
|
| 380 |
+
static bool isNodeValid(const Node& node) {
|
| 381 |
+
return node.IsSequence() && node.size() == N;
|
| 382 |
+
}
|
| 383 |
+
};
|
| 384 |
+
|
| 385 |
+
|
| 386 |
+
// std::valarray
|
| 387 |
+
template <typename T>
|
| 388 |
+
struct convert<std::valarray<T>> {
|
| 389 |
+
static Node encode(const std::valarray<T>& rhs) {
|
| 390 |
+
Node node(NodeType::Sequence);
|
| 391 |
+
for (const auto& element : rhs) {
|
| 392 |
+
node.push_back(element);
|
| 393 |
+
}
|
| 394 |
+
return node;
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
static bool decode(const Node& node, std::valarray<T>& rhs) {
|
| 398 |
+
if (!node.IsSequence()) {
|
| 399 |
+
return false;
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
rhs.resize(node.size());
|
| 403 |
+
for (auto i = 0u; i < node.size(); ++i) {
|
| 404 |
+
#if defined(__GNUC__) && __GNUC__ < 4
|
| 405 |
+
// workaround for GCC 3:
|
| 406 |
+
rhs[i] = node[i].template as<T>();
|
| 407 |
+
#else
|
| 408 |
+
rhs[i] = node[i].as<T>();
|
| 409 |
+
#endif
|
| 410 |
+
}
|
| 411 |
+
return true;
|
| 412 |
+
}
|
| 413 |
+
};
|
| 414 |
+
|
| 415 |
+
|
| 416 |
+
// std::pair
|
| 417 |
+
template <typename T, typename U>
|
| 418 |
+
struct convert<std::pair<T, U>> {
|
| 419 |
+
static Node encode(const std::pair<T, U>& rhs) {
|
| 420 |
+
Node node(NodeType::Sequence);
|
| 421 |
+
node.push_back(rhs.first);
|
| 422 |
+
node.push_back(rhs.second);
|
| 423 |
+
return node;
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
static bool decode(const Node& node, std::pair<T, U>& rhs) {
|
| 427 |
+
if (!node.IsSequence())
|
| 428 |
+
return false;
|
| 429 |
+
if (node.size() != 2)
|
| 430 |
+
return false;
|
| 431 |
+
|
| 432 |
+
#if defined(__GNUC__) && __GNUC__ < 4
|
| 433 |
+
// workaround for GCC 3:
|
| 434 |
+
rhs.first = node[0].template as<T>();
|
| 435 |
+
#else
|
| 436 |
+
rhs.first = node[0].as<T>();
|
| 437 |
+
#endif
|
| 438 |
+
#if defined(__GNUC__) && __GNUC__ < 4
|
| 439 |
+
// workaround for GCC 3:
|
| 440 |
+
rhs.second = node[1].template as<U>();
|
| 441 |
+
#else
|
| 442 |
+
rhs.second = node[1].as<U>();
|
| 443 |
+
#endif
|
| 444 |
+
return true;
|
| 445 |
+
}
|
| 446 |
+
};
|
| 447 |
+
|
| 448 |
+
// binary
|
| 449 |
+
template <>
|
| 450 |
+
struct convert<Binary> {
|
| 451 |
+
static Node encode(const Binary& rhs) {
|
| 452 |
+
return Node(EncodeBase64(rhs.data(), rhs.size()));
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
static bool decode(const Node& node, Binary& rhs) {
|
| 456 |
+
if (!node.IsScalar())
|
| 457 |
+
return false;
|
| 458 |
+
|
| 459 |
+
std::vector<unsigned char> data = DecodeBase64(node.Scalar());
|
| 460 |
+
if (data.empty() && !node.Scalar().empty())
|
| 461 |
+
return false;
|
| 462 |
+
|
| 463 |
+
rhs.swap(data);
|
| 464 |
+
return true;
|
| 465 |
+
}
|
| 466 |
+
};
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
#endif // NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/detail/iterator.h
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include "yaml-cpp/dll.h"
|
| 11 |
+
#include "yaml-cpp/node/detail/node_iterator.h"
|
| 12 |
+
#include "yaml-cpp/node/node.h"
|
| 13 |
+
#include "yaml-cpp/node/ptr.h"
|
| 14 |
+
#include <cstddef>
|
| 15 |
+
#include <iterator>
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
namespace YAML {
|
| 19 |
+
namespace detail {
|
| 20 |
+
struct iterator_value;
|
| 21 |
+
|
| 22 |
+
template <typename V>
|
| 23 |
+
class iterator_base {
|
| 24 |
+
|
| 25 |
+
private:
|
| 26 |
+
template <typename>
|
| 27 |
+
friend class iterator_base;
|
| 28 |
+
struct enabler {};
|
| 29 |
+
using base_type = node_iterator;
|
| 30 |
+
|
| 31 |
+
struct proxy {
|
| 32 |
+
explicit proxy(const V& x) : m_ref(x) {}
|
| 33 |
+
V* operator->() { return std::addressof(m_ref); }
|
| 34 |
+
operator V*() { return std::addressof(m_ref); }
|
| 35 |
+
|
| 36 |
+
V m_ref;
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
public:
|
| 40 |
+
using iterator_category = std::forward_iterator_tag;
|
| 41 |
+
using value_type = V;
|
| 42 |
+
using difference_type = std::ptrdiff_t;
|
| 43 |
+
using pointer = V*;
|
| 44 |
+
using reference = V;
|
| 45 |
+
|
| 46 |
+
public:
|
| 47 |
+
iterator_base() : m_iterator(), m_pMemory() {}
|
| 48 |
+
explicit iterator_base(base_type rhs, shared_memory_holder pMemory)
|
| 49 |
+
: m_iterator(rhs), m_pMemory(pMemory) {}
|
| 50 |
+
|
| 51 |
+
template <class W>
|
| 52 |
+
iterator_base(const iterator_base<W>& rhs,
|
| 53 |
+
typename std::enable_if<std::is_convertible<W*, V*>::value,
|
| 54 |
+
enabler>::type = enabler())
|
| 55 |
+
: m_iterator(rhs.m_iterator), m_pMemory(rhs.m_pMemory) {}
|
| 56 |
+
|
| 57 |
+
iterator_base<V>& operator++() {
|
| 58 |
+
++m_iterator;
|
| 59 |
+
return *this;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
iterator_base<V> operator++(int) {
|
| 63 |
+
iterator_base<V> iterator_pre(*this);
|
| 64 |
+
++(*this);
|
| 65 |
+
return iterator_pre;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
template <typename W>
|
| 69 |
+
bool operator==(const iterator_base<W>& rhs) const {
|
| 70 |
+
return m_iterator == rhs.m_iterator;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
template <typename W>
|
| 74 |
+
bool operator!=(const iterator_base<W>& rhs) const {
|
| 75 |
+
return m_iterator != rhs.m_iterator;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
value_type operator*() const {
|
| 79 |
+
const typename base_type::value_type& v = *m_iterator;
|
| 80 |
+
if (v.pNode)
|
| 81 |
+
return value_type(Node(*v, m_pMemory));
|
| 82 |
+
if (v.first && v.second)
|
| 83 |
+
return value_type(Node(*v.first, m_pMemory), Node(*v.second, m_pMemory));
|
| 84 |
+
return value_type();
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
proxy operator->() const { return proxy(**this); }
|
| 88 |
+
|
| 89 |
+
private:
|
| 90 |
+
base_type m_iterator;
|
| 91 |
+
shared_memory_holder m_pMemory;
|
| 92 |
+
};
|
| 93 |
+
} // namespace detail
|
| 94 |
+
} // namespace YAML
|
| 95 |
+
|
| 96 |
+
#endif // VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/detail/node.h
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include "yaml-cpp/dll.h"
|
| 11 |
+
#include "yaml-cpp/emitterstyle.h"
|
| 12 |
+
#include "yaml-cpp/node/detail/node_ref.h"
|
| 13 |
+
#include "yaml-cpp/node/ptr.h"
|
| 14 |
+
#include "yaml-cpp/node/type.h"
|
| 15 |
+
#include <set>
|
| 16 |
+
#include <atomic>
|
| 17 |
+
|
| 18 |
+
namespace YAML {
|
| 19 |
+
namespace detail {
|
| 20 |
+
class node {
|
| 21 |
+
private:
|
| 22 |
+
struct less {
|
| 23 |
+
bool operator ()(const node* l, const node* r) const {return l->m_index < r->m_index;}
|
| 24 |
+
};
|
| 25 |
+
|
| 26 |
+
public:
|
| 27 |
+
node() : m_pRef(new node_ref), m_dependencies{}, m_index{} {}
|
| 28 |
+
node(const node&) = delete;
|
| 29 |
+
node& operator=(const node&) = delete;
|
| 30 |
+
|
| 31 |
+
bool is(const node& rhs) const { return m_pRef == rhs.m_pRef; }
|
| 32 |
+
const node_ref* ref() const { return m_pRef.get(); }
|
| 33 |
+
|
| 34 |
+
bool is_defined() const { return m_pRef->is_defined(); }
|
| 35 |
+
const Mark& mark() const { return m_pRef->mark(); }
|
| 36 |
+
NodeType::value type() const { return m_pRef->type(); }
|
| 37 |
+
|
| 38 |
+
const std::string& scalar() const { return m_pRef->scalar(); }
|
| 39 |
+
const std::string& tag() const { return m_pRef->tag(); }
|
| 40 |
+
EmitterStyle::value style() const { return m_pRef->style(); }
|
| 41 |
+
|
| 42 |
+
template <typename T>
|
| 43 |
+
bool equals(const T& rhs, shared_memory_holder pMemory);
|
| 44 |
+
bool equals(const char* rhs, shared_memory_holder pMemory);
|
| 45 |
+
|
| 46 |
+
void mark_defined() {
|
| 47 |
+
if (is_defined())
|
| 48 |
+
return;
|
| 49 |
+
|
| 50 |
+
m_pRef->mark_defined();
|
| 51 |
+
for (node* dependency : m_dependencies)
|
| 52 |
+
dependency->mark_defined();
|
| 53 |
+
m_dependencies.clear();
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
void add_dependency(node& rhs) {
|
| 57 |
+
if (is_defined())
|
| 58 |
+
rhs.mark_defined();
|
| 59 |
+
else
|
| 60 |
+
m_dependencies.insert(&rhs);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
void set_ref(const node& rhs) {
|
| 64 |
+
if (rhs.is_defined())
|
| 65 |
+
mark_defined();
|
| 66 |
+
m_pRef = rhs.m_pRef;
|
| 67 |
+
}
|
| 68 |
+
void set_data(const node& rhs) {
|
| 69 |
+
if (rhs.is_defined())
|
| 70 |
+
mark_defined();
|
| 71 |
+
m_pRef->set_data(*rhs.m_pRef);
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
void set_mark(const Mark& mark) { m_pRef->set_mark(mark); }
|
| 75 |
+
|
| 76 |
+
void set_type(NodeType::value type) {
|
| 77 |
+
if (type != NodeType::Undefined)
|
| 78 |
+
mark_defined();
|
| 79 |
+
m_pRef->set_type(type);
|
| 80 |
+
}
|
| 81 |
+
void set_null() {
|
| 82 |
+
mark_defined();
|
| 83 |
+
m_pRef->set_null();
|
| 84 |
+
}
|
| 85 |
+
void set_scalar(const std::string& scalar) {
|
| 86 |
+
mark_defined();
|
| 87 |
+
m_pRef->set_scalar(scalar);
|
| 88 |
+
}
|
| 89 |
+
void set_tag(const std::string& tag) {
|
| 90 |
+
mark_defined();
|
| 91 |
+
m_pRef->set_tag(tag);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
// style
|
| 95 |
+
void set_style(EmitterStyle::value style) {
|
| 96 |
+
mark_defined();
|
| 97 |
+
m_pRef->set_style(style);
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
// size/iterator
|
| 101 |
+
std::size_t size() const { return m_pRef->size(); }
|
| 102 |
+
|
| 103 |
+
const_node_iterator begin() const {
|
| 104 |
+
return static_cast<const node_ref&>(*m_pRef).begin();
|
| 105 |
+
}
|
| 106 |
+
node_iterator begin() { return m_pRef->begin(); }
|
| 107 |
+
|
| 108 |
+
const_node_iterator end() const {
|
| 109 |
+
return static_cast<const node_ref&>(*m_pRef).end();
|
| 110 |
+
}
|
| 111 |
+
node_iterator end() { return m_pRef->end(); }
|
| 112 |
+
|
| 113 |
+
// sequence
|
| 114 |
+
void push_back(node& input, shared_memory_holder pMemory) {
|
| 115 |
+
m_pRef->push_back(input, pMemory);
|
| 116 |
+
input.add_dependency(*this);
|
| 117 |
+
m_index = m_amount.fetch_add(1);
|
| 118 |
+
}
|
| 119 |
+
void insert(node& key, node& value, shared_memory_holder pMemory) {
|
| 120 |
+
m_pRef->insert(key, value, pMemory);
|
| 121 |
+
key.add_dependency(*this);
|
| 122 |
+
value.add_dependency(*this);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
// indexing
|
| 126 |
+
template <typename Key>
|
| 127 |
+
node* get(const Key& key, shared_memory_holder pMemory) const {
|
| 128 |
+
// NOTE: this returns a non-const node so that the top-level Node can wrap
|
| 129 |
+
// it, and returns a pointer so that it can be nullptr (if there is no such
|
| 130 |
+
// key).
|
| 131 |
+
return static_cast<const node_ref&>(*m_pRef).get(key, pMemory);
|
| 132 |
+
}
|
| 133 |
+
template <typename Key>
|
| 134 |
+
node& get(const Key& key, shared_memory_holder pMemory) {
|
| 135 |
+
node& value = m_pRef->get(key, pMemory);
|
| 136 |
+
value.add_dependency(*this);
|
| 137 |
+
return value;
|
| 138 |
+
}
|
| 139 |
+
template <typename Key>
|
| 140 |
+
bool remove(const Key& key, shared_memory_holder pMemory) {
|
| 141 |
+
return m_pRef->remove(key, pMemory);
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
node* get(node& key, shared_memory_holder pMemory) const {
|
| 145 |
+
// NOTE: this returns a non-const node so that the top-level Node can wrap
|
| 146 |
+
// it, and returns a pointer so that it can be nullptr (if there is no such
|
| 147 |
+
// key).
|
| 148 |
+
return static_cast<const node_ref&>(*m_pRef).get(key, pMemory);
|
| 149 |
+
}
|
| 150 |
+
node& get(node& key, shared_memory_holder pMemory) {
|
| 151 |
+
node& value = m_pRef->get(key, pMemory);
|
| 152 |
+
key.add_dependency(*this);
|
| 153 |
+
value.add_dependency(*this);
|
| 154 |
+
return value;
|
| 155 |
+
}
|
| 156 |
+
bool remove(node& key, shared_memory_holder pMemory) {
|
| 157 |
+
return m_pRef->remove(key, pMemory);
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
// map
|
| 161 |
+
template <typename Key, typename Value>
|
| 162 |
+
void force_insert(const Key& key, const Value& value,
|
| 163 |
+
shared_memory_holder pMemory) {
|
| 164 |
+
m_pRef->force_insert(key, value, pMemory);
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
private:
|
| 168 |
+
shared_node_ref m_pRef;
|
| 169 |
+
using nodes = std::set<node*, less>;
|
| 170 |
+
nodes m_dependencies;
|
| 171 |
+
size_t m_index;
|
| 172 |
+
static YAML_CPP_API std::atomic<size_t> m_amount;
|
| 173 |
+
};
|
| 174 |
+
} // namespace detail
|
| 175 |
+
} // namespace YAML
|
| 176 |
+
|
| 177 |
+
#endif // NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/detail/node_data.h
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <list>
|
| 11 |
+
#include <map>
|
| 12 |
+
#include <string>
|
| 13 |
+
#include <utility>
|
| 14 |
+
#include <vector>
|
| 15 |
+
|
| 16 |
+
#include "yaml-cpp/dll.h"
|
| 17 |
+
#include "yaml-cpp/node/detail/node_iterator.h"
|
| 18 |
+
#include "yaml-cpp/node/iterator.h"
|
| 19 |
+
#include "yaml-cpp/node/ptr.h"
|
| 20 |
+
#include "yaml-cpp/node/type.h"
|
| 21 |
+
|
| 22 |
+
namespace YAML {
|
| 23 |
+
namespace detail {
|
| 24 |
+
class node;
|
| 25 |
+
} // namespace detail
|
| 26 |
+
} // namespace YAML
|
| 27 |
+
|
| 28 |
+
namespace YAML {
|
| 29 |
+
namespace detail {
|
| 30 |
+
class YAML_CPP_API node_data {
|
| 31 |
+
public:
|
| 32 |
+
node_data();
|
| 33 |
+
node_data(const node_data&) = delete;
|
| 34 |
+
node_data& operator=(const node_data&) = delete;
|
| 35 |
+
|
| 36 |
+
void mark_defined();
|
| 37 |
+
void set_mark(const Mark& mark);
|
| 38 |
+
void set_type(NodeType::value type);
|
| 39 |
+
void set_tag(const std::string& tag);
|
| 40 |
+
void set_null();
|
| 41 |
+
void set_scalar(const std::string& scalar);
|
| 42 |
+
void set_style(EmitterStyle::value style);
|
| 43 |
+
|
| 44 |
+
bool is_defined() const { return m_isDefined; }
|
| 45 |
+
const Mark& mark() const { return m_mark; }
|
| 46 |
+
NodeType::value type() const {
|
| 47 |
+
return m_isDefined ? m_type : NodeType::Undefined;
|
| 48 |
+
}
|
| 49 |
+
const std::string& scalar() const { return m_scalar; }
|
| 50 |
+
const std::string& tag() const { return m_tag; }
|
| 51 |
+
EmitterStyle::value style() const { return m_style; }
|
| 52 |
+
|
| 53 |
+
// size/iterator
|
| 54 |
+
std::size_t size() const;
|
| 55 |
+
|
| 56 |
+
const_node_iterator begin() const;
|
| 57 |
+
node_iterator begin();
|
| 58 |
+
|
| 59 |
+
const_node_iterator end() const;
|
| 60 |
+
node_iterator end();
|
| 61 |
+
|
| 62 |
+
// sequence
|
| 63 |
+
void push_back(node& node, const shared_memory_holder& pMemory);
|
| 64 |
+
void insert(node& key, node& value, const shared_memory_holder& pMemory);
|
| 65 |
+
|
| 66 |
+
// indexing
|
| 67 |
+
template <typename Key>
|
| 68 |
+
node* get(const Key& key, shared_memory_holder pMemory) const;
|
| 69 |
+
template <typename Key>
|
| 70 |
+
node& get(const Key& key, shared_memory_holder pMemory);
|
| 71 |
+
template <typename Key>
|
| 72 |
+
bool remove(const Key& key, shared_memory_holder pMemory);
|
| 73 |
+
|
| 74 |
+
node* get(node& key, const shared_memory_holder& pMemory) const;
|
| 75 |
+
node& get(node& key, const shared_memory_holder& pMemory);
|
| 76 |
+
bool remove(node& key, const shared_memory_holder& pMemory);
|
| 77 |
+
|
| 78 |
+
// map
|
| 79 |
+
template <typename Key, typename Value>
|
| 80 |
+
void force_insert(const Key& key, const Value& value,
|
| 81 |
+
shared_memory_holder pMemory);
|
| 82 |
+
|
| 83 |
+
public:
|
| 84 |
+
static const std::string& empty_scalar();
|
| 85 |
+
|
| 86 |
+
private:
|
| 87 |
+
void compute_seq_size() const;
|
| 88 |
+
void compute_map_size() const;
|
| 89 |
+
|
| 90 |
+
void reset_sequence();
|
| 91 |
+
void reset_map();
|
| 92 |
+
|
| 93 |
+
void insert_map_pair(node& key, node& value);
|
| 94 |
+
void convert_to_map(const shared_memory_holder& pMemory);
|
| 95 |
+
void convert_sequence_to_map(const shared_memory_holder& pMemory);
|
| 96 |
+
|
| 97 |
+
template <typename T>
|
| 98 |
+
static node& convert_to_node(const T& rhs, shared_memory_holder pMemory);
|
| 99 |
+
|
| 100 |
+
private:
|
| 101 |
+
bool m_isDefined;
|
| 102 |
+
Mark m_mark;
|
| 103 |
+
NodeType::value m_type;
|
| 104 |
+
std::string m_tag;
|
| 105 |
+
EmitterStyle::value m_style;
|
| 106 |
+
|
| 107 |
+
// scalar
|
| 108 |
+
std::string m_scalar;
|
| 109 |
+
|
| 110 |
+
// sequence
|
| 111 |
+
using node_seq = std::vector<node *>;
|
| 112 |
+
node_seq m_sequence;
|
| 113 |
+
|
| 114 |
+
mutable std::size_t m_seqSize;
|
| 115 |
+
|
| 116 |
+
// map
|
| 117 |
+
using node_map = std::vector<std::pair<node*, node*>>;
|
| 118 |
+
node_map m_map;
|
| 119 |
+
|
| 120 |
+
using kv_pair = std::pair<node*, node*>;
|
| 121 |
+
using kv_pairs = std::list<kv_pair>;
|
| 122 |
+
mutable kv_pairs m_undefinedPairs;
|
| 123 |
+
};
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
#endif // VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/emit.h
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <string>
|
| 11 |
+
#include <iosfwd>
|
| 12 |
+
|
| 13 |
+
#include "yaml-cpp/dll.h"
|
| 14 |
+
|
| 15 |
+
namespace YAML {
|
| 16 |
+
class Emitter;
|
| 17 |
+
class Node;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Emits the node to the given {@link Emitter}. If there is an error in writing,
|
| 21 |
+
* {@link Emitter#good} will return false.
|
| 22 |
+
*/
|
| 23 |
+
YAML_CPP_API Emitter& operator<<(Emitter& out, const Node& node);
|
| 24 |
+
|
| 25 |
+
/** Emits the node to the given output stream. */
|
| 26 |
+
YAML_CPP_API std::ostream& operator<<(std::ostream& out, const Node& node);
|
| 27 |
+
|
| 28 |
+
/** Converts the node to a YAML string. */
|
| 29 |
+
YAML_CPP_API std::string Dump(const Node& node);
|
| 30 |
+
} // namespace YAML
|
| 31 |
+
|
| 32 |
+
#endif // NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/impl.h
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include "yaml-cpp/exceptions.h"
|
| 11 |
+
#include "yaml-cpp/node/detail/memory.h"
|
| 12 |
+
#include "yaml-cpp/node/detail/node.h"
|
| 13 |
+
#include "yaml-cpp/node/iterator.h"
|
| 14 |
+
#include "yaml-cpp/node/node.h"
|
| 15 |
+
#include <sstream>
|
| 16 |
+
#include <string>
|
| 17 |
+
|
| 18 |
+
namespace YAML {
|
| 19 |
+
inline Node::Node()
|
| 20 |
+
: m_isValid(true), m_invalidKey{}, m_pMemory(nullptr), m_pNode(nullptr) {}
|
| 21 |
+
|
| 22 |
+
inline Node::Node(NodeType::value type)
|
| 23 |
+
: m_isValid(true),
|
| 24 |
+
m_invalidKey{},
|
| 25 |
+
m_pMemory(new detail::memory_holder),
|
| 26 |
+
m_pNode(&m_pMemory->create_node()) {
|
| 27 |
+
m_pNode->set_type(type);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
template <typename T>
|
| 31 |
+
inline Node::Node(const T& rhs)
|
| 32 |
+
: m_isValid(true),
|
| 33 |
+
m_invalidKey{},
|
| 34 |
+
m_pMemory(new detail::memory_holder),
|
| 35 |
+
m_pNode(&m_pMemory->create_node()) {
|
| 36 |
+
Assign(rhs);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
inline Node::Node(const detail::iterator_value& rhs)
|
| 40 |
+
: m_isValid(rhs.m_isValid),
|
| 41 |
+
m_invalidKey(rhs.m_invalidKey),
|
| 42 |
+
m_pMemory(rhs.m_pMemory),
|
| 43 |
+
m_pNode(rhs.m_pNode) {}
|
| 44 |
+
|
| 45 |
+
inline Node::Node(const Node&) = default;
|
| 46 |
+
|
| 47 |
+
inline Node::Node(Zombie)
|
| 48 |
+
: m_isValid(false), m_invalidKey{}, m_pMemory{}, m_pNode(nullptr) {}
|
| 49 |
+
|
| 50 |
+
inline Node::Node(Zombie, const std::string& key)
|
| 51 |
+
: m_isValid(false), m_invalidKey(key), m_pMemory{}, m_pNode(nullptr) {}
|
| 52 |
+
|
| 53 |
+
inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory)
|
| 54 |
+
: m_isValid(true), m_invalidKey{}, m_pMemory(pMemory), m_pNode(&node) {}
|
| 55 |
+
|
| 56 |
+
inline Node::~Node() = default;
|
| 57 |
+
|
| 58 |
+
inline void Node::EnsureNodeExists() const {
|
| 59 |
+
if (!m_isValid)
|
| 60 |
+
throw InvalidNode(m_invalidKey);
|
| 61 |
+
if (!m_pNode) {
|
| 62 |
+
m_pMemory.reset(new detail::memory_holder);
|
| 63 |
+
m_pNode = &m_pMemory->create_node();
|
| 64 |
+
m_pNode->set_null();
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
inline bool Node::IsDefined() const {
|
| 69 |
+
if (!m_isValid) {
|
| 70 |
+
return false;
|
| 71 |
+
}
|
| 72 |
+
return m_pNode ? m_pNode->is_defined() : true;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
inline Mark Node::Mark() const {
|
| 76 |
+
if (!m_isValid) {
|
| 77 |
+
throw InvalidNode(m_invalidKey);
|
| 78 |
+
}
|
| 79 |
+
return m_pNode ? m_pNode->mark() : Mark::null_mark();
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
inline NodeType::value Node::Type() const {
|
| 83 |
+
if (!m_isValid)
|
| 84 |
+
throw InvalidNode(m_invalidKey);
|
| 85 |
+
return m_pNode ? m_pNode->type() : NodeType::Null;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
// access
|
| 89 |
+
|
| 90 |
+
// template helpers
|
| 91 |
+
template <typename T, typename S>
|
| 92 |
+
struct as_if {
|
| 93 |
+
explicit as_if(const Node& node_) : node(node_) {}
|
| 94 |
+
const Node& node;
|
| 95 |
+
|
| 96 |
+
T operator()(const S& fallback) const {
|
| 97 |
+
if (!node.m_pNode)
|
| 98 |
+
return fallback;
|
| 99 |
+
|
| 100 |
+
T t;
|
| 101 |
+
if (convert<T>::decode(node, t))
|
| 102 |
+
return t;
|
| 103 |
+
return fallback;
|
| 104 |
+
}
|
| 105 |
+
};
|
| 106 |
+
|
| 107 |
+
template <typename S>
|
| 108 |
+
struct as_if<std::string, S> {
|
| 109 |
+
explicit as_if(const Node& node_) : node(node_) {}
|
| 110 |
+
const Node& node;
|
| 111 |
+
|
| 112 |
+
std::string operator()(const S& fallback) const {
|
| 113 |
+
if (node.Type() == NodeType::Null)
|
| 114 |
+
return "null";
|
| 115 |
+
if (node.Type() != NodeType::Scalar)
|
| 116 |
+
return fallback;
|
| 117 |
+
return node.Scalar();
|
| 118 |
+
}
|
| 119 |
+
};
|
| 120 |
+
|
| 121 |
+
template <typename T>
|
| 122 |
+
struct as_if<T, void> {
|
| 123 |
+
explicit as_if(const Node& node_) : node(node_) {}
|
| 124 |
+
const Node& node;
|
| 125 |
+
|
| 126 |
+
T operator()() const {
|
| 127 |
+
if (!node.m_pNode)
|
| 128 |
+
throw TypedBadConversion<T>(node.Mark());
|
| 129 |
+
|
| 130 |
+
T t;
|
| 131 |
+
if (convert<T>::decode(node, t))
|
| 132 |
+
return t;
|
| 133 |
+
throw TypedBadConversion<T>(node.Mark());
|
| 134 |
+
}
|
| 135 |
+
};
|
| 136 |
+
|
| 137 |
+
template <>
|
| 138 |
+
struct as_if<std::string, void> {
|
| 139 |
+
explicit as_if(const Node& node_) : node(node_) {}
|
| 140 |
+
const Node& node;
|
| 141 |
+
|
| 142 |
+
std::string operator()() const {
|
| 143 |
+
if (node.Type() == NodeType::Null)
|
| 144 |
+
return "null";
|
| 145 |
+
if (node.Type() != NodeType::Scalar)
|
| 146 |
+
throw TypedBadConversion<std::string>(node.Mark());
|
| 147 |
+
return node.Scalar();
|
| 148 |
+
}
|
| 149 |
+
};
|
| 150 |
+
|
| 151 |
+
// access functions
|
| 152 |
+
template <typename T>
|
| 153 |
+
inline T Node::as() const {
|
| 154 |
+
if (!m_isValid)
|
| 155 |
+
throw InvalidNode(m_invalidKey);
|
| 156 |
+
return as_if<T, void>(*this)();
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
template <typename T, typename S>
|
| 160 |
+
inline T Node::as(const S& fallback) const {
|
| 161 |
+
if (!m_isValid)
|
| 162 |
+
return fallback;
|
| 163 |
+
return as_if<T, S>(*this)(fallback);
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
inline const std::string& Node::Scalar() const {
|
| 167 |
+
if (!m_isValid)
|
| 168 |
+
throw InvalidNode(m_invalidKey);
|
| 169 |
+
return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar();
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
inline const std::string& Node::Tag() const {
|
| 173 |
+
if (!m_isValid)
|
| 174 |
+
throw InvalidNode(m_invalidKey);
|
| 175 |
+
return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar();
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
inline void Node::SetTag(const std::string& tag) {
|
| 179 |
+
EnsureNodeExists();
|
| 180 |
+
m_pNode->set_tag(tag);
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
inline EmitterStyle::value Node::Style() const {
|
| 184 |
+
if (!m_isValid)
|
| 185 |
+
throw InvalidNode(m_invalidKey);
|
| 186 |
+
return m_pNode ? m_pNode->style() : EmitterStyle::Default;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
inline void Node::SetStyle(EmitterStyle::value style) {
|
| 190 |
+
EnsureNodeExists();
|
| 191 |
+
m_pNode->set_style(style);
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
// assignment
|
| 195 |
+
inline bool Node::is(const Node& rhs) const {
|
| 196 |
+
if (!m_isValid || !rhs.m_isValid)
|
| 197 |
+
throw InvalidNode(m_invalidKey);
|
| 198 |
+
if (!m_pNode || !rhs.m_pNode)
|
| 199 |
+
return false;
|
| 200 |
+
return m_pNode->is(*rhs.m_pNode);
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
template <typename T>
|
| 204 |
+
inline Node& Node::operator=(const T& rhs) {
|
| 205 |
+
Assign(rhs);
|
| 206 |
+
return *this;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
inline Node& Node::operator=(const Node& rhs) {
|
| 210 |
+
if (is(rhs))
|
| 211 |
+
return *this;
|
| 212 |
+
AssignNode(rhs);
|
| 213 |
+
return *this;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
inline void Node::reset(const YAML::Node& rhs) {
|
| 217 |
+
if (!m_isValid || !rhs.m_isValid)
|
| 218 |
+
throw InvalidNode(m_invalidKey);
|
| 219 |
+
m_pMemory = rhs.m_pMemory;
|
| 220 |
+
m_pNode = rhs.m_pNode;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
template <typename T>
|
| 224 |
+
inline void Node::Assign(const T& rhs) {
|
| 225 |
+
if (!m_isValid)
|
| 226 |
+
throw InvalidNode(m_invalidKey);
|
| 227 |
+
AssignData(convert<T>::encode(rhs));
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
template <>
|
| 231 |
+
inline void Node::Assign(const std::string& rhs) {
|
| 232 |
+
EnsureNodeExists();
|
| 233 |
+
m_pNode->set_scalar(rhs);
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
inline void Node::Assign(const char* rhs) {
|
| 237 |
+
EnsureNodeExists();
|
| 238 |
+
m_pNode->set_scalar(rhs);
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
inline void Node::Assign(char* rhs) {
|
| 242 |
+
EnsureNodeExists();
|
| 243 |
+
m_pNode->set_scalar(rhs);
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
inline void Node::AssignData(const Node& rhs) {
|
| 247 |
+
EnsureNodeExists();
|
| 248 |
+
rhs.EnsureNodeExists();
|
| 249 |
+
|
| 250 |
+
m_pNode->set_data(*rhs.m_pNode);
|
| 251 |
+
m_pMemory->merge(*rhs.m_pMemory);
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
inline void Node::AssignNode(const Node& rhs) {
|
| 255 |
+
if (!m_isValid)
|
| 256 |
+
throw InvalidNode(m_invalidKey);
|
| 257 |
+
rhs.EnsureNodeExists();
|
| 258 |
+
|
| 259 |
+
if (!m_pNode) {
|
| 260 |
+
m_pNode = rhs.m_pNode;
|
| 261 |
+
m_pMemory = rhs.m_pMemory;
|
| 262 |
+
return;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
m_pNode->set_ref(*rhs.m_pNode);
|
| 266 |
+
m_pMemory->merge(*rhs.m_pMemory);
|
| 267 |
+
m_pNode = rhs.m_pNode;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
// size/iterator
|
| 271 |
+
inline std::size_t Node::size() const {
|
| 272 |
+
if (!m_isValid)
|
| 273 |
+
throw InvalidNode(m_invalidKey);
|
| 274 |
+
return m_pNode ? m_pNode->size() : 0;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
inline const_iterator Node::begin() const {
|
| 278 |
+
if (!m_isValid)
|
| 279 |
+
return const_iterator();
|
| 280 |
+
return m_pNode ? const_iterator(m_pNode->begin(), m_pMemory)
|
| 281 |
+
: const_iterator();
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
inline iterator Node::begin() {
|
| 285 |
+
if (!m_isValid)
|
| 286 |
+
return iterator();
|
| 287 |
+
return m_pNode ? iterator(m_pNode->begin(), m_pMemory) : iterator();
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
inline const_iterator Node::end() const {
|
| 291 |
+
if (!m_isValid)
|
| 292 |
+
return const_iterator();
|
| 293 |
+
return m_pNode ? const_iterator(m_pNode->end(), m_pMemory) : const_iterator();
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
inline iterator Node::end() {
|
| 297 |
+
if (!m_isValid)
|
| 298 |
+
return iterator();
|
| 299 |
+
return m_pNode ? iterator(m_pNode->end(), m_pMemory) : iterator();
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
// sequence
|
| 303 |
+
template <typename T>
|
| 304 |
+
inline void Node::push_back(const T& rhs) {
|
| 305 |
+
if (!m_isValid)
|
| 306 |
+
throw InvalidNode(m_invalidKey);
|
| 307 |
+
push_back(Node(rhs));
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
inline void Node::push_back(const Node& rhs) {
|
| 311 |
+
EnsureNodeExists();
|
| 312 |
+
rhs.EnsureNodeExists();
|
| 313 |
+
|
| 314 |
+
m_pNode->push_back(*rhs.m_pNode, m_pMemory);
|
| 315 |
+
m_pMemory->merge(*rhs.m_pMemory);
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
template<typename Key>
|
| 319 |
+
std::string key_to_string(const Key& key) {
|
| 320 |
+
return streamable_to_string<Key, is_streamable<std::stringstream, Key>::value>().impl(key);
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
// indexing
|
| 324 |
+
template <typename Key>
|
| 325 |
+
inline const Node Node::operator[](const Key& key) const {
|
| 326 |
+
EnsureNodeExists();
|
| 327 |
+
detail::node* value =
|
| 328 |
+
static_cast<const detail::node&>(*m_pNode).get(key, m_pMemory);
|
| 329 |
+
if (!value) {
|
| 330 |
+
return Node(ZombieNode, key_to_string(key));
|
| 331 |
+
}
|
| 332 |
+
return Node(*value, m_pMemory);
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
template <typename Key>
|
| 336 |
+
inline Node Node::operator[](const Key& key) {
|
| 337 |
+
EnsureNodeExists();
|
| 338 |
+
detail::node& value = m_pNode->get(key, m_pMemory);
|
| 339 |
+
return Node(value, m_pMemory);
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
template <typename Key>
|
| 343 |
+
inline bool Node::remove(const Key& key) {
|
| 344 |
+
EnsureNodeExists();
|
| 345 |
+
return m_pNode->remove(key, m_pMemory);
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
inline const Node Node::operator[](const Node& key) const {
|
| 349 |
+
EnsureNodeExists();
|
| 350 |
+
key.EnsureNodeExists();
|
| 351 |
+
m_pMemory->merge(*key.m_pMemory);
|
| 352 |
+
detail::node* value =
|
| 353 |
+
static_cast<const detail::node&>(*m_pNode).get(*key.m_pNode, m_pMemory);
|
| 354 |
+
if (!value) {
|
| 355 |
+
return Node(ZombieNode, key_to_string(key));
|
| 356 |
+
}
|
| 357 |
+
return Node(*value, m_pMemory);
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
inline Node Node::operator[](const Node& key) {
|
| 361 |
+
EnsureNodeExists();
|
| 362 |
+
key.EnsureNodeExists();
|
| 363 |
+
m_pMemory->merge(*key.m_pMemory);
|
| 364 |
+
detail::node& value = m_pNode->get(*key.m_pNode, m_pMemory);
|
| 365 |
+
return Node(value, m_pMemory);
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
inline bool Node::remove(const Node& key) {
|
| 369 |
+
EnsureNodeExists();
|
| 370 |
+
key.EnsureNodeExists();
|
| 371 |
+
return m_pNode->remove(*key.m_pNode, m_pMemory);
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
// map
|
| 375 |
+
template <typename Key, typename Value>
|
| 376 |
+
inline void Node::force_insert(const Key& key, const Value& value) {
|
| 377 |
+
EnsureNodeExists();
|
| 378 |
+
m_pNode->force_insert(key, value, m_pMemory);
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
// free functions
|
| 382 |
+
inline bool operator==(const Node& lhs, const Node& rhs) { return lhs.is(rhs); }
|
| 383 |
+
} // namespace YAML
|
| 384 |
+
|
| 385 |
+
#endif // NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/iterator.h
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include "yaml-cpp/dll.h"
|
| 11 |
+
#include "yaml-cpp/node/node.h"
|
| 12 |
+
#include "yaml-cpp/node/detail/iterator_fwd.h"
|
| 13 |
+
#include "yaml-cpp/node/detail/iterator.h"
|
| 14 |
+
#include <list>
|
| 15 |
+
#include <utility>
|
| 16 |
+
#include <vector>
|
| 17 |
+
|
| 18 |
+
// Assert in place so gcc + libc++ combination properly builds
|
| 19 |
+
static_assert(std::is_constructible<YAML::Node, const YAML::Node&>::value, "Node must be copy constructable");
|
| 20 |
+
|
| 21 |
+
namespace YAML {
|
| 22 |
+
namespace detail {
|
| 23 |
+
struct iterator_value : public Node, std::pair<Node, Node> {
|
| 24 |
+
iterator_value() = default;
|
| 25 |
+
explicit iterator_value(const Node& rhs)
|
| 26 |
+
: Node(rhs),
|
| 27 |
+
std::pair<Node, Node>(Node(Node::ZombieNode), Node(Node::ZombieNode)) {}
|
| 28 |
+
explicit iterator_value(const Node& key, const Node& value)
|
| 29 |
+
: Node(Node::ZombieNode), std::pair<Node, Node>(key, value) {}
|
| 30 |
+
};
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
#endif // VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/node.h
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <stdexcept>
|
| 11 |
+
#include <string>
|
| 12 |
+
|
| 13 |
+
#include "yaml-cpp/dll.h"
|
| 14 |
+
#include "yaml-cpp/emitterstyle.h"
|
| 15 |
+
#include "yaml-cpp/mark.h"
|
| 16 |
+
#include "yaml-cpp/node/detail/iterator_fwd.h"
|
| 17 |
+
#include "yaml-cpp/node/ptr.h"
|
| 18 |
+
#include "yaml-cpp/node/type.h"
|
| 19 |
+
|
| 20 |
+
namespace YAML {
|
| 21 |
+
namespace detail {
|
| 22 |
+
class node;
|
| 23 |
+
class node_data;
|
| 24 |
+
struct iterator_value;
|
| 25 |
+
} // namespace detail
|
| 26 |
+
} // namespace YAML
|
| 27 |
+
|
| 28 |
+
namespace YAML {
|
| 29 |
+
class YAML_CPP_API Node {
|
| 30 |
+
public:
|
| 31 |
+
friend class NodeBuilder;
|
| 32 |
+
friend class NodeEvents;
|
| 33 |
+
friend struct detail::iterator_value;
|
| 34 |
+
friend class detail::node;
|
| 35 |
+
friend class detail::node_data;
|
| 36 |
+
template <typename>
|
| 37 |
+
friend class detail::iterator_base;
|
| 38 |
+
template <typename T, typename S>
|
| 39 |
+
friend struct as_if;
|
| 40 |
+
|
| 41 |
+
using iterator = YAML::iterator;
|
| 42 |
+
using const_iterator = YAML::const_iterator;
|
| 43 |
+
|
| 44 |
+
Node();
|
| 45 |
+
explicit Node(NodeType::value type);
|
| 46 |
+
template <typename T>
|
| 47 |
+
explicit Node(const T& rhs);
|
| 48 |
+
explicit Node(const detail::iterator_value& rhs);
|
| 49 |
+
Node(const Node& rhs);
|
| 50 |
+
~Node();
|
| 51 |
+
|
| 52 |
+
YAML::Mark Mark() const;
|
| 53 |
+
NodeType::value Type() const;
|
| 54 |
+
bool IsDefined() const;
|
| 55 |
+
bool IsNull() const { return Type() == NodeType::Null; }
|
| 56 |
+
bool IsScalar() const { return Type() == NodeType::Scalar; }
|
| 57 |
+
bool IsSequence() const { return Type() == NodeType::Sequence; }
|
| 58 |
+
bool IsMap() const { return Type() == NodeType::Map; }
|
| 59 |
+
|
| 60 |
+
// bool conversions
|
| 61 |
+
explicit operator bool() const { return IsDefined(); }
|
| 62 |
+
bool operator!() const { return !IsDefined(); }
|
| 63 |
+
|
| 64 |
+
// access
|
| 65 |
+
template <typename T>
|
| 66 |
+
T as() const;
|
| 67 |
+
template <typename T, typename S>
|
| 68 |
+
T as(const S& fallback) const;
|
| 69 |
+
const std::string& Scalar() const;
|
| 70 |
+
|
| 71 |
+
const std::string& Tag() const;
|
| 72 |
+
void SetTag(const std::string& tag);
|
| 73 |
+
|
| 74 |
+
// style
|
| 75 |
+
// WARNING: This API might change in future releases.
|
| 76 |
+
EmitterStyle::value Style() const;
|
| 77 |
+
void SetStyle(EmitterStyle::value style);
|
| 78 |
+
|
| 79 |
+
// assignment
|
| 80 |
+
bool is(const Node& rhs) const;
|
| 81 |
+
template <typename T>
|
| 82 |
+
Node& operator=(const T& rhs);
|
| 83 |
+
Node& operator=(const Node& rhs);
|
| 84 |
+
void reset(const Node& rhs = Node());
|
| 85 |
+
|
| 86 |
+
// size/iterator
|
| 87 |
+
std::size_t size() const;
|
| 88 |
+
|
| 89 |
+
const_iterator begin() const;
|
| 90 |
+
iterator begin();
|
| 91 |
+
|
| 92 |
+
const_iterator end() const;
|
| 93 |
+
iterator end();
|
| 94 |
+
|
| 95 |
+
// sequence
|
| 96 |
+
template <typename T>
|
| 97 |
+
void push_back(const T& rhs);
|
| 98 |
+
void push_back(const Node& rhs);
|
| 99 |
+
|
| 100 |
+
// indexing
|
| 101 |
+
template <typename Key>
|
| 102 |
+
const Node operator[](const Key& key) const;
|
| 103 |
+
template <typename Key>
|
| 104 |
+
Node operator[](const Key& key);
|
| 105 |
+
template <typename Key>
|
| 106 |
+
bool remove(const Key& key);
|
| 107 |
+
|
| 108 |
+
const Node operator[](const Node& key) const;
|
| 109 |
+
Node operator[](const Node& key);
|
| 110 |
+
bool remove(const Node& key);
|
| 111 |
+
|
| 112 |
+
// map
|
| 113 |
+
template <typename Key, typename Value>
|
| 114 |
+
void force_insert(const Key& key, const Value& value);
|
| 115 |
+
|
| 116 |
+
private:
|
| 117 |
+
enum Zombie { ZombieNode };
|
| 118 |
+
explicit Node(Zombie);
|
| 119 |
+
explicit Node(Zombie, const std::string&);
|
| 120 |
+
explicit Node(detail::node& node, detail::shared_memory_holder pMemory);
|
| 121 |
+
|
| 122 |
+
void EnsureNodeExists() const;
|
| 123 |
+
|
| 124 |
+
template <typename T>
|
| 125 |
+
void Assign(const T& rhs);
|
| 126 |
+
void Assign(const char* rhs);
|
| 127 |
+
void Assign(char* rhs);
|
| 128 |
+
|
| 129 |
+
void AssignData(const Node& rhs);
|
| 130 |
+
void AssignNode(const Node& rhs);
|
| 131 |
+
|
| 132 |
+
private:
|
| 133 |
+
bool m_isValid;
|
| 134 |
+
// String representation of invalid key, if the node is invalid.
|
| 135 |
+
std::string m_invalidKey;
|
| 136 |
+
mutable detail::shared_memory_holder m_pMemory;
|
| 137 |
+
mutable detail::node* m_pNode;
|
| 138 |
+
};
|
| 139 |
+
|
| 140 |
+
YAML_CPP_API bool operator==(const Node& lhs, const Node& rhs);
|
| 141 |
+
|
| 142 |
+
YAML_CPP_API Node Clone(const Node& node);
|
| 143 |
+
|
| 144 |
+
template <typename T>
|
| 145 |
+
struct convert;
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
#endif // NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/parse.h
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <iosfwd>
|
| 11 |
+
#include <string>
|
| 12 |
+
#include <vector>
|
| 13 |
+
|
| 14 |
+
#include "yaml-cpp/dll.h"
|
| 15 |
+
|
| 16 |
+
namespace YAML {
|
| 17 |
+
class Node;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Loads the input string as a single YAML document.
|
| 21 |
+
*
|
| 22 |
+
* @throws {@link ParserException} if it is malformed.
|
| 23 |
+
*/
|
| 24 |
+
YAML_CPP_API Node Load(const std::string& input);
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Loads the input string as a single YAML document.
|
| 28 |
+
*
|
| 29 |
+
* @throws {@link ParserException} if it is malformed.
|
| 30 |
+
*/
|
| 31 |
+
YAML_CPP_API Node Load(const char* input);
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Loads the input stream as a single YAML document.
|
| 35 |
+
*
|
| 36 |
+
* @throws {@link ParserException} if it is malformed.
|
| 37 |
+
*/
|
| 38 |
+
YAML_CPP_API Node Load(std::istream& input);
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Loads the input file as a single YAML document.
|
| 42 |
+
*
|
| 43 |
+
* @throws {@link ParserException} if it is malformed.
|
| 44 |
+
* @throws {@link BadFile} if the file cannot be loaded.
|
| 45 |
+
*/
|
| 46 |
+
YAML_CPP_API Node LoadFile(const std::string& filename);
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Loads the input string as a list of YAML documents.
|
| 50 |
+
*
|
| 51 |
+
* @throws {@link ParserException} if it is malformed.
|
| 52 |
+
*/
|
| 53 |
+
YAML_CPP_API std::vector<Node> LoadAll(const std::string& input);
|
| 54 |
+
|
| 55 |
+
/**
|
| 56 |
+
* Loads the input string as a list of YAML documents.
|
| 57 |
+
*
|
| 58 |
+
* @throws {@link ParserException} if it is malformed.
|
| 59 |
+
*/
|
| 60 |
+
YAML_CPP_API std::vector<Node> LoadAll(const char* input);
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Loads the input stream as a list of YAML documents.
|
| 64 |
+
*
|
| 65 |
+
* @throws {@link ParserException} if it is malformed.
|
| 66 |
+
*/
|
| 67 |
+
YAML_CPP_API std::vector<Node> LoadAll(std::istream& input);
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Loads the input file as a list of YAML documents.
|
| 71 |
+
*
|
| 72 |
+
* @throws {@link ParserException} if it is malformed.
|
| 73 |
+
* @throws {@link BadFile} if the file cannot be loaded.
|
| 74 |
+
*/
|
| 75 |
+
YAML_CPP_API std::vector<Node> LoadAllFromFile(const std::string& filename);
|
| 76 |
+
} // namespace YAML
|
| 77 |
+
|
| 78 |
+
#endif // VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/ptr.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include <memory>
|
| 11 |
+
|
| 12 |
+
namespace YAML {
|
| 13 |
+
namespace detail {
|
| 14 |
+
class node;
|
| 15 |
+
class node_ref;
|
| 16 |
+
class node_data;
|
| 17 |
+
class memory;
|
| 18 |
+
class memory_holder;
|
| 19 |
+
|
| 20 |
+
using shared_node = std::shared_ptr<node>;
|
| 21 |
+
using shared_node_ref = std::shared_ptr<node_ref>;
|
| 22 |
+
using shared_node_data = std::shared_ptr<node_data>;
|
| 23 |
+
using shared_memory_holder = std::shared_ptr<memory_holder>;
|
| 24 |
+
using shared_memory = std::shared_ptr<memory>;
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
#endif // VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/node/type.h
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
namespace YAML {
|
| 11 |
+
struct NodeType {
|
| 12 |
+
enum value { Undefined, Null, Scalar, Sequence, Map };
|
| 13 |
+
};
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
#endif // VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/noexcept.h
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NOEXCEPT_H_768872DA_476C_11EA_88B8_90B11C0C0FF8
|
| 2 |
+
#define NOEXCEPT_H_768872DA_476C_11EA_88B8_90B11C0C0FF8
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
// This is here for compatibility with older versions of Visual Studio
|
| 11 |
+
// which don't support noexcept.
|
| 12 |
+
#if defined(_MSC_VER) && _MSC_VER < 1900
|
| 13 |
+
#define YAML_CPP_NOEXCEPT _NOEXCEPT
|
| 14 |
+
#else
|
| 15 |
+
#define YAML_CPP_NOEXCEPT noexcept
|
| 16 |
+
#endif
|
| 17 |
+
|
| 18 |
+
#endif
|
data/miniconda3/pkgs/yaml-cpp-0.8.0-h6a678d5_1/include/yaml-cpp/null.h
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 2 |
+
#define NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
| 3 |
+
|
| 4 |
+
#if defined(_MSC_VER) || \
|
| 5 |
+
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
|
| 6 |
+
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
| 7 |
+
#pragma once
|
| 8 |
+
#endif
|
| 9 |
+
|
| 10 |
+
#include "yaml-cpp/dll.h"
|
| 11 |
+
#include <string>
|
| 12 |
+
|
| 13 |
+
namespace YAML {
|
| 14 |
+
class Node;
|
| 15 |
+
|
| 16 |
+
struct YAML_CPP_API _Null {};
|
| 17 |
+
inline bool operator==(const _Null&, const _Null&) { return true; }
|
| 18 |
+
inline bool operator!=(const _Null&, const _Null&) { return false; }
|
| 19 |
+
|
| 20 |
+
YAML_CPP_API bool IsNull(const Node& node); // old API only
|
| 21 |
+
YAML_CPP_API bool IsNullString(const std::string& str);
|
| 22 |
+
|
| 23 |
+
extern YAML_CPP_API _Null Null;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
#endif // NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|