uTL
micro Template library
gtest.h
Go to the documentation of this file.
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 GTEST_INCLUDE_GTEST_GTEST_H_
53 #define GTEST_INCLUDE_GTEST_GTEST_H_
54 
55 #include <limits>
56 #include <memory>
57 #include <ostream>
58 #include <vector>
59 
60 // Copyright 2005, Google Inc.
61 // All rights reserved.
62 //
63 // Redistribution and use in source and binary forms, with or without
64 // modification, are permitted provided that the following conditions are
65 // met:
66 //
67 // * Redistributions of source code must retain the above copyright
68 // notice, this list of conditions and the following disclaimer.
69 // * Redistributions in binary form must reproduce the above
70 // copyright notice, this list of conditions and the following disclaimer
71 // in the documentation and/or other materials provided with the
72 // distribution.
73 // * Neither the name of Google Inc. nor the names of its
74 // contributors may be used to endorse or promote products derived from
75 // this software without specific prior written permission.
76 //
77 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
78 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
79 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
80 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
81 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
82 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
83 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
84 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
85 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
86 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
87 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88 //
89 // The Google C++ Testing and Mocking Framework (Google Test)
90 //
91 // This header file declares functions and macros used internally by
92 // Google Test. They are subject to change without notice.
93 
94 // GOOGLETEST_CM0001 DO NOT DELETE
95 
96 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
97 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
98 
99 // Copyright 2005, Google Inc.
100 // All rights reserved.
101 //
102 // Redistribution and use in source and binary forms, with or without
103 // modification, are permitted provided that the following conditions are
104 // met:
105 //
106 // * Redistributions of source code must retain the above copyright
107 // notice, this list of conditions and the following disclaimer.
108 // * Redistributions in binary form must reproduce the above
109 // copyright notice, this list of conditions and the following disclaimer
110 // in the documentation and/or other materials provided with the
111 // distribution.
112 // * Neither the name of Google Inc. nor the names of its
113 // contributors may be used to endorse or promote products derived from
114 // this software without specific prior written permission.
115 //
116 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
117 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
118 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
119 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
120 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
121 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
122 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
123 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
124 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
125 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
126 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
127 //
128 // Low-level types and utilities for porting Google Test to various
129 // platforms. All macros ending with _ and symbols defined in an
130 // internal namespace are subject to change without notice. Code
131 // outside Google Test MUST NOT USE THEM DIRECTLY. Macros that don't
132 // end with _ are part of Google Test's public API and can be used by
133 // code outside Google Test.
134 //
135 // This file is fundamental to Google Test. All other Google Test source
136 // files are expected to #include this. Therefore, it cannot #include
137 // any other Google Test header.
138 
139 // GOOGLETEST_CM0001 DO NOT DELETE
140 
141 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
142 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
143 
144 // Environment-describing macros
145 // -----------------------------
146 //
147 // Google Test can be used in many different environments. Macros in
148 // this section tell Google Test what kind of environment it is being
149 // used in, such that Google Test can provide environment-specific
150 // features and implementations.
151 //
152 // Google Test tries to automatically detect the properties of its
153 // environment, so users usually don't need to worry about these
154 // macros. However, the automatic detection is not perfect.
155 // Sometimes it's necessary for a user to define some of the following
156 // macros in the build script to override Google Test's decisions.
157 //
158 // If the user doesn't define a macro in the list, Google Test will
159 // provide a default definition. After this header is #included, all
160 // macros in this list will be defined to either 1 or 0.
161 //
162 // Notes to maintainers:
163 // - Each macro here is a user-tweakable knob; do not grow the list
164 // lightly.
165 // - Use #if to key off these macros. Don't use #ifdef or "#if
166 // defined(...)", which will not work as these macros are ALWAYS
167 // defined.
168 //
169 // GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2)
170 // is/isn't available.
171 // GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions
172 // are enabled.
173 // GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string
174 // is/isn't available
175 // GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::wstring
176 // is/isn't available
177 // GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular
178 // expressions are/aren't available.
179 // GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h>
180 // is/isn't available.
181 // GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't
182 // enabled.
183 // GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
184 // std::wstring does/doesn't work (Google Test can
185 // be used where std::wstring is unavailable).
186 // GTEST_HAS_SEH - Define it to 1/0 to indicate whether the
187 // compiler supports Microsoft's "Structured
188 // Exception Handling".
189 // GTEST_HAS_STREAM_REDIRECTION
190 // - Define it to 1/0 to indicate whether the
191 // platform supports I/O stream redirection using
192 // dup() and dup2().
193 // GTEST_LINKED_AS_SHARED_LIBRARY
194 // - Define to 1 when compiling tests that use
195 // Google Test as a shared library (known as
196 // DLL on Windows).
197 // GTEST_CREATE_SHARED_LIBRARY
198 // - Define to 1 when compiling Google Test itself
199 // as a shared library.
200 // GTEST_DEFAULT_DEATH_TEST_STYLE
201 // - The default value of --gtest_death_test_style.
202 // The legacy default has been "fast" in the open
203 // source version since 2008. The recommended value
204 // is "threadsafe", and can be set in
205 // custom/gtest-port.h.
206 
207 // Platform-indicating macros
208 // --------------------------
209 //
210 // Macros indicating the platform on which Google Test is being used
211 // (a macro is defined to 1 if compiled on the given platform;
212 // otherwise UNDEFINED -- it's never defined to 0.). Google Test
213 // defines these macros automatically. Code outside Google Test MUST
214 // NOT define them.
215 //
216 // GTEST_OS_AIX - IBM AIX
217 // GTEST_OS_CYGWIN - Cygwin
218 // GTEST_OS_FREEBSD - FreeBSD
219 // GTEST_OS_FUCHSIA - Fuchsia
220 // GTEST_OS_HPUX - HP-UX
221 // GTEST_OS_LINUX - Linux
222 // GTEST_OS_LINUX_ANDROID - Google Android
223 // GTEST_OS_MAC - Mac OS X
224 // GTEST_OS_IOS - iOS
225 // GTEST_OS_NACL - Google Native Client (NaCl)
226 // GTEST_OS_NETBSD - NetBSD
227 // GTEST_OS_OPENBSD - OpenBSD
228 // GTEST_OS_OS2 - OS/2
229 // GTEST_OS_QNX - QNX
230 // GTEST_OS_SOLARIS - Sun Solaris
231 // GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile)
232 // GTEST_OS_WINDOWS_DESKTOP - Windows Desktop
233 // GTEST_OS_WINDOWS_MINGW - MinGW
234 // GTEST_OS_WINDOWS_MOBILE - Windows Mobile
235 // GTEST_OS_WINDOWS_PHONE - Windows Phone
236 // GTEST_OS_WINDOWS_RT - Windows Store App/WinRT
237 // GTEST_OS_ZOS - z/OS
238 //
239 // Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
240 // most stable support. Since core members of the Google Test project
241 // don't have access to other platforms, support for them may be less
242 // stable. If you notice any problems on your platform, please notify
243 // googletestframework@googlegroups.com (patches for fixing them are
244 // even more welcome!).
245 //
246 // It is possible that none of the GTEST_OS_* macros are defined.
247 
248 // Feature-indicating macros
249 // -------------------------
250 //
251 // Macros indicating which Google Test features are available (a macro
252 // is defined to 1 if the corresponding feature is supported;
253 // otherwise UNDEFINED -- it's never defined to 0.). Google Test
254 // defines these macros automatically. Code outside Google Test MUST
255 // NOT define them.
256 //
257 // These macros are public so that portable tests can be written.
258 // Such tests typically surround code using a feature with an #if
259 // which controls that code. For example:
260 //
261 // #if GTEST_HAS_DEATH_TEST
262 // EXPECT_DEATH(DoSomethingDeadly());
263 // #endif
264 //
265 // GTEST_HAS_DEATH_TEST - death tests
266 // GTEST_HAS_TYPED_TEST - typed tests
267 // GTEST_HAS_TYPED_TEST_P - type-parameterized tests
268 // GTEST_IS_THREADSAFE - Google Test is thread-safe.
269 // GOOGLETEST_CM0007 DO NOT DELETE
270 // GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with
271 // GTEST_HAS_POSIX_RE (see above) which users can
272 // define themselves.
273 // GTEST_USES_SIMPLE_RE - our own simple regex is used;
274 // the above RE\b(s) are mutually exclusive.
275 
276 // Misc public macros
277 // ------------------
278 //
279 // GTEST_FLAG(flag_name) - references the variable corresponding to
280 // the given Google Test flag.
281 
282 // Internal utilities
283 // ------------------
284 //
285 // The following macros and utilities are for Google Test's INTERNAL
286 // use only. Code outside Google Test MUST NOT USE THEM DIRECTLY.
287 //
288 // Macros for basic C++ coding:
289 // GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
290 // GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a
291 // variable don't have to be used.
292 // GTEST_DISALLOW_ASSIGN_ - disables operator=.
293 // GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
294 // GTEST_MUST_USE_RESULT_ - declares that a function's result must be used.
295 // GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is
296 // suppressed (constant conditional).
297 // GTEST_INTENTIONAL_CONST_COND_POP_ - finish code section where MSVC C4127
298 // is suppressed.
299 //
300 // Synchronization:
301 // Mutex, MutexLock, ThreadLocal, GetThreadCount()
302 // - synchronization primitives.
303 //
304 // Template meta programming:
305 // IteratorTraits - partial implementation of std::iterator_traits, which
306 // is not available in libCstd when compiled with Sun C++.
307 //
308 //
309 // Regular expressions:
310 // RE - a simple regular expression class using the POSIX
311 // Extended Regular Expression syntax on UNIX-like platforms
312 // GOOGLETEST_CM0008 DO NOT DELETE
313 // or a reduced regular exception syntax on other
314 // platforms, including Windows.
315 // Logging:
316 // GTEST_LOG_() - logs messages at the specified severity level.
317 // LogToStderr() - directs all log messages to stderr.
318 // FlushInfoLog() - flushes informational log messages.
319 //
320 // Stdout and stderr capturing:
321 // CaptureStdout() - starts capturing stdout.
322 // GetCapturedStdout() - stops capturing stdout and returns the captured
323 // string.
324 // CaptureStderr() - starts capturing stderr.
325 // GetCapturedStderr() - stops capturing stderr and returns the captured
326 // string.
327 //
328 // Integer types:
329 // TypeWithSize - maps an integer to a int type.
330 // Int32, UInt32, Int64, UInt64, TimeInMillis
331 // - integers of known sizes.
332 // BiggestInt - the biggest signed integer type.
333 //
334 // Command-line utilities:
335 // GTEST_DECLARE_*() - declares a flag.
336 // GTEST_DEFINE_*() - defines a flag.
337 // GetInjectableArgvs() - returns the command line as a vector of strings.
338 //
339 // Environment variable utilities:
340 // GetEnv() - gets the value of an environment variable.
341 // BoolFromGTestEnv() - parses a bool environment variable.
342 // Int32FromGTestEnv() - parses an Int32 environment variable.
343 // StringFromGTestEnv() - parses a string environment variable.
344 
345 #include <ctype.h> // for isspace, etc
346 #include <stddef.h> // for ptrdiff_t
347 #include <stdio.h>
348 #include <stdlib.h>
349 #include <string.h>
350 #include <memory>
351 #include <type_traits>
352 
353 #ifndef _WIN32_WCE
354 # include <sys/types.h>
355 # include <sys/stat.h>
356 #endif // !_WIN32_WCE
357 
358 #if defined __APPLE__
359 # include <AvailabilityMacros.h>
360 # include <TargetConditionals.h>
361 #endif
362 
363 // Brings in the definition of HAS_GLOBAL_STRING. This must be done
364 // BEFORE we test HAS_GLOBAL_STRING.
365 #include <string> // NOLINT
366 #include <algorithm> // NOLINT
367 #include <iostream> // NOLINT
368 #include <sstream> // NOLINT
369 #include <tuple>
370 #include <utility>
371 #include <vector> // NOLINT
372 
373 // Copyright 2015, Google Inc.
374 // All rights reserved.
375 //
376 // Redistribution and use in source and binary forms, with or without
377 // modification, are permitted provided that the following conditions are
378 // met:
379 //
380 // * Redistributions of source code must retain the above copyright
381 // notice, this list of conditions and the following disclaimer.
382 // * Redistributions in binary form must reproduce the above
383 // copyright notice, this list of conditions and the following disclaimer
384 // in the documentation and/or other materials provided with the
385 // distribution.
386 // * Neither the name of Google Inc. nor the names of its
387 // contributors may be used to endorse or promote products derived from
388 // this software without specific prior written permission.
389 //
390 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
391 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
392 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
393 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
394 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
395 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
396 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
397 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
398 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
399 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
400 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
401 //
402 // The Google C++ Testing and Mocking Framework (Google Test)
403 //
404 // This header file defines the GTEST_OS_* macro.
405 // It is separate from gtest-port.h so that custom/gtest-port.h can include it.
406 
407 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
408 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
409 
410 // Determines the platform on which Google Test is compiled.
411 #ifdef __CYGWIN__
412 # define GTEST_OS_CYGWIN 1
413 # elif defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)
414 # define GTEST_OS_WINDOWS_MINGW 1
415 # define GTEST_OS_WINDOWS 1
416 #elif defined _WIN32
417 # define GTEST_OS_WINDOWS 1
418 # ifdef _WIN32_WCE
419 # define GTEST_OS_WINDOWS_MOBILE 1
420 # elif defined(WINAPI_FAMILY)
421 # include <winapifamily.h>
422 # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
423 # define GTEST_OS_WINDOWS_DESKTOP 1
424 # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
425 # define GTEST_OS_WINDOWS_PHONE 1
426 # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
427 # define GTEST_OS_WINDOWS_RT 1
428 # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)
429 # define GTEST_OS_WINDOWS_PHONE 1
430 # define GTEST_OS_WINDOWS_TV_TITLE 1
431 # else
432  // WINAPI_FAMILY defined but no known partition matched.
433  // Default to desktop.
434 # define GTEST_OS_WINDOWS_DESKTOP 1
435 # endif
436 # else
437 # define GTEST_OS_WINDOWS_DESKTOP 1
438 # endif // _WIN32_WCE
439 #elif defined __OS2__
440 # define GTEST_OS_OS2 1
441 #elif defined __APPLE__
442 # define GTEST_OS_MAC 1
443 # if TARGET_OS_IPHONE
444 # define GTEST_OS_IOS 1
445 # endif
446 #elif defined __FreeBSD__
447 # define GTEST_OS_FREEBSD 1
448 #elif defined __Fuchsia__
449 # define GTEST_OS_FUCHSIA 1
450 #elif defined __linux__
451 # define GTEST_OS_LINUX 1
452 # if defined __ANDROID__
453 # define GTEST_OS_LINUX_ANDROID 1
454 # endif
455 #elif defined __MVS__
456 # define GTEST_OS_ZOS 1
457 #elif defined(__sun) && defined(__SVR4)
458 # define GTEST_OS_SOLARIS 1
459 #elif defined(_AIX)
460 # define GTEST_OS_AIX 1
461 #elif defined(__hpux)
462 # define GTEST_OS_HPUX 1
463 #elif defined __native_client__
464 # define GTEST_OS_NACL 1
465 #elif defined __NetBSD__
466 # define GTEST_OS_NETBSD 1
467 #elif defined __OpenBSD__
468 # define GTEST_OS_OPENBSD 1
469 #elif defined __QNX__
470 # define GTEST_OS_QNX 1
471 #endif // __CYGWIN__
472 
473 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
474 // Copyright 2015, Google Inc.
475 // All rights reserved.
476 //
477 // Redistribution and use in source and binary forms, with or without
478 // modification, are permitted provided that the following conditions are
479 // met:
480 //
481 // * Redistributions of source code must retain the above copyright
482 // notice, this list of conditions and the following disclaimer.
483 // * Redistributions in binary form must reproduce the above
484 // copyright notice, this list of conditions and the following disclaimer
485 // in the documentation and/or other materials provided with the
486 // distribution.
487 // * Neither the name of Google Inc. nor the names of its
488 // contributors may be used to endorse or promote products derived from
489 // this software without specific prior written permission.
490 //
491 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
492 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
493 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
494 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
495 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
496 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
497 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
498 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
499 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
500 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
501 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
502 //
503 // Injection point for custom user configurations. See README for details
504 //
505 // ** Custom implementation starts here **
506 
507 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
508 #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
509 
510 #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
511 
512 #if !defined(GTEST_DEV_EMAIL_)
513 # define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
514 # define GTEST_FLAG_PREFIX_ "gtest_"
515 # define GTEST_FLAG_PREFIX_DASH_ "gtest-"
516 # define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
517 # define GTEST_NAME_ "Google Test"
518 # define GTEST_PROJECT_URL_ "https://github.com/google/googletest/"
519 #endif // !defined(GTEST_DEV_EMAIL_)
520 
521 #if !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
522 # define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest"
523 #endif // !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
524 
525 // Determines the version of gcc that is used to compile this.
526 #ifdef __GNUC__
527 // 40302 means version 4.3.2.
528 # define GTEST_GCC_VER_ \
529  (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
530 #endif // __GNUC__
531 
532 // Macros for disabling Microsoft Visual C++ warnings.
533 //
534 // GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385)
535 // /* code that triggers warnings C4800 and C4385 */
536 // GTEST_DISABLE_MSC_WARNINGS_POP_()
537 #if defined(_MSC_VER)
538 # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \
539  __pragma(warning(push)) \
540  __pragma(warning(disable: warnings))
541 # define GTEST_DISABLE_MSC_WARNINGS_POP_() \
542  __pragma(warning(pop))
543 #else
544 // Not all compilers are MSVC
545 # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
546 # define GTEST_DISABLE_MSC_WARNINGS_POP_()
547 #endif
548 
549 // Clang on Windows does not understand MSVC's pragma warning.
550 // We need clang-specific way to disable function deprecation warning.
551 #ifdef __clang__
552 # define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
553  _Pragma("clang diagnostic push") \
554  _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
555  _Pragma("clang diagnostic ignored \"-Wdeprecated-implementations\"")
556 #define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
557  _Pragma("clang diagnostic pop")
558 #else
559 # define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
560  GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
561 # define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
562  GTEST_DISABLE_MSC_WARNINGS_POP_()
563 #endif
564 
565 // Brings in definitions for functions used in the testing::internal::posix
566 // namespace (read, write, close, chdir, isatty, stat). We do not currently
567 // use them on Windows Mobile.
568 #if GTEST_OS_WINDOWS
569 # if !GTEST_OS_WINDOWS_MOBILE
570 # include <direct.h>
571 # include <io.h>
572 # endif
573 // In order to avoid having to include <windows.h>, use forward declaration
574 #if GTEST_OS_WINDOWS_MINGW && !defined(__MINGW64_VERSION_MAJOR)
575 // MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two
576 // separate (equivalent) structs, instead of using typedef
577 typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION;
578 #else
579 // Assume CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
580 // This assumption is verified by
581 // WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
582 typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
583 #endif
584 #else
585 // This assumes that non-Windows OSes provide unistd.h. For OSes where this
586 // is not the case, we need to include headers that provide the functions
587 // mentioned above.
588 # include <unistd.h>
589 # include <strings.h>
590 #endif // GTEST_OS_WINDOWS
591 
592 #if GTEST_OS_LINUX_ANDROID
593 // Used to define __ANDROID_API__ matching the target NDK API level.
594 # include <android/api-level.h> // NOLINT
595 #endif
596 
597 // Defines this to true iff Google Test can use POSIX regular expressions.
598 #ifndef GTEST_HAS_POSIX_RE
599 # if GTEST_OS_LINUX_ANDROID
600 // On Android, <regex.h> is only available starting with Gingerbread.
601 # define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
602 # else
603 # define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
604 # endif
605 #endif
606 
607 #if GTEST_USES_PCRE
608 // The appropriate headers have already been included.
609 
610 #elif GTEST_HAS_POSIX_RE
611 
612 // On some platforms, <regex.h> needs someone to define size_t, and
613 // won't compile otherwise. We can #include it here as we already
614 // included <stdlib.h>, which is guaranteed to define size_t through
615 // <stddef.h>.
616 # include <regex.h> // NOLINT
617 
618 # define GTEST_USES_POSIX_RE 1
619 
620 #elif GTEST_OS_WINDOWS
621 
622 // <regex.h> is not available on Windows. Use our own simple regex
623 // implementation instead.
624 # define GTEST_USES_SIMPLE_RE 1
625 
626 #else
627 
628 // <regex.h> may not be available on this platform. Use our own
629 // simple regex implementation instead.
630 # define GTEST_USES_SIMPLE_RE 1
631 
632 #endif // GTEST_USES_PCRE
633 
634 #ifndef GTEST_HAS_EXCEPTIONS
635 // The user didn't tell us whether exceptions are enabled, so we need
636 // to figure it out.
637 # if defined(_MSC_VER) && defined(_CPPUNWIND)
638 // MSVC defines _CPPUNWIND to 1 iff exceptions are enabled.
639 # define GTEST_HAS_EXCEPTIONS 1
640 # elif defined(__BORLANDC__)
641 // C++Builder's implementation of the STL uses the _HAS_EXCEPTIONS
642 // macro to enable exceptions, so we'll do the same.
643 // Assumes that exceptions are enabled by default.
644 # ifndef _HAS_EXCEPTIONS
645 # define _HAS_EXCEPTIONS 1
646 # endif // _HAS_EXCEPTIONS
647 # define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
648 # elif defined(__clang__)
649 // clang defines __EXCEPTIONS iff exceptions are enabled before clang 220714,
650 // but iff cleanups are enabled after that. In Obj-C++ files, there can be
651 // cleanups for ObjC exceptions which also need cleanups, even if C++ exceptions
652 // are disabled. clang has __has_feature(cxx_exceptions) which checks for C++
653 // exceptions starting at clang r206352, but which checked for cleanups prior to
654 // that. To reliably check for C++ exception availability with clang, check for
655 // __EXCEPTIONS && __has_feature(cxx_exceptions).
656 # define GTEST_HAS_EXCEPTIONS (__EXCEPTIONS && __has_feature(cxx_exceptions))
657 # elif defined(__GNUC__) && __EXCEPTIONS
658 // gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
659 # define GTEST_HAS_EXCEPTIONS 1
660 # elif defined(__SUNPRO_CC)
661 // Sun Pro CC supports exceptions. However, there is no compile-time way of
662 // detecting whether they are enabled or not. Therefore, we assume that
663 // they are enabled unless the user tells us otherwise.
664 # define GTEST_HAS_EXCEPTIONS 1
665 # elif defined(__IBMCPP__) && __EXCEPTIONS
666 // xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
667 # define GTEST_HAS_EXCEPTIONS 1
668 # elif defined(__HP_aCC)
669 // Exception handling is in effect by default in HP aCC compiler. It has to
670 // be turned of by +noeh compiler option if desired.
671 # define GTEST_HAS_EXCEPTIONS 1
672 # else
673 // For other compilers, we assume exceptions are disabled to be
674 // conservative.
675 # define GTEST_HAS_EXCEPTIONS 0
676 # endif // defined(_MSC_VER) || defined(__BORLANDC__)
677 #endif // GTEST_HAS_EXCEPTIONS
678 
679 #if !defined(GTEST_HAS_STD_STRING)
680 // Even though we don't use this macro any longer, we keep it in case
681 // some clients still depend on it.
682 # define GTEST_HAS_STD_STRING 1
683 #elif !GTEST_HAS_STD_STRING
684 // The user told us that ::std::string isn't available.
685 # error "::std::string isn't available."
686 #endif // !defined(GTEST_HAS_STD_STRING)
687 
688 #ifndef GTEST_HAS_GLOBAL_STRING
689 # define GTEST_HAS_GLOBAL_STRING 0
690 #endif // GTEST_HAS_GLOBAL_STRING
691 
692 #ifndef GTEST_HAS_STD_WSTRING
693 // The user didn't tell us whether ::std::wstring is available, so we need
694 // to figure it out.
695 // Cygwin 1.7 and below doesn't support ::std::wstring.
696 // Solaris' libc++ doesn't support it either. Android has
697 // no support for it at least as recent as Froyo (2.2).
698 # define GTEST_HAS_STD_WSTRING \
699  (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
700 
701 #endif // GTEST_HAS_STD_WSTRING
702 
703 #ifndef GTEST_HAS_GLOBAL_WSTRING
704 // The user didn't tell us whether ::wstring is available, so we need
705 // to figure it out.
706 # define GTEST_HAS_GLOBAL_WSTRING \
707  (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
708 #endif // GTEST_HAS_GLOBAL_WSTRING
709 
710 // Determines whether RTTI is available.
711 #ifndef GTEST_HAS_RTTI
712 // The user didn't tell us whether RTTI is enabled, so we need to
713 // figure it out.
714 
715 # ifdef _MSC_VER
716 
717 # ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled.
718 # define GTEST_HAS_RTTI 1
719 # else
720 # define GTEST_HAS_RTTI 0
721 # endif
722 
723 // Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
724 # elif defined(__GNUC__)
725 
726 # ifdef __GXX_RTTI
727 // When building against STLport with the Android NDK and with
728 // -frtti -fno-exceptions, the build fails at link time with undefined
729 // references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
730 // so disable RTTI when detected.
731 # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
732  !defined(__EXCEPTIONS)
733 # define GTEST_HAS_RTTI 0
734 # else
735 # define GTEST_HAS_RTTI 1
736 # endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
737 # else
738 # define GTEST_HAS_RTTI 0
739 # endif // __GXX_RTTI
740 
741 // Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
742 // using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
743 // first version with C++ support.
744 # elif defined(__clang__)
745 
746 # define GTEST_HAS_RTTI __has_feature(cxx_rtti)
747 
748 // Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
749 // both the typeid and dynamic_cast features are present.
750 # elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
751 
752 # ifdef __RTTI_ALL__
753 # define GTEST_HAS_RTTI 1
754 # else
755 # define GTEST_HAS_RTTI 0
756 # endif
757 
758 # else
759 
760 // For all other compilers, we assume RTTI is enabled.
761 # define GTEST_HAS_RTTI 1
762 
763 # endif // _MSC_VER
764 
765 #endif // GTEST_HAS_RTTI
766 
767 // It's this header's responsibility to #include <typeinfo> when RTTI
768 // is enabled.
769 #if GTEST_HAS_RTTI
770 # include <typeinfo>
771 #endif
772 
773 // Determines whether Google Test can use the pthreads library.
774 #ifndef GTEST_HAS_PTHREAD
775 // The user didn't tell us explicitly, so we make reasonable assumptions about
776 // which platforms have pthreads support.
777 //
778 // To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
779 // to your compiler flags.
780 #define GTEST_HAS_PTHREAD \
781  (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX || GTEST_OS_QNX || \
782  GTEST_OS_FREEBSD || GTEST_OS_NACL || GTEST_OS_NETBSD || GTEST_OS_FUCHSIA)
783 #endif // GTEST_HAS_PTHREAD
784 
785 #if GTEST_HAS_PTHREAD
786 // gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
787 // true.
788 # include <pthread.h> // NOLINT
789 
790 // For timespec and nanosleep, used below.
791 # include <time.h> // NOLINT
792 #endif
793 
794 // Determines whether clone(2) is supported.
795 // Usually it will only be available on Linux, excluding
796 // Linux on the Itanium architecture.
797 // Also see http://linux.die.net/man/2/clone.
798 #ifndef GTEST_HAS_CLONE
799 // The user didn't tell us, so we need to figure it out.
800 
801 # if GTEST_OS_LINUX && !defined(__ia64__)
802 # if GTEST_OS_LINUX_ANDROID
803 // On Android, clone() became available at different API levels for each 32-bit
804 // architecture.
805 # if defined(__LP64__) || \
806  (defined(__arm__) && __ANDROID_API__ >= 9) || \
807  (defined(__mips__) && __ANDROID_API__ >= 12) || \
808  (defined(__i386__) && __ANDROID_API__ >= 17)
809 # define GTEST_HAS_CLONE 1
810 # else
811 # define GTEST_HAS_CLONE 0
812 # endif
813 # else
814 # define GTEST_HAS_CLONE 1
815 # endif
816 # else
817 # define GTEST_HAS_CLONE 0
818 # endif // GTEST_OS_LINUX && !defined(__ia64__)
819 
820 #endif // GTEST_HAS_CLONE
821 
822 // Determines whether to support stream redirection. This is used to test
823 // output correctness and to implement death tests.
824 #ifndef GTEST_HAS_STREAM_REDIRECTION
825 // By default, we assume that stream redirection is supported on all
826 // platforms except known mobile ones.
827 # if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
828 # define GTEST_HAS_STREAM_REDIRECTION 0
829 # else
830 # define GTEST_HAS_STREAM_REDIRECTION 1
831 # endif // !GTEST_OS_WINDOWS_MOBILE
832 #endif // GTEST_HAS_STREAM_REDIRECTION
833 
834 // Determines whether to support death tests.
835 // pops up a dialog window that cannot be suppressed programmatically.
836 #if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
837  (GTEST_OS_MAC && !GTEST_OS_IOS) || \
838  (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER) || \
839  GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
840  GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD || \
841  GTEST_OS_NETBSD || GTEST_OS_FUCHSIA)
842 # define GTEST_HAS_DEATH_TEST 1
843 #endif
844 
845 // Determines whether to support type-driven tests.
846 
847 // Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
848 // Sun Pro CC, IBM Visual Age, and HP aCC support.
849 #if defined(__GNUC__) || defined(_MSC_VER) || defined(__SUNPRO_CC) || \
850  defined(__IBMCPP__) || defined(__HP_aCC)
851 # define GTEST_HAS_TYPED_TEST 1
852 # define GTEST_HAS_TYPED_TEST_P 1
853 #endif
854 
855 // Determines whether the system compiler uses UTF-16 for encoding wide strings.
856 #define GTEST_WIDE_STRING_USES_UTF16_ \
857  (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_AIX || GTEST_OS_OS2)
858 
859 // Determines whether test results can be streamed to a socket.
860 #if GTEST_OS_LINUX
861 # define GTEST_CAN_STREAM_RESULTS_ 1
862 #endif
863 
864 // Defines some utility macros.
865 
866 // The GNU compiler emits a warning if nested "if" statements are followed by
867 // an "else" statement and braces are not used to explicitly disambiguate the
868 // "else" binding. This leads to problems with code like:
869 //
870 // if (gate)
871 // ASSERT_*(condition) << "Some message";
872 //
873 // The "switch (0) case 0:" idiom is used to suppress this.
874 #ifdef __INTEL_COMPILER
875 # define GTEST_AMBIGUOUS_ELSE_BLOCKER_
876 #else
877 # define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT
878 #endif
879 
880 // Use this annotation at the end of a struct/class definition to
881 // prevent the compiler from optimizing away instances that are never
882 // used. This is useful when all interesting logic happens inside the
883 // c'tor and / or d'tor. Example:
884 //
885 // struct Foo {
886 // Foo() { ... }
887 // } GTEST_ATTRIBUTE_UNUSED_;
888 //
889 // Also use it after a variable or parameter declaration to tell the
890 // compiler the variable/parameter does not have to be used.
891 #if defined(__GNUC__) && !defined(COMPILER_ICC)
892 # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
893 #elif defined(__clang__)
894 # if __has_attribute(unused)
895 # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
896 # endif
897 #endif
898 #ifndef GTEST_ATTRIBUTE_UNUSED_
899 # define GTEST_ATTRIBUTE_UNUSED_
900 #endif
901 
902 // Use this annotation before a function that takes a printf format string.
903 #if (defined(__GNUC__) || defined(__clang__)) && !defined(COMPILER_ICC)
904 # if defined(__MINGW_PRINTF_FORMAT)
905 // MinGW has two different printf implementations. Ensure the format macro
906 // matches the selected implementation. See
907 // https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/.
908 # define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
909  __attribute__((__format__(__MINGW_PRINTF_FORMAT, string_index, \
910  first_to_check)))
911 # else
912 # define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
913  __attribute__((__format__(__printf__, string_index, first_to_check)))
914 # endif
915 #else
916 # define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
917 #endif
918 
919 
920 // A macro to disallow operator=
921 // This should be used in the private: declarations for a class.
922 #define GTEST_DISALLOW_ASSIGN_(type) \
923  void operator=(type const &) = delete
924 
925 // A macro to disallow copy constructor and operator=
926 // This should be used in the private: declarations for a class.
927 #define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \
928  type(type const &) = delete; \
929  GTEST_DISALLOW_ASSIGN_(type)
930 
931 // Tell the compiler to warn about unused return values for functions declared
932 // with this macro. The macro should be used on function declarations
933 // following the argument list:
934 //
935 // Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
936 #if defined(__GNUC__) && !defined(COMPILER_ICC)
937 # define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
938 #else
939 # define GTEST_MUST_USE_RESULT_
940 #endif // __GNUC__ && !COMPILER_ICC
941 
942 // MS C++ compiler emits warning when a conditional expression is compile time
943 // constant. In some contexts this warning is false positive and needs to be
944 // suppressed. Use the following two macros in such cases:
945 //
946 // GTEST_INTENTIONAL_CONST_COND_PUSH_()
947 // while (true) {
948 // GTEST_INTENTIONAL_CONST_COND_POP_()
949 // }
950 # define GTEST_INTENTIONAL_CONST_COND_PUSH_() \
951  GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127)
952 # define GTEST_INTENTIONAL_CONST_COND_POP_() \
953  GTEST_DISABLE_MSC_WARNINGS_POP_()
954 
955 // Determine whether the compiler supports Microsoft's Structured Exception
956 // Handling. This is supported by several Windows compilers but generally
957 // does not exist on any other system.
958 #ifndef GTEST_HAS_SEH
959 // The user didn't tell us, so we need to figure it out.
960 
961 # if defined(_MSC_VER) || defined(__BORLANDC__)
962 // These two compilers are known to support SEH.
963 # define GTEST_HAS_SEH 1
964 # else
965 // Assume no SEH.
966 # define GTEST_HAS_SEH 0
967 # endif
968 
969 #endif // GTEST_HAS_SEH
970 
971 #ifndef GTEST_IS_THREADSAFE
972 
973 #define GTEST_IS_THREADSAFE \
974  (GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ || \
975  (GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT) || \
976  GTEST_HAS_PTHREAD)
977 
978 #endif // GTEST_IS_THREADSAFE
979 
980 // GTEST_API_ qualifies all symbols that must be exported. The definitions below
981 // are guarded by #ifndef to give embedders a chance to define GTEST_API_ in
982 // gtest/internal/custom/gtest-port.h
983 #ifndef GTEST_API_
984 
985 #ifdef _MSC_VER
986 # if GTEST_LINKED_AS_SHARED_LIBRARY
987 # define GTEST_API_ __declspec(dllimport)
988 # elif GTEST_CREATE_SHARED_LIBRARY
989 # define GTEST_API_ __declspec(dllexport)
990 # endif
991 #elif __GNUC__ >= 4 || defined(__clang__)
992 # define GTEST_API_ __attribute__((visibility ("default")))
993 #endif // _MSC_VER
994 
995 #endif // GTEST_API_
996 
997 #ifndef GTEST_API_
998 # define GTEST_API_
999 #endif // GTEST_API_
1000 
1001 #ifndef GTEST_DEFAULT_DEATH_TEST_STYLE
1002 # define GTEST_DEFAULT_DEATH_TEST_STYLE "fast"
1003 #endif // GTEST_DEFAULT_DEATH_TEST_STYLE
1004 
1005 #ifdef __GNUC__
1006 // Ask the compiler to never inline a given function.
1007 # define GTEST_NO_INLINE_ __attribute__((noinline))
1008 #else
1009 # define GTEST_NO_INLINE_
1010 #endif
1011 
1012 // _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
1013 #if !defined(GTEST_HAS_CXXABI_H_)
1014 # if defined(__GLIBCXX__) || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER))
1015 # define GTEST_HAS_CXXABI_H_ 1
1016 # else
1017 # define GTEST_HAS_CXXABI_H_ 0
1018 # endif
1019 #endif
1020 
1021 // A function level attribute to disable checking for use of uninitialized
1022 // memory when built with MemorySanitizer.
1023 #if defined(__clang__)
1024 # if __has_feature(memory_sanitizer)
1025 # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ \
1026  __attribute__((no_sanitize_memory))
1027 # else
1028 # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
1029 # endif // __has_feature(memory_sanitizer)
1030 #else
1031 # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
1032 #endif // __clang__
1033 
1034 // A function level attribute to disable AddressSanitizer instrumentation.
1035 #if defined(__clang__)
1036 # if __has_feature(address_sanitizer)
1037 # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \
1038  __attribute__((no_sanitize_address))
1039 # else
1040 # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
1041 # endif // __has_feature(address_sanitizer)
1042 #else
1043 # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
1044 #endif // __clang__
1045 
1046 // A function level attribute to disable ThreadSanitizer instrumentation.
1047 #if defined(__clang__)
1048 # if __has_feature(thread_sanitizer)
1049 # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ \
1050  __attribute__((no_sanitize_thread))
1051 # else
1052 # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
1053 # endif // __has_feature(thread_sanitizer)
1054 #else
1055 # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
1056 #endif // __clang__
1057 
1058 namespace testing {
1059 
1060 class Message;
1061 
1062 // Legacy imports for backwards compatibility.
1063 // New code should use std:: names directly.
1064 using std::get;
1065 using std::make_tuple;
1066 using std::tuple;
1067 using std::tuple_element;
1068 using std::tuple_size;
1069 
1070 namespace internal {
1071 
1072 // A secret type that Google Test users don't know about. It has no
1073 // definition on purpose. Therefore it's impossible to create a
1074 // Secret object, which is what we want.
1075 class Secret;
1076 
1077 // The GTEST_COMPILE_ASSERT_ is a legacy macro used to verify that a compile
1078 // time expression is true (in new code, use static_assert instead). For
1079 // example, you could use it to verify the size of a static array:
1080 //
1081 // GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES,
1082 // names_incorrect_size);
1083 //
1084 // The second argument to the macro must be a valid C++ identifier. If the
1085 // expression is false, compiler will issue an error containing this identifier.
1086 #define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg)
1087 
1088 // StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.
1089 //
1090 // This template is declared, but intentionally undefined.
1091 template <typename T1, typename T2>
1093 
1094 template <typename T>
1096  enum { value = true };
1097 };
1098 
1099 // Same as std::is_same<>.
1100 template <typename T, typename U>
1101 struct IsSame {
1102  enum { value = false };
1103 };
1104 template <typename T>
1105 struct IsSame<T, T> {
1106  enum { value = true };
1107 };
1108 
1109 // Evaluates to the number of elements in 'array'.
1110 #define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0]))
1111 
1112 #if GTEST_HAS_GLOBAL_STRING
1114 #else
1116 #endif // GTEST_HAS_GLOBAL_STRING
1117 
1118 #if GTEST_HAS_GLOBAL_WSTRING
1120 #elif GTEST_HAS_STD_WSTRING
1122 #endif // GTEST_HAS_GLOBAL_WSTRING
1123 
1124 // A helper for suppressing warnings on constant condition. It just
1125 // returns 'condition'.
1126 GTEST_API_ bool IsTrue(bool condition);
1127 
1128 // Defines RE.
1129 
1130 #if GTEST_USES_PCRE
1131 // if used, PCRE is injected by custom/gtest-port.h
1132 #elif GTEST_USES_POSIX_RE || GTEST_USES_SIMPLE_RE
1133 
1134 // A simple C++ wrapper for <regex.h>. It uses the POSIX Extended
1135 // Regular Expression syntax.
1137  public:
1138  // A copy constructor is required by the Standard to initialize object
1139  // references from r-values.
1140  RE(const RE& other) { Init(other.pattern()); }
1141 
1142  // Constructs an RE from a string.
1143  RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT
1144 
1145 # if GTEST_HAS_GLOBAL_STRING
1146 
1147  RE(const ::string& regex) { Init(regex.c_str()); } // NOLINT
1148 
1149 # endif // GTEST_HAS_GLOBAL_STRING
1150 
1151  RE(const char* regex) { Init(regex); } // NOLINT
1152  ~RE();
1153 
1154  // Returns the string representation of the regex.
1155  const char* pattern() const { return pattern_; }
1156 
1157  // FullMatch(str, re) returns true iff regular expression re matches
1158  // the entire str.
1159  // PartialMatch(str, re) returns true iff regular expression re
1160  // matches a substring of str (including str itself).
1161  static bool FullMatch(const ::std::string& str, const RE& re) {
1162  return FullMatch(str.c_str(), re);
1163  }
1164  static bool PartialMatch(const ::std::string& str, const RE& re) {
1165  return PartialMatch(str.c_str(), re);
1166  }
1167 
1168 # if GTEST_HAS_GLOBAL_STRING
1169 
1170  static bool FullMatch(const ::string& str, const RE& re) {
1171  return FullMatch(str.c_str(), re);
1172  }
1173  static bool PartialMatch(const ::string& str, const RE& re) {
1174  return PartialMatch(str.c_str(), re);
1175  }
1176 
1177 # endif // GTEST_HAS_GLOBAL_STRING
1178 
1179  static bool FullMatch(const char* str, const RE& re);
1180  static bool PartialMatch(const char* str, const RE& re);
1181 
1182  private:
1183  void Init(const char* regex);
1184  const char* pattern_;
1185  bool is_valid_;
1186 
1187 # if GTEST_USES_POSIX_RE
1188 
1189  regex_t full_regex_; // For FullMatch().
1190  regex_t partial_regex_; // For PartialMatch().
1191 
1192 # else // GTEST_USES_SIMPLE_RE
1193 
1194  const char* full_pattern_; // For FullMatch();
1195 
1196 # endif
1197 
1199 };
1200 
1201 #endif // GTEST_USES_PCRE
1202 
1203 // Formats a source file path and a line number as they would appear
1204 // in an error message from the compiler used to compile this code.
1205 GTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
1206 
1207 // Formats a file location for compiler-independent XML output.
1208 // Although this function is not platform dependent, we put it next to
1209 // FormatFileLocation in order to contrast the two functions.
1211  int line);
1212 
1213 // Defines logging utilities:
1214 // GTEST_LOG_(severity) - logs messages at the specified severity level. The
1215 // message itself is streamed into the macro.
1216 // LogToStderr() - directs all log messages to stderr.
1217 // FlushInfoLog() - flushes informational log messages.
1218 
1224 };
1225 
1226 // Formats log entry severity, provides a stream object for streaming the
1227 // log message, and terminates the message with a newline when going out of
1228 // scope.
1230  public:
1231  GTestLog(GTestLogSeverity severity, const char* file, int line);
1232 
1233  // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
1234  ~GTestLog();
1235 
1236  ::std::ostream& GetStream() { return ::std::cerr; }
1237 
1238  private:
1239  const GTestLogSeverity severity_;
1240 
1242 };
1243 
1244 #if !defined(GTEST_LOG_)
1245 
1246 # define GTEST_LOG_(severity) \
1247  ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
1248  __FILE__, __LINE__).GetStream()
1249 
1250 inline void LogToStderr() {}
1251 inline void FlushInfoLog() { fflush(nullptr); }
1252 
1253 #endif // !defined(GTEST_LOG_)
1254 
1255 #if !defined(GTEST_CHECK_)
1256 // INTERNAL IMPLEMENTATION - DO NOT USE.
1257 //
1258 // GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
1259 // is not satisfied.
1260 // Synopsys:
1261 // GTEST_CHECK_(boolean_condition);
1262 // or
1263 // GTEST_CHECK_(boolean_condition) << "Additional message";
1264 //
1265 // This checks the condition and if the condition is not satisfied
1266 // it prints message about the condition violation, including the
1267 // condition itself, plus additional message streamed into it, if any,
1268 // and then it aborts the program. It aborts the program irrespective of
1269 // whether it is built in the debug mode or not.
1270 # define GTEST_CHECK_(condition) \
1271  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1272  if (::testing::internal::IsTrue(condition)) \
1273  ; \
1274  else \
1275  GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
1276 #endif // !defined(GTEST_CHECK_)
1277 
1278 // An all-mode assert to verify that the given POSIX-style function
1279 // call returns 0 (indicating success). Known limitation: this
1280 // doesn't expand to a balanced 'if' statement, so enclose the macro
1281 // in {} if you need to use it as the only statement in an 'if'
1282 // branch.
1283 #define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
1284  if (const int gtest_error = (posix_call)) \
1285  GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
1286  << gtest_error
1287 
1288 // Adds reference to a type if it is not a reference type,
1289 // otherwise leaves it unchanged. This is the same as
1290 // tr1::add_reference, which is not widely available yet.
1291 template <typename T>
1292 struct AddReference { typedef T& type; }; // NOLINT
1293 template <typename T>
1294 struct AddReference<T&> { typedef T& type; }; // NOLINT
1295 
1296 // A handy wrapper around AddReference that works when the argument T
1297 // depends on template parameters.
1298 #define GTEST_ADD_REFERENCE_(T) \
1299  typename ::testing::internal::AddReference<T>::type
1300 
1301 // Transforms "T" into "const T&" according to standard reference collapsing
1302 // rules (this is only needed as a backport for C++98 compilers that do not
1303 // support reference collapsing). Specifically, it transforms:
1304 //
1305 // char ==> const char&
1306 // const char ==> const char&
1307 // char& ==> char&
1308 // const char& ==> const char&
1309 //
1310 // Note that the non-const reference will not have "const" added. This is
1311 // standard, and necessary so that "T" can always bind to "const T&".
1312 template <typename T>
1313 struct ConstRef { typedef const T& type; };
1314 template <typename T>
1315 struct ConstRef<T&> { typedef T& type; };
1316 
1317 // The argument T must depend on some template parameters.
1318 #define GTEST_REFERENCE_TO_CONST_(T) \
1319  typename ::testing::internal::ConstRef<T>::type
1320 
1321 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
1322 //
1323 // Use ImplicitCast_ as a safe version of static_cast for upcasting in
1324 // the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a
1325 // const Foo*). When you use ImplicitCast_, the compiler checks that
1326 // the cast is safe. Such explicit ImplicitCast_s are necessary in
1327 // surprisingly many situations where C++ demands an exact type match
1328 // instead of an argument type convertable to a target type.
1329 //
1330 // The syntax for using ImplicitCast_ is the same as for static_cast:
1331 //
1332 // ImplicitCast_<ToType>(expr)
1333 //
1334 // ImplicitCast_ would have been part of the C++ standard library,
1335 // but the proposal was submitted too late. It will probably make
1336 // its way into the language in the future.
1337 //
1338 // This relatively ugly name is intentional. It prevents clashes with
1339 // similar functions users may have (e.g., implicit_cast). The internal
1340 // namespace alone is not enough because the function can be found by ADL.
1341 template<typename To>
1342 inline To ImplicitCast_(To x) { return x; }
1343 
1344 // When you upcast (that is, cast a pointer from type Foo to type
1345 // SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts
1346 // always succeed. When you downcast (that is, cast a pointer from
1347 // type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
1348 // how do you know the pointer is really of type SubclassOfFoo? It
1349 // could be a bare Foo, or of type DifferentSubclassOfFoo. Thus,
1350 // when you downcast, you should use this macro. In debug mode, we
1351 // use dynamic_cast<> to double-check the downcast is legal (we die
1352 // if it's not). In normal mode, we do the efficient static_cast<>
1353 // instead. Thus, it's important to test in debug mode to make sure
1354 // the cast is legal!
1355 // This is the only place in the code we should use dynamic_cast<>.
1356 // In particular, you SHOULDN'T be using dynamic_cast<> in order to
1357 // do RTTI (eg code like this:
1358 // if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
1359 // if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
1360 // You should design the code some other way not to need this.
1361 //
1362 // This relatively ugly name is intentional. It prevents clashes with
1363 // similar functions users may have (e.g., down_cast). The internal
1364 // namespace alone is not enough because the function can be found by ADL.
1365 template<typename To, typename From> // use like this: DownCast_<T*>(foo);
1366 inline To DownCast_(From* f) { // so we only accept pointers
1367  // Ensures that To is a sub-type of From *. This test is here only
1368  // for compile-time type checking, and has no overhead in an
1369  // optimized build at run-time, as it will be optimized away
1370  // completely.
1372  if (false) {
1374  const To to = nullptr;
1375  ::testing::internal::ImplicitCast_<From*>(to);
1376  }
1377 
1378 #if GTEST_HAS_RTTI
1379  // RTTI: debug mode only!
1380  GTEST_CHECK_(f == nullptr || dynamic_cast<To>(f) != nullptr);
1381 #endif
1382  return static_cast<To>(f);
1383 }
1384 
1385 // Downcasts the pointer of type Base to Derived.
1386 // Derived must be a subclass of Base. The parameter MUST
1387 // point to a class of type Derived, not any subclass of it.
1388 // When RTTI is available, the function performs a runtime
1389 // check to enforce this.
1390 template <class Derived, class Base>
1391 Derived* CheckedDowncastToActualType(Base* base) {
1392 #if GTEST_HAS_RTTI
1393  GTEST_CHECK_(typeid(*base) == typeid(Derived));
1394 #endif
1395 
1396 #if GTEST_HAS_DOWNCAST_
1397  return ::down_cast<Derived*>(base);
1398 #elif GTEST_HAS_RTTI
1399  return dynamic_cast<Derived*>(base); // NOLINT
1400 #else
1401  return static_cast<Derived*>(base); // Poor man's downcast.
1402 #endif
1403 }
1404 
1405 #if GTEST_HAS_STREAM_REDIRECTION
1406 
1407 // Defines the stderr capturer:
1408 // CaptureStdout - starts capturing stdout.
1409 // GetCapturedStdout - stops capturing stdout and returns the captured string.
1410 // CaptureStderr - starts capturing stderr.
1411 // GetCapturedStderr - stops capturing stderr and returns the captured string.
1412 //
1413 GTEST_API_ void CaptureStdout();
1415 GTEST_API_ void CaptureStderr();
1417 
1418 #endif // GTEST_HAS_STREAM_REDIRECTION
1419 // Returns the size (in bytes) of a file.
1420 GTEST_API_ size_t GetFileSize(FILE* file);
1421 
1422 // Reads the entire content of a file as a string.
1424 
1425 // All command line arguments.
1426 GTEST_API_ std::vector<std::string> GetArgvs();
1427 
1428 #if GTEST_HAS_DEATH_TEST
1429 
1430 std::vector<std::string> GetInjectableArgvs();
1431 // Deprecated: pass the args vector by value instead.
1432 void SetInjectableArgvs(const std::vector<std::string>* new_argvs);
1433 void SetInjectableArgvs(const std::vector<std::string>& new_argvs);
1434 #if GTEST_HAS_GLOBAL_STRING
1435 void SetInjectableArgvs(const std::vector< ::string>& new_argvs);
1436 #endif // GTEST_HAS_GLOBAL_STRING
1437 void ClearInjectableArgvs();
1438 
1439 #endif // GTEST_HAS_DEATH_TEST
1440 
1441 // Defines synchronization primitives.
1442 #if GTEST_IS_THREADSAFE
1443 # if GTEST_HAS_PTHREAD
1444 // Sleeps for (roughly) n milliseconds. This function is only for testing
1445 // Google Test's own constructs. Don't use it in user tests, either
1446 // directly or indirectly.
1447 inline void SleepMilliseconds(int n) {
1448  const timespec time = {
1449  0, // 0 seconds.
1450  n * 1000L * 1000L, // And n ms.
1451  };
1452  nanosleep(&time, nullptr);
1453 }
1454 # endif // GTEST_HAS_PTHREAD
1455 
1456 # if GTEST_HAS_NOTIFICATION_
1457 // Notification has already been imported into the namespace.
1458 // Nothing to do here.
1459 
1460 # elif GTEST_HAS_PTHREAD
1461 // Allows a controller thread to pause execution of newly created
1462 // threads until notified. Instances of this class must be created
1463 // and destroyed in the controller thread.
1464 //
1465 // This class is only for testing Google Test's own constructs. Do not
1466 // use it in user tests, either directly or indirectly.
1467 class Notification {
1468  public:
1469  Notification() : notified_(false) {
1470  GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, nullptr));
1471  }
1472  ~Notification() {
1473  pthread_mutex_destroy(&mutex_);
1474  }
1475 
1476  // Notifies all threads created with this notification to start. Must
1477  // be called from the controller thread.
1478  void Notify() {
1479  pthread_mutex_lock(&mutex_);
1480  notified_ = true;
1481  pthread_mutex_unlock(&mutex_);
1482  }
1483 
1484  // Blocks until the controller thread notifies. Must be called from a test
1485  // thread.
1486  void WaitForNotification() {
1487  for (;;) {
1488  pthread_mutex_lock(&mutex_);
1489  const bool notified = notified_;
1490  pthread_mutex_unlock(&mutex_);
1491  if (notified)
1492  break;
1493  SleepMilliseconds(10);
1494  }
1495  }
1496 
1497  private:
1498  pthread_mutex_t mutex_;
1499  bool notified_;
1500 
1501  GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
1502 };
1503 
1504 # elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
1505 
1506 GTEST_API_ void SleepMilliseconds(int n);
1507 
1508 // Provides leak-safe Windows kernel handle ownership.
1509 // Used in death tests and in threading support.
1510 class GTEST_API_ AutoHandle {
1511  public:
1512  // Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to
1513  // avoid including <windows.h> in this header file. Including <windows.h> is
1514  // undesirable because it defines a lot of symbols and macros that tend to
1515  // conflict with client code. This assumption is verified by
1516  // WindowsTypesTest.HANDLEIsVoidStar.
1517  typedef void* Handle;
1518  AutoHandle();
1519  explicit AutoHandle(Handle handle);
1520 
1521  ~AutoHandle();
1522 
1523  Handle Get() const;
1524  void Reset();
1525  void Reset(Handle handle);
1526 
1527  private:
1528  // Returns true iff the handle is a valid handle object that can be closed.
1529  bool IsCloseable() const;
1530 
1531  Handle handle_;
1532 
1533  GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
1534 };
1535 
1536 // Allows a controller thread to pause execution of newly created
1537 // threads until notified. Instances of this class must be created
1538 // and destroyed in the controller thread.
1539 //
1540 // This class is only for testing Google Test's own constructs. Do not
1541 // use it in user tests, either directly or indirectly.
1542 class GTEST_API_ Notification {
1543  public:
1544  Notification();
1545  void Notify();
1546  void WaitForNotification();
1547 
1548  private:
1549  AutoHandle event_;
1550 
1551  GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
1552 };
1553 # endif // GTEST_HAS_NOTIFICATION_
1554 
1555 // On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD
1556 // defined, but we don't want to use MinGW's pthreads implementation, which
1557 // has conformance problems with some versions of the POSIX standard.
1558 # if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW
1559 
1560 // As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
1561 // Consequently, it cannot select a correct instantiation of ThreadWithParam
1562 // in order to call its Run(). Introducing ThreadWithParamBase as a
1563 // non-templated base class for ThreadWithParam allows us to bypass this
1564 // problem.
1565 class ThreadWithParamBase {
1566  public:
1567  virtual ~ThreadWithParamBase() {}
1568  virtual void Run() = 0;
1569 };
1570 
1571 // pthread_create() accepts a pointer to a function type with the C linkage.
1572 // According to the Standard (7.5/1), function types with different linkages
1573 // are different even if they are otherwise identical. Some compilers (for
1574 // example, SunStudio) treat them as different types. Since class methods
1575 // cannot be defined with C-linkage we need to define a free C-function to
1576 // pass into pthread_create().
1577 extern "C" inline void* ThreadFuncWithCLinkage(void* thread) {
1578  static_cast<ThreadWithParamBase*>(thread)->Run();
1579  return nullptr;
1580 }
1581 
1582 // Helper class for testing Google Test's multi-threading constructs.
1583 // To use it, write:
1584 //
1585 // void ThreadFunc(int param) { /* Do things with param */ }
1586 // Notification thread_can_start;
1587 // ...
1588 // // The thread_can_start parameter is optional; you can supply NULL.
1589 // ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);
1590 // thread_can_start.Notify();
1591 //
1592 // These classes are only for testing Google Test's own constructs. Do
1593 // not use them in user tests, either directly or indirectly.
1594 template <typename T>
1595 class ThreadWithParam : public ThreadWithParamBase {
1596  public:
1597  typedef void UserThreadFunc(T);
1598 
1599  ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
1600  : func_(func),
1601  param_(param),
1602  thread_can_start_(thread_can_start),
1603  finished_(false) {
1604  ThreadWithParamBase* const base = this;
1605  // The thread can be created only after all fields except thread_
1606  // have been initialized.
1608  pthread_create(&thread_, nullptr, &ThreadFuncWithCLinkage, base));
1609  }
1610  ~ThreadWithParam() override { Join(); }
1611 
1612  void Join() {
1613  if (!finished_) {
1614  GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, nullptr));
1615  finished_ = true;
1616  }
1617  }
1618 
1619  void Run() override {
1620  if (thread_can_start_ != nullptr) thread_can_start_->WaitForNotification();
1621  func_(param_);
1622  }
1623 
1624  private:
1625  UserThreadFunc* const func_; // User-supplied thread function.
1626  const T param_; // User-supplied parameter to the thread function.
1627  // When non-NULL, used to block execution until the controller thread
1628  // notifies.
1629  Notification* const thread_can_start_;
1630  bool finished_; // true iff we know that the thread function has finished.
1631  pthread_t thread_; // The native thread object.
1632 
1633  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
1634 };
1635 # endif // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD ||
1636  // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
1637 
1638 # if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
1639 // Mutex and ThreadLocal have already been imported into the namespace.
1640 // Nothing to do here.
1641 
1642 # elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
1643 
1644 // Mutex implements mutex on Windows platforms. It is used in conjunction
1645 // with class MutexLock:
1646 //
1647 // Mutex mutex;
1648 // ...
1649 // MutexLock lock(&mutex); // Acquires the mutex and releases it at the
1650 // // end of the current scope.
1651 //
1652 // A static Mutex *must* be defined or declared using one of the following
1653 // macros:
1654 // GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);
1655 // GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
1656 //
1657 // (A non-static Mutex is defined/declared in the usual way).
1658 class GTEST_API_ Mutex {
1659  public:
1660  enum MutexType { kStatic = 0, kDynamic = 1 };
1661  // We rely on kStaticMutex being 0 as it is to what the linker initializes
1662  // type_ in static mutexes. critical_section_ will be initialized lazily
1663  // in ThreadSafeLazyInit().
1664  enum StaticConstructorSelector { kStaticMutex = 0 };
1665 
1666  // This constructor intentionally does nothing. It relies on type_ being
1667  // statically initialized to 0 (effectively setting it to kStatic) and on
1668  // ThreadSafeLazyInit() to lazily initialize the rest of the members.
1669  explicit Mutex(StaticConstructorSelector /*dummy*/) {}
1670 
1671  Mutex();
1672  ~Mutex();
1673 
1674  void Lock();
1675 
1676  void Unlock();
1677 
1678  // Does nothing if the current thread holds the mutex. Otherwise, crashes
1679  // with high probability.
1680  void AssertHeld();
1681 
1682  private:
1683  // Initializes owner_thread_id_ and critical_section_ in static mutexes.
1684  void ThreadSafeLazyInit();
1685 
1686  // Per https://blogs.msdn.microsoft.com/oldnewthing/20040223-00/?p=40503,
1687  // we assume that 0 is an invalid value for thread IDs.
1688  unsigned int owner_thread_id_;
1689 
1690  // For static mutexes, we rely on these members being initialized to zeros
1691  // by the linker.
1692  MutexType type_;
1693  long critical_section_init_phase_; // NOLINT
1694  GTEST_CRITICAL_SECTION* critical_section_;
1695 
1697 };
1698 
1699 # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
1700  extern ::testing::internal::Mutex mutex
1701 
1702 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
1703  ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex)
1704 
1705 // We cannot name this class MutexLock because the ctor declaration would
1706 // conflict with a macro named MutexLock, which is defined on some
1707 // platforms. That macro is used as a defensive measure to prevent against
1708 // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
1709 // "MutexLock l(&mu)". Hence the typedef trick below.
1710 class GTestMutexLock {
1711  public:
1712  explicit GTestMutexLock(Mutex* mutex)
1713  : mutex_(mutex) { mutex_->Lock(); }
1714 
1715  ~GTestMutexLock() { mutex_->Unlock(); }
1716 
1717  private:
1718  Mutex* const mutex_;
1719 
1721 };
1722 
1723 typedef GTestMutexLock MutexLock;
1724 
1725 // Base class for ValueHolder<T>. Allows a caller to hold and delete a value
1726 // without knowing its type.
1727 class ThreadLocalValueHolderBase {
1728  public:
1729  virtual ~ThreadLocalValueHolderBase() {}
1730 };
1731 
1732 // Provides a way for a thread to send notifications to a ThreadLocal
1733 // regardless of its parameter type.
1734 class ThreadLocalBase {
1735  public:
1736  // Creates a new ValueHolder<T> object holding a default value passed to
1737  // this ThreadLocal<T>'s constructor and returns it. It is the caller's
1738  // responsibility not to call this when the ThreadLocal<T> instance already
1739  // has a value on the current thread.
1740  virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0;
1741 
1742  protected:
1743  ThreadLocalBase() {}
1744  virtual ~ThreadLocalBase() {}
1745 
1746  private:
1747  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocalBase);
1748 };
1749 
1750 // Maps a thread to a set of ThreadLocals that have values instantiated on that
1751 // thread and notifies them when the thread exits. A ThreadLocal instance is
1752 // expected to persist until all threads it has values on have terminated.
1753 class GTEST_API_ ThreadLocalRegistry {
1754  public:
1755  // Registers thread_local_instance as having value on the current thread.
1756  // Returns a value that can be used to identify the thread from other threads.
1757  static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
1758  const ThreadLocalBase* thread_local_instance);
1759 
1760  // Invoked when a ThreadLocal instance is destroyed.
1761  static void OnThreadLocalDestroyed(
1762  const ThreadLocalBase* thread_local_instance);
1763 };
1764 
1765 class GTEST_API_ ThreadWithParamBase {
1766  public:
1767  void Join();
1768 
1769  protected:
1770  class Runnable {
1771  public:
1772  virtual ~Runnable() {}
1773  virtual void Run() = 0;
1774  };
1775 
1776  ThreadWithParamBase(Runnable *runnable, Notification* thread_can_start);
1777  virtual ~ThreadWithParamBase();
1778 
1779  private:
1780  AutoHandle thread_;
1781 };
1782 
1783 // Helper class for testing Google Test's multi-threading constructs.
1784 template <typename T>
1785 class ThreadWithParam : public ThreadWithParamBase {
1786  public:
1787  typedef void UserThreadFunc(T);
1788 
1789  ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
1790  : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {
1791  }
1792  virtual ~ThreadWithParam() {}
1793 
1794  private:
1795  class RunnableImpl : public Runnable {
1796  public:
1797  RunnableImpl(UserThreadFunc* func, T param)
1798  : func_(func),
1799  param_(param) {
1800  }
1801  virtual ~RunnableImpl() {}
1802  virtual void Run() {
1803  func_(param_);
1804  }
1805 
1806  private:
1807  UserThreadFunc* const func_;
1808  const T param_;
1809 
1810  GTEST_DISALLOW_COPY_AND_ASSIGN_(RunnableImpl);
1811  };
1812 
1813  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
1814 };
1815 
1816 // Implements thread-local storage on Windows systems.
1817 //
1818 // // Thread 1
1819 // ThreadLocal<int> tl(100); // 100 is the default value for each thread.
1820 //
1821 // // Thread 2
1822 // tl.set(150); // Changes the value for thread 2 only.
1823 // EXPECT_EQ(150, tl.get());
1824 //
1825 // // Thread 1
1826 // EXPECT_EQ(100, tl.get()); // In thread 1, tl has the original value.
1827 // tl.set(200);
1828 // EXPECT_EQ(200, tl.get());
1829 //
1830 // The template type argument T must have a public copy constructor.
1831 // In addition, the default ThreadLocal constructor requires T to have
1832 // a public default constructor.
1833 //
1834 // The users of a TheadLocal instance have to make sure that all but one
1835 // threads (including the main one) using that instance have exited before
1836 // destroying it. Otherwise, the per-thread objects managed for them by the
1837 // ThreadLocal instance are not guaranteed to be destroyed on all platforms.
1838 //
1839 // Google Test only uses global ThreadLocal objects. That means they
1840 // will die after main() has returned. Therefore, no per-thread
1841 // object managed by Google Test will be leaked as long as all threads
1842 // using Google Test have exited when main() returns.
1843 template <typename T>
1844 class ThreadLocal : public ThreadLocalBase {
1845  public:
1846  ThreadLocal() : default_factory_(new DefaultValueHolderFactory()) {}
1847  explicit ThreadLocal(const T& value)
1848  : default_factory_(new InstanceValueHolderFactory(value)) {}
1849 
1850  ~ThreadLocal() { ThreadLocalRegistry::OnThreadLocalDestroyed(this); }
1851 
1852  T* pointer() { return GetOrCreateValue(); }
1853  const T* pointer() const { return GetOrCreateValue(); }
1854  const T& get() const { return *pointer(); }
1855  void set(const T& value) { *pointer() = value; }
1856 
1857  private:
1858  // Holds a value of T. Can be deleted via its base class without the caller
1859  // knowing the type of T.
1860  class ValueHolder : public ThreadLocalValueHolderBase {
1861  public:
1862  ValueHolder() : value_() {}
1863  explicit ValueHolder(const T& value) : value_(value) {}
1864 
1865  T* pointer() { return &value_; }
1866 
1867  private:
1868  T value_;
1869  GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
1870  };
1871 
1872 
1873  T* GetOrCreateValue() const {
1874  return static_cast<ValueHolder*>(
1875  ThreadLocalRegistry::GetValueOnCurrentThread(this))->pointer();
1876  }
1877 
1878  virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const {
1879  return default_factory_->MakeNewHolder();
1880  }
1881 
1882  class ValueHolderFactory {
1883  public:
1884  ValueHolderFactory() {}
1885  virtual ~ValueHolderFactory() {}
1886  virtual ValueHolder* MakeNewHolder() const = 0;
1887 
1888  private:
1889  GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
1890  };
1891 
1892  class DefaultValueHolderFactory : public ValueHolderFactory {
1893  public:
1894  DefaultValueHolderFactory() {}
1895  virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); }
1896 
1897  private:
1898  GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
1899  };
1900 
1901  class InstanceValueHolderFactory : public ValueHolderFactory {
1902  public:
1903  explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
1904  virtual ValueHolder* MakeNewHolder() const {
1905  return new ValueHolder(value_);
1906  }
1907 
1908  private:
1909  const T value_; // The value for each thread.
1910 
1911  GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
1912  };
1913 
1914  std::unique_ptr<ValueHolderFactory> default_factory_;
1915 
1917 };
1918 
1919 # elif GTEST_HAS_PTHREAD
1920 
1921 // MutexBase and Mutex implement mutex on pthreads-based platforms.
1922 class MutexBase {
1923  public:
1924  // Acquires this mutex.
1925  void Lock() {
1926  GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
1927  owner_ = pthread_self();
1928  has_owner_ = true;
1929  }
1930 
1931  // Releases this mutex.
1932  void Unlock() {
1933  // Since the lock is being released the owner_ field should no longer be
1934  // considered valid. We don't protect writing to has_owner_ here, as it's
1935  // the caller's responsibility to ensure that the current thread holds the
1936  // mutex when this is called.
1937  has_owner_ = false;
1938  GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
1939  }
1940 
1941  // Does nothing if the current thread holds the mutex. Otherwise, crashes
1942  // with high probability.
1943  void AssertHeld() const {
1944  GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
1945  << "The current thread is not holding the mutex @" << this;
1946  }
1947 
1948  // A static mutex may be used before main() is entered. It may even
1949  // be used before the dynamic initialization stage. Therefore we
1950  // must be able to initialize a static mutex object at link time.
1951  // This means MutexBase has to be a POD and its member variables
1952  // have to be public.
1953  public:
1954  pthread_mutex_t mutex_; // The underlying pthread mutex.
1955  // has_owner_ indicates whether the owner_ field below contains a valid thread
1956  // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All
1957  // accesses to the owner_ field should be protected by a check of this field.
1958  // An alternative might be to memset() owner_ to all zeros, but there's no
1959  // guarantee that a zero'd pthread_t is necessarily invalid or even different
1960  // from pthread_self().
1961  bool has_owner_;
1962  pthread_t owner_; // The thread holding the mutex.
1963 };
1964 
1965 // Forward-declares a static mutex.
1966 # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
1967  extern ::testing::internal::MutexBase mutex
1968 
1969 // Defines and statically (i.e. at link time) initializes a static mutex.
1970 // The initialization list here does not explicitly initialize each field,
1971 // instead relying on default initialization for the unspecified fields. In
1972 // particular, the owner_ field (a pthread_t) is not explicitly initialized.
1973 // This allows initialization to work whether pthread_t is a scalar or struct.
1974 // The flag -Wmissing-field-initializers must not be specified for this to work.
1975 #define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
1976  ::testing::internal::MutexBase mutex = {PTHREAD_MUTEX_INITIALIZER, false, 0}
1977 
1978 // The Mutex class can only be used for mutexes created at runtime. It
1979 // shares its API with MutexBase otherwise.
1980 class Mutex : public MutexBase {
1981  public:
1982  Mutex() {
1983  GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, nullptr));
1984  has_owner_ = false;
1985  }
1986  ~Mutex() {
1987  GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
1988  }
1989 
1990  private:
1992 };
1993 
1994 // We cannot name this class MutexLock because the ctor declaration would
1995 // conflict with a macro named MutexLock, which is defined on some
1996 // platforms. That macro is used as a defensive measure to prevent against
1997 // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
1998 // "MutexLock l(&mu)". Hence the typedef trick below.
1999 class GTestMutexLock {
2000  public:
2001  explicit GTestMutexLock(MutexBase* mutex)
2002  : mutex_(mutex) { mutex_->Lock(); }
2003 
2004  ~GTestMutexLock() { mutex_->Unlock(); }
2005 
2006  private:
2007  MutexBase* const mutex_;
2008 
2010 };
2011 
2012 typedef GTestMutexLock MutexLock;
2013 
2014 // Helpers for ThreadLocal.
2015 
2016 // pthread_key_create() requires DeleteThreadLocalValue() to have
2017 // C-linkage. Therefore it cannot be templatized to access
2018 // ThreadLocal<T>. Hence the need for class
2019 // ThreadLocalValueHolderBase.
2020 class ThreadLocalValueHolderBase {
2021  public:
2022  virtual ~ThreadLocalValueHolderBase() {}
2023 };
2024 
2025 // Called by pthread to delete thread-local data stored by
2026 // pthread_setspecific().
2027 extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
2028  delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
2029 }
2030 
2031 // Implements thread-local storage on pthreads-based systems.
2032 template <typename T>
2033 class GTEST_API_ ThreadLocal {
2034  public:
2035  ThreadLocal()
2036  : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {}
2037  explicit ThreadLocal(const T& value)
2038  : key_(CreateKey()),
2039  default_factory_(new InstanceValueHolderFactory(value)) {}
2040 
2041  ~ThreadLocal() {
2042  // Destroys the managed object for the current thread, if any.
2043  DeleteThreadLocalValue(pthread_getspecific(key_));
2044 
2045  // Releases resources associated with the key. This will *not*
2046  // delete managed objects for other threads.
2047  GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));
2048  }
2049 
2050  T* pointer() { return GetOrCreateValue(); }
2051  const T* pointer() const { return GetOrCreateValue(); }
2052  const T& get() const { return *pointer(); }
2053  void set(const T& value) { *pointer() = value; }
2054 
2055  private:
2056  // Holds a value of type T.
2057  class ValueHolder : public ThreadLocalValueHolderBase {
2058  public:
2059  ValueHolder() : value_() {}
2060  explicit ValueHolder(const T& value) : value_(value) {}
2061 
2062  T* pointer() { return &value_; }
2063 
2064  private:
2065  T value_;
2066  GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
2067  };
2068 
2069  static pthread_key_t CreateKey() {
2070  pthread_key_t key;
2071  // When a thread exits, DeleteThreadLocalValue() will be called on
2072  // the object managed for that thread.
2074  pthread_key_create(&key, &DeleteThreadLocalValue));
2075  return key;
2076  }
2077 
2078  T* GetOrCreateValue() const {
2079  ThreadLocalValueHolderBase* const holder =
2080  static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));
2081  if (holder != nullptr) {
2082  return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
2083  }
2084 
2085  ValueHolder* const new_holder = default_factory_->MakeNewHolder();
2086  ThreadLocalValueHolderBase* const holder_base = new_holder;
2087  GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
2088  return new_holder->pointer();
2089  }
2090 
2091  class ValueHolderFactory {
2092  public:
2093  ValueHolderFactory() {}
2094  virtual ~ValueHolderFactory() {}
2095  virtual ValueHolder* MakeNewHolder() const = 0;
2096 
2097  private:
2098  GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
2099  };
2100 
2101  class DefaultValueHolderFactory : public ValueHolderFactory {
2102  public:
2103  DefaultValueHolderFactory() {}
2104  virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); }
2105 
2106  private:
2107  GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
2108  };
2109 
2110  class InstanceValueHolderFactory : public ValueHolderFactory {
2111  public:
2112  explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
2113  virtual ValueHolder* MakeNewHolder() const {
2114  return new ValueHolder(value_);
2115  }
2116 
2117  private:
2118  const T value_; // The value for each thread.
2119 
2120  GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
2121  };
2122 
2123  // A key pthreads uses for looking up per-thread values.
2124  const pthread_key_t key_;
2125  std::unique_ptr<ValueHolderFactory> default_factory_;
2126 
2127  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
2128 };
2129 
2130 # endif // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
2131 
2132 #else // GTEST_IS_THREADSAFE
2133 
2134 // A dummy implementation of synchronization primitives (mutex, lock,
2135 // and thread-local variable). Necessary for compiling Google Test where
2136 // mutex is not supported - using Google Test in multiple threads is not
2137 // supported on such platforms.
2138 
2139 class Mutex {
2140  public:
2141  Mutex() {}
2142  void Lock() {}
2143  void Unlock() {}
2144  void AssertHeld() const {}
2145 };
2146 
2147 # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
2148  extern ::testing::internal::Mutex mutex
2149 
2150 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
2151 
2152 // We cannot name this class MutexLock because the ctor declaration would
2153 // conflict with a macro named MutexLock, which is defined on some
2154 // platforms. That macro is used as a defensive measure to prevent against
2155 // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
2156 // "MutexLock l(&mu)". Hence the typedef trick below.
2158  public:
2159  explicit GTestMutexLock(Mutex*) {} // NOLINT
2160 };
2161 
2163 
2164 template <typename T>
2166  public:
2167  ThreadLocal() : value_() {}
2168  explicit ThreadLocal(const T& value) : value_(value) {}
2169  T* pointer() { return &value_; }
2170  const T* pointer() const { return &value_; }
2171  const T& get() const { return value_; }
2172  void set(const T& value) { value_ = value; }
2173  private:
2174  T value_;
2175 };
2176 
2177 #endif // GTEST_IS_THREADSAFE
2178 
2179 // Returns the number of threads running in the process, or 0 to indicate that
2180 // we cannot detect it.
2181 GTEST_API_ size_t GetThreadCount();
2182 
2183 template <bool bool_value>
2186  static const bool value = bool_value;
2187 };
2188 template <bool bool_value> const bool bool_constant<bool_value>::value;
2189 
2192 
2193 template <typename T, typename U>
2194 struct is_same : public false_type {};
2195 
2196 template <typename T>
2197 struct is_same<T, T> : public true_type {};
2198 
2199 template <typename Iterator>
2201  typedef typename Iterator::value_type value_type;
2202 };
2203 
2204 
2205 template <typename T>
2206 struct IteratorTraits<T*> {
2207  typedef T value_type;
2208 };
2209 
2210 template <typename T>
2211 struct IteratorTraits<const T*> {
2212  typedef T value_type;
2213 };
2214 
2215 #if GTEST_OS_WINDOWS
2216 # define GTEST_PATH_SEP_ "\\"
2217 # define GTEST_HAS_ALT_PATH_SEP_ 1
2218 // The biggest signed integer type the compiler supports.
2219 typedef __int64 BiggestInt;
2220 #else
2221 # define GTEST_PATH_SEP_ "/"
2222 # define GTEST_HAS_ALT_PATH_SEP_ 0
2223 typedef long long BiggestInt; // NOLINT
2224 #endif // GTEST_OS_WINDOWS
2225 
2226 // Utilities for char.
2227 
2228 // isspace(int ch) and friends accept an unsigned char or EOF. char
2229 // may be signed, depending on the compiler (or compiler flags).
2230 // Therefore we need to cast a char to unsigned char before calling
2231 // isspace(), etc.
2232 
2233 inline bool IsAlpha(char ch) {
2234  return isalpha(static_cast<unsigned char>(ch)) != 0;
2235 }
2236 inline bool IsAlNum(char ch) {
2237  return isalnum(static_cast<unsigned char>(ch)) != 0;
2238 }
2239 inline bool IsDigit(char ch) {
2240  return isdigit(static_cast<unsigned char>(ch)) != 0;
2241 }
2242 inline bool IsLower(char ch) {
2243  return islower(static_cast<unsigned char>(ch)) != 0;
2244 }
2245 inline bool IsSpace(char ch) {
2246  return isspace(static_cast<unsigned char>(ch)) != 0;
2247 }
2248 inline bool IsUpper(char ch) {
2249  return isupper(static_cast<unsigned char>(ch)) != 0;
2250 }
2251 inline bool IsXDigit(char ch) {
2252  return isxdigit(static_cast<unsigned char>(ch)) != 0;
2253 }
2254 inline bool IsXDigit(wchar_t ch) {
2255  const unsigned char low_byte = static_cast<unsigned char>(ch);
2256  return ch == low_byte && isxdigit(low_byte) != 0;
2257 }
2258 
2259 inline char ToLower(char ch) {
2260  return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
2261 }
2262 inline char ToUpper(char ch) {
2263  return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
2264 }
2265 
2267  std::string::iterator it = str.end();
2268  while (it != str.begin() && IsSpace(*--it))
2269  it = str.erase(it);
2270  return str;
2271 }
2272 
2273 // The testing::internal::posix namespace holds wrappers for common
2274 // POSIX functions. These wrappers hide the differences between
2275 // Windows/MSVC and POSIX systems. Since some compilers define these
2276 // standard functions as macros, the wrapper cannot have the same name
2277 // as the wrapped function.
2278 
2279 namespace posix {
2280 
2281 // Functions with a different name on Windows.
2282 
2283 #if GTEST_OS_WINDOWS
2284 
2285 typedef struct _stat StatStruct;
2286 
2287 # ifdef __BORLANDC__
2288 inline int IsATTY(int fd) { return isatty(fd); }
2289 inline int StrCaseCmp(const char* s1, const char* s2) {
2290  return stricmp(s1, s2);
2291 }
2292 inline char* StrDup(const char* src) { return strdup(src); }
2293 # else // !__BORLANDC__
2294 # if GTEST_OS_WINDOWS_MOBILE
2295 inline int IsATTY(int /* fd */) { return 0; }
2296 # else
2297 inline int IsATTY(int fd) { return _isatty(fd); }
2298 # endif // GTEST_OS_WINDOWS_MOBILE
2299 inline int StrCaseCmp(const char* s1, const char* s2) {
2300  return _stricmp(s1, s2);
2301 }
2302 inline char* StrDup(const char* src) { return _strdup(src); }
2303 # endif // __BORLANDC__
2304 
2305 # if GTEST_OS_WINDOWS_MOBILE
2306 inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
2307 // Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
2308 // time and thus not defined there.
2309 # else
2310 inline int FileNo(FILE* file) { return _fileno(file); }
2311 inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
2312 inline int RmDir(const char* dir) { return _rmdir(dir); }
2313 inline bool IsDir(const StatStruct& st) {
2314  return (_S_IFDIR & st.st_mode) != 0;
2315 }
2316 # endif // GTEST_OS_WINDOWS_MOBILE
2317 
2318 #else
2319 
2320 typedef struct stat StatStruct;
2321 
2322 inline int FileNo(FILE* file) { return fileno(file); }
2323 inline int IsATTY(int fd) { return isatty(fd); }
2324 inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }
2325 inline int StrCaseCmp(const char* s1, const char* s2) {
2326  return strcasecmp(s1, s2);
2327 }
2328 inline char* StrDup(const char* src) { return strdup(src); }
2329 inline int RmDir(const char* dir) { return rmdir(dir); }
2330 inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
2331 
2332 #endif // GTEST_OS_WINDOWS
2333 
2334 // Functions deprecated by MSVC 8.0.
2335 
2337 
2338 inline const char* StrNCpy(char* dest, const char* src, size_t n) {
2339  return strncpy(dest, src, n);
2340 }
2341 
2342 // ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
2343 // StrError() aren't needed on Windows CE at this time and thus not
2344 // defined there.
2345 
2346 #if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
2347 inline int ChDir(const char* dir) { return chdir(dir); }
2348 #endif
2349 inline FILE* FOpen(const char* path, const char* mode) {
2350  return fopen(path, mode);
2351 }
2352 #if !GTEST_OS_WINDOWS_MOBILE
2353 inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
2354  return freopen(path, mode, stream);
2355 }
2356 inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
2357 #endif
2358 inline int FClose(FILE* fp) { return fclose(fp); }
2359 #if !GTEST_OS_WINDOWS_MOBILE
2360 inline int Read(int fd, void* buf, unsigned int count) {
2361  return static_cast<int>(read(fd, buf, count));
2362 }
2363 inline int Write(int fd, const void* buf, unsigned int count) {
2364  return static_cast<int>(write(fd, buf, count));
2365 }
2366 inline int Close(int fd) { return close(fd); }
2367 inline const char* StrError(int errnum) { return strerror(errnum); }
2368 #endif
2369 inline const char* GetEnv(const char* name) {
2370 #if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
2371  // We are on Windows CE, which has no environment variables.
2372  static_cast<void>(name); // To prevent 'unused argument' warning.
2373  return nullptr;
2374 #elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
2375  // Environment variables which we programmatically clear will be set to the
2376  // empty string rather than unset (NULL). Handle that case.
2377  const char* const env = getenv(name);
2378  return (env != nullptr && env[0] != '\0') ? env : nullptr;
2379 #else
2380  return getenv(name);
2381 #endif
2382 }
2383 
2385 
2386 #if GTEST_OS_WINDOWS_MOBILE
2387 // Windows CE has no C library. The abort() function is used in
2388 // several places in Google Test. This implementation provides a reasonable
2389 // imitation of standard behaviour.
2390 [[noreturn]] void Abort();
2391 #else
2392 [[noreturn]] inline void Abort() { abort(); }
2393 #endif // GTEST_OS_WINDOWS_MOBILE
2394 
2395 } // namespace posix
2396 
2397 // MSVC "deprecates" snprintf and issues warnings wherever it is used. In
2398 // order to avoid these warnings, we need to use _snprintf or _snprintf_s on
2399 // MSVC-based platforms. We map the GTEST_SNPRINTF_ macro to the appropriate
2400 // function in order to achieve that. We use macro definition here because
2401 // snprintf is a variadic function.
2402 #if _MSC_VER && !GTEST_OS_WINDOWS_MOBILE
2403 // MSVC 2005 and above support variadic macros.
2404 # define GTEST_SNPRINTF_(buffer, size, format, ...) \
2405  _snprintf_s(buffer, size, size, format, __VA_ARGS__)
2406 #elif defined(_MSC_VER)
2407 // Windows CE does not define _snprintf_s
2408 # define GTEST_SNPRINTF_ _snprintf
2409 #else
2410 # define GTEST_SNPRINTF_ snprintf
2411 #endif
2412 
2413 // The maximum number a BiggestInt can represent. This definition
2414 // works no matter BiggestInt is represented in one's complement or
2415 // two's complement.
2416 //
2417 // We cannot rely on numeric_limits in STL, as __int64 and long long
2418 // are not part of standard C++ and numeric_limits doesn't need to be
2419 // defined for them.
2421  ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));
2422 
2423 // This template class serves as a compile-time function from size to
2424 // type. It maps a size in bytes to a primitive type with that
2425 // size. e.g.
2426 //
2427 // TypeWithSize<4>::UInt
2428 //
2429 // is typedef-ed to be unsigned int (unsigned integer made up of 4
2430 // bytes).
2431 //
2432 // Such functionality should belong to STL, but I cannot find it
2433 // there.
2434 //
2435 // Google Test uses this class in the implementation of floating-point
2436 // comparison.
2437 //
2438 // For now it only handles UInt (unsigned int) as that's all Google Test
2439 // needs. Other types can be easily added in the future if need
2440 // arises.
2441 template <size_t size>
2443  public:
2444  // This prevents the user from using TypeWithSize<N> with incorrect
2445  // values of N.
2446  typedef void UInt;
2447 };
2448 
2449 // The specialization for size 4.
2450 template <>
2451 class TypeWithSize<4> {
2452  public:
2453  // unsigned int has size 4 in both gcc and MSVC.
2454  //
2455  // As base/basictypes.h doesn't compile on Windows, we cannot use
2456  // uint32, uint64, and etc here.
2457  typedef int Int;
2458  typedef unsigned int UInt;
2459 };
2460 
2461 // The specialization for size 8.
2462 template <>
2463 class TypeWithSize<8> {
2464  public:
2465 #if GTEST_OS_WINDOWS
2466  typedef __int64 Int;
2467  typedef unsigned __int64 UInt;
2468 #else
2469  typedef long long Int; // NOLINT
2470  typedef unsigned long long UInt; // NOLINT
2471 #endif // GTEST_OS_WINDOWS
2472 };
2473 
2474 // Integer types of known sizes.
2479 typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
2480 
2481 // Utilities for command line flags and environment variables.
2482 
2483 // Macro for referencing flags.
2484 #if !defined(GTEST_FLAG)
2485 # define GTEST_FLAG(name) FLAGS_gtest_##name
2486 #endif // !defined(GTEST_FLAG)
2487 
2488 #if !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
2489 # define GTEST_USE_OWN_FLAGFILE_FLAG_ 1
2490 #endif // !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
2491 
2492 #if !defined(GTEST_DECLARE_bool_)
2493 # define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver
2494 
2495 // Macros for declaring flags.
2496 # define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
2497 # define GTEST_DECLARE_int32_(name) \
2498  GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
2499 # define GTEST_DECLARE_string_(name) \
2500  GTEST_API_ extern ::std::string GTEST_FLAG(name)
2501 
2502 // Macros for defining flags.
2503 # define GTEST_DEFINE_bool_(name, default_val, doc) \
2504  GTEST_API_ bool GTEST_FLAG(name) = (default_val)
2505 # define GTEST_DEFINE_int32_(name, default_val, doc) \
2506  GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
2507 # define GTEST_DEFINE_string_(name, default_val, doc) \
2508  GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
2509 
2510 #endif // !defined(GTEST_DECLARE_bool_)
2511 
2512 // Thread annotations
2513 #if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
2514 # define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
2515 # define GTEST_LOCK_EXCLUDED_(locks)
2516 #endif // !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
2517 
2518 // Parses 'str' for a 32-bit signed integer. If successful, writes the result
2519 // to *value and returns true; otherwise leaves *value unchanged and returns
2520 // false.
2521 bool ParseInt32(const Message& src_text, const char* str, Int32* value);
2522 
2523 // Parses a bool/Int32/string from the environment variable
2524 // corresponding to the given Google Test flag.
2525 bool BoolFromGTestEnv(const char* flag, bool default_val);
2526 GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
2528 const char* StringFromGTestEnv(const char* flag, const char* default_val);
2529 
2530 } // namespace internal
2531 } // namespace testing
2532 
2533 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
2534 
2535 #if GTEST_OS_LINUX
2536 # include <stdlib.h>
2537 # include <sys/types.h>
2538 # include <sys/wait.h>
2539 # include <unistd.h>
2540 #endif // GTEST_OS_LINUX
2541 
2542 #if GTEST_HAS_EXCEPTIONS
2543 # include <stdexcept>
2544 #endif
2545 
2546 #include <ctype.h>
2547 #include <float.h>
2548 #include <string.h>
2549 #include <iomanip>
2550 #include <limits>
2551 #include <map>
2552 #include <set>
2553 #include <string>
2554 #include <vector>
2555 
2556 // Copyright 2005, Google Inc.
2557 // All rights reserved.
2558 //
2559 // Redistribution and use in source and binary forms, with or without
2560 // modification, are permitted provided that the following conditions are
2561 // met:
2562 //
2563 // * Redistributions of source code must retain the above copyright
2564 // notice, this list of conditions and the following disclaimer.
2565 // * Redistributions in binary form must reproduce the above
2566 // copyright notice, this list of conditions and the following disclaimer
2567 // in the documentation and/or other materials provided with the
2568 // distribution.
2569 // * Neither the name of Google Inc. nor the names of its
2570 // contributors may be used to endorse or promote products derived from
2571 // this software without specific prior written permission.
2572 //
2573 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2574 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2575 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2576 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2577 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2578 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2579 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2580 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2581 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2582 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2583 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2584 
2585 //
2586 // The Google C++ Testing and Mocking Framework (Google Test)
2587 //
2588 // This header file defines the Message class.
2589 //
2590 // IMPORTANT NOTE: Due to limitation of the C++ language, we have to
2591 // leave some internal implementation details in this header file.
2592 // They are clearly marked by comments like this:
2593 //
2594 // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
2595 //
2596 // Such code is NOT meant to be used by a user directly, and is subject
2597 // to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
2598 // program!
2599 
2600 // GOOGLETEST_CM0001 DO NOT DELETE
2601 
2602 #ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
2603 #define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
2604 
2605 #include <limits>
2606 #include <memory>
2607 
2608 
2610 /* class A needs to have dll-interface to be used by clients of class B */)
2611 
2612 // Ensures that there is at least one operator<< in the global namespace.
2613 // See Message& operator<<(...) below for why.
2614 void operator<<(const testing::internal::Secret&, int);
2615 
2616 namespace testing {
2617 
2618 // The Message class works like an ostream repeater.
2619 //
2620 // Typical usage:
2621 //
2622 // 1. You stream a bunch of values to a Message object.
2623 // It will remember the text in a stringstream.
2624 // 2. Then you stream the Message object to an ostream.
2625 // This causes the text in the Message to be streamed
2626 // to the ostream.
2627 //
2628 // For example;
2629 //
2630 // testing::Message foo;
2631 // foo << 1 << " != " << 2;
2632 // std::cout << foo;
2633 //
2634 // will print "1 != 2".
2635 //
2636 // Message is not intended to be inherited from. In particular, its
2637 // destructor is not virtual.
2638 //
2639 // Note that stringstream behaves differently in gcc and in MSVC. You
2640 // can stream a NULL char pointer to it in the former, but not in the
2641 // latter (it causes an access violation if you do). The Message
2642 // class hides this difference by treating a NULL char pointer as
2643 // "(null)".
2645  private:
2646  // The type of basic IO manipulators (endl, ends, and flush) for
2647  // narrow streams.
2648  typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
2649 
2650  public:
2651  // Constructs an empty Message.
2652  Message();
2653 
2654  // Copy constructor.
2655  Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT
2656  *ss_ << msg.GetString();
2657  }
2658 
2659  // Constructs a Message from a C-string.
2660  explicit Message(const char* str) : ss_(new ::std::stringstream) {
2661  *ss_ << str;
2662  }
2663 
2664  // Streams a non-pointer value to this object.
2665  template <typename T>
2666  inline Message& operator <<(const T& val) {
2667  // Some libraries overload << for STL containers. These
2668  // overloads are defined in the global namespace instead of ::std.
2669  //
2670  // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
2671  // overloads are visible in either the std namespace or the global
2672  // namespace, but not other namespaces, including the testing
2673  // namespace which Google Test's Message class is in.
2674  //
2675  // To allow STL containers (and other types that has a << operator
2676  // defined in the global namespace) to be used in Google Test
2677  // assertions, testing::Message must access the custom << operator
2678  // from the global namespace. With this using declaration,
2679  // overloads of << defined in the global namespace and those
2680  // visible via Koenig lookup are both exposed in this function.
2681  using ::operator <<;
2682  *ss_ << val;
2683  return *this;
2684  }
2685 
2686  // Streams a pointer value to this object.
2687  //
2688  // This function is an overload of the previous one. When you
2689  // stream a pointer to a Message, this definition will be used as it
2690  // is more specialized. (The C++ Standard, section
2691  // [temp.func.order].) If you stream a non-pointer, then the
2692  // previous definition will be used.
2693  //
2694  // The reason for this overload is that streaming a NULL pointer to
2695  // ostream is undefined behavior. Depending on the compiler, you
2696  // may get "0", "(nil)", "(null)", or an access violation. To
2697  // ensure consistent result across compilers, we always treat NULL
2698  // as "(null)".
2699  template <typename T>
2700  inline Message& operator <<(T* const& pointer) { // NOLINT
2701  if (pointer == nullptr) {
2702  *ss_ << "(null)";
2703  } else {
2704  *ss_ << pointer;
2705  }
2706  return *this;
2707  }
2708 
2709  // Since the basic IO manipulators are overloaded for both narrow
2710  // and wide streams, we have to provide this specialized definition
2711  // of operator <<, even though its body is the same as the
2712  // templatized version above. Without this definition, streaming
2713  // endl or other basic IO manipulators to Message will confuse the
2714  // compiler.
2715  Message& operator <<(BasicNarrowIoManip val) {
2716  *ss_ << val;
2717  return *this;
2718  }
2719 
2720  // Instead of 1/0, we want to see true/false for bool values.
2722  return *this << (b ? "true" : "false");
2723  }
2724 
2725  // These two overloads allow streaming a wide C string to a Message
2726  // using the UTF-8 encoding.
2727  Message& operator <<(const wchar_t* wide_c_str);
2728  Message& operator <<(wchar_t* wide_c_str);
2729 
2730 #if GTEST_HAS_STD_WSTRING
2731  // Converts the given wide string to a narrow string using the UTF-8
2732  // encoding, and streams the result to this Message object.
2734 #endif // GTEST_HAS_STD_WSTRING
2735 
2736 #if GTEST_HAS_GLOBAL_WSTRING
2737  // Converts the given wide string to a narrow string using the UTF-8
2738  // encoding, and streams the result to this Message object.
2740 #endif // GTEST_HAS_GLOBAL_WSTRING
2741 
2742  // Gets the text streamed to this object so far as an std::string.
2743  // Each '\0' character in the buffer is replaced with "\\0".
2744  //
2745  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
2746  std::string GetString() const;
2747 
2748  private:
2749  // We'll hold the text streamed to this object here.
2750  const std::unique_ptr< ::std::stringstream> ss_;
2751 
2752  // We declare (but don't implement) this to prevent the compiler
2753  // from implementing the assignment operator.
2754  void operator=(const Message&);
2755 };
2756 
2757 // Streams a Message to an ostream.
2758 inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
2759  return os << sb.GetString();
2760 }
2761 
2762 namespace internal {
2763 
2764 // Converts a streamable value to an std::string. A NULL pointer is
2765 // converted to "(null)". When the input value is a ::string,
2766 // ::std::string, ::wstring, or ::std::wstring object, each NUL
2767 // character in it is replaced with "\\0".
2768 template <typename T>
2769 std::string StreamableToString(const T& streamable) {
2770  return (Message() << streamable).GetString();
2771 }
2772 
2773 } // namespace internal
2774 } // namespace testing
2775 
2777 
2778 #endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
2779 // Copyright 2008, Google Inc.
2780 // All rights reserved.
2781 //
2782 // Redistribution and use in source and binary forms, with or without
2783 // modification, are permitted provided that the following conditions are
2784 // met:
2785 //
2786 // * Redistributions of source code must retain the above copyright
2787 // notice, this list of conditions and the following disclaimer.
2788 // * Redistributions in binary form must reproduce the above
2789 // copyright notice, this list of conditions and the following disclaimer
2790 // in the documentation and/or other materials provided with the
2791 // distribution.
2792 // * Neither the name of Google Inc. nor the names of its
2793 // contributors may be used to endorse or promote products derived from
2794 // this software without specific prior written permission.
2795 //
2796 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2797 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2798 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2799 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2800 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2801 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2802 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2803 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2804 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2805 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2806 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2807 //
2808 // Google Test filepath utilities
2809 //
2810 // This header file declares classes and functions used internally by
2811 // Google Test. They are subject to change without notice.
2812 //
2813 // This file is #included in gtest/internal/gtest-internal.h.
2814 // Do not include this header file separately!
2815 
2816 // GOOGLETEST_CM0001 DO NOT DELETE
2817 
2818 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
2819 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
2820 
2821 // Copyright 2005, Google Inc.
2822 // All rights reserved.
2823 //
2824 // Redistribution and use in source and binary forms, with or without
2825 // modification, are permitted provided that the following conditions are
2826 // met:
2827 //
2828 // * Redistributions of source code must retain the above copyright
2829 // notice, this list of conditions and the following disclaimer.
2830 // * Redistributions in binary form must reproduce the above
2831 // copyright notice, this list of conditions and the following disclaimer
2832 // in the documentation and/or other materials provided with the
2833 // distribution.
2834 // * Neither the name of Google Inc. nor the names of its
2835 // contributors may be used to endorse or promote products derived from
2836 // this software without specific prior written permission.
2837 //
2838 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2839 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2840 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2841 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2842 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2843 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2844 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2845 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2846 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2847 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2848 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2849 //
2850 // The Google C++ Testing and Mocking Framework (Google Test)
2851 //
2852 // This header file declares the String class and functions used internally by
2853 // Google Test. They are subject to change without notice. They should not used
2854 // by code external to Google Test.
2855 //
2856 // This header file is #included by gtest-internal.h.
2857 // It should not be #included by other files.
2858 
2859 // GOOGLETEST_CM0001 DO NOT DELETE
2860 
2861 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
2862 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
2863 
2864 #ifdef __BORLANDC__
2865 // string.h is not guaranteed to provide strcpy on C++ Builder.
2866 # include <mem.h>
2867 #endif
2868 
2869 #include <string.h>
2870 #include <string>
2871 
2872 
2873 namespace testing {
2874 namespace internal {
2875 
2876 // String - an abstract class holding static string utilities.
2877 class GTEST_API_ String {
2878  public:
2879  // Static utility methods
2880 
2881  // Clones a 0-terminated C string, allocating memory using new. The
2882  // caller is responsible for deleting the return value using
2883  // delete[]. Returns the cloned string, or NULL if the input is
2884  // NULL.
2885  //
2886  // This is different from strdup() in string.h, which allocates
2887  // memory using malloc().
2888  static const char* CloneCString(const char* c_str);
2889 
2890 #if GTEST_OS_WINDOWS_MOBILE
2891  // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
2892  // able to pass strings to Win32 APIs on CE we need to convert them
2893  // to 'Unicode', UTF-16.
2894 
2895  // Creates a UTF-16 wide string from the given ANSI string, allocating
2896  // memory using new. The caller is responsible for deleting the return
2897  // value using delete[]. Returns the wide string, or NULL if the
2898  // input is NULL.
2899  //
2900  // The wide string is created using the ANSI codepage (CP_ACP) to
2901  // match the behaviour of the ANSI versions of Win32 calls and the
2902  // C runtime.
2903  static LPCWSTR AnsiToUtf16(const char* c_str);
2904 
2905  // Creates an ANSI string from the given wide string, allocating
2906  // memory using new. The caller is responsible for deleting the return
2907  // value using delete[]. Returns the ANSI string, or NULL if the
2908  // input is NULL.
2909  //
2910  // The returned string is created using the ANSI codepage (CP_ACP) to
2911  // match the behaviour of the ANSI versions of Win32 calls and the
2912  // C runtime.
2913  static const char* Utf16ToAnsi(LPCWSTR utf16_str);
2914 #endif
2915 
2916  // Compares two C strings. Returns true iff they have the same content.
2917  //
2918  // Unlike strcmp(), this function can handle NULL argument(s). A
2919  // NULL C string is considered different to any non-NULL C string,
2920  // including the empty string.
2921  static bool CStringEquals(const char* lhs, const char* rhs);
2922 
2923  // Converts a wide C string to a String using the UTF-8 encoding.
2924  // NULL will be converted to "(null)". If an error occurred during
2925  // the conversion, "(failed to convert from wide string)" is
2926  // returned.
2927  static std::string ShowWideCString(const wchar_t* wide_c_str);
2928 
2929  // Compares two wide C strings. Returns true iff they have the same
2930  // content.
2931  //
2932  // Unlike wcscmp(), this function can handle NULL argument(s). A
2933  // NULL C string is considered different to any non-NULL C string,
2934  // including the empty string.
2935  static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
2936 
2937  // Compares two C strings, ignoring case. Returns true iff they
2938  // have the same content.
2939  //
2940  // Unlike strcasecmp(), this function can handle NULL argument(s).
2941  // A NULL C string is considered different to any non-NULL C string,
2942  // including the empty string.
2943  static bool CaseInsensitiveCStringEquals(const char* lhs,
2944  const char* rhs);
2945 
2946  // Compares two wide C strings, ignoring case. Returns true iff they
2947  // have the same content.
2948  //
2949  // Unlike wcscasecmp(), this function can handle NULL argument(s).
2950  // A NULL C string is considered different to any non-NULL wide C string,
2951  // including the empty string.
2952  // NB: The implementations on different platforms slightly differ.
2953  // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
2954  // environment variable. On GNU platform this method uses wcscasecmp
2955  // which compares according to LC_CTYPE category of the current locale.
2956  // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
2957  // current locale.
2958  static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
2959  const wchar_t* rhs);
2960 
2961  // Returns true iff the given string ends with the given suffix, ignoring
2962  // case. Any string is considered to end with an empty suffix.
2963  static bool EndsWithCaseInsensitive(
2964  const std::string& str, const std::string& suffix);
2965 
2966  // Formats an int value as "%02d".
2967  static std::string FormatIntWidth2(int value); // "%02d" for width == 2
2968 
2969  // Formats an int value as "%X".
2970  static std::string FormatHexInt(int value);
2971 
2972  // Formats a byte as "%02X".
2973  static std::string FormatByte(unsigned char value);
2974 
2975  private:
2976  String(); // Not meant to be instantiated.
2977 }; // class String
2978 
2979 // Gets the content of the stringstream's buffer as an std::string. Each '\0'
2980 // character in the buffer is replaced with "\\0".
2981 GTEST_API_ std::string StringStreamToString(::std::stringstream* stream);
2982 
2983 } // namespace internal
2984 } // namespace testing
2985 
2986 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
2987 
2989 /* class A needs to have dll-interface to be used by clients of class B */)
2990 
2991 namespace testing {
2992 namespace internal {
2993 
2994 // FilePath - a class for file and directory pathname manipulation which
2995 // handles platform-specific conventions (like the pathname separator).
2996 // Used for helper functions for naming files in a directory for xml output.
2997 // Except for Set methods, all methods are const or static, which provides an
2998 // "immutable value object" -- useful for peace of mind.
2999 // A FilePath with a value ending in a path separator ("like/this/") represents
3000 // a directory, otherwise it is assumed to represent a file. In either case,
3001 // it may or may not represent an actual file or directory in the file system.
3002 // Names are NOT checked for syntax correctness -- no checking for illegal
3003 // characters, malformed paths, etc.
3004 
3005 class GTEST_API_ FilePath {
3006  public:
3007  FilePath() : pathname_("") { }
3008  FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
3009 
3010  explicit FilePath(const std::string& pathname) : pathname_(pathname) {
3011  Normalize();
3012  }
3013 
3014  FilePath& operator=(const FilePath& rhs) {
3015  Set(rhs);
3016  return *this;
3017  }
3018 
3019  void Set(const FilePath& rhs) {
3020  pathname_ = rhs.pathname_;
3021  }
3022 
3023  const std::string& string() const { return pathname_; }
3024  const char* c_str() const { return pathname_.c_str(); }
3025 
3026  // Returns the current working directory, or "" if unsuccessful.
3027  static FilePath GetCurrentDir();
3028 
3029  // Given directory = "dir", base_name = "test", number = 0,
3030  // extension = "xml", returns "dir/test.xml". If number is greater
3031  // than zero (e.g., 12), returns "dir/test_12.xml".
3032  // On Windows platform, uses \ as the separator rather than /.
3033  static FilePath MakeFileName(const FilePath& directory,
3034  const FilePath& base_name,
3035  int number,
3036  const char* extension);
3037 
3038  // Given directory = "dir", relative_path = "test.xml",
3039  // returns "dir/test.xml".
3040  // On Windows, uses \ as the separator rather than /.
3041  static FilePath ConcatPaths(const FilePath& directory,
3042  const FilePath& relative_path);
3043 
3044  // Returns a pathname for a file that does not currently exist. The pathname
3045  // will be directory/base_name.extension or
3046  // directory/base_name_<number>.extension if directory/base_name.extension
3047  // already exists. The number will be incremented until a pathname is found
3048  // that does not already exist.
3049  // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
3050  // There could be a race condition if two or more processes are calling this
3051  // function at the same time -- they could both pick the same filename.
3052  static FilePath GenerateUniqueFileName(const FilePath& directory,
3053  const FilePath& base_name,
3054  const char* extension);
3055 
3056  // Returns true iff the path is "".
3057  bool IsEmpty() const { return pathname_.empty(); }
3058 
3059  // If input name has a trailing separator character, removes it and returns
3060  // the name, otherwise return the name string unmodified.
3061  // On Windows platform, uses \ as the separator, other platforms use /.
3062  FilePath RemoveTrailingPathSeparator() const;
3063 
3064  // Returns a copy of the FilePath with the directory part removed.
3065  // Example: FilePath("path/to/file").RemoveDirectoryName() returns
3066  // FilePath("file"). If there is no directory part ("just_a_file"), it returns
3067  // the FilePath unmodified. If there is no file part ("just_a_dir/") it
3068  // returns an empty FilePath ("").
3069  // On Windows platform, '\' is the path separator, otherwise it is '/'.
3070  FilePath RemoveDirectoryName() const;
3071 
3072  // RemoveFileName returns the directory path with the filename removed.
3073  // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
3074  // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
3075  // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
3076  // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
3077  // On Windows platform, '\' is the path separator, otherwise it is '/'.
3078  FilePath RemoveFileName() const;
3079 
3080  // Returns a copy of the FilePath with the case-insensitive extension removed.
3081  // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
3082  // FilePath("dir/file"). If a case-insensitive extension is not
3083  // found, returns a copy of the original FilePath.
3084  FilePath RemoveExtension(const char* extension) const;
3085 
3086  // Creates directories so that path exists. Returns true if successful or if
3087  // the directories already exist; returns false if unable to create
3088  // directories for any reason. Will also return false if the FilePath does
3089  // not represent a directory (that is, it doesn't end with a path separator).
3090  bool CreateDirectoriesRecursively() const;
3091 
3092  // Create the directory so that path exists. Returns true if successful or
3093  // if the directory already exists; returns false if unable to create the
3094  // directory for any reason, including if the parent directory does not
3095  // exist. Not named "CreateDirectory" because that's a macro on Windows.
3096  bool CreateFolder() const;
3097 
3098  // Returns true if FilePath describes something in the file-system,
3099  // either a file, directory, or whatever, and that something exists.
3100  bool FileOrDirectoryExists() const;
3101 
3102  // Returns true if pathname describes a directory in the file-system
3103  // that exists.
3104  bool DirectoryExists() const;
3105 
3106  // Returns true if FilePath ends with a path separator, which indicates that
3107  // it is intended to represent a directory. Returns false otherwise.
3108  // This does NOT check that a directory (or file) actually exists.
3109  bool IsDirectory() const;
3110 
3111  // Returns true if pathname describes a root directory. (Windows has one
3112  // root directory per disk drive.)
3113  bool IsRootDirectory() const;
3114 
3115  // Returns true if pathname describes an absolute path.
3116  bool IsAbsolutePath() const;
3117 
3118  private:
3119  // Replaces multiple consecutive separators with a single separator.
3120  // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
3121  // redundancies that might be in a pathname involving "." or "..".
3122  //
3123  // A pathname with multiple consecutive separators may occur either through
3124  // user error or as a result of some scripts or APIs that generate a pathname
3125  // with a trailing separator. On other platforms the same API or script
3126  // may NOT generate a pathname with a trailing "/". Then elsewhere that
3127  // pathname may have another "/" and pathname components added to it,
3128  // without checking for the separator already being there.
3129  // The script language and operating system may allow paths like "foo//bar"
3130  // but some of the functions in FilePath will not handle that correctly. In
3131  // particular, RemoveTrailingPathSeparator() only removes one separator, and
3132  // it is called in CreateDirectoriesRecursively() assuming that it will change
3133  // a pathname from directory syntax (trailing separator) to filename syntax.
3134  //
3135  // On Windows this method also replaces the alternate path separator '/' with
3136  // the primary path separator '\\', so that for example "bar\\/\\foo" becomes
3137  // "bar\\foo".
3138 
3139  void Normalize();
3140 
3141  // Returns a pointer to the last occurence of a valid path separator in
3142  // the FilePath. On Windows, for example, both '/' and '\' are valid path
3143  // separators. Returns NULL if no path separator was found.
3144  const char* FindLastPathSeparator() const;
3145 
3146  std::string pathname_;
3147 }; // class FilePath
3148 
3149 } // namespace internal
3150 } // namespace testing
3151 
3153 
3154 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
3155 // This file was GENERATED by command:
3156 // pump.py gtest-type-util.h.pump
3157 // DO NOT EDIT BY HAND!!!
3158 
3159 // Copyright 2008 Google Inc.
3160 // All Rights Reserved.
3161 //
3162 // Redistribution and use in source and binary forms, with or without
3163 // modification, are permitted provided that the following conditions are
3164 // met:
3165 //
3166 // * Redistributions of source code must retain the above copyright
3167 // notice, this list of conditions and the following disclaimer.
3168 // * Redistributions in binary form must reproduce the above
3169 // copyright notice, this list of conditions and the following disclaimer
3170 // in the documentation and/or other materials provided with the
3171 // distribution.
3172 // * Neither the name of Google Inc. nor the names of its
3173 // contributors may be used to endorse or promote products derived from
3174 // this software without specific prior written permission.
3175 //
3176 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3177 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3178 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3179 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3180 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3181 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3182 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3183 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3184 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3185 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3186 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3187 
3188 // Type utilities needed for implementing typed and type-parameterized
3189 // tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
3190 //
3191 // Currently we support at most 50 types in a list, and at most 50
3192 // type-parameterized tests in one type-parameterized test suite.
3193 // Please contact googletestframework@googlegroups.com if you need
3194 // more.
3195 
3196 // GOOGLETEST_CM0001 DO NOT DELETE
3197 
3198 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
3199 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
3200 
3201 
3202 // #ifdef __GNUC__ is too general here. It is possible to use gcc without using
3203 // libstdc++ (which is where cxxabi.h comes from).
3204 # if GTEST_HAS_CXXABI_H_
3205 # include <cxxabi.h>
3206 # elif defined(__HP_aCC)
3207 # include <acxx_demangle.h>
3208 # endif // GTEST_HASH_CXXABI_H_
3209 
3210 namespace testing {
3211 namespace internal {
3212 
3213 // Canonicalizes a given name with respect to the Standard C++ Library.
3214 // This handles removing the inline namespace within `std` that is
3215 // used by various standard libraries (e.g., `std::__1`). Names outside
3216 // of namespace std are returned unmodified.
3217 inline std::string CanonicalizeForStdLibVersioning(std::string s) {
3218  static const char prefix[] = "std::__";
3219  if (s.compare(0, strlen(prefix), prefix) == 0) {
3220  std::string::size_type end = s.find("::", strlen(prefix));
3221  if (end != s.npos) {
3222  // Erase everything between the initial `std` and the second `::`.
3223  s.erase(strlen("std"), end - strlen("std"));
3224  }
3225  }
3226  return s;
3227 }
3228 
3229 // GetTypeName<T>() returns a human-readable name of type T.
3230 // NB: This function is also used in Google Mock, so don't move it inside of
3231 // the typed-test-only section below.
3232 template <typename T>
3233 std::string GetTypeName() {
3234 # if GTEST_HAS_RTTI
3235 
3236  const char* const name = typeid(T).name();
3237 # if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
3238  int status = 0;
3239  // gcc's implementation of typeid(T).name() mangles the type name,
3240  // so we have to demangle it.
3241 # if GTEST_HAS_CXXABI_H_
3242  using abi::__cxa_demangle;
3243 # endif // GTEST_HAS_CXXABI_H_
3244  char* const readable_name = __cxa_demangle(name, nullptr, nullptr, &status);
3245  const std::string name_str(status == 0 ? readable_name : name);
3246  free(readable_name);
3247  return CanonicalizeForStdLibVersioning(name_str);
3248 # else
3249  return name;
3250 # endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
3251 
3252 # else
3253 
3254  return "<type>";
3255 
3256 # endif // GTEST_HAS_RTTI
3257 }
3258 
3259 #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
3260 
3261 // AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
3262 // type. This can be used as a compile-time assertion to ensure that
3263 // two types are equal.
3264 
3265 template <typename T1, typename T2>
3266 struct AssertTypeEq;
3267 
3268 template <typename T>
3269 struct AssertTypeEq<T, T> {
3270  typedef bool type;
3271 };
3272 
3273 // A unique type used as the default value for the arguments of class
3274 // template Types. This allows us to simulate variadic templates
3275 // (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
3276 // support directly.
3277 struct None {};
3278 
3279 // The following family of struct and struct templates are used to
3280 // represent type lists. In particular, TypesN<T1, T2, ..., TN>
3281 // represents a type list with N types (T1, T2, ..., and TN) in it.
3282 // Except for Types0, every struct in the family has two member types:
3283 // Head for the first type in the list, and Tail for the rest of the
3284 // list.
3285 
3286 // The empty type list.
3287 struct Types0 {};
3288 
3289 // Type lists of length 1, 2, 3, and so on.
3290 
3291 template <typename T1>
3292 struct Types1 {
3293  typedef T1 Head;
3294  typedef Types0 Tail;
3295 };
3296 template <typename T1, typename T2>
3297 struct Types2 {
3298  typedef T1 Head;
3299  typedef Types1<T2> Tail;
3300 };
3301 
3302 template <typename T1, typename T2, typename T3>
3303 struct Types3 {
3304  typedef T1 Head;
3305  typedef Types2<T2, T3> Tail;
3306 };
3307 
3308 template <typename T1, typename T2, typename T3, typename T4>
3309 struct Types4 {
3310  typedef T1 Head;
3311  typedef Types3<T2, T3, T4> Tail;
3312 };
3313 
3314 template <typename T1, typename T2, typename T3, typename T4, typename T5>
3315 struct Types5 {
3316  typedef T1 Head;
3317  typedef Types4<T2, T3, T4, T5> Tail;
3318 };
3319 
3320 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3321  typename T6>
3322 struct Types6 {
3323  typedef T1 Head;
3324  typedef Types5<T2, T3, T4, T5, T6> Tail;
3325 };
3326 
3327 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3328  typename T6, typename T7>
3329 struct Types7 {
3330  typedef T1 Head;
3331  typedef Types6<T2, T3, T4, T5, T6, T7> Tail;
3332 };
3333 
3334 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3335  typename T6, typename T7, typename T8>
3336 struct Types8 {
3337  typedef T1 Head;
3338  typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;
3339 };
3340 
3341 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3342  typename T6, typename T7, typename T8, typename T9>
3343 struct Types9 {
3344  typedef T1 Head;
3345  typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
3346 };
3347 
3348 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3349  typename T6, typename T7, typename T8, typename T9, typename T10>
3350 struct Types10 {
3351  typedef T1 Head;
3352  typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
3353 };
3354 
3355 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3356  typename T6, typename T7, typename T8, typename T9, typename T10,
3357  typename T11>
3358 struct Types11 {
3359  typedef T1 Head;
3360  typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
3361 };
3362 
3363 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3364  typename T6, typename T7, typename T8, typename T9, typename T10,
3365  typename T11, typename T12>
3366 struct Types12 {
3367  typedef T1 Head;
3368  typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
3369 };
3370 
3371 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3372  typename T6, typename T7, typename T8, typename T9, typename T10,
3373  typename T11, typename T12, typename T13>
3374 struct Types13 {
3375  typedef T1 Head;
3376  typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
3377 };
3378 
3379 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3380  typename T6, typename T7, typename T8, typename T9, typename T10,
3381  typename T11, typename T12, typename T13, typename T14>
3382 struct Types14 {
3383  typedef T1 Head;
3384  typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;
3385 };
3386 
3387 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3388  typename T6, typename T7, typename T8, typename T9, typename T10,
3389  typename T11, typename T12, typename T13, typename T14, typename T15>
3390 struct Types15 {
3391  typedef T1 Head;
3392  typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
3393  T15> Tail;
3394 };
3395 
3396 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3397  typename T6, typename T7, typename T8, typename T9, typename T10,
3398  typename T11, typename T12, typename T13, typename T14, typename T15,
3399  typename T16>
3400 struct Types16 {
3401  typedef T1 Head;
3402  typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3403  T16> Tail;
3404 };
3405 
3406 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3407  typename T6, typename T7, typename T8, typename T9, typename T10,
3408  typename T11, typename T12, typename T13, typename T14, typename T15,
3409  typename T16, typename T17>
3410 struct Types17 {
3411  typedef T1 Head;
3412  typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3413  T16, T17> Tail;
3414 };
3415 
3416 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3417  typename T6, typename T7, typename T8, typename T9, typename T10,
3418  typename T11, typename T12, typename T13, typename T14, typename T15,
3419  typename T16, typename T17, typename T18>
3420 struct Types18 {
3421  typedef T1 Head;
3422  typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3423  T16, T17, T18> Tail;
3424 };
3425 
3426 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3427  typename T6, typename T7, typename T8, typename T9, typename T10,
3428  typename T11, typename T12, typename T13, typename T14, typename T15,
3429  typename T16, typename T17, typename T18, typename T19>
3430 struct Types19 {
3431  typedef T1 Head;
3432  typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3433  T16, T17, T18, T19> Tail;
3434 };
3435 
3436 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3437  typename T6, typename T7, typename T8, typename T9, typename T10,
3438  typename T11, typename T12, typename T13, typename T14, typename T15,
3439  typename T16, typename T17, typename T18, typename T19, typename T20>
3440 struct Types20 {
3441  typedef T1 Head;
3442  typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3443  T16, T17, T18, T19, T20> Tail;
3444 };
3445 
3446 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3447  typename T6, typename T7, typename T8, typename T9, typename T10,
3448  typename T11, typename T12, typename T13, typename T14, typename T15,
3449  typename T16, typename T17, typename T18, typename T19, typename T20,
3450  typename T21>
3451 struct Types21 {
3452  typedef T1 Head;
3453  typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3454  T16, T17, T18, T19, T20, T21> Tail;
3455 };
3456 
3457 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3458  typename T6, typename T7, typename T8, typename T9, typename T10,
3459  typename T11, typename T12, typename T13, typename T14, typename T15,
3460  typename T16, typename T17, typename T18, typename T19, typename T20,
3461  typename T21, typename T22>
3462 struct Types22 {
3463  typedef T1 Head;
3464  typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3465  T16, T17, T18, T19, T20, T21, T22> Tail;
3466 };
3467 
3468 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3469  typename T6, typename T7, typename T8, typename T9, typename T10,
3470  typename T11, typename T12, typename T13, typename T14, typename T15,
3471  typename T16, typename T17, typename T18, typename T19, typename T20,
3472  typename T21, typename T22, typename T23>
3473 struct Types23 {
3474  typedef T1 Head;
3475  typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3476  T16, T17, T18, T19, T20, T21, T22, T23> Tail;
3477 };
3478 
3479 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3480  typename T6, typename T7, typename T8, typename T9, typename T10,
3481  typename T11, typename T12, typename T13, typename T14, typename T15,
3482  typename T16, typename T17, typename T18, typename T19, typename T20,
3483  typename T21, typename T22, typename T23, typename T24>
3484 struct Types24 {
3485  typedef T1 Head;
3486  typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3487  T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
3488 };
3489 
3490 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3491  typename T6, typename T7, typename T8, typename T9, typename T10,
3492  typename T11, typename T12, typename T13, typename T14, typename T15,
3493  typename T16, typename T17, typename T18, typename T19, typename T20,
3494  typename T21, typename T22, typename T23, typename T24, typename T25>
3495 struct Types25 {
3496  typedef T1 Head;
3497  typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3498  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
3499 };
3500 
3501 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3502  typename T6, typename T7, typename T8, typename T9, typename T10,
3503  typename T11, typename T12, typename T13, typename T14, typename T15,
3504  typename T16, typename T17, typename T18, typename T19, typename T20,
3505  typename T21, typename T22, typename T23, typename T24, typename T25,
3506  typename T26>
3507 struct Types26 {
3508  typedef T1 Head;
3509  typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3510  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
3511 };
3512 
3513 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3514  typename T6, typename T7, typename T8, typename T9, typename T10,
3515  typename T11, typename T12, typename T13, typename T14, typename T15,
3516  typename T16, typename T17, typename T18, typename T19, typename T20,
3517  typename T21, typename T22, typename T23, typename T24, typename T25,
3518  typename T26, typename T27>
3519 struct Types27 {
3520  typedef T1 Head;
3521  typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3522  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
3523 };
3524 
3525 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3526  typename T6, typename T7, typename T8, typename T9, typename T10,
3527  typename T11, typename T12, typename T13, typename T14, typename T15,
3528  typename T16, typename T17, typename T18, typename T19, typename T20,
3529  typename T21, typename T22, typename T23, typename T24, typename T25,
3530  typename T26, typename T27, typename T28>
3531 struct Types28 {
3532  typedef T1 Head;
3533  typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3534  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;
3535 };
3536 
3537 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3538  typename T6, typename T7, typename T8, typename T9, typename T10,
3539  typename T11, typename T12, typename T13, typename T14, typename T15,
3540  typename T16, typename T17, typename T18, typename T19, typename T20,
3541  typename T21, typename T22, typename T23, typename T24, typename T25,
3542  typename T26, typename T27, typename T28, typename T29>
3543 struct Types29 {
3544  typedef T1 Head;
3545  typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3546  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
3547  T29> Tail;
3548 };
3549 
3550 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3551  typename T6, typename T7, typename T8, typename T9, typename T10,
3552  typename T11, typename T12, typename T13, typename T14, typename T15,
3553  typename T16, typename T17, typename T18, typename T19, typename T20,
3554  typename T21, typename T22, typename T23, typename T24, typename T25,
3555  typename T26, typename T27, typename T28, typename T29, typename T30>
3556 struct Types30 {
3557  typedef T1 Head;
3558  typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3559  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3560  T30> Tail;
3561 };
3562 
3563 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3564  typename T6, typename T7, typename T8, typename T9, typename T10,
3565  typename T11, typename T12, typename T13, typename T14, typename T15,
3566  typename T16, typename T17, typename T18, typename T19, typename T20,
3567  typename T21, typename T22, typename T23, typename T24, typename T25,
3568  typename T26, typename T27, typename T28, typename T29, typename T30,
3569  typename T31>
3570 struct Types31 {
3571  typedef T1 Head;
3572  typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3573  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3574  T30, T31> Tail;
3575 };
3576 
3577 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3578  typename T6, typename T7, typename T8, typename T9, typename T10,
3579  typename T11, typename T12, typename T13, typename T14, typename T15,
3580  typename T16, typename T17, typename T18, typename T19, typename T20,
3581  typename T21, typename T22, typename T23, typename T24, typename T25,
3582  typename T26, typename T27, typename T28, typename T29, typename T30,
3583  typename T31, typename T32>
3584 struct Types32 {
3585  typedef T1 Head;
3586  typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3587  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3588  T30, T31, T32> Tail;
3589 };
3590 
3591 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3592  typename T6, typename T7, typename T8, typename T9, typename T10,
3593  typename T11, typename T12, typename T13, typename T14, typename T15,
3594  typename T16, typename T17, typename T18, typename T19, typename T20,
3595  typename T21, typename T22, typename T23, typename T24, typename T25,
3596  typename T26, typename T27, typename T28, typename T29, typename T30,
3597  typename T31, typename T32, typename T33>
3598 struct Types33 {
3599  typedef T1 Head;
3600  typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3601  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3602  T30, T31, T32, T33> Tail;
3603 };
3604 
3605 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3606  typename T6, typename T7, typename T8, typename T9, typename T10,
3607  typename T11, typename T12, typename T13, typename T14, typename T15,
3608  typename T16, typename T17, typename T18, typename T19, typename T20,
3609  typename T21, typename T22, typename T23, typename T24, typename T25,
3610  typename T26, typename T27, typename T28, typename T29, typename T30,
3611  typename T31, typename T32, typename T33, typename T34>
3612 struct Types34 {
3613  typedef T1 Head;
3614  typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3615  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3616  T30, T31, T32, T33, T34> Tail;
3617 };
3618 
3619 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3620  typename T6, typename T7, typename T8, typename T9, typename T10,
3621  typename T11, typename T12, typename T13, typename T14, typename T15,
3622  typename T16, typename T17, typename T18, typename T19, typename T20,
3623  typename T21, typename T22, typename T23, typename T24, typename T25,
3624  typename T26, typename T27, typename T28, typename T29, typename T30,
3625  typename T31, typename T32, typename T33, typename T34, typename T35>
3626 struct Types35 {
3627  typedef T1 Head;
3628  typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3629  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3630  T30, T31, T32, T33, T34, T35> Tail;
3631 };
3632 
3633 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3634  typename T6, typename T7, typename T8, typename T9, typename T10,
3635  typename T11, typename T12, typename T13, typename T14, typename T15,
3636  typename T16, typename T17, typename T18, typename T19, typename T20,
3637  typename T21, typename T22, typename T23, typename T24, typename T25,
3638  typename T26, typename T27, typename T28, typename T29, typename T30,
3639  typename T31, typename T32, typename T33, typename T34, typename T35,
3640  typename T36>
3641 struct Types36 {
3642  typedef T1 Head;
3643  typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3644  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3645  T30, T31, T32, T33, T34, T35, T36> Tail;
3646 };
3647 
3648 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3649  typename T6, typename T7, typename T8, typename T9, typename T10,
3650  typename T11, typename T12, typename T13, typename T14, typename T15,
3651  typename T16, typename T17, typename T18, typename T19, typename T20,
3652  typename T21, typename T22, typename T23, typename T24, typename T25,
3653  typename T26, typename T27, typename T28, typename T29, typename T30,
3654  typename T31, typename T32, typename T33, typename T34, typename T35,
3655  typename T36, typename T37>
3656 struct Types37 {
3657  typedef T1 Head;
3658  typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3659  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3660  T30, T31, T32, T33, T34, T35, T36, T37> Tail;
3661 };
3662 
3663 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3664  typename T6, typename T7, typename T8, typename T9, typename T10,
3665  typename T11, typename T12, typename T13, typename T14, typename T15,
3666  typename T16, typename T17, typename T18, typename T19, typename T20,
3667  typename T21, typename T22, typename T23, typename T24, typename T25,
3668  typename T26, typename T27, typename T28, typename T29, typename T30,
3669  typename T31, typename T32, typename T33, typename T34, typename T35,
3670  typename T36, typename T37, typename T38>
3671 struct Types38 {
3672  typedef T1 Head;
3673  typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3674  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3675  T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
3676 };
3677 
3678 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3679  typename T6, typename T7, typename T8, typename T9, typename T10,
3680  typename T11, typename T12, typename T13, typename T14, typename T15,
3681  typename T16, typename T17, typename T18, typename T19, typename T20,
3682  typename T21, typename T22, typename T23, typename T24, typename T25,
3683  typename T26, typename T27, typename T28, typename T29, typename T30,
3684  typename T31, typename T32, typename T33, typename T34, typename T35,
3685  typename T36, typename T37, typename T38, typename T39>
3686 struct Types39 {
3687  typedef T1 Head;
3688  typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3689  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3690  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
3691 };
3692 
3693 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3694  typename T6, typename T7, typename T8, typename T9, typename T10,
3695  typename T11, typename T12, typename T13, typename T14, typename T15,
3696  typename T16, typename T17, typename T18, typename T19, typename T20,
3697  typename T21, typename T22, typename T23, typename T24, typename T25,
3698  typename T26, typename T27, typename T28, typename T29, typename T30,
3699  typename T31, typename T32, typename T33, typename T34, typename T35,
3700  typename T36, typename T37, typename T38, typename T39, typename T40>
3701 struct Types40 {
3702  typedef T1 Head;
3703  typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3704  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3705  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
3706 };
3707 
3708 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3709  typename T6, typename T7, typename T8, typename T9, typename T10,
3710  typename T11, typename T12, typename T13, typename T14, typename T15,
3711  typename T16, typename T17, typename T18, typename T19, typename T20,
3712  typename T21, typename T22, typename T23, typename T24, typename T25,
3713  typename T26, typename T27, typename T28, typename T29, typename T30,
3714  typename T31, typename T32, typename T33, typename T34, typename T35,
3715  typename T36, typename T37, typename T38, typename T39, typename T40,
3716  typename T41>
3717 struct Types41 {
3718  typedef T1 Head;
3719  typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3720  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3721  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
3722 };
3723 
3724 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3725  typename T6, typename T7, typename T8, typename T9, typename T10,
3726  typename T11, typename T12, typename T13, typename T14, typename T15,
3727  typename T16, typename T17, typename T18, typename T19, typename T20,
3728  typename T21, typename T22, typename T23, typename T24, typename T25,
3729  typename T26, typename T27, typename T28, typename T29, typename T30,
3730  typename T31, typename T32, typename T33, typename T34, typename T35,
3731  typename T36, typename T37, typename T38, typename T39, typename T40,
3732  typename T41, typename T42>
3733 struct Types42 {
3734  typedef T1 Head;
3735  typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3736  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3737  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;
3738 };
3739 
3740 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3741  typename T6, typename T7, typename T8, typename T9, typename T10,
3742  typename T11, typename T12, typename T13, typename T14, typename T15,
3743  typename T16, typename T17, typename T18, typename T19, typename T20,
3744  typename T21, typename T22, typename T23, typename T24, typename T25,
3745  typename T26, typename T27, typename T28, typename T29, typename T30,
3746  typename T31, typename T32, typename T33, typename T34, typename T35,
3747  typename T36, typename T37, typename T38, typename T39, typename T40,
3748  typename T41, typename T42, typename T43>
3749 struct Types43 {
3750  typedef T1 Head;
3751  typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3752  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3753  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
3754  T43> Tail;
3755 };
3756 
3757 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3758  typename T6, typename T7, typename T8, typename T9, typename T10,
3759  typename T11, typename T12, typename T13, typename T14, typename T15,
3760  typename T16, typename T17, typename T18, typename T19, typename T20,
3761  typename T21, typename T22, typename T23, typename T24, typename T25,
3762  typename T26, typename T27, typename T28, typename T29, typename T30,
3763  typename T31, typename T32, typename T33, typename T34, typename T35,
3764  typename T36, typename T37, typename T38, typename T39, typename T40,
3765  typename T41, typename T42, typename T43, typename T44>
3766 struct Types44 {
3767  typedef T1 Head;
3768  typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3769  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3770  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3771  T44> Tail;
3772 };
3773 
3774 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3775  typename T6, typename T7, typename T8, typename T9, typename T10,
3776  typename T11, typename T12, typename T13, typename T14, typename T15,
3777  typename T16, typename T17, typename T18, typename T19, typename T20,
3778  typename T21, typename T22, typename T23, typename T24, typename T25,
3779  typename T26, typename T27, typename T28, typename T29, typename T30,
3780  typename T31, typename T32, typename T33, typename T34, typename T35,
3781  typename T36, typename T37, typename T38, typename T39, typename T40,
3782  typename T41, typename T42, typename T43, typename T44, typename T45>
3783 struct Types45 {
3784  typedef T1 Head;
3785  typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3786  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3787  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3788  T44, T45> Tail;
3789 };
3790 
3791 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3792  typename T6, typename T7, typename T8, typename T9, typename T10,
3793  typename T11, typename T12, typename T13, typename T14, typename T15,
3794  typename T16, typename T17, typename T18, typename T19, typename T20,
3795  typename T21, typename T22, typename T23, typename T24, typename T25,
3796  typename T26, typename T27, typename T28, typename T29, typename T30,
3797  typename T31, typename T32, typename T33, typename T34, typename T35,
3798  typename T36, typename T37, typename T38, typename T39, typename T40,
3799  typename T41, typename T42, typename T43, typename T44, typename T45,
3800  typename T46>
3801 struct Types46 {
3802  typedef T1 Head;
3803  typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3804  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3805  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3806  T44, T45, T46> Tail;
3807 };
3808 
3809 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3810  typename T6, typename T7, typename T8, typename T9, typename T10,
3811  typename T11, typename T12, typename T13, typename T14, typename T15,
3812  typename T16, typename T17, typename T18, typename T19, typename T20,
3813  typename T21, typename T22, typename T23, typename T24, typename T25,
3814  typename T26, typename T27, typename T28, typename T29, typename T30,
3815  typename T31, typename T32, typename T33, typename T34, typename T35,
3816  typename T36, typename T37, typename T38, typename T39, typename T40,
3817  typename T41, typename T42, typename T43, typename T44, typename T45,
3818  typename T46, typename T47>
3819 struct Types47 {
3820  typedef T1 Head;
3821  typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3822  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3823  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3824  T44, T45, T46, T47> Tail;
3825 };
3826 
3827 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3828  typename T6, typename T7, typename T8, typename T9, typename T10,
3829  typename T11, typename T12, typename T13, typename T14, typename T15,
3830  typename T16, typename T17, typename T18, typename T19, typename T20,
3831  typename T21, typename T22, typename T23, typename T24, typename T25,
3832  typename T26, typename T27, typename T28, typename T29, typename T30,
3833  typename T31, typename T32, typename T33, typename T34, typename T35,
3834  typename T36, typename T37, typename T38, typename T39, typename T40,
3835  typename T41, typename T42, typename T43, typename T44, typename T45,
3836  typename T46, typename T47, typename T48>
3837 struct Types48 {
3838  typedef T1 Head;
3839  typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3840  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3841  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3842  T44, T45, T46, T47, T48> Tail;
3843 };
3844 
3845 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3846  typename T6, typename T7, typename T8, typename T9, typename T10,
3847  typename T11, typename T12, typename T13, typename T14, typename T15,
3848  typename T16, typename T17, typename T18, typename T19, typename T20,
3849  typename T21, typename T22, typename T23, typename T24, typename T25,
3850  typename T26, typename T27, typename T28, typename T29, typename T30,
3851  typename T31, typename T32, typename T33, typename T34, typename T35,
3852  typename T36, typename T37, typename T38, typename T39, typename T40,
3853  typename T41, typename T42, typename T43, typename T44, typename T45,
3854  typename T46, typename T47, typename T48, typename T49>
3855 struct Types49 {
3856  typedef T1 Head;
3857  typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3858  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3859  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3860  T44, T45, T46, T47, T48, T49> Tail;
3861 };
3862 
3863 template <typename T1, typename T2, typename T3, typename T4, typename T5,
3864  typename T6, typename T7, typename T8, typename T9, typename T10,
3865  typename T11, typename T12, typename T13, typename T14, typename T15,
3866  typename T16, typename T17, typename T18, typename T19, typename T20,
3867  typename T21, typename T22, typename T23, typename T24, typename T25,
3868  typename T26, typename T27, typename T28, typename T29, typename T30,
3869  typename T31, typename T32, typename T33, typename T34, typename T35,
3870  typename T36, typename T37, typename T38, typename T39, typename T40,
3871  typename T41, typename T42, typename T43, typename T44, typename T45,
3872  typename T46, typename T47, typename T48, typename T49, typename T50>
3873 struct Types50 {
3874  typedef T1 Head;
3875  typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3876  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3877  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3878  T44, T45, T46, T47, T48, T49, T50> Tail;
3879 };
3880 
3881 
3882 } // namespace internal
3883 
3884 // We don't want to require the users to write TypesN<...> directly,
3885 // as that would require them to count the length. Types<...> is much
3886 // easier to write, but generates horrible messages when there is a
3887 // compiler error, as gcc insists on printing out each template
3888 // argument, even if it has the default value (this means Types<int>
3889 // will appear as Types<int, None, None, ..., None> in the compiler
3890 // errors).
3891 //
3892 // Our solution is to combine the best part of the two approaches: a
3893 // user would write Types<T1, ..., TN>, and Google Test will translate
3894 // that to TypesN<T1, ..., TN> internally to make error messages
3895 // readable. The translation is done by the 'type' member of the
3896 // Types template.
3897 template <typename T1 = internal::None, typename T2 = internal::None,
3898  typename T3 = internal::None, typename T4 = internal::None,
3899  typename T5 = internal::None, typename T6 = internal::None,
3900  typename T7 = internal::None, typename T8 = internal::None,
3901  typename T9 = internal::None, typename T10 = internal::None,
3902  typename T11 = internal::None, typename T12 = internal::None,
3903  typename T13 = internal::None, typename T14 = internal::None,
3904  typename T15 = internal::None, typename T16 = internal::None,
3905  typename T17 = internal::None, typename T18 = internal::None,
3906  typename T19 = internal::None, typename T20 = internal::None,
3907  typename T21 = internal::None, typename T22 = internal::None,
3908  typename T23 = internal::None, typename T24 = internal::None,
3909  typename T25 = internal::None, typename T26 = internal::None,
3910  typename T27 = internal::None, typename T28 = internal::None,
3911  typename T29 = internal::None, typename T30 = internal::None,
3912  typename T31 = internal::None, typename T32 = internal::None,
3913  typename T33 = internal::None, typename T34 = internal::None,
3914  typename T35 = internal::None, typename T36 = internal::None,
3915  typename T37 = internal::None, typename T38 = internal::None,
3916  typename T39 = internal::None, typename T40 = internal::None,
3917  typename T41 = internal::None, typename T42 = internal::None,
3918  typename T43 = internal::None, typename T44 = internal::None,
3919  typename T45 = internal::None, typename T46 = internal::None,
3920  typename T47 = internal::None, typename T48 = internal::None,
3921  typename T49 = internal::None, typename T50 = internal::None>
3922 struct Types {
3923  typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
3924  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
3925  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
3926  T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
3927 };
3928 
3929 template <>
3930 struct Types<internal::None, internal::None, internal::None, internal::None,
3931  internal::None, internal::None, internal::None, internal::None,
3932  internal::None, internal::None, internal::None, internal::None,
3933  internal::None, internal::None, internal::None, internal::None,
3934  internal::None, internal::None, internal::None, internal::None,
3935  internal::None, internal::None, internal::None, internal::None,
3936  internal::None, internal::None, internal::None, internal::None,
3937  internal::None, internal::None, internal::None, internal::None,
3938  internal::None, internal::None, internal::None, internal::None,
3939  internal::None, internal::None, internal::None, internal::None,
3940  internal::None, internal::None, internal::None, internal::None,
3941  internal::None, internal::None, internal::None, internal::None,
3942  internal::None, internal::None> {
3943  typedef internal::Types0 type;
3944 };
3945 template <typename T1>
3946 struct Types<T1, internal::None, internal::None, internal::None,
3947  internal::None, internal::None, internal::None, internal::None,
3948  internal::None, internal::None, internal::None, internal::None,
3949  internal::None, internal::None, internal::None, internal::None,
3950  internal::None, internal::None, internal::None, internal::None,
3951  internal::None, internal::None, internal::None, internal::None,
3952  internal::None, internal::None, internal::None, internal::None,
3953  internal::None, internal::None, internal::None, internal::None,
3954  internal::None, internal::None, internal::None, internal::None,
3955  internal::None, internal::None, internal::None, internal::None,
3956  internal::None, internal::None, internal::None, internal::None,
3957  internal::None, internal::None, internal::None, internal::None,
3958  internal::None, internal::None> {
3959  typedef internal::Types1<T1> type;
3960 };
3961 template <typename T1, typename T2>
3962 struct Types<T1, T2, internal::None, internal::None, internal::None,
3963  internal::None, internal::None, internal::None, internal::None,
3964  internal::None, internal::None, internal::None, internal::None,
3965  internal::None, internal::None, internal::None, internal::None,
3966  internal::None, internal::None, internal::None, internal::None,
3967  internal::None, internal::None, internal::None, internal::None,
3968  internal::None, internal::None, internal::None, internal::None,
3969  internal::None, internal::None, internal::None, internal::None,
3970  internal::None, internal::None, internal::None, internal::None,
3971  internal::None, internal::None, internal::None, internal::None,
3972  internal::None, internal::None, internal::None, internal::None,
3973  internal::None, internal::None, internal::None, internal::None,
3974  internal::None> {
3975  typedef internal::Types2<T1, T2> type;
3976 };
3977 template <typename T1, typename T2, typename T3>
3978 struct Types<T1, T2, T3, internal::None, internal::None, internal::None,
3979  internal::None, internal::None, internal::None, internal::None,
3980  internal::None, internal::None, internal::None, internal::None,
3981  internal::None, internal::None, internal::None, internal::None,
3982  internal::None, internal::None, internal::None, internal::None,
3983  internal::None, internal::None, internal::None, internal::None,
3984  internal::None, internal::None, internal::None, internal::None,
3985  internal::None, internal::None, internal::None, internal::None,
3986  internal::None, internal::None, internal::None, internal::None,
3987  internal::None, internal::None, internal::None, internal::None,
3988  internal::None, internal::None, internal::None, internal::None,
3989  internal::None, internal::None, internal::None, internal::None> {
3990  typedef internal::Types3<T1, T2, T3> type;
3991 };
3992 template <typename T1, typename T2, typename T3, typename T4>
3993 struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None,
3994  internal::None, internal::None, internal::None, internal::None,
3995  internal::None, internal::None, internal::None, internal::None,
3996  internal::None, internal::None, internal::None, internal::None,
3997  internal::None, internal::None, internal::None, internal::None,
3998  internal::None, internal::None, internal::None, internal::None,
3999  internal::None, internal::None, internal::None, internal::None,
4000  internal::None, internal::None, internal::None, internal::None,
4001  internal::None, internal::None, internal::None, internal::None,
4002  internal::None, internal::None, internal::None, internal::None,
4003  internal::None, internal::None, internal::None, internal::None,
4004  internal::None, internal::None, internal::None> {
4005  typedef internal::Types4<T1, T2, T3, T4> type;
4006 };
4007 template <typename T1, typename T2, typename T3, typename T4, typename T5>
4008 struct Types<T1, T2, T3, T4, T5, internal::None, internal::None,
4009  internal::None, internal::None, internal::None, internal::None,
4010  internal::None, internal::None, internal::None, internal::None,
4011  internal::None, internal::None, internal::None, internal::None,
4012  internal::None, internal::None, internal::None, internal::None,
4013  internal::None, internal::None, internal::None, internal::None,
4014  internal::None, internal::None, internal::None, internal::None,
4015  internal::None, internal::None, internal::None, internal::None,
4016  internal::None, internal::None, internal::None, internal::None,
4017  internal::None, internal::None, internal::None, internal::None,
4018  internal::None, internal::None, internal::None, internal::None,
4019  internal::None, internal::None, internal::None> {
4020  typedef internal::Types5<T1, T2, T3, T4, T5> type;
4021 };
4022 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4023  typename T6>
4024 struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None,
4025  internal::None, internal::None, internal::None, internal::None,
4026  internal::None, internal::None, internal::None, internal::None,
4027  internal::None, internal::None, internal::None, internal::None,
4028  internal::None, internal::None, internal::None, internal::None,
4029  internal::None, internal::None, internal::None, internal::None,
4030  internal::None, internal::None, internal::None, internal::None,
4031  internal::None, internal::None, internal::None, internal::None,
4032  internal::None, internal::None, internal::None, internal::None,
4033  internal::None, internal::None, internal::None, internal::None,
4034  internal::None, internal::None, internal::None, internal::None,
4035  internal::None, internal::None> {
4036  typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;
4037 };
4038 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4039  typename T6, typename T7>
4040 struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None,
4041  internal::None, internal::None, internal::None, internal::None,
4042  internal::None, internal::None, internal::None, internal::None,
4043  internal::None, internal::None, internal::None, internal::None,
4044  internal::None, internal::None, internal::None, internal::None,
4045  internal::None, internal::None, internal::None, internal::None,
4046  internal::None, internal::None, internal::None, internal::None,
4047  internal::None, internal::None, internal::None, internal::None,
4048  internal::None, internal::None, internal::None, internal::None,
4049  internal::None, internal::None, internal::None, internal::None,
4050  internal::None, internal::None, internal::None, internal::None,
4051  internal::None> {
4052  typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;
4053 };
4054 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4055  typename T6, typename T7, typename T8>
4056 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None,
4057  internal::None, internal::None, internal::None, internal::None,
4058  internal::None, internal::None, internal::None, internal::None,
4059  internal::None, internal::None, internal::None, internal::None,
4060  internal::None, internal::None, internal::None, internal::None,
4061  internal::None, internal::None, internal::None, internal::None,
4062  internal::None, internal::None, internal::None, internal::None,
4063  internal::None, internal::None, internal::None, internal::None,
4064  internal::None, internal::None, internal::None, internal::None,
4065  internal::None, internal::None, internal::None, internal::None,
4066  internal::None, internal::None, internal::None, internal::None> {
4067  typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;
4068 };
4069 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4070  typename T6, typename T7, typename T8, typename T9>
4071 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None,
4072  internal::None, internal::None, internal::None, internal::None,
4073  internal::None, internal::None, internal::None, internal::None,
4074  internal::None, internal::None, internal::None, internal::None,
4075  internal::None, internal::None, internal::None, internal::None,
4076  internal::None, internal::None, internal::None, internal::None,
4077  internal::None, internal::None, internal::None, internal::None,
4078  internal::None, internal::None, internal::None, internal::None,
4079  internal::None, internal::None, internal::None, internal::None,
4080  internal::None, internal::None, internal::None, internal::None,
4081  internal::None, internal::None, internal::None, internal::None> {
4082  typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
4083 };
4084 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4085  typename T6, typename T7, typename T8, typename T9, typename T10>
4086 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None,
4087  internal::None, internal::None, internal::None, internal::None,
4088  internal::None, internal::None, internal::None, internal::None,
4089  internal::None, internal::None, internal::None, internal::None,
4090  internal::None, internal::None, internal::None, internal::None,
4091  internal::None, internal::None, internal::None, internal::None,
4092  internal::None, internal::None, internal::None, internal::None,
4093  internal::None, internal::None, internal::None, internal::None,
4094  internal::None, internal::None, internal::None, internal::None,
4095  internal::None, internal::None, internal::None, internal::None,
4096  internal::None, internal::None, internal::None> {
4097  typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
4098 };
4099 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4100  typename T6, typename T7, typename T8, typename T9, typename T10,
4101  typename T11>
4102 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None,
4103  internal::None, internal::None, internal::None, internal::None,
4104  internal::None, internal::None, internal::None, internal::None,
4105  internal::None, internal::None, internal::None, internal::None,
4106  internal::None, internal::None, internal::None, internal::None,
4107  internal::None, internal::None, internal::None, internal::None,
4108  internal::None, internal::None, internal::None, internal::None,
4109  internal::None, internal::None, internal::None, internal::None,
4110  internal::None, internal::None, internal::None, internal::None,
4111  internal::None, internal::None, internal::None, internal::None,
4112  internal::None, internal::None> {
4113  typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
4114 };
4115 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4116  typename T6, typename T7, typename T8, typename T9, typename T10,
4117  typename T11, typename T12>
4118 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None,
4119  internal::None, internal::None, internal::None, internal::None,
4120  internal::None, internal::None, internal::None, internal::None,
4121  internal::None, internal::None, internal::None, internal::None,
4122  internal::None, internal::None, internal::None, internal::None,
4123  internal::None, internal::None, internal::None, internal::None,
4124  internal::None, internal::None, internal::None, internal::None,
4125  internal::None, internal::None, internal::None, internal::None,
4126  internal::None, internal::None, internal::None, internal::None,
4127  internal::None, internal::None, internal::None, internal::None,
4128  internal::None> {
4129  typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
4130  T12> type;
4131 };
4132 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4133  typename T6, typename T7, typename T8, typename T9, typename T10,
4134  typename T11, typename T12, typename T13>
4135 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
4136  internal::None, internal::None, internal::None, internal::None,
4137  internal::None, internal::None, internal::None, internal::None,
4138  internal::None, internal::None, internal::None, internal::None,
4139  internal::None, internal::None, internal::None, internal::None,
4140  internal::None, internal::None, internal::None, internal::None,
4141  internal::None, internal::None, internal::None, internal::None,
4142  internal::None, internal::None, internal::None, internal::None,
4143  internal::None, internal::None, internal::None, internal::None,
4144  internal::None, internal::None, internal::None, internal::None,
4145  internal::None> {
4146  typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4147  T13> type;
4148 };
4149 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4150  typename T6, typename T7, typename T8, typename T9, typename T10,
4151  typename T11, typename T12, typename T13, typename T14>
4152 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4153  internal::None, internal::None, internal::None, internal::None,
4154  internal::None, internal::None, internal::None, internal::None,
4155  internal::None, internal::None, internal::None, internal::None,
4156  internal::None, internal::None, internal::None, internal::None,
4157  internal::None, internal::None, internal::None, internal::None,
4158  internal::None, internal::None, internal::None, internal::None,
4159  internal::None, internal::None, internal::None, internal::None,
4160  internal::None, internal::None, internal::None, internal::None,
4161  internal::None, internal::None, internal::None, internal::None> {
4162  typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4163  T13, T14> type;
4164 };
4165 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4166  typename T6, typename T7, typename T8, typename T9, typename T10,
4167  typename T11, typename T12, typename T13, typename T14, typename T15>
4168 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4169  internal::None, internal::None, internal::None, internal::None,
4170  internal::None, internal::None, internal::None, internal::None,
4171  internal::None, internal::None, internal::None, internal::None,
4172  internal::None, internal::None, internal::None, internal::None,
4173  internal::None, internal::None, internal::None, internal::None,
4174  internal::None, internal::None, internal::None, internal::None,
4175  internal::None, internal::None, internal::None, internal::None,
4176  internal::None, internal::None, internal::None, internal::None,
4177  internal::None, internal::None, internal::None> {
4178  typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4179  T13, T14, T15> type;
4180 };
4181 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4182  typename T6, typename T7, typename T8, typename T9, typename T10,
4183  typename T11, typename T12, typename T13, typename T14, typename T15,
4184  typename T16>
4185 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4186  T16, internal::None, internal::None, internal::None, internal::None,
4187  internal::None, internal::None, internal::None, internal::None,
4188  internal::None, internal::None, internal::None, internal::None,
4189  internal::None, internal::None, internal::None, internal::None,
4190  internal::None, internal::None, internal::None, internal::None,
4191  internal::None, internal::None, internal::None, internal::None,
4192  internal::None, internal::None, internal::None, internal::None,
4193  internal::None, internal::None, internal::None, internal::None,
4194  internal::None, internal::None> {
4195  typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4196  T13, T14, T15, T16> type;
4197 };
4198 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4199  typename T6, typename T7, typename T8, typename T9, typename T10,
4200  typename T11, typename T12, typename T13, typename T14, typename T15,
4201  typename T16, typename T17>
4202 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4203  T16, T17, internal::None, internal::None, internal::None, internal::None,
4204  internal::None, internal::None, internal::None, internal::None,
4205  internal::None, internal::None, internal::None, internal::None,
4206  internal::None, internal::None, internal::None, internal::None,
4207  internal::None, internal::None, internal::None, internal::None,
4208  internal::None, internal::None, internal::None, internal::None,
4209  internal::None, internal::None, internal::None, internal::None,
4210  internal::None, internal::None, internal::None, internal::None,
4211  internal::None> {
4212  typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4213  T13, T14, T15, T16, T17> type;
4214 };
4215 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4216  typename T6, typename T7, typename T8, typename T9, typename T10,
4217  typename T11, typename T12, typename T13, typename T14, typename T15,
4218  typename T16, typename T17, typename T18>
4219 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4220  T16, T17, T18, internal::None, internal::None, internal::None,
4221  internal::None, internal::None, internal::None, internal::None,
4222  internal::None, internal::None, internal::None, internal::None,
4223  internal::None, internal::None, internal::None, internal::None,
4224  internal::None, internal::None, internal::None, internal::None,
4225  internal::None, internal::None, internal::None, internal::None,
4226  internal::None, internal::None, internal::None, internal::None,
4227  internal::None, internal::None, internal::None, internal::None,
4228  internal::None> {
4229  typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4230  T13, T14, T15, T16, T17, T18> type;
4231 };
4232 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4233  typename T6, typename T7, typename T8, typename T9, typename T10,
4234  typename T11, typename T12, typename T13, typename T14, typename T15,
4235  typename T16, typename T17, typename T18, typename T19>
4236 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4237  T16, T17, T18, T19, internal::None, internal::None, internal::None,
4238  internal::None, internal::None, internal::None, internal::None,
4239  internal::None, internal::None, internal::None, internal::None,
4240  internal::None, internal::None, internal::None, internal::None,
4241  internal::None, internal::None, internal::None, internal::None,
4242  internal::None, internal::None, internal::None, internal::None,
4243  internal::None, internal::None, internal::None, internal::None,
4244  internal::None, internal::None, internal::None, internal::None> {
4245  typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4246  T13, T14, T15, T16, T17, T18, T19> type;
4247 };
4248 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4249  typename T6, typename T7, typename T8, typename T9, typename T10,
4250  typename T11, typename T12, typename T13, typename T14, typename T15,
4251  typename T16, typename T17, typename T18, typename T19, typename T20>
4252 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4253  T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,
4254  internal::None, internal::None, internal::None, internal::None,
4255  internal::None, internal::None, internal::None, internal::None,
4256  internal::None, internal::None, internal::None, internal::None,
4257  internal::None, internal::None, internal::None, internal::None,
4258  internal::None, internal::None, internal::None, internal::None,
4259  internal::None, internal::None, internal::None, internal::None,
4260  internal::None, internal::None, internal::None> {
4261  typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4262  T13, T14, T15, T16, T17, T18, T19, T20> type;
4263 };
4264 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4265  typename T6, typename T7, typename T8, typename T9, typename T10,
4266  typename T11, typename T12, typename T13, typename T14, typename T15,
4267  typename T16, typename T17, typename T18, typename T19, typename T20,
4268  typename T21>
4269 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4270  T16, T17, T18, T19, T20, T21, internal::None, internal::None,
4271  internal::None, internal::None, internal::None, internal::None,
4272  internal::None, internal::None, internal::None, internal::None,
4273  internal::None, internal::None, internal::None, internal::None,
4274  internal::None, internal::None, internal::None, internal::None,
4275  internal::None, internal::None, internal::None, internal::None,
4276  internal::None, internal::None, internal::None, internal::None,
4277  internal::None, internal::None, internal::None> {
4278  typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4279  T13, T14, T15, T16, T17, T18, T19, T20, T21> type;
4280 };
4281 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4282  typename T6, typename T7, typename T8, typename T9, typename T10,
4283  typename T11, typename T12, typename T13, typename T14, typename T15,
4284  typename T16, typename T17, typename T18, typename T19, typename T20,
4285  typename T21, typename T22>
4286 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4287  T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,
4288  internal::None, internal::None, internal::None, internal::None,
4289  internal::None, internal::None, internal::None, internal::None,
4290  internal::None, internal::None, internal::None, internal::None,
4291  internal::None, internal::None, internal::None, internal::None,
4292  internal::None, internal::None, internal::None, internal::None,
4293  internal::None, internal::None, internal::None, internal::None,
4294  internal::None, internal::None> {
4295  typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4296  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
4297 };
4298 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4299  typename T6, typename T7, typename T8, typename T9, typename T10,
4300  typename T11, typename T12, typename T13, typename T14, typename T15,
4301  typename T16, typename T17, typename T18, typename T19, typename T20,
4302  typename T21, typename T22, typename T23>
4303 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4304  T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,
4305  internal::None, internal::None, internal::None, internal::None,
4306  internal::None, internal::None, internal::None, internal::None,
4307  internal::None, internal::None, internal::None, internal::None,
4308  internal::None, internal::None, internal::None, internal::None,
4309  internal::None, internal::None, internal::None, internal::None,
4310  internal::None, internal::None, internal::None, internal::None,
4311  internal::None> {
4312  typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4313  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
4314 };
4315 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4316  typename T6, typename T7, typename T8, typename T9, typename T10,
4317  typename T11, typename T12, typename T13, typename T14, typename T15,
4318  typename T16, typename T17, typename T18, typename T19, typename T20,
4319  typename T21, typename T22, typename T23, typename T24>
4320 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4321  T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,
4322  internal::None, internal::None, internal::None, internal::None,
4323  internal::None, internal::None, internal::None, internal::None,
4324  internal::None, internal::None, internal::None, internal::None,
4325  internal::None, internal::None, internal::None, internal::None,
4326  internal::None, internal::None, internal::None, internal::None,
4327  internal::None, internal::None, internal::None, internal::None,
4328  internal::None> {
4329  typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4330  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
4331 };
4332 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4333  typename T6, typename T7, typename T8, typename T9, typename T10,
4334  typename T11, typename T12, typename T13, typename T14, typename T15,
4335  typename T16, typename T17, typename T18, typename T19, typename T20,
4336  typename T21, typename T22, typename T23, typename T24, typename T25>
4337 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4338  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,
4339  internal::None, internal::None, internal::None, internal::None,
4340  internal::None, internal::None, internal::None, internal::None,
4341  internal::None, internal::None, internal::None, internal::None,
4342  internal::None, internal::None, internal::None, internal::None,
4343  internal::None, internal::None, internal::None, internal::None,
4344  internal::None, internal::None, internal::None, internal::None> {
4345  typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4346  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
4347 };
4348 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4349  typename T6, typename T7, typename T8, typename T9, typename T10,
4350  typename T11, typename T12, typename T13, typename T14, typename T15,
4351  typename T16, typename T17, typename T18, typename T19, typename T20,
4352  typename T21, typename T22, typename T23, typename T24, typename T25,
4353  typename T26>
4354 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4355  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,
4356  internal::None, internal::None, internal::None, internal::None,
4357  internal::None, internal::None, internal::None, internal::None,
4358  internal::None, internal::None, internal::None, internal::None,
4359  internal::None, internal::None, internal::None, internal::None,
4360  internal::None, internal::None, internal::None, internal::None,
4361  internal::None, internal::None, internal::None> {
4362  typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4363  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
4364  T26> type;
4365 };
4366 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4367  typename T6, typename T7, typename T8, typename T9, typename T10,
4368  typename T11, typename T12, typename T13, typename T14, typename T15,
4369  typename T16, typename T17, typename T18, typename T19, typename T20,
4370  typename T21, typename T22, typename T23, typename T24, typename T25,
4371  typename T26, typename T27>
4372 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4373  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,
4374  internal::None, internal::None, internal::None, internal::None,
4375  internal::None, internal::None, internal::None, internal::None,
4376  internal::None, internal::None, internal::None, internal::None,
4377  internal::None, internal::None, internal::None, internal::None,
4378  internal::None, internal::None, internal::None, internal::None,
4379  internal::None, internal::None> {
4380  typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4381  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4382  T27> type;
4383 };
4384 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4385  typename T6, typename T7, typename T8, typename T9, typename T10,
4386  typename T11, typename T12, typename T13, typename T14, typename T15,
4387  typename T16, typename T17, typename T18, typename T19, typename T20,
4388  typename T21, typename T22, typename T23, typename T24, typename T25,
4389  typename T26, typename T27, typename T28>
4390 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4391  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
4392  internal::None, internal::None, internal::None, internal::None,
4393  internal::None, internal::None, internal::None, internal::None,
4394  internal::None, internal::None, internal::None, internal::None,
4395  internal::None, internal::None, internal::None, internal::None,
4396  internal::None, internal::None, internal::None, internal::None,
4397  internal::None, internal::None> {
4398  typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4399  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4400  T27, T28> type;
4401 };
4402 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4403  typename T6, typename T7, typename T8, typename T9, typename T10,
4404  typename T11, typename T12, typename T13, typename T14, typename T15,
4405  typename T16, typename T17, typename T18, typename T19, typename T20,
4406  typename T21, typename T22, typename T23, typename T24, typename T25,
4407  typename T26, typename T27, typename T28, typename T29>
4408 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4409  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4410  internal::None, internal::None, internal::None, internal::None,
4411  internal::None, internal::None, internal::None, internal::None,
4412  internal::None, internal::None, internal::None, internal::None,
4413  internal::None, internal::None, internal::None, internal::None,
4414  internal::None, internal::None, internal::None, internal::None,
4415  internal::None> {
4416  typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4417  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4418  T27, T28, T29> type;
4419 };
4420 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4421  typename T6, typename T7, typename T8, typename T9, typename T10,
4422  typename T11, typename T12, typename T13, typename T14, typename T15,
4423  typename T16, typename T17, typename T18, typename T19, typename T20,
4424  typename T21, typename T22, typename T23, typename T24, typename T25,
4425  typename T26, typename T27, typename T28, typename T29, typename T30>
4426 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4427  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4428  internal::None, internal::None, internal::None, internal::None,
4429  internal::None, internal::None, internal::None, internal::None,
4430  internal::None, internal::None, internal::None, internal::None,
4431  internal::None, internal::None, internal::None, internal::None,
4432  internal::None, internal::None, internal::None, internal::None> {
4433  typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4434  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4435  T27, T28, T29, T30> type;
4436 };
4437 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4438  typename T6, typename T7, typename T8, typename T9, typename T10,
4439  typename T11, typename T12, typename T13, typename T14, typename T15,
4440  typename T16, typename T17, typename T18, typename T19, typename T20,
4441  typename T21, typename T22, typename T23, typename T24, typename T25,
4442  typename T26, typename T27, typename T28, typename T29, typename T30,
4443  typename T31>
4444 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4445  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4446  T31, internal::None, internal::None, internal::None, internal::None,
4447  internal::None, internal::None, internal::None, internal::None,
4448  internal::None, internal::None, internal::None, internal::None,
4449  internal::None, internal::None, internal::None, internal::None,
4450  internal::None, internal::None, internal::None> {
4451  typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4452  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4453  T27, T28, T29, T30, T31> type;
4454 };
4455 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4456  typename T6, typename T7, typename T8, typename T9, typename T10,
4457  typename T11, typename T12, typename T13, typename T14, typename T15,
4458  typename T16, typename T17, typename T18, typename T19, typename T20,
4459  typename T21, typename T22, typename T23, typename T24, typename T25,
4460  typename T26, typename T27, typename T28, typename T29, typename T30,
4461  typename T31, typename T32>
4462 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4463  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4464  T31, T32, internal::None, internal::None, internal::None, internal::None,
4465  internal::None, internal::None, internal::None, internal::None,
4466  internal::None, internal::None, internal::None, internal::None,
4467  internal::None, internal::None, internal::None, internal::None,
4468  internal::None, internal::None> {
4469  typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4470  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4471  T27, T28, T29, T30, T31, T32> type;
4472 };
4473 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4474  typename T6, typename T7, typename T8, typename T9, typename T10,
4475  typename T11, typename T12, typename T13, typename T14, typename T15,
4476  typename T16, typename T17, typename T18, typename T19, typename T20,
4477  typename T21, typename T22, typename T23, typename T24, typename T25,
4478  typename T26, typename T27, typename T28, typename T29, typename T30,
4479  typename T31, typename T32, typename T33>
4480 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4481  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4482  T31, T32, T33, internal::None, internal::None, internal::None,
4483  internal::None, internal::None, internal::None, internal::None,
4484  internal::None, internal::None, internal::None, internal::None,
4485  internal::None, internal::None, internal::None, internal::None,
4486  internal::None, internal::None> {
4487  typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4488  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4489  T27, T28, T29, T30, T31, T32, T33> type;
4490 };
4491 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4492  typename T6, typename T7, typename T8, typename T9, typename T10,
4493  typename T11, typename T12, typename T13, typename T14, typename T15,
4494  typename T16, typename T17, typename T18, typename T19, typename T20,
4495  typename T21, typename T22, typename T23, typename T24, typename T25,
4496  typename T26, typename T27, typename T28, typename T29, typename T30,
4497  typename T31, typename T32, typename T33, typename T34>
4498 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4499  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4500  T31, T32, T33, T34, internal::None, internal::None, internal::None,
4501  internal::None, internal::None, internal::None, internal::None,
4502  internal::None, internal::None, internal::None, internal::None,
4503  internal::None, internal::None, internal::None, internal::None,
4504  internal::None> {
4505  typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4506  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4507  T27, T28, T29, T30, T31, T32, T33, T34> type;
4508 };
4509 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4510  typename T6, typename T7, typename T8, typename T9, typename T10,
4511  typename T11, typename T12, typename T13, typename T14, typename T15,
4512  typename T16, typename T17, typename T18, typename T19, typename T20,
4513  typename T21, typename T22, typename T23, typename T24, typename T25,
4514  typename T26, typename T27, typename T28, typename T29, typename T30,
4515  typename T31, typename T32, typename T33, typename T34, typename T35>
4516 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4517  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4518  T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,
4519  internal::None, internal::None, internal::None, internal::None,
4520  internal::None, internal::None, internal::None, internal::None,
4521  internal::None, internal::None, internal::None, internal::None> {
4522  typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4523  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4524  T27, T28, T29, T30, T31, T32, T33, T34, T35> type;
4525 };
4526 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4527  typename T6, typename T7, typename T8, typename T9, typename T10,
4528  typename T11, typename T12, typename T13, typename T14, typename T15,
4529  typename T16, typename T17, typename T18, typename T19, typename T20,
4530  typename T21, typename T22, typename T23, typename T24, typename T25,
4531  typename T26, typename T27, typename T28, typename T29, typename T30,
4532  typename T31, typename T32, typename T33, typename T34, typename T35,
4533  typename T36>
4534 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4535  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4536  T31, T32, T33, T34, T35, T36, internal::None, internal::None,
4537  internal::None, internal::None, internal::None, internal::None,
4538  internal::None, internal::None, internal::None, internal::None,
4539  internal::None, internal::None, internal::None, internal::None> {
4540  typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4541  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4542  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
4543 };
4544 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4545  typename T6, typename T7, typename T8, typename T9, typename T10,
4546  typename T11, typename T12, typename T13, typename T14, typename T15,
4547  typename T16, typename T17, typename T18, typename T19, typename T20,
4548  typename T21, typename T22, typename T23, typename T24, typename T25,
4549  typename T26, typename T27, typename T28, typename T29, typename T30,
4550  typename T31, typename T32, typename T33, typename T34, typename T35,
4551  typename T36, typename T37>
4552 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4553  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4554  T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,
4555  internal::None, internal::None, internal::None, internal::None,
4556  internal::None, internal::None, internal::None, internal::None,
4557  internal::None, internal::None, internal::None> {
4558  typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4559  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4560  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
4561 };
4562 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4563  typename T6, typename T7, typename T8, typename T9, typename T10,
4564  typename T11, typename T12, typename T13, typename T14, typename T15,
4565  typename T16, typename T17, typename T18, typename T19, typename T20,
4566  typename T21, typename T22, typename T23, typename T24, typename T25,
4567  typename T26, typename T27, typename T28, typename T29, typename T30,
4568  typename T31, typename T32, typename T33, typename T34, typename T35,
4569  typename T36, typename T37, typename T38>
4570 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4571  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4572  T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,
4573  internal::None, internal::None, internal::None, internal::None,
4574  internal::None, internal::None, internal::None, internal::None,
4575  internal::None, internal::None> {
4576  typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4577  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4578  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
4579 };
4580 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4581  typename T6, typename T7, typename T8, typename T9, typename T10,
4582  typename T11, typename T12, typename T13, typename T14, typename T15,
4583  typename T16, typename T17, typename T18, typename T19, typename T20,
4584  typename T21, typename T22, typename T23, typename T24, typename T25,
4585  typename T26, typename T27, typename T28, typename T29, typename T30,
4586  typename T31, typename T32, typename T33, typename T34, typename T35,
4587  typename T36, typename T37, typename T38, typename T39>
4588 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4589  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4590  T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,
4591  internal::None, internal::None, internal::None, internal::None,
4592  internal::None, internal::None, internal::None, internal::None,
4593  internal::None, internal::None> {
4594  typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4595  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4596  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
4597 };
4598 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4599  typename T6, typename T7, typename T8, typename T9, typename T10,
4600  typename T11, typename T12, typename T13, typename T14, typename T15,
4601  typename T16, typename T17, typename T18, typename T19, typename T20,
4602  typename T21, typename T22, typename T23, typename T24, typename T25,
4603  typename T26, typename T27, typename T28, typename T29, typename T30,
4604  typename T31, typename T32, typename T33, typename T34, typename T35,
4605  typename T36, typename T37, typename T38, typename T39, typename T40>
4606 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4607  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4608  T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,
4609  internal::None, internal::None, internal::None, internal::None,
4610  internal::None, internal::None, internal::None, internal::None,
4611  internal::None> {
4612  typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4613  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4614  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
4615  T40> type;
4616 };
4617 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4618  typename T6, typename T7, typename T8, typename T9, typename T10,
4619  typename T11, typename T12, typename T13, typename T14, typename T15,
4620  typename T16, typename T17, typename T18, typename T19, typename T20,
4621  typename T21, typename T22, typename T23, typename T24, typename T25,
4622  typename T26, typename T27, typename T28, typename T29, typename T30,
4623  typename T31, typename T32, typename T33, typename T34, typename T35,
4624  typename T36, typename T37, typename T38, typename T39, typename T40,
4625  typename T41>
4626 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4627  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4628  T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,
4629  internal::None, internal::None, internal::None, internal::None,
4630  internal::None, internal::None, internal::None, internal::None> {
4631  typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4632  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4633  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4634  T41> type;
4635 };
4636 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4637  typename T6, typename T7, typename T8, typename T9, typename T10,
4638  typename T11, typename T12, typename T13, typename T14, typename T15,
4639  typename T16, typename T17, typename T18, typename T19, typename T20,
4640  typename T21, typename T22, typename T23, typename T24, typename T25,
4641  typename T26, typename T27, typename T28, typename T29, typename T30,
4642  typename T31, typename T32, typename T33, typename T34, typename T35,
4643  typename T36, typename T37, typename T38, typename T39, typename T40,
4644  typename T41, typename T42>
4645 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4646  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4647  T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,
4648  internal::None, internal::None, internal::None, internal::None,
4649  internal::None, internal::None, internal::None> {
4650  typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4651  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4652  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4653  T41, T42> type;
4654 };
4655 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4656  typename T6, typename T7, typename T8, typename T9, typename T10,
4657  typename T11, typename T12, typename T13, typename T14, typename T15,
4658  typename T16, typename T17, typename T18, typename T19, typename T20,
4659  typename T21, typename T22, typename T23, typename T24, typename T25,
4660  typename T26, typename T27, typename T28, typename T29, typename T30,
4661  typename T31, typename T32, typename T33, typename T34, typename T35,
4662  typename T36, typename T37, typename T38, typename T39, typename T40,
4663  typename T41, typename T42, typename T43>
4664 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4665  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4666  T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4667  internal::None, internal::None, internal::None, internal::None,
4668  internal::None, internal::None, internal::None> {
4669  typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4670  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4671  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4672  T41, T42, T43> type;
4673 };
4674 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4675  typename T6, typename T7, typename T8, typename T9, typename T10,
4676  typename T11, typename T12, typename T13, typename T14, typename T15,
4677  typename T16, typename T17, typename T18, typename T19, typename T20,
4678  typename T21, typename T22, typename T23, typename T24, typename T25,
4679  typename T26, typename T27, typename T28, typename T29, typename T30,
4680  typename T31, typename T32, typename T33, typename T34, typename T35,
4681  typename T36, typename T37, typename T38, typename T39, typename T40,
4682  typename T41, typename T42, typename T43, typename T44>
4683 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4684  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4685  T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
4686  internal::None, internal::None, internal::None, internal::None,
4687  internal::None, internal::None> {
4688  typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4689  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4690  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4691  T41, T42, T43, T44> type;
4692 };
4693 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4694  typename T6, typename T7, typename T8, typename T9, typename T10,
4695  typename T11, typename T12, typename T13, typename T14, typename T15,
4696  typename T16, typename T17, typename T18, typename T19, typename T20,
4697  typename T21, typename T22, typename T23, typename T24, typename T25,
4698  typename T26, typename T27, typename T28, typename T29, typename T30,
4699  typename T31, typename T32, typename T33, typename T34, typename T35,
4700  typename T36, typename T37, typename T38, typename T39, typename T40,
4701  typename T41, typename T42, typename T43, typename T44, typename T45>
4702 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4703  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4704  T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
4705  internal::None, internal::None, internal::None, internal::None,
4706  internal::None> {
4707  typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4708  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4709  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4710  T41, T42, T43, T44, T45> type;
4711 };
4712 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4713  typename T6, typename T7, typename T8, typename T9, typename T10,
4714  typename T11, typename T12, typename T13, typename T14, typename T15,
4715  typename T16, typename T17, typename T18, typename T19, typename T20,
4716  typename T21, typename T22, typename T23, typename T24, typename T25,
4717  typename T26, typename T27, typename T28, typename T29, typename T30,
4718  typename T31, typename T32, typename T33, typename T34, typename T35,
4719  typename T36, typename T37, typename T38, typename T39, typename T40,
4720  typename T41, typename T42, typename T43, typename T44, typename T45,
4721  typename T46>
4722 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4723  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4724  T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
4725  T46, internal::None, internal::None, internal::None, internal::None> {
4726  typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4727  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4728  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4729  T41, T42, T43, T44, T45, T46> type;
4730 };
4731 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4732  typename T6, typename T7, typename T8, typename T9, typename T10,
4733  typename T11, typename T12, typename T13, typename T14, typename T15,
4734  typename T16, typename T17, typename T18, typename T19, typename T20,
4735  typename T21, typename T22, typename T23, typename T24, typename T25,
4736  typename T26, typename T27, typename T28, typename T29, typename T30,
4737  typename T31, typename T32, typename T33, typename T34, typename T35,
4738  typename T36, typename T37, typename T38, typename T39, typename T40,
4739  typename T41, typename T42, typename T43, typename T44, typename T45,
4740  typename T46, typename T47>
4741 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4742  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4743  T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
4744  T46, T47, internal::None, internal::None, internal::None> {
4745  typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4746  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4747  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4748  T41, T42, T43, T44, T45, T46, T47> type;
4749 };
4750 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4751  typename T6, typename T7, typename T8, typename T9, typename T10,
4752  typename T11, typename T12, typename T13, typename T14, typename T15,
4753  typename T16, typename T17, typename T18, typename T19, typename T20,
4754  typename T21, typename T22, typename T23, typename T24, typename T25,
4755  typename T26, typename T27, typename T28, typename T29, typename T30,
4756  typename T31, typename T32, typename T33, typename T34, typename T35,
4757  typename T36, typename T37, typename T38, typename T39, typename T40,
4758  typename T41, typename T42, typename T43, typename T44, typename T45,
4759  typename T46, typename T47, typename T48>
4760 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4761  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4762  T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
4763  T46, T47, T48, internal::None, internal::None> {
4764  typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4765  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4766  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4767  T41, T42, T43, T44, T45, T46, T47, T48> type;
4768 };
4769 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4770  typename T6, typename T7, typename T8, typename T9, typename T10,
4771  typename T11, typename T12, typename T13, typename T14, typename T15,
4772  typename T16, typename T17, typename T18, typename T19, typename T20,
4773  typename T21, typename T22, typename T23, typename T24, typename T25,
4774  typename T26, typename T27, typename T28, typename T29, typename T30,
4775  typename T31, typename T32, typename T33, typename T34, typename T35,
4776  typename T36, typename T37, typename T38, typename T39, typename T40,
4777  typename T41, typename T42, typename T43, typename T44, typename T45,
4778  typename T46, typename T47, typename T48, typename T49>
4779 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4780  T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4781  T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
4782  T46, T47, T48, T49, internal::None> {
4783  typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4784  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4785  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4786  T41, T42, T43, T44, T45, T46, T47, T48, T49> type;
4787 };
4788 
4789 namespace internal {
4790 
4791 # define GTEST_TEMPLATE_ template <typename T> class
4792 
4793 // The template "selector" struct TemplateSel<Tmpl> is used to
4794 // represent Tmpl, which must be a class template with one type
4795 // parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
4796 // as the type Tmpl<T>. This allows us to actually instantiate the
4797 // template "selected" by TemplateSel<Tmpl>.
4798 //
4799 // This trick is necessary for simulating typedef for class templates,
4800 // which C++ doesn't support directly.
4801 template <GTEST_TEMPLATE_ Tmpl>
4802 struct TemplateSel {
4803  template <typename T>
4804  struct Bind {
4805  typedef Tmpl<T> type;
4806  };
4807 };
4808 
4809 # define GTEST_BIND_(TmplSel, T) \
4810  TmplSel::template Bind<T>::type
4811 
4812 // A unique struct template used as the default value for the
4813 // arguments of class template Templates. This allows us to simulate
4814 // variadic templates (e.g. Templates<int>, Templates<int, double>,
4815 // and etc), which C++ doesn't support directly.
4816 template <typename T>
4817 struct NoneT {};
4818 
4819 // The following family of struct and struct templates are used to
4820 // represent template lists. In particular, TemplatesN<T1, T2, ...,
4821 // TN> represents a list of N templates (T1, T2, ..., and TN). Except
4822 // for Templates0, every struct in the family has two member types:
4823 // Head for the selector of the first template in the list, and Tail
4824 // for the rest of the list.
4825 
4826 // The empty template list.
4827 struct Templates0 {};
4828 
4829 // Template lists of length 1, 2, 3, and so on.
4830 
4831 template <GTEST_TEMPLATE_ T1>
4832 struct Templates1 {
4833  typedef TemplateSel<T1> Head;
4834  typedef Templates0 Tail;
4835 };
4836 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
4837 struct Templates2 {
4838  typedef TemplateSel<T1> Head;
4839  typedef Templates1<T2> Tail;
4840 };
4841 
4842 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
4843 struct Templates3 {
4844  typedef TemplateSel<T1> Head;
4845  typedef Templates2<T2, T3> Tail;
4846 };
4847 
4848 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4849  GTEST_TEMPLATE_ T4>
4850 struct Templates4 {
4851  typedef TemplateSel<T1> Head;
4852  typedef Templates3<T2, T3, T4> Tail;
4853 };
4854 
4855 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4856  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
4857 struct Templates5 {
4858  typedef TemplateSel<T1> Head;
4859  typedef Templates4<T2, T3, T4, T5> Tail;
4860 };
4861 
4862 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4863  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
4864 struct Templates6 {
4865  typedef TemplateSel<T1> Head;
4866  typedef Templates5<T2, T3, T4, T5, T6> Tail;
4867 };
4868 
4869 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4870  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4871  GTEST_TEMPLATE_ T7>
4872 struct Templates7 {
4873  typedef TemplateSel<T1> Head;
4874  typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;
4875 };
4876 
4877 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4878  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4879  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
4880 struct Templates8 {
4881  typedef TemplateSel<T1> Head;
4882  typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;
4883 };
4884 
4885 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4886  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4887  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
4888 struct Templates9 {
4889  typedef TemplateSel<T1> Head;
4890  typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
4891 };
4892 
4893 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4894  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4895  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4896  GTEST_TEMPLATE_ T10>
4897 struct Templates10 {
4898  typedef TemplateSel<T1> Head;
4899  typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
4900 };
4901 
4902 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4903  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4904  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4905  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
4906 struct Templates11 {
4907  typedef TemplateSel<T1> Head;
4908  typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
4909 };
4910 
4911 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4912  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4913  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4914  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
4915 struct Templates12 {
4916  typedef TemplateSel<T1> Head;
4917  typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
4918 };
4919 
4920 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4921  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4922  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4923  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4924  GTEST_TEMPLATE_ T13>
4925 struct Templates13 {
4926  typedef TemplateSel<T1> Head;
4927  typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
4928 };
4929 
4930 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4931  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4932  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4933  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4934  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
4935 struct Templates14 {
4936  typedef TemplateSel<T1> Head;
4937  typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
4938  T14> Tail;
4939 };
4940 
4941 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4942  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4943  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4944  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4945  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
4946 struct Templates15 {
4947  typedef TemplateSel<T1> Head;
4948  typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4949  T15> Tail;
4950 };
4951 
4952 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4953  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4954  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4955  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4956  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
4957  GTEST_TEMPLATE_ T16>
4958 struct Templates16 {
4959  typedef TemplateSel<T1> Head;
4960  typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4961  T15, T16> Tail;
4962 };
4963 
4964 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4965  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4966  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4967  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4968  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
4969  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
4970 struct Templates17 {
4971  typedef TemplateSel<T1> Head;
4972  typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4973  T15, T16, T17> Tail;
4974 };
4975 
4976 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4977  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4978  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4979  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4980  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
4981  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
4982 struct Templates18 {
4983  typedef TemplateSel<T1> Head;
4984  typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4985  T15, T16, T17, T18> Tail;
4986 };
4987 
4988 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4989  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4990  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4991  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4992  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
4993  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
4994  GTEST_TEMPLATE_ T19>
4995 struct Templates19 {
4996  typedef TemplateSel<T1> Head;
4997  typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4998  T15, T16, T17, T18, T19> Tail;
4999 };
5000 
5001 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5002  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5003  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5004  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5005  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5006  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5007  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
5008 struct Templates20 {
5009  typedef TemplateSel<T1> Head;
5010  typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5011  T15, T16, T17, T18, T19, T20> Tail;
5012 };
5013 
5014 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5015  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5016  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5017  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5018  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5019  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5020  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
5021 struct Templates21 {
5022  typedef TemplateSel<T1> Head;
5023  typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5024  T15, T16, T17, T18, T19, T20, T21> Tail;
5025 };
5026 
5027 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5028  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5029  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5030  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5031  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5032  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5033  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5034  GTEST_TEMPLATE_ T22>
5035 struct Templates22 {
5036  typedef TemplateSel<T1> Head;
5037  typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5038  T15, T16, T17, T18, T19, T20, T21, T22> Tail;
5039 };
5040 
5041 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5042  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5043  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5044  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5045  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5046  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5047  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5048  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
5049 struct Templates23 {
5050  typedef TemplateSel<T1> Head;
5051  typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5052  T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;
5053 };
5054 
5055 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5056  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5057  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5058  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5059  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5060  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5061  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5062  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
5063 struct Templates24 {
5064  typedef TemplateSel<T1> Head;
5065  typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5066  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
5067 };
5068 
5069 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5070  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5071  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5072  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5073  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5074  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5075  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5076  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5077  GTEST_TEMPLATE_ T25>
5078 struct Templates25 {
5079  typedef TemplateSel<T1> Head;
5080  typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5081  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
5082 };
5083 
5084 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5085  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5086  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5087  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5088  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5089  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5090  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5091  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5092  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
5093 struct Templates26 {
5094  typedef TemplateSel<T1> Head;
5095  typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5096  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
5097 };
5098 
5099 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5100  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5101  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5102  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5103  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5104  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5105  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5106  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5107  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
5108 struct Templates27 {
5109  typedef TemplateSel<T1> Head;
5110  typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5111  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
5112 };
5113 
5114 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5115  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5116  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5117  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5118  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5119  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5120  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5121  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5122  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5123  GTEST_TEMPLATE_ T28>
5124 struct Templates28 {
5125  typedef TemplateSel<T1> Head;
5126  typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5127  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
5128  T28> Tail;
5129 };
5130 
5131 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5132  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5133  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5134  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5135  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5136  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5137  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5138  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5139  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5140  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
5141 struct Templates29 {
5142  typedef TemplateSel<T1> Head;
5143  typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5144  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5145  T29> Tail;
5146 };
5147 
5148 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5149  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5150  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5151  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5152  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5153  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5154  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5155  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5156  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5157  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
5158 struct Templates30 {
5159  typedef TemplateSel<T1> Head;
5160  typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5161  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5162  T29, T30> Tail;
5163 };
5164 
5165 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5166  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5167  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5168  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5169  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5170  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5171  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5172  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5173  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5174  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5175  GTEST_TEMPLATE_ T31>
5176 struct Templates31 {
5177  typedef TemplateSel<T1> Head;
5178  typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5179  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5180  T29, T30, T31> Tail;
5181 };
5182 
5183 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5184  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5185  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5186  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5187  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5188  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5189  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5190  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5191  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5192  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5193  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
5194 struct Templates32 {
5195  typedef TemplateSel<T1> Head;
5196  typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5197  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5198  T29, T30, T31, T32> Tail;
5199 };
5200 
5201 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5202  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5203  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5204  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5205  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5206  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5207  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5208  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5209  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5210  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5211  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
5212 struct Templates33 {
5213  typedef TemplateSel<T1> Head;
5214  typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5215  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5216  T29, T30, T31, T32, T33> Tail;
5217 };
5218 
5219 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5220  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5221  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5222  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5223  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5224  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5225  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5226  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5227  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5228  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5229  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5230  GTEST_TEMPLATE_ T34>
5231 struct Templates34 {
5232  typedef TemplateSel<T1> Head;
5233  typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5234  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5235  T29, T30, T31, T32, T33, T34> Tail;
5236 };
5237 
5238 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5239  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5240  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5241  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5242  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5243  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5244  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5245  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5246  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5247  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5248  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5249  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
5250 struct Templates35 {
5251  typedef TemplateSel<T1> Head;
5252  typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5253  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5254  T29, T30, T31, T32, T33, T34, T35> Tail;
5255 };
5256 
5257 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5258  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5259  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5260  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5261  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5262  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5263  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5264  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5265  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5266  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5267  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5268  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
5269 struct Templates36 {
5270  typedef TemplateSel<T1> Head;
5271  typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5272  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5273  T29, T30, T31, T32, T33, T34, T35, T36> Tail;
5274 };
5275 
5276 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5277  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5278  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5279  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5280  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5281  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5282  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5283  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5284  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5285  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5286  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5287  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5288  GTEST_TEMPLATE_ T37>
5289 struct Templates37 {
5290  typedef TemplateSel<T1> Head;
5291  typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5292  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5293  T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;
5294 };
5295 
5296 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5297  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5298  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5299  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5300  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5301  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5302  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5303  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5304  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5305  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5306  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5307  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5308  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
5309 struct Templates38 {
5310  typedef TemplateSel<T1> Head;
5311  typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5312  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5313  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
5314 };
5315 
5316 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5317  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5318  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5319  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5320  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5321  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5322  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5323  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5324  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5325  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5326  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5327  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5328  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
5329 struct Templates39 {
5330  typedef TemplateSel<T1> Head;
5331  typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5332  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5333  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
5334 };
5335 
5336 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5337  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5338  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5339  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5340  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5341  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5342  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5343  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5344  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5345  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5346  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5347  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5348  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5349  GTEST_TEMPLATE_ T40>
5350 struct Templates40 {
5351  typedef TemplateSel<T1> Head;
5352  typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5353  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5354  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
5355 };
5356 
5357 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5358  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5359  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5360  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5361  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5362  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5363  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5364  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5365  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5366  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5367  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5368  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5369  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5370  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
5371 struct Templates41 {
5372  typedef TemplateSel<T1> Head;
5373  typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5374  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5375  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
5376 };
5377 
5378 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5379  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5380  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5381  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5382  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5383  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5384  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5385  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5386  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5387  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5388  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5389  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5390  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5391  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
5392 struct Templates42 {
5393  typedef TemplateSel<T1> Head;
5394  typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5395  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5396  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
5397  T42> Tail;
5398 };
5399 
5400 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5401  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5402  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5403  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5404  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5405  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5406  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5407  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5408  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5409  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5410  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5411  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5412  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5413  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5414  GTEST_TEMPLATE_ T43>
5415 struct Templates43 {
5416  typedef TemplateSel<T1> Head;
5417  typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5418  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5419  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5420  T43> Tail;
5421 };
5422 
5423 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5424  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5425  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5426  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5427  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5428  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5429  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5430  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5431  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5432  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5433  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5434  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5435  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5436  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5437  GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
5438 struct Templates44 {
5439  typedef TemplateSel<T1> Head;
5440  typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5441  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5442  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5443  T43, T44> Tail;
5444 };
5445 
5446 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5447  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5448  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5449  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5450  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5451  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5452  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5453  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5454  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5455  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5456  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5457  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5458  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5459  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5460  GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
5461 struct Templates45 {
5462  typedef TemplateSel<T1> Head;
5463  typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5464  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5465  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5466  T43, T44, T45> Tail;
5467 };
5468 
5469 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5470  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5471  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5472  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5473  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5474  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5475  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5476  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5477  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5478  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5479  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5480  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5481  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5482  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5483  GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5484  GTEST_TEMPLATE_ T46>
5485 struct Templates46 {
5486  typedef TemplateSel<T1> Head;
5487  typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5488  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5489  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5490  T43, T44, T45, T46> Tail;
5491 };
5492 
5493 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5494  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5495  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5496  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5497  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5498  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5499  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5500  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5501  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5502  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5503  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5504  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5505  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5506  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5507  GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5508  GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
5509 struct Templates47 {
5510  typedef TemplateSel<T1> Head;
5511  typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5512  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5513  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5514  T43, T44, T45, T46, T47> Tail;
5515 };
5516 
5517 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5518  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5519  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5520  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5521  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5522  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5523  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5524  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5525  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5526  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5527  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5528  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5529  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5530  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5531  GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5532  GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
5533 struct Templates48 {
5534  typedef TemplateSel<T1> Head;
5535  typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5536  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5537  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5538  T43, T44, T45, T46, T47, T48> Tail;
5539 };
5540 
5541 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5542  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5543  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5544  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5545  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5546  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5547  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5548  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5549  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5550  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5551  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5552  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5553  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5554  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5555  GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5556  GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
5557  GTEST_TEMPLATE_ T49>
5558 struct Templates49 {
5559  typedef TemplateSel<T1> Head;
5560  typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5561  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5562  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5563  T43, T44, T45, T46, T47, T48, T49> Tail;
5564 };
5565 
5566 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5567  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5568  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5569  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5570  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5571  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5572  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5573  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5574  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5575  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5576  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5577  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5578  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5579  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5580  GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5581  GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
5582  GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>
5583 struct Templates50 {
5584  typedef TemplateSel<T1> Head;
5585  typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5586  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5587  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5588  T43, T44, T45, T46, T47, T48, T49, T50> Tail;
5589 };
5590 
5591 
5592 // We don't want to require the users to write TemplatesN<...> directly,
5593 // as that would require them to count the length. Templates<...> is much
5594 // easier to write, but generates horrible messages when there is a
5595 // compiler error, as gcc insists on printing out each template
5596 // argument, even if it has the default value (this means Templates<list>
5597 // will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
5598 // errors).
5599 //
5600 // Our solution is to combine the best part of the two approaches: a
5601 // user would write Templates<T1, ..., TN>, and Google Test will translate
5602 // that to TemplatesN<T1, ..., TN> internally to make error messages
5603 // readable. The translation is done by the 'type' member of the
5604 // Templates template.
5605 template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,
5606  GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,
5607  GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,
5608  GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,
5609  GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,
5610  GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,
5611  GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,
5612  GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,
5613  GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,
5614  GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,
5615  GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,
5616  GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,
5617  GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,
5618  GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,
5619  GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,
5620  GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,
5621  GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,
5622  GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,
5623  GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,
5624  GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,
5625  GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,
5626  GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,
5627  GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,
5628  GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,
5629  GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>
5630 struct Templates {
5631  typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5632  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
5633  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
5634  T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
5635 };
5636 
5637 template <>
5638 struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5639  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5640  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5641  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5642  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5643  NoneT> {
5644  typedef Templates0 type;
5645 };
5646 template <GTEST_TEMPLATE_ T1>
5647 struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5648  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5649  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5650  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5651  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5652  NoneT> {
5653  typedef Templates1<T1> type;
5654 };
5655 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
5656 struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5657  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5658  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5659  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5660  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5661  NoneT> {
5662  typedef Templates2<T1, T2> type;
5663 };
5664 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
5665 struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5666  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5667  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5668  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5669  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5670  typedef Templates3<T1, T2, T3> type;
5671 };
5672 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5673  GTEST_TEMPLATE_ T4>
5674 struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5675  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5676  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5677  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5678  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5679  typedef Templates4<T1, T2, T3, T4> type;
5680 };
5681 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5682  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
5683 struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5684  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5685  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5686  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5687  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5688  typedef Templates5<T1, T2, T3, T4, T5> type;
5689 };
5690 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5691  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
5692 struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,
5693  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5694  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5695  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5696  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5697  typedef Templates6<T1, T2, T3, T4, T5, T6> type;
5698 };
5699 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5700  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5701  GTEST_TEMPLATE_ T7>
5702 struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,
5703  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5704  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5705  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5706  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5707  typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;
5708 };
5709 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5710  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5711  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
5712 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT,
5713  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5714  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5715  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5716  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5717  typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;
5718 };
5719 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5720  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5721  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
5722 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT,
5723  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5724  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5725  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5726  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5727  typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
5728 };
5729 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5730  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5731  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5732  GTEST_TEMPLATE_ T10>
5733 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,
5734  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5735  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5736  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5737  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5738  typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
5739 };
5740 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5741  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5742  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5743  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
5744 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,
5745  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5746  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5747  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5748  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5749  typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
5750 };
5751 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5752  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5753  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5754  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
5755 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,
5756  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5757  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5758  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5759  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5760  typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;
5761 };
5762 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5763  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5764  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5765  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5766  GTEST_TEMPLATE_ T13>
5767 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,
5768  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5769  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5770  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5771  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5772  typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5773  T13> type;
5774 };
5775 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5776  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5777  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5778  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5779  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
5780 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5781  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5782  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5783  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5784  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5785  typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5786  T14> type;
5787 };
5788 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5789  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5790  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5791  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5792  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
5793 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5794  T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5795  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5796  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5797  NoneT, NoneT, NoneT, NoneT, NoneT> {
5798  typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5799  T14, T15> type;
5800 };
5801 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5802  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5803  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5804  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5805  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5806  GTEST_TEMPLATE_ T16>
5807 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5808  T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5809  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5810  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5811  NoneT, NoneT, NoneT, NoneT, NoneT> {
5812  typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5813  T14, T15, T16> type;
5814 };
5815 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5816  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5817  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5818  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5819  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5820  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
5821 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5822  T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5823  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5824  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5825  NoneT, NoneT, NoneT, NoneT, NoneT> {
5826  typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5827  T14, T15, T16, T17> type;
5828 };
5829 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5830  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5831  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5832  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5833  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5834  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
5835 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5836  T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5837  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5838  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5839  NoneT, NoneT, NoneT, NoneT> {
5840  typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5841  T14, T15, T16, T17, T18> type;
5842 };
5843 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5844  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5845  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5846  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5847  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5848  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5849  GTEST_TEMPLATE_ T19>
5850 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5851  T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5852  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5853  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5854  NoneT, NoneT, NoneT, NoneT> {
5855  typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5856  T14, T15, T16, T17, T18, T19> type;
5857 };
5858 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5859  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5860  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5861  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5862  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5863  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5864  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
5865 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5866  T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5867  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5868  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5869  NoneT, NoneT, NoneT, NoneT> {
5870  typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5871  T14, T15, T16, T17, T18, T19, T20> type;
5872 };
5873 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5874  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5875  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5876  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5877  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5878  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5879  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
5880 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5881  T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT,
5882  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5883  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5884  NoneT, NoneT, NoneT, NoneT> {
5885  typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5886  T14, T15, T16, T17, T18, T19, T20, T21> type;
5887 };
5888 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5889  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5890  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5891  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5892  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5893  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5894  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5895  GTEST_TEMPLATE_ T22>
5896 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5897  T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,
5898  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5899  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5900  NoneT, NoneT, NoneT> {
5901  typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5902  T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
5903 };
5904 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5905  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5906  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5907  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5908  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5909  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5910  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5911  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
5912 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5913  T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,
5914  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5915  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5916  NoneT, NoneT, NoneT> {
5917  typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5918  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
5919 };
5920 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5921  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5922  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5923  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5924  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5925  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5926  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5927  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
5928 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5929  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,
5930  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5931  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5932  NoneT, NoneT, NoneT> {
5933  typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5934  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
5935 };
5936 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5937  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5938  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5939  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5940  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5941  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5942  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5943  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5944  GTEST_TEMPLATE_ T25>
5945 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5946  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,
5947  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5948  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5949  NoneT, NoneT> {
5950  typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5951  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
5952 };
5953 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5954  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5955  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5956  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5957  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5958  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5959  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5960  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5961  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
5962 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5963  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,
5964  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5965  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5966  NoneT, NoneT> {
5967  typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5968  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;
5969 };
5970 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5971  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5972  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5973  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5974  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5975  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5976  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5977  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5978  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
5979 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5980  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,
5981  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5982  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5983  NoneT, NoneT> {
5984  typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5985  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5986  T27> type;
5987 };
5988 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5989  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5990  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5991  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5992  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5993  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5994  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5995  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5996  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5997  GTEST_TEMPLATE_ T28>
5998 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5999  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6000  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6001  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6002  NoneT, NoneT> {
6003  typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6004  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6005  T28> type;
6006 };
6007 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6008  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6009  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6010  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6011  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6012  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6013  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6014  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6015  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6016  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
6017 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6018  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6019  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6020  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6021  NoneT> {
6022  typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6023  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6024  T28, T29> type;
6025 };
6026 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6027  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6028  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6029  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6030  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6031  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6032  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6033  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6034  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6035  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
6036 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6037  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6038  T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6039  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6040  typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6041  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6042  T28, T29, T30> type;
6043 };
6044 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6045  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6046  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6047  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6048  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6049  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6050  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6051  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6052  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6053  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6054  GTEST_TEMPLATE_ T31>
6055 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6056  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6057  T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6058  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6059  typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6060  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6061  T28, T29, T30, T31> type;
6062 };
6063 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6064  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6065  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6066  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6067  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6068  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6069  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6070  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6071  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6072  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6073  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
6074 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6075  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6076  T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6077  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6078  typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6079  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6080  T28, T29, T30, T31, T32> type;
6081 };
6082 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6083  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6084  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6085  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6086  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6087  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6088  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6089  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6090  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6091  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6092  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
6093 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6094  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6095  T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6096  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6097  typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6098  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6099  T28, T29, T30, T31, T32, T33> type;
6100 };
6101 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6102  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6103  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6104  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6105  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6106  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6107  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6108  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6109  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6110  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6111  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6112  GTEST_TEMPLATE_ T34>
6113 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6114  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6115  T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6116  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6117  typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6118  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6119  T28, T29, T30, T31, T32, T33, T34> type;
6120 };
6121 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6122  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6123  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6124  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6125  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6126  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6127  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6128  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6129  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6130  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6131  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6132  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
6133 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6134  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6135  T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6136  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6137  typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6138  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6139  T28, T29, T30, T31, T32, T33, T34, T35> type;
6140 };
6141 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6142  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6143  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6144  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6145  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6146  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6147  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6148  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6149  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6150  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6151  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6152  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
6153 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6154  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6155  T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,
6156  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6157  typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6158  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6159  T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
6160 };
6161 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6162  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6163  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6164  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6165  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6166  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6167  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6168  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6169  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6170  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6171  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6172  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6173  GTEST_TEMPLATE_ T37>
6174 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6175  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6176  T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,
6177  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6178  typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6179  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6180  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
6181 };
6182 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6183  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6184  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6185  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6186  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6187  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6188  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6189  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6190  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6191  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6192  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6193  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6194  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
6195 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6196  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6197  T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,
6198  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6199  typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6200  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6201  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
6202 };
6203 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6204  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6205  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6206  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6207  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6208  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6209  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6210  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6211  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6212  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6213  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6214  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6215  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
6216 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6217  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6218  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,
6219  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6220  typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6221  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6222  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
6223 };
6224 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6225  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6226  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6227  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6228  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6229  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6230  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6231  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6232  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6233  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6234  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6235  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6236  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6237  GTEST_TEMPLATE_ T40>
6238 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6239  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6240  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,
6241  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6242  typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6243  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6244  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;
6245 };
6246 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6247  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6248  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6249  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6250  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6251  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6252  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6253  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6254  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6255  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6256  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6257  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6258  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6259  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
6260 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6261  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6262  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,
6263  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6264  typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6265  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6266  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6267  T41> type;
6268 };
6269 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6270  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6271  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6272  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6273  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6274  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6275  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6276  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6277  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6278  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6279  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6280  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6281  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6282  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
6283 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6284  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6285  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,
6286  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6287  typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6288  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6289  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6290  T42> type;
6291 };
6292 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6293  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6294  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6295  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6296  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6297  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6298  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6299  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6300  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6301  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6302  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6303  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6304  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6305  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6306  GTEST_TEMPLATE_ T43>
6307 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6308  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6309  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
6310  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6311  typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6312  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6313  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6314  T42, T43> type;
6315 };
6316 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6317  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6318  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6319  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6320  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6321  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6322  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6323  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6324  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6325  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6326  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6327  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6328  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6329  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6330  GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
6331 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6332  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6333  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6334  NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6335  typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6336  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6337  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6338  T42, T43, T44> type;
6339 };
6340 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6341  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6342  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6343  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6344  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6345  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6346  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6347  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6348  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6349  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6350  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6351  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6352  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6353  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6354  GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
6355 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6356  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6357  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6358  T45, NoneT, NoneT, NoneT, NoneT, NoneT> {
6359  typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6360  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6361  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6362  T42, T43, T44, T45> type;
6363 };
6364 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6365  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6366  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6367  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6368  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6369  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6370  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6371  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6372  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6373  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6374  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6375  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6376  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6377  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6378  GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6379  GTEST_TEMPLATE_ T46>
6380 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6381  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6382  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6383  T45, T46, NoneT, NoneT, NoneT, NoneT> {
6384  typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6385  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6386  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6387  T42, T43, T44, T45, T46> type;
6388 };
6389 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6390  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6391  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6392  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6393  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6394  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6395  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6396  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6397  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6398  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6399  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6400  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6401  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6402  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6403  GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6404  GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
6405 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6406  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6407  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6408  T45, T46, T47, NoneT, NoneT, NoneT> {
6409  typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6410  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6411  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6412  T42, T43, T44, T45, T46, T47> type;
6413 };
6414 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6415  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6416  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6417  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6418  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6419  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6420  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6421  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6422  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6423  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6424  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6425  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6426  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6427  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6428  GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6429  GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
6430 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6431  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6432  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6433  T45, T46, T47, T48, NoneT, NoneT> {
6434  typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6435  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6436  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6437  T42, T43, T44, T45, T46, T47, T48> type;
6438 };
6439 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6440  GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6441  GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6442  GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6443  GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6444  GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6445  GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6446  GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6447  GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6448  GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6449  GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6450  GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6451  GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6452  GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6453  GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6454  GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
6455  GTEST_TEMPLATE_ T49>
6456 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6457  T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6458  T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6459  T45, T46, T47, T48, T49, NoneT> {
6460  typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6461  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6462  T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6463  T42, T43, T44, T45, T46, T47, T48, T49> type;
6464 };
6465 
6466 // The TypeList template makes it possible to use either a single type
6467 // or a Types<...> list in TYPED_TEST_SUITE() and
6468 // INSTANTIATE_TYPED_TEST_SUITE_P().
6469 
6470 template <typename T>
6471 struct TypeList {
6472  typedef Types1<T> type;
6473 };
6474 
6475 template <typename T1, typename T2, typename T3, typename T4, typename T5,
6476  typename T6, typename T7, typename T8, typename T9, typename T10,
6477  typename T11, typename T12, typename T13, typename T14, typename T15,
6478  typename T16, typename T17, typename T18, typename T19, typename T20,
6479  typename T21, typename T22, typename T23, typename T24, typename T25,
6480  typename T26, typename T27, typename T28, typename T29, typename T30,
6481  typename T31, typename T32, typename T33, typename T34, typename T35,
6482  typename T36, typename T37, typename T38, typename T39, typename T40,
6483  typename T41, typename T42, typename T43, typename T44, typename T45,
6484  typename T46, typename T47, typename T48, typename T49, typename T50>
6485 struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6486  T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6487  T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
6488  T44, T45, T46, T47, T48, T49, T50> > {
6489  typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6490  T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6491  T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6492  T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;
6493 };
6494 
6495 #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
6496 
6497 } // namespace internal
6498 } // namespace testing
6499 
6500 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
6501 
6502 // Due to C++ preprocessor weirdness, we need double indirection to
6503 // concatenate two tokens when one of them is __LINE__. Writing
6504 //
6505 // foo ## __LINE__
6506 //
6507 // will result in the token foo__LINE__, instead of foo followed by
6508 // the current line number. For more details, see
6509 // http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
6510 #define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
6511 #define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
6512 
6513 // Stringifies its argument.
6514 #define GTEST_STRINGIFY_(name) #name
6515 
6516 class ProtocolMessage;
6517 namespace proto2 { class Message; }
6518 
6519 namespace testing {
6520 
6521 // Forward declarations.
6522 
6523 class AssertionResult; // Result of an assertion.
6524 class Message; // Represents a failure message.
6525 class Test; // Represents a test.
6526 class TestInfo; // Information about a test.
6527 class TestPartResult; // Result of a test part.
6528 class UnitTest; // A collection of test suites.
6529 
6530 template <typename T>
6531 ::std::string PrintToString(const T& value);
6532 
6533 namespace internal {
6534 
6535 struct TraceInfo; // Information about a trace point.
6536 class TestInfoImpl; // Opaque implementation of TestInfo
6537 class UnitTestImpl; // Opaque implementation of UnitTest
6538 
6539 // The text used in failure messages to indicate the start of the
6540 // stack trace.
6541 GTEST_API_ extern const char kStackTraceMarker[];
6542 
6543 // An IgnoredValue object can be implicitly constructed from ANY value.
6545  public:
6546  // This constructor template allows any value to be implicitly
6547  // converted to IgnoredValue. The object has no data member and
6548  // doesn't try to remember anything about the argument. We
6549  // deliberately omit the 'explicit' keyword in order to allow the
6550  // conversion to be implicit.
6551  template <typename T>
6552  IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
6553 };
6554 
6555 // Two overloaded helpers for checking at compile time whether an
6556 // expression is a null pointer literal (i.e. NULL or any 0-valued
6557 // compile-time integral constant). These helpers have no
6558 // implementations, as we only need their signatures.
6559 //
6560 // Given IsNullLiteralHelper(x), the compiler will pick the first
6561 // version if x can be implicitly converted to Secret*, and pick the
6562 // second version otherwise. Since Secret is a secret and incomplete
6563 // type, the only expression a user can write that has type Secret* is
6564 // a null pointer literal. Therefore, we know that x is a null
6565 // pointer literal if and only if the first version is picked by the
6566 // compiler.
6568 std::false_type IsNullLiteralHelper(IgnoredValue);
6569 
6570 // A compile-time bool constant that is true if and only if x is a null pointer
6571 // literal (i.e. nullptr, NULL or any 0-valued compile-time integral constant).
6572 #define GTEST_IS_NULL_LITERAL_(x) \
6573  decltype(::testing::internal::IsNullLiteralHelper(x))::value
6574 
6575 // Appends the user-supplied message to the Google-Test-generated message.
6577  const std::string& gtest_msg, const Message& user_msg);
6578 
6579 #if GTEST_HAS_EXCEPTIONS
6580 
6582 /* an exported class was derived from a class that was not exported */)
6583 
6584 // This exception is thrown by (and only by) a failed Google Test
6585 // assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
6586 // are enabled). We derive it from std::runtime_error, which is for
6587 // errors presumably detectable only at run time. Since
6588 // std::runtime_error inherits from std::exception, many testing
6589 // frameworks know how to extract and print the message inside it.
6590 class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
6591  public:
6592  explicit GoogleTestFailureException(const TestPartResult& failure);
6593 };
6594 
6596 
6597 #endif // GTEST_HAS_EXCEPTIONS
6598 
6599 namespace edit_distance {
6600 // Returns the optimal edits to go from 'left' to 'right'.
6601 // All edits cost the same, with replace having lower priority than
6602 // add/remove.
6603 // Simple implementation of the Wagner-Fischer algorithm.
6604 // See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm
6606 GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
6607  const std::vector<size_t>& left, const std::vector<size_t>& right);
6608 
6609 // Same as above, but the input is represented as strings.
6610 GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
6611  const std::vector<std::string>& left,
6612  const std::vector<std::string>& right);
6613 
6614 // Create a diff of the input strings in Unified diff format.
6615 GTEST_API_ std::string CreateUnifiedDiff(const std::vector<std::string>& left,
6616  const std::vector<std::string>& right,
6617  size_t context = 2);
6618 
6619 } // namespace edit_distance
6620 
6621 // Calculate the diff between 'left' and 'right' and return it in unified diff
6622 // format.
6623 // If not null, stores in 'total_line_count' the total number of lines found
6624 // in left + right.
6626  const std::string& right,
6627  size_t* total_line_count);
6628 
6629 // Constructs and returns the message for an equality assertion
6630 // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
6631 //
6632 // The first four parameters are the expressions used in the assertion
6633 // and their values, as strings. For example, for ASSERT_EQ(foo, bar)
6634 // where foo is 5 and bar is 6, we have:
6635 //
6636 // expected_expression: "foo"
6637 // actual_expression: "bar"
6638 // expected_value: "5"
6639 // actual_value: "6"
6640 //
6641 // The ignoring_case parameter is true iff the assertion is a
6642 // *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
6643 // be inserted into the message.
6644 GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
6645  const char* actual_expression,
6646  const std::string& expected_value,
6647  const std::string& actual_value,
6648  bool ignoring_case);
6649 
6650 // Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
6652  const AssertionResult& assertion_result,
6653  const char* expression_text,
6654  const char* actual_predicate_value,
6655  const char* expected_predicate_value);
6656 
6657 // This template class represents an IEEE floating-point number
6658 // (either single-precision or double-precision, depending on the
6659 // template parameters).
6660 //
6661 // The purpose of this class is to do more sophisticated number
6662 // comparison. (Due to round-off error, etc, it's very unlikely that
6663 // two floating-points will be equal exactly. Hence a naive
6664 // comparison by the == operation often doesn't work.)
6665 //
6666 // Format of IEEE floating-point:
6667 //
6668 // The most-significant bit being the leftmost, an IEEE
6669 // floating-point looks like
6670 //
6671 // sign_bit exponent_bits fraction_bits
6672 //
6673 // Here, sign_bit is a single bit that designates the sign of the
6674 // number.
6675 //
6676 // For float, there are 8 exponent bits and 23 fraction bits.
6677 //
6678 // For double, there are 11 exponent bits and 52 fraction bits.
6679 //
6680 // More details can be found at
6681 // http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
6682 //
6683 // Template parameter:
6684 //
6685 // RawType: the raw floating-point type (either float or double)
6686 template <typename RawType>
6688  public:
6689  // Defines the unsigned integer type that has the same size as the
6690  // floating point number.
6692 
6693  // Constants.
6694 
6695  // # of bits in a number.
6696  static const size_t kBitCount = 8*sizeof(RawType);
6697 
6698  // # of fraction bits in a number.
6699  static const size_t kFractionBitCount =
6700  std::numeric_limits<RawType>::digits - 1;
6701 
6702  // # of exponent bits in a number.
6703  static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
6704 
6705  // The mask for the sign bit.
6706  static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
6707 
6708  // The mask for the fraction bits.
6709  static const Bits kFractionBitMask =
6710  ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
6711 
6712  // The mask for the exponent bits.
6714 
6715  // How many ULP's (Units in the Last Place) we want to tolerate when
6716  // comparing two numbers. The larger the value, the more error we
6717  // allow. A 0 value means that two numbers must be exactly the same
6718  // to be considered equal.
6719  //
6720  // The maximum error of a single floating-point operation is 0.5
6721  // units in the last place. On Intel CPU's, all floating-point
6722  // calculations are done with 80-bit precision, while double has 64
6723  // bits. Therefore, 4 should be enough for ordinary use.
6724  //
6725  // See the following article for more details on ULP:
6726  // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
6727  static const size_t kMaxUlps = 4;
6728 
6729  // Constructs a FloatingPoint from a raw floating-point number.
6730  //
6731  // On an Intel CPU, passing a non-normalized NAN (Not a Number)
6732  // around may change its bits, although the new value is guaranteed
6733  // to be also a NAN. Therefore, don't expect this constructor to
6734  // preserve the bits in x when x is a NAN.
6735  explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
6736 
6737  // Static methods
6738 
6739  // Reinterprets a bit pattern as a floating-point number.
6740  //
6741  // This function is needed to test the AlmostEquals() method.
6742  static RawType ReinterpretBits(const Bits bits) {
6743  FloatingPoint fp(0);
6744  fp.u_.bits_ = bits;
6745  return fp.u_.value_;
6746  }
6747 
6748  // Returns the floating-point number that represent positive infinity.
6749  static RawType Infinity() {
6751  }
6752 
6753  // Returns the maximum representable finite floating-point number.
6754  static RawType Max();
6755 
6756  // Non-static methods
6757 
6758  // Returns the bits that represents this number.
6759  const Bits &bits() const { return u_.bits_; }
6760 
6761  // Returns the exponent bits of this number.
6762  Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
6763 
6764  // Returns the fraction bits of this number.
6765  Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
6766 
6767  // Returns the sign bit of this number.
6768  Bits sign_bit() const { return kSignBitMask & u_.bits_; }
6769 
6770  // Returns true iff this is NAN (not a number).
6771  bool is_nan() const {
6772  // It's a NAN if the exponent bits are all ones and the fraction
6773  // bits are not entirely zeros.
6774  return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
6775  }
6776 
6777  // Returns true iff this number is at most kMaxUlps ULP's away from
6778  // rhs. In particular, this function:
6779  //
6780  // - returns false if either number is (or both are) NAN.
6781  // - treats really large numbers as almost equal to infinity.
6782  // - thinks +0.0 and -0.0 are 0 DLP's apart.
6783  bool AlmostEquals(const FloatingPoint& rhs) const {
6784  // The IEEE standard says that any comparison operation involving
6785  // a NAN must return false.
6786  if (is_nan() || rhs.is_nan()) return false;
6787 
6788  return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
6789  <= kMaxUlps;
6790  }
6791 
6792  private:
6793  // The data type used to store the actual floating-point number.
6794  union FloatingPointUnion {
6795  RawType value_; // The raw floating-point number.
6796  Bits bits_; // The bits that represent the number.
6797  };
6798 
6799  // Converts an integer from the sign-and-magnitude representation to
6800  // the biased representation. More precisely, let N be 2 to the
6801  // power of (kBitCount - 1), an integer x is represented by the
6802  // unsigned number x + N.
6803  //
6804  // For instance,
6805  //
6806  // -N + 1 (the most negative number representable using
6807  // sign-and-magnitude) is represented by 1;
6808  // 0 is represented by N; and
6809  // N - 1 (the biggest number representable using
6810  // sign-and-magnitude) is represented by 2N - 1.
6811  //
6812  // Read http://en.wikipedia.org/wiki/Signed_number_representations
6813  // for more details on signed number representations.
6814  static Bits SignAndMagnitudeToBiased(const Bits &sam) {
6815  if (kSignBitMask & sam) {
6816  // sam represents a negative number.
6817  return ~sam + 1;
6818  } else {
6819  // sam represents a positive number.
6820  return kSignBitMask | sam;
6821  }
6822  }
6823 
6824  // Given two numbers in the sign-and-magnitude representation,
6825  // returns the distance between them as an unsigned number.
6826  static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
6827  const Bits &sam2) {
6828  const Bits biased1 = SignAndMagnitudeToBiased(sam1);
6829  const Bits biased2 = SignAndMagnitudeToBiased(sam2);
6830  return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
6831  }
6832 
6833  FloatingPointUnion u_;
6834 };
6835 
6836 // We cannot use std::numeric_limits<T>::max() as it clashes with the max()
6837 // macro defined by <windows.h>.
6838 template <>
6839 inline float FloatingPoint<float>::Max() { return FLT_MAX; }
6840 template <>
6841 inline double FloatingPoint<double>::Max() { return DBL_MAX; }
6842 
6843 // Typedefs the instances of the FloatingPoint template class that we
6844 // care to use.
6847 
6848 // In order to catch the mistake of putting tests that use different
6849 // test fixture classes in the same test suite, we need to assign
6850 // unique IDs to fixture classes and compare them. The TypeId type is
6851 // used to hold such IDs. The user should treat TypeId as an opaque
6852 // type: the only operation allowed on TypeId values is to compare
6853 // them for equality using the == operator.
6854 typedef const void* TypeId;
6855 
6856 template <typename T>
6858  public:
6859  // dummy_ must not have a const type. Otherwise an overly eager
6860  // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
6861  // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
6862  static bool dummy_;
6863 };
6864 
6865 template <typename T>
6866 bool TypeIdHelper<T>::dummy_ = false;
6867 
6868 // GetTypeId<T>() returns the ID of type T. Different values will be
6869 // returned for different types. Calling the function twice with the
6870 // same type argument is guaranteed to return the same ID.
6871 template <typename T>
6873  // The compiler is required to allocate a different
6874  // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
6875  // the template. Therefore, the address of dummy_ is guaranteed to
6876  // be unique.
6877  return &(TypeIdHelper<T>::dummy_);
6878 }
6879 
6880 // Returns the type ID of ::testing::Test. Always call this instead
6881 // of GetTypeId< ::testing::Test>() to get the type ID of
6882 // ::testing::Test, as the latter may give the wrong result due to a
6883 // suspected linker bug when compiling Google Test as a Mac OS X
6884 // framework.
6886 
6887 // Defines the abstract factory interface that creates instances
6888 // of a Test object.
6890  public:
6891  virtual ~TestFactoryBase() {}
6892 
6893  // Creates a test instance to run. The instance is both created and destroyed
6894  // within TestInfoImpl::Run()
6895  virtual Test* CreateTest() = 0;
6896 
6897  protected:
6899 
6900  private:
6901  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
6902 };
6903 
6904 // This class provides implementation of TeastFactoryBase interface.
6905 // It is used in TEST and TEST_F macros.
6906 template <class TestClass>
6908  public:
6909  Test* CreateTest() override { return new TestClass; }
6910 };
6911 
6912 #if GTEST_OS_WINDOWS
6913 
6914 // Predicate-formatters for implementing the HRESULT checking macros
6915 // {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
6916 // We pass a long instead of HRESULT to avoid causing an
6917 // include dependency for the HRESULT type.
6918 GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
6919  long hr); // NOLINT
6920 GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
6921  long hr); // NOLINT
6922 
6923 #endif // GTEST_OS_WINDOWS
6924 
6925 // Types of SetUpTestSuite() and TearDownTestSuite() functions.
6926 using SetUpTestSuiteFunc = void (*)();
6927 using TearDownTestSuiteFunc = void (*)();
6928 
6930  CodeLocation(const std::string& a_file, int a_line)
6931  : file(a_file), line(a_line) {}
6932 
6934  int line;
6935 };
6936 
6937 // Helper to identify which setup function for TestCase / TestSuite to call.
6938 // Only one function is allowed, either TestCase or TestSute but not both.
6939 
6940 // Utility functions to help SuiteApiResolver
6941 using SetUpTearDownSuiteFuncType = void (*)();
6942 
6945  return a == def ? nullptr : a;
6946 }
6947 
6948 template <typename T>
6949 // Note that SuiteApiResolver inherits from T because
6950 // SetUpTestSuite()/TearDownTestSuite() could be protected. Ths way
6951 // SuiteApiResolver can access them.
6952 struct SuiteApiResolver : T {
6953  // testing::Test is only forward declared at this point. So we make it a
6954  // dependend class for the compiler to be OK with it.
6955  using Test =
6956  typename std::conditional<sizeof(T) != 0, ::testing::Test, void>::type;
6957 
6959  SetUpTearDownSuiteFuncType test_case_fp =
6960  GetNotDefaultOrNull(&T::SetUpTestCase, &Test::SetUpTestCase);
6961  SetUpTearDownSuiteFuncType test_suite_fp =
6962  GetNotDefaultOrNull(&T::SetUpTestSuite, &Test::SetUpTestSuite);
6963 
6964  GTEST_CHECK_(!test_case_fp || !test_suite_fp)
6965  << "Test can not provide both SetUpTestSuite and SetUpTestCase, please "
6966  "make sure there is only one present ";
6967 
6968  return test_case_fp != nullptr ? test_case_fp : test_suite_fp;
6969  }
6970 
6972  SetUpTearDownSuiteFuncType test_case_fp =
6973  GetNotDefaultOrNull(&T::TearDownTestCase, &Test::TearDownTestCase);
6974  SetUpTearDownSuiteFuncType test_suite_fp =
6975  GetNotDefaultOrNull(&T::TearDownTestSuite, &Test::TearDownTestSuite);
6976 
6977  GTEST_CHECK_(!test_case_fp || !test_suite_fp)
6978  << "Test can not provide both TearDownTestSuite and TearDownTestCase,"
6979  " please make sure there is only one present ";
6980 
6981  return test_case_fp != nullptr ? test_case_fp : test_suite_fp;
6982  }
6983 };
6984 
6985 // Creates a new TestInfo object and registers it with Google Test;
6986 // returns the created object.
6987 //
6988 // Arguments:
6989 //
6990 // test_suite_name: name of the test suite
6991 // name: name of the test
6992 // type_param the name of the test's type parameter, or NULL if
6993 // this is not a typed or a type-parameterized test.
6994 // value_param text representation of the test's value parameter,
6995 // or NULL if this is not a type-parameterized test.
6996 // code_location: code location where the test is defined
6997 // fixture_class_id: ID of the test fixture class
6998 // set_up_tc: pointer to the function that sets up the test suite
6999 // tear_down_tc: pointer to the function that tears down the test suite
7000 // factory: pointer to the factory that creates a test object.
7001 // The newly created TestInfo instance will assume
7002 // ownership of the factory object.
7004  const char* test_suite_name, const char* name, const char* type_param,
7005  const char* value_param, CodeLocation code_location,
7006  TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc,
7007  TearDownTestSuiteFunc tear_down_tc, TestFactoryBase* factory);
7008 
7009 // If *pstr starts with the given prefix, modifies *pstr to be right
7010 // past the prefix and returns true; otherwise leaves *pstr unchanged
7011 // and returns false. None of pstr, *pstr, and prefix can be NULL.
7012 GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
7013 
7014 #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
7015 
7017 /* class A needs to have dll-interface to be used by clients of class B */)
7018 
7019 // State of the definition of a type-parameterized test suite.
7020 class GTEST_API_ TypedTestSuitePState {
7021  public:
7022  TypedTestSuitePState() : registered_(false) {}
7023 
7024  // Adds the given test name to defined_test_names_ and return true
7025  // if the test suite hasn't been registered; otherwise aborts the
7026  // program.
7027  bool AddTestName(const char* file, int line, const char* case_name,
7028  const char* test_name) {
7029  if (registered_) {
7030  fprintf(stderr,
7031  "%s Test %s must be defined before "
7032  "REGISTER_TYPED_TEST_SUITE_P(%s, ...).\n",
7033  FormatFileLocation(file, line).c_str(), test_name, case_name);
7034  fflush(stderr);
7035  posix::Abort();
7036  }
7037  registered_tests_.insert(
7038  ::std::make_pair(test_name, CodeLocation(file, line)));
7039  return true;
7040  }
7041 
7042  bool TestExists(const std::string& test_name) const {
7043  return registered_tests_.count(test_name) > 0;
7044  }
7045 
7046  const CodeLocation& GetCodeLocation(const std::string& test_name) const {
7047  RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name);
7048  GTEST_CHECK_(it != registered_tests_.end());
7049  return it->second;
7050  }
7051 
7052  // Verifies that registered_tests match the test names in
7053  // defined_test_names_; returns registered_tests if successful, or
7054  // aborts the program otherwise.
7055  const char* VerifyRegisteredTestNames(
7056  const char* file, int line, const char* registered_tests);
7057 
7058  private:
7059  typedef ::std::map<std::string, CodeLocation> RegisteredTestsMap;
7060 
7061  bool registered_;
7062  RegisteredTestsMap registered_tests_;
7063 };
7064 
7065 // Legacy API is deprecated but still available
7066 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
7067 using TypedTestCasePState = TypedTestSuitePState;
7068 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
7069 
7071 
7072 // Skips to the first non-space char after the first comma in 'str';
7073 // returns NULL if no comma is found in 'str'.
7074 inline const char* SkipComma(const char* str) {
7075  const char* comma = strchr(str, ',');
7076  if (comma == nullptr) {
7077  return nullptr;
7078  }
7079  while (IsSpace(*(++comma))) {}
7080  return comma;
7081 }
7082 
7083 // Returns the prefix of 'str' before the first comma in it; returns
7084 // the entire string if it contains no comma.
7085 inline std::string GetPrefixUntilComma(const char* str) {
7086  const char* comma = strchr(str, ',');
7087  return comma == nullptr ? str : std::string(str, comma);
7088 }
7089 
7090 // Splits a given string on a given delimiter, populating a given
7091 // vector with the fields.
7092 void SplitString(const ::std::string& str, char delimiter,
7093  ::std::vector< ::std::string>* dest);
7094 
7095 // The default argument to the template below for the case when the user does
7096 // not provide a name generator.
7097 struct DefaultNameGenerator {
7098  template <typename T>
7099  static std::string GetName(int i) {
7100  return StreamableToString(i);
7101  }
7102 };
7103 
7104 template <typename Provided = DefaultNameGenerator>
7105 struct NameGeneratorSelector {
7106  typedef Provided type;
7107 };
7108 
7109 template <typename NameGenerator>
7110 void GenerateNamesRecursively(Types0, std::vector<std::string>*, int) {}
7111 
7112 template <typename NameGenerator, typename Types>
7113 void GenerateNamesRecursively(Types, std::vector<std::string>* result, int i) {
7114  result->push_back(NameGenerator::template GetName<typename Types::Head>(i));
7115  GenerateNamesRecursively<NameGenerator>(typename Types::Tail(), result,
7116  i + 1);
7117 }
7118 
7119 template <typename NameGenerator, typename Types>
7120 std::vector<std::string> GenerateNames() {
7121  std::vector<std::string> result;
7122  GenerateNamesRecursively<NameGenerator>(Types(), &result, 0);
7123  return result;
7124 }
7125 
7126 // TypeParameterizedTest<Fixture, TestSel, Types>::Register()
7127 // registers a list of type-parameterized tests with Google Test. The
7128 // return value is insignificant - we just need to return something
7129 // such that we can call this function in a namespace scope.
7130 //
7131 // Implementation note: The GTEST_TEMPLATE_ macro declares a template
7132 // template parameter. It's defined in gtest-type-util.h.
7133 template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
7134 class TypeParameterizedTest {
7135  public:
7136  // 'index' is the index of the test in the type list 'Types'
7137  // specified in INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, TestSuite,
7138  // Types). Valid values for 'index' are [0, N - 1] where N is the
7139  // length of Types.
7140  static bool Register(const char* prefix, const CodeLocation& code_location,
7141  const char* case_name, const char* test_names, int index,
7142  const std::vector<std::string>& type_names =
7143  GenerateNames<DefaultNameGenerator, Types>()) {
7144  typedef typename Types::Head Type;
7145  typedef Fixture<Type> FixtureClass;
7146  typedef typename GTEST_BIND_(TestSel, Type) TestClass;
7147 
7148  // First, registers the first type-parameterized test in the type
7149  // list.
7151  (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name +
7152  "/" + type_names[index])
7153  .c_str(),
7154  StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(),
7155  GetTypeName<Type>().c_str(),
7156  nullptr, // No value parameter.
7157  code_location, GetTypeId<FixtureClass>(),
7160  new TestFactoryImpl<TestClass>);
7161 
7162  // Next, recurses (at compile time) with the tail of the type list.
7163  return TypeParameterizedTest<Fixture, TestSel,
7164  typename Types::Tail>::Register(prefix,
7165  code_location,
7166  case_name,
7167  test_names,
7168  index + 1,
7169  type_names);
7170  }
7171 };
7172 
7173 // The base case for the compile time recursion.
7174 template <GTEST_TEMPLATE_ Fixture, class TestSel>
7175 class TypeParameterizedTest<Fixture, TestSel, Types0> {
7176  public:
7177  static bool Register(const char* /*prefix*/, const CodeLocation&,
7178  const char* /*case_name*/, const char* /*test_names*/,
7179  int /*index*/,
7180  const std::vector<std::string>& =
7181  std::vector<std::string>() /*type_names*/) {
7182  return true;
7183  }
7184 };
7185 
7186 // TypeParameterizedTestSuite<Fixture, Tests, Types>::Register()
7187 // registers *all combinations* of 'Tests' and 'Types' with Google
7188 // Test. The return value is insignificant - we just need to return
7189 // something such that we can call this function in a namespace scope.
7190 template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
7191 class TypeParameterizedTestSuite {
7192  public:
7193  static bool Register(const char* prefix, CodeLocation code_location,
7194  const TypedTestSuitePState* state, const char* case_name,
7195  const char* test_names,
7196  const std::vector<std::string>& type_names =
7197  GenerateNames<DefaultNameGenerator, Types>()) {
7198  std::string test_name = StripTrailingSpaces(
7199  GetPrefixUntilComma(test_names));
7200  if (!state->TestExists(test_name)) {
7201  fprintf(stderr, "Failed to get code location for test %s.%s at %s.",
7202  case_name, test_name.c_str(),
7203  FormatFileLocation(code_location.file.c_str(),
7204  code_location.line).c_str());
7205  fflush(stderr);
7206  posix::Abort();
7207  }
7208  const CodeLocation& test_location = state->GetCodeLocation(test_name);
7209 
7210  typedef typename Tests::Head Head;
7211 
7212  // First, register the first test in 'Test' for each type in 'Types'.
7213  TypeParameterizedTest<Fixture, Head, Types>::Register(
7214  prefix, test_location, case_name, test_names, 0, type_names);
7215 
7216  // Next, recurses (at compile time) with the tail of the test list.
7217  return TypeParameterizedTestSuite<Fixture, typename Tests::Tail,
7218  Types>::Register(prefix, code_location,
7219  state, case_name,
7220  SkipComma(test_names),
7221  type_names);
7222  }
7223 };
7224 
7225 // The base case for the compile time recursion.
7226 template <GTEST_TEMPLATE_ Fixture, typename Types>
7227 class TypeParameterizedTestSuite<Fixture, Templates0, Types> {
7228  public:
7229  static bool Register(const char* /*prefix*/, const CodeLocation&,
7230  const TypedTestSuitePState* /*state*/,
7231  const char* /*case_name*/, const char* /*test_names*/,
7232  const std::vector<std::string>& =
7233  std::vector<std::string>() /*type_names*/) {
7234  return true;
7235  }
7236 };
7237 
7238 #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
7239 
7240 // Returns the current OS stack trace as an std::string.
7241 //
7242 // The maximum number of stack frames to be included is specified by
7243 // the gtest_stack_trace_depth flag. The skip_count parameter
7244 // specifies the number of top frames to be skipped, which doesn't
7245 // count against the number of frames to be included.
7246 //
7247 // For example, if Foo() calls Bar(), which in turn calls
7248 // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
7249 // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
7251  UnitTest* unit_test, int skip_count);
7252 
7253 // Helpers for suppressing warnings on unreachable code or constant
7254 // condition.
7255 
7256 // Always returns true.
7257 GTEST_API_ bool AlwaysTrue();
7258 
7259 // Always returns false.
7260 inline bool AlwaysFalse() { return !AlwaysTrue(); }
7261 
7262 // Helper for suppressing false warning from Clang on a const char*
7263 // variable declared in a conditional expression always being NULL in
7264 // the else branch.
7266  ConstCharPtr(const char* str) : value(str) {}
7267  operator bool() const { return true; }
7268  const char* value;
7269 };
7270 
7271 // A simple Linear Congruential Generator for generating random
7272 // numbers with a uniform distribution. Unlike rand() and srand(), it
7273 // doesn't use global state (and therefore can't interfere with user
7274 // code). Unlike rand_r(), it's portable. An LCG isn't very random,
7275 // but it's good enough for our purposes.
7277  public:
7278  static const UInt32 kMaxRange = 1u << 31;
7279 
7280  explicit Random(UInt32 seed) : state_(seed) {}
7281 
7282  void Reseed(UInt32 seed) { state_ = seed; }
7283 
7284  // Generates a random number from [0, range). Crashes if 'range' is
7285  // 0 or greater than kMaxRange.
7286  UInt32 Generate(UInt32 range);
7287 
7288  private:
7289  UInt32 state_;
7291 };
7292 
7293 // Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a
7294 // compiler error iff T1 and T2 are different types.
7295 template <typename T1, typename T2>
7297 
7298 template <typename T>
7300 };
7301 
7302 // Removes the reference from a type if it is a reference type,
7303 // otherwise leaves it unchanged. This is the same as
7304 // tr1::remove_reference, which is not widely available yet.
7305 template <typename T>
7306 struct RemoveReference { typedef T type; }; // NOLINT
7307 template <typename T>
7308 struct RemoveReference<T&> { typedef T type; }; // NOLINT
7309 
7310 // A handy wrapper around RemoveReference that works when the argument
7311 // T depends on template parameters.
7312 #define GTEST_REMOVE_REFERENCE_(T) \
7313  typename ::testing::internal::RemoveReference<T>::type
7314 
7315 // Removes const from a type if it is a const type, otherwise leaves
7316 // it unchanged. This is the same as tr1::remove_const, which is not
7317 // widely available yet.
7318 template <typename T>
7319 struct RemoveConst { typedef T type; }; // NOLINT
7320 template <typename T>
7321 struct RemoveConst<const T> { typedef T type; }; // NOLINT
7322 
7323 // MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above
7324 // definition to fail to remove the const in 'const int[3]' and 'const
7325 // char[3][4]'. The following specialization works around the bug.
7326 template <typename T, size_t N>
7327 struct RemoveConst<const T[N]> {
7328  typedef typename RemoveConst<T>::type type[N];
7329 };
7330 
7331 // A handy wrapper around RemoveConst that works when the argument
7332 // T depends on template parameters.
7333 #define GTEST_REMOVE_CONST_(T) \
7334  typename ::testing::internal::RemoveConst<T>::type
7335 
7336 // Turns const U&, U&, const U, and U all into U.
7337 #define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
7338  GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))
7339 
7340 // ImplicitlyConvertible<From, To>::value is a compile-time bool
7341 // constant that's true iff type From can be implicitly converted to
7342 // type To.
7343 template <typename From, typename To>
7345  private:
7346  // We need the following helper functions only for their types.
7347  // They have no implementations.
7348 
7349  // MakeFrom() is an expression whose type is From. We cannot simply
7350  // use From(), as the type From may not have a public default
7351  // constructor.
7352  static typename AddReference<From>::type MakeFrom();
7353 
7354  // These two functions are overloaded. Given an expression
7355  // Helper(x), the compiler will pick the first version if x can be
7356  // implicitly converted to type To; otherwise it will pick the
7357  // second version.
7358  //
7359  // The first version returns a value of size 1, and the second
7360  // version returns a value of size 2. Therefore, by checking the
7361  // size of Helper(x), which can be done at compile time, we can tell
7362  // which version of Helper() is used, and hence whether x can be
7363  // implicitly converted to type To.
7364  static char Helper(To);
7365  static char (&Helper(...))[2]; // NOLINT
7366 
7367  // We have to put the 'public' section after the 'private' section,
7368  // or MSVC refuses to compile the code.
7369  public:
7370 #if defined(__BORLANDC__)
7371  // C++Builder cannot use member overload resolution during template
7372  // instantiation. The simplest workaround is to use its C++0x type traits
7373  // functions (C++Builder 2009 and above only).
7374  static const bool value = __is_convertible(From, To);
7375 #else
7376  // MSVC warns about implicitly converting from double to int for
7377  // possible loss of data, so we need to temporarily disable the
7378  // warning.
7380  static const bool value =
7381  sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
7383 #endif // __BORLANDC__
7384 };
7385 template <typename From, typename To>
7387 
7388 // IsAProtocolMessage<T>::value is a compile-time bool constant that's
7389 // true iff T is type ProtocolMessage, proto2::Message, or a subclass
7390 // of those.
7391 template <typename T>
7393  : public bool_constant<
7394  ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value ||
7395  ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> {
7396 };
7397 
7398 // When the compiler sees expression IsContainerTest<C>(0), if C is an
7399 // STL-style container class, the first overload of IsContainerTest
7400 // will be viable (since both C::iterator* and C::const_iterator* are
7401 // valid types and NULL can be implicitly converted to them). It will
7402 // be picked over the second overload as 'int' is a perfect match for
7403 // the type of argument 0. If C::iterator or C::const_iterator is not
7404 // a valid type, the first overload is not viable, and the second
7405 // overload will be picked. Therefore, we can determine whether C is
7406 // a container class by checking the type of IsContainerTest<C>(0).
7407 // The value of the expression is insignificant.
7408 //
7409 // In C++11 mode we check the existence of a const_iterator and that an
7410 // iterator is properly implemented for the container.
7411 //
7412 // For pre-C++11 that we look for both C::iterator and C::const_iterator.
7413 // The reason is that C++ injects the name of a class as a member of the
7414 // class itself (e.g. you can refer to class iterator as either
7415 // 'iterator' or 'iterator::iterator'). If we look for C::iterator
7416 // only, for example, we would mistakenly think that a class named
7417 // iterator is an STL container.
7418 //
7419 // Also note that the simpler approach of overloading
7420 // IsContainerTest(typename C::const_iterator*) and
7421 // IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
7422 typedef int IsContainer;
7423 template <class C,
7424  class Iterator = decltype(::std::declval<const C&>().begin()),
7425  class = decltype(::std::declval<const C&>().end()),
7426  class = decltype(++::std::declval<Iterator&>()),
7427  class = decltype(*::std::declval<Iterator>()),
7428  class = typename C::const_iterator>
7429 IsContainer IsContainerTest(int /* dummy */) {
7430  return 0;
7431 }
7432 
7433 typedef char IsNotContainer;
7434 template <class C>
7435 IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
7436 
7437 // Trait to detect whether a type T is a hash table.
7438 // The heuristic used is that the type contains an inner type `hasher` and does
7439 // not contain an inner type `reverse_iterator`.
7440 // If the container is iterable in reverse, then order might actually matter.
7441 template <typename T>
7442 struct IsHashTable {
7443  private:
7444  template <typename U>
7445  static char test(typename U::hasher*, typename U::reverse_iterator*);
7446  template <typename U>
7447  static int test(typename U::hasher*, ...);
7448  template <typename U>
7449  static char test(...);
7450 
7451  public:
7452  static const bool value = sizeof(test<T>(nullptr, nullptr)) == sizeof(int);
7453 };
7454 
7455 template <typename T>
7456 const bool IsHashTable<T>::value;
7457 
7458 template <typename C,
7459  bool = sizeof(IsContainerTest<C>(0)) == sizeof(IsContainer)>
7461 
7462 template <typename C>
7464 
7465 // Since the IsRecursiveContainerImpl depends on the IsContainerTest we need to
7466 // obey the same inconsistencies as the IsContainerTest, namely check if
7467 // something is a container is relying on only const_iterator in C++11 and
7468 // is relying on both const_iterator and iterator otherwise
7469 template <typename C>
7471  using value_type = decltype(*std::declval<typename C::const_iterator>());
7472  using type =
7473  is_same<typename std::remove_const<
7474  typename std::remove_reference<value_type>::type>::type,
7475  C>;
7476 };
7477 
7478 // IsRecursiveContainer<Type> is a unary compile-time predicate that
7479 // evaluates whether C is a recursive container type. A recursive container
7480 // type is a container type whose value_type is equal to the container type
7481 // itself. An example for a recursive container type is
7482 // boost::filesystem::path, whose iterator has a value_type that is equal to
7483 // boost::filesystem::path.
7484 template <typename C>
7486 
7487 // EnableIf<condition>::type is void when 'Cond' is true, and
7488 // undefined when 'Cond' is false. To use SFINAE to make a function
7489 // overload only apply when a particular expression is true, add
7490 // "typename EnableIf<expression>::type* = 0" as the last parameter.
7491 template<bool> struct EnableIf;
7492 template<> struct EnableIf<true> { typedef void type; }; // NOLINT
7493 
7494 // Utilities for native arrays.
7495 
7496 // ArrayEq() compares two k-dimensional native arrays using the
7497 // elements' operator==, where k can be any integer >= 0. When k is
7498 // 0, ArrayEq() degenerates into comparing a single pair of values.
7499 
7500 template <typename T, typename U>
7501 bool ArrayEq(const T* lhs, size_t size, const U* rhs);
7502 
7503 // This generic version is used when k is 0.
7504 template <typename T, typename U>
7505 inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
7506 
7507 // This overload is used when k >= 1.
7508 template <typename T, typename U, size_t N>
7509 inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
7510  return internal::ArrayEq(lhs, N, rhs);
7511 }
7512 
7513 // This helper reduces code bloat. If we instead put its logic inside
7514 // the previous ArrayEq() function, arrays with different sizes would
7515 // lead to different copies of the template code.
7516 template <typename T, typename U>
7517 bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
7518  for (size_t i = 0; i != size; i++) {
7519  if (!internal::ArrayEq(lhs[i], rhs[i]))
7520  return false;
7521  }
7522  return true;
7523 }
7524 
7525 // Finds the first element in the iterator range [begin, end) that
7526 // equals elem. Element may be a native array type itself.
7527 template <typename Iter, typename Element>
7528 Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
7529  for (Iter it = begin; it != end; ++it) {
7530  if (internal::ArrayEq(*it, elem))
7531  return it;
7532  }
7533  return end;
7534 }
7535 
7536 // CopyArray() copies a k-dimensional native array using the elements'
7537 // operator=, where k can be any integer >= 0. When k is 0,
7538 // CopyArray() degenerates into copying a single value.
7539 
7540 template <typename T, typename U>
7541 void CopyArray(const T* from, size_t size, U* to);
7542 
7543 // This generic version is used when k is 0.
7544 template <typename T, typename U>
7545 inline void CopyArray(const T& from, U* to) { *to = from; }
7546 
7547 // This overload is used when k >= 1.
7548 template <typename T, typename U, size_t N>
7549 inline void CopyArray(const T(&from)[N], U(*to)[N]) {
7550  internal::CopyArray(from, N, *to);
7551 }
7552 
7553 // This helper reduces code bloat. If we instead put its logic inside
7554 // the previous CopyArray() function, arrays with different sizes
7555 // would lead to different copies of the template code.
7556 template <typename T, typename U>
7557 void CopyArray(const T* from, size_t size, U* to) {
7558  for (size_t i = 0; i != size; i++) {
7559  internal::CopyArray(from[i], to + i);
7560  }
7561 }
7562 
7563 // The relation between an NativeArray object (see below) and the
7564 // native array it represents.
7565 // We use 2 different structs to allow non-copyable types to be used, as long
7566 // as RelationToSourceReference() is passed.
7569 
7570 // Adapts a native array to a read-only STL-style container. Instead
7571 // of the complete STL container concept, this adaptor only implements
7572 // members useful for Google Mock's container matchers. New members
7573 // should be added as needed. To simplify the implementation, we only
7574 // support Element being a raw type (i.e. having no top-level const or
7575 // reference modifier). It's the client's responsibility to satisfy
7576 // this requirement. Element can be an array type itself (hence
7577 // multi-dimensional arrays are supported).
7578 template <typename Element>
7580  public:
7581  // STL-style container typedefs.
7582  typedef Element value_type;
7583  typedef Element* iterator;
7584  typedef const Element* const_iterator;
7585 
7586  // Constructs from a native array. References the source.
7587  NativeArray(const Element* array, size_t count, RelationToSourceReference) {
7588  InitRef(array, count);
7589  }
7590 
7591  // Constructs from a native array. Copies the source.
7592  NativeArray(const Element* array, size_t count, RelationToSourceCopy) {
7593  InitCopy(array, count);
7594  }
7595 
7596  // Copy constructor.
7597  NativeArray(const NativeArray& rhs) {
7598  (this->*rhs.clone_)(rhs.array_, rhs.size_);
7599  }
7600 
7602  if (clone_ != &NativeArray::InitRef)
7603  delete[] array_;
7604  }
7605 
7606  // STL-style container methods.
7607  size_t size() const { return size_; }
7608  const_iterator begin() const { return array_; }
7609  const_iterator end() const { return array_ + size_; }
7610  bool operator==(const NativeArray& rhs) const {
7611  return size() == rhs.size() &&
7612  ArrayEq(begin(), size(), rhs.begin());
7613  }
7614 
7615  private:
7616  enum {
7617  kCheckTypeIsNotConstOrAReference = StaticAssertTypeEqHelper<
7618  Element, GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>::value
7619  };
7620 
7621  // Initializes this object with a copy of the input.
7622  void InitCopy(const Element* array, size_t a_size) {
7623  Element* const copy = new Element[a_size];
7624  CopyArray(array, a_size, copy);
7625  array_ = copy;
7626  size_ = a_size;
7627  clone_ = &NativeArray::InitCopy;
7628  }
7629 
7630  // Initializes this object with a reference of the input.
7631  void InitRef(const Element* array, size_t a_size) {
7632  array_ = array;
7633  size_ = a_size;
7634  clone_ = &NativeArray::InitRef;
7635  }
7636 
7637  const Element* array_;
7638  size_t size_;
7639  void (NativeArray::*clone_)(const Element*, size_t);
7640 
7641  GTEST_DISALLOW_ASSIGN_(NativeArray);
7642 };
7643 
7644 // Backport of std::index_sequence.
7645 template <size_t... Is>
7648 };
7649 
7650 // Double the IndexSequence, and one if plus_one is true.
7651 template <bool plus_one, typename T, size_t sizeofT>
7653 template <size_t... I, size_t sizeofT>
7654 struct DoubleSequence<true, IndexSequence<I...>, sizeofT> {
7655  using type = IndexSequence<I..., (sizeofT + I)..., 2 * sizeofT>;
7656 };
7657 template <size_t... I, size_t sizeofT>
7658 struct DoubleSequence<false, IndexSequence<I...>, sizeofT> {
7659  using type = IndexSequence<I..., (sizeofT + I)...>;
7660 };
7661 
7662 // Backport of std::make_index_sequence.
7663 // It uses O(ln(N)) instantiation depth.
7664 template <size_t N>
7666  : DoubleSequence<N % 2 == 1, typename MakeIndexSequence<N / 2>::type,
7667  N / 2>::type {};
7668 
7669 template <>
7671 
7672 // FIXME: This implementation of ElemFromList is O(1) in instantiation depth,
7673 // but it is O(N^2) in total instantiations. Not sure if this is the best
7674 // tradeoff, as it will make it somewhat slow to compile.
7675 template <typename T, size_t, size_t>
7677 
7678 template <typename T, size_t I>
7679 struct ElemFromListImpl<T, I, I> {
7680  using type = T;
7681 };
7682 
7683 // Get the Nth element from T...
7684 // It uses O(1) instantiation depth.
7685 template <size_t N, typename I, typename... T>
7687 
7688 template <size_t N, size_t... I, typename... T>
7689 struct ElemFromList<N, IndexSequence<I...>, T...>
7690  : ElemFromListImpl<T, N, I>... {};
7691 
7692 template <typename... T>
7694 
7695 template <typename Derived, size_t I>
7697 
7698 template <typename... T, size_t I>
7699 struct FlatTupleElemBase<FlatTuple<T...>, I> {
7700  using value_type =
7701  typename ElemFromList<I, typename MakeIndexSequence<sizeof...(T)>::type,
7702  T...>::type;
7703  FlatTupleElemBase() = default;
7704  explicit FlatTupleElemBase(value_type t) : value(std::move(t)) {}
7706 };
7707 
7708 template <typename Derived, typename Idx>
7710 
7711 template <size_t... Idx, typename... T>
7712 struct FlatTupleBase<FlatTuple<T...>, IndexSequence<Idx...>>
7713  : FlatTupleElemBase<FlatTuple<T...>, Idx>... {
7714  using Indices = IndexSequence<Idx...>;
7715  FlatTupleBase() = default;
7716  explicit FlatTupleBase(T... t)
7717  : FlatTupleElemBase<FlatTuple<T...>, Idx>(std::move(t))... {}
7718 };
7719 
7720 // Analog to std::tuple but with different tradeoffs.
7721 // This class minimizes the template instantiation depth, thus allowing more
7722 // elements that std::tuple would. std::tuple has been seen to require an
7723 // instantiation depth of more than 10x the number of elements in some
7724 // implementations.
7725 // FlatTuple and ElemFromList are not recursive and have a fixed depth
7726 // regardless of T...
7727 // MakeIndexSequence, on the other hand, it is recursive but with an
7728 // instantiation depth of O(ln(N)).
7729 template <typename... T>
7730 class FlatTuple
7731  : private FlatTupleBase<FlatTuple<T...>,
7732  typename MakeIndexSequence<sizeof...(T)>::type> {
7733  using Indices = typename FlatTuple::FlatTupleBase::Indices;
7734 
7735  public:
7736  FlatTuple() = default;
7737  explicit FlatTuple(T... t) : FlatTuple::FlatTupleBase(std::move(t)...) {}
7738 
7739  template <size_t I>
7740  const typename ElemFromList<I, Indices, T...>::type& Get() const {
7741  return static_cast<const FlatTupleElemBase<FlatTuple, I>*>(this)->value;
7742  }
7743 
7744  template <size_t I>
7745  typename ElemFromList<I, Indices, T...>::type& Get() {
7746  return static_cast<FlatTupleElemBase<FlatTuple, I>*>(this)->value;
7747  }
7748 };
7749 
7750 } // namespace internal
7751 } // namespace testing
7752 
7753 #define GTEST_MESSAGE_AT_(file, line, message, result_type) \
7754  ::testing::internal::AssertHelper(result_type, file, line, message) \
7755  = ::testing::Message()
7756 
7757 #define GTEST_MESSAGE_(message, result_type) \
7758  GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
7759 
7760 #define GTEST_FATAL_FAILURE_(message) \
7761  return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
7762 
7763 #define GTEST_NONFATAL_FAILURE_(message) \
7764  GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
7765 
7766 #define GTEST_SUCCESS_(message) \
7767  GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
7768 
7769 #define GTEST_SKIP_(message) \
7770  return GTEST_MESSAGE_(message, ::testing::TestPartResult::kSkip)
7771 
7772 // Suppress MSVC warning 4072 (unreachable code) for the code following
7773 // statement if it returns or throws (or doesn't return or throw in some
7774 // situations).
7775 #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
7776  if (::testing::internal::AlwaysTrue()) { statement; }
7777 
7778 #define GTEST_TEST_THROW_(statement, expected_exception, fail) \
7779  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7780  if (::testing::internal::ConstCharPtr gtest_msg = "") { \
7781  bool gtest_caught_expected = false; \
7782  try { \
7783  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
7784  } \
7785  catch (expected_exception const&) { \
7786  gtest_caught_expected = true; \
7787  } \
7788  catch (...) { \
7789  gtest_msg.value = \
7790  "Expected: " #statement " throws an exception of type " \
7791  #expected_exception ".\n Actual: it throws a different type."; \
7792  goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
7793  } \
7794  if (!gtest_caught_expected) { \
7795  gtest_msg.value = \
7796  "Expected: " #statement " throws an exception of type " \
7797  #expected_exception ".\n Actual: it throws nothing."; \
7798  goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
7799  } \
7800  } else \
7801  GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
7802  fail(gtest_msg.value)
7803 
7804 #define GTEST_TEST_NO_THROW_(statement, fail) \
7805  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7806  if (::testing::internal::AlwaysTrue()) { \
7807  try { \
7808  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
7809  } \
7810  catch (...) { \
7811  goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
7812  } \
7813  } else \
7814  GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
7815  fail("Expected: " #statement " doesn't throw an exception.\n" \
7816  " Actual: it throws.")
7817 
7818 #define GTEST_TEST_ANY_THROW_(statement, fail) \
7819  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7820  if (::testing::internal::AlwaysTrue()) { \
7821  bool gtest_caught_any = false; \
7822  try { \
7823  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
7824  } \
7825  catch (...) { \
7826  gtest_caught_any = true; \
7827  } \
7828  if (!gtest_caught_any) { \
7829  goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
7830  } \
7831  } else \
7832  GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
7833  fail("Expected: " #statement " throws an exception.\n" \
7834  " Actual: it doesn't.")
7835 
7836 
7837 // Implements Boolean test assertions such as EXPECT_TRUE. expression can be
7838 // either a boolean expression or an AssertionResult. text is a textual
7839 // represenation of expression as it was passed into the EXPECT_TRUE.
7840 #define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
7841  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7842  if (const ::testing::AssertionResult gtest_ar_ = \
7843  ::testing::AssertionResult(expression)) \
7844  ; \
7845  else \
7846  fail(::testing::internal::GetBoolAssertionFailureMessage(\
7847  gtest_ar_, text, #actual, #expected).c_str())
7848 
7849 #define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
7850  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7851  if (::testing::internal::AlwaysTrue()) { \
7852  ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
7853  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
7854  if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
7855  goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
7856  } \
7857  } else \
7858  GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
7859  fail("Expected: " #statement " doesn't generate new fatal " \
7860  "failures in the current thread.\n" \
7861  " Actual: it does.")
7862 
7863 // Expands to the name of the class that implements the given test.
7864 #define GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
7865  test_suite_name##_##test_name##_Test
7866 
7867 // Helper macro for defining tests.
7868 #define GTEST_TEST_(test_suite_name, test_name, parent_class, parent_id) \
7869  class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
7870  : public parent_class { \
7871  public: \
7872  GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
7873  \
7874  private: \
7875  virtual void TestBody(); \
7876  static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_; \
7877  GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
7878  test_name)); \
7879  }; \
7880  \
7881  ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_suite_name, \
7882  test_name)::test_info_ = \
7883  ::testing::internal::MakeAndRegisterTestInfo( \
7884  #test_suite_name, #test_name, nullptr, nullptr, \
7885  ::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \
7886  ::testing::internal::SuiteApiResolver< \
7887  parent_class>::GetSetUpCaseOrSuite(), \
7888  ::testing::internal::SuiteApiResolver< \
7889  parent_class>::GetTearDownCaseOrSuite(), \
7890  new ::testing::internal::TestFactoryImpl<GTEST_TEST_CLASS_NAME_( \
7891  test_suite_name, test_name)>); \
7892  void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
7893 
7894 // Internal Macro to mark an API deprecated, for googletest usage only
7895 // Usage: class GTEST_INTERNAL_DEPRECATED(message) MyClass or
7896 // GTEST_INTERNAL_DEPRECATED(message) <return_type> myFunction(); Every usage of
7897 // a deprecated entity will trigger a warning when compiled with
7898 // `-Wdeprecated-declarations` option (clang, gcc, any __GNUC__ compiler).
7899 // For msvc /W3 option will need to be used
7900 // Note that for 'other' compilers this macro evaluates to nothing to prevent
7901 // compilations errors.
7902 #if defined(_MSC_VER)
7903 #define GTEST_INTERNAL_DEPRECATED(message) __declspec(deprecated(message))
7904 #elif defined(__GNUC__)
7905 #define GTEST_INTERNAL_DEPRECATED(message) __attribute__((deprecated(message)))
7906 #else
7907 #define GTEST_INTERNAL_DEPRECATED(message)
7908 #endif
7909 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
7910 // Copyright 2005, Google Inc.
7911 // All rights reserved.
7912 //
7913 // Redistribution and use in source and binary forms, with or without
7914 // modification, are permitted provided that the following conditions are
7915 // met:
7916 //
7917 // * Redistributions of source code must retain the above copyright
7918 // notice, this list of conditions and the following disclaimer.
7919 // * Redistributions in binary form must reproduce the above
7920 // copyright notice, this list of conditions and the following disclaimer
7921 // in the documentation and/or other materials provided with the
7922 // distribution.
7923 // * Neither the name of Google Inc. nor the names of its
7924 // contributors may be used to endorse or promote products derived from
7925 // this software without specific prior written permission.
7926 //
7927 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7928 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7929 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7930 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7931 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
7932 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
7933 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
7934 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
7935 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7936 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
7937 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7938 
7939 //
7940 // The Google C++ Testing and Mocking Framework (Google Test)
7941 //
7942 // This header file defines the public API for death tests. It is
7943 // #included by gtest.h so a user doesn't need to include this
7944 // directly.
7945 // GOOGLETEST_CM0001 DO NOT DELETE
7946 
7947 #ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
7948 #define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
7949 
7950 // Copyright 2005, Google Inc.
7951 // All rights reserved.
7952 //
7953 // Redistribution and use in source and binary forms, with or without
7954 // modification, are permitted provided that the following conditions are
7955 // met:
7956 //
7957 // * Redistributions of source code must retain the above copyright
7958 // notice, this list of conditions and the following disclaimer.
7959 // * Redistributions in binary form must reproduce the above
7960 // copyright notice, this list of conditions and the following disclaimer
7961 // in the documentation and/or other materials provided with the
7962 // distribution.
7963 // * Neither the name of Google Inc. nor the names of its
7964 // contributors may be used to endorse or promote products derived from
7965 // this software without specific prior written permission.
7966 //
7967 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7968 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7969 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7970 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7971 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
7972 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
7973 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
7974 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
7975 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7976 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
7977 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7978 //
7979 // The Google C++ Testing and Mocking Framework (Google Test)
7980 //
7981 // This header file defines internal utilities needed for implementing
7982 // death tests. They are subject to change without notice.
7983 // GOOGLETEST_CM0001 DO NOT DELETE
7984 
7985 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
7986 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
7987 
7988 // Copyright 2007, Google Inc.
7989 // All rights reserved.
7990 //
7991 // Redistribution and use in source and binary forms, with or without
7992 // modification, are permitted provided that the following conditions are
7993 // met:
7994 //
7995 // * Redistributions of source code must retain the above copyright
7996 // notice, this list of conditions and the following disclaimer.
7997 // * Redistributions in binary form must reproduce the above
7998 // copyright notice, this list of conditions and the following disclaimer
7999 // in the documentation and/or other materials provided with the
8000 // distribution.
8001 // * Neither the name of Google Inc. nor the names of its
8002 // contributors may be used to endorse or promote products derived from
8003 // this software without specific prior written permission.
8004 //
8005 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8006 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8007 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8008 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8009 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8010 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8011 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8012 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8013 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8014 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
8015 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8016 
8017 // The Google C++ Testing and Mocking Framework (Google Test)
8018 //
8019 // This file implements just enough of the matcher interface to allow
8020 // EXPECT_DEATH and friends to accept a matcher argument.
8021 
8022 // IWYU pragma: private, include "testing/base/public/gunit.h"
8023 // IWYU pragma: friend third_party/googletest/googlemock/.*
8024 // IWYU pragma: friend third_party/googletest/googletest/.*
8025 
8026 #ifndef GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
8027 #define GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
8028 
8029 #include <memory>
8030 #include <ostream>
8031 #include <string>
8032 
8033 // Copyright 2007, Google Inc.
8034 // All rights reserved.
8035 //
8036 // Redistribution and use in source and binary forms, with or without
8037 // modification, are permitted provided that the following conditions are
8038 // met:
8039 //
8040 // * Redistributions of source code must retain the above copyright
8041 // notice, this list of conditions and the following disclaimer.
8042 // * Redistributions in binary form must reproduce the above
8043 // copyright notice, this list of conditions and the following disclaimer
8044 // in the documentation and/or other materials provided with the
8045 // distribution.
8046 // * Neither the name of Google Inc. nor the names of its
8047 // contributors may be used to endorse or promote products derived from
8048 // this software without specific prior written permission.
8049 //
8050 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8051 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8052 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8053 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8054 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8055 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8056 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8057 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8058 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8059 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
8060 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8061 
8062 
8063 // Google Test - The Google C++ Testing and Mocking Framework
8064 //
8065 // This file implements a universal value printer that can print a
8066 // value of any type T:
8067 //
8068 // void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
8069 //
8070 // A user can teach this function how to print a class type T by
8071 // defining either operator<<() or PrintTo() in the namespace that
8072 // defines T. More specifically, the FIRST defined function in the
8073 // following list will be used (assuming T is defined in namespace
8074 // foo):
8075 //
8076 // 1. foo::PrintTo(const T&, ostream*)
8077 // 2. operator<<(ostream&, const T&) defined in either foo or the
8078 // global namespace.
8079 //
8080 // However if T is an STL-style container then it is printed element-wise
8081 // unless foo::PrintTo(const T&, ostream*) is defined. Note that
8082 // operator<<() is ignored for container types.
8083 //
8084 // If none of the above is defined, it will print the debug string of
8085 // the value if it is a protocol buffer, or print the raw bytes in the
8086 // value otherwise.
8087 //
8088 // To aid debugging: when T is a reference type, the address of the
8089 // value is also printed; when T is a (const) char pointer, both the
8090 // pointer value and the NUL-terminated string it points to are
8091 // printed.
8092 //
8093 // We also provide some convenient wrappers:
8094 //
8095 // // Prints a value to a string. For a (const or not) char
8096 // // pointer, the NUL-terminated string (but not the pointer) is
8097 // // printed.
8098 // std::string ::testing::PrintToString(const T& value);
8099 //
8100 // // Prints a value tersely: for a reference type, the referenced
8101 // // value (but not the address) is printed; for a (const or not) char
8102 // // pointer, the NUL-terminated string (but not the pointer) is
8103 // // printed.
8104 // void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
8105 //
8106 // // Prints value using the type inferred by the compiler. The difference
8107 // // from UniversalTersePrint() is that this function prints both the
8108 // // pointer and the NUL-terminated string for a (const or not) char pointer.
8109 // void ::testing::internal::UniversalPrint(const T& value, ostream*);
8110 //
8111 // // Prints the fields of a tuple tersely to a string vector, one
8112 // // element for each field. Tuple support must be enabled in
8113 // // gtest-port.h.
8114 // std::vector<string> UniversalTersePrintTupleFieldsToStrings(
8115 // const Tuple& value);
8116 //
8117 // Known limitation:
8118 //
8119 // The print primitives print the elements of an STL-style container
8120 // using the compiler-inferred type of *iter where iter is a
8121 // const_iterator of the container. When const_iterator is an input
8122 // iterator but not a forward iterator, this inferred type may not
8123 // match value_type, and the print output may be incorrect. In
8124 // practice, this is rarely a problem as for most containers
8125 // const_iterator is a forward iterator. We'll fix this if there's an
8126 // actual need for it. Note that this fix cannot rely on value_type
8127 // being defined as many user-defined container types don't have
8128 // value_type.
8129 
8130 // GOOGLETEST_CM0001 DO NOT DELETE
8131 
8132 #ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
8133 #define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
8134 
8135 #include <functional>
8136 #include <ostream> // NOLINT
8137 #include <sstream>
8138 #include <string>
8139 #include <tuple>
8140 #include <type_traits>
8141 #include <utility>
8142 #include <vector>
8143 
8144 #if GTEST_HAS_ABSL
8145 #include "absl/strings/string_view.h"
8146 #include "absl/types/optional.h"
8147 #include "absl/types/variant.h"
8148 #endif // GTEST_HAS_ABSL
8149 
8150 namespace testing {
8151 
8152 // Definitions in the 'internal' and 'internal2' name spaces are
8153 // subject to change without notice. DO NOT USE THEM IN USER CODE!
8154 namespace internal2 {
8155 
8156 // Prints the given number of bytes in the given object to the given
8157 // ostream.
8158 GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
8159  size_t count,
8160  ::std::ostream* os);
8161 
8162 // For selecting which printer to use when a given type has neither <<
8163 // nor PrintTo().
8164 enum TypeKind {
8165  kProtobuf, // a protobuf type
8166  kConvertibleToInteger, // a type implicitly convertible to BiggestInt
8167  // (e.g. a named or unnamed enum type)
8168 #if GTEST_HAS_ABSL
8169  kConvertibleToStringView, // a type implicitly convertible to
8170  // absl::string_view
8171 #endif
8172  kOtherType // anything else
8173 };
8174 
8175 // TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called
8176 // by the universal printer to print a value of type T when neither
8177 // operator<< nor PrintTo() is defined for T, where kTypeKind is the
8178 // "kind" of T as defined by enum TypeKind.
8179 template <typename T, TypeKind kTypeKind>
8181  public:
8182  // This default version is called when kTypeKind is kOtherType.
8183  static void PrintValue(const T& value, ::std::ostream* os) {
8184  PrintBytesInObjectTo(static_cast<const unsigned char*>(
8185  reinterpret_cast<const void*>(&value)),
8186  sizeof(value), os);
8187  }
8188 };
8189 
8190 // We print a protobuf using its ShortDebugString() when the string
8191 // doesn't exceed this many characters; otherwise we print it using
8192 // DebugString() for better readability.
8193 const size_t kProtobufOneLinerMaxLength = 50;
8194 
8195 template <typename T>
8197  public:
8198  static void PrintValue(const T& value, ::std::ostream* os) {
8199  std::string pretty_str = value.ShortDebugString();
8200  if (pretty_str.length() > kProtobufOneLinerMaxLength) {
8201  pretty_str = "\n" + value.DebugString();
8202  }
8203  *os << ("<" + pretty_str + ">");
8204  }
8205 };
8206 
8207 template <typename T>
8209  public:
8210  // Since T has no << operator or PrintTo() but can be implicitly
8211  // converted to BiggestInt, we print it as a BiggestInt.
8212  //
8213  // Most likely T is an enum type (either named or unnamed), in which
8214  // case printing it as an integer is the desired behavior. In case
8215  // T is not an enum, printing it as an integer is the best we can do
8216  // given that it has no user-defined printer.
8217  static void PrintValue(const T& value, ::std::ostream* os) {
8218  const internal::BiggestInt kBigInt = value;
8219  *os << kBigInt;
8220  }
8221 };
8222 
8223 #if GTEST_HAS_ABSL
8224 template <typename T>
8225 class TypeWithoutFormatter<T, kConvertibleToStringView> {
8226  public:
8227  // Since T has neither operator<< nor PrintTo() but can be implicitly
8228  // converted to absl::string_view, we print it as a absl::string_view.
8229  //
8230  // Note: the implementation is further below, as it depends on
8231  // internal::PrintTo symbol which is defined later in the file.
8232  static void PrintValue(const T& value, ::std::ostream* os);
8233 };
8234 #endif
8235 
8236 // Prints the given value to the given ostream. If the value is a
8237 // protocol message, its debug string is printed; if it's an enum or
8238 // of a type implicitly convertible to BiggestInt, it's printed as an
8239 // integer; otherwise the bytes in the value are printed. This is
8240 // what UniversalPrinter<T>::Print() does when it knows nothing about
8241 // type T and T has neither << operator nor PrintTo().
8242 //
8243 // A user can override this behavior for a class type Foo by defining
8244 // a << operator in the namespace where Foo is defined.
8245 //
8246 // We put this operator in namespace 'internal2' instead of 'internal'
8247 // to simplify the implementation, as much code in 'internal' needs to
8248 // use << in STL, which would conflict with our own << were it defined
8249 // in 'internal'.
8250 //
8251 // Note that this operator<< takes a generic std::basic_ostream<Char,
8252 // CharTraits> type instead of the more restricted std::ostream. If
8253 // we define it to take an std::ostream instead, we'll get an
8254 // "ambiguous overloads" compiler error when trying to print a type
8255 // Foo that supports streaming to std::basic_ostream<Char,
8256 // CharTraits>, as the compiler cannot tell whether
8257 // operator<<(std::ostream&, const T&) or
8258 // operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more
8259 // specific.
8260 template <typename Char, typename CharTraits, typename T>
8261 ::std::basic_ostream<Char, CharTraits>& operator<<(
8262  ::std::basic_ostream<Char, CharTraits>& os, const T& x) {
8264  ? kProtobuf
8266  const T&, internal::BiggestInt>::value
8268  :
8269 #if GTEST_HAS_ABSL
8271  const T&, absl::string_view>::value
8272  ? kConvertibleToStringView
8273  :
8274 #endif
8275  kOtherType)>::PrintValue(x, &os);
8276  return os;
8277 }
8278 
8279 } // namespace internal2
8280 } // namespace testing
8281 
8282 // This namespace MUST NOT BE NESTED IN ::testing, or the name look-up
8283 // magic needed for implementing UniversalPrinter won't work.
8284 namespace testing_internal {
8285 
8286 // Used to print a value that is not an STL-style container when the
8287 // user doesn't define PrintTo() for it.
8288 template <typename T>
8289 void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
8290  // With the following statement, during unqualified name lookup,
8291  // testing::internal2::operator<< appears as if it was declared in
8292  // the nearest enclosing namespace that contains both
8293  // ::testing_internal and ::testing::internal2, i.e. the global
8294  // namespace. For more details, refer to the C++ Standard section
8295  // 7.3.4-1 [namespace.udir]. This allows us to fall back onto
8296  // testing::internal2::operator<< in case T doesn't come with a <<
8297  // operator.
8298  //
8299  // We cannot write 'using ::testing::internal2::operator<<;', which
8300  // gcc 3.3 fails to compile due to a compiler bug.
8301  using namespace ::testing::internal2; // NOLINT
8302 
8303  // Assuming T is defined in namespace foo, in the next statement,
8304  // the compiler will consider all of:
8305  //
8306  // 1. foo::operator<< (thanks to Koenig look-up),
8307  // 2. ::operator<< (as the current namespace is enclosed in ::),
8308  // 3. testing::internal2::operator<< (thanks to the using statement above).
8309  //
8310  // The operator<< whose type matches T best will be picked.
8311  //
8312  // We deliberately allow #2 to be a candidate, as sometimes it's
8313  // impossible to define #1 (e.g. when foo is ::std, defining
8314  // anything in it is undefined behavior unless you are a compiler
8315  // vendor.).
8316  *os << value;
8317 }
8318 
8319 } // namespace testing_internal
8320 
8321 namespace testing {
8322 namespace internal {
8323 
8324 // FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
8325 // value of type ToPrint that is an operand of a comparison assertion
8326 // (e.g. ASSERT_EQ). OtherOperand is the type of the other operand in
8327 // the comparison, and is used to help determine the best way to
8328 // format the value. In particular, when the value is a C string
8329 // (char pointer) and the other operand is an STL string object, we
8330 // want to format the C string as a string, since we know it is
8331 // compared by value with the string object. If the value is a char
8332 // pointer but the other operand is not an STL string object, we don't
8333 // know whether the pointer is supposed to point to a NUL-terminated
8334 // string, and thus want to print it as a pointer to be safe.
8335 //
8336 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
8337 
8338 // The default case.
8339 template <typename ToPrint, typename OtherOperand>
8341  public:
8342  static ::std::string Format(const ToPrint& value) {
8344  }
8345 };
8346 
8347 // Array.
8348 template <typename ToPrint, size_t N, typename OtherOperand>
8349 class FormatForComparison<ToPrint[N], OtherOperand> {
8350  public:
8351  static ::std::string Format(const ToPrint* value) {
8353  }
8354 };
8355 
8356 // By default, print C string as pointers to be safe, as we don't know
8357 // whether they actually point to a NUL-terminated string.
8358 
8359 #define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType) \
8360  template <typename OtherOperand> \
8361  class FormatForComparison<CharType*, OtherOperand> { \
8362  public: \
8363  static ::std::string Format(CharType* value) { \
8364  return ::testing::PrintToString(static_cast<const void*>(value)); \
8365  } \
8366  }
8367 
8372 
8373 #undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
8374 
8375 // If a C string is compared with an STL string object, we know it's meant
8376 // to point to a NUL-terminated string, and thus can print it as a string.
8377 
8378 #define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
8379  template <> \
8380  class FormatForComparison<CharType*, OtherStringType> { \
8381  public: \
8382  static ::std::string Format(CharType* value) { \
8383  return ::testing::PrintToString(value); \
8384  } \
8385  }
8386 
8389 
8390 #if GTEST_HAS_GLOBAL_STRING
8392 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);
8393 #endif
8394 
8395 #if GTEST_HAS_GLOBAL_WSTRING
8398 #endif
8399 
8400 #if GTEST_HAS_STD_WSTRING
8403 #endif
8404 
8405 #undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
8406 
8407 // Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
8408 // operand to be used in a failure message. The type (but not value)
8409 // of the other operand may affect the format. This allows us to
8410 // print a char* as a raw pointer when it is compared against another
8411 // char* or void*, and print it as a C string when it is compared
8412 // against an std::string object, for example.
8413 //
8414 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
8415 template <typename T1, typename T2>
8417  const T1& value, const T2& /* other_operand */) {
8419 }
8420 
8421 // UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
8422 // value to the given ostream. The caller must ensure that
8423 // 'ostream_ptr' is not NULL, or the behavior is undefined.
8424 //
8425 // We define UniversalPrinter as a class template (as opposed to a
8426 // function template), as we need to partially specialize it for
8427 // reference types, which cannot be done with function templates.
8428 template <typename T>
8430 
8431 template <typename T>
8432 void UniversalPrint(const T& value, ::std::ostream* os);
8433 
8439 };
8440 template <DefaultPrinterType type> struct WrapPrinterType {};
8441 
8442 // Used to print an STL-style container when the user doesn't define
8443 // a PrintTo() for it.
8444 template <typename C>
8446  const C& container, ::std::ostream* os) {
8447  const size_t kMaxCount = 32; // The maximum number of elements to print.
8448  *os << '{';
8449  size_t count = 0;
8450  for (typename C::const_iterator it = container.begin();
8451  it != container.end(); ++it, ++count) {
8452  if (count > 0) {
8453  *os << ',';
8454  if (count == kMaxCount) { // Enough has been printed.
8455  *os << " ...";
8456  break;
8457  }
8458  }
8459  *os << ' ';
8460  // We cannot call PrintTo(*it, os) here as PrintTo() doesn't
8461  // handle *it being a native array.
8462  internal::UniversalPrint(*it, os);
8463  }
8464 
8465  if (count > 0) {
8466  *os << ' ';
8467  }
8468  *os << '}';
8469 }
8470 
8471 // Used to print a pointer that is neither a char pointer nor a member
8472 // pointer, when the user doesn't define PrintTo() for it. (A member
8473 // variable pointer or member function pointer doesn't really point to
8474 // a location in the address space. Their representation is
8475 // implementation-defined. Therefore they will be printed as raw
8476 // bytes.)
8477 template <typename T>
8479  T* p, ::std::ostream* os) {
8480  if (p == nullptr) {
8481  *os << "NULL";
8482  } else {
8483  // T is not a function type. We just call << to print p,
8484  // relying on ADL to pick up user-defined << for their pointer
8485  // types, if any.
8486  *os << p;
8487  }
8488 }
8489 template <typename T>
8491  T* p, ::std::ostream* os) {
8492  if (p == nullptr) {
8493  *os << "NULL";
8494  } else {
8495  // T is a function type, so '*os << p' doesn't do what we want
8496  // (it just prints p as bool). We want to print p as a const
8497  // void*.
8498  *os << reinterpret_cast<const void*>(p);
8499  }
8500 }
8501 
8502 // Used to print a non-container, non-pointer value when the user
8503 // doesn't define PrintTo() for it.
8504 template <typename T>
8506  const T& value, ::std::ostream* os) {
8508 }
8509 
8510 // Prints the given value using the << operator if it has one;
8511 // otherwise prints the bytes in it. This is what
8512 // UniversalPrinter<T>::Print() does when PrintTo() is not specialized
8513 // or overloaded for type T.
8514 //
8515 // A user can override this behavior for a class type Foo by defining
8516 // an overload of PrintTo() in the namespace where Foo is defined. We
8517 // give the user this option as sometimes defining a << operator for
8518 // Foo is not desirable (e.g. the coding style may prevent doing it,
8519 // or there is already a << operator but it doesn't do what the user
8520 // wants).
8521 template <typename T>
8522 void PrintTo(const T& value, ::std::ostream* os) {
8523  // DefaultPrintTo() is overloaded. The type of its first argument
8524  // determines which version will be picked.
8525  //
8526  // Note that we check for container types here, prior to we check
8527  // for protocol message types in our operator<<. The rationale is:
8528  //
8529  // For protocol messages, we want to give people a chance to
8530  // override Google Mock's format by defining a PrintTo() or
8531  // operator<<. For STL containers, other formats can be
8532  // incompatible with Google Mock's format for the container
8533  // elements; therefore we check for container types here to ensure
8534  // that our format is used.
8535  //
8536  // Note that MSVC and clang-cl do allow an implicit conversion from
8537  // pointer-to-function to pointer-to-object, but clang-cl warns on it.
8538  // So don't use ImplicitlyConvertible if it can be helped since it will
8539  // cause this warning, and use a separate overload of DefaultPrintTo for
8540  // function pointers so that the `*os << p` in the object pointer overload
8541  // doesn't cause that warning either.
8543  WrapPrinterType <
8544  (sizeof(IsContainerTest<T>(0)) == sizeof(IsContainer)) &&
8546  ? kPrintContainer
8547  : !std::is_pointer<T>::value
8548  ? kPrintOther
8549  : std::is_function<typename std::remove_pointer<T>::type>::value
8551  : kPrintPointer > (),
8552  value, os);
8553 }
8554 
8555 // The following list of PrintTo() overloads tells
8556 // UniversalPrinter<T>::Print() how to print standard types (built-in
8557 // types, strings, plain arrays, and pointers).
8558 
8559 // Overloads for various char types.
8560 GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);
8561 GTEST_API_ void PrintTo(signed char c, ::std::ostream* os);
8562 inline void PrintTo(char c, ::std::ostream* os) {
8563  // When printing a plain char, we always treat it as unsigned. This
8564  // way, the output won't be affected by whether the compiler thinks
8565  // char is signed or not.
8566  PrintTo(static_cast<unsigned char>(c), os);
8567 }
8568 
8569 // Overloads for other simple built-in types.
8570 inline void PrintTo(bool x, ::std::ostream* os) {
8571  *os << (x ? "true" : "false");
8572 }
8573 
8574 // Overload for wchar_t type.
8575 // Prints a wchar_t as a symbol if it is printable or as its internal
8576 // code otherwise and also as its decimal code (except for L'\0').
8577 // The L'\0' char is printed as "L'\\0'". The decimal code is printed
8578 // as signed integer when wchar_t is implemented by the compiler
8579 // as a signed type and is printed as an unsigned integer when wchar_t
8580 // is implemented as an unsigned type.
8581 GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
8582 
8583 // Overloads for C strings.
8584 GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
8585 inline void PrintTo(char* s, ::std::ostream* os) {
8586  PrintTo(ImplicitCast_<const char*>(s), os);
8587 }
8588 
8589 // signed/unsigned char is often used for representing binary data, so
8590 // we print pointers to it as void* to be safe.
8591 inline void PrintTo(const signed char* s, ::std::ostream* os) {
8592  PrintTo(ImplicitCast_<const void*>(s), os);
8593 }
8594 inline void PrintTo(signed char* s, ::std::ostream* os) {
8595  PrintTo(ImplicitCast_<const void*>(s), os);
8596 }
8597 inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
8598  PrintTo(ImplicitCast_<const void*>(s), os);
8599 }
8600 inline void PrintTo(unsigned char* s, ::std::ostream* os) {
8601  PrintTo(ImplicitCast_<const void*>(s), os);
8602 }
8603 
8604 // MSVC can be configured to define wchar_t as a typedef of unsigned
8605 // short. It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
8606 // type. When wchar_t is a typedef, defining an overload for const
8607 // wchar_t* would cause unsigned short* be printed as a wide string,
8608 // possibly causing invalid memory accesses.
8609 #if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
8610 // Overloads for wide C strings
8611 GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);
8612 inline void PrintTo(wchar_t* s, ::std::ostream* os) {
8613  PrintTo(ImplicitCast_<const wchar_t*>(s), os);
8614 }
8615 #endif
8616 
8617 // Overload for C arrays. Multi-dimensional arrays are printed
8618 // properly.
8619 
8620 // Prints the given number of elements in an array, without printing
8621 // the curly braces.
8622 template <typename T>
8623 void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
8624  UniversalPrint(a[0], os);
8625  for (size_t i = 1; i != count; i++) {
8626  *os << ", ";
8627  UniversalPrint(a[i], os);
8628  }
8629 }
8630 
8631 // Overloads for ::string and ::std::string.
8632 #if GTEST_HAS_GLOBAL_STRING
8633 GTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os);
8634 inline void PrintTo(const ::string& s, ::std::ostream* os) {
8635  PrintStringTo(s, os);
8636 }
8637 #endif // GTEST_HAS_GLOBAL_STRING
8638 
8639 GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);
8640 inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
8641  PrintStringTo(s, os);
8642 }
8643 
8644 // Overloads for ::wstring and ::std::wstring.
8645 #if GTEST_HAS_GLOBAL_WSTRING
8646 GTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os);
8647 inline void PrintTo(const ::wstring& s, ::std::ostream* os) {
8648  PrintWideStringTo(s, os);
8649 }
8650 #endif // GTEST_HAS_GLOBAL_WSTRING
8651 
8652 #if GTEST_HAS_STD_WSTRING
8653 GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
8654 inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
8655  PrintWideStringTo(s, os);
8656 }
8657 #endif // GTEST_HAS_STD_WSTRING
8658 
8659 #if GTEST_HAS_ABSL
8660 // Overload for absl::string_view.
8661 inline void PrintTo(absl::string_view sp, ::std::ostream* os) {
8662  PrintTo(::std::string(sp), os);
8663 }
8664 #endif // GTEST_HAS_ABSL
8665 
8666 inline void PrintTo(std::nullptr_t, ::std::ostream* os) { *os << "(nullptr)"; }
8667 
8668 template <typename T>
8669 void PrintTo(std::reference_wrapper<T> ref, ::std::ostream* os) {
8670  // Delegate to wrapped value.
8671  PrintTo(ref.get(), os);
8672 }
8673 
8674 // Helper function for printing a tuple. T must be instantiated with
8675 // a tuple type.
8676 template <typename T>
8677 void PrintTupleTo(const T&, std::integral_constant<size_t, 0>,
8678  ::std::ostream*) {}
8679 
8680 template <typename T, size_t I>
8681 void PrintTupleTo(const T& t, std::integral_constant<size_t, I>,
8682  ::std::ostream* os) {
8683  PrintTupleTo(t, std::integral_constant<size_t, I - 1>(), os);
8685  if (I > 1) {
8687  *os << ", ";
8688  }
8689  UniversalPrinter<typename std::tuple_element<I - 1, T>::type>::Print(
8690  std::get<I - 1>(t), os);
8691 }
8692 
8693 template <typename... Types>
8694 void PrintTo(const ::std::tuple<Types...>& t, ::std::ostream* os) {
8695  *os << "(";
8696  PrintTupleTo(t, std::integral_constant<size_t, sizeof...(Types)>(), os);
8697  *os << ")";
8698 }
8699 
8700 // Overload for std::pair.
8701 template <typename T1, typename T2>
8702 void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
8703  *os << '(';
8704  // We cannot use UniversalPrint(value.first, os) here, as T1 may be
8705  // a reference type. The same for printing value.second.
8706  UniversalPrinter<T1>::Print(value.first, os);
8707  *os << ", ";
8708  UniversalPrinter<T2>::Print(value.second, os);
8709  *os << ')';
8710 }
8711 
8712 // Implements printing a non-reference type T by letting the compiler
8713 // pick the right overload of PrintTo() for T.
8714 template <typename T>
8715 class UniversalPrinter {
8716  public:
8717  // MSVC warns about adding const to a function type, so we want to
8718  // disable the warning.
8720 
8721  // Note: we deliberately don't call this PrintTo(), as that name
8722  // conflicts with ::testing::internal::PrintTo in the body of the
8723  // function.
8724  static void Print(const T& value, ::std::ostream* os) {
8725  // By default, ::testing::internal::PrintTo() is used for printing
8726  // the value.
8727  //
8728  // Thanks to Koenig look-up, if T is a class and has its own
8729  // PrintTo() function defined in its namespace, that function will
8730  // be visible here. Since it is more specific than the generic ones
8731  // in ::testing::internal, it will be picked by the compiler in the
8732  // following statement - exactly what we want.
8733  PrintTo(value, os);
8734  }
8735 
8737 };
8738 
8739 #if GTEST_HAS_ABSL
8740 
8741 // Printer for absl::optional
8742 
8743 template <typename T>
8744 class UniversalPrinter<::absl::optional<T>> {
8745  public:
8746  static void Print(const ::absl::optional<T>& value, ::std::ostream* os) {
8747  *os << '(';
8748  if (!value) {
8749  *os << "nullopt";
8750  } else {
8751  UniversalPrint(*value, os);
8752  }
8753  *os << ')';
8754  }
8755 };
8756 
8757 // Printer for absl::variant
8758 
8759 template <typename... T>
8760 class UniversalPrinter<::absl::variant<T...>> {
8761  public:
8762  static void Print(const ::absl::variant<T...>& value, ::std::ostream* os) {
8763  *os << '(';
8764  absl::visit(Visitor{os}, value);
8765  *os << ')';
8766  }
8767 
8768  private:
8769  struct Visitor {
8770  template <typename U>
8771  void operator()(const U& u) const {
8772  *os << "'" << GetTypeName<U>() << "' with value ";
8773  UniversalPrint(u, os);
8774  }
8775  ::std::ostream* os;
8776  };
8777 };
8778 
8779 #endif // GTEST_HAS_ABSL
8780 
8781 // UniversalPrintArray(begin, len, os) prints an array of 'len'
8782 // elements, starting at address 'begin'.
8783 template <typename T>
8784 void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
8785  if (len == 0) {
8786  *os << "{}";
8787  } else {
8788  *os << "{ ";
8789  const size_t kThreshold = 18;
8790  const size_t kChunkSize = 8;
8791  // If the array has more than kThreshold elements, we'll have to
8792  // omit some details by printing only the first and the last
8793  // kChunkSize elements.
8794  if (len <= kThreshold) {
8795  PrintRawArrayTo(begin, len, os);
8796  } else {
8797  PrintRawArrayTo(begin, kChunkSize, os);
8798  *os << ", ..., ";
8799  PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
8800  }
8801  *os << " }";
8802  }
8803 }
8804 // This overload prints a (const) char array compactly.
8806  const char* begin, size_t len, ::std::ostream* os);
8807 
8808 // This overload prints a (const) wchar_t array compactly.
8810  const wchar_t* begin, size_t len, ::std::ostream* os);
8811 
8812 // Implements printing an array type T[N].
8813 template <typename T, size_t N>
8814 class UniversalPrinter<T[N]> {
8815  public:
8816  // Prints the given array, omitting some elements when there are too
8817  // many.
8818  static void Print(const T (&a)[N], ::std::ostream* os) {
8819  UniversalPrintArray(a, N, os);
8820  }
8821 };
8822 
8823 // Implements printing a reference type T&.
8824 template <typename T>
8825 class UniversalPrinter<T&> {
8826  public:
8827  // MSVC warns about adding const to a function type, so we want to
8828  // disable the warning.
8830 
8831  static void Print(const T& value, ::std::ostream* os) {
8832  // Prints the address of the value. We use reinterpret_cast here
8833  // as static_cast doesn't compile when T is a function type.
8834  *os << "@" << reinterpret_cast<const void*>(&value) << " ";
8835 
8836  // Then prints the value itself.
8837  UniversalPrint(value, os);
8838  }
8839 
8841 };
8842 
8843 // Prints a value tersely: for a reference type, the referenced value
8844 // (but not the address) is printed; for a (const) char pointer, the
8845 // NUL-terminated string (but not the pointer) is printed.
8846 
8847 template <typename T>
8849  public:
8850  static void Print(const T& value, ::std::ostream* os) {
8851  UniversalPrint(value, os);
8852  }
8853 };
8854 template <typename T>
8856  public:
8857  static void Print(const T& value, ::std::ostream* os) {
8858  UniversalPrint(value, os);
8859  }
8860 };
8861 template <typename T, size_t N>
8863  public:
8864  static void Print(const T (&value)[N], ::std::ostream* os) {
8865  UniversalPrinter<T[N]>::Print(value, os);
8866  }
8867 };
8868 template <>
8869 class UniversalTersePrinter<const char*> {
8870  public:
8871  static void Print(const char* str, ::std::ostream* os) {
8872  if (str == nullptr) {
8873  *os << "NULL";
8874  } else {
8875  UniversalPrint(std::string(str), os);
8876  }
8877  }
8878 };
8879 template <>
8881  public:
8882  static void Print(char* str, ::std::ostream* os) {
8884  }
8885 };
8886 
8887 #if GTEST_HAS_STD_WSTRING
8888 template <>
8889 class UniversalTersePrinter<const wchar_t*> {
8890  public:
8891  static void Print(const wchar_t* str, ::std::ostream* os) {
8892  if (str == nullptr) {
8893  *os << "NULL";
8894  } else {
8895  UniversalPrint(::std::wstring(str), os);
8896  }
8897  }
8898 };
8899 #endif
8900 
8901 template <>
8902 class UniversalTersePrinter<wchar_t*> {
8903  public:
8904  static void Print(wchar_t* str, ::std::ostream* os) {
8906  }
8907 };
8908 
8909 template <typename T>
8910 void UniversalTersePrint(const T& value, ::std::ostream* os) {
8912 }
8913 
8914 // Prints a value using the type inferred by the compiler. The
8915 // difference between this and UniversalTersePrint() is that for a
8916 // (const) char pointer, this prints both the pointer and the
8917 // NUL-terminated string.
8918 template <typename T>
8919 void UniversalPrint(const T& value, ::std::ostream* os) {
8920  // A workarond for the bug in VC++ 7.1 that prevents us from instantiating
8921  // UniversalPrinter with T directly.
8922  typedef T T1;
8923  UniversalPrinter<T1>::Print(value, os);
8924 }
8925 
8926 typedef ::std::vector< ::std::string> Strings;
8927 
8928  // Tersely prints the first N fields of a tuple to a string vector,
8929  // one element for each field.
8930 template <typename Tuple>
8931 void TersePrintPrefixToStrings(const Tuple&, std::integral_constant<size_t, 0>,
8932  Strings*) {}
8933 template <typename Tuple, size_t I>
8934 void TersePrintPrefixToStrings(const Tuple& t,
8935  std::integral_constant<size_t, I>,
8936  Strings* strings) {
8937  TersePrintPrefixToStrings(t, std::integral_constant<size_t, I - 1>(),
8938  strings);
8939  ::std::stringstream ss;
8940  UniversalTersePrint(std::get<I - 1>(t), &ss);
8941  strings->push_back(ss.str());
8942 }
8943 
8944 // Prints the fields of a tuple tersely to a string vector, one
8945 // element for each field. See the comment before
8946 // UniversalTersePrint() for how we define "tersely".
8947 template <typename Tuple>
8949  Strings result;
8951  value, std::integral_constant<size_t, std::tuple_size<Tuple>::value>(),
8952  &result);
8953  return result;
8954 }
8955 
8956 } // namespace internal
8957 
8958 #if GTEST_HAS_ABSL
8959 namespace internal2 {
8960 template <typename T>
8962  const T& value, ::std::ostream* os) {
8963  internal::PrintTo(absl::string_view(value), os);
8964 }
8965 } // namespace internal2
8966 #endif
8967 
8968 template <typename T>
8969 ::std::string PrintToString(const T& value) {
8970  ::std::stringstream ss;
8972  return ss.str();
8973 }
8974 
8975 } // namespace testing
8976 
8977 // Include any custom printer added by the local installation.
8978 // We must include this header at the end to make sure it can use the
8979 // declarations from this file.
8980 // Copyright 2015, Google Inc.
8981 // All rights reserved.
8982 //
8983 // Redistribution and use in source and binary forms, with or without
8984 // modification, are permitted provided that the following conditions are
8985 // met:
8986 //
8987 // * Redistributions of source code must retain the above copyright
8988 // notice, this list of conditions and the following disclaimer.
8989 // * Redistributions in binary form must reproduce the above
8990 // copyright notice, this list of conditions and the following disclaimer
8991 // in the documentation and/or other materials provided with the
8992 // distribution.
8993 // * Neither the name of Google Inc. nor the names of its
8994 // contributors may be used to endorse or promote products derived from
8995 // this software without specific prior written permission.
8996 //
8997 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8998 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8999 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9000 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9001 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9002 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9003 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9004 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9005 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9006 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9007 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9008 //
9009 // This file provides an injection point for custom printers in a local
9010 // installation of gTest.
9011 // It will be included from gtest-printers.h and the overrides in this file
9012 // will be visible to everyone.
9013 //
9014 // Injection point for custom user configurations. See README for details
9015 //
9016 // ** Custom implementation starts here **
9017 
9018 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
9019 #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
9020 
9021 #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
9022 
9023 #endif // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
9024 
9026  4251 5046 /* class A needs to have dll-interface to be used by clients of
9027  class B */
9028  /* Symbol involving type with internal linkage not defined */)
9029 
9030 namespace testing {
9031 
9032 // To implement a matcher Foo for type T, define:
9033 // 1. a class FooMatcherImpl that implements the
9034 // MatcherInterface<T> interface, and
9035 // 2. a factory function that creates a Matcher<T> object from a
9036 // FooMatcherImpl*.
9037 //
9038 // The two-level delegation design makes it possible to allow a user
9039 // to write "v" instead of "Eq(v)" where a Matcher is expected, which
9040 // is impossible if we pass matchers by pointers. It also eases
9041 // ownership management as Matcher objects can now be copied like
9042 // plain values.
9043 
9044 // MatchResultListener is an abstract class. Its << operator can be
9045 // used by a matcher to explain why a value matches or doesn't match.
9046 //
9047 class MatchResultListener {
9048  public:
9049  // Creates a listener object with the given underlying ostream. The
9050  // listener does not own the ostream, and does not dereference it
9051  // in the constructor or destructor.
9052  explicit MatchResultListener(::std::ostream* os) : stream_(os) {}
9053  virtual ~MatchResultListener() = 0; // Makes this class abstract.
9054 
9055  // Streams x to the underlying ostream; does nothing if the ostream
9056  // is NULL.
9057  template <typename T>
9058  MatchResultListener& operator<<(const T& x) {
9059  if (stream_ != nullptr) *stream_ << x;
9060  return *this;
9061  }
9062 
9063  // Returns the underlying ostream.
9064  ::std::ostream* stream() { return stream_; }
9065 
9066  // Returns true iff the listener is interested in an explanation of
9067  // the match result. A matcher's MatchAndExplain() method can use
9068  // this information to avoid generating the explanation when no one
9069  // intends to hear it.
9070  bool IsInterested() const { return stream_ != nullptr; }
9071 
9072  private:
9073  ::std::ostream* const stream_;
9074 
9075  GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener);
9076 };
9077 
9078 inline MatchResultListener::~MatchResultListener() {
9079 }
9080 
9081 // An instance of a subclass of this knows how to describe itself as a
9082 // matcher.
9083 class MatcherDescriberInterface {
9084  public:
9085  virtual ~MatcherDescriberInterface() {}
9086 
9087  // Describes this matcher to an ostream. The function should print
9088  // a verb phrase that describes the property a value matching this
9089  // matcher should have. The subject of the verb phrase is the value
9090  // being matched. For example, the DescribeTo() method of the Gt(7)
9091  // matcher prints "is greater than 7".
9092  virtual void DescribeTo(::std::ostream* os) const = 0;
9093 
9094  // Describes the negation of this matcher to an ostream. For
9095  // example, if the description of this matcher is "is greater than
9096  // 7", the negated description could be "is not greater than 7".
9097  // You are not required to override this when implementing
9098  // MatcherInterface, but it is highly advised so that your matcher
9099  // can produce good error messages.
9100  virtual void DescribeNegationTo(::std::ostream* os) const {
9101  *os << "not (";
9102  DescribeTo(os);
9103  *os << ")";
9104  }
9105 };
9106 
9107 // The implementation of a matcher.
9108 template <typename T>
9109 class MatcherInterface : public MatcherDescriberInterface {
9110  public:
9111  // Returns true iff the matcher matches x; also explains the match
9112  // result to 'listener' if necessary (see the next paragraph), in
9113  // the form of a non-restrictive relative clause ("which ...",
9114  // "whose ...", etc) that describes x. For example, the
9115  // MatchAndExplain() method of the Pointee(...) matcher should
9116  // generate an explanation like "which points to ...".
9117  //
9118  // Implementations of MatchAndExplain() should add an explanation of
9119  // the match result *if and only if* they can provide additional
9120  // information that's not already present (or not obvious) in the
9121  // print-out of x and the matcher's description. Whether the match
9122  // succeeds is not a factor in deciding whether an explanation is
9123  // needed, as sometimes the caller needs to print a failure message
9124  // when the match succeeds (e.g. when the matcher is used inside
9125  // Not()).
9126  //
9127  // For example, a "has at least 10 elements" matcher should explain
9128  // what the actual element count is, regardless of the match result,
9129  // as it is useful information to the reader; on the other hand, an
9130  // "is empty" matcher probably only needs to explain what the actual
9131  // size is when the match fails, as it's redundant to say that the
9132  // size is 0 when the value is already known to be empty.
9133  //
9134  // You should override this method when defining a new matcher.
9135  //
9136  // It's the responsibility of the caller (Google Test) to guarantee
9137  // that 'listener' is not NULL. This helps to simplify a matcher's
9138  // implementation when it doesn't care about the performance, as it
9139  // can talk to 'listener' without checking its validity first.
9140  // However, in order to implement dummy listeners efficiently,
9141  // listener->stream() may be NULL.
9142  virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0;
9143 
9144  // Inherits these methods from MatcherDescriberInterface:
9145  // virtual void DescribeTo(::std::ostream* os) const = 0;
9146  // virtual void DescribeNegationTo(::std::ostream* os) const;
9147 };
9148 
9149 namespace internal {
9150 
9151 // Converts a MatcherInterface<T> to a MatcherInterface<const T&>.
9152 template <typename T>
9153 class MatcherInterfaceAdapter : public MatcherInterface<const T&> {
9154  public:
9155  explicit MatcherInterfaceAdapter(const MatcherInterface<T>* impl)
9156  : impl_(impl) {}
9157  ~MatcherInterfaceAdapter() override { delete impl_; }
9158 
9159  void DescribeTo(::std::ostream* os) const override { impl_->DescribeTo(os); }
9160 
9161  void DescribeNegationTo(::std::ostream* os) const override {
9162  impl_->DescribeNegationTo(os);
9163  }
9164 
9165  bool MatchAndExplain(const T& x,
9166  MatchResultListener* listener) const override {
9167  return impl_->MatchAndExplain(x, listener);
9168  }
9169 
9170  private:
9171  const MatcherInterface<T>* const impl_;
9172 
9173  GTEST_DISALLOW_COPY_AND_ASSIGN_(MatcherInterfaceAdapter);
9174 };
9175 
9176 struct AnyEq {
9177  template <typename A, typename B>
9178  bool operator()(const A& a, const B& b) const { return a == b; }
9179 };
9180 struct AnyNe {
9181  template <typename A, typename B>
9182  bool operator()(const A& a, const B& b) const { return a != b; }
9183 };
9184 struct AnyLt {
9185  template <typename A, typename B>
9186  bool operator()(const A& a, const B& b) const { return a < b; }
9187 };
9188 struct AnyGt {
9189  template <typename A, typename B>
9190  bool operator()(const A& a, const B& b) const { return a > b; }
9191 };
9192 struct AnyLe {
9193  template <typename A, typename B>
9194  bool operator()(const A& a, const B& b) const { return a <= b; }
9195 };
9196 struct AnyGe {
9197  template <typename A, typename B>
9198  bool operator()(const A& a, const B& b) const { return a >= b; }
9199 };
9200 
9201 // A match result listener that ignores the explanation.
9202 class DummyMatchResultListener : public MatchResultListener {
9203  public:
9204  DummyMatchResultListener() : MatchResultListener(nullptr) {}
9205 
9206  private:
9207  GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener);
9208 };
9209 
9210 // A match result listener that forwards the explanation to a given
9211 // ostream. The difference between this and MatchResultListener is
9212 // that the former is concrete.
9213 class StreamMatchResultListener : public MatchResultListener {
9214  public:
9215  explicit StreamMatchResultListener(::std::ostream* os)
9216  : MatchResultListener(os) {}
9217 
9218  private:
9219  GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener);
9220 };
9221 
9222 // An internal class for implementing Matcher<T>, which will derive
9223 // from it. We put functionalities common to all Matcher<T>
9224 // specializations here to avoid code duplication.
9225 template <typename T>
9226 class MatcherBase {
9227  public:
9228  // Returns true iff the matcher matches x; also explains the match
9229  // result to 'listener'.
9230  bool MatchAndExplain(const T& x, MatchResultListener* listener) const {
9231  return impl_->MatchAndExplain(x, listener);
9232  }
9233 
9234  // Returns true iff this matcher matches x.
9235  bool Matches(const T& x) const {
9236  DummyMatchResultListener dummy;
9237  return MatchAndExplain(x, &dummy);
9238  }
9239 
9240  // Describes this matcher to an ostream.
9241  void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); }
9242 
9243  // Describes the negation of this matcher to an ostream.
9244  void DescribeNegationTo(::std::ostream* os) const {
9245  impl_->DescribeNegationTo(os);
9246  }
9247 
9248  // Explains why x matches, or doesn't match, the matcher.
9249  void ExplainMatchResultTo(const T& x, ::std::ostream* os) const {
9250  StreamMatchResultListener listener(os);
9251  MatchAndExplain(x, &listener);
9252  }
9253 
9254  // Returns the describer for this matcher object; retains ownership
9255  // of the describer, which is only guaranteed to be alive when
9256  // this matcher object is alive.
9257  const MatcherDescriberInterface* GetDescriber() const {
9258  return impl_.get();
9259  }
9260 
9261  protected:
9262  MatcherBase() {}
9263 
9264  // Constructs a matcher from its implementation.
9265  explicit MatcherBase(const MatcherInterface<const T&>* impl) : impl_(impl) {}
9266 
9267  template <typename U>
9268  explicit MatcherBase(
9269  const MatcherInterface<U>* impl,
9270  typename internal::EnableIf<
9271  !internal::IsSame<U, const U&>::value>::type* = nullptr)
9272  : impl_(new internal::MatcherInterfaceAdapter<U>(impl)) {}
9273 
9274  virtual ~MatcherBase() {}
9275 
9276  private:
9277  std::shared_ptr<const MatcherInterface<const T&>> impl_;
9278 };
9279 
9280 } // namespace internal
9281 
9282 // A Matcher<T> is a copyable and IMMUTABLE (except by assignment)
9283 // object that can check whether a value of type T matches. The
9284 // implementation of Matcher<T> is just a std::shared_ptr to const
9285 // MatcherInterface<T>. Don't inherit from Matcher!
9286 template <typename T>
9287 class Matcher : public internal::MatcherBase<T> {
9288  public:
9289  // Constructs a null matcher. Needed for storing Matcher objects in STL
9290  // containers. A default-constructed matcher is not yet initialized. You
9291  // cannot use it until a valid value has been assigned to it.
9292  explicit Matcher() {} // NOLINT
9293 
9294  // Constructs a matcher from its implementation.
9295  explicit Matcher(const MatcherInterface<const T&>* impl)
9296  : internal::MatcherBase<T>(impl) {}
9297 
9298  template <typename U>
9299  explicit Matcher(const MatcherInterface<U>* impl,
9300  typename internal::EnableIf<
9301  !internal::IsSame<U, const U&>::value>::type* = nullptr)
9302  : internal::MatcherBase<T>(impl) {}
9303 
9304  // Implicit constructor here allows people to write
9305  // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes
9306  Matcher(T value); // NOLINT
9307 };
9308 
9309 // The following two specializations allow the user to write str
9310 // instead of Eq(str) and "foo" instead of Eq("foo") when a std::string
9311 // matcher is expected.
9312 template <>
9313 class GTEST_API_ Matcher<const std::string&>
9314  : public internal::MatcherBase<const std::string&> {
9315  public:
9316  Matcher() {}
9317 
9318  explicit Matcher(const MatcherInterface<const std::string&>* impl)
9319  : internal::MatcherBase<const std::string&>(impl) {}
9320 
9321  // Allows the user to write str instead of Eq(str) sometimes, where
9322  // str is a std::string object.
9323  Matcher(const std::string& s); // NOLINT
9324 
9325 #if GTEST_HAS_GLOBAL_STRING
9326  // Allows the user to write str instead of Eq(str) sometimes, where
9327  // str is a ::string object.
9328  Matcher(const ::string& s); // NOLINT
9329 #endif // GTEST_HAS_GLOBAL_STRING
9330 
9331  // Allows the user to write "foo" instead of Eq("foo") sometimes.
9332  Matcher(const char* s); // NOLINT
9333 };
9334 
9335 template <>
9336 class GTEST_API_ Matcher<std::string>
9337  : public internal::MatcherBase<std::string> {
9338  public:
9339  Matcher() {}
9340 
9341  explicit Matcher(const MatcherInterface<const std::string&>* impl)
9342  : internal::MatcherBase<std::string>(impl) {}
9343  explicit Matcher(const MatcherInterface<std::string>* impl)
9344  : internal::MatcherBase<std::string>(impl) {}
9345 
9346  // Allows the user to write str instead of Eq(str) sometimes, where
9347  // str is a string object.
9348  Matcher(const std::string& s); // NOLINT
9349 
9350 #if GTEST_HAS_GLOBAL_STRING
9351  // Allows the user to write str instead of Eq(str) sometimes, where
9352  // str is a ::string object.
9353  Matcher(const ::string& s); // NOLINT
9354 #endif // GTEST_HAS_GLOBAL_STRING
9355 
9356  // Allows the user to write "foo" instead of Eq("foo") sometimes.
9357  Matcher(const char* s); // NOLINT
9358 };
9359 
9360 #if GTEST_HAS_GLOBAL_STRING
9361 // The following two specializations allow the user to write str
9362 // instead of Eq(str) and "foo" instead of Eq("foo") when a ::string
9363 // matcher is expected.
9364 template <>
9365 class GTEST_API_ Matcher<const ::string&>
9366  : public internal::MatcherBase<const ::string&> {
9367  public:
9368  Matcher() {}
9369 
9370  explicit Matcher(const MatcherInterface<const ::string&>* impl)
9371  : internal::MatcherBase<const ::string&>(impl) {}
9372 
9373  // Allows the user to write str instead of Eq(str) sometimes, where
9374  // str is a std::string object.
9375  Matcher(const std::string& s); // NOLINT
9376 
9377  // Allows the user to write str instead of Eq(str) sometimes, where
9378  // str is a ::string object.
9379  Matcher(const ::string& s); // NOLINT
9380 
9381  // Allows the user to write "foo" instead of Eq("foo") sometimes.
9382  Matcher(const char* s); // NOLINT
9383 };
9384 
9385 template <>
9386 class GTEST_API_ Matcher< ::string>
9387  : public internal::MatcherBase< ::string> {
9388  public:
9389  Matcher() {}
9390 
9391  explicit Matcher(const MatcherInterface<const ::string&>* impl)
9392  : internal::MatcherBase< ::string>(impl) {}
9393  explicit Matcher(const MatcherInterface< ::string>* impl)
9394  : internal::MatcherBase< ::string>(impl) {}
9395 
9396  // Allows the user to write str instead of Eq(str) sometimes, where
9397  // str is a std::string object.
9398  Matcher(const std::string& s); // NOLINT
9399 
9400  // Allows the user to write str instead of Eq(str) sometimes, where
9401  // str is a ::string object.
9402  Matcher(const ::string& s); // NOLINT
9403 
9404  // Allows the user to write "foo" instead of Eq("foo") sometimes.
9405  Matcher(const char* s); // NOLINT
9406 };
9407 #endif // GTEST_HAS_GLOBAL_STRING
9408 
9409 #if GTEST_HAS_ABSL
9410 // The following two specializations allow the user to write str
9411 // instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
9412 // matcher is expected.
9413 template <>
9414 class GTEST_API_ Matcher<const absl::string_view&>
9415  : public internal::MatcherBase<const absl::string_view&> {
9416  public:
9417  Matcher() {}
9418 
9419  explicit Matcher(const MatcherInterface<const absl::string_view&>* impl)
9420  : internal::MatcherBase<const absl::string_view&>(impl) {}
9421 
9422  // Allows the user to write str instead of Eq(str) sometimes, where
9423  // str is a std::string object.
9424  Matcher(const std::string& s); // NOLINT
9425 
9426 #if GTEST_HAS_GLOBAL_STRING
9427  // Allows the user to write str instead of Eq(str) sometimes, where
9428  // str is a ::string object.
9429  Matcher(const ::string& s); // NOLINT
9430 #endif // GTEST_HAS_GLOBAL_STRING
9431 
9432  // Allows the user to write "foo" instead of Eq("foo") sometimes.
9433  Matcher(const char* s); // NOLINT
9434 
9435  // Allows the user to pass absl::string_views directly.
9436  Matcher(absl::string_view s); // NOLINT
9437 };
9438 
9439 template <>
9440 class GTEST_API_ Matcher<absl::string_view>
9441  : public internal::MatcherBase<absl::string_view> {
9442  public:
9443  Matcher() {}
9444 
9445  explicit Matcher(const MatcherInterface<const absl::string_view&>* impl)
9446  : internal::MatcherBase<absl::string_view>(impl) {}
9447  explicit Matcher(const MatcherInterface<absl::string_view>* impl)
9448  : internal::MatcherBase<absl::string_view>(impl) {}
9449 
9450  // Allows the user to write str instead of Eq(str) sometimes, where
9451  // str is a std::string object.
9452  Matcher(const std::string& s); // NOLINT
9453 
9454 #if GTEST_HAS_GLOBAL_STRING
9455  // Allows the user to write str instead of Eq(str) sometimes, where
9456  // str is a ::string object.
9457  Matcher(const ::string& s); // NOLINT
9458 #endif // GTEST_HAS_GLOBAL_STRING
9459 
9460  // Allows the user to write "foo" instead of Eq("foo") sometimes.
9461  Matcher(const char* s); // NOLINT
9462 
9463  // Allows the user to pass absl::string_views directly.
9464  Matcher(absl::string_view s); // NOLINT
9465 };
9466 #endif // GTEST_HAS_ABSL
9467 
9468 // Prints a matcher in a human-readable format.
9469 template <typename T>
9470 std::ostream& operator<<(std::ostream& os, const Matcher<T>& matcher) {
9471  matcher.DescribeTo(&os);
9472  return os;
9473 }
9474 
9475 // The PolymorphicMatcher class template makes it easy to implement a
9476 // polymorphic matcher (i.e. a matcher that can match values of more
9477 // than one type, e.g. Eq(n) and NotNull()).
9478 //
9479 // To define a polymorphic matcher, a user should provide an Impl
9480 // class that has a DescribeTo() method and a DescribeNegationTo()
9481 // method, and define a member function (or member function template)
9482 //
9483 // bool MatchAndExplain(const Value& value,
9484 // MatchResultListener* listener) const;
9485 //
9486 // See the definition of NotNull() for a complete example.
9487 template <class Impl>
9488 class PolymorphicMatcher {
9489  public:
9490  explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {}
9491 
9492  // Returns a mutable reference to the underlying matcher
9493  // implementation object.
9494  Impl& mutable_impl() { return impl_; }
9495 
9496  // Returns an immutable reference to the underlying matcher
9497  // implementation object.
9498  const Impl& impl() const { return impl_; }
9499 
9500  template <typename T>
9501  operator Matcher<T>() const {
9502  return Matcher<T>(new MonomorphicImpl<const T&>(impl_));
9503  }
9504 
9505  private:
9506  template <typename T>
9507  class MonomorphicImpl : public MatcherInterface<T> {
9508  public:
9509  explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
9510 
9511  virtual void DescribeTo(::std::ostream* os) const { impl_.DescribeTo(os); }
9512 
9513  virtual void DescribeNegationTo(::std::ostream* os) const {
9514  impl_.DescribeNegationTo(os);
9515  }
9516 
9517  virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
9518  return impl_.MatchAndExplain(x, listener);
9519  }
9520 
9521  private:
9522  const Impl impl_;
9523 
9524  GTEST_DISALLOW_ASSIGN_(MonomorphicImpl);
9525  };
9526 
9527  Impl impl_;
9528 
9529  GTEST_DISALLOW_ASSIGN_(PolymorphicMatcher);
9530 };
9531 
9532 // Creates a matcher from its implementation. This is easier to use
9533 // than the Matcher<T> constructor as it doesn't require you to
9534 // explicitly write the template argument, e.g.
9535 //
9536 // MakeMatcher(foo);
9537 // vs
9538 // Matcher<const string&>(foo);
9539 template <typename T>
9540 inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) {
9541  return Matcher<T>(impl);
9542 }
9543 
9544 // Creates a polymorphic matcher from its implementation. This is
9545 // easier to use than the PolymorphicMatcher<Impl> constructor as it
9546 // doesn't require you to explicitly write the template argument, e.g.
9547 //
9548 // MakePolymorphicMatcher(foo);
9549 // vs
9550 // PolymorphicMatcher<TypeOfFoo>(foo);
9551 template <class Impl>
9552 inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) {
9553  return PolymorphicMatcher<Impl>(impl);
9554 }
9555 
9556 namespace internal {
9557 // Implements a matcher that compares a given value with a
9558 // pre-supplied value using one of the ==, <=, <, etc, operators. The
9559 // two values being compared don't have to have the same type.
9560 //
9561 // The matcher defined here is polymorphic (for example, Eq(5) can be
9562 // used to match an int, a short, a double, etc). Therefore we use
9563 // a template type conversion operator in the implementation.
9564 //
9565 // The following template definition assumes that the Rhs parameter is
9566 // a "bare" type (i.e. neither 'const T' nor 'T&').
9567 template <typename D, typename Rhs, typename Op>
9568 class ComparisonBase {
9569  public:
9570  explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {}
9571  template <typename Lhs>
9572  operator Matcher<Lhs>() const {
9573  return MakeMatcher(new Impl<Lhs>(rhs_));
9574  }
9575 
9576  private:
9577  template <typename Lhs>
9578  class Impl : public MatcherInterface<Lhs> {
9579  public:
9580  explicit Impl(const Rhs& rhs) : rhs_(rhs) {}
9581  bool MatchAndExplain(Lhs lhs,
9582  MatchResultListener* /* listener */) const override {
9583  return Op()(lhs, rhs_);
9584  }
9585  void DescribeTo(::std::ostream* os) const override {
9586  *os << D::Desc() << " ";
9587  UniversalPrint(rhs_, os);
9588  }
9589  void DescribeNegationTo(::std::ostream* os) const override {
9590  *os << D::NegatedDesc() << " ";
9591  UniversalPrint(rhs_, os);
9592  }
9593 
9594  private:
9595  Rhs rhs_;
9596  GTEST_DISALLOW_ASSIGN_(Impl);
9597  };
9598  Rhs rhs_;
9599  GTEST_DISALLOW_ASSIGN_(ComparisonBase);
9600 };
9601 
9602 template <typename Rhs>
9603 class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq> {
9604  public:
9605  explicit EqMatcher(const Rhs& rhs)
9606  : ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq>(rhs) { }
9607  static const char* Desc() { return "is equal to"; }
9608  static const char* NegatedDesc() { return "isn't equal to"; }
9609 };
9610 template <typename Rhs>
9611 class NeMatcher : public ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe> {
9612  public:
9613  explicit NeMatcher(const Rhs& rhs)
9614  : ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe>(rhs) { }
9615  static const char* Desc() { return "isn't equal to"; }
9616  static const char* NegatedDesc() { return "is equal to"; }
9617 };
9618 template <typename Rhs>
9619 class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt> {
9620  public:
9621  explicit LtMatcher(const Rhs& rhs)
9622  : ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt>(rhs) { }
9623  static const char* Desc() { return "is <"; }
9624  static const char* NegatedDesc() { return "isn't <"; }
9625 };
9626 template <typename Rhs>
9627 class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt> {
9628  public:
9629  explicit GtMatcher(const Rhs& rhs)
9630  : ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt>(rhs) { }
9631  static const char* Desc() { return "is >"; }
9632  static const char* NegatedDesc() { return "isn't >"; }
9633 };
9634 template <typename Rhs>
9635 class LeMatcher : public ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe> {
9636  public:
9637  explicit LeMatcher(const Rhs& rhs)
9638  : ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe>(rhs) { }
9639  static const char* Desc() { return "is <="; }
9640  static const char* NegatedDesc() { return "isn't <="; }
9641 };
9642 template <typename Rhs>
9643 class GeMatcher : public ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe> {
9644  public:
9645  explicit GeMatcher(const Rhs& rhs)
9646  : ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe>(rhs) { }
9647  static const char* Desc() { return "is >="; }
9648  static const char* NegatedDesc() { return "isn't >="; }
9649 };
9650 
9651 // Implements polymorphic matchers MatchesRegex(regex) and
9652 // ContainsRegex(regex), which can be used as a Matcher<T> as long as
9653 // T can be converted to a string.
9654 class MatchesRegexMatcher {
9655  public:
9656  MatchesRegexMatcher(const RE* regex, bool full_match)
9657  : regex_(regex), full_match_(full_match) {}
9658 
9659 #if GTEST_HAS_ABSL
9660  bool MatchAndExplain(const absl::string_view& s,
9661  MatchResultListener* listener) const {
9662  return MatchAndExplain(string(s), listener);
9663  }
9664 #endif // GTEST_HAS_ABSL
9665 
9666  // Accepts pointer types, particularly:
9667  // const char*
9668  // char*
9669  // const wchar_t*
9670  // wchar_t*
9671  template <typename CharType>
9672  bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
9673  return s != nullptr && MatchAndExplain(std::string(s), listener);
9674  }
9675 
9676  // Matches anything that can convert to std::string.
9677  //
9678  // This is a template, not just a plain function with const std::string&,
9679  // because absl::string_view has some interfering non-explicit constructors.
9680  template <class MatcheeStringType>
9681  bool MatchAndExplain(const MatcheeStringType& s,
9682  MatchResultListener* /* listener */) const {
9683  const std::string& s2(s);
9684  return full_match_ ? RE::FullMatch(s2, *regex_)
9685  : RE::PartialMatch(s2, *regex_);
9686  }
9687 
9688  void DescribeTo(::std::ostream* os) const {
9689  *os << (full_match_ ? "matches" : "contains") << " regular expression ";
9690  UniversalPrinter<std::string>::Print(regex_->pattern(), os);
9691  }
9692 
9693  void DescribeNegationTo(::std::ostream* os) const {
9694  *os << "doesn't " << (full_match_ ? "match" : "contain")
9695  << " regular expression ";
9696  UniversalPrinter<std::string>::Print(regex_->pattern(), os);
9697  }
9698 
9699  private:
9700  const std::shared_ptr<const RE> regex_;
9701  const bool full_match_;
9702 
9703  GTEST_DISALLOW_ASSIGN_(MatchesRegexMatcher);
9704 };
9705 } // namespace internal
9706 
9707 // Matches a string that fully matches regular expression 'regex'.
9708 // The matcher takes ownership of 'regex'.
9709 inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
9710  const internal::RE* regex) {
9711  return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
9712 }
9713 inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
9714  const std::string& regex) {
9715  return MatchesRegex(new internal::RE(regex));
9716 }
9717 
9718 // Matches a string that contains regular expression 'regex'.
9719 // The matcher takes ownership of 'regex'.
9720 inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
9721  const internal::RE* regex) {
9722  return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
9723 }
9724 inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
9725  const std::string& regex) {
9726  return ContainsRegex(new internal::RE(regex));
9727 }
9728 
9729 // Creates a polymorphic matcher that matches anything equal to x.
9730 // Note: if the parameter of Eq() were declared as const T&, Eq("foo")
9731 // wouldn't compile.
9732 template <typename T>
9733 inline internal::EqMatcher<T> Eq(T x) { return internal::EqMatcher<T>(x); }
9734 
9735 // Constructs a Matcher<T> from a 'value' of type T. The constructed
9736 // matcher matches any value that's equal to 'value'.
9737 template <typename T>
9738 Matcher<T>::Matcher(T value) { *this = Eq(value); }
9739 
9740 // Creates a monomorphic matcher that matches anything with type Lhs
9741 // and equal to rhs. A user may need to use this instead of Eq(...)
9742 // in order to resolve an overloading ambiguity.
9743 //
9744 // TypedEq<T>(x) is just a convenient short-hand for Matcher<T>(Eq(x))
9745 // or Matcher<T>(x), but more readable than the latter.
9746 //
9747 // We could define similar monomorphic matchers for other comparison
9748 // operations (e.g. TypedLt, TypedGe, and etc), but decided not to do
9749 // it yet as those are used much less than Eq() in practice. A user
9750 // can always write Matcher<T>(Lt(5)) to be explicit about the type,
9751 // for example.
9752 template <typename Lhs, typename Rhs>
9753 inline Matcher<Lhs> TypedEq(const Rhs& rhs) { return Eq(rhs); }
9754 
9755 // Creates a polymorphic matcher that matches anything >= x.
9756 template <typename Rhs>
9757 inline internal::GeMatcher<Rhs> Ge(Rhs x) {
9758  return internal::GeMatcher<Rhs>(x);
9759 }
9760 
9761 // Creates a polymorphic matcher that matches anything > x.
9762 template <typename Rhs>
9763 inline internal::GtMatcher<Rhs> Gt(Rhs x) {
9764  return internal::GtMatcher<Rhs>(x);
9765 }
9766 
9767 // Creates a polymorphic matcher that matches anything <= x.
9768 template <typename Rhs>
9769 inline internal::LeMatcher<Rhs> Le(Rhs x) {
9770  return internal::LeMatcher<Rhs>(x);
9771 }
9772 
9773 // Creates a polymorphic matcher that matches anything < x.
9774 template <typename Rhs>
9775 inline internal::LtMatcher<Rhs> Lt(Rhs x) {
9776  return internal::LtMatcher<Rhs>(x);
9777 }
9778 
9779 // Creates a polymorphic matcher that matches anything != x.
9780 template <typename Rhs>
9781 inline internal::NeMatcher<Rhs> Ne(Rhs x) {
9782  return internal::NeMatcher<Rhs>(x);
9783 }
9784 } // namespace testing
9785 
9786 GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 5046
9787 
9788 #endif // GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
9789 
9790 #include <stdio.h>
9791 #include <memory>
9792 
9793 namespace testing {
9794 namespace internal {
9795 
9796 GTEST_DECLARE_string_(internal_run_death_test);
9797 
9798 // Names of the flags (needed for parsing Google Test flags).
9799 const char kDeathTestStyleFlag[] = "death_test_style";
9800 const char kDeathTestUseFork[] = "death_test_use_fork";
9801 const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
9802 
9803 #if GTEST_HAS_DEATH_TEST
9804 
9806 /* class A needs to have dll-interface to be used by clients of class B */)
9807 
9808 // DeathTest is a class that hides much of the complexity of the
9809 // GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
9810 // returns a concrete class that depends on the prevailing death test
9811 // style, as defined by the --gtest_death_test_style and/or
9812 // --gtest_internal_run_death_test flags.
9813 
9814 // In describing the results of death tests, these terms are used with
9815 // the corresponding definitions:
9816 //
9817 // exit status: The integer exit information in the format specified
9818 // by wait(2)
9819 // exit code: The integer code passed to exit(3), _exit(2), or
9820 // returned from main()
9821 class GTEST_API_ DeathTest {
9822  public:
9823  // Create returns false if there was an error determining the
9824  // appropriate action to take for the current death test; for example,
9825  // if the gtest_death_test_style flag is set to an invalid value.
9826  // The LastMessage method will return a more detailed message in that
9827  // case. Otherwise, the DeathTest pointer pointed to by the "test"
9828  // argument is set. If the death test should be skipped, the pointer
9829  // is set to NULL; otherwise, it is set to the address of a new concrete
9830  // DeathTest object that controls the execution of the current test.
9831  static bool Create(const char* statement, Matcher<const std::string&> matcher,
9832  const char* file, int line, DeathTest** test);
9833  DeathTest();
9834  virtual ~DeathTest() { }
9835 
9836  // A helper class that aborts a death test when it's deleted.
9837  class ReturnSentinel {
9838  public:
9839  explicit ReturnSentinel(DeathTest* test) : test_(test) { }
9840  ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
9841  private:
9842  DeathTest* const test_;
9843  GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
9845 
9846  // An enumeration of possible roles that may be taken when a death
9847  // test is encountered. EXECUTE means that the death test logic should
9848  // be executed immediately. OVERSEE means that the program should prepare
9849  // the appropriate environment for a child process to execute the death
9850  // test, then wait for it to complete.
9851  enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
9852 
9853  // An enumeration of the three reasons that a test might be aborted.
9854  enum AbortReason {
9855  TEST_ENCOUNTERED_RETURN_STATEMENT,
9856  TEST_THREW_EXCEPTION,
9857  TEST_DID_NOT_DIE
9858  };
9859 
9860  // Assumes one of the above roles.
9861  virtual TestRole AssumeRole() = 0;
9862 
9863  // Waits for the death test to finish and returns its status.
9864  virtual int Wait() = 0;
9865 
9866  // Returns true if the death test passed; that is, the test process
9867  // exited during the test, its exit status matches a user-supplied
9868  // predicate, and its stderr output matches a user-supplied regular
9869  // expression.
9870  // The user-supplied predicate may be a macro expression rather
9871  // than a function pointer or functor, or else Wait and Passed could
9872  // be combined.
9873  virtual bool Passed(bool exit_status_ok) = 0;
9874 
9875  // Signals that the death test did not die as expected.
9876  virtual void Abort(AbortReason reason) = 0;
9877 
9878  // Returns a human-readable outcome message regarding the outcome of
9879  // the last death test.
9880  static const char* LastMessage();
9881 
9882  static void set_last_death_test_message(const std::string& message);
9883 
9884  private:
9885  // A string containing a description of the outcome of the last death test.
9886  static std::string last_death_test_message_;
9887 
9889 };
9890 
9892 
9893 // Factory interface for death tests. May be mocked out for testing.
9894 class DeathTestFactory {
9895  public:
9896  virtual ~DeathTestFactory() { }
9897  virtual bool Create(const char* statement,
9898  Matcher<const std::string&> matcher, const char* file,
9899  int line, DeathTest** test) = 0;
9900 };
9901 
9902 // A concrete DeathTestFactory implementation for normal use.
9903 class DefaultDeathTestFactory : public DeathTestFactory {
9904  public:
9905  bool Create(const char* statement, Matcher<const std::string&> matcher,
9906  const char* file, int line, DeathTest** test) override;
9907 };
9908 
9909 // Returns true if exit_status describes a process that was terminated
9910 // by a signal, or exited normally with a nonzero exit code.
9911 GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
9912 
9913 // A string passed to EXPECT_DEATH (etc.) is caught by one of these overloads
9914 // and interpreted as a regex (rather than an Eq matcher) for legacy
9915 // compatibility.
9916 inline Matcher<const ::std::string&> MakeDeathTestMatcher(
9917  ::testing::internal::RE regex) {
9918  return ContainsRegex(regex.pattern());
9919 }
9920 inline Matcher<const ::std::string&> MakeDeathTestMatcher(const char* regex) {
9921  return ContainsRegex(regex);
9922 }
9923 inline Matcher<const ::std::string&> MakeDeathTestMatcher(
9924  const ::std::string& regex) {
9925  return ContainsRegex(regex);
9926 }
9927 #if GTEST_HAS_GLOBAL_STRING
9928 inline Matcher<const ::std::string&> MakeDeathTestMatcher(
9929  const ::string& regex) {
9930  return ContainsRegex(regex);
9931 }
9932 #endif
9933 
9934 // If a Matcher<const ::std::string&> is passed to EXPECT_DEATH (etc.), it's
9935 // used directly.
9936 inline Matcher<const ::std::string&> MakeDeathTestMatcher(
9937  Matcher<const ::std::string&> matcher) {
9938  return matcher;
9939 }
9940 
9941 // Traps C++ exceptions escaping statement and reports them as test
9942 // failures. Note that trapping SEH exceptions is not implemented here.
9943 # if GTEST_HAS_EXCEPTIONS
9944 # define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
9945  try { \
9946  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
9947  } catch (const ::std::exception& gtest_exception) { \
9948  fprintf(\
9949  stderr, \
9950  "\n%s: Caught std::exception-derived exception escaping the " \
9951  "death test statement. Exception message: %s\n", \
9952  ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
9953  gtest_exception.what()); \
9954  fflush(stderr); \
9955  death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
9956  } catch (...) { \
9957  death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
9958  }
9959 
9960 # else
9961 # define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
9962  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
9963 
9964 # endif
9965 
9966 // This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
9967 // ASSERT_EXIT*, and EXPECT_EXIT*.
9968 #define GTEST_DEATH_TEST_(statement, predicate, regex_or_matcher, fail) \
9969  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
9970  if (::testing::internal::AlwaysTrue()) { \
9971  ::testing::internal::DeathTest* gtest_dt; \
9972  if (!::testing::internal::DeathTest::Create( \
9973  #statement, \
9974  ::testing::internal::MakeDeathTestMatcher(regex_or_matcher), \
9975  __FILE__, __LINE__, &gtest_dt)) { \
9976  goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
9977  } \
9978  if (gtest_dt != nullptr) { \
9979  std::unique_ptr< ::testing::internal::DeathTest> gtest_dt_ptr(gtest_dt); \
9980  switch (gtest_dt->AssumeRole()) { \
9981  case ::testing::internal::DeathTest::OVERSEE_TEST: \
9982  if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
9983  goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
9984  } \
9985  break; \
9986  case ::testing::internal::DeathTest::EXECUTE_TEST: { \
9987  ::testing::internal::DeathTest::ReturnSentinel gtest_sentinel( \
9988  gtest_dt); \
9989  GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \
9990  gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
9991  break; \
9992  } \
9993  default: \
9994  break; \
9995  } \
9996  } \
9997  } else \
9998  GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__) \
9999  : fail(::testing::internal::DeathTest::LastMessage())
10000 // The symbol "fail" here expands to something into which a message
10001 // can be streamed.
10002 
10003 // This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
10004 // NDEBUG mode. In this case we need the statements to be executed and the macro
10005 // must accept a streamed message even though the message is never printed.
10006 // The regex object is not evaluated, but it is used to prevent "unused"
10007 // warnings and to avoid an expression that doesn't compile in debug mode.
10008 #define GTEST_EXECUTE_STATEMENT_(statement, regex_or_matcher) \
10009  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
10010  if (::testing::internal::AlwaysTrue()) { \
10011  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
10012  } else if (!::testing::internal::AlwaysTrue()) { \
10013  ::testing::internal::MakeDeathTestMatcher(regex_or_matcher); \
10014  } else \
10015  ::testing::Message()
10016 
10017 // A class representing the parsed contents of the
10018 // --gtest_internal_run_death_test flag, as it existed when
10019 // RUN_ALL_TESTS was called.
10020 class InternalRunDeathTestFlag {
10021  public:
10022  InternalRunDeathTestFlag(const std::string& a_file,
10023  int a_line,
10024  int an_index,
10025  int a_write_fd)
10026  : file_(a_file), line_(a_line), index_(an_index),
10027  write_fd_(a_write_fd) {}
10028 
10029  ~InternalRunDeathTestFlag() {
10030  if (write_fd_ >= 0)
10031  posix::Close(write_fd_);
10032  }
10033 
10034  const std::string& file() const { return file_; }
10035  int line() const { return line_; }
10036  int index() const { return index_; }
10037  int write_fd() const { return write_fd_; }
10038 
10039  private:
10040  std::string file_;
10041  int line_;
10042  int index_;
10043  int write_fd_;
10044 
10045  GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
10046 };
10047 
10048 // Returns a newly created InternalRunDeathTestFlag object with fields
10049 // initialized from the GTEST_FLAG(internal_run_death_test) flag if
10050 // the flag is specified; otherwise returns NULL.
10051 InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
10052 
10053 #endif // GTEST_HAS_DEATH_TEST
10054 
10055 } // namespace internal
10056 } // namespace testing
10057 
10058 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
10059 
10060 namespace testing {
10061 
10062 // This flag controls the style of death tests. Valid values are "threadsafe",
10063 // meaning that the death test child process will re-execute the test binary
10064 // from the start, running only a single death test, or "fast",
10065 // meaning that the child process will execute the test logic immediately
10066 // after forking.
10067 GTEST_DECLARE_string_(death_test_style);
10068 
10069 #if GTEST_HAS_DEATH_TEST
10070 
10071 namespace internal {
10072 
10073 // Returns a Boolean value indicating whether the caller is currently
10074 // executing in the context of the death test child process. Tools such as
10075 // Valgrind heap checkers may need this to modify their behavior in death
10076 // tests. IMPORTANT: This is an internal utility. Using it may break the
10077 // implementation of death tests. User code MUST NOT use it.
10078 GTEST_API_ bool InDeathTestChild();
10079 
10080 } // namespace internal
10081 
10082 // The following macros are useful for writing death tests.
10083 
10084 // Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
10085 // executed:
10086 //
10087 // 1. It generates a warning if there is more than one active
10088 // thread. This is because it's safe to fork() or clone() only
10089 // when there is a single thread.
10090 //
10091 // 2. The parent process clone()s a sub-process and runs the death
10092 // test in it; the sub-process exits with code 0 at the end of the
10093 // death test, if it hasn't exited already.
10094 //
10095 // 3. The parent process waits for the sub-process to terminate.
10096 //
10097 // 4. The parent process checks the exit code and error message of
10098 // the sub-process.
10099 //
10100 // Examples:
10101 //
10102 // ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
10103 // for (int i = 0; i < 5; i++) {
10104 // EXPECT_DEATH(server.ProcessRequest(i),
10105 // "Invalid request .* in ProcessRequest()")
10106 // << "Failed to die on request " << i;
10107 // }
10108 //
10109 // ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
10110 //
10111 // bool KilledBySIGHUP(int exit_code) {
10112 // return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
10113 // }
10114 //
10115 // ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
10116 //
10117 // On the regular expressions used in death tests:
10118 //
10119 // GOOGLETEST_CM0005 DO NOT DELETE
10120 // On POSIX-compliant systems (*nix), we use the <regex.h> library,
10121 // which uses the POSIX extended regex syntax.
10122 //
10123 // On other platforms (e.g. Windows or Mac), we only support a simple regex
10124 // syntax implemented as part of Google Test. This limited
10125 // implementation should be enough most of the time when writing
10126 // death tests; though it lacks many features you can find in PCRE
10127 // or POSIX extended regex syntax. For example, we don't support
10128 // union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
10129 // repetition count ("x{5,7}"), among others.
10130 //
10131 // Below is the syntax that we do support. We chose it to be a
10132 // subset of both PCRE and POSIX extended regex, so it's easy to
10133 // learn wherever you come from. In the following: 'A' denotes a
10134 // literal character, period (.), or a single \\ escape sequence;
10135 // 'x' and 'y' denote regular expressions; 'm' and 'n' are for
10136 // natural numbers.
10137 //
10138 // c matches any literal character c
10139 // \\d matches any decimal digit
10140 // \\D matches any character that's not a decimal digit
10141 // \\f matches \f
10142 // \\n matches \n
10143 // \\r matches \r
10144 // \\s matches any ASCII whitespace, including \n
10145 // \\S matches any character that's not a whitespace
10146 // \\t matches \t
10147 // \\v matches \v
10148 // \\w matches any letter, _, or decimal digit
10149 // \\W matches any character that \\w doesn't match
10150 // \\c matches any literal character c, which must be a punctuation
10151 // . matches any single character except \n
10152 // A? matches 0 or 1 occurrences of A
10153 // A* matches 0 or many occurrences of A
10154 // A+ matches 1 or many occurrences of A
10155 // ^ matches the beginning of a string (not that of each line)
10156 // $ matches the end of a string (not that of each line)
10157 // xy matches x followed by y
10158 //
10159 // If you accidentally use PCRE or POSIX extended regex features
10160 // not implemented by us, you will get a run-time failure. In that
10161 // case, please try to rewrite your regular expression within the
10162 // above syntax.
10163 //
10164 // This implementation is *not* meant to be as highly tuned or robust
10165 // as a compiled regex library, but should perform well enough for a
10166 // death test, which already incurs significant overhead by launching
10167 // a child process.
10168 //
10169 // Known caveats:
10170 //
10171 // A "threadsafe" style death test obtains the path to the test
10172 // program from argv[0] and re-executes it in the sub-process. For
10173 // simplicity, the current implementation doesn't search the PATH
10174 // when launching the sub-process. This means that the user must
10175 // invoke the test program via a path that contains at least one
10176 // path separator (e.g. path/to/foo_test and
10177 // /absolute/path/to/bar_test are fine, but foo_test is not). This
10178 // is rarely a problem as people usually don't put the test binary
10179 // directory in PATH.
10180 //
10181 
10182 // Asserts that a given statement causes the program to exit, with an
10183 // integer exit status that satisfies predicate, and emitting error output
10184 // that matches regex.
10185 # define ASSERT_EXIT(statement, predicate, regex) \
10186  GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
10187 
10188 // Like ASSERT_EXIT, but continues on to successive tests in the
10189 // test suite, if any:
10190 # define EXPECT_EXIT(statement, predicate, regex) \
10191  GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
10192 
10193 // Asserts that a given statement causes the program to exit, either by
10194 // explicitly exiting with a nonzero exit code or being killed by a
10195 // signal, and emitting error output that matches regex.
10196 # define ASSERT_DEATH(statement, regex) \
10197  ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
10198 
10199 // Like ASSERT_DEATH, but continues on to successive tests in the
10200 // test suite, if any:
10201 # define EXPECT_DEATH(statement, regex) \
10202  EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
10203 
10204 // Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
10205 
10206 // Tests that an exit code describes a normal exit with a given exit code.
10207 class GTEST_API_ ExitedWithCode {
10208  public:
10209  explicit ExitedWithCode(int exit_code);
10210  bool operator()(int exit_status) const;
10211  private:
10212  // No implementation - assignment is unsupported.
10213  void operator=(const ExitedWithCode& other);
10214 
10215  const int exit_code_;
10216 };
10217 
10218 # if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
10219 // Tests that an exit code describes an exit due to termination by a
10220 // given signal.
10221 // GOOGLETEST_CM0006 DO NOT DELETE
10222 class GTEST_API_ KilledBySignal {
10223  public:
10224  explicit KilledBySignal(int signum);
10225  bool operator()(int exit_status) const;
10226  private:
10227  const int signum_;
10228 };
10229 # endif // !GTEST_OS_WINDOWS
10230 
10231 // EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
10232 // The death testing framework causes this to have interesting semantics,
10233 // since the sideeffects of the call are only visible in opt mode, and not
10234 // in debug mode.
10235 //
10236 // In practice, this can be used to test functions that utilize the
10237 // LOG(DFATAL) macro using the following style:
10238 //
10239 // int DieInDebugOr12(int* sideeffect) {
10240 // if (sideeffect) {
10241 // *sideeffect = 12;
10242 // }
10243 // LOG(DFATAL) << "death";
10244 // return 12;
10245 // }
10246 //
10247 // TEST(TestSuite, TestDieOr12WorksInDgbAndOpt) {
10248 // int sideeffect = 0;
10249 // // Only asserts in dbg.
10250 // EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
10251 //
10252 // #ifdef NDEBUG
10253 // // opt-mode has sideeffect visible.
10254 // EXPECT_EQ(12, sideeffect);
10255 // #else
10256 // // dbg-mode no visible sideeffect.
10257 // EXPECT_EQ(0, sideeffect);
10258 // #endif
10259 // }
10260 //
10261 // This will assert that DieInDebugReturn12InOpt() crashes in debug
10262 // mode, usually due to a DCHECK or LOG(DFATAL), but returns the
10263 // appropriate fallback value (12 in this case) in opt mode. If you
10264 // need to test that a function has appropriate side-effects in opt
10265 // mode, include assertions against the side-effects. A general
10266 // pattern for this is:
10267 //
10268 // EXPECT_DEBUG_DEATH({
10269 // // Side-effects here will have an effect after this statement in
10270 // // opt mode, but none in debug mode.
10271 // EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
10272 // }, "death");
10273 //
10274 # ifdef NDEBUG
10275 
10276 # define EXPECT_DEBUG_DEATH(statement, regex) \
10277  GTEST_EXECUTE_STATEMENT_(statement, regex)
10278 
10279 # define ASSERT_DEBUG_DEATH(statement, regex) \
10280  GTEST_EXECUTE_STATEMENT_(statement, regex)
10281 
10282 # else
10283 
10284 # define EXPECT_DEBUG_DEATH(statement, regex) \
10285  EXPECT_DEATH(statement, regex)
10286 
10287 # define ASSERT_DEBUG_DEATH(statement, regex) \
10288  ASSERT_DEATH(statement, regex)
10289 
10290 # endif // NDEBUG for EXPECT_DEBUG_DEATH
10291 #endif // GTEST_HAS_DEATH_TEST
10292 
10293 // This macro is used for implementing macros such as
10294 // EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
10295 // death tests are not supported. Those macros must compile on such systems
10296 // iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
10297 // systems that support death tests. This allows one to write such a macro
10298 // on a system that does not support death tests and be sure that it will
10299 // compile on a death-test supporting system. It is exposed publicly so that
10300 // systems that have death-tests with stricter requirements than
10301 // GTEST_HAS_DEATH_TEST can write their own equivalent of
10302 // EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED.
10303 //
10304 // Parameters:
10305 // statement - A statement that a macro such as EXPECT_DEATH would test
10306 // for program termination. This macro has to make sure this
10307 // statement is compiled but not executed, to ensure that
10308 // EXPECT_DEATH_IF_SUPPORTED compiles with a certain
10309 // parameter iff EXPECT_DEATH compiles with it.
10310 // regex - A regex that a macro such as EXPECT_DEATH would use to test
10311 // the output of statement. This parameter has to be
10312 // compiled but not evaluated by this macro, to ensure that
10313 // this macro only accepts expressions that a macro such as
10314 // EXPECT_DEATH would accept.
10315 // terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
10316 // and a return statement for ASSERT_DEATH_IF_SUPPORTED.
10317 // This ensures that ASSERT_DEATH_IF_SUPPORTED will not
10318 // compile inside functions where ASSERT_DEATH doesn't
10319 // compile.
10320 //
10321 // The branch that has an always false condition is used to ensure that
10322 // statement and regex are compiled (and thus syntactically correct) but
10323 // never executed. The unreachable code macro protects the terminator
10324 // statement from generating an 'unreachable code' warning in case
10325 // statement unconditionally returns or throws. The Message constructor at
10326 // the end allows the syntax of streaming additional messages into the
10327 // macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
10328 # define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
10329  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
10330  if (::testing::internal::AlwaysTrue()) { \
10331  GTEST_LOG_(WARNING) \
10332  << "Death tests are not supported on this platform.\n" \
10333  << "Statement '" #statement "' cannot be verified."; \
10334  } else if (::testing::internal::AlwaysFalse()) { \
10335  ::testing::internal::RE::PartialMatch(".*", (regex)); \
10336  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
10337  terminator; \
10338  } else \
10339  ::testing::Message()
10340 
10341 // EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
10342 // ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
10343 // death tests are supported; otherwise they just issue a warning. This is
10344 // useful when you are combining death test assertions with normal test
10345 // assertions in one test.
10346 #if GTEST_HAS_DEATH_TEST
10347 # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
10348  EXPECT_DEATH(statement, regex)
10349 # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
10350  ASSERT_DEATH(statement, regex)
10351 #else
10352 # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
10353  GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, )
10354 # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
10355  GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return)
10356 #endif
10357 
10358 } // namespace testing
10359 
10360 #endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
10361 // This file was GENERATED by command:
10362 // pump.py gtest-param-test.h.pump
10363 // DO NOT EDIT BY HAND!!!
10364 
10365 // Copyright 2008, Google Inc.
10366 // All rights reserved.
10367 //
10368 // Redistribution and use in source and binary forms, with or without
10369 // modification, are permitted provided that the following conditions are
10370 // met:
10371 //
10372 // * Redistributions of source code must retain the above copyright
10373 // notice, this list of conditions and the following disclaimer.
10374 // * Redistributions in binary form must reproduce the above
10375 // copyright notice, this list of conditions and the following disclaimer
10376 // in the documentation and/or other materials provided with the
10377 // distribution.
10378 // * Neither the name of Google Inc. nor the names of its
10379 // contributors may be used to endorse or promote products derived from
10380 // this software without specific prior written permission.
10381 //
10382 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
10383 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
10384 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
10385 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
10386 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10387 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10388 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10389 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
10390 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
10391 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
10392 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10393 //
10394 // Macros and functions for implementing parameterized tests
10395 // in Google C++ Testing and Mocking Framework (Google Test)
10396 //
10397 // This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
10398 //
10399 // GOOGLETEST_CM0001 DO NOT DELETE
10400 #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
10401 #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
10402 
10403 
10404 // Value-parameterized tests allow you to test your code with different
10405 // parameters without writing multiple copies of the same test.
10406 //
10407 // Here is how you use value-parameterized tests:
10408 
10409 #if 0
10410 
10411 // To write value-parameterized tests, first you should define a fixture
10412 // class. It is usually derived from testing::TestWithParam<T> (see below for
10413 // another inheritance scheme that's sometimes useful in more complicated
10414 // class hierarchies), where the type of your parameter values.
10415 // TestWithParam<T> is itself derived from testing::Test. T can be any
10416 // copyable type. If it's a raw pointer, you are responsible for managing the
10417 // lifespan of the pointed values.
10418 
10419 class FooTest : public ::testing::TestWithParam<const char*> {
10420  // You can implement all the usual class fixture members here.
10421 };
10422 
10423 // Then, use the TEST_P macro to define as many parameterized tests
10424 // for this fixture as you want. The _P suffix is for "parameterized"
10425 // or "pattern", whichever you prefer to think.
10426 
10427 TEST_P(FooTest, DoesBlah) {
10428  // Inside a test, access the test parameter with the GetParam() method
10429  // of the TestWithParam<T> class:
10430  EXPECT_TRUE(foo.Blah(GetParam()));
10431  ...
10432 }
10433 
10434 TEST_P(FooTest, HasBlahBlah) {
10435  ...
10436 }
10437 
10438 // Finally, you can use INSTANTIATE_TEST_SUITE_P to instantiate the test
10439 // case with any set of parameters you want. Google Test defines a number
10440 // of functions for generating test parameters. They return what we call
10441 // (surprise!) parameter generators. Here is a summary of them, which
10442 // are all in the testing namespace:
10443 //
10444 //
10445 // Range(begin, end [, step]) - Yields values {begin, begin+step,
10446 // begin+step+step, ...}. The values do not
10447 // include end. step defaults to 1.
10448 // Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
10449 // ValuesIn(container) - Yields values from a C-style array, an STL
10450 // ValuesIn(begin,end) container, or an iterator range [begin, end).
10451 // Bool() - Yields sequence {false, true}.
10452 // Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
10453 // for the math savvy) of the values generated
10454 // by the N generators.
10455 //
10456 // For more details, see comments at the definitions of these functions below
10457 // in this file.
10458 //
10459 // The following statement will instantiate tests from the FooTest test suite
10460 // each with parameter values "meeny", "miny", and "moe".
10461 
10462 INSTANTIATE_TEST_SUITE_P(InstantiationName,
10463  FooTest,
10464  Values("meeny", "miny", "moe"));
10465 
10466 // To distinguish different instances of the pattern, (yes, you
10467 // can instantiate it more then once) the first argument to the
10468 // INSTANTIATE_TEST_SUITE_P macro is a prefix that will be added to the
10469 // actual test suite name. Remember to pick unique prefixes for different
10470 // instantiations. The tests from the instantiation above will have
10471 // these names:
10472 //
10473 // * InstantiationName/FooTest.DoesBlah/0 for "meeny"
10474 // * InstantiationName/FooTest.DoesBlah/1 for "miny"
10475 // * InstantiationName/FooTest.DoesBlah/2 for "moe"
10476 // * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
10477 // * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
10478 // * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
10479 //
10480 // You can use these names in --gtest_filter.
10481 //
10482 // This statement will instantiate all tests from FooTest again, each
10483 // with parameter values "cat" and "dog":
10484 
10485 const char* pets[] = {"cat", "dog"};
10486 INSTANTIATE_TEST_SUITE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
10487 
10488 // The tests from the instantiation above will have these names:
10489 //
10490 // * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
10491 // * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
10492 // * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
10493 // * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
10494 //
10495 // Please note that INSTANTIATE_TEST_SUITE_P will instantiate all tests
10496 // in the given test suite, whether their definitions come before or
10497 // AFTER the INSTANTIATE_TEST_SUITE_P statement.
10498 //
10499 // Please also note that generator expressions (including parameters to the
10500 // generators) are evaluated in InitGoogleTest(), after main() has started.
10501 // This allows the user on one hand, to adjust generator parameters in order
10502 // to dynamically determine a set of tests to run and on the other hand,
10503 // give the user a chance to inspect the generated tests with Google Test
10504 // reflection API before RUN_ALL_TESTS() is executed.
10505 //
10506 // You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
10507 // for more examples.
10508 //
10509 // In the future, we plan to publish the API for defining new parameter
10510 // generators. But for now this interface remains part of the internal
10511 // implementation and is subject to change.
10512 //
10513 //
10514 // A parameterized test fixture must be derived from testing::Test and from
10515 // testing::WithParamInterface<T>, where T is the type of the parameter
10516 // values. Inheriting from TestWithParam<T> satisfies that requirement because
10517 // TestWithParam<T> inherits from both Test and WithParamInterface. In more
10518 // complicated hierarchies, however, it is occasionally useful to inherit
10519 // separately from Test and WithParamInterface. For example:
10520 
10521 class BaseTest : public ::testing::Test {
10522  // You can inherit all the usual members for a non-parameterized test
10523  // fixture here.
10524 };
10525 
10526 class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
10527  // The usual test fixture members go here too.
10528 };
10529 
10530 TEST_F(BaseTest, HasFoo) {
10531  // This is an ordinary non-parameterized test.
10532 }
10533 
10534 TEST_P(DerivedTest, DoesBlah) {
10535  // GetParam works just the same here as if you inherit from TestWithParam.
10536  EXPECT_TRUE(foo.Blah(GetParam()));
10537 }
10538 
10539 #endif // 0
10540 
10541 #include <utility>
10542 
10543 // Copyright 2008 Google Inc.
10544 // All Rights Reserved.
10545 //
10546 // Redistribution and use in source and binary forms, with or without
10547 // modification, are permitted provided that the following conditions are
10548 // met:
10549 //
10550 // * Redistributions of source code must retain the above copyright
10551 // notice, this list of conditions and the following disclaimer.
10552 // * Redistributions in binary form must reproduce the above
10553 // copyright notice, this list of conditions and the following disclaimer
10554 // in the documentation and/or other materials provided with the
10555 // distribution.
10556 // * Neither the name of Google Inc. nor the names of its
10557 // contributors may be used to endorse or promote products derived from
10558 // this software without specific prior written permission.
10559 //
10560 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
10561 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
10562 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
10563 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
10564 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10565 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10566 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10567 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
10568 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
10569 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
10570 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10571 
10572 
10573 // Type and function utilities for implementing parameterized tests.
10574 
10575 // GOOGLETEST_CM0001 DO NOT DELETE
10576 
10577 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
10578 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
10579 
10580 #include <ctype.h>
10581 
10582 #include <iterator>
10583 #include <memory>
10584 #include <set>
10585 #include <tuple>
10586 #include <utility>
10587 #include <vector>
10588 
10589 
10590 namespace testing {
10591 // Input to a parameterized test name generator, describing a test parameter.
10592 // Consists of the parameter value and the integer parameter index.
10593 template <class ParamType>
10595  TestParamInfo(const ParamType& a_param, size_t an_index) :
10596  param(a_param),
10597  index(an_index) {}
10598  ParamType param;
10599  size_t index;
10600 };
10601 
10602 // A builtin parameterized test name generator which returns the result of
10603 // testing::PrintToString.
10605  template <class ParamType>
10607  return PrintToString(info.param);
10608  }
10609 };
10610 
10611 namespace internal {
10612 
10613 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10614 // Utility Functions
10615 
10616 // Outputs a message explaining invalid registration of different
10617 // fixture class for the same test suite. This may happen when
10618 // TEST_P macro is used to define two tests with the same name
10619 // but in different namespaces.
10620 GTEST_API_ void ReportInvalidTestSuiteType(const char* test_suite_name,
10621  CodeLocation code_location);
10622 
10623 template <typename> class ParamGeneratorInterface;
10624 template <typename> class ParamGenerator;
10625 
10626 // Interface for iterating over elements provided by an implementation
10627 // of ParamGeneratorInterface<T>.
10628 template <typename T>
10630  public:
10632  // A pointer to the base generator instance.
10633  // Used only for the purposes of iterator comparison
10634  // to make sure that two iterators belong to the same generator.
10635  virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;
10636  // Advances iterator to point to the next element
10637  // provided by the generator. The caller is responsible
10638  // for not calling Advance() on an iterator equal to
10639  // BaseGenerator()->End().
10640  virtual void Advance() = 0;
10641  // Clones the iterator object. Used for implementing copy semantics
10642  // of ParamIterator<T>.
10643  virtual ParamIteratorInterface* Clone() const = 0;
10644  // Dereferences the current iterator and provides (read-only) access
10645  // to the pointed value. It is the caller's responsibility not to call
10646  // Current() on an iterator equal to BaseGenerator()->End().
10647  // Used for implementing ParamGenerator<T>::operator*().
10648  virtual const T* Current() const = 0;
10649  // Determines whether the given iterator and other point to the same
10650  // element in the sequence generated by the generator.
10651  // Used for implementing ParamGenerator<T>::operator==().
10652  virtual bool Equals(const ParamIteratorInterface& other) const = 0;
10653 };
10654 
10655 // Class iterating over elements provided by an implementation of
10656 // ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>
10657 // and implements the const forward iterator concept.
10658 template <typename T>
10660  public:
10661  typedef T value_type;
10662  typedef const T& reference;
10664 
10665  // ParamIterator assumes ownership of the impl_ pointer.
10666  ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
10668  if (this != &other)
10669  impl_.reset(other.impl_->Clone());
10670  return *this;
10671  }
10672 
10673  const T& operator*() const { return *impl_->Current(); }
10674  const T* operator->() const { return impl_->Current(); }
10675  // Prefix version of operator++.
10677  impl_->Advance();
10678  return *this;
10679  }
10680  // Postfix version of operator++.
10681  ParamIterator operator++(int /*unused*/) {
10682  ParamIteratorInterface<T>* clone = impl_->Clone();
10683  impl_->Advance();
10684  return ParamIterator(clone);
10685  }
10686  bool operator==(const ParamIterator& other) const {
10687  return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
10688  }
10689  bool operator!=(const ParamIterator& other) const {
10690  return !(*this == other);
10691  }
10692 
10693  private:
10694  friend class ParamGenerator<T>;
10695  explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
10696  std::unique_ptr<ParamIteratorInterface<T> > impl_;
10697 };
10698 
10699 // ParamGeneratorInterface<T> is the binary interface to access generators
10700 // defined in other translation units.
10701 template <typename T>
10702 class ParamGeneratorInterface {
10703  public:
10704  typedef T ParamType;
10705 
10707 
10708  // Generator interface definition
10709  virtual ParamIteratorInterface<T>* Begin() const = 0;
10710  virtual ParamIteratorInterface<T>* End() const = 0;
10711 };
10712 
10713 // Wraps ParamGeneratorInterface<T> and provides general generator syntax
10714 // compatible with the STL Container concept.
10715 // This class implements copy initialization semantics and the contained
10716 // ParamGeneratorInterface<T> instance is shared among all copies
10717 // of the original object. This is possible because that instance is immutable.
10718 template<typename T>
10719 class ParamGenerator {
10720  public:
10722 
10723  explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}
10724  ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}
10725 
10727  impl_ = other.impl_;
10728  return *this;
10729  }
10730 
10731  iterator begin() const { return iterator(impl_->Begin()); }
10732  iterator end() const { return iterator(impl_->End()); }
10733 
10734  private:
10735  std::shared_ptr<const ParamGeneratorInterface<T> > impl_;
10736 };
10737 
10738 // Generates values from a range of two comparable values. Can be used to
10739 // generate sequences of user-defined types that implement operator+() and
10740 // operator<().
10741 // This class is used in the Range() function.
10742 template <typename T, typename IncrementT>
10744  public:
10745  RangeGenerator(T begin, T end, IncrementT step)
10746  : begin_(begin), end_(end),
10747  step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
10748  ~RangeGenerator() override {}
10749 
10750  ParamIteratorInterface<T>* Begin() const override {
10751  return new Iterator(this, begin_, 0, step_);
10752  }
10753  ParamIteratorInterface<T>* End() const override {
10754  return new Iterator(this, end_, end_index_, step_);
10755  }
10756 
10757  private:
10758  class Iterator : public ParamIteratorInterface<T> {
10759  public:
10760  Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
10761  IncrementT step)
10762  : base_(base), value_(value), index_(index), step_(step) {}
10763  ~Iterator() override {}
10764 
10765  const ParamGeneratorInterface<T>* BaseGenerator() const override {
10766  return base_;
10767  }
10768  void Advance() override {
10769  value_ = static_cast<T>(value_ + step_);
10770  index_++;
10771  }
10772  ParamIteratorInterface<T>* Clone() const override {
10773  return new Iterator(*this);
10774  }
10775  const T* Current() const override { return &value_; }
10776  bool Equals(const ParamIteratorInterface<T>& other) const override {
10777  // Having the same base generator guarantees that the other
10778  // iterator is of the same type and we can downcast.
10779  GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
10780  << "The program attempted to compare iterators "
10781  << "from different generators." << std::endl;
10782  const int other_index =
10783  CheckedDowncastToActualType<const Iterator>(&other)->index_;
10784  return index_ == other_index;
10785  }
10786 
10787  private:
10788  Iterator(const Iterator& other)
10789  : ParamIteratorInterface<T>(),
10790  base_(other.base_), value_(other.value_), index_(other.index_),
10791  step_(other.step_) {}
10792 
10793  // No implementation - assignment is unsupported.
10794  void operator=(const Iterator& other);
10795 
10796  const ParamGeneratorInterface<T>* const base_;
10797  T value_;
10798  int index_;
10799  const IncrementT step_;
10800  }; // class RangeGenerator::Iterator
10801 
10802  static int CalculateEndIndex(const T& begin,
10803  const T& end,
10804  const IncrementT& step) {
10805  int end_index = 0;
10806  for (T i = begin; i < end; i = static_cast<T>(i + step))
10807  end_index++;
10808  return end_index;
10809  }
10810 
10811  // No implementation - assignment is unsupported.
10812  void operator=(const RangeGenerator& other);
10813 
10814  const T begin_;
10815  const T end_;
10816  const IncrementT step_;
10817  // The index for the end() iterator. All the elements in the generated
10818  // sequence are indexed (0-based) to aid iterator comparison.
10819  const int end_index_;
10820 }; // class RangeGenerator
10821 
10822 
10823 // Generates values from a pair of STL-style iterators. Used in the
10824 // ValuesIn() function. The elements are copied from the source range
10825 // since the source can be located on the stack, and the generator
10826 // is likely to persist beyond that stack frame.
10827 template <typename T>
10829  public:
10830  template <typename ForwardIterator>
10831  ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
10832  : container_(begin, end) {}
10834 
10835  ParamIteratorInterface<T>* Begin() const override {
10836  return new Iterator(this, container_.begin());
10837  }
10838  ParamIteratorInterface<T>* End() const override {
10839  return new Iterator(this, container_.end());
10840  }
10841 
10842  private:
10843  typedef typename ::std::vector<T> ContainerType;
10844 
10845  class Iterator : public ParamIteratorInterface<T> {
10846  public:
10847  Iterator(const ParamGeneratorInterface<T>* base,
10848  typename ContainerType::const_iterator iterator)
10849  : base_(base), iterator_(iterator) {}
10850  ~Iterator() override {}
10851 
10852  const ParamGeneratorInterface<T>* BaseGenerator() const override {
10853  return base_;
10854  }
10855  void Advance() override {
10856  ++iterator_;
10857  value_.reset();
10858  }
10859  ParamIteratorInterface<T>* Clone() const override {
10860  return new Iterator(*this);
10861  }
10862  // We need to use cached value referenced by iterator_ because *iterator_
10863  // can return a temporary object (and of type other then T), so just
10864  // having "return &*iterator_;" doesn't work.
10865  // value_ is updated here and not in Advance() because Advance()
10866  // can advance iterator_ beyond the end of the range, and we cannot
10867  // detect that fact. The client code, on the other hand, is
10868  // responsible for not calling Current() on an out-of-range iterator.
10869  const T* Current() const override {
10870  if (value_.get() == nullptr) value_.reset(new T(*iterator_));
10871  return value_.get();
10872  }
10873  bool Equals(const ParamIteratorInterface<T>& other) const override {
10874  // Having the same base generator guarantees that the other
10875  // iterator is of the same type and we can downcast.
10876  GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
10877  << "The program attempted to compare iterators "
10878  << "from different generators." << std::endl;
10879  return iterator_ ==
10880  CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
10881  }
10882 
10883  private:
10884  Iterator(const Iterator& other)
10885  // The explicit constructor call suppresses a false warning
10886  // emitted by gcc when supplied with the -Wextra option.
10887  : ParamIteratorInterface<T>(),
10888  base_(other.base_),
10889  iterator_(other.iterator_) {}
10890 
10891  const ParamGeneratorInterface<T>* const base_;
10892  typename ContainerType::const_iterator iterator_;
10893  // A cached value of *iterator_. We keep it here to allow access by
10894  // pointer in the wrapping iterator's operator->().
10895  // value_ needs to be mutable to be accessed in Current().
10896  // Use of std::unique_ptr helps manage cached value's lifetime,
10897  // which is bound by the lifespan of the iterator itself.
10898  mutable std::unique_ptr<const T> value_;
10899  }; // class ValuesInIteratorRangeGenerator::Iterator
10900 
10901  // No implementation - assignment is unsupported.
10902  void operator=(const ValuesInIteratorRangeGenerator& other);
10903 
10904  const ContainerType container_;
10905 }; // class ValuesInIteratorRangeGenerator
10906 
10907 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10908 //
10909 // Default parameterized test name generator, returns a string containing the
10910 // integer test parameter index.
10911 template <class ParamType>
10913  Message name_stream;
10914  name_stream << info.index;
10915  return name_stream.GetString();
10916 }
10917 
10918 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10919 //
10920 // Parameterized test name overload helpers, which help the
10921 // INSTANTIATE_TEST_SUITE_P macro choose between the default parameterized
10922 // test name generator and user param name generator.
10923 template <class ParamType, class ParamNameGenFunctor>
10924 ParamNameGenFunctor GetParamNameGen(ParamNameGenFunctor func) {
10925  return func;
10926 }
10927 
10928 template <class ParamType>
10931 };
10932 
10933 template <class ParamType>
10935  return &DefaultParamName;
10936 }
10937 
10938 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10939 //
10940 // Stores a parameter value and later creates tests parameterized with that
10941 // value.
10942 template <class TestClass>
10944  public:
10945  typedef typename TestClass::ParamType ParamType;
10946  explicit ParameterizedTestFactory(ParamType parameter) :
10947  parameter_(parameter) {}
10948  Test* CreateTest() override {
10949  TestClass::SetParam(&parameter_);
10950  return new TestClass();
10951  }
10952 
10953  private:
10954  const ParamType parameter_;
10955 
10956  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
10957 };
10958 
10959 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10960 //
10961 // TestMetaFactoryBase is a base class for meta-factories that create
10962 // test factories for passing into MakeAndRegisterTestInfo function.
10963 template <class ParamType>
10965  public:
10967 
10968  virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
10969 };
10970 
10971 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10972 //
10973 // TestMetaFactory creates test factories for passing into
10974 // MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives
10975 // ownership of test factory pointer, same factory object cannot be passed
10976 // into that method twice. But ParameterizedTestSuiteInfo is going to call
10977 // it for each Test/Parameter value combination. Thus it needs meta factory
10978 // creator class.
10979 template <class TestSuite>
10981  : public TestMetaFactoryBase<typename TestSuite::ParamType> {
10982  public:
10983  using ParamType = typename TestSuite::ParamType;
10984 
10986 
10988  return new ParameterizedTestFactory<TestSuite>(parameter);
10989  }
10990 
10991  private:
10992  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
10993 };
10994 
10995 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10996 //
10997 // ParameterizedTestSuiteInfoBase is a generic interface
10998 // to ParameterizedTestSuiteInfo classes. ParameterizedTestSuiteInfoBase
10999 // accumulates test information provided by TEST_P macro invocations
11000 // and generators provided by INSTANTIATE_TEST_SUITE_P macro invocations
11001 // and uses that information to register all resulting test instances
11002 // in RegisterTests method. The ParameterizeTestSuiteRegistry class holds
11003 // a collection of pointers to the ParameterizedTestSuiteInfo objects
11004 // and calls RegisterTests() on each of them when asked.
11006  public:
11008 
11009  // Base part of test suite name for display purposes.
11010  virtual const std::string& GetTestSuiteName() const = 0;
11011  // Test case id to verify identity.
11012  virtual TypeId GetTestSuiteTypeId() const = 0;
11013  // UnitTest class invokes this method to register tests in this
11014  // test suite right before running them in RUN_ALL_TESTS macro.
11015  // This method should not be called more then once on any single
11016  // instance of a ParameterizedTestSuiteInfoBase derived class.
11017  virtual void RegisterTests() = 0;
11018 
11019  protected:
11021 
11022  private:
11023  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfoBase);
11024 };
11025 
11026 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11027 //
11028 // ParameterizedTestSuiteInfo accumulates tests obtained from TEST_P
11029 // macro invocations for a particular test suite and generators
11030 // obtained from INSTANTIATE_TEST_SUITE_P macro invocations for that
11031 // test suite. It registers tests with all values generated by all
11032 // generators when asked.
11033 template <class TestSuite>
11035  public:
11036  // ParamType and GeneratorCreationFunc are private types but are required
11037  // for declarations of public methods AddTestPattern() and
11038  // AddTestSuiteInstantiation().
11039  using ParamType = typename TestSuite::ParamType;
11040  // A function that returns an instance of appropriate generator type.
11041  typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
11043 
11044  explicit ParameterizedTestSuiteInfo(const char* name,
11045  CodeLocation code_location)
11046  : test_suite_name_(name), code_location_(code_location) {}
11047 
11048  // Test case base name for display purposes.
11049  const std::string& GetTestSuiteName() const override {
11050  return test_suite_name_;
11051  }
11052  // Test case id to verify identity.
11053  TypeId GetTestSuiteTypeId() const override { return GetTypeId<TestSuite>(); }
11054  // TEST_P macro uses AddTestPattern() to record information
11055  // about a single test in a LocalTestInfo structure.
11056  // test_suite_name is the base name of the test suite (without invocation
11057  // prefix). test_base_name is the name of an individual test without
11058  // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
11059  // test suite base name and DoBar is test base name.
11060  void AddTestPattern(const char* test_suite_name, const char* test_base_name,
11061  TestMetaFactoryBase<ParamType>* meta_factory) {
11062  tests_.push_back(std::shared_ptr<TestInfo>(
11063  new TestInfo(test_suite_name, test_base_name, meta_factory)));
11064  }
11065  // INSTANTIATE_TEST_SUITE_P macro uses AddGenerator() to record information
11066  // about a generator.
11067  int AddTestSuiteInstantiation(const std::string& instantiation_name,
11068  GeneratorCreationFunc* func,
11069  ParamNameGeneratorFunc* name_func,
11070  const char* file, int line) {
11071  instantiations_.push_back(
11072  InstantiationInfo(instantiation_name, func, name_func, file, line));
11073  return 0; // Return value used only to run this method in namespace scope.
11074  }
11075  // UnitTest class invokes this method to register tests in this test suite
11076  // test suites right before running tests in RUN_ALL_TESTS macro.
11077  // This method should not be called more then once on any single
11078  // instance of a ParameterizedTestSuiteInfoBase derived class.
11079  // UnitTest has a guard to prevent from calling this method more then once.
11080  void RegisterTests() override {
11081  for (typename TestInfoContainer::iterator test_it = tests_.begin();
11082  test_it != tests_.end(); ++test_it) {
11083  std::shared_ptr<TestInfo> test_info = *test_it;
11084  for (typename InstantiationContainer::iterator gen_it =
11085  instantiations_.begin(); gen_it != instantiations_.end();
11086  ++gen_it) {
11087  const std::string& instantiation_name = gen_it->name;
11088  ParamGenerator<ParamType> generator((*gen_it->generator)());
11089  ParamNameGeneratorFunc* name_func = gen_it->name_func;
11090  const char* file = gen_it->file;
11091  int line = gen_it->line;
11092 
11093  std::string test_suite_name;
11094  if ( !instantiation_name.empty() )
11095  test_suite_name = instantiation_name + "/";
11096  test_suite_name += test_info->test_suite_base_name;
11097 
11098  size_t i = 0;
11099  std::set<std::string> test_param_names;
11100  for (typename ParamGenerator<ParamType>::iterator param_it =
11101  generator.begin();
11102  param_it != generator.end(); ++param_it, ++i) {
11103  Message test_name_stream;
11104 
11105  std::string param_name = name_func(
11106  TestParamInfo<ParamType>(*param_it, i));
11107 
11108  GTEST_CHECK_(IsValidParamName(param_name))
11109  << "Parameterized test name '" << param_name
11110  << "' is invalid, in " << file
11111  << " line " << line << std::endl;
11112 
11113  GTEST_CHECK_(test_param_names.count(param_name) == 0)
11114  << "Duplicate parameterized test name '" << param_name
11115  << "', in " << file << " line " << line << std::endl;
11116 
11117  test_param_names.insert(param_name);
11118 
11119  test_name_stream << test_info->test_base_name << "/" << param_name;
11121  test_suite_name.c_str(), test_name_stream.GetString().c_str(),
11122  nullptr, // No type parameter.
11123  PrintToString(*param_it).c_str(), code_location_,
11127  test_info->test_meta_factory->CreateTestFactory(*param_it));
11128  } // for param_it
11129  } // for gen_it
11130  } // for test_it
11131  } // RegisterTests
11132 
11133  private:
11134  // LocalTestInfo structure keeps information about a single test registered
11135  // with TEST_P macro.
11136  struct TestInfo {
11137  TestInfo(const char* a_test_suite_base_name, const char* a_test_base_name,
11138  TestMetaFactoryBase<ParamType>* a_test_meta_factory)
11139  : test_suite_base_name(a_test_suite_base_name),
11140  test_base_name(a_test_base_name),
11141  test_meta_factory(a_test_meta_factory) {}
11142 
11143  const std::string test_suite_base_name;
11144  const std::string test_base_name;
11145  const std::unique_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
11146  };
11147  using TestInfoContainer = ::std::vector<std::shared_ptr<TestInfo> >;
11148  // Records data received from INSTANTIATE_TEST_SUITE_P macros:
11149  // <Instantiation name, Sequence generator creation function,
11150  // Name generator function, Source file, Source line>
11151  struct InstantiationInfo {
11152  InstantiationInfo(const std::string &name_in,
11153  GeneratorCreationFunc* generator_in,
11154  ParamNameGeneratorFunc* name_func_in,
11155  const char* file_in,
11156  int line_in)
11157  : name(name_in),
11158  generator(generator_in),
11159  name_func(name_func_in),
11160  file(file_in),
11161  line(line_in) {}
11162 
11163  std::string name;
11164  GeneratorCreationFunc* generator;
11165  ParamNameGeneratorFunc* name_func;
11166  const char* file;
11167  int line;
11168  };
11169  typedef ::std::vector<InstantiationInfo> InstantiationContainer;
11170 
11171  static bool IsValidParamName(const std::string& name) {
11172  // Check for empty string
11173  if (name.empty())
11174  return false;
11175 
11176  // Check for invalid characters
11177  for (std::string::size_type index = 0; index < name.size(); ++index) {
11178  if (!isalnum(name[index]) && name[index] != '_')
11179  return false;
11180  }
11181 
11182  return true;
11183  }
11184 
11185  const std::string test_suite_name_;
11186  CodeLocation code_location_;
11187  TestInfoContainer tests_;
11188  InstantiationContainer instantiations_;
11189 
11190  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfo);
11191 }; // class ParameterizedTestSuiteInfo
11192 
11193 // Legacy API is deprecated but still available
11194 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
11195 template <class TestCase>
11197 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
11198 
11199 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11200 //
11201 // ParameterizedTestSuiteRegistry contains a map of
11202 // ParameterizedTestSuiteInfoBase classes accessed by test suite names. TEST_P
11203 // and INSTANTIATE_TEST_SUITE_P macros use it to locate their corresponding
11204 // ParameterizedTestSuiteInfo descriptors.
11206  public:
11209  for (auto& test_suite_info : test_suite_infos_) {
11210  delete test_suite_info;
11211  }
11212  }
11213 
11214  // Looks up or creates and returns a structure containing information about
11215  // tests and instantiations of a particular test suite.
11216  template <class TestSuite>
11218  const char* test_suite_name, CodeLocation code_location) {
11219  ParameterizedTestSuiteInfo<TestSuite>* typed_test_info = nullptr;
11220  for (auto& test_suite_info : test_suite_infos_) {
11221  if (test_suite_info->GetTestSuiteName() == test_suite_name) {
11222  if (test_suite_info->GetTestSuiteTypeId() != GetTypeId<TestSuite>()) {
11223  // Complain about incorrect usage of Google Test facilities
11224  // and terminate the program since we cannot guaranty correct
11225  // test suite setup and tear-down in this case.
11226  ReportInvalidTestSuiteType(test_suite_name, code_location);
11227  posix::Abort();
11228  } else {
11229  // At this point we are sure that the object we found is of the same
11230  // type we are looking for, so we downcast it to that type
11231  // without further checks.
11232  typed_test_info = CheckedDowncastToActualType<
11233  ParameterizedTestSuiteInfo<TestSuite> >(test_suite_info);
11234  }
11235  break;
11236  }
11237  }
11238  if (typed_test_info == nullptr) {
11239  typed_test_info = new ParameterizedTestSuiteInfo<TestSuite>(
11240  test_suite_name, code_location);
11241  test_suite_infos_.push_back(typed_test_info);
11242  }
11243  return typed_test_info;
11244  }
11245  void RegisterTests() {
11246  for (auto& test_suite_info : test_suite_infos_) {
11247  test_suite_info->RegisterTests();
11248  }
11249  }
11250 // Legacy API is deprecated but still available
11251 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
11252  template <class TestCase>
11254  const char* test_case_name, CodeLocation code_location) {
11255  return GetTestSuitePatternHolder<TestCase>(test_case_name, code_location);
11256  }
11257 
11258 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
11259 
11260  private:
11261  using TestSuiteInfoContainer = ::std::vector<ParameterizedTestSuiteInfoBase*>;
11262 
11263  TestSuiteInfoContainer test_suite_infos_;
11264 
11265  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteRegistry);
11266 };
11267 
11268 } // namespace internal
11269 
11270 // Forward declarations of ValuesIn(), which is implemented in
11271 // include/gtest/gtest-param-test.h.
11272 template <class Container>
11273 internal::ParamGenerator<typename Container::value_type> ValuesIn(
11274  const Container& container);
11275 
11276 namespace internal {
11277 // Used in the Values() function to provide polymorphic capabilities.
11278 
11279 template <typename... Ts>
11280 class ValueArray {
11281  public:
11282  ValueArray(Ts... v) : v_{std::move(v)...} {}
11283 
11284  template <typename T>
11285  operator ParamGenerator<T>() const { // NOLINT
11286  return ValuesIn(MakeVector<T>(MakeIndexSequence<sizeof...(Ts)>()));
11287  }
11288 
11289  private:
11290  template <typename T, size_t... I>
11291  std::vector<T> MakeVector(IndexSequence<I...>) const {
11292  return std::vector<T>{static_cast<T>(v_.template Get<I>())...};
11293  }
11294 
11295  FlatTuple<Ts...> v_;
11296 };
11297 
11298 } // namespace internal
11299 } // namespace testing
11300 
11301 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
11302 // This file was GENERATED by command:
11303 // pump.py gtest-param-util-generated.h.pump
11304 // DO NOT EDIT BY HAND!!!
11305 
11306 // Copyright 2008 Google Inc.
11307 // All Rights Reserved.
11308 //
11309 // Redistribution and use in source and binary forms, with or without
11310 // modification, are permitted provided that the following conditions are
11311 // met:
11312 //
11313 // * Redistributions of source code must retain the above copyright
11314 // notice, this list of conditions and the following disclaimer.
11315 // * Redistributions in binary form must reproduce the above
11316 // copyright notice, this list of conditions and the following disclaimer
11317 // in the documentation and/or other materials provided with the
11318 // distribution.
11319 // * Neither the name of Google Inc. nor the names of its
11320 // contributors may be used to endorse or promote products derived from
11321 // this software without specific prior written permission.
11322 //
11323 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
11324 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
11325 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
11326 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
11327 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
11328 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11329 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11330 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11331 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11332 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
11333 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11334 
11335 
11336 // Type and function utilities for implementing parameterized tests.
11337 // This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
11338 //
11339 // Currently Google Test supports at most 50 arguments in Values,
11340 // and at most 10 arguments in Combine. Please contact
11341 // googletestframework@googlegroups.com if you need more.
11342 // Please note that the number of arguments to Combine is limited
11343 // by the maximum arity of the implementation of tuple which is
11344 // currently set at 10.
11345 
11346 // GOOGLETEST_CM0001 DO NOT DELETE
11347 
11348 #include <assert.h>
11349 
11350 #include <memory>
11351 
11352 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
11353 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
11354 
11355 
11356 namespace testing {
11357 
11358 namespace internal {
11359 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11360 //
11361 // Generates values from the Cartesian product of values produced
11362 // by the argument generators.
11363 //
11364 template <typename T1, typename T2>
11366  : public ParamGeneratorInterface< ::std::tuple<T1, T2> > {
11367  public:
11368  typedef ::std::tuple<T1, T2> ParamType;
11369 
11371  const ParamGenerator<T2>& g2)
11372  : g1_(g1), g2_(g2) {}
11374 
11376  return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin());
11377  }
11379  return new Iterator(this, g1_, g1_.end(), g2_, g2_.end());
11380  }
11381 
11382  private:
11383  class Iterator : public ParamIteratorInterface<ParamType> {
11384  public:
11385  Iterator(const ParamGeneratorInterface<ParamType>* base,
11386  const ParamGenerator<T1>& g1,
11387  const typename ParamGenerator<T1>::iterator& current1,
11388  const ParamGenerator<T2>& g2,
11389  const typename ParamGenerator<T2>::iterator& current2)
11390  : base_(base),
11391  begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
11392  begin2_(g2.begin()), end2_(g2.end()), current2_(current2) {
11393  ComputeCurrentValue();
11394  }
11395  ~Iterator() override {}
11396 
11397  const ParamGeneratorInterface<ParamType>* BaseGenerator() const override {
11398  return base_;
11399  }
11400  // Advance should not be called on beyond-of-range iterators
11401  // so no component iterators must be beyond end of range, either.
11402  void Advance() override {
11403  assert(!AtEnd());
11404  ++current2_;
11405  if (current2_ == end2_) {
11406  current2_ = begin2_;
11407  ++current1_;
11408  }
11409  ComputeCurrentValue();
11410  }
11411  ParamIteratorInterface<ParamType>* Clone() const override {
11412  return new Iterator(*this);
11413  }
11414  const ParamType* Current() const override { return current_value_.get(); }
11415  bool Equals(const ParamIteratorInterface<ParamType>& other) const override {
11416  // Having the same base generator guarantees that the other
11417  // iterator is of the same type and we can downcast.
11418  GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
11419  << "The program attempted to compare iterators "
11420  << "from different generators." << std::endl;
11421  const Iterator* typed_other =
11422  CheckedDowncastToActualType<const Iterator>(&other);
11423  // We must report iterators equal if they both point beyond their
11424  // respective ranges. That can happen in a variety of fashions,
11425  // so we have to consult AtEnd().
11426  return (AtEnd() && typed_other->AtEnd()) ||
11427  (
11428  current1_ == typed_other->current1_ &&
11429  current2_ == typed_other->current2_);
11430  }
11431 
11432  private:
11433  Iterator(const Iterator& other)
11434  : base_(other.base_),
11435  begin1_(other.begin1_),
11436  end1_(other.end1_),
11437  current1_(other.current1_),
11438  begin2_(other.begin2_),
11439  end2_(other.end2_),
11440  current2_(other.current2_) {
11441  ComputeCurrentValue();
11442  }
11443 
11444  void ComputeCurrentValue() {
11445  if (!AtEnd())
11446  current_value_.reset(new ParamType(*current1_, *current2_));
11447  }
11448  bool AtEnd() const {
11449  // We must report iterator past the end of the range when either of the
11450  // component iterators has reached the end of its range.
11451  return
11452  current1_ == end1_ ||
11453  current2_ == end2_;
11454  }
11455 
11456  // No implementation - assignment is unsupported.
11457  void operator=(const Iterator& other);
11458 
11459  const ParamGeneratorInterface<ParamType>* const base_;
11460  // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
11461  // current[i]_ is the actual traversing iterator.
11462  const typename ParamGenerator<T1>::iterator begin1_;
11463  const typename ParamGenerator<T1>::iterator end1_;
11464  typename ParamGenerator<T1>::iterator current1_;
11465  const typename ParamGenerator<T2>::iterator begin2_;
11466  const typename ParamGenerator<T2>::iterator end2_;
11467  typename ParamGenerator<T2>::iterator current2_;
11468  std::shared_ptr<ParamType> current_value_;
11469  }; // class CartesianProductGenerator2::Iterator
11470 
11471  // No implementation - assignment is unsupported.
11472  void operator=(const CartesianProductGenerator2& other);
11473 
11474  const ParamGenerator<T1> g1_;
11475  const ParamGenerator<T2> g2_;
11476 }; // class CartesianProductGenerator2
11477 
11478 
11479 template <typename T1, typename T2, typename T3>
11481  : public ParamGeneratorInterface< ::std::tuple<T1, T2, T3> > {
11482  public:
11483  typedef ::std::tuple<T1, T2, T3> ParamType;
11484 
11486  const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)
11487  : g1_(g1), g2_(g2), g3_(g3) {}
11489 
11491  return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
11492  g3_.begin());
11493  }
11495  return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end());
11496  }
11497 
11498  private:
11499  class Iterator : public ParamIteratorInterface<ParamType> {
11500  public:
11501  Iterator(const ParamGeneratorInterface<ParamType>* base,
11502  const ParamGenerator<T1>& g1,
11503  const typename ParamGenerator<T1>::iterator& current1,
11504  const ParamGenerator<T2>& g2,
11505  const typename ParamGenerator<T2>::iterator& current2,
11506  const ParamGenerator<T3>& g3,
11507  const typename ParamGenerator<T3>::iterator& current3)
11508  : base_(base),
11509  begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
11510  begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
11511  begin3_(g3.begin()), end3_(g3.end()), current3_(current3) {
11512  ComputeCurrentValue();
11513  }
11514  ~Iterator() override {}
11515 
11516  const ParamGeneratorInterface<ParamType>* BaseGenerator() const override {
11517  return base_;
11518  }
11519  // Advance should not be called on beyond-of-range iterators
11520  // so no component iterators must be beyond end of range, either.
11521  void Advance() override {
11522  assert(!AtEnd());
11523  ++current3_;
11524  if (current3_ == end3_) {
11525  current3_ = begin3_;
11526  ++current2_;
11527  }
11528  if (current2_ == end2_) {
11529  current2_ = begin2_;
11530  ++current1_;
11531  }
11532  ComputeCurrentValue();
11533  }
11534  ParamIteratorInterface<ParamType>* Clone() const override {
11535  return new Iterator(*this);
11536  }
11537  const ParamType* Current() const override { return current_value_.get(); }
11538  bool Equals(const ParamIteratorInterface<ParamType>& other) const override {
11539  // Having the same base generator guarantees that the other
11540  // iterator is of the same type and we can downcast.
11541  GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
11542  << "The program attempted to compare iterators "
11543  << "from different generators." << std::endl;
11544  const Iterator* typed_other =
11545  CheckedDowncastToActualType<const Iterator>(&other);
11546  // We must report iterators equal if they both point beyond their
11547  // respective ranges. That can happen in a variety of fashions,
11548  // so we have to consult AtEnd().
11549  return (AtEnd() && typed_other->AtEnd()) ||
11550  (
11551  current1_ == typed_other->current1_ &&
11552  current2_ == typed_other->current2_ &&
11553  current3_ == typed_other->current3_);
11554  }
11555 
11556  private:
11557  Iterator(const Iterator& other)
11558  : base_(other.base_),
11559  begin1_(other.begin1_),
11560  end1_(other.end1_),
11561  current1_(other.current1_),
11562  begin2_(other.begin2_),
11563  end2_(other.end2_),
11564  current2_(other.current2_),
11565  begin3_(other.begin3_),
11566  end3_(other.end3_),
11567  current3_(other.current3_) {
11568  ComputeCurrentValue();
11569  }
11570 
11571  void ComputeCurrentValue() {
11572  if (!AtEnd())
11573  current_value_.reset(new ParamType(*current1_, *current2_, *current3_));
11574  }
11575  bool AtEnd() const {
11576  // We must report iterator past the end of the range when either of the
11577  // component iterators has reached the end of its range.
11578  return
11579  current1_ == end1_ ||
11580  current2_ == end2_ ||
11581  current3_ == end3_;
11582  }
11583 
11584  // No implementation - assignment is unsupported.
11585  void operator=(const Iterator& other);
11586 
11587  const ParamGeneratorInterface<ParamType>* const base_;
11588  // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
11589  // current[i]_ is the actual traversing iterator.
11590  const typename ParamGenerator<T1>::iterator begin1_;
11591  const typename ParamGenerator<T1>::iterator end1_;
11592  typename ParamGenerator<T1>::iterator current1_;
11593  const typename ParamGenerator<T2>::iterator begin2_;
11594  const typename ParamGenerator<T2>::iterator end2_;
11595  typename ParamGenerator<T2>::iterator current2_;
11596  const typename ParamGenerator<T3>::iterator begin3_;
11597  const typename ParamGenerator<T3>::iterator end3_;
11598  typename ParamGenerator<T3>::iterator current3_;
11599  std::shared_ptr<ParamType> current_value_;
11600  }; // class CartesianProductGenerator3::Iterator
11601 
11602  // No implementation - assignment is unsupported.
11603  void operator=(const CartesianProductGenerator3& other);
11604 
11605  const ParamGenerator<T1> g1_;
11606  const ParamGenerator<T2> g2_;
11607  const ParamGenerator<T3> g3_;
11608 }; // class CartesianProductGenerator3
11609 
11610 
11611 template <typename T1, typename T2, typename T3, typename T4>
11613  : public ParamGeneratorInterface< ::std::tuple<T1, T2, T3, T4> > {
11614  public:
11615  typedef ::std::tuple<T1, T2, T3, T4> ParamType;
11616 
11618  const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
11619  const ParamGenerator<T4>& g4)
11620  : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
11622 
11624  return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
11625  g3_.begin(), g4_, g4_.begin());
11626  }
11628  return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
11629  g4_, g4_.end());
11630  }
11631 
11632  private:
11633  class Iterator : public ParamIteratorInterface<ParamType> {
11634  public:
11635  Iterator(const ParamGeneratorInterface<ParamType>* base,
11636  const ParamGenerator<T1>& g1,
11637  const typename ParamGenerator<T1>::iterator& current1,
11638  const ParamGenerator<T2>& g2,
11639  const typename ParamGenerator<T2>::iterator& current2,
11640  const ParamGenerator<T3>& g3,
11641  const typename ParamGenerator<T3>::iterator& current3,
11642  const ParamGenerator<T4>& g4,
11643  const typename ParamGenerator<T4>::iterator& current4)
11644  : base_(base),
11645  begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
11646  begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
11647  begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
11648  begin4_(g4.begin()), end4_(g4.end()), current4_(current4) {
11649  ComputeCurrentValue();
11650  }
11651  ~Iterator() override {}
11652 
11653  const ParamGeneratorInterface<ParamType>* BaseGenerator() const override {
11654  return base_;
11655  }
11656  // Advance should not be called on beyond-of-range iterators
11657  // so no component iterators must be beyond end of range, either.
11658  void Advance() override {
11659  assert(!AtEnd());
11660  ++current4_;
11661  if (current4_ == end4_) {
11662  current4_ = begin4_;
11663  ++current3_;
11664  }
11665  if (current3_ == end3_) {
11666  current3_ = begin3_;
11667  ++current2_;
11668  }
11669  if (current2_ == end2_) {
11670  current2_ = begin2_;
11671  ++current1_;
11672  }
11673  ComputeCurrentValue();
11674  }
11675  ParamIteratorInterface<ParamType>* Clone() const override {
11676  return new Iterator(*this);
11677  }
11678  const ParamType* Current() const override { return current_value_.get(); }
11679  bool Equals(const ParamIteratorInterface<ParamType>& other) const override {
11680  // Having the same base generator guarantees that the other
11681  // iterator is of the same type and we can downcast.
11682  GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
11683  << "The program attempted to compare iterators "
11684  << "from different generators." << std::endl;
11685  const Iterator* typed_other =
11686  CheckedDowncastToActualType<const Iterator>(&other);
11687  // We must report iterators equal if they both point beyond their
11688  // respective ranges. That can happen in a variety of fashions,
11689  // so we have to consult AtEnd().
11690  return (AtEnd() && typed_other->AtEnd()) ||
11691  (
11692  current1_ == typed_other->current1_ &&
11693  current2_ == typed_other->current2_ &&
11694  current3_ == typed_other->current3_ &&
11695  current4_ == typed_other->current4_);
11696  }
11697 
11698  private:
11699  Iterator(const Iterator& other)
11700  : base_(other.base_),
11701  begin1_(other.begin1_),
11702  end1_(other.end1_),
11703  current1_(other.current1_),
11704  begin2_(other.begin2_),
11705  end2_(other.end2_),
11706  current2_(other.current2_),
11707  begin3_(other.begin3_),
11708  end3_(other.end3_),
11709  current3_(other.current3_),
11710  begin4_(other.begin4_),
11711  end4_(other.end4_),
11712  current4_(other.current4_) {
11713  ComputeCurrentValue();
11714  }
11715 
11716  void ComputeCurrentValue() {
11717  if (!AtEnd())
11718  current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
11719  *current4_));
11720  }
11721  bool AtEnd() const {
11722  // We must report iterator past the end of the range when either of the
11723  // component iterators has reached the end of its range.
11724  return
11725  current1_ == end1_ ||
11726  current2_ == end2_ ||
11727  current3_ == end3_ ||
11728  current4_ == end4_;
11729  }
11730 
11731  // No implementation - assignment is unsupported.
11732  void operator=(const Iterator& other);
11733 
11734  const ParamGeneratorInterface<ParamType>* const base_;
11735  // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
11736  // current[i]_ is the actual traversing iterator.
11737  const typename ParamGenerator<T1>::iterator begin1_;
11738  const typename ParamGenerator<T1>::iterator end1_;
11739  typename ParamGenerator<T1>::iterator current1_;
11740  const typename ParamGenerator<T2>::iterator begin2_;
11741  const typename ParamGenerator<T2>::iterator end2_;
11742  typename ParamGenerator<T2>::iterator current2_;
11743  const typename ParamGenerator<T3>::iterator begin3_;
11744  const typename ParamGenerator<T3>::iterator end3_;
11745  typename ParamGenerator<T3>::iterator current3_;
11746  const typename ParamGenerator<T4>::iterator begin4_;
11747  const typename ParamGenerator<T4>::iterator end4_;
11748  typename ParamGenerator<T4>::iterator current4_;
11749  std::shared_ptr<ParamType> current_value_;
11750  }; // class CartesianProductGenerator4::Iterator
11751 
11752  // No implementation - assignment is unsupported.
11753  void operator=(const CartesianProductGenerator4& other);
11754 
11755  const ParamGenerator<T1> g1_;
11756  const ParamGenerator<T2> g2_;
11757  const ParamGenerator<T3> g3_;
11758  const ParamGenerator<T4> g4_;
11759 }; // class CartesianProductGenerator4
11760 
11761 
11762 template <typename T1, typename T2, typename T3, typename T4, typename T5>
11764  : public ParamGeneratorInterface< ::std::tuple<T1, T2, T3, T4, T5> > {
11765  public:
11766  typedef ::std::tuple<T1, T2, T3, T4, T5> ParamType;
11767 
11769  const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
11770  const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5)
11771  : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
11773 
11775  return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
11776  g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin());
11777  }
11779  return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
11780  g4_, g4_.end(), g5_, g5_.end());
11781  }
11782 
11783  private:
11784  class Iterator : public ParamIteratorInterface<ParamType> {
11785  public:
11786  Iterator(const ParamGeneratorInterface<ParamType>* base,
11787  const ParamGenerator<T1>& g1,
11788  const typename ParamGenerator<T1>::iterator& current1,
11789  const ParamGenerator<T2>& g2,
11790  const typename ParamGenerator<T2>::iterator& current2,
11791  const ParamGenerator<T3>& g3,
11792  const typename ParamGenerator<T3>::iterator& current3,
11793  const ParamGenerator<T4>& g4,
11794  const typename ParamGenerator<T4>::iterator& current4,
11795  const ParamGenerator<T5>& g5,
11796  const typename ParamGenerator<T5>::iterator& current5)
11797  : base_(base),
11798  begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
11799  begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
11800  begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
11801  begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
11802  begin5_(g5.begin()), end5_(g5.end()), current5_(current5) {
11803  ComputeCurrentValue();
11804  }
11805  ~Iterator() override {}
11806 
11807  const ParamGeneratorInterface<ParamType>* BaseGenerator() const override {
11808  return base_;
11809  }
11810  // Advance should not be called on beyond-of-range iterators
11811  // so no component iterators must be beyond end of range, either.
11812  void Advance() override {
11813  assert(!AtEnd());
11814  ++current5_;
11815  if (current5_ == end5_) {
11816  current5_ = begin5_;
11817  ++current4_;
11818  }
11819  if (current4_ == end4_) {
11820  current4_ = begin4_;
11821  ++current3_;
11822  }
11823  if (current3_ == end3_) {
11824  current3_ = begin3_;
11825  ++current2_;
11826  }
11827  if (current2_ == end2_) {
11828  current2_ = begin2_;
11829  ++current1_;
11830  }
11831  ComputeCurrentValue();
11832  }
11833  ParamIteratorInterface<ParamType>* Clone() const override {
11834  return new Iterator(*this);
11835  }
11836  const ParamType* Current() const override { return current_value_.get(); }
11837  bool Equals(const ParamIteratorInterface<ParamType>& other) const override {
11838  // Having the same base generator guarantees that the other
11839  // iterator is of the same type and we can downcast.
11840  GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
11841  << "The program attempted to compare iterators "
11842  << "from different generators." << std::endl;
11843  const Iterator* typed_other =
11844  CheckedDowncastToActualType<const Iterator>(&other);
11845  // We must report iterators equal if they both point beyond their
11846  // respective ranges. That can happen in a variety of fashions,
11847  // so we have to consult AtEnd().
11848  return (AtEnd() && typed_other->AtEnd()) ||
11849  (
11850  current1_ == typed_other->current1_ &&
11851  current2_ == typed_other->current2_ &&
11852  current3_ == typed_other->current3_ &&
11853  current4_ == typed_other->current4_ &&
11854  current5_ == typed_other->current5_);
11855  }
11856 
11857  private:
11858  Iterator(const Iterator& other)
11859  : base_(other.base_),
11860  begin1_(other.begin1_),
11861  end1_(other.end1_),
11862  current1_(other.current1_),
11863  begin2_(other.begin2_),
11864  end2_(other.end2_),
11865  current2_(other.current2_),
11866  begin3_(other.begin3_),
11867  end3_(other.end3_),
11868  current3_(other.current3_),
11869  begin4_(other.begin4_),
11870  end4_(other.end4_),
11871  current4_(other.current4_),
11872  begin5_(other.begin5_),
11873  end5_(other.end5_),
11874  current5_(other.current5_) {
11875  ComputeCurrentValue();
11876  }
11877 
11878  void ComputeCurrentValue() {
11879  if (!AtEnd())
11880  current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
11881  *current4_, *current5_));
11882  }
11883  bool AtEnd() const {
11884  // We must report iterator past the end of the range when either of the
11885  // component iterators has reached the end of its range.
11886  return
11887  current1_ == end1_ ||
11888  current2_ == end2_ ||
11889  current3_ == end3_ ||
11890  current4_ == end4_ ||
11891  current5_ == end5_;
11892  }
11893 
11894  // No implementation - assignment is unsupported.
11895  void operator=(const Iterator& other);
11896 
11897  const ParamGeneratorInterface<ParamType>* const base_;
11898  // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
11899  // current[i]_ is the actual traversing iterator.
11900  const typename ParamGenerator<T1>::iterator begin1_;
11901  const typename ParamGenerator<T1>::iterator end1_;
11902  typename ParamGenerator<T1>::iterator current1_;
11903  const typename ParamGenerator<T2>::iterator begin2_;
11904  const typename ParamGenerator<T2>::iterator end2_;
11905  typename ParamGenerator<T2>::iterator current2_;
11906  const typename ParamGenerator<T3>::iterator begin3_;
11907  const typename ParamGenerator<T3>::iterator end3_;
11908  typename ParamGenerator<T3>::iterator current3_;
11909  const typename ParamGenerator<T4>::iterator begin4_;
11910  const typename ParamGenerator<T4>::iterator end4_;
11911  typename ParamGenerator<T4>::iterator current4_;
11912  const typename ParamGenerator<T5>::iterator begin5_;
11913  const typename ParamGenerator<T5>::iterator end5_;
11914  typename ParamGenerator<T5>::iterator current5_;
11915  std::shared_ptr<ParamType> current_value_;
11916  }; // class CartesianProductGenerator5::Iterator
11917 
11918  // No implementation - assignment is unsupported.
11919  void operator=(const CartesianProductGenerator5& other);
11920 
11921  const ParamGenerator<T1> g1_;
11922  const ParamGenerator<T2> g2_;
11923  const ParamGenerator<T3> g3_;
11924  const ParamGenerator<T4> g4_;
11925  const ParamGenerator<T5> g5_;
11926 }; // class CartesianProductGenerator5
11927 
11928 
11929 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11930  typename T6>
11932  : public ParamGeneratorInterface< ::std::tuple<T1, T2, T3, T4, T5, T6> > {
11933  public:
11934  typedef ::std::tuple<T1, T2, T3, T4, T5, T6> ParamType;
11935 
11937  const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
11938  const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
11939  const ParamGenerator<T6>& g6)
11940  : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
11942 
11944  return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
11945  g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin());
11946  }
11948  return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
11949  g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end());
11950  }
11951 
11952  private:
11953  class Iterator : public ParamIteratorInterface<ParamType> {
11954  public:
11955  Iterator(const ParamGeneratorInterface<ParamType>* base,
11956  const ParamGenerator<T1>& g1,
11957  const typename ParamGenerator<T1>::iterator& current1,
11958  const ParamGenerator<T2>& g2,
11959  const typename ParamGenerator<T2>::iterator& current2,
11960  const ParamGenerator<T3>& g3,
11961  const typename ParamGenerator<T3>::iterator& current3,
11962  const ParamGenerator<T4>& g4,
11963  const typename ParamGenerator<T4>::iterator& current4,
11964  const ParamGenerator<T5>& g5,
11965  const typename ParamGenerator<T5>::iterator& current5,
11966  const ParamGenerator<T6>& g6,
11967  const typename ParamGenerator<T6>::iterator& current6)
11968  : base_(base),
11969  begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
11970  begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
11971  begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
11972  begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
11973  begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
11974  begin6_(g6.begin()), end6_(g6.end()), current6_(current6) {
11975  ComputeCurrentValue();
11976  }
11977  ~Iterator() override {}
11978 
11979  const ParamGeneratorInterface<ParamType>* BaseGenerator() const override {
11980  return base_;
11981  }
11982  // Advance should not be called on beyond-of-range iterators
11983  // so no component iterators must be beyond end of range, either.
11984  void Advance() override {
11985  assert(!AtEnd());
11986  ++current6_;
11987  if (current6_ == end6_) {
11988  current6_ = begin6_;
11989  ++current5_;
11990  }
11991  if (current5_ == end5_) {
11992  current5_ = begin5_;
11993  ++current4_;
11994  }
11995  if (current4_ == end4_) {
11996  current4_ = begin4_;
11997  ++current3_;
11998  }
11999  if (current3_ == end3_) {
12000  current3_ = begin3_;
12001  ++current2_;
12002  }
12003  if (current2_ == end2_) {
12004  current2_ = begin2_;
12005  ++current1_;
12006  }
12007  ComputeCurrentValue();
12008  }
12009  ParamIteratorInterface<ParamType>* Clone() const override {
12010  return new Iterator(*this);
12011  }
12012  const ParamType* Current() const override { return current_value_.get(); }
12013  bool Equals(const ParamIteratorInterface<ParamType>& other) const override {
12014  // Having the same base generator guarantees that the other
12015  // iterator is of the same type and we can downcast.
12016  GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
12017  << "The program attempted to compare iterators "
12018  << "from different generators." << std::endl;
12019  const Iterator* typed_other =
12020  CheckedDowncastToActualType<const Iterator>(&other);
12021  // We must report iterators equal if they both point beyond their
12022  // respective ranges. That can happen in a variety of fashions,
12023  // so we have to consult AtEnd().
12024  return (AtEnd() && typed_other->AtEnd()) ||
12025  (
12026  current1_ == typed_other->current1_ &&
12027  current2_ == typed_other->current2_ &&
12028  current3_ == typed_other->current3_ &&
12029  current4_ == typed_other->current4_ &&
12030  current5_ == typed_other->current5_ &&
12031  current6_ == typed_other->current6_);
12032  }
12033 
12034  private:
12035  Iterator(const Iterator& other)
12036  : base_(other.base_),
12037  begin1_(other.begin1_),
12038  end1_(other.end1_),
12039  current1_(other.current1_),
12040  begin2_(other.begin2_),
12041  end2_(other.end2_),
12042  current2_(other.current2_),
12043  begin3_(other.begin3_),
12044  end3_(other.end3_),
12045  current3_(other.current3_),
12046  begin4_(other.begin4_),
12047  end4_(other.end4_),
12048  current4_(other.current4_),
12049  begin5_(other.begin5_),
12050  end5_(other.end5_),
12051  current5_(other.current5_),
12052  begin6_(other.begin6_),
12053  end6_(other.end6_),
12054  current6_(other.current6_) {
12055  ComputeCurrentValue();
12056  }
12057 
12058  void ComputeCurrentValue() {
12059  if (!AtEnd())
12060  current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
12061  *current4_, *current5_, *current6_));
12062  }
12063  bool AtEnd() const {
12064  // We must report iterator past the end of the range when either of the
12065  // component iterators has reached the end of its range.
12066  return
12067  current1_ == end1_ ||
12068  current2_ == end2_ ||
12069  current3_ == end3_ ||
12070  current4_ == end4_ ||
12071  current5_ == end5_ ||
12072  current6_ == end6_;
12073  }
12074 
12075  // No implementation - assignment is unsupported.
12076  void operator=(const Iterator& other);
12077 
12078  const ParamGeneratorInterface<ParamType>* const base_;
12079  // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
12080  // current[i]_ is the actual traversing iterator.
12081  const typename ParamGenerator<T1>::iterator begin1_;
12082  const typename ParamGenerator<T1>::iterator end1_;
12083  typename ParamGenerator<T1>::iterator current1_;
12084  const typename ParamGenerator<T2>::iterator begin2_;
12085  const typename ParamGenerator<T2>::iterator end2_;
12086  typename ParamGenerator<T2>::iterator current2_;
12087  const typename ParamGenerator<T3>::iterator begin3_;
12088  const typename ParamGenerator<T3>::iterator end3_;
12089  typename ParamGenerator<T3>::iterator current3_;
12090  const typename ParamGenerator<T4>::iterator begin4_;
12091  const typename ParamGenerator<T4>::iterator end4_;
12092  typename ParamGenerator<T4>::iterator current4_;
12093  const typename ParamGenerator<T5>::iterator begin5_;
12094  const typename ParamGenerator<T5>::iterator end5_;
12095  typename ParamGenerator<T5>::iterator current5_;
12096  const typename ParamGenerator<T6>::iterator begin6_;
12097  const typename ParamGenerator<T6>::iterator end6_;
12098  typename ParamGenerator<T6>::iterator current6_;
12099  std::shared_ptr<ParamType> current_value_;
12100  }; // class CartesianProductGenerator6::Iterator
12101 
12102  // No implementation - assignment is unsupported.
12103  void operator=(const CartesianProductGenerator6& other);
12104 
12105  const ParamGenerator<T1> g1_;
12106  const ParamGenerator<T2> g2_;
12107  const ParamGenerator<T3> g3_;
12108  const ParamGenerator<T4> g4_;
12109  const ParamGenerator<T5> g5_;
12110  const ParamGenerator<T6> g6_;
12111 }; // class CartesianProductGenerator6
12112 
12113 
12114 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12115  typename T6, typename T7>
12117  : public ParamGeneratorInterface< ::std::tuple<T1, T2, T3, T4, T5, T6,
12118  T7> > {
12119  public:
12120  typedef ::std::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;
12121 
12123  const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
12124  const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
12125  const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7)
12126  : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
12128 
12130  return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
12131  g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
12132  g7_.begin());
12133  }
12135  return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
12136  g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end());
12137  }
12138 
12139  private:
12140  class Iterator : public ParamIteratorInterface<ParamType> {
12141  public:
12142  Iterator(const ParamGeneratorInterface<ParamType>* base,
12143  const ParamGenerator<T1>& g1,
12144  const typename ParamGenerator<T1>::iterator& current1,
12145  const ParamGenerator<T2>& g2,
12146  const typename ParamGenerator<T2>::iterator& current2,
12147  const ParamGenerator<T3>& g3,
12148  const typename ParamGenerator<T3>::iterator& current3,
12149  const ParamGenerator<T4>& g4,
12150  const typename ParamGenerator<T4>::iterator& current4,
12151  const ParamGenerator<T5>& g5,
12152  const typename ParamGenerator<T5>::iterator& current5,
12153  const ParamGenerator<T6>& g6,
12154  const typename ParamGenerator<T6>::iterator& current6,
12155  const ParamGenerator<T7>& g7,
12156  const typename ParamGenerator<T7>::iterator& current7)
12157  : base_(base),
12158  begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
12159  begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
12160  begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
12161  begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
12162  begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
12163  begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
12164  begin7_(g7.begin()), end7_(g7.end()), current7_(current7) {
12165  ComputeCurrentValue();
12166  }
12167  ~Iterator() override {}
12168 
12169  const ParamGeneratorInterface<ParamType>* BaseGenerator() const override {
12170  return base_;
12171  }
12172  // Advance should not be called on beyond-of-range iterators
12173  // so no component iterators must be beyond end of range, either.
12174  void Advance() override {
12175  assert(!AtEnd());
12176  ++current7_;
12177  if (current7_ == end7_) {
12178  current7_ = begin7_;
12179  ++current6_;
12180  }
12181  if (current6_ == end6_) {
12182  current6_ = begin6_;
12183  ++current5_;
12184  }
12185  if (current5_ == end5_) {
12186  current5_ = begin5_;
12187  ++current4_;
12188  }
12189  if (current4_ == end4_) {
12190  current4_ = begin4_;
12191  ++current3_;
12192  }
12193  if (current3_ == end3_) {
12194  current3_ = begin3_;
12195  ++current2_;
12196  }
12197  if (current2_ == end2_) {
12198  current2_ = begin2_;
12199  ++current1_;
12200  }
12201  ComputeCurrentValue();
12202  }
12203  ParamIteratorInterface<ParamType>* Clone() const override {
12204  return new Iterator(*this);
12205  }
12206  const ParamType* Current() const override { return current_value_.get(); }
12207  bool Equals(const ParamIteratorInterface<ParamType>& other) const override {
12208  // Having the same base generator guarantees that the other
12209  // iterator is of the same type and we can downcast.
12210  GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
12211  << "The program attempted to compare iterators "
12212  << "from different generators." << std::endl;
12213  const Iterator* typed_other =
12214  CheckedDowncastToActualType<const Iterator>(&other);
12215  // We must report iterators equal if they both point beyond their
12216  // respective ranges. That can happen in a variety of fashions,
12217  // so we have to consult AtEnd().
12218  return (AtEnd() && typed_other->AtEnd()) ||
12219  (
12220  current1_ == typed_other->current1_ &&
12221  current2_ == typed_other->current2_ &&
12222  current3_ == typed_other->current3_ &&
12223  current4_ == typed_other->current4_ &&
12224  current5_ == typed_other->current5_ &&
12225  current6_ == typed_other->current6_ &&
12226  current7_ == typed_other->current7_);
12227  }
12228 
12229  private:
12230  Iterator(const Iterator& other)
12231  : base_(other.base_),
12232  begin1_(other.begin1_),
12233  end1_(other.end1_),
12234  current1_(other.current1_),
12235  begin2_(other.begin2_),
12236  end2_(other.end2_),
12237  current2_(other.current2_),
12238  begin3_(other.begin3_),
12239  end3_(other.end3_),
12240  current3_(other.current3_),
12241  begin4_(other.begin4_),
12242  end4_(other.end4_),
12243  current4_(other.current4_),
12244  begin5_(other.begin5_),
12245  end5_(other.end5_),
12246  current5_(other.current5_),
12247  begin6_(other.begin6_),
12248  end6_(other.end6_),
12249  current6_(other.current6_),
12250  begin7_(other.begin7_),
12251  end7_(other.end7_),
12252  current7_(other.current7_) {
12253  ComputeCurrentValue();
12254  }
12255 
12256  void ComputeCurrentValue() {
12257  if (!AtEnd())
12258  current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
12259  *current4_, *current5_, *current6_, *current7_));
12260  }
12261  bool AtEnd() const {
12262  // We must report iterator past the end of the range when either of the
12263  // component iterators has reached the end of its range.
12264  return
12265  current1_ == end1_ ||
12266  current2_ == end2_ ||
12267  current3_ == end3_ ||
12268  current4_ == end4_ ||
12269  current5_ == end5_ ||
12270  current6_ == end6_ ||
12271  current7_ == end7_;
12272  }
12273 
12274  // No implementation - assignment is unsupported.
12275  void operator=(const Iterator& other);
12276 
12277  const ParamGeneratorInterface<ParamType>* const base_;
12278  // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
12279  // current[i]_ is the actual traversing iterator.
12280  const typename ParamGenerator<T1>::iterator begin1_;
12281  const typename ParamGenerator<T1>::iterator end1_;
12282  typename ParamGenerator<T1>::iterator current1_;
12283  const typename ParamGenerator<T2>::iterator begin2_;
12284  const typename ParamGenerator<T2>::iterator end2_;
12285  typename ParamGenerator<T2>::iterator current2_;
12286  const typename ParamGenerator<T3>::iterator begin3_;
12287  const typename ParamGenerator<T3>::iterator end3_;
12288  typename ParamGenerator<T3>::iterator current3_;
12289  const typename ParamGenerator<T4>::iterator begin4_;
12290  const typename ParamGenerator<T4>::iterator end4_;
12291  typename ParamGenerator<T4>::iterator current4_;
12292  const typename ParamGenerator<T5>::iterator begin5_;
12293  const typename ParamGenerator<T5>::iterator end5_;
12294  typename ParamGenerator<T5>::iterator current5_;
12295  const typename ParamGenerator<T6>::iterator begin6_;
12296  const typename ParamGenerator<T6>::iterator end6_;
12297  typename ParamGenerator<T6>::iterator current6_;
12298  const typename ParamGenerator<T7>::iterator begin7_;
12299  const typename ParamGenerator<T7>::iterator end7_;
12300  typename ParamGenerator<T7>::iterator current7_;
12301  std::shared_ptr<ParamType> current_value_;
12302  }; // class CartesianProductGenerator7::Iterator
12303 
12304  // No implementation - assignment is unsupported.
12305  void operator=(const CartesianProductGenerator7& other);
12306 
12307  const ParamGenerator<T1> g1_;
12308  const ParamGenerator<T2> g2_;
12309  const ParamGenerator<T3> g3_;
12310  const ParamGenerator<T4> g4_;
12311  const ParamGenerator<T5> g5_;
12312  const ParamGenerator<T6> g6_;
12313  const ParamGenerator<T7> g7_;
12314 }; // class CartesianProductGenerator7
12315 
12316 
12317 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12318  typename T6, typename T7, typename T8>
12320  : public ParamGeneratorInterface< ::std::tuple<T1, T2, T3, T4, T5, T6, T7,
12321  T8> > {
12322  public:
12323  typedef ::std::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;
12324 
12326  const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
12327  const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
12328  const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
12329  const ParamGenerator<T8>& g8)
12330  : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
12331  g8_(g8) {}
12333 
12335  return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
12336  g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
12337  g7_.begin(), g8_, g8_.begin());
12338  }
12340  return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
12341  g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
12342  g8_.end());
12343  }
12344 
12345  private:
12346  class Iterator : public ParamIteratorInterface<ParamType> {
12347  public:
12348  Iterator(const ParamGeneratorInterface<ParamType>* base,
12349  const ParamGenerator<T1>& g1,
12350  const typename ParamGenerator<T1>::iterator& current1,
12351  const ParamGenerator<T2>& g2,
12352  const typename ParamGenerator<T2>::iterator& current2,
12353  const ParamGenerator<T3>& g3,
12354  const typename ParamGenerator<T3>::iterator& current3,
12355  const ParamGenerator<T4>& g4,
12356  const typename ParamGenerator<T4>::iterator& current4,
12357  const ParamGenerator<T5>& g5,
12358  const typename ParamGenerator<T5>::iterator& current5,
12359  const ParamGenerator<T6>& g6,
12360  const typename ParamGenerator<T6>::iterator& current6,
12361  const ParamGenerator<T7>& g7,
12362  const typename ParamGenerator<T7>::iterator& current7,
12363  const ParamGenerator<T8>& g8,
12364  const typename ParamGenerator<T8>::iterator& current8)
12365  : base_(base),
12366  begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
12367  begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
12368  begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
12369  begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
12370  begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
12371  begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
12372  begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
12373  begin8_(g8.begin()), end8_(g8.end()), current8_(current8) {
12374  ComputeCurrentValue();
12375  }
12376  ~Iterator() override {}
12377 
12378  const ParamGeneratorInterface<ParamType>* BaseGenerator() const override {
12379  return base_;
12380  }
12381  // Advance should not be called on beyond-of-range iterators
12382  // so no component iterators must be beyond end of range, either.
12383  void Advance() override {
12384  assert(!AtEnd());
12385  ++current8_;
12386  if (current8_ == end8_) {
12387  current8_ = begin8_;
12388  ++current7_;
12389  }
12390  if (current7_ == end7_) {
12391  current7_ = begin7_;
12392  ++current6_;
12393  }
12394  if (current6_ == end6_) {
12395  current6_ = begin6_;
12396  ++current5_;
12397  }
12398  if (current5_ == end5_) {
12399  current5_ = begin5_;
12400  ++current4_;
12401  }
12402  if (current4_ == end4_) {
12403  current4_ = begin4_;
12404  ++current3_;
12405  }
12406  if (current3_ == end3_) {
12407  current3_ = begin3_;
12408  ++current2_;
12409  }
12410  if (current2_ == end2_) {
12411  current2_ = begin2_;
12412  ++current1_;
12413  }
12414  ComputeCurrentValue();
12415  }
12416  ParamIteratorInterface<ParamType>* Clone() const override {
12417  return new Iterator(*this);
12418  }
12419  const ParamType* Current() const override { return current_value_.get(); }
12420  bool Equals(const ParamIteratorInterface<ParamType>& other) const override {
12421  // Having the same base generator guarantees that the other
12422  // iterator is of the same type and we can downcast.
12423  GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
12424  << "The program attempted to compare iterators "
12425  << "from different generators." << std::endl;
12426  const Iterator* typed_other =
12427  CheckedDowncastToActualType<const Iterator>(&other);
12428  // We must report iterators equal if they both point beyond their
12429  // respective ranges. That can happen in a variety of fashions,
12430  // so we have to consult AtEnd().
12431  return (AtEnd() && typed_other->AtEnd()) ||
12432  (
12433  current1_ == typed_other->current1_ &&
12434  current2_ == typed_other->current2_ &&
12435  current3_ == typed_other->current3_ &&
12436  current4_ == typed_other->current4_ &&
12437  current5_ == typed_other->current5_ &&
12438  current6_ == typed_other->current6_ &&
12439  current7_ == typed_other->current7_ &&
12440  current8_ == typed_other->current8_);
12441  }
12442 
12443  private:
12444  Iterator(const Iterator& other)
12445  : base_(other.base_),
12446  begin1_(other.begin1_),
12447  end1_(other.end1_),
12448  current1_(other.current1_),
12449  begin2_(other.begin2_),
12450  end2_(other.end2_),
12451  current2_(other.current2_),
12452  begin3_(other.begin3_),
12453  end3_(other.end3_),
12454  current3_(other.current3_),
12455  begin4_(other.begin4_),
12456  end4_(other.end4_),
12457  current4_(other.current4_),
12458  begin5_(other.begin5_),
12459  end5_(other.end5_),
12460  current5_(other.current5_),
12461  begin6_(other.begin6_),
12462  end6_(other.end6_),
12463  current6_(other.current6_),
12464  begin7_(other.begin7_),
12465  end7_(other.end7_),
12466  current7_(other.current7_),
12467  begin8_(other.begin8_),
12468  end8_(other.end8_),
12469  current8_(other.current8_) {
12470  ComputeCurrentValue();
12471  }
12472 
12473  void ComputeCurrentValue() {
12474  if (!AtEnd())
12475  current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
12476  *current4_, *current5_, *current6_, *current7_, *current8_));
12477  }
12478  bool AtEnd() const {
12479  // We must report iterator past the end of the range when either of the
12480  // component iterators has reached the end of its range.
12481  return
12482  current1_ == end1_ ||
12483  current2_ == end2_ ||
12484  current3_ == end3_ ||
12485  current4_ == end4_ ||
12486  current5_ == end5_ ||
12487  current6_ == end6_ ||
12488  current7_ == end7_ ||
12489  current8_ == end8_;
12490  }
12491 
12492  // No implementation - assignment is unsupported.
12493  void operator=(const Iterator& other);
12494 
12495  const ParamGeneratorInterface<ParamType>* const base_;
12496  // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
12497  // current[i]_ is the actual traversing iterator.
12498  const typename ParamGenerator<T1>::iterator begin1_;
12499  const typename ParamGenerator<T1>::iterator end1_;
12500  typename ParamGenerator<T1>::iterator current1_;
12501  const typename ParamGenerator<T2>::iterator begin2_;
12502  const typename ParamGenerator<T2>::iterator end2_;
12503  typename ParamGenerator<T2>::iterator current2_;
12504  const typename ParamGenerator<T3>::iterator begin3_;
12505  const typename ParamGenerator<T3>::iterator end3_;
12506  typename ParamGenerator<T3>::iterator current3_;
12507  const typename ParamGenerator<T4>::iterator begin4_;
12508  const typename ParamGenerator<T4>::iterator end4_;
12509  typename ParamGenerator<T4>::iterator current4_;
12510  const typename ParamGenerator<T5>::iterator begin5_;
12511  const typename ParamGenerator<T5>::iterator end5_;
12512  typename ParamGenerator<T5>::iterator current5_;
12513  const typename ParamGenerator<T6>::iterator begin6_;
12514  const typename ParamGenerator<T6>::iterator end6_;
12515  typename ParamGenerator<T6>::iterator current6_;
12516  const typename ParamGenerator<T7>::iterator begin7_;
12517  const typename ParamGenerator<T7>::iterator end7_;
12518  typename ParamGenerator<T7>::iterator current7_;
12519  const typename ParamGenerator<T8>::iterator begin8_;
12520  const typename ParamGenerator<T8>::iterator end8_;
12521  typename ParamGenerator<T8>::iterator current8_;
12522  std::shared_ptr<ParamType> current_value_;
12523  }; // class CartesianProductGenerator8::Iterator
12524 
12525  // No implementation - assignment is unsupported.
12526  void operator=(const CartesianProductGenerator8& other);
12527 
12528  const ParamGenerator<T1> g1_;
12529  const ParamGenerator<T2> g2_;
12530  const ParamGenerator<T3> g3_;
12531  const ParamGenerator<T4> g4_;
12532  const ParamGenerator<T5> g5_;
12533  const ParamGenerator<T6> g6_;
12534  const ParamGenerator<T7> g7_;
12535  const ParamGenerator<T8> g8_;
12536 }; // class CartesianProductGenerator8
12537 
12538 
12539 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12540  typename T6, typename T7, typename T8, typename T9>
12542  : public ParamGeneratorInterface< ::std::tuple<T1, T2, T3, T4, T5, T6, T7,
12543  T8, T9> > {
12544  public:
12545  typedef ::std::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;
12546 
12548  const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
12549  const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
12550  const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
12551  const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9)
12552  : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
12553  g9_(g9) {}
12555 
12557  return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
12558  g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
12559  g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin());
12560  }
12562  return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
12563  g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
12564  g8_.end(), g9_, g9_.end());
12565  }
12566 
12567  private:
12568  class Iterator : public ParamIteratorInterface<ParamType> {
12569  public:
12570  Iterator(const ParamGeneratorInterface<ParamType>* base,
12571  const ParamGenerator<T1>& g1,
12572  const typename ParamGenerator<T1>::iterator& current1,
12573  const ParamGenerator<T2>& g2,
12574  const typename ParamGenerator<T2>::iterator& current2,
12575  const ParamGenerator<T3>& g3,
12576  const typename ParamGenerator<T3>::iterator& current3,
12577  const ParamGenerator<T4>& g4,
12578  const typename ParamGenerator<T4>::iterator& current4,
12579  const ParamGenerator<T5>& g5,
12580  const typename ParamGenerator<T5>::iterator& current5,
12581  const ParamGenerator<T6>& g6,
12582  const typename ParamGenerator<T6>::iterator& current6,
12583  const ParamGenerator<T7>& g7,
12584  const typename ParamGenerator<T7>::iterator& current7,
12585  const ParamGenerator<T8>& g8,
12586  const typename ParamGenerator<T8>::iterator& current8,
12587  const ParamGenerator<T9>& g9,
12588  const typename ParamGenerator<T9>::iterator& current9)
12589  : base_(base),
12590  begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
12591  begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
12592  begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
12593  begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
12594  begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
12595  begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
12596  begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
12597  begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
12598  begin9_(g9.begin()), end9_(g9.end()), current9_(current9) {
12599  ComputeCurrentValue();
12600  }
12601  ~Iterator() override {}
12602 
12603  const ParamGeneratorInterface<ParamType>* BaseGenerator() const override {
12604  return base_;
12605  }
12606  // Advance should not be called on beyond-of-range iterators
12607  // so no component iterators must be beyond end of range, either.
12608  void Advance() override {
12609  assert(!AtEnd());
12610  ++current9_;
12611  if (current9_ == end9_) {
12612  current9_ = begin9_;
12613  ++current8_;
12614  }
12615  if (current8_ == end8_) {
12616  current8_ = begin8_;
12617  ++current7_;
12618  }
12619  if (current7_ == end7_) {
12620  current7_ = begin7_;
12621  ++current6_;
12622  }
12623  if (current6_ == end6_) {
12624  current6_ = begin6_;
12625  ++current5_;
12626  }
12627  if (current5_ == end5_) {
12628  current5_ = begin5_;
12629  ++current4_;
12630  }
12631  if (current4_ == end4_) {
12632  current4_ = begin4_;
12633  ++current3_;
12634  }
12635  if (current3_ == end3_) {
12636  current3_ = begin3_;
12637  ++current2_;
12638  }
12639  if (current2_ == end2_) {
12640  current2_ = begin2_;
12641  ++current1_;
12642  }
12643  ComputeCurrentValue();
12644  }
12645  ParamIteratorInterface<ParamType>* Clone() const override {
12646  return new Iterator(*this);
12647  }
12648  const ParamType* Current() const override { return current_value_.get(); }
12649  bool Equals(const ParamIteratorInterface<ParamType>& other) const override {
12650  // Having the same base generator guarantees that the other
12651  // iterator is of the same type and we can downcast.
12652  GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
12653  << "The program attempted to compare iterators "
12654  << "from different generators." << std::endl;
12655  const Iterator* typed_other =
12656  CheckedDowncastToActualType<const Iterator>(&other);
12657  // We must report iterators equal if they both point beyond their
12658  // respective ranges. That can happen in a variety of fashions,
12659  // so we have to consult AtEnd().
12660  return (AtEnd() && typed_other->AtEnd()) ||
12661  (
12662  current1_ == typed_other->current1_ &&
12663  current2_ == typed_other->current2_ &&
12664  current3_ == typed_other->current3_ &&
12665  current4_ == typed_other->current4_ &&
12666  current5_ == typed_other->current5_ &&
12667  current6_ == typed_other->current6_ &&
12668  current7_ == typed_other->current7_ &&
12669  current8_ == typed_other->current8_ &&
12670  current9_ == typed_other->current9_);
12671  }
12672 
12673  private:
12674  Iterator(const Iterator& other)
12675  : base_(other.base_),
12676  begin1_(other.begin1_),
12677  end1_(other.end1_),
12678  current1_(other.current1_),
12679  begin2_(other.begin2_),
12680  end2_(other.end2_),
12681  current2_(other.current2_),
12682  begin3_(other.begin3_),
12683  end3_(other.end3_),
12684  current3_(other.current3_),
12685  begin4_(other.begin4_),
12686  end4_(other.end4_),
12687  current4_(other.current4_),
12688  begin5_(other.begin5_),
12689  end5_(other.end5_),
12690  current5_(other.current5_),
12691  begin6_(other.begin6_),
12692  end6_(other.end6_),
12693  current6_(other.current6_),
12694  begin7_(other.begin7_),
12695  end7_(other.end7_),
12696  current7_(other.current7_),
12697  begin8_(other.begin8_),
12698  end8_(other.end8_),
12699  current8_(other.current8_),
12700  begin9_(other.begin9_),
12701  end9_(other.end9_),
12702  current9_(other.current9_) {
12703  ComputeCurrentValue();
12704  }
12705 
12706  void ComputeCurrentValue() {
12707  if (!AtEnd())
12708  current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
12709  *current4_, *current5_, *current6_, *current7_, *current8_,
12710  *current9_));
12711  }
12712  bool AtEnd() const {
12713  // We must report iterator past the end of the range when either of the
12714  // component iterators has reached the end of its range.
12715  return
12716  current1_ == end1_ ||
12717  current2_ == end2_ ||
12718  current3_ == end3_ ||
12719  current4_ == end4_ ||
12720  current5_ == end5_ ||
12721  current6_ == end6_ ||
12722  current7_ == end7_ ||
12723  current8_ == end8_ ||
12724  current9_ == end9_;
12725  }
12726 
12727  // No implementation - assignment is unsupported.
12728  void operator=(const Iterator& other);
12729 
12730  const ParamGeneratorInterface<ParamType>* const base_;
12731  // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
12732  // current[i]_ is the actual traversing iterator.
12733  const typename ParamGenerator<T1>::iterator begin1_;
12734  const typename ParamGenerator<T1>::iterator end1_;
12735  typename ParamGenerator<T1>::iterator current1_;
12736  const typename ParamGenerator<T2>::iterator begin2_;
12737  const typename ParamGenerator<T2>::iterator end2_;
12738  typename ParamGenerator<T2>::iterator current2_;
12739  const typename ParamGenerator<T3>::iterator begin3_;
12740  const typename ParamGenerator<T3>::iterator end3_;
12741  typename ParamGenerator<T3>::iterator current3_;
12742  const typename ParamGenerator<T4>::iterator begin4_;
12743  const typename ParamGenerator<T4>::iterator end4_;
12744  typename ParamGenerator<T4>::iterator current4_;
12745  const typename ParamGenerator<T5>::iterator begin5_;
12746  const typename ParamGenerator<T5>::iterator end5_;
12747  typename ParamGenerator<T5>::iterator current5_;
12748  const typename ParamGenerator<T6>::iterator begin6_;
12749  const typename ParamGenerator<T6>::iterator end6_;
12750  typename ParamGenerator<T6>::iterator current6_;
12751  const typename ParamGenerator<T7>::iterator begin7_;
12752  const typename ParamGenerator<T7>::iterator end7_;
12753  typename ParamGenerator<T7>::iterator current7_;
12754  const typename ParamGenerator<T8>::iterator begin8_;
12755  const typename ParamGenerator<T8>::iterator end8_;
12756  typename ParamGenerator<T8>::iterator current8_;
12757  const typename ParamGenerator<T9>::iterator begin9_;
12758  const typename ParamGenerator<T9>::iterator end9_;
12759  typename ParamGenerator<T9>::iterator current9_;
12760  std::shared_ptr<ParamType> current_value_;
12761  }; // class CartesianProductGenerator9::Iterator
12762 
12763  // No implementation - assignment is unsupported.
12764  void operator=(const CartesianProductGenerator9& other);
12765 
12766  const ParamGenerator<T1> g1_;
12767  const ParamGenerator<T2> g2_;
12768  const ParamGenerator<T3> g3_;
12769  const ParamGenerator<T4> g4_;
12770  const ParamGenerator<T5> g5_;
12771  const ParamGenerator<T6> g6_;
12772  const ParamGenerator<T7> g7_;
12773  const ParamGenerator<T8> g8_;
12774  const ParamGenerator<T9> g9_;
12775 }; // class CartesianProductGenerator9
12776 
12777 
12778 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12779  typename T6, typename T7, typename T8, typename T9, typename T10>
12781  : public ParamGeneratorInterface< ::std::tuple<T1, T2, T3, T4, T5, T6, T7,
12782  T8, T9, T10> > {
12783  public:
12784  typedef ::std::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;
12785 
12787  const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
12788  const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
12789  const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
12790  const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9,
12791  const ParamGenerator<T10>& g10)
12792  : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
12793  g9_(g9), g10_(g10) {}
12795 
12797  return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
12798  g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
12799  g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin());
12800  }
12802  return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
12803  g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
12804  g8_.end(), g9_, g9_.end(), g10_, g10_.end());
12805  }
12806 
12807  private:
12808  class Iterator : public ParamIteratorInterface<ParamType> {
12809  public:
12810  Iterator(const ParamGeneratorInterface<ParamType>* base,
12811  const ParamGenerator<T1>& g1,
12812  const typename ParamGenerator<T1>::iterator& current1,
12813  const ParamGenerator<T2>& g2,
12814  const typename ParamGenerator<T2>::iterator& current2,
12815  const ParamGenerator<T3>& g3,
12816  const typename ParamGenerator<T3>::iterator& current3,
12817  const ParamGenerator<T4>& g4,
12818  const typename ParamGenerator<T4>::iterator& current4,
12819  const ParamGenerator<T5>& g5,
12820  const typename ParamGenerator<T5>::iterator& current5,
12821  const ParamGenerator<T6>& g6,
12822  const typename ParamGenerator<T6>::iterator& current6,
12823  const ParamGenerator<T7>& g7,
12824  const typename ParamGenerator<T7>::iterator& current7,
12825  const ParamGenerator<T8>& g8,
12826  const typename ParamGenerator<T8>::iterator& current8,
12827  const ParamGenerator<T9>& g9,
12828  const typename ParamGenerator<T9>::iterator& current9,
12829  const ParamGenerator<T10>& g10,
12830  const typename ParamGenerator<T10>::iterator& current10)
12831  : base_(base),
12832  begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
12833  begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
12834  begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
12835  begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
12836  begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
12837  begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
12838  begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
12839  begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
12840  begin9_(g9.begin()), end9_(g9.end()), current9_(current9),
12841  begin10_(g10.begin()), end10_(g10.end()), current10_(current10) {
12842  ComputeCurrentValue();
12843  }
12844  ~Iterator() override {}
12845 
12846  const ParamGeneratorInterface<ParamType>* BaseGenerator() const override {
12847  return base_;
12848  }
12849  // Advance should not be called on beyond-of-range iterators
12850  // so no component iterators must be beyond end of range, either.
12851  void Advance() override {
12852  assert(!AtEnd());
12853  ++current10_;
12854  if (current10_ == end10_) {
12855  current10_ = begin10_;
12856  ++current9_;
12857  }
12858  if (current9_ == end9_) {
12859  current9_ = begin9_;
12860  ++current8_;
12861  }
12862  if (current8_ == end8_) {
12863  current8_ = begin8_;
12864  ++current7_;
12865  }
12866  if (current7_ == end7_) {
12867  current7_ = begin7_;
12868  ++current6_;
12869  }
12870  if (current6_ == end6_) {
12871  current6_ = begin6_;
12872  ++current5_;
12873  }
12874  if (current5_ == end5_) {
12875  current5_ = begin5_;
12876  ++current4_;
12877  }
12878  if (current4_ == end4_) {
12879  current4_ = begin4_;
12880  ++current3_;
12881  }
12882  if (current3_ == end3_) {
12883  current3_ = begin3_;
12884  ++current2_;
12885  }
12886  if (current2_ == end2_) {
12887  current2_ = begin2_;
12888  ++current1_;
12889  }
12890  ComputeCurrentValue();
12891  }
12892  ParamIteratorInterface<ParamType>* Clone() const override {
12893  return new Iterator(*this);
12894  }
12895  const ParamType* Current() const override { return current_value_.get(); }
12896  bool Equals(const ParamIteratorInterface<ParamType>& other) const override {
12897  // Having the same base generator guarantees that the other
12898  // iterator is of the same type and we can downcast.
12899  GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
12900  << "The program attempted to compare iterators "
12901  << "from different generators." << std::endl;
12902  const Iterator* typed_other =
12903  CheckedDowncastToActualType<const Iterator>(&other);
12904  // We must report iterators equal if they both point beyond their
12905  // respective ranges. That can happen in a variety of fashions,
12906  // so we have to consult AtEnd().
12907  return (AtEnd() && typed_other->AtEnd()) ||
12908  (
12909  current1_ == typed_other->current1_ &&
12910  current2_ == typed_other->current2_ &&
12911  current3_ == typed_other->current3_ &&
12912  current4_ == typed_other->current4_ &&
12913  current5_ == typed_other->current5_ &&
12914  current6_ == typed_other->current6_ &&
12915  current7_ == typed_other->current7_ &&
12916  current8_ == typed_other->current8_ &&
12917  current9_ == typed_other->current9_ &&
12918  current10_ == typed_other->current10_);
12919  }
12920 
12921  private:
12922  Iterator(const Iterator& other)
12923  : base_(other.base_),
12924  begin1_(other.begin1_),
12925  end1_(other.end1_),
12926  current1_(other.current1_),
12927  begin2_(other.begin2_),
12928  end2_(other.end2_),
12929  current2_(other.current2_),
12930  begin3_(other.begin3_),
12931  end3_(other.end3_),
12932  current3_(other.current3_),
12933  begin4_(other.begin4_),
12934  end4_(other.end4_),
12935  current4_(other.current4_),
12936  begin5_(other.begin5_),
12937  end5_(other.end5_),
12938  current5_(other.current5_),
12939  begin6_(other.begin6_),
12940  end6_(other.end6_),
12941  current6_(other.current6_),
12942  begin7_(other.begin7_),
12943  end7_(other.end7_),
12944  current7_(other.current7_),
12945  begin8_(other.begin8_),
12946  end8_(other.end8_),
12947  current8_(other.current8_),
12948  begin9_(other.begin9_),
12949  end9_(other.end9_),
12950  current9_(other.current9_),
12951  begin10_(other.begin10_),
12952  end10_(other.end10_),
12953  current10_(other.current10_) {
12954  ComputeCurrentValue();
12955  }
12956 
12957  void ComputeCurrentValue() {
12958  if (!AtEnd())
12959  current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
12960  *current4_, *current5_, *current6_, *current7_, *current8_,
12961  *current9_, *current10_));
12962  }
12963  bool AtEnd() const {
12964  // We must report iterator past the end of the range when either of the
12965  // component iterators has reached the end of its range.
12966  return
12967  current1_ == end1_ ||
12968  current2_ == end2_ ||
12969  current3_ == end3_ ||
12970  current4_ == end4_ ||
12971  current5_ == end5_ ||
12972  current6_ == end6_ ||
12973  current7_ == end7_ ||
12974  current8_ == end8_ ||
12975  current9_ == end9_ ||
12976  current10_ == end10_;
12977  }
12978 
12979  // No implementation - assignment is unsupported.
12980  void operator=(const Iterator& other);
12981 
12982  const ParamGeneratorInterface<ParamType>* const base_;
12983  // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
12984  // current[i]_ is the actual traversing iterator.
12985  const typename ParamGenerator<T1>::iterator begin1_;
12986  const typename ParamGenerator<T1>::iterator end1_;
12987  typename ParamGenerator<T1>::iterator current1_;
12988  const typename ParamGenerator<T2>::iterator begin2_;
12989  const typename ParamGenerator<T2>::iterator end2_;
12990  typename ParamGenerator<T2>::iterator current2_;
12991  const typename ParamGenerator<T3>::iterator begin3_;
12992  const typename ParamGenerator<T3>::iterator end3_;
12993  typename ParamGenerator<T3>::iterator current3_;
12994  const typename ParamGenerator<T4>::iterator begin4_;
12995  const typename ParamGenerator<T4>::iterator end4_;
12996  typename ParamGenerator<T4>::iterator current4_;
12997  const typename ParamGenerator<T5>::iterator begin5_;
12998  const typename ParamGenerator<T5>::iterator end5_;
12999  typename ParamGenerator<T5>::iterator current5_;
13000  const typename ParamGenerator<T6>::iterator begin6_;
13001  const typename ParamGenerator<T6>::iterator end6_;
13002  typename ParamGenerator<T6>::iterator current6_;
13003  const typename ParamGenerator<T7>::iterator begin7_;
13004  const typename ParamGenerator<T7>::iterator end7_;
13005  typename ParamGenerator<T7>::iterator current7_;
13006  const typename ParamGenerator<T8>::iterator begin8_;
13007  const typename ParamGenerator<T8>::iterator end8_;
13008  typename ParamGenerator<T8>::iterator current8_;
13009  const typename ParamGenerator<T9>::iterator begin9_;
13010  const typename ParamGenerator<T9>::iterator end9_;
13011  typename ParamGenerator<T9>::iterator current9_;
13012  const typename ParamGenerator<T10>::iterator begin10_;
13013  const typename ParamGenerator<T10>::iterator end10_;
13014  typename ParamGenerator<T10>::iterator current10_;
13015  std::shared_ptr<ParamType> current_value_;
13016  }; // class CartesianProductGenerator10::Iterator
13017 
13018  // No implementation - assignment is unsupported.
13019  void operator=(const CartesianProductGenerator10& other);
13020 
13021  const ParamGenerator<T1> g1_;
13022  const ParamGenerator<T2> g2_;
13023  const ParamGenerator<T3> g3_;
13024  const ParamGenerator<T4> g4_;
13025  const ParamGenerator<T5> g5_;
13026  const ParamGenerator<T6> g6_;
13027  const ParamGenerator<T7> g7_;
13028  const ParamGenerator<T8> g8_;
13029  const ParamGenerator<T9> g9_;
13030  const ParamGenerator<T10> g10_;
13031 }; // class CartesianProductGenerator10
13032 
13033 
13034 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
13035 //
13036 // Helper classes providing Combine() with polymorphic features. They allow
13037 // casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
13038 // convertible to U.
13039 //
13040 template <class Generator1, class Generator2>
13042  public:
13043 CartesianProductHolder2(const Generator1& g1, const Generator2& g2)
13044  : g1_(g1), g2_(g2) {}
13045  template <typename T1, typename T2>
13049  static_cast<ParamGenerator<T1> >(g1_),
13050  static_cast<ParamGenerator<T2> >(g2_)));
13051  }
13052 
13053  private:
13054  // No implementation - assignment is unsupported.
13055  void operator=(const CartesianProductHolder2& other);
13056 
13057  const Generator1 g1_;
13058  const Generator2 g2_;
13059 }; // class CartesianProductHolder2
13060 
13061 template <class Generator1, class Generator2, class Generator3>
13063  public:
13064 CartesianProductHolder3(const Generator1& g1, const Generator2& g2,
13065  const Generator3& g3)
13066  : g1_(g1), g2_(g2), g3_(g3) {}
13067  template <typename T1, typename T2, typename T3>
13071  static_cast<ParamGenerator<T1> >(g1_),
13072  static_cast<ParamGenerator<T2> >(g2_),
13073  static_cast<ParamGenerator<T3> >(g3_)));
13074  }
13075 
13076  private:
13077  // No implementation - assignment is unsupported.
13078  void operator=(const CartesianProductHolder3& other);
13079 
13080  const Generator1 g1_;
13081  const Generator2 g2_;
13082  const Generator3 g3_;
13083 }; // class CartesianProductHolder3
13084 
13085 template <class Generator1, class Generator2, class Generator3,
13086  class Generator4>
13088  public:
13089 CartesianProductHolder4(const Generator1& g1, const Generator2& g2,
13090  const Generator3& g3, const Generator4& g4)
13091  : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
13092  template <typename T1, typename T2, typename T3, typename T4>
13096  static_cast<ParamGenerator<T1> >(g1_),
13097  static_cast<ParamGenerator<T2> >(g2_),
13098  static_cast<ParamGenerator<T3> >(g3_),
13099  static_cast<ParamGenerator<T4> >(g4_)));
13100  }
13101 
13102  private:
13103  // No implementation - assignment is unsupported.
13104  void operator=(const CartesianProductHolder4& other);
13105 
13106  const Generator1 g1_;
13107  const Generator2 g2_;
13108  const Generator3 g3_;
13109  const Generator4 g4_;
13110 }; // class CartesianProductHolder4
13111 
13112 template <class Generator1, class Generator2, class Generator3,
13113  class Generator4, class Generator5>
13115  public:
13116 CartesianProductHolder5(const Generator1& g1, const Generator2& g2,
13117  const Generator3& g3, const Generator4& g4, const Generator5& g5)
13118  : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
13119  template <typename T1, typename T2, typename T3, typename T4, typename T5>
13123  static_cast<ParamGenerator<T1> >(g1_),
13124  static_cast<ParamGenerator<T2> >(g2_),
13125  static_cast<ParamGenerator<T3> >(g3_),
13126  static_cast<ParamGenerator<T4> >(g4_),
13127  static_cast<ParamGenerator<T5> >(g5_)));
13128  }
13129 
13130  private:
13131  // No implementation - assignment is unsupported.
13132  void operator=(const CartesianProductHolder5& other);
13133 
13134  const Generator1 g1_;
13135  const Generator2 g2_;
13136  const Generator3 g3_;
13137  const Generator4 g4_;
13138  const Generator5 g5_;
13139 }; // class CartesianProductHolder5
13140 
13141 template <class Generator1, class Generator2, class Generator3,
13142  class Generator4, class Generator5, class Generator6>
13144  public:
13145 CartesianProductHolder6(const Generator1& g1, const Generator2& g2,
13146  const Generator3& g3, const Generator4& g4, const Generator5& g5,
13147  const Generator6& g6)
13148  : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
13149  template <typename T1, typename T2, typename T3, typename T4, typename T5,
13150  typename T6>
13154  static_cast<ParamGenerator<T1> >(g1_),
13155  static_cast<ParamGenerator<T2> >(g2_),
13156  static_cast<ParamGenerator<T3> >(g3_),
13157  static_cast<ParamGenerator<T4> >(g4_),
13158  static_cast<ParamGenerator<T5> >(g5_),
13159  static_cast<ParamGenerator<T6> >(g6_)));
13160  }
13161 
13162  private:
13163  // No implementation - assignment is unsupported.
13164  void operator=(const CartesianProductHolder6& other);
13165 
13166  const Generator1 g1_;
13167  const Generator2 g2_;
13168  const Generator3 g3_;
13169  const Generator4 g4_;
13170  const Generator5 g5_;
13171  const Generator6 g6_;
13172 }; // class CartesianProductHolder6
13173 
13174 template <class Generator1, class Generator2, class Generator3,
13175  class Generator4, class Generator5, class Generator6, class Generator7>
13177  public:
13178 CartesianProductHolder7(const Generator1& g1, const Generator2& g2,
13179  const Generator3& g3, const Generator4& g4, const Generator5& g5,
13180  const Generator6& g6, const Generator7& g7)
13181  : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
13182  template <typename T1, typename T2, typename T3, typename T4, typename T5,
13183  typename T6, typename T7>
13187  static_cast<ParamGenerator<T1> >(g1_),
13188  static_cast<ParamGenerator<T2> >(g2_),
13189  static_cast<ParamGenerator<T3> >(g3_),
13190  static_cast<ParamGenerator<T4> >(g4_),
13191  static_cast<ParamGenerator<T5> >(g5_),
13192  static_cast<ParamGenerator<T6> >(g6_),
13193  static_cast<ParamGenerator<T7> >(g7_)));
13194  }
13195 
13196  private:
13197  // No implementation - assignment is unsupported.
13198  void operator=(const CartesianProductHolder7& other);
13199 
13200  const Generator1 g1_;
13201  const Generator2 g2_;
13202  const Generator3 g3_;
13203  const Generator4 g4_;
13204  const Generator5 g5_;
13205  const Generator6 g6_;
13206  const Generator7 g7_;
13207 }; // class CartesianProductHolder7
13208 
13209 template <class Generator1, class Generator2, class Generator3,
13210  class Generator4, class Generator5, class Generator6, class Generator7,
13211  class Generator8>
13213  public:
13214 CartesianProductHolder8(const Generator1& g1, const Generator2& g2,
13215  const Generator3& g3, const Generator4& g4, const Generator5& g5,
13216  const Generator6& g6, const Generator7& g7, const Generator8& g8)
13217  : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
13218  g8_(g8) {}
13219  template <typename T1, typename T2, typename T3, typename T4, typename T5,
13220  typename T6, typename T7, typename T8>
13221  operator ParamGenerator< ::std::tuple<T1, T2, T3, T4, T5, T6, T7,
13222  T8> >() const {
13225  static_cast<ParamGenerator<T1> >(g1_),
13226  static_cast<ParamGenerator<T2> >(g2_),
13227  static_cast<ParamGenerator<T3> >(g3_),
13228  static_cast<ParamGenerator<T4> >(g4_),
13229  static_cast<ParamGenerator<T5> >(g5_),
13230  static_cast<ParamGenerator<T6> >(g6_),
13231  static_cast<ParamGenerator<T7> >(g7_),
13232  static_cast<ParamGenerator<T8> >(g8_)));
13233  }
13234 
13235  private:
13236  // No implementation - assignment is unsupported.
13237  void operator=(const CartesianProductHolder8& other);
13238 
13239  const Generator1 g1_;
13240  const Generator2 g2_;
13241  const Generator3 g3_;
13242  const Generator4 g4_;
13243  const Generator5 g5_;
13244  const Generator6 g6_;
13245  const Generator7 g7_;
13246  const Generator8 g8_;
13247 }; // class CartesianProductHolder8
13248 
13249 template <class Generator1, class Generator2, class Generator3,
13250  class Generator4, class Generator5, class Generator6, class Generator7,
13251  class Generator8, class Generator9>
13253  public:
13254 CartesianProductHolder9(const Generator1& g1, const Generator2& g2,
13255  const Generator3& g3, const Generator4& g4, const Generator5& g5,
13256  const Generator6& g6, const Generator7& g7, const Generator8& g8,
13257  const Generator9& g9)
13258  : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
13259  g9_(g9) {}
13260  template <typename T1, typename T2, typename T3, typename T4, typename T5,
13261  typename T6, typename T7, typename T8, typename T9>
13262  operator ParamGenerator< ::std::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
13263  T9> >() const {
13266  static_cast<ParamGenerator<T1> >(g1_),
13267  static_cast<ParamGenerator<T2> >(g2_),
13268  static_cast<ParamGenerator<T3> >(g3_),
13269  static_cast<ParamGenerator<T4> >(g4_),
13270  static_cast<ParamGenerator<T5> >(g5_),
13271  static_cast<ParamGenerator<T6> >(g6_),
13272  static_cast<ParamGenerator<T7> >(g7_),
13273  static_cast<ParamGenerator<T8> >(g8_),
13274  static_cast<ParamGenerator<T9> >(g9_)));
13275  }
13276 
13277  private:
13278  // No implementation - assignment is unsupported.
13279  void operator=(const CartesianProductHolder9& other);
13280 
13281  const Generator1 g1_;
13282  const Generator2 g2_;
13283  const Generator3 g3_;
13284  const Generator4 g4_;
13285  const Generator5 g5_;
13286  const Generator6 g6_;
13287  const Generator7 g7_;
13288  const Generator8 g8_;
13289  const Generator9 g9_;
13290 }; // class CartesianProductHolder9
13291 
13292 template <class Generator1, class Generator2, class Generator3,
13293  class Generator4, class Generator5, class Generator6, class Generator7,
13294  class Generator8, class Generator9, class Generator10>
13296  public:
13297 CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
13298  const Generator3& g3, const Generator4& g4, const Generator5& g5,
13299  const Generator6& g6, const Generator7& g7, const Generator8& g8,
13300  const Generator9& g9, const Generator10& g10)
13301  : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
13302  g9_(g9), g10_(g10) {}
13303  template <typename T1, typename T2, typename T3, typename T4, typename T5,
13304  typename T6, typename T7, typename T8, typename T9, typename T10>
13305  operator ParamGenerator< ::std::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9,
13306  T10> >() const {
13307  return ParamGenerator< ::std::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9,
13308  T10> >(
13309  new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
13310  T10>(
13311  static_cast<ParamGenerator<T1> >(g1_),
13312  static_cast<ParamGenerator<T2> >(g2_),
13313  static_cast<ParamGenerator<T3> >(g3_),
13314  static_cast<ParamGenerator<T4> >(g4_),
13315  static_cast<ParamGenerator<T5> >(g5_),
13316  static_cast<ParamGenerator<T6> >(g6_),
13317  static_cast<ParamGenerator<T7> >(g7_),
13318  static_cast<ParamGenerator<T8> >(g8_),
13319  static_cast<ParamGenerator<T9> >(g9_),
13320  static_cast<ParamGenerator<T10> >(g10_)));
13321  }
13322 
13323  private:
13324  // No implementation - assignment is unsupported.
13325  void operator=(const CartesianProductHolder10& other);
13326 
13327  const Generator1 g1_;
13328  const Generator2 g2_;
13329  const Generator3 g3_;
13330  const Generator4 g4_;
13331  const Generator5 g5_;
13332  const Generator6 g6_;
13333  const Generator7 g7_;
13334  const Generator8 g8_;
13335  const Generator9 g9_;
13336  const Generator10 g10_;
13337 }; // class CartesianProductHolder10
13338 
13339 } // namespace internal
13340 } // namespace testing
13341 
13342 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
13343 
13344 namespace testing {
13345 
13346 // Functions producing parameter generators.
13347 //
13348 // Google Test uses these generators to produce parameters for value-
13349 // parameterized tests. When a parameterized test suite is instantiated
13350 // with a particular generator, Google Test creates and runs tests
13351 // for each element in the sequence produced by the generator.
13352 //
13353 // In the following sample, tests from test suite FooTest are instantiated
13354 // each three times with parameter values 3, 5, and 8:
13355 //
13356 // class FooTest : public TestWithParam<int> { ... };
13357 //
13358 // TEST_P(FooTest, TestThis) {
13359 // }
13360 // TEST_P(FooTest, TestThat) {
13361 // }
13362 // INSTANTIATE_TEST_SUITE_P(TestSequence, FooTest, Values(3, 5, 8));
13363 //
13364 
13365 // Range() returns generators providing sequences of values in a range.
13366 //
13367 // Synopsis:
13368 // Range(start, end)
13369 // - returns a generator producing a sequence of values {start, start+1,
13370 // start+2, ..., }.
13371 // Range(start, end, step)
13372 // - returns a generator producing a sequence of values {start, start+step,
13373 // start+step+step, ..., }.
13374 // Notes:
13375 // * The generated sequences never include end. For example, Range(1, 5)
13376 // returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
13377 // returns a generator producing {1, 3, 5, 7}.
13378 // * start and end must have the same type. That type may be any integral or
13379 // floating-point type or a user defined type satisfying these conditions:
13380 // * It must be assignable (have operator=() defined).
13381 // * It must have operator+() (operator+(int-compatible type) for
13382 // two-operand version).
13383 // * It must have operator<() defined.
13384 // Elements in the resulting sequences will also have that type.
13385 // * Condition start < end must be satisfied in order for resulting sequences
13386 // to contain any elements.
13387 //
13388 template <typename T, typename IncrementT>
13389 internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
13391  new internal::RangeGenerator<T, IncrementT>(start, end, step));
13392 }
13393 
13394 template <typename T>
13396  return Range(start, end, 1);
13397 }
13398 
13399 // ValuesIn() function allows generation of tests with parameters coming from
13400 // a container.
13401 //
13402 // Synopsis:
13403 // ValuesIn(const T (&array)[N])
13404 // - returns a generator producing sequences with elements from
13405 // a C-style array.
13406 // ValuesIn(const Container& container)
13407 // - returns a generator producing sequences with elements from
13408 // an STL-style container.
13409 // ValuesIn(Iterator begin, Iterator end)
13410 // - returns a generator producing sequences with elements from
13411 // a range [begin, end) defined by a pair of STL-style iterators. These
13412 // iterators can also be plain C pointers.
13413 //
13414 // Please note that ValuesIn copies the values from the containers
13415 // passed in and keeps them to generate tests in RUN_ALL_TESTS().
13416 //
13417 // Examples:
13418 //
13419 // This instantiates tests from test suite StringTest
13420 // each with C-string values of "foo", "bar", and "baz":
13421 //
13422 // const char* strings[] = {"foo", "bar", "baz"};
13423 // INSTANTIATE_TEST_SUITE_P(StringSequence, StringTest, ValuesIn(strings));
13424 //
13425 // This instantiates tests from test suite StlStringTest
13426 // each with STL strings with values "a" and "b":
13427 //
13428 // ::std::vector< ::std::string> GetParameterStrings() {
13429 // ::std::vector< ::std::string> v;
13430 // v.push_back("a");
13431 // v.push_back("b");
13432 // return v;
13433 // }
13434 //
13435 // INSTANTIATE_TEST_SUITE_P(CharSequence,
13436 // StlStringTest,
13437 // ValuesIn(GetParameterStrings()));
13438 //
13439 //
13440 // This will also instantiate tests from CharTest
13441 // each with parameter values 'a' and 'b':
13442 //
13443 // ::std::list<char> GetParameterChars() {
13444 // ::std::list<char> list;
13445 // list.push_back('a');
13446 // list.push_back('b');
13447 // return list;
13448 // }
13449 // ::std::list<char> l = GetParameterChars();
13450 // INSTANTIATE_TEST_SUITE_P(CharSequence2,
13451 // CharTest,
13452 // ValuesIn(l.begin(), l.end()));
13453 //
13454 template <typename ForwardIterator>
13455 internal::ParamGenerator<
13456  typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
13457 ValuesIn(ForwardIterator begin, ForwardIterator end) {
13458  typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
13459  ::value_type ParamType;
13462 }
13463 
13464 template <typename T, size_t N>
13466  return ValuesIn(array, array + N);
13467 }
13468 
13469 template <class Container>
13471  const Container& container) {
13472  return ValuesIn(container.begin(), container.end());
13473 }
13474 
13475 // Values() allows generating tests from explicitly specified list of
13476 // parameters.
13477 //
13478 // Synopsis:
13479 // Values(T v1, T v2, ..., T vN)
13480 // - returns a generator producing sequences with elements v1, v2, ..., vN.
13481 //
13482 // For example, this instantiates tests from test suite BarTest each
13483 // with values "one", "two", and "three":
13484 //
13485 // INSTANTIATE_TEST_SUITE_P(NumSequence,
13486 // BarTest,
13487 // Values("one", "two", "three"));
13488 //
13489 // This instantiates tests from test suite BazTest each with values 1, 2, 3.5.
13490 // The exact type of values will depend on the type of parameter in BazTest.
13491 //
13492 // INSTANTIATE_TEST_SUITE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
13493 //
13494 //
13495 template <typename... T>
13497  return internal::ValueArray<T...>(std::move(v)...);
13498 }
13499 
13500 // Bool() allows generating tests with parameters in a set of (false, true).
13501 //
13502 // Synopsis:
13503 // Bool()
13504 // - returns a generator producing sequences with elements {false, true}.
13505 //
13506 // It is useful when testing code that depends on Boolean flags. Combinations
13507 // of multiple flags can be tested when several Bool()'s are combined using
13508 // Combine() function.
13509 //
13510 // In the following example all tests in the test suite FlagDependentTest
13511 // will be instantiated twice with parameters false and true.
13512 //
13513 // class FlagDependentTest : public testing::TestWithParam<bool> {
13514 // virtual void SetUp() {
13515 // external_flag = GetParam();
13516 // }
13517 // }
13518 // INSTANTIATE_TEST_SUITE_P(BoolSequence, FlagDependentTest, Bool());
13519 //
13521  return Values(false, true);
13522 }
13523 
13524 // Combine() allows the user to combine two or more sequences to produce
13525 // values of a Cartesian product of those sequences' elements.
13526 //
13527 // Synopsis:
13528 // Combine(gen1, gen2, ..., genN)
13529 // - returns a generator producing sequences with elements coming from
13530 // the Cartesian product of elements from the sequences generated by
13531 // gen1, gen2, ..., genN. The sequence elements will have a type of
13532 // std::tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
13533 // of elements from sequences produces by gen1, gen2, ..., genN.
13534 //
13535 // Combine can have up to 10 arguments.
13536 //
13537 // Example:
13538 //
13539 // This will instantiate tests in test suite AnimalTest each one with
13540 // the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
13541 // tuple("dog", BLACK), and tuple("dog", WHITE):
13542 //
13543 // enum Color { BLACK, GRAY, WHITE };
13544 // class AnimalTest
13545 // : public testing::TestWithParam<std::tuple<const char*, Color> > {...};
13546 //
13547 // TEST_P(AnimalTest, AnimalLooksNice) {...}
13548 //
13549 // INSTANTIATE_TEST_SUITE_P(AnimalVariations, AnimalTest,
13550 // Combine(Values("cat", "dog"),
13551 // Values(BLACK, WHITE)));
13552 //
13553 // This will instantiate tests in FlagDependentTest with all variations of two
13554 // Boolean flags:
13555 //
13556 // class FlagDependentTest
13557 // : public testing::TestWithParam<std::tuple<bool, bool> > {
13558 // virtual void SetUp() {
13559 // // Assigns external_flag_1 and external_flag_2 values from the tuple.
13560 // std::tie(external_flag_1, external_flag_2) = GetParam();
13561 // }
13562 // };
13563 //
13564 // TEST_P(FlagDependentTest, TestFeature1) {
13565 // // Test your code using external_flag_1 and external_flag_2 here.
13566 // }
13567 // INSTANTIATE_TEST_SUITE_P(TwoBoolSequence, FlagDependentTest,
13568 // Combine(Bool(), Bool()));
13569 //
13570 template <typename Generator1, typename Generator2>
13572  const Generator1& g1, const Generator2& g2) {
13574  g1, g2);
13575 }
13576 
13577 template <typename Generator1, typename Generator2, typename Generator3>
13579  const Generator1& g1, const Generator2& g2, const Generator3& g3) {
13581  g1, g2, g3);
13582 }
13583 
13584 template <typename Generator1, typename Generator2, typename Generator3,
13585  typename Generator4>
13586 internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
13587  Generator4> Combine(
13588  const Generator1& g1, const Generator2& g2, const Generator3& g3,
13589  const Generator4& g4) {
13590  return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
13591  Generator4>(
13592  g1, g2, g3, g4);
13593 }
13594 
13595 template <typename Generator1, typename Generator2, typename Generator3,
13596  typename Generator4, typename Generator5>
13597 internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
13598  Generator4, Generator5> Combine(
13599  const Generator1& g1, const Generator2& g2, const Generator3& g3,
13600  const Generator4& g4, const Generator5& g5) {
13601  return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
13602  Generator4, Generator5>(
13603  g1, g2, g3, g4, g5);
13604 }
13605 
13606 template <typename Generator1, typename Generator2, typename Generator3,
13607  typename Generator4, typename Generator5, typename Generator6>
13608 internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
13609  Generator4, Generator5, Generator6> Combine(
13610  const Generator1& g1, const Generator2& g2, const Generator3& g3,
13611  const Generator4& g4, const Generator5& g5, const Generator6& g6) {
13612  return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
13613  Generator4, Generator5, Generator6>(
13614  g1, g2, g3, g4, g5, g6);
13615 }
13616 
13617 template <typename Generator1, typename Generator2, typename Generator3,
13618  typename Generator4, typename Generator5, typename Generator6,
13619  typename Generator7>
13620 internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
13621  Generator4, Generator5, Generator6, Generator7> Combine(
13622  const Generator1& g1, const Generator2& g2, const Generator3& g3,
13623  const Generator4& g4, const Generator5& g5, const Generator6& g6,
13624  const Generator7& g7) {
13625  return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
13626  Generator4, Generator5, Generator6, Generator7>(
13627  g1, g2, g3, g4, g5, g6, g7);
13628 }
13629 
13630 template <typename Generator1, typename Generator2, typename Generator3,
13631  typename Generator4, typename Generator5, typename Generator6,
13632  typename Generator7, typename Generator8>
13633 internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
13634  Generator4, Generator5, Generator6, Generator7, Generator8> Combine(
13635  const Generator1& g1, const Generator2& g2, const Generator3& g3,
13636  const Generator4& g4, const Generator5& g5, const Generator6& g6,
13637  const Generator7& g7, const Generator8& g8) {
13638  return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
13639  Generator4, Generator5, Generator6, Generator7, Generator8>(
13640  g1, g2, g3, g4, g5, g6, g7, g8);
13641 }
13642 
13643 template <typename Generator1, typename Generator2, typename Generator3,
13644  typename Generator4, typename Generator5, typename Generator6,
13645  typename Generator7, typename Generator8, typename Generator9>
13646 internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
13647  Generator4, Generator5, Generator6, Generator7, Generator8,
13648  Generator9> Combine(
13649  const Generator1& g1, const Generator2& g2, const Generator3& g3,
13650  const Generator4& g4, const Generator5& g5, const Generator6& g6,
13651  const Generator7& g7, const Generator8& g8, const Generator9& g9) {
13652  return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
13653  Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(
13654  g1, g2, g3, g4, g5, g6, g7, g8, g9);
13655 }
13656 
13657 template <typename Generator1, typename Generator2, typename Generator3,
13658  typename Generator4, typename Generator5, typename Generator6,
13659  typename Generator7, typename Generator8, typename Generator9,
13660  typename Generator10>
13661 internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
13662  Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
13663  Generator10> Combine(
13664  const Generator1& g1, const Generator2& g2, const Generator3& g3,
13665  const Generator4& g4, const Generator5& g5, const Generator6& g6,
13666  const Generator7& g7, const Generator8& g8, const Generator9& g9,
13667  const Generator10& g10) {
13668  return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
13669  Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
13670  Generator10>(
13671  g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
13672 }
13673 
13674 #define TEST_P(test_suite_name, test_name) \
13675  class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
13676  : public test_suite_name { \
13677  public: \
13678  GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
13679  virtual void TestBody(); \
13680  \
13681  private: \
13682  static int AddToRegistry() { \
13683  ::testing::UnitTest::GetInstance() \
13684  ->parameterized_test_registry() \
13685  .GetTestSuitePatternHolder<test_suite_name>( \
13686  #test_suite_name, \
13687  ::testing::internal::CodeLocation(__FILE__, __LINE__)) \
13688  ->AddTestPattern( \
13689  GTEST_STRINGIFY_(test_suite_name), GTEST_STRINGIFY_(test_name), \
13690  new ::testing::internal::TestMetaFactory<GTEST_TEST_CLASS_NAME_( \
13691  test_suite_name, test_name)>()); \
13692  return 0; \
13693  } \
13694  static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
13695  GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
13696  test_name)); \
13697  }; \
13698  int GTEST_TEST_CLASS_NAME_(test_suite_name, \
13699  test_name)::gtest_registering_dummy_ = \
13700  GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \
13701  void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
13702 
13703 // The optional last argument to INSTANTIATE_TEST_SUITE_P allows the user
13704 // to specify a function or functor that generates custom test name suffixes
13705 // based on the test parameters. The function should accept one argument of
13706 // type testing::TestParamInfo<class ParamType>, and return std::string.
13707 //
13708 // testing::PrintToStringParamName is a builtin test suffix generator that
13709 // returns the value of testing::PrintToString(GetParam()).
13710 //
13711 // Note: test names must be non-empty, unique, and may only contain ASCII
13712 // alphanumeric characters or underscore. Because PrintToString adds quotes
13713 // to std::string and C strings, it won't work for these types.
13714 
13715 #define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, generator, ...) \
13716  static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \
13717  gtest_##prefix##test_suite_name##_EvalGenerator_() { \
13718  return generator; \
13719  } \
13720  static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \
13721  const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \
13722  return ::testing::internal::GetParamNameGen<test_suite_name::ParamType>( \
13723  __VA_ARGS__)(info); \
13724  } \
13725  static int gtest_##prefix##test_suite_name##_dummy_ \
13726  GTEST_ATTRIBUTE_UNUSED_ = \
13727  ::testing::UnitTest::GetInstance() \
13728  ->parameterized_test_registry() \
13729  .GetTestSuitePatternHolder<test_suite_name>( \
13730  #test_suite_name, \
13731  ::testing::internal::CodeLocation(__FILE__, __LINE__)) \
13732  ->AddTestSuiteInstantiation( \
13733  #prefix, &gtest_##prefix##test_suite_name##_EvalGenerator_, \
13734  &gtest_##prefix##test_suite_name##_EvalGenerateName_, \
13735  __FILE__, __LINE__)
13736 
13737 // Legacy API is deprecated but still available
13738 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13739 #define INSTANTIATE_TEST_CASE_P INSTANTIATE_TEST_SUITE_P
13740 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13741 
13742 } // namespace testing
13743 
13744 #endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
13745 // Copyright 2006, Google Inc.
13746 // All rights reserved.
13747 //
13748 // Redistribution and use in source and binary forms, with or without
13749 // modification, are permitted provided that the following conditions are
13750 // met:
13751 //
13752 // * Redistributions of source code must retain the above copyright
13753 // notice, this list of conditions and the following disclaimer.
13754 // * Redistributions in binary form must reproduce the above
13755 // copyright notice, this list of conditions and the following disclaimer
13756 // in the documentation and/or other materials provided with the
13757 // distribution.
13758 // * Neither the name of Google Inc. nor the names of its
13759 // contributors may be used to endorse or promote products derived from
13760 // this software without specific prior written permission.
13761 //
13762 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13763 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13764 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
13765 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
13766 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
13767 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
13768 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
13769 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13770 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13771 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13772 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13773 
13774 //
13775 // Google C++ Testing and Mocking Framework definitions useful in production code.
13776 // GOOGLETEST_CM0003 DO NOT DELETE
13777 
13778 #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
13779 #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
13780 
13781 // When you need to test the private or protected members of a class,
13782 // use the FRIEND_TEST macro to declare your tests as friends of the
13783 // class. For example:
13784 //
13785 // class MyClass {
13786 // private:
13787 // void PrivateMethod();
13788 // FRIEND_TEST(MyClassTest, PrivateMethodWorks);
13789 // };
13790 //
13791 // class MyClassTest : public testing::Test {
13792 // // ...
13793 // };
13794 //
13795 // TEST_F(MyClassTest, PrivateMethodWorks) {
13796 // // Can call MyClass::PrivateMethod() here.
13797 // }
13798 //
13799 // Note: The test class must be in the same namespace as the class being tested.
13800 // For example, putting MyClassTest in an anonymous namespace will not work.
13801 
13802 #define FRIEND_TEST(test_case_name, test_name)\
13803 friend class test_case_name##_##test_name##_Test
13804 
13805 #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
13806 // Copyright 2008, Google Inc.
13807 // All rights reserved.
13808 //
13809 // Redistribution and use in source and binary forms, with or without
13810 // modification, are permitted provided that the following conditions are
13811 // met:
13812 //
13813 // * Redistributions of source code must retain the above copyright
13814 // notice, this list of conditions and the following disclaimer.
13815 // * Redistributions in binary form must reproduce the above
13816 // copyright notice, this list of conditions and the following disclaimer
13817 // in the documentation and/or other materials provided with the
13818 // distribution.
13819 // * Neither the name of Google Inc. nor the names of its
13820 // contributors may be used to endorse or promote products derived from
13821 // this software without specific prior written permission.
13822 //
13823 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13824 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13825 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
13826 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
13827 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
13828 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
13829 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
13830 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13831 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13832 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13833 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13834 //
13835 // GOOGLETEST_CM0001 DO NOT DELETE
13836 
13837 #ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
13838 #define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
13839 
13840 #include <iosfwd>
13841 #include <vector>
13842 
13844 /* class A needs to have dll-interface to be used by clients of class B */)
13845 
13846 namespace testing {
13847 
13848 // A copyable object representing the result of a test part (i.e. an
13849 // assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
13850 //
13851 // Don't inherit from TestPartResult as its destructor is not virtual.
13852 class GTEST_API_ TestPartResult {
13853  public:
13854  // The possible outcomes of a test part (i.e. an assertion or an
13855  // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
13856  enum Type {
13857  kSuccess, // Succeeded.
13858  kNonFatalFailure, // Failed but the test can continue.
13859  kFatalFailure, // Failed and the test should be terminated.
13860  kSkip // Skipped.
13861  };
13862 
13863  // C'tor. TestPartResult does NOT have a default constructor.
13864  // Always use this constructor (with parameters) to create a
13865  // TestPartResult object.
13866  TestPartResult(Type a_type, const char* a_file_name, int a_line_number,
13867  const char* a_message)
13868  : type_(a_type),
13869  file_name_(a_file_name == nullptr ? "" : a_file_name),
13870  line_number_(a_line_number),
13871  summary_(ExtractSummary(a_message)),
13872  message_(a_message) {}
13873 
13874  // Gets the outcome of the test part.
13875  Type type() const { return type_; }
13876 
13877  // Gets the name of the source file where the test part took place, or
13878  // NULL if it's unknown.
13879  const char* file_name() const {
13880  return file_name_.empty() ? nullptr : file_name_.c_str();
13881  }
13882 
13883  // Gets the line in the source file where the test part took place,
13884  // or -1 if it's unknown.
13885  int line_number() const { return line_number_; }
13886 
13887  // Gets the summary of the failure message.
13888  const char* summary() const { return summary_.c_str(); }
13889 
13890  // Gets the message associated with the test part.
13891  const char* message() const { return message_.c_str(); }
13892 
13893  // Returns true iff the test part was skipped.
13894  bool skipped() const { return type_ == kSkip; }
13895 
13896  // Returns true iff the test part passed.
13897  bool passed() const { return type_ == kSuccess; }
13898 
13899  // Returns true iff the test part non-fatally failed.
13900  bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
13901 
13902  // Returns true iff the test part fatally failed.
13903  bool fatally_failed() const { return type_ == kFatalFailure; }
13904 
13905  // Returns true iff the test part failed.
13906  bool failed() const { return fatally_failed() || nonfatally_failed(); }
13907 
13908  private:
13909  Type type_;
13910 
13911  // Gets the summary of the failure message by omitting the stack
13912  // trace in it.
13913  static std::string ExtractSummary(const char* message);
13914 
13915  // The name of the source file where the test part took place, or
13916  // "" if the source file is unknown.
13917  std::string file_name_;
13918  // The line in the source file where the test part took place, or -1
13919  // if the line number is unknown.
13920  int line_number_;
13921  std::string summary_; // The test failure summary.
13922  std::string message_; // The test failure message.
13923 };
13924 
13925 // Prints a TestPartResult object.
13926 std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
13927 
13928 // An array of TestPartResult objects.
13929 //
13930 // Don't inherit from TestPartResultArray as its destructor is not
13931 // virtual.
13932 class GTEST_API_ TestPartResultArray {
13933  public:
13934  TestPartResultArray() {}
13935 
13936  // Appends the given TestPartResult to the array.
13937  void Append(const TestPartResult& result);
13938 
13939  // Returns the TestPartResult at the given index (0-based).
13940  const TestPartResult& GetTestPartResult(int index) const;
13941 
13942  // Returns the number of TestPartResult objects in the array.
13943  int size() const;
13944 
13945  private:
13946  std::vector<TestPartResult> array_;
13947 
13948  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
13949 };
13950 
13951 // This interface knows how to report a test part result.
13952 class GTEST_API_ TestPartResultReporterInterface {
13953  public:
13954  virtual ~TestPartResultReporterInterface() {}
13955 
13956  virtual void ReportTestPartResult(const TestPartResult& result) = 0;
13957 };
13958 
13959 namespace internal {
13960 
13961 // This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
13962 // statement generates new fatal failures. To do so it registers itself as the
13963 // current test part result reporter. Besides checking if fatal failures were
13964 // reported, it only delegates the reporting to the former result reporter.
13965 // The original result reporter is restored in the destructor.
13966 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
13967 class GTEST_API_ HasNewFatalFailureHelper
13968  : public TestPartResultReporterInterface {
13969  public:
13970  HasNewFatalFailureHelper();
13971  ~HasNewFatalFailureHelper() override;
13972  void ReportTestPartResult(const TestPartResult& result) override;
13973  bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
13974  private:
13975  bool has_new_fatal_failure_;
13976  TestPartResultReporterInterface* original_reporter_;
13977 
13978  GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
13979 };
13980 
13981 } // namespace internal
13982 
13983 } // namespace testing
13984 
13986 
13987 #endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
13988 // Copyright 2008 Google Inc.
13989 // All Rights Reserved.
13990 //
13991 // Redistribution and use in source and binary forms, with or without
13992 // modification, are permitted provided that the following conditions are
13993 // met:
13994 //
13995 // * Redistributions of source code must retain the above copyright
13996 // notice, this list of conditions and the following disclaimer.
13997 // * Redistributions in binary form must reproduce the above
13998 // copyright notice, this list of conditions and the following disclaimer
13999 // in the documentation and/or other materials provided with the
14000 // distribution.
14001 // * Neither the name of Google Inc. nor the names of its
14002 // contributors may be used to endorse or promote products derived from
14003 // this software without specific prior written permission.
14004 //
14005 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14006 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
14007 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
14008 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
14009 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
14010 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
14011 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
14012 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
14013 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14014 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14015 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14016 
14017 
14018 // GOOGLETEST_CM0001 DO NOT DELETE
14019 
14020 #ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
14021 #define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
14022 
14023 // This header implements typed tests and type-parameterized tests.
14024 
14025 // Typed (aka type-driven) tests repeat the same test for types in a
14026 // list. You must know which types you want to test with when writing
14027 // typed tests. Here's how you do it:
14028 
14029 #if 0
14030 
14031 // First, define a fixture class template. It should be parameterized
14032 // by a type. Remember to derive it from testing::Test.
14033 template <typename T>
14034 class FooTest : public testing::Test {
14035  public:
14036  ...
14037  typedef std::list<T> List;
14038  static T shared_;
14039  T value_;
14040 };
14041 
14042 // Next, associate a list of types with the test suite, which will be
14043 // repeated for each type in the list. The typedef is necessary for
14044 // the macro to parse correctly.
14045 typedef testing::Types<char, int, unsigned int> MyTypes;
14046 TYPED_TEST_SUITE(FooTest, MyTypes);
14047 
14048 // If the type list contains only one type, you can write that type
14049 // directly without Types<...>:
14050 // TYPED_TEST_SUITE(FooTest, int);
14051 
14052 // Then, use TYPED_TEST() instead of TEST_F() to define as many typed
14053 // tests for this test suite as you want.
14054 TYPED_TEST(FooTest, DoesBlah) {
14055  // Inside a test, refer to TypeParam to get the type parameter.
14056  // Since we are inside a derived class template, C++ requires use to
14057  // visit the members of FooTest via 'this'.
14058  TypeParam n = this->value_;
14059 
14060  // To visit static members of the fixture, add the TestFixture::
14061  // prefix.
14062  n += TestFixture::shared_;
14063 
14064  // To refer to typedefs in the fixture, add the "typename
14065  // TestFixture::" prefix.
14066  typename TestFixture::List values;
14067  values.push_back(n);
14068  ...
14069 }
14070 
14071 TYPED_TEST(FooTest, HasPropertyA) { ... }
14072 
14073 // TYPED_TEST_SUITE takes an optional third argument which allows to specify a
14074 // class that generates custom test name suffixes based on the type. This should
14075 // be a class which has a static template function GetName(int index) returning
14076 // a string for each type. The provided integer index equals the index of the
14077 // type in the provided type list. In many cases the index can be ignored.
14078 //
14079 // For example:
14080 // class MyTypeNames {
14081 // public:
14082 // template <typename T>
14083 // static std::string GetName(int) {
14084 // if (std::is_same<T, char>()) return "char";
14085 // if (std::is_same<T, int>()) return "int";
14086 // if (std::is_same<T, unsigned int>()) return "unsignedInt";
14087 // }
14088 // };
14089 // TYPED_TEST_SUITE(FooTest, MyTypes, MyTypeNames);
14090 
14091 #endif // 0
14092 
14093 // Type-parameterized tests are abstract test patterns parameterized
14094 // by a type. Compared with typed tests, type-parameterized tests
14095 // allow you to define the test pattern without knowing what the type
14096 // parameters are. The defined pattern can be instantiated with
14097 // different types any number of times, in any number of translation
14098 // units.
14099 //
14100 // If you are designing an interface or concept, you can define a
14101 // suite of type-parameterized tests to verify properties that any
14102 // valid implementation of the interface/concept should have. Then,
14103 // each implementation can easily instantiate the test suite to verify
14104 // that it conforms to the requirements, without having to write
14105 // similar tests repeatedly. Here's an example:
14106 
14107 #if 0
14108 
14109 // First, define a fixture class template. It should be parameterized
14110 // by a type. Remember to derive it from testing::Test.
14111 template <typename T>
14112 class FooTest : public testing::Test {
14113  ...
14114 };
14115 
14116 // Next, declare that you will define a type-parameterized test suite
14117 // (the _P suffix is for "parameterized" or "pattern", whichever you
14118 // prefer):
14119 TYPED_TEST_SUITE_P(FooTest);
14120 
14121 // Then, use TYPED_TEST_P() to define as many type-parameterized tests
14122 // for this type-parameterized test suite as you want.
14123 TYPED_TEST_P(FooTest, DoesBlah) {
14124  // Inside a test, refer to TypeParam to get the type parameter.
14125  TypeParam n = 0;
14126  ...
14127 }
14128 
14129 TYPED_TEST_P(FooTest, HasPropertyA) { ... }
14130 
14131 // Now the tricky part: you need to register all test patterns before
14132 // you can instantiate them. The first argument of the macro is the
14133 // test suite name; the rest are the names of the tests in this test
14134 // case.
14135 REGISTER_TYPED_TEST_SUITE_P(FooTest,
14136  DoesBlah, HasPropertyA);
14137 
14138 // Finally, you are free to instantiate the pattern with the types you
14139 // want. If you put the above code in a header file, you can #include
14140 // it in multiple C++ source files and instantiate it multiple times.
14141 //
14142 // To distinguish different instances of the pattern, the first
14143 // argument to the INSTANTIATE_* macro is a prefix that will be added
14144 // to the actual test suite name. Remember to pick unique prefixes for
14145 // different instances.
14146 typedef testing::Types<char, int, unsigned int> MyTypes;
14147 INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
14148 
14149 // If the type list contains only one type, you can write that type
14150 // directly without Types<...>:
14151 // INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, int);
14152 //
14153 // Similar to the optional argument of TYPED_TEST_SUITE above,
14154 // INSTANTIATE_TEST_SUITE_P takes an optional fourth argument which allows to
14155 // generate custom names.
14156 // INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes, MyTypeNames);
14157 
14158 #endif // 0
14159 
14160 
14161 // Implements typed tests.
14162 
14163 #if GTEST_HAS_TYPED_TEST
14164 
14165 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
14166 //
14167 // Expands to the name of the typedef for the type parameters of the
14168 // given test suite.
14169 #define GTEST_TYPE_PARAMS_(TestSuiteName) gtest_type_params_##TestSuiteName##_
14170 
14171 // Expands to the name of the typedef for the NameGenerator, responsible for
14172 // creating the suffixes of the name.
14173 #define GTEST_NAME_GENERATOR_(TestSuiteName) \
14174  gtest_type_params_##TestSuiteName##_NameGenerator
14175 
14176 // The 'Types' template argument below must have spaces around it
14177 // since some compilers may choke on '>>' when passing a template
14178 // instance (e.g. Types<int>)
14179 #define TYPED_TEST_SUITE(CaseName, Types, ...) \
14180  typedef ::testing::internal::TypeList<Types>::type GTEST_TYPE_PARAMS_( \
14181  CaseName); \
14182  typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \
14183  GTEST_NAME_GENERATOR_(CaseName)
14184 
14185 # define TYPED_TEST(CaseName, TestName) \
14186  template <typename gtest_TypeParam_> \
14187  class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
14188  : public CaseName<gtest_TypeParam_> { \
14189  private: \
14190  typedef CaseName<gtest_TypeParam_> TestFixture; \
14191  typedef gtest_TypeParam_ TypeParam; \
14192  virtual void TestBody(); \
14193  }; \
14194  static bool gtest_##CaseName##_##TestName##_registered_ \
14195  GTEST_ATTRIBUTE_UNUSED_ = \
14196  ::testing::internal::TypeParameterizedTest< \
14197  CaseName, \
14198  ::testing::internal::TemplateSel<GTEST_TEST_CLASS_NAME_(CaseName, \
14199  TestName)>, \
14200  GTEST_TYPE_PARAMS_( \
14201  CaseName)>::Register("", \
14202  ::testing::internal::CodeLocation( \
14203  __FILE__, __LINE__), \
14204  #CaseName, #TestName, 0, \
14205  ::testing::internal::GenerateNames< \
14206  GTEST_NAME_GENERATOR_(CaseName), \
14207  GTEST_TYPE_PARAMS_(CaseName)>()); \
14208  template <typename gtest_TypeParam_> \
14209  void GTEST_TEST_CLASS_NAME_(CaseName, \
14210  TestName)<gtest_TypeParam_>::TestBody()
14211 
14212 // Legacy API is deprecated but still available
14213 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
14214 #define TYPED_TEST_CASE TYPED_TEST_SUITE
14215 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
14216 
14217 #endif // GTEST_HAS_TYPED_TEST
14218 
14219 // Implements type-parameterized tests.
14220 
14221 #if GTEST_HAS_TYPED_TEST_P
14222 
14223 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
14224 //
14225 // Expands to the namespace name that the type-parameterized tests for
14226 // the given type-parameterized test suite are defined in. The exact
14227 // name of the namespace is subject to change without notice.
14228 #define GTEST_SUITE_NAMESPACE_(TestSuiteName) gtest_suite_##TestSuiteName##_
14229 
14230 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
14231 //
14232 // Expands to the name of the variable used to remember the names of
14233 // the defined tests in the given test suite.
14234 #define GTEST_TYPED_TEST_SUITE_P_STATE_(TestSuiteName) \
14235  gtest_typed_test_suite_p_state_##TestSuiteName##_
14236 
14237 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
14238 //
14239 // Expands to the name of the variable used to remember the names of
14240 // the registered tests in the given test suite.
14241 #define GTEST_REGISTERED_TEST_NAMES_(TestSuiteName) \
14242  gtest_registered_test_names_##TestSuiteName##_
14243 
14244 // The variables defined in the type-parameterized test macros are
14245 // static as typically these macros are used in a .h file that can be
14246 // #included in multiple translation units linked together.
14247 #define TYPED_TEST_SUITE_P(SuiteName) \
14248  static ::testing::internal::TypedTestSuitePState \
14249  GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName)
14250 
14251 // Legacy API is deprecated but still available
14252 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
14253 #define TYPED_TEST_CASE_P TYPED_TEST_SUITE_P
14254 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
14255 
14256 #define TYPED_TEST_P(SuiteName, TestName) \
14257  namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
14258  template <typename gtest_TypeParam_> \
14259  class TestName : public SuiteName<gtest_TypeParam_> { \
14260  private: \
14261  typedef SuiteName<gtest_TypeParam_> TestFixture; \
14262  typedef gtest_TypeParam_ TypeParam; \
14263  virtual void TestBody(); \
14264  }; \
14265  static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
14266  GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \
14267  __FILE__, __LINE__, #SuiteName, #TestName); \
14268  } \
14269  template <typename gtest_TypeParam_> \
14270  void GTEST_SUITE_NAMESPACE_( \
14271  SuiteName)::TestName<gtest_TypeParam_>::TestBody()
14272 
14273 #define REGISTER_TYPED_TEST_SUITE_P(SuiteName, ...) \
14274  namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
14275  typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
14276  } \
14277  static const char* const GTEST_REGISTERED_TEST_NAMES_( \
14278  SuiteName) GTEST_ATTRIBUTE_UNUSED_ = \
14279  GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).VerifyRegisteredTestNames( \
14280  __FILE__, __LINE__, #__VA_ARGS__)
14281 
14282 // Legacy API is deprecated but still available
14283 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
14284 #define REGISTER_TYPED_TEST_CASE_P REGISTER_TYPED_TEST_SUITE_P
14285 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
14286 
14287 // The 'Types' template argument below must have spaces around it
14288 // since some compilers may choke on '>>' when passing a template
14289 // instance (e.g. Types<int>)
14290 #define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types, ...) \
14291  static bool gtest_##Prefix##_##SuiteName GTEST_ATTRIBUTE_UNUSED_ = \
14292  ::testing::internal::TypeParameterizedTestSuite< \
14293  SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \
14294  ::testing::internal::TypeList<Types>::type>:: \
14295  Register(#Prefix, \
14296  ::testing::internal::CodeLocation(__FILE__, __LINE__), \
14297  &GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName), #SuiteName, \
14298  GTEST_REGISTERED_TEST_NAMES_(SuiteName), \
14299  ::testing::internal::GenerateNames< \
14300  ::testing::internal::NameGeneratorSelector< \
14301  __VA_ARGS__>::type, \
14302  ::testing::internal::TypeList<Types>::type>())
14303 
14304 // Legacy API is deprecated but still available
14305 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
14306 #define INSTANTIATE_TYPED_TEST_CASE_P INSTANTIATE_TYPED_TEST_SUITE_P
14307 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
14308 
14309 #endif // GTEST_HAS_TYPED_TEST_P
14310 
14311 #endif // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
14312 
14314 /* class A needs to have dll-interface to be used by clients of class B */)
14315 
14316 // Depending on the platform, different string classes are available.
14317 // On Linux, in addition to ::std::string, Google also makes use of
14318 // class ::string, which has the same interface as ::std::string, but
14319 // has a different implementation.
14320 //
14321 // You can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
14322 // ::string is available AND is a distinct type to ::std::string, or
14323 // define it to 0 to indicate otherwise.
14324 //
14325 // If ::std::string and ::string are the same class on your platform
14326 // due to aliasing, you should define GTEST_HAS_GLOBAL_STRING to 0.
14327 //
14328 // If you do not define GTEST_HAS_GLOBAL_STRING, it is defined
14329 // heuristically.
14330 
14331 namespace testing {
14332 
14333 // Silence C4100 (unreferenced formal parameter) and 4805
14334 // unsafe mix of type 'const int' and type 'const bool'
14335 #ifdef _MSC_VER
14336 # pragma warning(push)
14337 # pragma warning(disable:4805)
14338 # pragma warning(disable:4100)
14339 #endif
14340 
14341 
14342 // Declares the flags.
14343 
14344 // This flag temporary enables the disabled tests.
14345 GTEST_DECLARE_bool_(also_run_disabled_tests);
14346 
14347 // This flag brings the debugger on an assertion failure.
14348 GTEST_DECLARE_bool_(break_on_failure);
14349 
14350 // This flag controls whether Google Test catches all test-thrown exceptions
14351 // and logs them as failures.
14352 GTEST_DECLARE_bool_(catch_exceptions);
14353 
14354 // This flag enables using colors in terminal output. Available values are
14355 // "yes" to enable colors, "no" (disable colors), or "auto" (the default)
14356 // to let Google Test decide.
14357 GTEST_DECLARE_string_(color);
14358 
14359 // This flag sets up the filter to select by name using a glob pattern
14360 // the tests to run. If the filter is not given all tests are executed.
14362 
14363 // This flag controls whether Google Test installs a signal handler that dumps
14364 // debugging information when fatal signals are raised.
14365 GTEST_DECLARE_bool_(install_failure_signal_handler);
14366 
14367 // This flag causes the Google Test to list tests. None of the tests listed
14368 // are actually run if the flag is provided.
14369 GTEST_DECLARE_bool_(list_tests);
14370 
14371 // This flag controls whether Google Test emits a detailed XML report to a file
14372 // in addition to its normal textual output.
14373 GTEST_DECLARE_string_(output);
14374 
14375 // This flags control whether Google Test prints the elapsed time for each
14376 // test.
14377 GTEST_DECLARE_bool_(print_time);
14378 
14379 // This flags control whether Google Test prints UTF8 characters as text.
14380 GTEST_DECLARE_bool_(print_utf8);
14381 
14382 // This flag specifies the random number seed.
14383 GTEST_DECLARE_int32_(random_seed);
14384 
14385 // This flag sets how many times the tests are repeated. The default value
14386 // is 1. If the value is -1 the tests are repeating forever.
14388 
14389 // This flag controls whether Google Test includes Google Test internal
14390 // stack frames in failure stack traces.
14391 GTEST_DECLARE_bool_(show_internal_stack_frames);
14392 
14393 // When this flag is specified, tests' order is randomized on every iteration.
14394 GTEST_DECLARE_bool_(shuffle);
14395 
14396 // This flag specifies the maximum number of stack frames to be
14397 // printed in a failure message.
14398 GTEST_DECLARE_int32_(stack_trace_depth);
14399 
14400 // When this flag is specified, a failed assertion will throw an
14401 // exception if exceptions are enabled, or exit the program with a
14402 // non-zero code otherwise. For use with an external test framework.
14403 GTEST_DECLARE_bool_(throw_on_failure);
14404 
14405 // When this flag is set with a "host:port" string, on supported
14406 // platforms test results are streamed to the specified port on
14407 // the specified host machine.
14408 GTEST_DECLARE_string_(stream_result_to);
14409 
14410 #if GTEST_USE_OWN_FLAGFILE_FLAG_
14411 GTEST_DECLARE_string_(flagfile);
14412 #endif // GTEST_USE_OWN_FLAGFILE_FLAG_
14413 
14414 // The upper limit for valid stack trace depths.
14415 const int kMaxStackTraceDepth = 100;
14416 
14417 namespace internal {
14418 
14419 class AssertHelper;
14420 class DefaultGlobalTestPartResultReporter;
14421 class ExecDeathTest;
14422 class NoExecDeathTest;
14423 class FinalSuccessChecker;
14424 class GTestFlagSaver;
14425 class StreamingListenerTest;
14426 class TestResultAccessor;
14427 class TestEventListenersAccessor;
14428 class TestEventRepeater;
14429 class UnitTestRecordPropertyTestHelper;
14430 class WindowsDeathTest;
14431 class FuchsiaDeathTest;
14432 class UnitTestImpl* GetUnitTestImpl();
14433 void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
14434  const std::string& message);
14435 
14436 } // namespace internal
14437 
14438 // The friend relationship of some of these classes is cyclic.
14439 // If we don't forward declare them the compiler might confuse the classes
14440 // in friendship clauses with same named classes on the scope.
14441 class Test;
14442 class TestSuite;
14443 
14444 // Old API is still available but deprecated
14445 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
14446 using TestCase = TestSuite;
14447 #endif
14448 class TestInfo;
14449 class UnitTest;
14450 
14451 // A class for indicating whether an assertion was successful. When
14452 // the assertion wasn't successful, the AssertionResult object
14453 // remembers a non-empty message that describes how it failed.
14454 //
14455 // To create an instance of this class, use one of the factory functions
14456 // (AssertionSuccess() and AssertionFailure()).
14457 //
14458 // This class is useful for two purposes:
14459 // 1. Defining predicate functions to be used with Boolean test assertions
14460 // EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
14461 // 2. Defining predicate-format functions to be
14462 // used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
14463 //
14464 // For example, if you define IsEven predicate:
14465 //
14466 // testing::AssertionResult IsEven(int n) {
14467 // if ((n % 2) == 0)
14468 // return testing::AssertionSuccess();
14469 // else
14470 // return testing::AssertionFailure() << n << " is odd";
14471 // }
14472 //
14473 // Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
14474 // will print the message
14475 //
14476 // Value of: IsEven(Fib(5))
14477 // Actual: false (5 is odd)
14478 // Expected: true
14479 //
14480 // instead of a more opaque
14481 //
14482 // Value of: IsEven(Fib(5))
14483 // Actual: false
14484 // Expected: true
14485 //
14486 // in case IsEven is a simple Boolean predicate.
14487 //
14488 // If you expect your predicate to be reused and want to support informative
14489 // messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
14490 // about half as often as positive ones in our tests), supply messages for
14491 // both success and failure cases:
14492 //
14493 // testing::AssertionResult IsEven(int n) {
14494 // if ((n % 2) == 0)
14495 // return testing::AssertionSuccess() << n << " is even";
14496 // else
14497 // return testing::AssertionFailure() << n << " is odd";
14498 // }
14499 //
14500 // Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
14501 //
14502 // Value of: IsEven(Fib(6))
14503 // Actual: true (8 is even)
14504 // Expected: false
14505 //
14506 // NB: Predicates that support negative Boolean assertions have reduced
14507 // performance in positive ones so be careful not to use them in tests
14508 // that have lots (tens of thousands) of positive Boolean assertions.
14509 //
14510 // To use this class with EXPECT_PRED_FORMAT assertions such as:
14511 //
14512 // // Verifies that Foo() returns an even number.
14513 // EXPECT_PRED_FORMAT1(IsEven, Foo());
14514 //
14515 // you need to define:
14516 //
14517 // testing::AssertionResult IsEven(const char* expr, int n) {
14518 // if ((n % 2) == 0)
14519 // return testing::AssertionSuccess();
14520 // else
14521 // return testing::AssertionFailure()
14522 // << "Expected: " << expr << " is even\n Actual: it's " << n;
14523 // }
14524 //
14525 // If Foo() returns 5, you will see the following message:
14526 //
14527 // Expected: Foo() is even
14528 // Actual: it's 5
14529 //
14530 class GTEST_API_ AssertionResult {
14531  public:
14532  // Copy constructor.
14533  // Used in EXPECT_TRUE/FALSE(assertion_result).
14534  AssertionResult(const AssertionResult& other);
14535 
14536 #if defined(_MSC_VER) && _MSC_VER < 1910
14537  GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
14538 #endif
14539 
14540  // Used in the EXPECT_TRUE/FALSE(bool_expression).
14541  //
14542  // T must be contextually convertible to bool.
14543  //
14544  // The second parameter prevents this overload from being considered if
14545  // the argument is implicitly convertible to AssertionResult. In that case
14546  // we want AssertionResult's copy constructor to be used.
14547  template <typename T>
14548  explicit AssertionResult(
14549  const T& success,
14550  typename internal::EnableIf<
14551  !internal::ImplicitlyConvertible<T, AssertionResult>::value>::type*
14552  /*enabler*/
14553  = nullptr)
14554  : success_(success) {}
14555 
14556 #if defined(_MSC_VER) && _MSC_VER < 1910
14558 #endif
14559 
14560  // Assignment operator.
14561  AssertionResult& operator=(AssertionResult other) {
14562  swap(other);
14563  return *this;
14564  }
14565 
14566  // Returns true iff the assertion succeeded.
14567  operator bool() const { return success_; } // NOLINT
14568 
14569  // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
14570  AssertionResult operator!() const;
14571 
14572  // Returns the text streamed into this AssertionResult. Test assertions
14573  // use it when they fail (i.e., the predicate's outcome doesn't match the
14574  // assertion's expectation). When nothing has been streamed into the
14575  // object, returns an empty string.
14576  const char* message() const {
14577  return message_.get() != nullptr ? message_->c_str() : "";
14578  }
14579  // Deprecated; please use message() instead.
14580  const char* failure_message() const { return message(); }
14581 
14582  // Streams a custom failure message into this object.
14583  template <typename T> AssertionResult& operator<<(const T& value) {
14584  AppendMessage(Message() << value);
14585  return *this;
14586  }
14587 
14588  // Allows streaming basic output manipulators such as endl or flush into
14589  // this object.
14590  AssertionResult& operator<<(
14591  ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
14592  AppendMessage(Message() << basic_manipulator);
14593  return *this;
14594  }
14595 
14596  private:
14597  // Appends the contents of message to message_.
14598  void AppendMessage(const Message& a_message) {
14599  if (message_.get() == nullptr) message_.reset(new ::std::string);
14600  message_->append(a_message.GetString().c_str());
14601  }
14602 
14603  // Swap the contents of this AssertionResult with other.
14604  void swap(AssertionResult& other);
14605 
14606  // Stores result of the assertion predicate.
14607  bool success_;
14608  // Stores the message describing the condition in case the expectation
14609  // construct is not satisfied with the predicate's outcome.
14610  // Referenced via a pointer to avoid taking too much stack frame space
14611  // with test assertions.
14612  std::unique_ptr< ::std::string> message_;
14613 };
14614 
14615 // Makes a successful assertion result.
14616 GTEST_API_ AssertionResult AssertionSuccess();
14617 
14618 // Makes a failed assertion result.
14619 GTEST_API_ AssertionResult AssertionFailure();
14620 
14621 // Makes a failed assertion result with the given failure message.
14622 // Deprecated; use AssertionFailure() << msg.
14623 GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
14624 
14625 } // namespace testing
14626 
14627 // Includes the auto-generated header that implements a family of generic
14628 // predicate assertion macros. This include comes late because it relies on
14629 // APIs declared above.
14630 // Copyright 2006, Google Inc.
14631 // All rights reserved.
14632 //
14633 // Redistribution and use in source and binary forms, with or without
14634 // modification, are permitted provided that the following conditions are
14635 // met:
14636 //
14637 // * Redistributions of source code must retain the above copyright
14638 // notice, this list of conditions and the following disclaimer.
14639 // * Redistributions in binary form must reproduce the above
14640 // copyright notice, this list of conditions and the following disclaimer
14641 // in the documentation and/or other materials provided with the
14642 // distribution.
14643 // * Neither the name of Google Inc. nor the names of its
14644 // contributors may be used to endorse or promote products derived from
14645 // this software without specific prior written permission.
14646 //
14647 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14648 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
14649 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
14650 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
14651 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
14652 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
14653 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
14654 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
14655 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14656 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14657 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14658 
14659 // This file is AUTOMATICALLY GENERATED on 01/02/2019 by command
14660 // 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
14661 //
14662 // Implements a family of generic predicate assertion macros.
14663 // GOOGLETEST_CM0001 DO NOT DELETE
14664 
14665 #ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
14666 #define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
14667 
14668 
14669 namespace testing {
14670 
14671 // This header implements a family of generic predicate assertion
14672 // macros:
14673 //
14674 // ASSERT_PRED_FORMAT1(pred_format, v1)
14675 // ASSERT_PRED_FORMAT2(pred_format, v1, v2)
14676 // ...
14677 //
14678 // where pred_format is a function or functor that takes n (in the
14679 // case of ASSERT_PRED_FORMATn) values and their source expression
14680 // text, and returns a testing::AssertionResult. See the definition
14681 // of ASSERT_EQ in gtest.h for an example.
14682 //
14683 // If you don't care about formatting, you can use the more
14684 // restrictive version:
14685 //
14686 // ASSERT_PRED1(pred, v1)
14687 // ASSERT_PRED2(pred, v1, v2)
14688 // ...
14689 //
14690 // where pred is an n-ary function or functor that returns bool,
14691 // and the values v1, v2, ..., must support the << operator for
14692 // streaming to std::ostream.
14693 //
14694 // We also define the EXPECT_* variations.
14695 //
14696 // For now we only support predicates whose arity is at most 5.
14697 // Please email googletestframework@googlegroups.com if you need
14698 // support for higher arities.
14699 
14700 // GTEST_ASSERT_ is the basic statement to which all of the assertions
14701 // in this file reduce. Don't use this in your code.
14702 
14703 #define GTEST_ASSERT_(expression, on_failure) \
14704  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
14705  if (const ::testing::AssertionResult gtest_ar = (expression)) \
14706  ; \
14707  else \
14708  on_failure(gtest_ar.failure_message())
14709 
14710 
14711 // Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use
14712 // this in your code.
14713 template <typename Pred,
14714  typename T1>
14715 AssertionResult AssertPred1Helper(const char* pred_text,
14716  const char* e1,
14717  Pred pred,
14718  const T1& v1) {
14719  if (pred(v1)) return AssertionSuccess();
14720 
14721  return AssertionFailure()
14722  << pred_text << "(" << e1 << ") evaluates to false, where"
14723  << "\n"
14724  << e1 << " evaluates to " << ::testing::PrintToString(v1);
14725 }
14726 
14727 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
14728 // Don't use this in your code.
14729 #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
14730  GTEST_ASSERT_(pred_format(#v1, v1), \
14731  on_failure)
14732 
14733 // Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use
14734 // this in your code.
14735 #define GTEST_PRED1_(pred, v1, on_failure)\
14736  GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
14737  #v1, \
14738  pred, \
14739  v1), on_failure)
14740 
14741 // Unary predicate assertion macros.
14742 #define EXPECT_PRED_FORMAT1(pred_format, v1) \
14743  GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
14744 #define EXPECT_PRED1(pred, v1) \
14745  GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
14746 #define ASSERT_PRED_FORMAT1(pred_format, v1) \
14747  GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
14748 #define ASSERT_PRED1(pred, v1) \
14749  GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
14750 
14751 
14752 
14753 // Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use
14754 // this in your code.
14755 template <typename Pred,
14756  typename T1,
14757  typename T2>
14758 AssertionResult AssertPred2Helper(const char* pred_text,
14759  const char* e1,
14760  const char* e2,
14761  Pred pred,
14762  const T1& v1,
14763  const T2& v2) {
14764  if (pred(v1, v2)) return AssertionSuccess();
14765 
14766  return AssertionFailure()
14767  << pred_text << "(" << e1 << ", " << e2
14768  << ") evaluates to false, where"
14769  << "\n"
14770  << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
14771  << e2 << " evaluates to " << ::testing::PrintToString(v2);
14772 }
14773 
14774 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
14775 // Don't use this in your code.
14776 #define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
14777  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
14778  on_failure)
14779 
14780 // Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use
14781 // this in your code.
14782 #define GTEST_PRED2_(pred, v1, v2, on_failure)\
14783  GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
14784  #v1, \
14785  #v2, \
14786  pred, \
14787  v1, \
14788  v2), on_failure)
14789 
14790 // Binary predicate assertion macros.
14791 #define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
14792  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
14793 #define EXPECT_PRED2(pred, v1, v2) \
14794  GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
14795 #define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
14796  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
14797 #define ASSERT_PRED2(pred, v1, v2) \
14798  GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
14799 
14800 
14801 
14802 // Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use
14803 // this in your code.
14804 template <typename Pred,
14805  typename T1,
14806  typename T2,
14807  typename T3>
14808 AssertionResult AssertPred3Helper(const char* pred_text,
14809  const char* e1,
14810  const char* e2,
14811  const char* e3,
14812  Pred pred,
14813  const T1& v1,
14814  const T2& v2,
14815  const T3& v3) {
14816  if (pred(v1, v2, v3)) return AssertionSuccess();
14817 
14818  return AssertionFailure()
14819  << pred_text << "(" << e1 << ", " << e2 << ", " << e3
14820  << ") evaluates to false, where"
14821  << "\n"
14822  << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
14823  << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
14824  << e3 << " evaluates to " << ::testing::PrintToString(v3);
14825 }
14826 
14827 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
14828 // Don't use this in your code.
14829 #define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
14830  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
14831  on_failure)
14832 
14833 // Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use
14834 // this in your code.
14835 #define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
14836  GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
14837  #v1, \
14838  #v2, \
14839  #v3, \
14840  pred, \
14841  v1, \
14842  v2, \
14843  v3), on_failure)
14844 
14845 // Ternary predicate assertion macros.
14846 #define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
14847  GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
14848 #define EXPECT_PRED3(pred, v1, v2, v3) \
14849  GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
14850 #define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
14851  GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
14852 #define ASSERT_PRED3(pred, v1, v2, v3) \
14853  GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
14854 
14855 
14856 
14857 // Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use
14858 // this in your code.
14859 template <typename Pred,
14860  typename T1,
14861  typename T2,
14862  typename T3,
14863  typename T4>
14864 AssertionResult AssertPred4Helper(const char* pred_text,
14865  const char* e1,
14866  const char* e2,
14867  const char* e3,
14868  const char* e4,
14869  Pred pred,
14870  const T1& v1,
14871  const T2& v2,
14872  const T3& v3,
14873  const T4& v4) {
14874  if (pred(v1, v2, v3, v4)) return AssertionSuccess();
14875 
14876  return AssertionFailure()
14877  << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4
14878  << ") evaluates to false, where"
14879  << "\n"
14880  << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
14881  << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
14882  << e3 << " evaluates to " << ::testing::PrintToString(v3) << "\n"
14883  << e4 << " evaluates to " << ::testing::PrintToString(v4);
14884 }
14885 
14886 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
14887 // Don't use this in your code.
14888 #define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
14889  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
14890  on_failure)
14891 
14892 // Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use
14893 // this in your code.
14894 #define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
14895  GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
14896  #v1, \
14897  #v2, \
14898  #v3, \
14899  #v4, \
14900  pred, \
14901  v1, \
14902  v2, \
14903  v3, \
14904  v4), on_failure)
14905 
14906 // 4-ary predicate assertion macros.
14907 #define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
14908  GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
14909 #define EXPECT_PRED4(pred, v1, v2, v3, v4) \
14910  GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
14911 #define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
14912  GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
14913 #define ASSERT_PRED4(pred, v1, v2, v3, v4) \
14914  GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
14915 
14916 
14917 
14918 // Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use
14919 // this in your code.
14920 template <typename Pred,
14921  typename T1,
14922  typename T2,
14923  typename T3,
14924  typename T4,
14925  typename T5>
14926 AssertionResult AssertPred5Helper(const char* pred_text,
14927  const char* e1,
14928  const char* e2,
14929  const char* e3,
14930  const char* e4,
14931  const char* e5,
14932  Pred pred,
14933  const T1& v1,
14934  const T2& v2,
14935  const T3& v3,
14936  const T4& v4,
14937  const T5& v5) {
14938  if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
14939 
14940  return AssertionFailure()
14941  << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4
14942  << ", " << e5 << ") evaluates to false, where"
14943  << "\n"
14944  << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
14945  << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
14946  << e3 << " evaluates to " << ::testing::PrintToString(v3) << "\n"
14947  << e4 << " evaluates to " << ::testing::PrintToString(v4) << "\n"
14948  << e5 << " evaluates to " << ::testing::PrintToString(v5);
14949 }
14950 
14951 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
14952 // Don't use this in your code.
14953 #define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
14954  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
14955  on_failure)
14956 
14957 // Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use
14958 // this in your code.
14959 #define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
14960  GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
14961  #v1, \
14962  #v2, \
14963  #v3, \
14964  #v4, \
14965  #v5, \
14966  pred, \
14967  v1, \
14968  v2, \
14969  v3, \
14970  v4, \
14971  v5), on_failure)
14972 
14973 // 5-ary predicate assertion macros.
14974 #define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
14975  GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
14976 #define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
14977  GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
14978 #define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
14979  GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
14980 #define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
14981  GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
14982 
14983 
14984 
14985 } // namespace testing
14986 
14987 #endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
14988 
14989 namespace testing {
14990 
14991 // The abstract class that all tests inherit from.
14992 //
14993 // In Google Test, a unit test program contains one or many TestSuites, and
14994 // each TestSuite contains one or many Tests.
14995 //
14996 // When you define a test using the TEST macro, you don't need to
14997 // explicitly derive from Test - the TEST macro automatically does
14998 // this for you.
14999 //
15000 // The only time you derive from Test is when defining a test fixture
15001 // to be used in a TEST_F. For example:
15002 //
15003 // class FooTest : public testing::Test {
15004 // protected:
15005 // void SetUp() override { ... }
15006 // void TearDown() override { ... }
15007 // ...
15008 // };
15009 //
15010 // TEST_F(FooTest, Bar) { ... }
15011 // TEST_F(FooTest, Baz) { ... }
15012 //
15013 // Test is not copyable.
15015  public:
15016  friend class TestInfo;
15017 
15018  // The d'tor is virtual as we intend to inherit from Test.
15019  virtual ~Test();
15020 
15021  // Sets up the stuff shared by all tests in this test case.
15022  //
15023  // Google Test will call Foo::SetUpTestSuite() before running the first
15024  // test in test case Foo. Hence a sub-class can define its own
15025  // SetUpTestSuite() method to shadow the one defined in the super
15026  // class.
15027  static void SetUpTestSuite() {}
15028 
15029  // Tears down the stuff shared by all tests in this test case.
15030  //
15031  // Google Test will call Foo::TearDownTestSuite() after running the last
15032  // test in test case Foo. Hence a sub-class can define its own
15033  // TearDownTestSuite() method to shadow the one defined in the super
15034  // class.
15035  static void TearDownTestSuite() {}
15036 
15037  // Legacy API is deprecated but still available
15038 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15039  static void TearDownTestCase() {}
15040  static void SetUpTestCase() {}
15041 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15042 
15043  // Returns true iff the current test has a fatal failure.
15044  static bool HasFatalFailure();
15045 
15046  // Returns true iff the current test has a non-fatal failure.
15047  static bool HasNonfatalFailure();
15048 
15049  // Returns true iff the current test was skipped.
15050  static bool IsSkipped();
15051 
15052  // Returns true iff the current test has a (either fatal or
15053  // non-fatal) failure.
15054  static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
15055 
15056  // Logs a property for the current test, test suite, or for the entire
15057  // invocation of the test program when used outside of the context of a
15058  // test suite. Only the last value for a given key is remembered. These
15059  // are public static so they can be called from utility functions that are
15060  // not members of the test fixture. Calls to RecordProperty made during
15061  // lifespan of the test (from the moment its constructor starts to the
15062  // moment its destructor finishes) will be output in XML as attributes of
15063  // the <testcase> element. Properties recorded from fixture's
15064  // SetUpTestSuite or TearDownTestSuite are logged as attributes of the
15065  // corresponding <testsuite> element. Calls to RecordProperty made in the
15066  // global context (before or after invocation of RUN_ALL_TESTS and from
15067  // SetUp/TearDown method of Environment objects registered with Google
15068  // Test) will be output as attributes of the <testsuites> element.
15069  static void RecordProperty(const std::string& key, const std::string& value);
15070  static void RecordProperty(const std::string& key, int value);
15071 
15072  protected:
15073  // Creates a Test object.
15074  Test();
15075 
15076  // Sets up the test fixture.
15077  virtual void SetUp();
15078 
15079  // Tears down the test fixture.
15080  virtual void TearDown();
15081 
15082  private:
15083  // Returns true iff the current test has the same fixture class as
15084  // the first test in the current test suite.
15085  static bool HasSameFixtureClass();
15086 
15087  // Runs the test after the test fixture has been set up.
15088  //
15089  // A sub-class must implement this to define the test logic.
15090  //
15091  // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
15092  // Instead, use the TEST or TEST_F macro.
15093  virtual void TestBody() = 0;
15094 
15095  // Sets up, executes, and tears down the test.
15096  void Run();
15097 
15098  // Deletes self. We deliberately pick an unusual name for this
15099  // internal method to avoid clashing with names used in user TESTs.
15100  void DeleteSelf_() { delete this; }
15101 
15102  const std::unique_ptr<GTEST_FLAG_SAVER_> gtest_flag_saver_;
15103 
15104  // Often a user misspells SetUp() as Setup() and spends a long time
15105  // wondering why it is never called by Google Test. The declaration of
15106  // the following method is solely for catching such an error at
15107  // compile time:
15108  //
15109  // - The return type is deliberately chosen to be not void, so it
15110  // will be a conflict if void Setup() is declared in the user's
15111  // test fixture.
15112  //
15113  // - This method is private, so it will be another compiler error
15114  // if the method is called from the user's test fixture.
15115  //
15116  // DO NOT OVERRIDE THIS FUNCTION.
15117  //
15118  // If you see an error about overriding the following function or
15119  // about it being private, you have mis-spelled SetUp() as Setup().
15120  struct Setup_should_be_spelled_SetUp {};
15121  virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; }
15122 
15123  // We disallow copying Tests.
15125 };
15126 
15128 
15129 // A copyable object representing a user specified test property which can be
15130 // output as a key/value string pair.
15131 //
15132 // Don't inherit from TestProperty as its destructor is not virtual.
15134  public:
15135  // C'tor. TestProperty does NOT have a default constructor.
15136  // Always use this constructor (with parameters) to create a
15137  // TestProperty object.
15138  TestProperty(const std::string& a_key, const std::string& a_value) :
15139  key_(a_key), value_(a_value) {
15140  }
15141 
15142  // Gets the user supplied key.
15143  const char* key() const {
15144  return key_.c_str();
15145  }
15146 
15147  // Gets the user supplied value.
15148  const char* value() const {
15149  return value_.c_str();
15150  }
15151 
15152  // Sets a new value, overriding the one supplied in the constructor.
15153  void SetValue(const std::string& new_value) {
15154  value_ = new_value;
15155  }
15156 
15157  private:
15158  // The key supplied by the user.
15159  std::string key_;
15160  // The value supplied by the user.
15161  std::string value_;
15162 };
15163 
15164 // The result of a single Test. This includes a list of
15165 // TestPartResults, a list of TestProperties, a count of how many
15166 // death tests there are in the Test, and how much time it took to run
15167 // the Test.
15168 //
15169 // TestResult is not copyable.
15171  public:
15172  // Creates an empty TestResult.
15173  TestResult();
15174 
15175  // D'tor. Do not inherit from TestResult.
15176  ~TestResult();
15177 
15178  // Gets the number of all test parts. This is the sum of the number
15179  // of successful test parts and the number of failed test parts.
15180  int total_part_count() const;
15181 
15182  // Returns the number of the test properties.
15183  int test_property_count() const;
15184 
15185  // Returns true iff the test passed (i.e. no test part failed).
15186  bool Passed() const { return !Skipped() && !Failed(); }
15187 
15188  // Returns true iff the test was skipped.
15189  bool Skipped() const;
15190 
15191  // Returns true iff the test failed.
15192  bool Failed() const;
15193 
15194  // Returns true iff the test fatally failed.
15195  bool HasFatalFailure() const;
15196 
15197  // Returns true iff the test has a non-fatal failure.
15198  bool HasNonfatalFailure() const;
15199 
15200  // Returns the elapsed time, in milliseconds.
15201  TimeInMillis elapsed_time() const { return elapsed_time_; }
15202 
15203  // Returns the i-th test part result among all the results. i can range from 0
15204  // to total_part_count() - 1. If i is not in that range, aborts the program.
15205  const TestPartResult& GetTestPartResult(int i) const;
15206 
15207  // Returns the i-th test property. i can range from 0 to
15208  // test_property_count() - 1. If i is not in that range, aborts the
15209  // program.
15210  const TestProperty& GetTestProperty(int i) const;
15211 
15212  private:
15213  friend class TestInfo;
15214  friend class TestSuite;
15215  friend class UnitTest;
15216  friend class internal::DefaultGlobalTestPartResultReporter;
15217  friend class internal::ExecDeathTest;
15218  friend class internal::TestResultAccessor;
15219  friend class internal::UnitTestImpl;
15220  friend class internal::WindowsDeathTest;
15221  friend class internal::FuchsiaDeathTest;
15222 
15223  // Gets the vector of TestPartResults.
15224  const std::vector<TestPartResult>& test_part_results() const {
15225  return test_part_results_;
15226  }
15227 
15228  // Gets the vector of TestProperties.
15229  const std::vector<TestProperty>& test_properties() const {
15230  return test_properties_;
15231  }
15232 
15233  // Sets the elapsed time.
15234  void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
15235 
15236  // Adds a test property to the list. The property is validated and may add
15237  // a non-fatal failure if invalid (e.g., if it conflicts with reserved
15238  // key names). If a property is already recorded for the same key, the
15239  // value will be updated, rather than storing multiple values for the same
15240  // key. xml_element specifies the element for which the property is being
15241  // recorded and is used for validation.
15242  void RecordProperty(const std::string& xml_element,
15243  const TestProperty& test_property);
15244 
15245  // Adds a failure if the key is a reserved attribute of Google Test
15246  // testsuite tags. Returns true if the property is valid.
15247  // FIXME: Validate attribute names are legal and human readable.
15248  static bool ValidateTestProperty(const std::string& xml_element,
15249  const TestProperty& test_property);
15250 
15251  // Adds a test part result to the list.
15252  void AddTestPartResult(const TestPartResult& test_part_result);
15253 
15254  // Returns the death test count.
15255  int death_test_count() const { return death_test_count_; }
15256 
15257  // Increments the death test count, returning the new count.
15258  int increment_death_test_count() { return ++death_test_count_; }
15259 
15260  // Clears the test part results.
15261  void ClearTestPartResults();
15262 
15263  // Clears the object.
15264  void Clear();
15265 
15266  // Protects mutable state of the property vector and of owned
15267  // properties, whose values may be updated.
15268  internal::Mutex test_properites_mutex_;
15269 
15270  // The vector of TestPartResults
15271  std::vector<TestPartResult> test_part_results_;
15272  // The vector of TestProperties
15273  std::vector<TestProperty> test_properties_;
15274  // Running count of death tests.
15275  int death_test_count_;
15276  // The elapsed time, in milliseconds.
15277  TimeInMillis elapsed_time_;
15278 
15279  // We disallow copying TestResult.
15280  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
15281 }; // class TestResult
15282 
15283 // A TestInfo object stores the following information about a test:
15284 //
15285 // Test suite name
15286 // Test name
15287 // Whether the test should be run
15288 // A function pointer that creates the test object when invoked
15289 // Test result
15290 //
15291 // The constructor of TestInfo registers itself with the UnitTest
15292 // singleton such that the RUN_ALL_TESTS() macro knows which tests to
15293 // run.
15295  public:
15296  // Destructs a TestInfo object. This function is not virtual, so
15297  // don't inherit from TestInfo.
15298  ~TestInfo();
15299 
15300  // Returns the test suite name.
15301  const char* test_suite_name() const { return test_suite_name_.c_str(); }
15302 
15303 // Legacy API is deprecated but still available
15304 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15305  const char* test_case_name() const { return test_suite_name(); }
15306 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15307 
15308  // Returns the test name.
15309  const char* name() const { return name_.c_str(); }
15310 
15311  // Returns the name of the parameter type, or NULL if this is not a typed
15312  // or a type-parameterized test.
15313  const char* type_param() const {
15314  if (type_param_.get() != nullptr) return type_param_->c_str();
15315  return nullptr;
15316  }
15317 
15318  // Returns the text representation of the value parameter, or NULL if this
15319  // is not a value-parameterized test.
15320  const char* value_param() const {
15321  if (value_param_.get() != nullptr) return value_param_->c_str();
15322  return nullptr;
15323  }
15324 
15325  // Returns the file name where this test is defined.
15326  const char* file() const { return location_.file.c_str(); }
15327 
15328  // Returns the line where this test is defined.
15329  int line() const { return location_.line; }
15330 
15331  // Return true if this test should not be run because it's in another shard.
15332  bool is_in_another_shard() const { return is_in_another_shard_; }
15333 
15334  // Returns true if this test should run, that is if the test is not
15335  // disabled (or it is disabled but the also_run_disabled_tests flag has
15336  // been specified) and its full name matches the user-specified filter.
15337  //
15338  // Google Test allows the user to filter the tests by their full names.
15339  // The full name of a test Bar in test suite Foo is defined as
15340  // "Foo.Bar". Only the tests that match the filter will run.
15341  //
15342  // A filter is a colon-separated list of glob (not regex) patterns,
15343  // optionally followed by a '-' and a colon-separated list of
15344  // negative patterns (tests to exclude). A test is run if it
15345  // matches one of the positive patterns and does not match any of
15346  // the negative patterns.
15347  //
15348  // For example, *A*:Foo.* is a filter that matches any string that
15349  // contains the character 'A' or starts with "Foo.".
15350  bool should_run() const { return should_run_; }
15351 
15352  // Returns true iff this test will appear in the XML report.
15353  bool is_reportable() const {
15354  // The XML report includes tests matching the filter, excluding those
15355  // run in other shards.
15356  return matches_filter_ && !is_in_another_shard_;
15357  }
15358 
15359  // Returns the result of the test.
15360  const TestResult* result() const { return &result_; }
15361 
15362  private:
15363 #if GTEST_HAS_DEATH_TEST
15364  friend class internal::DefaultDeathTestFactory;
15365 #endif // GTEST_HAS_DEATH_TEST
15366  friend class Test;
15367  friend class TestSuite;
15368  friend class internal::UnitTestImpl;
15369  friend class internal::StreamingListenerTest;
15371  const char* test_suite_name, const char* name, const char* type_param,
15372  const char* value_param, internal::CodeLocation code_location,
15373  internal::TypeId fixture_class_id, internal::SetUpTestSuiteFunc set_up_tc,
15374  internal::TearDownTestSuiteFunc tear_down_tc,
15375  internal::TestFactoryBase* factory);
15376 
15377  // Constructs a TestInfo object. The newly constructed instance assumes
15378  // ownership of the factory object.
15379  TestInfo(const std::string& test_suite_name, const std::string& name,
15380  const char* a_type_param, // NULL if not a type-parameterized test
15381  const char* a_value_param, // NULL if not a value-parameterized test
15382  internal::CodeLocation a_code_location,
15383  internal::TypeId fixture_class_id,
15384  internal::TestFactoryBase* factory);
15385 
15386  // Increments the number of death tests encountered in this test so
15387  // far.
15388  int increment_death_test_count() {
15389  return result_.increment_death_test_count();
15390  }
15391 
15392  // Creates the test object, runs it, records its result, and then
15393  // deletes it.
15394  void Run();
15395 
15396  static void ClearTestResult(TestInfo* test_info) {
15397  test_info->result_.Clear();
15398  }
15399 
15400  // These fields are immutable properties of the test.
15401  const std::string test_suite_name_; // test suite name
15402  const std::string name_; // Test name
15403  // Name of the parameter type, or NULL if this is not a typed or a
15404  // type-parameterized test.
15405  const std::unique_ptr<const ::std::string> type_param_;
15406  // Text representation of the value parameter, or NULL if this is not a
15407  // value-parameterized test.
15408  const std::unique_ptr<const ::std::string> value_param_;
15409  internal::CodeLocation location_;
15410  const internal::TypeId fixture_class_id_; // ID of the test fixture class
15411  bool should_run_; // True iff this test should run
15412  bool is_disabled_; // True iff this test is disabled
15413  bool matches_filter_; // True if this test matches the
15414  // user-specified filter.
15415  bool is_in_another_shard_; // Will be run in another shard.
15416  internal::TestFactoryBase* const factory_; // The factory that creates
15417  // the test object
15418 
15419  // This field is mutable and needs to be reset before running the
15420  // test for the second time.
15421  TestResult result_;
15422 
15424 };
15425 
15426 // A test suite, which consists of a vector of TestInfos.
15427 //
15428 // TestSuite is not copyable.
15430  public:
15431  // Creates a TestSuite with the given name.
15432  //
15433  // TestSuite does NOT have a default constructor. Always use this
15434  // constructor to create a TestSuite object.
15435  //
15436  // Arguments:
15437  //
15438  // name: name of the test suite
15439  // a_type_param: the name of the test's type parameter, or NULL if
15440  // this is not a type-parameterized test.
15441  // set_up_tc: pointer to the function that sets up the test suite
15442  // tear_down_tc: pointer to the function that tears down the test suite
15443  TestSuite(const char* name, const char* a_type_param,
15444  internal::SetUpTestSuiteFunc set_up_tc,
15445  internal::TearDownTestSuiteFunc tear_down_tc);
15446 
15447  // Destructor of TestSuite.
15448  virtual ~TestSuite();
15449 
15450  // Gets the name of the TestSuite.
15451  const char* name() const { return name_.c_str(); }
15452 
15453  // Returns the name of the parameter type, or NULL if this is not a
15454  // type-parameterized test suite.
15455  const char* type_param() const {
15456  if (type_param_.get() != nullptr) return type_param_->c_str();
15457  return nullptr;
15458  }
15459 
15460  // Returns true if any test in this test suite should run.
15461  bool should_run() const { return should_run_; }
15462 
15463  // Gets the number of successful tests in this test suite.
15464  int successful_test_count() const;
15465 
15466  // Gets the number of skipped tests in this test suite.
15467  int skipped_test_count() const;
15468 
15469  // Gets the number of failed tests in this test suite.
15470  int failed_test_count() const;
15471 
15472  // Gets the number of disabled tests that will be reported in the XML report.
15473  int reportable_disabled_test_count() const;
15474 
15475  // Gets the number of disabled tests in this test suite.
15476  int disabled_test_count() const;
15477 
15478  // Gets the number of tests to be printed in the XML report.
15479  int reportable_test_count() const;
15480 
15481  // Get the number of tests in this test suite that should run.
15482  int test_to_run_count() const;
15483 
15484  // Gets the number of all tests in this test suite.
15485  int total_test_count() const;
15486 
15487  // Returns true iff the test suite passed.
15488  bool Passed() const { return !Failed(); }
15489 
15490  // Returns true iff the test suite failed.
15491  bool Failed() const { return failed_test_count() > 0; }
15492 
15493  // Returns the elapsed time, in milliseconds.
15494  TimeInMillis elapsed_time() const { return elapsed_time_; }
15495 
15496  // Returns the i-th test among all the tests. i can range from 0 to
15497  // total_test_count() - 1. If i is not in that range, returns NULL.
15498  const TestInfo* GetTestInfo(int i) const;
15499 
15500  // Returns the TestResult that holds test properties recorded during
15501  // execution of SetUpTestSuite and TearDownTestSuite.
15502  const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }
15503 
15504  private:
15505  friend class Test;
15506  friend class internal::UnitTestImpl;
15507 
15508  // Gets the (mutable) vector of TestInfos in this TestSuite.
15509  std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
15510 
15511  // Gets the (immutable) vector of TestInfos in this TestSuite.
15512  const std::vector<TestInfo*>& test_info_list() const {
15513  return test_info_list_;
15514  }
15515 
15516  // Returns the i-th test among all the tests. i can range from 0 to
15517  // total_test_count() - 1. If i is not in that range, returns NULL.
15518  TestInfo* GetMutableTestInfo(int i);
15519 
15520  // Sets the should_run member.
15521  void set_should_run(bool should) { should_run_ = should; }
15522 
15523  // Adds a TestInfo to this test suite. Will delete the TestInfo upon
15524  // destruction of the TestSuite object.
15525  void AddTestInfo(TestInfo * test_info);
15526 
15527  // Clears the results of all tests in this test suite.
15528  void ClearResult();
15529 
15530  // Clears the results of all tests in the given test suite.
15531  static void ClearTestSuiteResult(TestSuite* test_suite) {
15532  test_suite->ClearResult();
15533  }
15534 
15535  // Runs every test in this TestSuite.
15536  void Run();
15537 
15538  // Runs SetUpTestSuite() for this TestSuite. This wrapper is needed
15539  // for catching exceptions thrown from SetUpTestSuite().
15540  void RunSetUpTestSuite() {
15541  if (set_up_tc_ != nullptr) {
15542  (*set_up_tc_)();
15543  }
15544  }
15545 
15546  // Runs TearDownTestSuite() for this TestSuite. This wrapper is
15547  // needed for catching exceptions thrown from TearDownTestSuite().
15548  void RunTearDownTestSuite() {
15549  if (tear_down_tc_ != nullptr) {
15550  (*tear_down_tc_)();
15551  }
15552  }
15553 
15554  // Returns true iff test passed.
15555  static bool TestPassed(const TestInfo* test_info) {
15556  return test_info->should_run() && test_info->result()->Passed();
15557  }
15558 
15559  // Returns true iff test skipped.
15560  static bool TestSkipped(const TestInfo* test_info) {
15561  return test_info->should_run() && test_info->result()->Skipped();
15562  }
15563 
15564  // Returns true iff test failed.
15565  static bool TestFailed(const TestInfo* test_info) {
15566  return test_info->should_run() && test_info->result()->Failed();
15567  }
15568 
15569  // Returns true iff the test is disabled and will be reported in the XML
15570  // report.
15571  static bool TestReportableDisabled(const TestInfo* test_info) {
15572  return test_info->is_reportable() && test_info->is_disabled_;
15573  }
15574 
15575  // Returns true iff test is disabled.
15576  static bool TestDisabled(const TestInfo* test_info) {
15577  return test_info->is_disabled_;
15578  }
15579 
15580  // Returns true iff this test will appear in the XML report.
15581  static bool TestReportable(const TestInfo* test_info) {
15582  return test_info->is_reportable();
15583  }
15584 
15585  // Returns true if the given test should run.
15586  static bool ShouldRunTest(const TestInfo* test_info) {
15587  return test_info->should_run();
15588  }
15589 
15590  // Shuffles the tests in this test suite.
15591  void ShuffleTests(internal::Random* random);
15592 
15593  // Restores the test order to before the first shuffle.
15594  void UnshuffleTests();
15595 
15596  // Name of the test suite.
15597  std::string name_;
15598  // Name of the parameter type, or NULL if this is not a typed or a
15599  // type-parameterized test.
15600  const std::unique_ptr<const ::std::string> type_param_;
15601  // The vector of TestInfos in their original order. It owns the
15602  // elements in the vector.
15603  std::vector<TestInfo*> test_info_list_;
15604  // Provides a level of indirection for the test list to allow easy
15605  // shuffling and restoring the test order. The i-th element in this
15606  // vector is the index of the i-th test in the shuffled test list.
15607  std::vector<int> test_indices_;
15608  // Pointer to the function that sets up the test suite.
15609  internal::SetUpTestSuiteFunc set_up_tc_;
15610  // Pointer to the function that tears down the test suite.
15611  internal::TearDownTestSuiteFunc tear_down_tc_;
15612  // True iff any test in this test suite should run.
15613  bool should_run_;
15614  // Elapsed time, in milliseconds.
15615  TimeInMillis elapsed_time_;
15616  // Holds test properties recorded during execution of SetUpTestSuite and
15617  // TearDownTestSuite.
15618  TestResult ad_hoc_test_result_;
15619 
15620  // We disallow copying TestSuites.
15622 };
15623 
15624 // An Environment object is capable of setting up and tearing down an
15625 // environment. You should subclass this to define your own
15626 // environment(s).
15627 //
15628 // An Environment object does the set-up and tear-down in virtual
15629 // methods SetUp() and TearDown() instead of the constructor and the
15630 // destructor, as:
15631 //
15632 // 1. You cannot safely throw from a destructor. This is a problem
15633 // as in some cases Google Test is used where exceptions are enabled, and
15634 // we may want to implement ASSERT_* using exceptions where they are
15635 // available.
15636 // 2. You cannot use ASSERT_* directly in a constructor or
15637 // destructor.
15639  public:
15640  // The d'tor is virtual as we need to subclass Environment.
15641  virtual ~Environment() {}
15642 
15643  // Override this to define how to set up the environment.
15644  virtual void SetUp() {}
15645 
15646  // Override this to define how to tear down the environment.
15647  virtual void TearDown() {}
15648  private:
15649  // If you see an error about overriding the following function or
15650  // about it being private, you have mis-spelled SetUp() as Setup().
15651  struct Setup_should_be_spelled_SetUp {};
15652  virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; }
15653 };
15654 
15655 #if GTEST_HAS_EXCEPTIONS
15656 
15657 // Exception which can be thrown from TestEventListener::OnTestPartResult.
15658 class GTEST_API_ AssertionException
15659  : public internal::GoogleTestFailureException {
15660  public:
15661  explicit AssertionException(const TestPartResult& result)
15662  : GoogleTestFailureException(result) {}
15663 };
15664 
15665 #endif // GTEST_HAS_EXCEPTIONS
15666 
15667 // The interface for tracing execution of tests. The methods are organized in
15668 // the order the corresponding events are fired.
15670  public:
15671  virtual ~TestEventListener() {}
15672 
15673  // Fired before any test activity starts.
15674  virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
15675 
15676  // Fired before each iteration of tests starts. There may be more than
15677  // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
15678  // index, starting from 0.
15679  virtual void OnTestIterationStart(const UnitTest& unit_test,
15680  int iteration) = 0;
15681 
15682  // Fired before environment set-up for each iteration of tests starts.
15683  virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
15684 
15685  // Fired after environment set-up for each iteration of tests ends.
15686  virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
15687 
15688  // Fired before the test suite starts.
15689  virtual void OnTestSuiteStart(const TestSuite& test_suite) {}
15690 
15691  // Legacy API is deprecated but still available
15692 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15693  virtual void OnTestCaseStart(const TestCase& test_case) {}
15694 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15695 
15696  // Fired before the test starts.
15697  virtual void OnTestStart(const TestInfo& test_info) = 0;
15698 
15699  // Fired after a failed assertion or a SUCCEED() invocation.
15700  // If you want to throw an exception from this function to skip to the next
15701  // TEST, it must be AssertionException defined above, or inherited from it.
15702  virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
15703 
15704  // Fired after the test ends.
15705  virtual void OnTestEnd(const TestInfo& test_info) = 0;
15706 
15707  // Fired after the test suite ends.
15708  virtual void OnTestSuiteEnd(const TestSuite& test_suite) {}
15709 
15710 // Legacy API is deprecated but still available
15711 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15712  virtual void OnTestCaseEnd(const TestCase& test_case) {}
15713 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15714 
15715  // Fired before environment tear-down for each iteration of tests starts.
15716  virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
15717 
15718  // Fired after environment tear-down for each iteration of tests ends.
15719  virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
15720 
15721  // Fired after each iteration of tests finishes.
15722  virtual void OnTestIterationEnd(const UnitTest& unit_test,
15723  int iteration) = 0;
15724 
15725  // Fired after all test activities have ended.
15726  virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
15727 };
15728 
15729 // The convenience class for users who need to override just one or two
15730 // methods and are not concerned that a possible change to a signature of
15731 // the methods they override will not be caught during the build. For
15732 // comments about each method please see the definition of TestEventListener
15733 // above.
15735  public:
15736  void OnTestProgramStart(const UnitTest& /*unit_test*/) override {}
15737  void OnTestIterationStart(const UnitTest& /*unit_test*/,
15738  int /*iteration*/) override {}
15739  void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) override {}
15740  void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
15741  void OnTestSuiteStart(const TestSuite& /*test_suite*/) override {}
15742 // Legacy API is deprecated but still available
15743 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15744  void OnTestCaseStart(const TestCase& tc /*test_suite*/) override {}
15745 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15746 
15747  void OnTestStart(const TestInfo& /*test_info*/) override {}
15748  void OnTestPartResult(const TestPartResult& /*test_part_result*/) override {}
15749  void OnTestEnd(const TestInfo& /*test_info*/) override {}
15750  void OnTestSuiteEnd(const TestSuite& /*test_suite*/) override {}
15751 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15752  void OnTestCaseEnd(const TestCase& tc /*test_suite*/) override {}
15753 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15754 
15755  void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) override {}
15756  void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) override {}
15757  void OnTestIterationEnd(const UnitTest& /*unit_test*/,
15758  int /*iteration*/) override {}
15759  void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {}
15760 };
15761 
15762 // TestEventListeners lets users add listeners to track events in Google Test.
15764  public:
15766  ~TestEventListeners();
15767 
15768  // Appends an event listener to the end of the list. Google Test assumes
15769  // the ownership of the listener (i.e. it will delete the listener when
15770  // the test program finishes).
15771  void Append(TestEventListener* listener);
15772 
15773  // Removes the given event listener from the list and returns it. It then
15774  // becomes the caller's responsibility to delete the listener. Returns
15775  // NULL if the listener is not found in the list.
15776  TestEventListener* Release(TestEventListener* listener);
15777 
15778  // Returns the standard listener responsible for the default console
15779  // output. Can be removed from the listeners list to shut down default
15780  // console output. Note that removing this object from the listener list
15781  // with Release transfers its ownership to the caller and makes this
15782  // function return NULL the next time.
15784  return default_result_printer_;
15785  }
15786 
15787  // Returns the standard listener responsible for the default XML output
15788  // controlled by the --gtest_output=xml flag. Can be removed from the
15789  // listeners list by users who want to shut down the default XML output
15790  // controlled by this flag and substitute it with custom one. Note that
15791  // removing this object from the listener list with Release transfers its
15792  // ownership to the caller and makes this function return NULL the next
15793  // time.
15795  return default_xml_generator_;
15796  }
15797 
15798  private:
15799  friend class TestSuite;
15800  friend class TestInfo;
15801  friend class internal::DefaultGlobalTestPartResultReporter;
15802  friend class internal::NoExecDeathTest;
15803  friend class internal::TestEventListenersAccessor;
15804  friend class internal::UnitTestImpl;
15805 
15806  // Returns repeater that broadcasts the TestEventListener events to all
15807  // subscribers.
15808  TestEventListener* repeater();
15809 
15810  // Sets the default_result_printer attribute to the provided listener.
15811  // The listener is also added to the listener list and previous
15812  // default_result_printer is removed from it and deleted. The listener can
15813  // also be NULL in which case it will not be added to the list. Does
15814  // nothing if the previous and the current listener objects are the same.
15815  void SetDefaultResultPrinter(TestEventListener* listener);
15816 
15817  // Sets the default_xml_generator attribute to the provided listener. The
15818  // listener is also added to the listener list and previous
15819  // default_xml_generator is removed from it and deleted. The listener can
15820  // also be NULL in which case it will not be added to the list. Does
15821  // nothing if the previous and the current listener objects are the same.
15822  void SetDefaultXmlGenerator(TestEventListener* listener);
15823 
15824  // Controls whether events will be forwarded by the repeater to the
15825  // listeners in the list.
15826  bool EventForwardingEnabled() const;
15827  void SuppressEventForwarding();
15828 
15829  // The actual list of listeners.
15830  internal::TestEventRepeater* repeater_;
15831  // Listener responsible for the standard result output.
15832  TestEventListener* default_result_printer_;
15833  // Listener responsible for the creation of the XML output file.
15834  TestEventListener* default_xml_generator_;
15835 
15836  // We disallow copying TestEventListeners.
15838 };
15839 
15840 // A UnitTest consists of a vector of TestSuites.
15841 //
15842 // This is a singleton class. The only instance of UnitTest is
15843 // created when UnitTest::GetInstance() is first called. This
15844 // instance is never deleted.
15845 //
15846 // UnitTest is not copyable.
15847 //
15848 // This class is thread-safe as long as the methods are called
15849 // according to their specification.
15851  public:
15852  // Gets the singleton UnitTest object. The first time this method
15853  // is called, a UnitTest object is constructed and returned.
15854  // Consecutive calls will return the same object.
15855  static UnitTest* GetInstance();
15856 
15857  // Runs all tests in this UnitTest object and prints the result.
15858  // Returns 0 if successful, or 1 otherwise.
15859  //
15860  // This method can only be called from the main thread.
15861  //
15862  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
15863  int Run() GTEST_MUST_USE_RESULT_;
15864 
15865  // Returns the working directory when the first TEST() or TEST_F()
15866  // was executed. The UnitTest object owns the string.
15867  const char* original_working_dir() const;
15868 
15869  // Returns the TestSuite object for the test that's currently running,
15870  // or NULL if no test is running.
15871  const TestSuite* current_test_suite() const GTEST_LOCK_EXCLUDED_(mutex_);
15872 
15873 // Legacy API is still available but deprecated
15874 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15875  const TestCase* current_test_case() const GTEST_LOCK_EXCLUDED_(mutex_);
15876 #endif
15877 
15878  // Returns the TestInfo object for the test that's currently running,
15879  // or NULL if no test is running.
15880  const TestInfo* current_test_info() const
15881  GTEST_LOCK_EXCLUDED_(mutex_);
15882 
15883  // Returns the random seed used at the start of the current test run.
15884  int random_seed() const;
15885 
15886  // Returns the ParameterizedTestSuiteRegistry object used to keep track of
15887  // value-parameterized tests and instantiate and register them.
15888  //
15889  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
15890  internal::ParameterizedTestSuiteRegistry& parameterized_test_registry()
15891  GTEST_LOCK_EXCLUDED_(mutex_);
15892 
15893  // Gets the number of successful test suites.
15894  int successful_test_suite_count() const;
15895 
15896  // Gets the number of failed test suites.
15897  int failed_test_suite_count() const;
15898 
15899  // Gets the number of all test suites.
15900  int total_test_suite_count() const;
15901 
15902  // Gets the number of all test suites that contain at least one test
15903  // that should run.
15904  int test_suite_to_run_count() const;
15905 
15906  // Legacy API is deprecated but still available
15907 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15908  int successful_test_case_count() const;
15909  int failed_test_case_count() const;
15910  int total_test_case_count() const;
15911  int test_case_to_run_count() const;
15912 #endif // EMOVE_LEGACY_TEST_CASEAPI
15913 
15914  // Gets the number of successful tests.
15915  int successful_test_count() const;
15916 
15917  // Gets the number of skipped tests.
15918  int skipped_test_count() const;
15919 
15920  // Gets the number of failed tests.
15921  int failed_test_count() const;
15922 
15923  // Gets the number of disabled tests that will be reported in the XML report.
15924  int reportable_disabled_test_count() const;
15925 
15926  // Gets the number of disabled tests.
15927  int disabled_test_count() const;
15928 
15929  // Gets the number of tests to be printed in the XML report.
15930  int reportable_test_count() const;
15931 
15932  // Gets the number of all tests.
15933  int total_test_count() const;
15934 
15935  // Gets the number of tests that should run.
15936  int test_to_run_count() const;
15937 
15938  // Gets the time of the test program start, in ms from the start of the
15939  // UNIX epoch.
15940  TimeInMillis start_timestamp() const;
15941 
15942  // Gets the elapsed time, in milliseconds.
15943  TimeInMillis elapsed_time() const;
15944 
15945  // Returns true iff the unit test passed (i.e. all test suites passed).
15946  bool Passed() const;
15947 
15948  // Returns true iff the unit test failed (i.e. some test suite failed
15949  // or something outside of all tests failed).
15950  bool Failed() const;
15951 
15952  // Gets the i-th test suite among all the test suites. i can range from 0 to
15953  // total_test_suite_count() - 1. If i is not in that range, returns NULL.
15954  const TestSuite* GetTestSuite(int i) const;
15955 
15956 // Legacy API is deprecated but still available
15957 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15958  const TestCase* GetTestCase(int i) const;
15959 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
15960 
15961  // Returns the TestResult containing information on test failures and
15962  // properties logged outside of individual test suites.
15963  const TestResult& ad_hoc_test_result() const;
15964 
15965  // Returns the list of event listeners that can be used to track events
15966  // inside Google Test.
15967  TestEventListeners& listeners();
15968 
15969  private:
15970  // Registers and returns a global test environment. When a test
15971  // program is run, all global test environments will be set-up in
15972  // the order they were registered. After all tests in the program
15973  // have finished, all global test environments will be torn-down in
15974  // the *reverse* order they were registered.
15975  //
15976  // The UnitTest object takes ownership of the given environment.
15977  //
15978  // This method can only be called from the main thread.
15979  Environment* AddEnvironment(Environment* env);
15980 
15981  // Adds a TestPartResult to the current TestResult object. All
15982  // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
15983  // eventually call this to report their results. The user code
15984  // should use the assertion macros instead of calling this directly.
15985  void AddTestPartResult(TestPartResult::Type result_type,
15986  const char* file_name,
15987  int line_number,
15988  const std::string& message,
15989  const std::string& os_stack_trace)
15990  GTEST_LOCK_EXCLUDED_(mutex_);
15991 
15992  // Adds a TestProperty to the current TestResult object when invoked from
15993  // inside a test, to current TestSuite's ad_hoc_test_result_ when invoked
15994  // from SetUpTestSuite or TearDownTestSuite, or to the global property set
15995  // when invoked elsewhere. If the result already contains a property with
15996  // the same key, the value will be updated.
15997  void RecordProperty(const std::string& key, const std::string& value);
15998 
15999  // Gets the i-th test suite among all the test suites. i can range from 0 to
16000  // total_test_suite_count() - 1. If i is not in that range, returns NULL.
16001  TestSuite* GetMutableTestSuite(int i);
16002 
16003  // Accessors for the implementation object.
16004  internal::UnitTestImpl* impl() { return impl_; }
16005  const internal::UnitTestImpl* impl() const { return impl_; }
16006 
16007  // These classes and functions are friends as they need to access private
16008  // members of UnitTest.
16009  friend class ScopedTrace;
16010  friend class Test;
16012  friend class internal::StreamingListenerTest;
16013  friend class internal::UnitTestRecordPropertyTestHelper;
16015  friend internal::UnitTestImpl* internal::GetUnitTestImpl();
16016  friend void internal::ReportFailureInUnknownLocation(
16017  TestPartResult::Type result_type,
16018  const std::string& message);
16019 
16020  // Creates an empty UnitTest.
16021  UnitTest();
16022 
16023  // D'tor
16024  virtual ~UnitTest();
16025 
16026  // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
16027  // Google Test trace stack.
16028  void PushGTestTrace(const internal::TraceInfo& trace)
16029  GTEST_LOCK_EXCLUDED_(mutex_);
16030 
16031  // Pops a trace from the per-thread Google Test trace stack.
16032  void PopGTestTrace()
16033  GTEST_LOCK_EXCLUDED_(mutex_);
16034 
16035  // Protects mutable state in *impl_. This is mutable as some const
16036  // methods need to lock it too.
16037  mutable internal::Mutex mutex_;
16038 
16039  // Opaque implementation object. This field is never changed once
16040  // the object is constructed. We don't mark it as const here, as
16041  // doing so will cause a warning in the constructor of UnitTest.
16042  // Mutable state in *impl_ is protected by mutex_.
16043  internal::UnitTestImpl* impl_;
16044 
16045  // We disallow copying UnitTest.
16047 };
16048 
16049 // A convenient wrapper for adding an environment for the test
16050 // program.
16051 //
16052 // You should call this before RUN_ALL_TESTS() is called, probably in
16053 // main(). If you use gtest_main, you need to call this before main()
16054 // starts for it to take effect. For example, you can define a global
16055 // variable like this:
16056 //
16057 // testing::Environment* const foo_env =
16058 // testing::AddGlobalTestEnvironment(new FooEnvironment);
16059 //
16060 // However, we strongly recommend you to write your own main() and
16061 // call AddGlobalTestEnvironment() there, as relying on initialization
16062 // of global variables makes the code harder to read and may cause
16063 // problems when you register multiple environments from different
16064 // translation units and the environments have dependencies among them
16065 // (remember that the compiler doesn't guarantee the order in which
16066 // global variables from different translation units are initialized).
16068  return UnitTest::GetInstance()->AddEnvironment(env);
16069 }
16070 
16071 // Initializes Google Test. This must be called before calling
16072 // RUN_ALL_TESTS(). In particular, it parses a command line for the
16073 // flags that Google Test recognizes. Whenever a Google Test flag is
16074 // seen, it is removed from argv, and *argc is decremented.
16075 //
16076 // No value is returned. Instead, the Google Test flag variables are
16077 // updated.
16078 //
16079 // Calling the function for the second time has no user-visible effect.
16080 GTEST_API_ void InitGoogleTest(int* argc, char** argv);
16081 
16082 // This overloaded version can be used in Windows programs compiled in
16083 // UNICODE mode.
16084 GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
16085 
16086 namespace internal {
16087 
16088 // Separate the error generating code from the code path to reduce the stack
16089 // frame size of CmpHelperEQ. This helps reduce the overhead of some sanitizers
16090 // when calling EXPECT_* in a tight loop.
16091 template <typename T1, typename T2>
16092 AssertionResult CmpHelperEQFailure(const char* lhs_expression,
16093  const char* rhs_expression,
16094  const T1& lhs, const T2& rhs) {
16095  return EqFailure(lhs_expression,
16096  rhs_expression,
16099  false);
16100 }
16101 
16102 // This block of code defines operator==/!=
16103 // to block lexical scope lookup.
16104 // It prevents using invalid operator==/!= defined at namespace scope.
16105 struct faketype {};
16106 inline bool operator==(faketype, faketype) { return true; }
16107 inline bool operator!=(faketype, faketype) { return false; }
16108 
16109 // The helper function for {ASSERT|EXPECT}_EQ.
16110 template <typename T1, typename T2>
16111 AssertionResult CmpHelperEQ(const char* lhs_expression,
16112  const char* rhs_expression,
16113  const T1& lhs,
16114  const T2& rhs) {
16115  if (lhs == rhs) {
16116  return AssertionSuccess();
16117  }
16118 
16119  return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);
16120 }
16121 
16122 // With this overloaded version, we allow anonymous enums to be used
16123 // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
16124 // can be implicitly cast to BiggestInt.
16125 GTEST_API_ AssertionResult CmpHelperEQ(const char* lhs_expression,
16126  const char* rhs_expression,
16127  BiggestInt lhs,
16128  BiggestInt rhs);
16129 
16130 // The helper class for {ASSERT|EXPECT}_EQ. The template argument
16131 // lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
16132 // is a null pointer literal. The following default implementation is
16133 // for lhs_is_null_literal being false.
16134 template <bool lhs_is_null_literal>
16135 class EqHelper {
16136  public:
16137  // This templatized version is for the general case.
16138  template <typename T1, typename T2>
16139  static AssertionResult Compare(const char* lhs_expression,
16140  const char* rhs_expression,
16141  const T1& lhs,
16142  const T2& rhs) {
16143  return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
16144  }
16145 
16146  // With this overloaded version, we allow anonymous enums to be used
16147  // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
16148  // enums can be implicitly cast to BiggestInt.
16149  //
16150  // Even though its body looks the same as the above version, we
16151  // cannot merge the two, as it will make anonymous enums unhappy.
16152  static AssertionResult Compare(const char* lhs_expression,
16153  const char* rhs_expression,
16154  BiggestInt lhs,
16155  BiggestInt rhs) {
16156  return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
16157  }
16158 };
16159 
16160 // This specialization is used when the first argument to ASSERT_EQ()
16161 // is a null pointer literal, like NULL, false, or 0.
16162 template <>
16163 class EqHelper<true> {
16164  public:
16165  // We define two overloaded versions of Compare(). The first
16166  // version will be picked when the second argument to ASSERT_EQ() is
16167  // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or
16168  // EXPECT_EQ(false, a_bool).
16169  template <typename T1, typename T2>
16170  static AssertionResult Compare(
16171  const char* lhs_expression, const char* rhs_expression, const T1& lhs,
16172  const T2& rhs,
16173  // The following line prevents this overload from being considered if T2
16174  // is not a pointer type. We need this because ASSERT_EQ(NULL, my_ptr)
16175  // expands to Compare("", "", NULL, my_ptr), which requires a conversion
16176  // to match the Secret* in the other overload, which would otherwise make
16177  // this template match better.
16178  typename EnableIf<!std::is_pointer<T2>::value>::type* = nullptr) {
16179  return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
16180  }
16181 
16182  // This version will be picked when the second argument to ASSERT_EQ() is a
16183  // pointer, e.g. ASSERT_EQ(NULL, a_pointer).
16184  template <typename T>
16185  static AssertionResult Compare(
16186  const char* lhs_expression,
16187  const char* rhs_expression,
16188  // We used to have a second template parameter instead of Secret*. That
16189  // template parameter would deduce to 'long', making this a better match
16190  // than the first overload even without the first overload's EnableIf.
16191  // Unfortunately, gcc with -Wconversion-null warns when "passing NULL to
16192  // non-pointer argument" (even a deduced integral argument), so the old
16193  // implementation caused warnings in user code.
16194  Secret* /* lhs (NULL) */,
16195  T* rhs) {
16196  // We already know that 'lhs' is a null pointer.
16197  return CmpHelperEQ(lhs_expression, rhs_expression, static_cast<T*>(nullptr),
16198  rhs);
16199  }
16200 };
16201 
16202 // Separate the error generating code from the code path to reduce the stack
16203 // frame size of CmpHelperOP. This helps reduce the overhead of some sanitizers
16204 // when calling EXPECT_OP in a tight loop.
16205 template <typename T1, typename T2>
16206 AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2,
16207  const T1& val1, const T2& val2,
16208  const char* op) {
16209  return AssertionFailure()
16210  << "Expected: (" << expr1 << ") " << op << " (" << expr2
16211  << "), actual: " << FormatForComparisonFailureMessage(val1, val2)
16212  << " vs " << FormatForComparisonFailureMessage(val2, val1);
16213 }
16214 
16215 // A macro for implementing the helper functions needed to implement
16216 // ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste
16217 // of similar code.
16218 //
16219 // For each templatized helper function, we also define an overloaded
16220 // version for BiggestInt in order to reduce code bloat and allow
16221 // anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
16222 // with gcc 4.
16223 //
16224 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
16225 
16226 #define GTEST_IMPL_CMP_HELPER_(op_name, op)\
16227 template <typename T1, typename T2>\
16228 AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
16229  const T1& val1, const T2& val2) {\
16230  if (val1 op val2) {\
16231  return AssertionSuccess();\
16232  } else {\
16233  return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
16234  }\
16235 }\
16236 GTEST_API_ AssertionResult CmpHelper##op_name(\
16237  const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
16238 
16239 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
16240 
16241 // Implements the helper function for {ASSERT|EXPECT}_NE
16242 GTEST_IMPL_CMP_HELPER_(NE, !=);
16243 // Implements the helper function for {ASSERT|EXPECT}_LE
16244 GTEST_IMPL_CMP_HELPER_(LE, <=);
16245 // Implements the helper function for {ASSERT|EXPECT}_LT
16246 GTEST_IMPL_CMP_HELPER_(LT, <);
16247 // Implements the helper function for {ASSERT|EXPECT}_GE
16248 GTEST_IMPL_CMP_HELPER_(GE, >=);
16249 // Implements the helper function for {ASSERT|EXPECT}_GT
16250 GTEST_IMPL_CMP_HELPER_(GT, >);
16251 
16252 #undef GTEST_IMPL_CMP_HELPER_
16253 
16254 // The helper function for {ASSERT|EXPECT}_STREQ.
16255 //
16256 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
16257 GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
16258  const char* s2_expression,
16259  const char* s1,
16260  const char* s2);
16261 
16262 // The helper function for {ASSERT|EXPECT}_STRCASEEQ.
16263 //
16264 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
16265 GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression,
16266  const char* s2_expression,
16267  const char* s1,
16268  const char* s2);
16269 
16270 // The helper function for {ASSERT|EXPECT}_STRNE.
16271 //
16272 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
16273 GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
16274  const char* s2_expression,
16275  const char* s1,
16276  const char* s2);
16277 
16278 // The helper function for {ASSERT|EXPECT}_STRCASENE.
16279 //
16280 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
16281 GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
16282  const char* s2_expression,
16283  const char* s1,
16284  const char* s2);
16285 
16286 
16287 // Helper function for *_STREQ on wide strings.
16288 //
16289 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
16290 GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
16291  const char* s2_expression,
16292  const wchar_t* s1,
16293  const wchar_t* s2);
16294 
16295 // Helper function for *_STRNE on wide strings.
16296 //
16297 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
16298 GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
16299  const char* s2_expression,
16300  const wchar_t* s1,
16301  const wchar_t* s2);
16302 
16303 } // namespace internal
16304 
16305 // IsSubstring() and IsNotSubstring() are intended to be used as the
16306 // first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
16307 // themselves. They check whether needle is a substring of haystack
16308 // (NULL is considered a substring of itself only), and return an
16309 // appropriate error message when they fail.
16310 //
16311 // The {needle,haystack}_expr arguments are the stringified
16312 // expressions that generated the two real arguments.
16313 GTEST_API_ AssertionResult IsSubstring(
16314  const char* needle_expr, const char* haystack_expr,
16315  const char* needle, const char* haystack);
16316 GTEST_API_ AssertionResult IsSubstring(
16317  const char* needle_expr, const char* haystack_expr,
16318  const wchar_t* needle, const wchar_t* haystack);
16319 GTEST_API_ AssertionResult IsNotSubstring(
16320  const char* needle_expr, const char* haystack_expr,
16321  const char* needle, const char* haystack);
16322 GTEST_API_ AssertionResult IsNotSubstring(
16323  const char* needle_expr, const char* haystack_expr,
16324  const wchar_t* needle, const wchar_t* haystack);
16325 GTEST_API_ AssertionResult IsSubstring(
16326  const char* needle_expr, const char* haystack_expr,
16327  const ::std::string& needle, const ::std::string& haystack);
16328 GTEST_API_ AssertionResult IsNotSubstring(
16329  const char* needle_expr, const char* haystack_expr,
16330  const ::std::string& needle, const ::std::string& haystack);
16331 
16332 #if GTEST_HAS_STD_WSTRING
16333 GTEST_API_ AssertionResult IsSubstring(
16334  const char* needle_expr, const char* haystack_expr,
16335  const ::std::wstring& needle, const ::std::wstring& haystack);
16336 GTEST_API_ AssertionResult IsNotSubstring(
16337  const char* needle_expr, const char* haystack_expr,
16338  const ::std::wstring& needle, const ::std::wstring& haystack);
16339 #endif // GTEST_HAS_STD_WSTRING
16340 
16341 namespace internal {
16342 
16343 // Helper template function for comparing floating-points.
16344 //
16345 // Template parameter:
16346 //
16347 // RawType: the raw floating-point type (either float or double)
16348 //
16349 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
16350 template <typename RawType>
16351 AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
16352  const char* rhs_expression,
16353  RawType lhs_value,
16354  RawType rhs_value) {
16355  const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
16356 
16357  if (lhs.AlmostEquals(rhs)) {
16358  return AssertionSuccess();
16359  }
16360 
16361  ::std::stringstream lhs_ss;
16362  lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
16363  << lhs_value;
16364 
16365  ::std::stringstream rhs_ss;
16366  rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
16367  << rhs_value;
16368 
16369  return EqFailure(lhs_expression,
16370  rhs_expression,
16371  StringStreamToString(&lhs_ss),
16372  StringStreamToString(&rhs_ss),
16373  false);
16374 }
16375 
16376 // Helper function for implementing ASSERT_NEAR.
16377 //
16378 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
16379 GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
16380  const char* expr2,
16381  const char* abs_error_expr,
16382  double val1,
16383  double val2,
16384  double abs_error);
16385 
16386 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
16387 // A class that enables one to stream messages to assertion macros
16389  public:
16390  // Constructor.
16391  AssertHelper(TestPartResult::Type type,
16392  const char* file,
16393  int line,
16394  const char* message);
16395  ~AssertHelper();
16396 
16397  // Message assignment is a semantic trick to enable assertion
16398  // streaming; see the GTEST_MESSAGE_ macro below.
16399  void operator=(const Message& message) const;
16400 
16401  private:
16402  // We put our data in a struct so that the size of the AssertHelper class can
16403  // be as small as possible. This is important because gcc is incapable of
16404  // re-using stack space even for temporary variables, so every EXPECT_EQ
16405  // reserves stack space for another AssertHelper.
16406  struct AssertHelperData {
16407  AssertHelperData(TestPartResult::Type t,
16408  const char* srcfile,
16409  int line_num,
16410  const char* msg)
16411  : type(t), file(srcfile), line(line_num), message(msg) { }
16412 
16413  TestPartResult::Type const type;
16414  const char* const file;
16415  int const line;
16416  std::string const message;
16417 
16418  private:
16419  GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
16420  };
16421 
16422  AssertHelperData* const data_;
16423 
16425 };
16426 
16428 
16429 GTEST_API_ GTEST_ATTRIBUTE_PRINTF_(2, 3) void ColoredPrintf(GTestColor color,
16430  const char* fmt,
16431  ...);
16432 
16433 } // namespace internal
16434 
16435 // The pure interface class that all value-parameterized tests inherit from.
16436 // A value-parameterized class must inherit from both ::testing::Test and
16437 // ::testing::WithParamInterface. In most cases that just means inheriting
16438 // from ::testing::TestWithParam, but more complicated test hierarchies
16439 // may need to inherit from Test and WithParamInterface at different levels.
16440 //
16441 // This interface has support for accessing the test parameter value via
16442 // the GetParam() method.
16443 //
16444 // Use it with one of the parameter generator defining functions, like Range(),
16445 // Values(), ValuesIn(), Bool(), and Combine().
16446 //
16447 // class FooTest : public ::testing::TestWithParam<int> {
16448 // protected:
16449 // FooTest() {
16450 // // Can use GetParam() here.
16451 // }
16452 // virtual ~FooTest() {
16453 // // Can use GetParam() here.
16454 // }
16455 // virtual void SetUp() {
16456 // // Can use GetParam() here.
16457 // }
16458 // virtual void TearDown {
16459 // // Can use GetParam() here.
16460 // }
16461 // };
16462 // TEST_P(FooTest, DoesBar) {
16463 // // Can use GetParam() method here.
16464 // Foo foo;
16465 // ASSERT_TRUE(foo.DoesBar(GetParam()));
16466 // }
16467 // INSTANTIATE_TEST_SUITE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
16468 
16469 template <typename T>
16471  public:
16472  typedef T ParamType;
16473  virtual ~WithParamInterface() {}
16474 
16475  // The current parameter value. Is also available in the test fixture's
16476  // constructor.
16477  static const ParamType& GetParam() {
16478  GTEST_CHECK_(parameter_ != nullptr)
16479  << "GetParam() can only be called inside a value-parameterized test "
16480  << "-- did you intend to write TEST_P instead of TEST_F?";
16481  return *parameter_;
16482  }
16483 
16484  private:
16485  // Sets parameter value. The caller is responsible for making sure the value
16486  // remains alive and unchanged throughout the current test.
16487  static void SetParam(const ParamType* parameter) {
16488  parameter_ = parameter;
16489  }
16490 
16491  // Static value used for accessing parameter during a test lifetime.
16492  static const ParamType* parameter_;
16493 
16494  // TestClass must be a subclass of WithParamInterface<T> and Test.
16495  template <class TestClass> friend class internal::ParameterizedTestFactory;
16496 };
16497 
16498 template <typename T>
16499 const T* WithParamInterface<T>::parameter_ = nullptr;
16500 
16501 // Most value-parameterized classes can ignore the existence of
16502 // WithParamInterface, and can just inherit from ::testing::TestWithParam.
16503 
16504 template <typename T>
16505 class TestWithParam : public Test, public WithParamInterface<T> {
16506 };
16507 
16508 // Macros for indicating success/failure in test code.
16509 
16510 // Skips test in runtime.
16511 // Skipping test aborts current function.
16512 // Skipped tests are neither successful nor failed.
16513 #define GTEST_SKIP() GTEST_SKIP_("Skipped")
16514 
16515 // ADD_FAILURE unconditionally adds a failure to the current test.
16516 // SUCCEED generates a success - it doesn't automatically make the
16517 // current test successful, as a test is only successful when it has
16518 // no failure.
16519 //
16520 // EXPECT_* verifies that a certain condition is satisfied. If not,
16521 // it behaves like ADD_FAILURE. In particular:
16522 //
16523 // EXPECT_TRUE verifies that a Boolean condition is true.
16524 // EXPECT_FALSE verifies that a Boolean condition is false.
16525 //
16526 // FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
16527 // that they will also abort the current function on failure. People
16528 // usually want the fail-fast behavior of FAIL and ASSERT_*, but those
16529 // writing data-driven tests often find themselves using ADD_FAILURE
16530 // and EXPECT_* more.
16531 
16532 // Generates a nonfatal failure with a generic message.
16533 #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
16534 
16535 // Generates a nonfatal failure at the given source file location with
16536 // a generic message.
16537 #define ADD_FAILURE_AT(file, line) \
16538  GTEST_MESSAGE_AT_(file, line, "Failed", \
16539  ::testing::TestPartResult::kNonFatalFailure)
16540 
16541 // Generates a fatal failure with a generic message.
16542 #define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
16543 
16544 // Define this macro to 1 to omit the definition of FAIL(), which is a
16545 // generic name and clashes with some other libraries.
16546 #if !GTEST_DONT_DEFINE_FAIL
16547 # define FAIL() GTEST_FAIL()
16548 #endif
16549 
16550 // Generates a success with a generic message.
16551 #define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
16552 
16553 // Define this macro to 1 to omit the definition of SUCCEED(), which
16554 // is a generic name and clashes with some other libraries.
16555 #if !GTEST_DONT_DEFINE_SUCCEED
16556 # define SUCCEED() GTEST_SUCCEED()
16557 #endif
16558 
16559 // Macros for testing exceptions.
16560 //
16561 // * {ASSERT|EXPECT}_THROW(statement, expected_exception):
16562 // Tests that the statement throws the expected exception.
16563 // * {ASSERT|EXPECT}_NO_THROW(statement):
16564 // Tests that the statement doesn't throw any exception.
16565 // * {ASSERT|EXPECT}_ANY_THROW(statement):
16566 // Tests that the statement throws an exception.
16567 
16568 #define EXPECT_THROW(statement, expected_exception) \
16569  GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
16570 #define EXPECT_NO_THROW(statement) \
16571  GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
16572 #define EXPECT_ANY_THROW(statement) \
16573  GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
16574 #define ASSERT_THROW(statement, expected_exception) \
16575  GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
16576 #define ASSERT_NO_THROW(statement) \
16577  GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
16578 #define ASSERT_ANY_THROW(statement) \
16579  GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
16580 
16581 // Boolean assertions. Condition can be either a Boolean expression or an
16582 // AssertionResult. For more information on how to use AssertionResult with
16583 // these macros see comments on that class.
16584 #define EXPECT_TRUE(condition) \
16585  GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
16586  GTEST_NONFATAL_FAILURE_)
16587 #define EXPECT_FALSE(condition) \
16588  GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
16589  GTEST_NONFATAL_FAILURE_)
16590 #define ASSERT_TRUE(condition) \
16591  GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
16592  GTEST_FATAL_FAILURE_)
16593 #define ASSERT_FALSE(condition) \
16594  GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
16595  GTEST_FATAL_FAILURE_)
16596 
16597 // Macros for testing equalities and inequalities.
16598 //
16599 // * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2
16600 // * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
16601 // * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
16602 // * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
16603 // * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
16604 // * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
16605 //
16606 // When they are not, Google Test prints both the tested expressions and
16607 // their actual values. The values must be compatible built-in types,
16608 // or you will get a compiler error. By "compatible" we mean that the
16609 // values can be compared by the respective operator.
16610 //
16611 // Note:
16612 //
16613 // 1. It is possible to make a user-defined type work with
16614 // {ASSERT|EXPECT}_??(), but that requires overloading the
16615 // comparison operators and is thus discouraged by the Google C++
16616 // Usage Guide. Therefore, you are advised to use the
16617 // {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
16618 // equal.
16619 //
16620 // 2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
16621 // pointers (in particular, C strings). Therefore, if you use it
16622 // with two C strings, you are testing how their locations in memory
16623 // are related, not how their content is related. To compare two C
16624 // strings by content, use {ASSERT|EXPECT}_STR*().
16625 //
16626 // 3. {ASSERT|EXPECT}_EQ(v1, v2) is preferred to
16627 // {ASSERT|EXPECT}_TRUE(v1 == v2), as the former tells you
16628 // what the actual value is when it fails, and similarly for the
16629 // other comparisons.
16630 //
16631 // 4. Do not depend on the order in which {ASSERT|EXPECT}_??()
16632 // evaluate their arguments, which is undefined.
16633 //
16634 // 5. These macros evaluate their arguments exactly once.
16635 //
16636 // Examples:
16637 //
16638 // EXPECT_NE(Foo(), 5);
16639 // EXPECT_EQ(a_pointer, NULL);
16640 // ASSERT_LT(i, array_size);
16641 // ASSERT_GT(records.size(), 0) << "There is no record left.";
16642 
16643 #define EXPECT_EQ(val1, val2) \
16644  EXPECT_PRED_FORMAT2(::testing::internal:: \
16645  EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
16646  val1, val2)
16647 #define EXPECT_NE(val1, val2) \
16648  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
16649 #define EXPECT_LE(val1, val2) \
16650  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
16651 #define EXPECT_LT(val1, val2) \
16652  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
16653 #define EXPECT_GE(val1, val2) \
16654  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
16655 #define EXPECT_GT(val1, val2) \
16656  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
16657 
16658 #define GTEST_ASSERT_EQ(val1, val2) \
16659  ASSERT_PRED_FORMAT2(::testing::internal:: \
16660  EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
16661  val1, val2)
16662 #define GTEST_ASSERT_NE(val1, val2) \
16663  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
16664 #define GTEST_ASSERT_LE(val1, val2) \
16665  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
16666 #define GTEST_ASSERT_LT(val1, val2) \
16667  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
16668 #define GTEST_ASSERT_GE(val1, val2) \
16669  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
16670 #define GTEST_ASSERT_GT(val1, val2) \
16671  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
16672 
16673 // Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
16674 // ASSERT_XY(), which clashes with some users' own code.
16675 
16676 #if !GTEST_DONT_DEFINE_ASSERT_EQ
16677 # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
16678 #endif
16679 
16680 #if !GTEST_DONT_DEFINE_ASSERT_NE
16681 # define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
16682 #endif
16683 
16684 #if !GTEST_DONT_DEFINE_ASSERT_LE
16685 # define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
16686 #endif
16687 
16688 #if !GTEST_DONT_DEFINE_ASSERT_LT
16689 # define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
16690 #endif
16691 
16692 #if !GTEST_DONT_DEFINE_ASSERT_GE
16693 # define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
16694 #endif
16695 
16696 #if !GTEST_DONT_DEFINE_ASSERT_GT
16697 # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
16698 #endif
16699 
16700 // C-string Comparisons. All tests treat NULL and any non-NULL string
16701 // as different. Two NULLs are equal.
16702 //
16703 // * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2
16704 // * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2
16705 // * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
16706 // * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
16707 //
16708 // For wide or narrow string objects, you can use the
16709 // {ASSERT|EXPECT}_??() macros.
16710 //
16711 // Don't depend on the order in which the arguments are evaluated,
16712 // which is undefined.
16713 //
16714 // These macros evaluate their arguments exactly once.
16715 
16716 #define EXPECT_STREQ(s1, s2) \
16717  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
16718 #define EXPECT_STRNE(s1, s2) \
16719  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
16720 #define EXPECT_STRCASEEQ(s1, s2) \
16721  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
16722 #define EXPECT_STRCASENE(s1, s2)\
16723  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
16724 
16725 #define ASSERT_STREQ(s1, s2) \
16726  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
16727 #define ASSERT_STRNE(s1, s2) \
16728  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
16729 #define ASSERT_STRCASEEQ(s1, s2) \
16730  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
16731 #define ASSERT_STRCASENE(s1, s2)\
16732  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
16733 
16734 // Macros for comparing floating-point numbers.
16735 //
16736 // * {ASSERT|EXPECT}_FLOAT_EQ(val1, val2):
16737 // Tests that two float values are almost equal.
16738 // * {ASSERT|EXPECT}_DOUBLE_EQ(val1, val2):
16739 // Tests that two double values are almost equal.
16740 // * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
16741 // Tests that v1 and v2 are within the given distance to each other.
16742 //
16743 // Google Test uses ULP-based comparison to automatically pick a default
16744 // error bound that is appropriate for the operands. See the
16745 // FloatingPoint template class in gtest-internal.h if you are
16746 // interested in the implementation details.
16747 
16748 #define EXPECT_FLOAT_EQ(val1, val2)\
16749  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
16750  val1, val2)
16751 
16752 #define EXPECT_DOUBLE_EQ(val1, val2)\
16753  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
16754  val1, val2)
16755 
16756 #define ASSERT_FLOAT_EQ(val1, val2)\
16757  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
16758  val1, val2)
16759 
16760 #define ASSERT_DOUBLE_EQ(val1, val2)\
16761  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
16762  val1, val2)
16763 
16764 #define EXPECT_NEAR(val1, val2, abs_error)\
16765  EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
16766  val1, val2, abs_error)
16767 
16768 #define ASSERT_NEAR(val1, val2, abs_error)\
16769  ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
16770  val1, val2, abs_error)
16771 
16772 // These predicate format functions work on floating-point values, and
16773 // can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
16774 //
16775 // EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
16776 
16777 // Asserts that val1 is less than, or almost equal to, val2. Fails
16778 // otherwise. In particular, it fails if either val1 or val2 is NaN.
16779 GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
16780  float val1, float val2);
16781 GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
16782  double val1, double val2);
16783 
16784 
16785 #if GTEST_OS_WINDOWS
16786 
16787 // Macros that test for HRESULT failure and success, these are only useful
16788 // on Windows, and rely on Windows SDK macros and APIs to compile.
16789 //
16790 // * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
16791 //
16792 // When expr unexpectedly fails or succeeds, Google Test prints the
16793 // expected result and the actual result with both a human-readable
16794 // string representation of the error, if available, as well as the
16795 // hex result code.
16796 # define EXPECT_HRESULT_SUCCEEDED(expr) \
16797  EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
16798 
16799 # define ASSERT_HRESULT_SUCCEEDED(expr) \
16800  ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
16801 
16802 # define EXPECT_HRESULT_FAILED(expr) \
16803  EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
16804 
16805 # define ASSERT_HRESULT_FAILED(expr) \
16806  ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
16807 
16808 #endif // GTEST_OS_WINDOWS
16809 
16810 // Macros that execute statement and check that it doesn't generate new fatal
16811 // failures in the current thread.
16812 //
16813 // * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
16814 //
16815 // Examples:
16816 //
16817 // EXPECT_NO_FATAL_FAILURE(Process());
16818 // ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
16819 //
16820 #define ASSERT_NO_FATAL_FAILURE(statement) \
16821  GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
16822 #define EXPECT_NO_FATAL_FAILURE(statement) \
16823  GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
16824 
16825 // Causes a trace (including the given source file path and line number,
16826 // and the given message) to be included in every test failure message generated
16827 // by code in the scope of the lifetime of an instance of this class. The effect
16828 // is undone with the destruction of the instance.
16829 //
16830 // The message argument can be anything streamable to std::ostream.
16831 //
16832 // Example:
16833 // testing::ScopedTrace trace("file.cc", 123, "message");
16834 //
16836  public:
16837  // The c'tor pushes the given source file location and message onto
16838  // a trace stack maintained by Google Test.
16839 
16840  // Template version. Uses Message() to convert the values into strings.
16841  // Slow, but flexible.
16842  template <typename T>
16843  ScopedTrace(const char* file, int line, const T& message) {
16844  PushTrace(file, line, (Message() << message).GetString());
16845  }
16846 
16847  // Optimize for some known types.
16848  ScopedTrace(const char* file, int line, const char* message) {
16849  PushTrace(file, line, message ? message : "(null)");
16850  }
16851 
16852 #if GTEST_HAS_GLOBAL_STRING
16853  ScopedTrace(const char* file, int line, const ::string& message) {
16854  PushTrace(file, line, message);
16855  }
16856 #endif
16857 
16858  ScopedTrace(const char* file, int line, const std::string& message) {
16859  PushTrace(file, line, message);
16860  }
16861 
16862  // The d'tor pops the info pushed by the c'tor.
16863  //
16864  // Note that the d'tor is not virtual in order to be efficient.
16865  // Don't inherit from ScopedTrace!
16866  ~ScopedTrace();
16867 
16868  private:
16869  void PushTrace(const char* file, int line, std::string message);
16870 
16872 } GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
16873  // c'tor and d'tor. Therefore it doesn't
16874  // need to be used otherwise.
16875 
16876 // Causes a trace (including the source file path, the current line
16877 // number, and the given message) to be included in every test failure
16878 // message generated by code in the current scope. The effect is
16879 // undone when the control leaves the current scope.
16880 //
16881 // The message argument can be anything streamable to std::ostream.
16882 //
16883 // In the implementation, we include the current line number as part
16884 // of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
16885 // to appear in the same block - as long as they are on different
16886 // lines.
16887 //
16888 // Assuming that each thread maintains its own stack of traces.
16889 // Therefore, a SCOPED_TRACE() would (correctly) only affect the
16890 // assertions in its own thread.
16891 #define SCOPED_TRACE(message) \
16892  ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
16893  __FILE__, __LINE__, (message))
16894 
16895 
16896 // Compile-time assertion for type equality.
16897 // StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
16898 // the same type. The value it returns is not interesting.
16899 //
16900 // Instead of making StaticAssertTypeEq a class template, we make it a
16901 // function template that invokes a helper class template. This
16902 // prevents a user from misusing StaticAssertTypeEq<T1, T2> by
16903 // defining objects of that type.
16904 //
16905 // CAVEAT:
16906 //
16907 // When used inside a method of a class template,
16908 // StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
16909 // instantiated. For example, given:
16910 //
16911 // template <typename T> class Foo {
16912 // public:
16913 // void Bar() { testing::StaticAssertTypeEq<int, T>(); }
16914 // };
16915 //
16916 // the code:
16917 //
16918 // void Test1() { Foo<bool> foo; }
16919 //
16920 // will NOT generate a compiler error, as Foo<bool>::Bar() is never
16921 // actually instantiated. Instead, you need:
16922 //
16923 // void Test2() { Foo<bool> foo; foo.Bar(); }
16924 //
16925 // to cause a compiler error.
16926 template <typename T1, typename T2>
16929  return true;
16930 }
16931 
16932 // Defines a test.
16933 //
16934 // The first parameter is the name of the test suite, and the second
16935 // parameter is the name of the test within the test suite.
16936 //
16937 // The convention is to end the test suite name with "Test". For
16938 // example, a test suite for the Foo class can be named FooTest.
16939 //
16940 // Test code should appear between braces after an invocation of
16941 // this macro. Example:
16942 //
16943 // TEST(FooTest, InitializesCorrectly) {
16944 // Foo foo;
16945 // EXPECT_TRUE(foo.StatusIsOK());
16946 // }
16947 
16948 // Note that we call GetTestTypeId() instead of GetTypeId<
16949 // ::testing::Test>() here to get the type ID of testing::Test. This
16950 // is to work around a suspected linker bug when using Google Test as
16951 // a framework on Mac OS X. The bug causes GetTypeId<
16952 // ::testing::Test>() to return different values depending on whether
16953 // the call is from the Google Test framework itself or from user test
16954 // code. GetTestTypeId() is guaranteed to always return the same
16955 // value, as it always calls GetTypeId<>() from the Google Test
16956 // framework.
16957 #define GTEST_TEST(test_suite_name, test_name) \
16958  GTEST_TEST_(test_suite_name, test_name, ::testing::Test, \
16959  ::testing::internal::GetTestTypeId())
16960 
16961 // Define this macro to 1 to omit the definition of TEST(), which
16962 // is a generic name and clashes with some other libraries.
16963 #if !GTEST_DONT_DEFINE_TEST
16964 #define TEST(test_suite_name, test_name) GTEST_TEST(test_suite_name, test_name)
16965 #endif
16966 
16967 // Defines a test that uses a test fixture.
16968 //
16969 // The first parameter is the name of the test fixture class, which
16970 // also doubles as the test suite name. The second parameter is the
16971 // name of the test within the test suite.
16972 //
16973 // A test fixture class must be declared earlier. The user should put
16974 // the test code between braces after using this macro. Example:
16975 //
16976 // class FooTest : public testing::Test {
16977 // protected:
16978 // virtual void SetUp() { b_.AddElement(3); }
16979 //
16980 // Foo a_;
16981 // Foo b_;
16982 // };
16983 //
16984 // TEST_F(FooTest, InitializesCorrectly) {
16985 // EXPECT_TRUE(a_.StatusIsOK());
16986 // }
16987 //
16988 // TEST_F(FooTest, ReturnsElementCountCorrectly) {
16989 // EXPECT_EQ(a_.size(), 0);
16990 // EXPECT_EQ(b_.size(), 1);
16991 // }
16992 
16993 #define TEST_F(test_fixture, test_name)\
16994  GTEST_TEST_(test_fixture, test_name, test_fixture, \
16995  ::testing::internal::GetTypeId<test_fixture>())
16996 
16997 // Returns a path to temporary directory.
16998 // Tries to determine an appropriate directory for the platform.
17000 
17001 #ifdef _MSC_VER
17002 # pragma warning(pop)
17003 #endif
17004 
17005 // Dynamically registers a test with the framework.
17006 //
17007 // This is an advanced API only to be used when the `TEST` macros are
17008 // insufficient. The macros should be preferred when possible, as they avoid
17009 // most of the complexity of calling this function.
17010 //
17011 // The `factory` argument is a factory callable (move-constructible) object or
17012 // function pointer that creates a new instance of the Test object. It
17013 // handles ownership to the caller. The signature of the callable is
17014 // `Fixture*()`, where `Fixture` is the test fixture class for the test. All
17015 // tests registered with the same `test_suite_name` must return the same
17016 // fixture type. This is checked at runtime.
17017 //
17018 // The framework will infer the fixture class from the factory and will call
17019 // the `SetUpTestSuite` and `TearDownTestSuite` for it.
17020 //
17021 // Must be called before `RUN_ALL_TESTS()` is invoked, otherwise behavior is
17022 // undefined.
17023 //
17024 // Use case example:
17025 //
17026 // class MyFixture : public ::testing::Test {
17027 // public:
17028 // // All of these optional, just like in regular macro usage.
17029 // static void SetUpTestSuite() { ... }
17030 // static void TearDownTestSuite() { ... }
17031 // void SetUp() override { ... }
17032 // void TearDown() override { ... }
17033 // };
17034 //
17035 // class MyTest : public MyFixture {
17036 // public:
17037 // explicit MyTest(int data) : data_(data) {}
17038 // void TestBody() override { ... }
17039 //
17040 // private:
17041 // int data_;
17042 // };
17043 //
17044 // void RegisterMyTests(const std::vector<int>& values) {
17045 // for (int v : values) {
17046 // ::testing::RegisterTest(
17047 // "MyFixture", ("Test" + std::to_string(v)).c_str(), nullptr,
17048 // std::to_string(v).c_str(),
17049 // __FILE__, __LINE__,
17050 // // Important to use the fixture type as the return type here.
17051 // [=]() -> MyFixture* { return new MyTest(v); });
17052 // }
17053 // }
17054 // ...
17055 // int main(int argc, char** argv) {
17056 // std::vector<int> values_to_test = LoadValuesFromConfig();
17057 // RegisterMyTests(values_to_test);
17058 // ...
17059 // return RUN_ALL_TESTS();
17060 // }
17061 //
17062 template <int&... ExplicitParameterBarrier, typename Factory>
17063 TestInfo* RegisterTest(const char* test_suite_name, const char* test_name,
17064  const char* type_param, const char* value_param,
17065  const char* file, int line, Factory factory) {
17066  using TestT = typename std::remove_pointer<decltype(factory())>::type;
17067 
17068  class FactoryImpl : public internal::TestFactoryBase {
17069  public:
17070  explicit FactoryImpl(Factory f) : factory_(std::move(f)) {}
17071  Test* CreateTest() override { return factory_(); }
17072 
17073  private:
17074  Factory factory_;
17075  };
17076 
17078  test_suite_name, test_name, type_param, value_param,
17079  internal::CodeLocation(file, line), internal::GetTypeId<TestT>(),
17082  new FactoryImpl{std::move(factory)});
17083 }
17084 
17085 } // namespace testing
17086 
17087 // Use this function in main() to run all tests. It returns 0 if all
17088 // tests are successful, or 1 otherwise.
17089 //
17090 // RUN_ALL_TESTS() should be invoked after the command line has been
17091 // parsed by InitGoogleTest().
17092 //
17093 // This function was formerly a macro; thus, it is in the global
17094 // namespace and has an all-caps name.
17096 
17097 inline int RUN_ALL_TESTS() {
17098  return ::testing::UnitTest::GetInstance()->Run();
17099 }
17100 
17102 
17103 #endif // GTEST_INCLUDE_GTEST_GTEST_H_
ParamIterator< T > iterator
Definition: gtest.h:10721
bool IsXDigit(char ch)
Definition: gtest.h:2251
FILE * FReopen(const char *path, const char *mode, FILE *stream)
Definition: gtest.h:2353
const T * operator->() const
Definition: gtest.h:10674
virtual void OnTestIterationStart(const UnitTest &unit_test, int iteration)=0
::std::tuple< T1, T2, T3 > ParamType
Definition: gtest.h:11483
GTEST_API_ AssertionResult DoubleLE(const char *expr1, const char *expr2, double val1, double val2)
static RawType ReinterpretBits(const Bits bits)
Definition: gtest.h:6742
::std::tuple< T1, T2, T3, T4, T5, T6, T7, T8 > ParamType
Definition: gtest.h:12323
ParameterizedTestSuiteInfo(const char *name, CodeLocation code_location)
Definition: gtest.h:11044
#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
Definition: gtest.h:916
const T * pointer() const
Definition: gtest.h:2170
Test * CreateTest() override
Definition: gtest.h:6909
std::true_type IsNullLiteralHelper(Secret *)
GTEST_API_ bool AlwaysTrue()
virtual void OnEnvironmentsSetUpEnd(const UnitTest &unit_test)=0
Environment * AddGlobalTestEnvironment(Environment *env)
Definition: gtest.h:16067
void OnTestCaseStart(const TestCase &tc) override
Definition: gtest.h:15744
ParamNameGenFunctor GetParamNameGen(ParamNameGenFunctor func)
Definition: gtest.h:10924
CartesianProductHolder3(const Generator1 &g1, const Generator2 &g2, const Generator3 &g3)
Definition: gtest.h:13064
static void Print(const wchar_t *str, ::std::ostream *os)
Definition: gtest.h:8891
std::string GetCapturedStdout()
Definition: gtest-all.cc:10789
virtual const std::string & GetTestSuiteName() const =0
GTEST_API_ AssertionResult DoubleNearPredFormat(const char *expr1, const char *expr2, const char *abs_error_expr, double val1, double val2, double abs_error)
std::string GetCapturedStderr()
Definition: gtest-all.cc:10794
TypeId GetTypeId()
Definition: gtest.h:6872
To ImplicitCast_(To x)
Definition: gtest.h:1342
ParamIterator & operator++()
Definition: gtest.h:10676
ParamIteratorInterface< ParamType > * Begin() const override
Definition: gtest.h:11623
ParamIteratorInterface< ParamType > * End() const override
Definition: gtest.h:12339
const char * test_case_name() const
Definition: gtest.h:15305
::std::tuple< T1, T2, T3, T4, T5, T6, T7 > ParamType
Definition: gtest.h:12120
GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(UnitTest *unit_test, int skip_count)
ParamIteratorInterface< T > * End() const override
Definition: gtest.h:10753
ParamIteratorInterface< ParamType > * Begin() const override
Definition: gtest.h:12796
void(*)() SetUpTestSuiteFunc
Definition: gtest.h:6926
static void PrintValue(const T &value, ::std::ostream *os)
Definition: gtest.h:8217
CartesianProductHolder7(const Generator1 &g1, const Generator2 &g2, const Generator3 &g3, const Generator4 &g4, const Generator5 &g5, const Generator6 &g6, const Generator7 &g7)
Definition: gtest.h:13178
void OnTestCaseEnd(const TestCase &tc) override
Definition: gtest.h:15752
GTEST_API_ bool SkipPrefix(const char *prefix, const char **pstr)
#define GTEST_INTENTIONAL_CONST_COND_PUSH_()
Definition: gtest.h:950
CartesianProductHolder4(const Generator1 &g1, const Generator2 &g2, const Generator3 &g3, const Generator4 &g4)
Definition: gtest.h:13089
bool Passed() const
Definition: gtest.h:15186
AssertionResult AssertPred2Helper(const char *pred_text, const char *e1, const char *e2, Pred pred, const T1 &v1, const T2 &v2)
Definition: gtest.h:14758
static const Bits kSignBitMask
Definition: gtest.h:6706
int FClose(FILE *fp)
Definition: gtest.h:2358
CartesianProductGenerator5(const ParamGenerator< T1 > &g1, const ParamGenerator< T2 > &g2, const ParamGenerator< T3 > &g3, const ParamGenerator< T4 > &g4, const ParamGenerator< T5 > &g5)
Definition: gtest.h:11768
CartesianProductGenerator6(const ParamGenerator< T1 > &g1, const ParamGenerator< T2 > &g2, const ParamGenerator< T3 > &g3, const ParamGenerator< T4 > &g4, const ParamGenerator< T5 > &g5, const ParamGenerator< T6 > &g6)
Definition: gtest.h:11936
size_t GetThreadCount()
Definition: gtest-all.cc:9875
IsContainer IsContainerTest(int)
Definition: gtest.h:7429
const TestResult & ad_hoc_test_result() const
Definition: gtest.h:15502
NativeArray(const NativeArray &rhs)
Definition: gtest.h:7597
eval< filter_impl::filter_< List, Pred, typelist<> > > filter
Definition: typelist.h:800
ParamIterator(const ParamIterator &other)
Definition: gtest.h:10666
const char * pattern() const
Definition: gtest.h:1155
static bool PartialMatch(const ::std::string &str, const RE &re)
Definition: gtest.h:1164
NativeArray(const Element *array, size_t count, RelationToSourceReference)
Definition: gtest.h:7587
bool should_run() const
Definition: gtest.h:15461
CartesianProductGenerator10(const ParamGenerator< T1 > &g1, const ParamGenerator< T2 > &g2, const ParamGenerator< T3 > &g3, const ParamGenerator< T4 > &g4, const ParamGenerator< T5 > &g5, const ParamGenerator< T6 > &g6, const ParamGenerator< T7 > &g7, const ParamGenerator< T8 > &g8, const ParamGenerator< T9 > &g9, const ParamGenerator< T10 > &g10)
Definition: gtest.h:12786
void OnTestIterationEnd(const UnitTest &, int) override
Definition: gtest.h:15757
ParamIteratorInterface< T > * Begin() const override
Definition: gtest.h:10835
static const bool value
Definition: gtest.h:2186
GTEST_API_ bool IsTrue(bool condition)
bool operator==(faketype, faketype)
Definition: gtest.h:16106
::std::string PrintToString(const T &value)
Definition: gtest.h:8969
virtual void OnTestCaseEnd(const TestCase &test_case)
Definition: gtest.h:15712
ParamIteratorInterface< ParamType > * End() const override
Definition: gtest.h:12801
std::string ReadEntireFile(FILE *file)
Definition: gtest-all.cc:10809
void OnTestSuiteEnd(const TestSuite &) override
Definition: gtest.h:15750
#define GTEST_CHECK_POSIX_SUCCESS_(posix_call)
Definition: gtest.h:1283
#define GTEST_DISABLE_MSC_DEPRECATED_POP_()
Definition: gtest.h:561
ConstCharPtr(const char *str)
Definition: gtest.h:7266
ParamIteratorInterface< ParamType > * End() const override
Definition: gtest.h:11378
bool BoolFromGTestEnv(const char *flag, bool default_value)
Definition: gtest-all.cc:10934
virtual ParamIteratorInterface< T > * Begin() const =0
const TestResult * result() const
Definition: gtest.h:15360
GTEST_API_ AssertionResult IsSubstring(const char *needle_expr, const char *haystack_expr, const char *needle, const char *haystack)
ScopedTrace(const char *file, int line, const std::string &message)
Definition: gtest.h:16858
GTEST_API_ ::std::string FormatFileLocation(const char *file, int line)
Definition: gtest-all.cc:10620
CartesianProductGenerator2(const ParamGenerator< T1 > &g1, const ParamGenerator< T2 > &g2)
Definition: gtest.h:11370
bool operator!=(faketype, faketype)
Definition: gtest.h:16107
virtual void OnTestStart(const TestInfo &test_info)=0
int IsATTY(int fd)
Definition: gtest.h:2323
::std::string string
Definition: gtest.h:1115
ParamIteratorInterface< ParamType > * Begin() const override
Definition: gtest.h:11774
bool_constant< bool_value > type
Definition: gtest.h:2185
FloatingPoint(const RawType &x)
Definition: gtest.h:6735
internal::ParamGenerator< bool > Bool()
Definition: gtest.h:13520
Int32 Int32FromGTestEnv(const char *flag, Int32 default_value)
Definition: gtest-all.cc:10948
#define TEST_F(test_fixture, test_name)
Definition: gtest.h:16993
ParamGenerator & operator=(const ParamGenerator &other)
Definition: gtest.h:10726
GTEST_API_ std::vector< EditType > CalculateOptimalEdits(const std::vector< size_t > &left, const std::vector< size_t > &right)
#define GTEST_INTENTIONAL_CONST_COND_POP_()
Definition: gtest.h:952
bool ParseInt32(const Message &src_text, const char *str, Int32 *value)
Definition: gtest-all.cc:10892
void SetValue(const std::string &new_value)
Definition: gtest.h:15153
size_< List::size()> size
Definition: typelist.h:129
virtual void OnTestIterationEnd(const UnitTest &unit_test, int iteration)=0
void OnTestPartResult(const TestPartResult &) override
Definition: gtest.h:15748
const char * type_param() const
Definition: gtest.h:15313
::std::wstring wstring
Definition: gtest.h:1121
RE(const char *regex)
Definition: gtest.h:1151
bool operator==(const ParamIterator &other) const
Definition: gtest.h:10686
RangeGenerator(T begin, T end, IncrementT step)
Definition: gtest.h:10745
ParamIterator operator++(int)
Definition: gtest.h:10681
static void PrintValue(const T &value, ::std::ostream *os)
Definition: gtest.h:8198
bool IsDigit(char ch)
Definition: gtest.h:2239
::std::vector< ::std::string > Strings
Definition: gtest.h:8926
ParamIteratorInterface< T > * Begin() const override
Definition: gtest.h:10750
int Stat(const char *path, StatStruct *buf)
Definition: gtest.h:2324
virtual void OnEnvironmentsTearDownEnd(const UnitTest &unit_test)=0
virtual void OnEnvironmentsSetUpStart(const UnitTest &unit_test)=0
GTEST_API_ AssertionResult IsNotSubstring(const char *needle_expr, const char *haystack_expr, const char *needle, const char *haystack)
static SetUpTearDownSuiteFuncType GetTearDownCaseOrSuite()
Definition: gtest.h:6971
int ChDir(const char *dir)
Definition: gtest.h:2347
repeat_c< N::type::value, Ts... > repeat
Definition: typelist.h:161
::std::basic_ostream< Char, CharTraits > & operator<<(::std::basic_ostream< Char, CharTraits > &os, const T &x)
Definition: gtest.h:8261
const char * GetEnv(const char *name)
Definition: gtest.h:2369
void OnTestIterationStart(const UnitTest &, int) override
Definition: gtest.h:15737
ParamNameGenFunc< ParamType >::Type ParamNameGeneratorFunc
Definition: gtest.h:11042
virtual void TearDown()
Definition: gtest.h:15647
typename std::conditional< sizeof(T) !=0, ::testing::Test, void >::type Test
Definition: gtest.h:6956
internal::ParamGenerator< T > Range(T start, T end, IncrementT step)
Definition: gtest.h:13389
static void Print(const char *str, ::std::ostream *os)
Definition: gtest.h:8871
void PrintStringTo(const ::std::string &s, ostream *os)
Definition: gtest-all.cc:11432
#define GTEST_DECLARE_string_(name)
Definition: gtest.h:2499
virtual const ParamGeneratorInterface< T > * BaseGenerator() const =0
GTEST_API_ AssertionResult CmpHelperSTRNE(const char *s1_expression, const char *s2_expression, const wchar_t *s1, const wchar_t *s2)
ParamIteratorInterface< ParamType > * End() const override
Definition: gtest.h:12561
ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
Definition: gtest.h:10831
virtual ~TestEventListener()
Definition: gtest.h:15671
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
Definition: gtest.h:8416
ParamGenerator(const ParamGenerator &other)
Definition: gtest.h:10724
ParamIteratorInterface< ParamType > * Begin() const override
Definition: gtest.h:12556
#define GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
Definition: gtest.h:559
TypeWithSize< 8 >::Int TimeInMillis
Definition: gtest.h:2479
bool_constant< true > true_type
Definition: gtest.h:2191
TestEventListener * default_result_printer() const
Definition: gtest.h:15783
ParamIteratorInterface< ParamType > * End() const override
Definition: gtest.h:11494
ThreadLocal(const T &value)
Definition: gtest.h:2168
To DownCast_(From *f)
Definition: gtest.h:1366
void OnEnvironmentsTearDownStart(const UnitTest &) override
Definition: gtest.h:15755
GTEST_API_ AssertionResult EqFailure(const char *expected_expression, const char *actual_expression, const std::string &expected_value, const std::string &actual_value, bool ignoring_case)
void OnEnvironmentsTearDownEnd(const UnitTest &) override
Definition: gtest.h:15756
static const bool value
Definition: gtest.h:7452
#define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
Definition: gtest.h:545
static void PrintValue(const T &value, ::std::ostream *os)
Definition: gtest.h:8183
static void Print(wchar_t *str, ::std::ostream *os)
Definition: gtest.h:8904
typename ElemFromList< I, typename MakeIndexSequence< sizeof...(T)>::type, T... >::type value_type
Definition: gtest.h:7702
TestEventListener * default_xml_generator() const
Definition: gtest.h:15794
#define GTEST_DECLARE_bool_(name)
Definition: gtest.h:2496
ParamIteratorInterface< ParamType > * Begin() const override
Definition: gtest.h:11490
size_t GetFileSize(FILE *file)
Definition: gtest-all.cc:10804
ElemFromList< I, Indices, T... >::type & Get()
Definition: gtest.h:7745
std::string StreamableToString(const T &streamable)
Definition: gtest.h:2769
count_if< List, same_as< T > > count
Definition: typelist.h:761
virtual ~Environment()
Definition: gtest.h:15641
internal::TimeInMillis TimeInMillis
Definition: gtest.h:15127
#define GTEST_API_
Definition: gtest.h:998
bool Passed() const
Definition: gtest.h:15488
bool_constant< false > false_type
Definition: gtest.h:2190
ParameterizedTestSuiteInfo< TestSuite > * GetTestSuitePatternHolder(const char *test_suite_name, CodeLocation code_location)
Definition: gtest.h:11217
virtual ParamIteratorInterface< T > * End() const =0
const_iterator begin() const
Definition: gtest.h:7608
bool ArrayEq(const T *lhs, size_t size, const U *rhs)
Definition: gtest.h:7517
TypeWithSize< 4 >::UInt UInt32
Definition: gtest.h:2476
NativeArray(const Element *array, size_t count, RelationToSourceCopy)
Definition: gtest.h:7592
const size_t kProtobufOneLinerMaxLength
Definition: gtest.h:8193
const void * TypeId
Definition: gtest.h:6854
const char * StringFromGTestEnv(const char *flag, const char *default_value)
Definition: gtest-all.cc:10991
int Write(int fd, const void *buf, unsigned int count)
Definition: gtest.h:2363
char ToLower(char ch)
Definition: gtest.h:2259
const ElemFromList< I, Indices, T... >::type & Get() const
Definition: gtest.h:7740
void PrintBytesInObjectTo(const unsigned char *obj_bytes, size_t count, ostream *os)
Definition: gtest-all.cc:11112
ParamGenerator(ParamGeneratorInterface< T > *impl)
Definition: gtest.h:10723
virtual const T * Current() const =0
const char * type_param() const
Definition: gtest.h:15455
std::ptrdiff_t ptrdiff_t
Definition: types.h:40
AssertionResult CmpHelperFloatingPointEQ(const char *lhs_expression, const char *rhs_expression, RawType lhs_value, RawType rhs_value)
Definition: gtest.h:16351
void PrintTupleTo(const T &, std::integral_constant< size_t, 0 >, ::std::ostream *)
Definition: gtest.h:8677
GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
TypeWithSize< 4 >::Int Int32
Definition: gtest.h:2475
bool IsSpace(char ch)
Definition: gtest.h:2245
#define GTEST_IMPL_CMP_HELPER_(op_name, op)
Definition: gtest.h:16226
bool should_run() const
Definition: gtest.h:15350
CartesianProductHolder5(const Generator1 &g1, const Generator2 &g2, const Generator3 &g3, const Generator4 &g4, const Generator5 &g5)
Definition: gtest.h:13116
void OnTestSuiteStart(const TestSuite &) override
Definition: gtest.h:15741
GTEST_API_ const char * fmt
Definition: gtest.h:16430
const T & operator*() const
Definition: gtest.h:10673
GTEST_API_ std::string TempDir()
CartesianProductGenerator8(const ParamGenerator< T1 > &g1, const ParamGenerator< T2 > &g2, const ParamGenerator< T3 > &g3, const ParamGenerator< T4 > &g4, const ParamGenerator< T5 > &g5, const ParamGenerator< T6 > &g6, const ParamGenerator< T7 > &g7, const ParamGenerator< T8 > &g8)
Definition: gtest.h:12325
static void Print(const T &value, ::std::ostream *os)
Definition: gtest.h:8724
static void TearDownTestCase()
Definition: gtest.h:15039
GTEST_API_ const char kStackTraceMarker[]
const_iterator end() const
Definition: gtest.h:7609
::std::ostream & GetStream()
Definition: gtest.h:1236
internal::CartesianProductHolder2< Generator1, Generator2 > Combine(const Generator1 &g1, const Generator2 &g2)
Definition: gtest.h:13571
CartesianProductGenerator3(const ParamGenerator< T1 > &g1, const ParamGenerator< T2 > &g2, const ParamGenerator< T3 > &g3)
Definition: gtest.h:11485
void DefaultPrintTo(WrapPrinterType< kPrintContainer >, const C &container, ::std::ostream *os)
Definition: gtest.h:8445
FloatingPoint< float > Float
Definition: gtest.h:6845
FloatingPoint< double > Double
Definition: gtest.h:6846
const char * name() const
Definition: gtest.h:15451
void OnTestStart(const TestInfo &) override
Definition: gtest.h:15747
int RmDir(const char *dir)
Definition: gtest.h:2329
GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
GTEST_API_ AssertionResult CmpHelperSTREQ(const char *s1_expression, const char *s2_expression, const wchar_t *s1, const wchar_t *s2)
TestParamInfo(const ParamType &a_param, size_t an_index)
Definition: gtest.h:10595
virtual void OnTestProgramEnd(const UnitTest &unit_test)=0
static bool FullMatch(const ::std::string &str, const RE &re)
Definition: gtest.h:1161
void(*)() TearDownTestSuiteFunc
Definition: gtest.h:6927
static void Print(const T &value, ::std::ostream *os)
Definition: gtest.h:8857
TestFactoryBase * CreateTestFactory(ParamType parameter) override
Definition: gtest.h:10987
struct stat StatStruct
Definition: gtest.h:2320
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
void LogToStderr()
Definition: gtest.h:1250
std::size_t size_t
Definition: types.h:37
void UniversalTersePrint(const T &value, ::std::ostream *os)
Definition: gtest.h:8910
TypeWithSize< sizeof(RawType)>::UInt Bits
Definition: gtest.h:6691
#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, generator,...)
Definition: gtest.h:13715
GTEST_API_ std::vector< std::string > GetArgvs()
GTEST_DECLARE_string_(death_test_style)
const Element * const_iterator
Definition: gtest.h:7584
GTEST_API_ TestInfo * MakeAndRegisterTestInfo(const char *test_suite_name, const char *name, const char *type_param, const char *value_param, CodeLocation code_location, TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc, TearDownTestSuiteFunc tear_down_tc, TestFactoryBase *factory)
int Read(int fd, void *buf, unsigned int count)
Definition: gtest.h:2360
#define GTEST_DISABLE_MSC_WARNINGS_POP_()
Definition: gtest.h:546
AssertionResult CmpHelperOpFailure(const char *expr1, const char *expr2, const T1 &val1, const T2 &val2, const char *op)
Definition: gtest.h:16206
static bool HasFailure()
Definition: gtest.h:15054
void DefaultPrintNonContainerTo(const T &value, ::std::ostream *os)
Definition: gtest.h:8289
#define GTEST_CHECK_(condition)
Definition: gtest.h:1270
const char * key() const
Definition: gtest.h:15143
bool AlwaysFalse()
Definition: gtest.h:7260
GTestMutexLock MutexLock
Definition: gtest.h:2162
std::string operator()(const TestParamInfo< ParamType > &info) const
Definition: gtest.h:10606
ParamIteratorInterface< ParamType > * End() const override
Definition: gtest.h:11778
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string)
static void TearDownTestSuite()
Definition: gtest.h:15035
virtual void SetUp()
Definition: gtest.h:15644
#define GTEST_DISALLOW_ASSIGN_(type)
Definition: gtest.h:922
static AssertionResult Compare(const char *lhs_expression, const char *rhs_expression, Secret *, T *rhs)
Definition: gtest.h:16185
virtual void OnTestSuiteStart(const TestSuite &test_suite)
Definition: gtest.h:15689
void Reseed(UInt32 seed)
Definition: gtest.h:7282
int StrCaseCmp(const char *s1, const char *s2)
Definition: gtest.h:2325
TestInfo * RegisterTest(const char *test_suite_name, const char *test_name, const char *type_param, const char *value_param, const char *file, int line, Factory factory)
Definition: gtest.h:17063
void OnEnvironmentsSetUpEnd(const UnitTest &) override
Definition: gtest.h:15740
SetUpTearDownSuiteFuncType GetNotDefaultOrNull(SetUpTearDownSuiteFuncType a, SetUpTearDownSuiteFuncType def)
Definition: gtest.h:6943
Message(const char *str)
Definition: gtest.h:2660
CartesianProductGenerator9(const ParamGenerator< T1 > &g1, const ParamGenerator< T2 > &g2, const ParamGenerator< T3 > &g3, const ParamGenerator< T4 > &g4, const ParamGenerator< T5 > &g5, const ParamGenerator< T6 > &g6, const ParamGenerator< T7 > &g7, const ParamGenerator< T8 > &g8, const ParamGenerator< T9 > &g9)
Definition: gtest.h:12547
long long BiggestInt
Definition: gtest.h:2223
std::string Type(const TestParamInfo< ParamType > &)
Definition: gtest.h:10930
ScopedTrace(const char *file, int line, const T &message)
Definition: gtest.h:16843
virtual ParamIteratorInterface * Clone() const =0
ParameterizedTestCaseInfo< TestCase > * GetTestCasePatternHolder(const char *test_case_name, CodeLocation code_location)
Definition: gtest.h:11253
bool IsDir(const StatStruct &st)
Definition: gtest.h:2330
static void Print(const T &value, ::std::ostream *os)
Definition: gtest.h:8850
bool IsAlpha(char ch)
Definition: gtest.h:2233
void PrintRawArrayTo(const T a[], size_t count, ::std::ostream *os)
Definition: gtest.h:8623
::std::tuple< T1, T2, T3, T4, T5, T6 > ParamType
Definition: gtest.h:11934
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
Definition: gtest.h:927
void OnEnvironmentsSetUpStart(const UnitTest &) override
Definition: gtest.h:15739
CartesianProductHolder10(const Generator1 &g1, const Generator2 &g2, const Generator3 &g3, const Generator4 &g4, const Generator5 &g5, const Generator6 &g6, const Generator7 &g7, const Generator8 &g8, const Generator9 &g9, const Generator10 &g10)
Definition: gtest.h:13297
integral_< index_t, v > index_
index_ type: integral constant wrapper for index_t a.k.a std::size_t
Definition: integral.h:106
internal::ParamGenerator< T > ValuesIn(const T(&array)[N])
Definition: gtest.h:13465
int AddTestSuiteInstantiation(const std::string &instantiation_name, GeneratorCreationFunc *func, ParamNameGeneratorFunc *name_func, const char *file, int line)
Definition: gtest.h:11067
::std::tuple< T1, T2, T3, T4 > ParamType
Definition: gtest.h:11615
void PrintTo(unsigned char c, ::std::ostream *os)
Definition: gtest-all.cc:11242
ParamIteratorInterface< ParamType > * End() const override
Definition: gtest.h:11627
static const Bits kExponentBitMask
Definition: gtest.h:6713
int FileNo(FILE *file)
Definition: gtest.h:2322
virtual void OnTestProgramStart(const UnitTest &unit_test)=0
GTEST_API_ std::string GetBoolAssertionFailureMessage(const AssertionResult &assertion_result, const char *expression_text, const char *actual_predicate_value, const char *expected_predicate_value)
ParameterizedTestFactory(ParamType parameter)
Definition: gtest.h:10946
TestProperty(const std::string &a_key, const std::string &a_value)
Definition: gtest.h:15138
GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char *file, int line)
Definition: gtest-all.cc:10638
Definition: gtest.h:6517
virtual void OnTestEnd(const TestInfo &test_info)=0
virtual void OnTestPartResult(const TestPartResult &test_part_result)=0
const char * value_param() const
Definition: gtest.h:15320
FILE * FOpen(const char *path, const char *mode)
Definition: gtest.h:2349
::std::tuple< T1, T2, T3, T4, T5 > ParamType
Definition: gtest.h:11766
const Bits & bits() const
Definition: gtest.h:6759
bool IsLower(char ch)
Definition: gtest.h:2242
int Close(int fd)
Definition: gtest.h:2366
internal::ParamGenerator< typename Container::value_type > ValuesIn(const Container &container)
Definition: gtest.h:13470
std::string DefaultParamName(const TestParamInfo< ParamType > &info)
Definition: gtest.h:10912
Strings UniversalTersePrintTupleFieldsToStrings(const Tuple &value)
Definition: gtest.h:8948
char IsNotContainer
Definition: gtest.h:7433
#define TEST_P(test_suite_name, test_name)
Definition: gtest.h:13674
bool operator!=(const ParamIterator &other) const
Definition: gtest.h:10689
void UniversalPrintArray(const char *begin, size_t len, ostream *os)
Definition: gtest-all.cc:11316
static AssertionResult Compare(const char *lhs_expression, const char *rhs_expression, const T1 &lhs, const T2 &rhs, typename EnableIf<!std::is_pointer< T2 >::value >::type *=nullptr)
Definition: gtest.h:16170
static void SetUpTestCase()
Definition: gtest.h:15040
AssertionResult CmpHelperEQFailure(const char *lhs_expression, const char *rhs_expression, const T1 &lhs, const T2 &rhs)
Definition: gtest.h:16092
virtual ~WithParamInterface()
Definition: gtest.h:16473
bool is_reportable() const
Definition: gtest.h:15353
static const size_t kBitCount
Definition: gtest.h:6696
GTEST_API_ std::string DiffStrings(const std::string &left, const std::string &right, size_t *total_line_count)
RE(const RE &other)
Definition: gtest.h:1140
static const size_t kFractionBitCount
Definition: gtest.h:6699
bool is_in_another_shard() const
Definition: gtest.h:15332
GTEST_API_ void ReportInvalidTestSuiteType(const char *test_suite_name, CodeLocation code_location)
GTEST_API_ std::string AppendUserMessage(const std::string &gtest_msg, const Message &user_msg)
CartesianProductHolder8(const Generator1 &g1, const Generator2 &g2, const Generator3 &g3, const Generator4 &g4, const Generator5 &g5, const Generator6 &g6, const Generator7 &g7, const Generator8 &g8)
Definition: gtest.h:13214
void OnTestEnd(const TestInfo &) override
Definition: gtest.h:15749
#define GTEST_MUST_USE_RESULT_
Definition: gtest.h:939
char ToUpper(char ch)
Definition: gtest.h:2262
ParamIteratorInterface< ParamType > * Begin() const override
Definition: gtest.h:12129
static const size_t kMaxUlps
Definition: gtest.h:6727
GTEST_API_ AssertionResult FloatLE(const char *expr1, const char *expr2, float val1, float val2)
static RawType Infinity()
Definition: gtest.h:6749
int line() const
Definition: gtest.h:15329
static AssertionResult Compare(const char *lhs_expression, const char *rhs_expression, const T1 &lhs, const T2 &rhs)
Definition: gtest.h:16139
::std::string Format(const ToPrint &value)
Definition: gtest.h:8342
CartesianProductHolder9(const Generator1 &g1, const Generator2 &g2, const Generator3 &g3, const Generator4 &g4, const Generator5 &g5, const Generator6 &g6, const Generator7 &g7, const Generator8 &g8, const Generator9 &g9)
Definition: gtest.h:13254
bool AlmostEquals(const FloatingPoint &rhs) const
Definition: gtest.h:6783
void FlushInfoLog()
Definition: gtest.h:1251
const char * StrNCpy(char *dest, const char *src, size_t n)
Definition: gtest.h:2338
#define GTEST_LOCK_EXCLUDED_(locks)
Definition: gtest.h:2515
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: gtest.h:17097
TypeWithSize< 8 >::UInt UInt64
Definition: gtest.h:2478
GTEST_API_ AssertionResult CmpHelperEQ(const char *lhs_expression, const char *rhs_expression, BiggestInt lhs, BiggestInt rhs)
void OnTestProgramEnd(const UnitTest &) override
Definition: gtest.h:15759
bool StaticAssertTypeEq()
Definition: gtest.h:16927
void PrintWideStringTo(const ::std::wstring &s, ostream *os)
Definition: gtest-all.cc:11448
CartesianProductHolder6(const Generator1 &g1, const Generator2 &g2, const Generator3 &g3, const Generator4 &g4, const Generator5 &g5, const Generator6 &g6)
Definition: gtest.h:13145
bool IsUpper(char ch)
Definition: gtest.h:2248
static void Print(const T(&a)[N], ::std::ostream *os)
Definition: gtest.h:8818
void TersePrintPrefixToStrings(const Tuple &, std::integral_constant< size_t, 0 >, Strings *)
Definition: gtest.h:8931
virtual TestFactoryBase * CreateTestFactory(ParamType parameter)=0
virtual void OnEnvironmentsTearDownStart(const UnitTest &unit_test)=0
Random(UInt32 seed)
Definition: gtest.h:7280
#define EXPECT_TRUE(condition)
Definition: gtest.h:16584
void CopyArray(const T *from, size_t size, U *to)
Definition: gtest.h:7557
AssertionResult AssertPred1Helper(const char *pred_text, const char *e1, Pred pred, const T1 &v1)
Definition: gtest.h:14715
ParamIterator & operator=(const ParamIterator &other)
Definition: gtest.h:10667
ParamIteratorInterface< ParamType > * Begin() const override
Definition: gtest.h:12334
class GTEST_API_ testing::ScopedTrace GTEST_ATTRIBUTE_UNUSED_
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char)
RE(const ::std::string &regex)
Definition: gtest.h:1143
static const size_t kExponentBitCount
Definition: gtest.h:6703
#define GTEST_DECLARE_int32_(name)
Definition: gtest.h:2497
static const ParamType & GetParam()
Definition: gtest.h:16477
Iter ArrayAwareFind(Iter begin, Iter end, const Element &elem)
Definition: gtest.h:7528
ParamIteratorInterface< ParamType > * End() const override
Definition: gtest.h:11947
CartesianProductGenerator4(const ParamGenerator< T1 > &g1, const ParamGenerator< T2 > &g2, const ParamGenerator< T3 > &g3, const ParamGenerator< T4 > &g4)
Definition: gtest.h:11617
::std::tuple< T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 > ParamType
Definition: gtest.h:12784
static const Bits kFractionBitMask
Definition: gtest.h:6709
AssertionResult AssertPred5Helper(const char *pred_text, const char *e1, const char *e2, const char *e3, const char *e4, const char *e5, Pred pred, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5)
Definition: gtest.h:14926
bool Failed() const
Definition: gtest.h:15491
GTEST_API_ std::string CreateUnifiedDiff(const std::vector< std::string > &left, const std::vector< std::string > &right, size_t context=2)
::std::tuple< T1, T2, T3, T4, T5, T6, T7, T8, T9 > ParamType
Definition: gtest.h:12545
TypeWithSize< 8 >::Int Int64
Definition: gtest.h:2477
void AssertHeld() const
Definition: gtest.h:2144
Iterator::value_type value_type
Definition: gtest.h:2201
ParamIteratorInterface< ParamType > * Begin() const override
Definition: gtest.h:11375
void(*)() SetUpTearDownSuiteFuncType
Definition: gtest.h:6941
static void Print(const T(&value)[N], ::std::ostream *os)
Definition: gtest.h:8864
Message(const Message &msg)
Definition: gtest.h:2655
static SetUpTearDownSuiteFuncType GetSetUpCaseOrSuite()
Definition: gtest.h:6958
CartesianProductHolder2(const Generator1 &g1, const Generator2 &g2)
Definition: gtest.h:13043
void swap(array< _Tp, _Nm > &lhs, array< _Tp, _Nm > &rhs) noexcept(noexcept(lhs.swap(rhs)))
Definition: array.h:214
const char * value() const
Definition: gtest.h:15148
virtual void OnTestSuiteEnd(const TestSuite &test_suite)
Definition: gtest.h:15708
FILE * FDOpen(int fd, const char *mode)
Definition: gtest.h:2356
ParamIteratorInterface< T > * End() const override
Definition: gtest.h:10838
const BiggestInt kMaxBiggestInt
Definition: gtest.h:2420
static UnitTest * GetInstance()
void AddTestPattern(const char *test_suite_name, const char *test_base_name, TestMetaFactoryBase< ParamType > *meta_factory)
Definition: gtest.h:11060
typename TestSuite::ParamType ParamType
Definition: gtest.h:11039
AssertionResult AssertPred3Helper(const char *pred_text, const char *e1, const char *e2, const char *e3, Pred pred, const T1 &v1, const T2 &v2, const T3 &v3)
Definition: gtest.h:14808
char * StrDup(const char *src)
Definition: gtest.h:2328
const char * StrError(int errnum)
Definition: gtest.h:2367
const char * name() const
Definition: gtest.h:15309
const char * file() const
Definition: gtest.h:15326
Derived * CheckedDowncastToActualType(Base *base)
Definition: gtest.h:1391
const char * test_suite_name() const
Definition: gtest.h:15301
TypeId GetTestSuiteTypeId() const override
Definition: gtest.h:11053
static AssertionResult Compare(const char *lhs_expression, const char *rhs_expression, BiggestInt lhs, BiggestInt rhs)
Definition: gtest.h:16152
virtual void OnTestCaseStart(const TestCase &test_case)
Definition: gtest.h:15693
decltype(*std::declval< typename C::const_iterator >()) value_type
Definition: gtest.h:7471
bool operator==(const NativeArray &rhs) const
Definition: gtest.h:7610
std::string OutputFlagAlsoCheckEnvVar()
Definition: gtest-all.cc:10980
GTEST_API_ TypeId GetTestTypeId()
AssertionResult AssertPred4Helper(const char *pred_text, const char *e1, const char *e2, const char *e3, const char *e4, Pred pred, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4)
Definition: gtest.h:14864
std::string StripTrailingSpaces(std::string str)
Definition: gtest.h:2266
static void SetUpTestSuite()
Definition: gtest.h:15027
static void Print(char *str, ::std::ostream *os)
Definition: gtest.h:8882
void UniversalPrint(const T &value, ::std::ostream *os)
Definition: gtest.h:8919
std::string GetString() const
CodeLocation(const std::string &a_file, int a_line)
Definition: gtest.h:6930
virtual bool Equals(const ParamIteratorInterface &other) const =0
TimeInMillis elapsed_time() const
Definition: gtest.h:15201
CartesianProductGenerator7(const ParamGenerator< T1 > &g1, const ParamGenerator< T2 > &g2, const ParamGenerator< T3 > &g3, const ParamGenerator< T4 > &g4, const ParamGenerator< T5 > &g5, const ParamGenerator< T6 > &g6, const ParamGenerator< T7 > &g7)
Definition: gtest.h:12122
#define GTEST_REMOVE_REFERENCE_AND_CONST_(T)
Definition: gtest.h:7337
const std::string & GetTestSuiteName() const override
Definition: gtest.h:11049
ScopedTrace(const char *file, int line, const char *message)
Definition: gtest.h:16848
void OnTestProgramStart(const UnitTest &) override
Definition: gtest.h:15736
typename TestSuite::ParamType ParamType
Definition: gtest.h:10983
TimeInMillis elapsed_time() const
Definition: gtest.h:15494
ParamIteratorInterface< ParamType > * End() const override
Definition: gtest.h:12134
internal::ValueArray< T... > Values(T... v)
Definition: gtest.h:13496
ParamIteratorInterface< ParamType > * Begin() const override
Definition: gtest.h:11943
constexpr _Tp & get(array< _Tp, _Nm > &arr) noexcept
Definition: array.h:220
bool IsAlNum(char ch)
Definition: gtest.h:2236