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 <cstddef>
56#include <limits>
57#include <memory>
58#include <ostream>
59#include <type_traits>
60#include <vector>
61
62// Copyright 2005, Google Inc.
63// All rights reserved.
64//
65// Redistribution and use in source and binary forms, with or without
66// modification, are permitted provided that the following conditions are
67// met:
68//
69// * Redistributions of source code must retain the above copyright
70// notice, this list of conditions and the following disclaimer.
71// * Redistributions in binary form must reproduce the above
72// copyright notice, this list of conditions and the following disclaimer
73// in the documentation and/or other materials provided with the
74// distribution.
75// * Neither the name of Google Inc. nor the names of its
76// contributors may be used to endorse or promote products derived from
77// this software without specific prior written permission.
78//
79// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
80// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
81// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
82// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
83// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
84// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
85// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
86// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
87// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
88// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
89// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
90//
91// The Google C++ Testing and Mocking Framework (Google Test)
92//
93// This header file declares functions and macros used internally by
94// Google Test. They are subject to change without notice.
95
96// GOOGLETEST_CM0001 DO NOT DELETE
97
98#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
99#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
100
101// Copyright 2005, Google Inc.
102// All rights reserved.
103//
104// Redistribution and use in source and binary forms, with or without
105// modification, are permitted provided that the following conditions are
106// met:
107//
108// * Redistributions of source code must retain the above copyright
109// notice, this list of conditions and the following disclaimer.
110// * Redistributions in binary form must reproduce the above
111// copyright notice, this list of conditions and the following disclaimer
112// in the documentation and/or other materials provided with the
113// distribution.
114// * Neither the name of Google Inc. nor the names of its
115// contributors may be used to endorse or promote products derived from
116// this software without specific prior written permission.
117//
118// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
119// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
120// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
121// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
122// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
123// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
124// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
125// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
126// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
127// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
128// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
129//
130// Low-level types and utilities for porting Google Test to various
131// platforms. All macros ending with _ and symbols defined in an
132// internal namespace are subject to change without notice. Code
133// outside Google Test MUST NOT USE THEM DIRECTLY. Macros that don't
134// end with _ are part of Google Test's public API and can be used by
135// code outside Google Test.
136//
137// This file is fundamental to Google Test. All other Google Test source
138// files are expected to #include this. Therefore, it cannot #include
139// any other Google Test header.
140
141// GOOGLETEST_CM0001 DO NOT DELETE
142
143#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
144#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
145
146// Environment-describing macros
147// -----------------------------
148//
149// Google Test can be used in many different environments. Macros in
150// this section tell Google Test what kind of environment it is being
151// used in, such that Google Test can provide environment-specific
152// features and implementations.
153//
154// Google Test tries to automatically detect the properties of its
155// environment, so users usually don't need to worry about these
156// macros. However, the automatic detection is not perfect.
157// Sometimes it's necessary for a user to define some of the following
158// macros in the build script to override Google Test's decisions.
159//
160// If the user doesn't define a macro in the list, Google Test will
161// provide a default definition. After this header is #included, all
162// macros in this list will be defined to either 1 or 0.
163//
164// Notes to maintainers:
165// - Each macro here is a user-tweakable knob; do not grow the list
166// lightly.
167// - Use #if to key off these macros. Don't use #ifdef or "#if
168// defined(...)", which will not work as these macros are ALWAYS
169// defined.
170//
171// GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2)
172// is/isn't available.
173// GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions
174// are enabled.
175// GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular
176// expressions are/aren't available.
177// GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h>
178// is/isn't available.
179// GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't
180// enabled.
181// GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
182// std::wstring does/doesn't work (Google Test can
183// be used where std::wstring is unavailable).
184// GTEST_HAS_SEH - Define it to 1/0 to indicate whether the
185// compiler supports Microsoft's "Structured
186// Exception Handling".
187// GTEST_HAS_STREAM_REDIRECTION
188// - Define it to 1/0 to indicate whether the
189// platform supports I/O stream redirection using
190// dup() and dup2().
191// GTEST_LINKED_AS_SHARED_LIBRARY
192// - Define to 1 when compiling tests that use
193// Google Test as a shared library (known as
194// DLL on Windows).
195// GTEST_CREATE_SHARED_LIBRARY
196// - Define to 1 when compiling Google Test itself
197// as a shared library.
198// GTEST_DEFAULT_DEATH_TEST_STYLE
199// - The default value of --gtest_death_test_style.
200// The legacy default has been "fast" in the open
201// source version since 2008. The recommended value
202// is "threadsafe", and can be set in
203// custom/gtest-port.h.
204
205// Platform-indicating macros
206// --------------------------
207//
208// Macros indicating the platform on which Google Test is being used
209// (a macro is defined to 1 if compiled on the given platform;
210// otherwise UNDEFINED -- it's never defined to 0.). Google Test
211// defines these macros automatically. Code outside Google Test MUST
212// NOT define them.
213//
214// GTEST_OS_AIX - IBM AIX
215// GTEST_OS_CYGWIN - Cygwin
216// GTEST_OS_DRAGONFLY - DragonFlyBSD
217// GTEST_OS_FREEBSD - FreeBSD
218// GTEST_OS_FUCHSIA - Fuchsia
219// GTEST_OS_GNU_KFREEBSD - GNU/kFreeBSD
220// GTEST_OS_HAIKU - Haiku
221// GTEST_OS_HPUX - HP-UX
222// GTEST_OS_LINUX - Linux
223// GTEST_OS_LINUX_ANDROID - Google Android
224// GTEST_OS_MAC - Mac OS X
225// GTEST_OS_IOS - iOS
226// GTEST_OS_NACL - Google Native Client (NaCl)
227// GTEST_OS_NETBSD - NetBSD
228// GTEST_OS_OPENBSD - OpenBSD
229// GTEST_OS_OS2 - OS/2
230// GTEST_OS_QNX - QNX
231// GTEST_OS_SOLARIS - Sun Solaris
232// GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile)
233// GTEST_OS_WINDOWS_DESKTOP - Windows Desktop
234// GTEST_OS_WINDOWS_MINGW - MinGW
235// GTEST_OS_WINDOWS_MOBILE - Windows Mobile
236// GTEST_OS_WINDOWS_PHONE - Windows Phone
237// GTEST_OS_WINDOWS_RT - Windows Store App/WinRT
238// GTEST_OS_ZOS - z/OS
239//
240// Among the platforms, Cygwin, Linux, Mac OS X, and Windows have the
241// most stable support. Since core members of the Google Test project
242// don't have access to other platforms, support for them may be less
243// stable. If you notice any problems on your platform, please notify
244// googletestframework@googlegroups.com (patches for fixing them are
245// even more welcome!).
246//
247// It is possible that none of the GTEST_OS_* macros are defined.
248
249// Feature-indicating macros
250// -------------------------
251//
252// Macros indicating which Google Test features are available (a macro
253// is defined to 1 if the corresponding feature is supported;
254// otherwise UNDEFINED -- it's never defined to 0.). Google Test
255// defines these macros automatically. Code outside Google Test MUST
256// NOT define them.
257//
258// These macros are public so that portable tests can be written.
259// Such tests typically surround code using a feature with an #if
260// which controls that code. For example:
261//
262// #if GTEST_HAS_DEATH_TEST
263// EXPECT_DEATH(DoSomethingDeadly());
264// #endif
265//
266// GTEST_HAS_DEATH_TEST - death tests
267// GTEST_HAS_TYPED_TEST - typed tests
268// GTEST_HAS_TYPED_TEST_P - type-parameterized tests
269// GTEST_IS_THREADSAFE - Google Test is thread-safe.
270// GOOGLETEST_CM0007 DO NOT DELETE
271// GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with
272// GTEST_HAS_POSIX_RE (see above) which users can
273// define themselves.
274// GTEST_USES_SIMPLE_RE - our own simple regex is used;
275// the above RE\b(s) are mutually exclusive.
276
277// Misc public macros
278// ------------------
279//
280// GTEST_FLAG(flag_name) - references the variable corresponding to
281// the given Google Test flag.
282
283// Internal utilities
284// ------------------
285//
286// The following macros and utilities are for Google Test's INTERNAL
287// use only. Code outside Google Test MUST NOT USE THEM DIRECTLY.
288//
289// Macros for basic C++ coding:
290// GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
291// GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a
292// variable don't have to be used.
293// GTEST_DISALLOW_ASSIGN_ - disables operator=.
294// GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
295// GTEST_MUST_USE_RESULT_ - declares that a function's result must be used.
296// GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is
297// suppressed (constant conditional).
298// GTEST_INTENTIONAL_CONST_COND_POP_ - finish code section where MSVC C4127
299// is suppressed.
300//
301// Synchronization:
302// Mutex, MutexLock, ThreadLocal, GetThreadCount()
303// - synchronization primitives.
304//
305// Regular expressions:
306// RE - a simple regular expression class using the POSIX
307// Extended Regular Expression syntax on UNIX-like platforms
308// GOOGLETEST_CM0008 DO NOT DELETE
309// or a reduced regular exception syntax on other
310// platforms, including Windows.
311// Logging:
312// GTEST_LOG_() - logs messages at the specified severity level.
313// LogToStderr() - directs all log messages to stderr.
314// FlushInfoLog() - flushes informational log messages.
315//
316// Stdout and stderr capturing:
317// CaptureStdout() - starts capturing stdout.
318// GetCapturedStdout() - stops capturing stdout and returns the captured
319// string.
320// CaptureStderr() - starts capturing stderr.
321// GetCapturedStderr() - stops capturing stderr and returns the captured
322// string.
323//
324// Integer types:
325// TypeWithSize - maps an integer to a int type.
326// Int32, UInt32, Int64, UInt64, TimeInMillis
327// - integers of known sizes.
328// BiggestInt - the biggest signed integer type.
329//
330// Command-line utilities:
331// GTEST_DECLARE_*() - declares a flag.
332// GTEST_DEFINE_*() - defines a flag.
333// GetInjectableArgvs() - returns the command line as a vector of strings.
334//
335// Environment variable utilities:
336// GetEnv() - gets the value of an environment variable.
337// BoolFromGTestEnv() - parses a bool environment variable.
338// Int32FromGTestEnv() - parses an Int32 environment variable.
339// StringFromGTestEnv() - parses a string environment variable.
340//
341// Deprecation warnings:
342// GTEST_INTERNAL_DEPRECATED(message) - attribute marking a function as
343// deprecated; calling a marked function
344// should generate a compiler warning
345
346#include <ctype.h> // for isspace, etc
347#include <stddef.h> // for ptrdiff_t
348#include <stdio.h>
349#include <stdlib.h>
350#include <string.h>
351#include <memory>
352#include <type_traits>
353
354#ifndef _WIN32_WCE
355# include <sys/types.h>
356# include <sys/stat.h>
357#endif // !_WIN32_WCE
358
359#if defined __APPLE__
360# include <AvailabilityMacros.h>
361# include <TargetConditionals.h>
362#endif
363
364#include <algorithm> // NOLINT
365#include <iostream> // NOLINT
366#include <sstream> // NOLINT
367#include <string> // NOLINT
368#include <tuple>
369#include <utility>
370#include <vector> // NOLINT
371
372// Copyright 2015, Google Inc.
373// All rights reserved.
374//
375// Redistribution and use in source and binary forms, with or without
376// modification, are permitted provided that the following conditions are
377// met:
378//
379// * Redistributions of source code must retain the above copyright
380// notice, this list of conditions and the following disclaimer.
381// * Redistributions in binary form must reproduce the above
382// copyright notice, this list of conditions and the following disclaimer
383// in the documentation and/or other materials provided with the
384// distribution.
385// * Neither the name of Google Inc. nor the names of its
386// contributors may be used to endorse or promote products derived from
387// this software without specific prior written permission.
388//
389// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
390// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
391// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
392// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
393// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
394// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
395// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
396// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
397// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
398// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
399// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
400//
401// The Google C++ Testing and Mocking Framework (Google Test)
402//
403// This header file defines the GTEST_OS_* macro.
404// It is separate from gtest-port.h so that custom/gtest-port.h can include it.
405
406#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
407#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
408
409// Determines the platform on which Google Test is compiled.
410#ifdef __CYGWIN__
411# define GTEST_OS_CYGWIN 1
412# elif defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)
413# define GTEST_OS_WINDOWS_MINGW 1
414# define GTEST_OS_WINDOWS 1
415#elif defined _WIN32
416# define GTEST_OS_WINDOWS 1
417# ifdef _WIN32_WCE
418# define GTEST_OS_WINDOWS_MOBILE 1
419# elif defined(WINAPI_FAMILY)
420# include <winapifamily.h>
421# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
422# define GTEST_OS_WINDOWS_DESKTOP 1
423# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
424# define GTEST_OS_WINDOWS_PHONE 1
425# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
426# define GTEST_OS_WINDOWS_RT 1
427# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)
428# define GTEST_OS_WINDOWS_PHONE 1
429# define GTEST_OS_WINDOWS_TV_TITLE 1
430# else
431 // WINAPI_FAMILY defined but no known partition matched.
432 // Default to desktop.
433# define GTEST_OS_WINDOWS_DESKTOP 1
434# endif
435# else
436# define GTEST_OS_WINDOWS_DESKTOP 1
437# endif // _WIN32_WCE
438#elif defined __OS2__
439# define GTEST_OS_OS2 1
440#elif defined __APPLE__
441# define GTEST_OS_MAC 1
442# if TARGET_OS_IPHONE
443# define GTEST_OS_IOS 1
444# endif
445#elif defined __DragonFly__
446# define GTEST_OS_DRAGONFLY 1
447#elif defined __FreeBSD__
448# define GTEST_OS_FREEBSD 1
449#elif defined __Fuchsia__
450# define GTEST_OS_FUCHSIA 1
451#elif defined(__GLIBC__) && defined(__FreeBSD_kernel__)
452# define GTEST_OS_GNU_KFREEBSD 1
453#elif defined __linux__
454# define GTEST_OS_LINUX 1
455# if defined __ANDROID__
456# define GTEST_OS_LINUX_ANDROID 1
457# endif
458#elif defined __MVS__
459# define GTEST_OS_ZOS 1
460#elif defined(__sun) && defined(__SVR4)
461# define GTEST_OS_SOLARIS 1
462#elif defined(_AIX)
463# define GTEST_OS_AIX 1
464#elif defined(__hpux)
465# define GTEST_OS_HPUX 1
466#elif defined __native_client__
467# define GTEST_OS_NACL 1
468#elif defined __NetBSD__
469# define GTEST_OS_NETBSD 1
470#elif defined __OpenBSD__
471# define GTEST_OS_OPENBSD 1
472#elif defined __QNX__
473# define GTEST_OS_QNX 1
474#elif defined(__HAIKU__)
475#define GTEST_OS_HAIKU 1
476#endif // __CYGWIN__
477
478#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
479// Copyright 2015, Google Inc.
480// All rights reserved.
481//
482// Redistribution and use in source and binary forms, with or without
483// modification, are permitted provided that the following conditions are
484// met:
485//
486// * Redistributions of source code must retain the above copyright
487// notice, this list of conditions and the following disclaimer.
488// * Redistributions in binary form must reproduce the above
489// copyright notice, this list of conditions and the following disclaimer
490// in the documentation and/or other materials provided with the
491// distribution.
492// * Neither the name of Google Inc. nor the names of its
493// contributors may be used to endorse or promote products derived from
494// this software without specific prior written permission.
495//
496// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
497// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
498// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
499// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
500// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
501// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
502// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
503// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
504// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
505// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
506// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
507//
508// Injection point for custom user configurations. See README for details
509//
510// ** Custom implementation starts here **
511
512#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
513#define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
514
515#endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
516
517#if !defined(GTEST_DEV_EMAIL_)
518# define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
519# define GTEST_FLAG_PREFIX_ "gtest_"
520# define GTEST_FLAG_PREFIX_DASH_ "gtest-"
521# define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
522# define GTEST_NAME_ "Google Test"
523# define GTEST_PROJECT_URL_ "https://github.com/google/googletest/"
524#endif // !defined(GTEST_DEV_EMAIL_)
525
526#if !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
527# define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest"
528#endif // !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
529
530// Determines the version of gcc that is used to compile this.
531#ifdef __GNUC__
532// 40302 means version 4.3.2.
533# define GTEST_GCC_VER_ \
534 (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
535#endif // __GNUC__
536
537// Macros for disabling Microsoft Visual C++ warnings.
538//
539// GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385)
540// /* code that triggers warnings C4800 and C4385 */
541// GTEST_DISABLE_MSC_WARNINGS_POP_()
542#if defined(_MSC_VER)
543# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \
544 __pragma(warning(push)) \
545 __pragma(warning(disable: warnings))
546# define GTEST_DISABLE_MSC_WARNINGS_POP_() \
547 __pragma(warning(pop))
548#else
549// Not all compilers are MSVC
550# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
551# define GTEST_DISABLE_MSC_WARNINGS_POP_()
552#endif
553
554// Clang on Windows does not understand MSVC's pragma warning.
555// We need clang-specific way to disable function deprecation warning.
556#ifdef __clang__
557# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
558 _Pragma("clang diagnostic push") \
559 _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
560 _Pragma("clang diagnostic ignored \"-Wdeprecated-implementations\"")
561#define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
562 _Pragma("clang diagnostic pop")
563#else
564# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
565 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
566# define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
567 GTEST_DISABLE_MSC_WARNINGS_POP_()
568#endif
569
570// Brings in definitions for functions used in the testing::internal::posix
571// namespace (read, write, close, chdir, isatty, stat). We do not currently
572// use them on Windows Mobile.
573#if GTEST_OS_WINDOWS
574# if !GTEST_OS_WINDOWS_MOBILE
575# include <direct.h>
576# include <io.h>
577# endif
578// In order to avoid having to include <windows.h>, use forward declaration
579#if GTEST_OS_WINDOWS_MINGW && !defined(__MINGW64_VERSION_MAJOR)
580// MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two
581// separate (equivalent) structs, instead of using typedef
582typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION;
583#else
584// Assume CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
585// This assumption is verified by
586// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
587typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
588#endif
589#else
590// This assumes that non-Windows OSes provide unistd.h. For OSes where this
591// is not the case, we need to include headers that provide the functions
592// mentioned above.
593# include <unistd.h>
594# include <strings.h>
595#endif // GTEST_OS_WINDOWS
596
597#if GTEST_OS_LINUX_ANDROID
598// Used to define __ANDROID_API__ matching the target NDK API level.
599# include <android/api-level.h> // NOLINT
600#endif
601
602// Defines this to true if and only if Google Test can use POSIX regular
603// expressions.
604#ifndef GTEST_HAS_POSIX_RE
605# if GTEST_OS_LINUX_ANDROID
606// On Android, <regex.h> is only available starting with Gingerbread.
607# define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
608# else
609# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
610# endif
611#endif
612
613#if GTEST_USES_PCRE
614// The appropriate headers have already been included.
615
616#elif GTEST_HAS_POSIX_RE
617
618// On some platforms, <regex.h> needs someone to define size_t, and
619// won't compile otherwise. We can #include it here as we already
620// included <stdlib.h>, which is guaranteed to define size_t through
621// <stddef.h>.
622# include <regex.h> // NOLINT
623
624# define GTEST_USES_POSIX_RE 1
625
626#elif GTEST_OS_WINDOWS
627
628// <regex.h> is not available on Windows. Use our own simple regex
629// implementation instead.
630# define GTEST_USES_SIMPLE_RE 1
631
632#else
633
634// <regex.h> may not be available on this platform. Use our own
635// simple regex implementation instead.
636# define GTEST_USES_SIMPLE_RE 1
637
638#endif // GTEST_USES_PCRE
639
640#ifndef GTEST_HAS_EXCEPTIONS
641// The user didn't tell us whether exceptions are enabled, so we need
642// to figure it out.
643# if defined(_MSC_VER) && defined(_CPPUNWIND)
644// MSVC defines _CPPUNWIND to 1 if and only if exceptions are enabled.
645# define GTEST_HAS_EXCEPTIONS 1
646# elif defined(__BORLANDC__)
647// C++Builder's implementation of the STL uses the _HAS_EXCEPTIONS
648// macro to enable exceptions, so we'll do the same.
649// Assumes that exceptions are enabled by default.
650# ifndef _HAS_EXCEPTIONS
651# define _HAS_EXCEPTIONS 1
652# endif // _HAS_EXCEPTIONS
653# define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
654# elif defined(__clang__)
655// clang defines __EXCEPTIONS if and only if exceptions are enabled before clang
656// 220714, but if and only if cleanups are enabled after that. In Obj-C++ files,
657// there can be cleanups for ObjC exceptions which also need cleanups, even if
658// C++ exceptions are disabled. clang has __has_feature(cxx_exceptions) which
659// checks for C++ exceptions starting at clang r206352, but which checked for
660// cleanups prior to that. To reliably check for C++ exception availability with
661// clang, check for
662// __EXCEPTIONS && __has_feature(cxx_exceptions).
663# define GTEST_HAS_EXCEPTIONS (__EXCEPTIONS && __has_feature(cxx_exceptions))
664# elif defined(__GNUC__) && __EXCEPTIONS
665// gcc defines __EXCEPTIONS to 1 if and only if exceptions are enabled.
666# define GTEST_HAS_EXCEPTIONS 1
667# elif defined(__SUNPRO_CC)
668// Sun Pro CC supports exceptions. However, there is no compile-time way of
669// detecting whether they are enabled or not. Therefore, we assume that
670// they are enabled unless the user tells us otherwise.
671# define GTEST_HAS_EXCEPTIONS 1
672# elif defined(__IBMCPP__) && __EXCEPTIONS
673// xlC defines __EXCEPTIONS to 1 if and only if exceptions are enabled.
674# define GTEST_HAS_EXCEPTIONS 1
675# elif defined(__HP_aCC)
676// Exception handling is in effect by default in HP aCC compiler. It has to
677// be turned of by +noeh compiler option if desired.
678# define GTEST_HAS_EXCEPTIONS 1
679# else
680// For other compilers, we assume exceptions are disabled to be
681// conservative.
682# define GTEST_HAS_EXCEPTIONS 0
683# endif // defined(_MSC_VER) || defined(__BORLANDC__)
684#endif // GTEST_HAS_EXCEPTIONS
685
686#if !defined(GTEST_HAS_STD_STRING)
687// Even though we don't use this macro any longer, we keep it in case
688// some clients still depend on it.
689# define GTEST_HAS_STD_STRING 1
690#elif !GTEST_HAS_STD_STRING
691// The user told us that ::std::string isn't available.
692# error "::std::string isn't available."
693#endif // !defined(GTEST_HAS_STD_STRING)
694
695#ifndef GTEST_HAS_STD_WSTRING
696// The user didn't tell us whether ::std::wstring is available, so we need
697// to figure it out.
698// Cygwin 1.7 and below doesn't support ::std::wstring.
699// Solaris' libc++ doesn't support it either. Android has
700// no support for it at least as recent as Froyo (2.2).
701#define GTEST_HAS_STD_WSTRING \
702 (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
703 GTEST_OS_HAIKU))
704
705#endif // GTEST_HAS_STD_WSTRING
706
707// Determines whether RTTI is available.
708#ifndef GTEST_HAS_RTTI
709// The user didn't tell us whether RTTI is enabled, so we need to
710// figure it out.
711
712# ifdef _MSC_VER
713
714#ifdef _CPPRTTI // MSVC defines this macro if and only if RTTI is enabled.
715# define GTEST_HAS_RTTI 1
716# else
717# define GTEST_HAS_RTTI 0
718# endif
719
720// Starting with version 4.3.2, gcc defines __GXX_RTTI if and only if RTTI is
721// enabled.
722# elif defined(__GNUC__)
723
724# ifdef __GXX_RTTI
725// When building against STLport with the Android NDK and with
726// -frtti -fno-exceptions, the build fails at link time with undefined
727// references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
728// so disable RTTI when detected.
729# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
730 !defined(__EXCEPTIONS)
731# define GTEST_HAS_RTTI 0
732# else
733# define GTEST_HAS_RTTI 1
734# endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
735# else
736# define GTEST_HAS_RTTI 0
737# endif // __GXX_RTTI
738
739// Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
740// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
741// first version with C++ support.
742# elif defined(__clang__)
743
744# define GTEST_HAS_RTTI __has_feature(cxx_rtti)
745
746// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
747// both the typeid and dynamic_cast features are present.
748# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
749
750# ifdef __RTTI_ALL__
751# define GTEST_HAS_RTTI 1
752# else
753# define GTEST_HAS_RTTI 0
754# endif
755
756# else
757
758// For all other compilers, we assume RTTI is enabled.
759# define GTEST_HAS_RTTI 1
760
761# endif // _MSC_VER
762
763#endif // GTEST_HAS_RTTI
764
765// It's this header's responsibility to #include <typeinfo> when RTTI
766// is enabled.
767#if GTEST_HAS_RTTI
768# include <typeinfo>
769#endif
770
771// Determines whether Google Test can use the pthreads library.
772#ifndef GTEST_HAS_PTHREAD
773// The user didn't tell us explicitly, so we make reasonable assumptions about
774// which platforms have pthreads support.
775//
776// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
777// to your compiler flags.
778#define GTEST_HAS_PTHREAD \
779 (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX || GTEST_OS_QNX || \
780 GTEST_OS_FREEBSD || GTEST_OS_NACL || GTEST_OS_NETBSD || GTEST_OS_FUCHSIA || \
781 GTEST_OS_DRAGONFLY || GTEST_OS_GNU_KFREEBSD || GTEST_OS_OPENBSD || \
782 GTEST_OS_HAIKU)
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) || GTEST_OS_WINDOWS_MINGW || \
839 GTEST_OS_AIX || GTEST_OS_HPUX || GTEST_OS_OPENBSD || GTEST_OS_QNX || \
840 GTEST_OS_FREEBSD || GTEST_OS_NETBSD || GTEST_OS_FUCHSIA || \
841 GTEST_OS_DRAGONFLY || GTEST_OS_GNU_KFREEBSD || GTEST_OS_HAIKU)
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 || GTEST_OS_GNU_KFREEBSD || GTEST_OS_DRAGONFLY || \
861 GTEST_OS_FREEBSD || GTEST_OS_NETBSD || GTEST_OS_OPENBSD
862# define GTEST_CAN_STREAM_RESULTS_ 1
863#endif
864
865// Defines some utility macros.
866
867// The GNU compiler emits a warning if nested "if" statements are followed by
868// an "else" statement and braces are not used to explicitly disambiguate the
869// "else" binding. This leads to problems with code like:
870//
871// if (gate)
872// ASSERT_*(condition) << "Some message";
873//
874// The "switch (0) case 0:" idiom is used to suppress this.
875#ifdef __INTEL_COMPILER
876# define GTEST_AMBIGUOUS_ELSE_BLOCKER_
877#else
878# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT
879#endif
880
881// Use this annotation at the end of a struct/class definition to
882// prevent the compiler from optimizing away instances that are never
883// used. This is useful when all interesting logic happens inside the
884// c'tor and / or d'tor. Example:
885//
886// struct Foo {
887// Foo() { ... }
888// } GTEST_ATTRIBUTE_UNUSED_;
889//
890// Also use it after a variable or parameter declaration to tell the
891// compiler the variable/parameter does not have to be used.
892#if defined(__GNUC__) && !defined(COMPILER_ICC)
893# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
894#elif defined(__clang__)
895# if __has_attribute(unused)
896# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
897# endif
898#endif
899#ifndef GTEST_ATTRIBUTE_UNUSED_
900# define GTEST_ATTRIBUTE_UNUSED_
901#endif
902
903// Use this annotation before a function that takes a printf format string.
904#if (defined(__GNUC__) || defined(__clang__)) && !defined(COMPILER_ICC)
905# if defined(__MINGW_PRINTF_FORMAT)
906// MinGW has two different printf implementations. Ensure the format macro
907// matches the selected implementation. See
908// https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/.
909# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
910 __attribute__((__format__(__MINGW_PRINTF_FORMAT, string_index, \
911 first_to_check)))
912# else
913# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
914 __attribute__((__format__(__printf__, string_index, first_to_check)))
915# endif
916#else
917# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
918#endif
919
920
921// A macro to disallow operator=
922// This should be used in the private: declarations for a class.
923#define GTEST_DISALLOW_ASSIGN_(type) \
924 void operator=(type const &) = delete
925
926// A macro to disallow copy constructor and operator=
927// This should be used in the private: declarations for a class.
928#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \
929 type(type const &) = delete; \
930 GTEST_DISALLOW_ASSIGN_(type)
931
932// Tell the compiler to warn about unused return values for functions declared
933// with this macro. The macro should be used on function declarations
934// following the argument list:
935//
936// Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
937#if defined(__GNUC__) && !defined(COMPILER_ICC)
938# define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
939#else
940# define GTEST_MUST_USE_RESULT_
941#endif // __GNUC__ && !COMPILER_ICC
942
943// MS C++ compiler emits warning when a conditional expression is compile time
944// constant. In some contexts this warning is false positive and needs to be
945// suppressed. Use the following two macros in such cases:
946//
947// GTEST_INTENTIONAL_CONST_COND_PUSH_()
948// while (true) {
949// GTEST_INTENTIONAL_CONST_COND_POP_()
950// }
951# define GTEST_INTENTIONAL_CONST_COND_PUSH_() \
952 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127)
953# define GTEST_INTENTIONAL_CONST_COND_POP_() \
954 GTEST_DISABLE_MSC_WARNINGS_POP_()
955
956// Determine whether the compiler supports Microsoft's Structured Exception
957// Handling. This is supported by several Windows compilers but generally
958// does not exist on any other system.
959#ifndef GTEST_HAS_SEH
960// The user didn't tell us, so we need to figure it out.
961
962# if defined(_MSC_VER) || defined(__BORLANDC__)
963// These two compilers are known to support SEH.
964# define GTEST_HAS_SEH 1
965# else
966// Assume no SEH.
967# define GTEST_HAS_SEH 0
968# endif
969
970#endif // GTEST_HAS_SEH
971
972#ifndef GTEST_IS_THREADSAFE
973
974#define GTEST_IS_THREADSAFE \
975 (GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ || \
976 (GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT) || \
977 GTEST_HAS_PTHREAD)
978
979#endif // GTEST_IS_THREADSAFE
980
981// GTEST_API_ qualifies all symbols that must be exported. The definitions below
982// are guarded by #ifndef to give embedders a chance to define GTEST_API_ in
983// gtest/internal/custom/gtest-port.h
984#ifndef GTEST_API_
985
986#ifdef _MSC_VER
987# if GTEST_LINKED_AS_SHARED_LIBRARY
988# define GTEST_API_ __declspec(dllimport)
989# elif GTEST_CREATE_SHARED_LIBRARY
990# define GTEST_API_ __declspec(dllexport)
991# endif
992#elif __GNUC__ >= 4 || defined(__clang__)
993# define GTEST_API_ __attribute__((visibility ("default")))
994#endif // _MSC_VER
995
996#endif // GTEST_API_
997
998#ifndef GTEST_API_
999# define GTEST_API_
1000#endif // GTEST_API_
1001
1002#ifndef GTEST_DEFAULT_DEATH_TEST_STYLE
1003# define GTEST_DEFAULT_DEATH_TEST_STYLE "fast"
1004#endif // GTEST_DEFAULT_DEATH_TEST_STYLE
1005
1006#ifdef __GNUC__
1007// Ask the compiler to never inline a given function.
1008# define GTEST_NO_INLINE_ __attribute__((noinline))
1009#else
1010# define GTEST_NO_INLINE_
1011#endif
1012
1013// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
1014#if !defined(GTEST_HAS_CXXABI_H_)
1015# if defined(__GLIBCXX__) || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER))
1016# define GTEST_HAS_CXXABI_H_ 1
1017# else
1018# define GTEST_HAS_CXXABI_H_ 0
1019# endif
1020#endif
1021
1022// A function level attribute to disable checking for use of uninitialized
1023// memory when built with MemorySanitizer.
1024#if defined(__clang__)
1025# if __has_feature(memory_sanitizer)
1026# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ \
1027 __attribute__((no_sanitize_memory))
1028# else
1029# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
1030# endif // __has_feature(memory_sanitizer)
1031#else
1032# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
1033#endif // __clang__
1034
1035// A function level attribute to disable AddressSanitizer instrumentation.
1036#if defined(__clang__)
1037# if __has_feature(address_sanitizer)
1038# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \
1039 __attribute__((no_sanitize_address))
1040# else
1041# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
1042# endif // __has_feature(address_sanitizer)
1043#else
1044# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
1045#endif // __clang__
1046
1047// A function level attribute to disable HWAddressSanitizer instrumentation.
1048#if defined(__clang__)
1049# if __has_feature(hwaddress_sanitizer)
1050# define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ \
1051 __attribute__((no_sanitize("hwaddress")))
1052# else
1053# define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
1054# endif // __has_feature(hwaddress_sanitizer)
1055#else
1056# define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
1057#endif // __clang__
1058
1059// A function level attribute to disable ThreadSanitizer instrumentation.
1060#if defined(__clang__)
1061# if __has_feature(thread_sanitizer)
1062# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ \
1063 __attribute__((no_sanitize_thread))
1064# else
1065# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
1066# endif // __has_feature(thread_sanitizer)
1067#else
1068# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
1069#endif // __clang__
1070
1071namespace testing {
1072
1073class Message;
1074
1075// Legacy imports for backwards compatibility.
1076// New code should use std:: names directly.
1077using std::get;
1078using std::make_tuple;
1079using std::tuple;
1080using std::tuple_element;
1081using std::tuple_size;
1082
1083namespace internal {
1084
1085// A secret type that Google Test users don't know about. It has no
1086// definition on purpose. Therefore it's impossible to create a
1087// Secret object, which is what we want.
1088class Secret;
1089
1090// The GTEST_COMPILE_ASSERT_ is a legacy macro used to verify that a compile
1091// time expression is true (in new code, use static_assert instead). For
1092// example, you could use it to verify the size of a static array:
1093//
1094// GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES,
1095// names_incorrect_size);
1096//
1097// The second argument to the macro must be a valid C++ identifier. If the
1098// expression is false, compiler will issue an error containing this identifier.
1099#define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg)
1100
1101// Evaluates to the number of elements in 'array'.
1102#define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0]))
1103
1104// A helper for suppressing warnings on constant condition. It just
1105// returns 'condition'.
1106GTEST_API_ bool IsTrue(bool condition);
1107
1108// Defines RE.
1109
1110#if GTEST_USES_PCRE
1111// if used, PCRE is injected by custom/gtest-port.h
1112#elif GTEST_USES_POSIX_RE || GTEST_USES_SIMPLE_RE
1113
1114// A simple C++ wrapper for <regex.h>. It uses the POSIX Extended
1115// Regular Expression syntax.
1117 public:
1118 // A copy constructor is required by the Standard to initialize object
1119 // references from r-values.
1120 RE(const RE& other) { Init(other.pattern()); }
1121
1122 // Constructs an RE from a string.
1123 RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT
1124
1125 RE(const char* regex) { Init(regex); } // NOLINT
1127
1128 // Returns the string representation of the regex.
1129 const char* pattern() const { return pattern_; }
1130
1131 // FullMatch(str, re) returns true if and only if regular expression re
1132 // matches the entire str.
1133 // PartialMatch(str, re) returns true if and only if regular expression re
1134 // matches a substring of str (including str itself).
1135 static bool FullMatch(const ::std::string& str, const RE& re) {
1136 return FullMatch(str.c_str(), re);
1137 }
1138 static bool PartialMatch(const ::std::string& str, const RE& re) {
1139 return PartialMatch(str.c_str(), re);
1140 }
1141
1142 static bool FullMatch(const char* str, const RE& re);
1143 static bool PartialMatch(const char* str, const RE& re);
1144
1145 private:
1146 void Init(const char* regex);
1147 const char* pattern_;
1148 bool is_valid_;
1149
1150# if GTEST_USES_POSIX_RE
1151
1152 regex_t full_regex_; // For FullMatch().
1153 regex_t partial_regex_; // For PartialMatch().
1154
1155# else // GTEST_USES_SIMPLE_RE
1156
1157 const char* full_pattern_; // For FullMatch();
1158
1159# endif
1160
1162};
1163
1164#endif // GTEST_USES_PCRE
1165
1166// Formats a source file path and a line number as they would appear
1167// in an error message from the compiler used to compile this code.
1169
1170// Formats a file location for compiler-independent XML output.
1171// Although this function is not platform dependent, we put it next to
1172// FormatFileLocation in order to contrast the two functions.
1174 int line);
1175
1176// Defines logging utilities:
1177// GTEST_LOG_(severity) - logs messages at the specified severity level. The
1178// message itself is streamed into the macro.
1179// LogToStderr() - directs all log messages to stderr.
1180// FlushInfoLog() - flushes informational log messages.
1181
1188
1189// Formats log entry severity, provides a stream object for streaming the
1190// log message, and terminates the message with a newline when going out of
1191// scope.
1193 public:
1194 GTestLog(GTestLogSeverity severity, const char* file, int line);
1195
1196 // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
1198
1199 ::std::ostream& GetStream() { return ::std::cerr; }
1200
1201 private:
1202 const GTestLogSeverity severity_;
1203
1205};
1206
1207#if !defined(GTEST_LOG_)
1208
1209# define GTEST_LOG_(severity) \
1210 ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
1211 __FILE__, __LINE__).GetStream()
1212
1213inline void LogToStderr() {}
1214inline void FlushInfoLog() { fflush(nullptr); }
1215
1216#endif // !defined(GTEST_LOG_)
1217
1218#if !defined(GTEST_CHECK_)
1219// INTERNAL IMPLEMENTATION - DO NOT USE.
1220//
1221// GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
1222// is not satisfied.
1223// Synopsys:
1224// GTEST_CHECK_(boolean_condition);
1225// or
1226// GTEST_CHECK_(boolean_condition) << "Additional message";
1227//
1228// This checks the condition and if the condition is not satisfied
1229// it prints message about the condition violation, including the
1230// condition itself, plus additional message streamed into it, if any,
1231// and then it aborts the program. It aborts the program irrespective of
1232// whether it is built in the debug mode or not.
1233# define GTEST_CHECK_(condition) \
1234 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1235 if (::testing::internal::IsTrue(condition)) \
1236 ; \
1237 else \
1238 GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
1239#endif // !defined(GTEST_CHECK_)
1240
1241// An all-mode assert to verify that the given POSIX-style function
1242// call returns 0 (indicating success). Known limitation: this
1243// doesn't expand to a balanced 'if' statement, so enclose the macro
1244// in {} if you need to use it as the only statement in an 'if'
1245// branch.
1246#define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
1247 if (const int gtest_error = (posix_call)) \
1248 GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
1249 << gtest_error
1250
1251// Transforms "T" into "const T&" according to standard reference collapsing
1252// rules (this is only needed as a backport for C++98 compilers that do not
1253// support reference collapsing). Specifically, it transforms:
1254//
1255// char ==> const char&
1256// const char ==> const char&
1257// char& ==> char&
1258// const char& ==> const char&
1259//
1260// Note that the non-const reference will not have "const" added. This is
1261// standard, and necessary so that "T" can always bind to "const T&".
1262template <typename T>
1263struct ConstRef { typedef const T& type; };
1264template <typename T>
1265struct ConstRef<T&> { typedef T& type; };
1266
1267// The argument T must depend on some template parameters.
1268#define GTEST_REFERENCE_TO_CONST_(T) \
1269 typename ::testing::internal::ConstRef<T>::type
1270
1271// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
1272//
1273// Use ImplicitCast_ as a safe version of static_cast for upcasting in
1274// the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a
1275// const Foo*). When you use ImplicitCast_, the compiler checks that
1276// the cast is safe. Such explicit ImplicitCast_s are necessary in
1277// surprisingly many situations where C++ demands an exact type match
1278// instead of an argument type convertable to a target type.
1279//
1280// The syntax for using ImplicitCast_ is the same as for static_cast:
1281//
1282// ImplicitCast_<ToType>(expr)
1283//
1284// ImplicitCast_ would have been part of the C++ standard library,
1285// but the proposal was submitted too late. It will probably make
1286// its way into the language in the future.
1287//
1288// This relatively ugly name is intentional. It prevents clashes with
1289// similar functions users may have (e.g., implicit_cast). The internal
1290// namespace alone is not enough because the function can be found by ADL.
1291template<typename To>
1292inline To ImplicitCast_(To x) { return x; }
1293
1294// When you upcast (that is, cast a pointer from type Foo to type
1295// SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts
1296// always succeed. When you downcast (that is, cast a pointer from
1297// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
1298// how do you know the pointer is really of type SubclassOfFoo? It
1299// could be a bare Foo, or of type DifferentSubclassOfFoo. Thus,
1300// when you downcast, you should use this macro. In debug mode, we
1301// use dynamic_cast<> to double-check the downcast is legal (we die
1302// if it's not). In normal mode, we do the efficient static_cast<>
1303// instead. Thus, it's important to test in debug mode to make sure
1304// the cast is legal!
1305// This is the only place in the code we should use dynamic_cast<>.
1306// In particular, you SHOULDN'T be using dynamic_cast<> in order to
1307// do RTTI (eg code like this:
1308// if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
1309// if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
1310// You should design the code some other way not to need this.
1311//
1312// This relatively ugly name is intentional. It prevents clashes with
1313// similar functions users may have (e.g., down_cast). The internal
1314// namespace alone is not enough because the function can be found by ADL.
1315template<typename To, typename From> // use like this: DownCast_<T*>(foo);
1316inline To DownCast_(From* f) { // so we only accept pointers
1317 // Ensures that To is a sub-type of From *. This test is here only
1318 // for compile-time type checking, and has no overhead in an
1319 // optimized build at run-time, as it will be optimized away
1320 // completely.
1322 if (false) {
1324 const To to = nullptr;
1325 ::testing::internal::ImplicitCast_<From*>(to);
1326 }
1327
1328#if GTEST_HAS_RTTI
1329 // RTTI: debug mode only!
1330 GTEST_CHECK_(f == nullptr || dynamic_cast<To>(f) != nullptr);
1331#endif
1332 return static_cast<To>(f);
1333}
1334
1335// Downcasts the pointer of type Base to Derived.
1336// Derived must be a subclass of Base. The parameter MUST
1337// point to a class of type Derived, not any subclass of it.
1338// When RTTI is available, the function performs a runtime
1339// check to enforce this.
1340template <class Derived, class Base>
1341Derived* CheckedDowncastToActualType(Base* base) {
1342#if GTEST_HAS_RTTI
1343 GTEST_CHECK_(typeid(*base) == typeid(Derived));
1344#endif
1345
1346#if GTEST_HAS_DOWNCAST_
1347 return ::down_cast<Derived*>(base);
1348#elif GTEST_HAS_RTTI
1349 return dynamic_cast<Derived*>(base); // NOLINT
1350#else
1351 return static_cast<Derived*>(base); // Poor man's downcast.
1352#endif
1353}
1354
1355#if GTEST_HAS_STREAM_REDIRECTION
1356
1357// Defines the stderr capturer:
1358// CaptureStdout - starts capturing stdout.
1359// GetCapturedStdout - stops capturing stdout and returns the captured string.
1360// CaptureStderr - starts capturing stderr.
1361// GetCapturedStderr - stops capturing stderr and returns the captured string.
1362//
1367
1368#endif // GTEST_HAS_STREAM_REDIRECTION
1369// Returns the size (in bytes) of a file.
1370GTEST_API_ size_t GetFileSize(FILE* file);
1371
1372// Reads the entire content of a file as a string.
1374
1375// All command line arguments.
1376GTEST_API_ std::vector<std::string> GetArgvs();
1377
1378#if GTEST_HAS_DEATH_TEST
1379
1380std::vector<std::string> GetInjectableArgvs();
1381// Deprecated: pass the args vector by value instead.
1382void SetInjectableArgvs(const std::vector<std::string>* new_argvs);
1383void SetInjectableArgvs(const std::vector<std::string>& new_argvs);
1384void ClearInjectableArgvs();
1385
1386#endif // GTEST_HAS_DEATH_TEST
1387
1388// Defines synchronization primitives.
1389#if GTEST_IS_THREADSAFE
1390# if GTEST_HAS_PTHREAD
1391// Sleeps for (roughly) n milliseconds. This function is only for testing
1392// Google Test's own constructs. Don't use it in user tests, either
1393// directly or indirectly.
1394inline void SleepMilliseconds(int n) {
1395 const timespec time = {
1396 0, // 0 seconds.
1397 n * 1000L * 1000L, // And n ms.
1398 };
1399 nanosleep(&time, nullptr);
1400}
1401# endif // GTEST_HAS_PTHREAD
1402
1403# if GTEST_HAS_NOTIFICATION_
1404// Notification has already been imported into the namespace.
1405// Nothing to do here.
1406
1407# elif GTEST_HAS_PTHREAD
1408// Allows a controller thread to pause execution of newly created
1409// threads until notified. Instances of this class must be created
1410// and destroyed in the controller thread.
1411//
1412// This class is only for testing Google Test's own constructs. Do not
1413// use it in user tests, either directly or indirectly.
1414class Notification {
1415 public:
1416 Notification() : notified_(false) {
1417 GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, nullptr));
1418 }
1419 ~Notification() {
1420 pthread_mutex_destroy(&mutex_);
1421 }
1422
1423 // Notifies all threads created with this notification to start. Must
1424 // be called from the controller thread.
1425 void Notify() {
1426 pthread_mutex_lock(&mutex_);
1427 notified_ = true;
1428 pthread_mutex_unlock(&mutex_);
1429 }
1430
1431 // Blocks until the controller thread notifies. Must be called from a test
1432 // thread.
1433 void WaitForNotification() {
1434 for (;;) {
1435 pthread_mutex_lock(&mutex_);
1436 const bool notified = notified_;
1437 pthread_mutex_unlock(&mutex_);
1438 if (notified)
1439 break;
1440 SleepMilliseconds(10);
1441 }
1442 }
1443
1444 private:
1445 pthread_mutex_t mutex_;
1446 bool notified_;
1447
1448 GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
1449};
1450
1451# elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
1452
1453GTEST_API_ void SleepMilliseconds(int n);
1454
1455// Provides leak-safe Windows kernel handle ownership.
1456// Used in death tests and in threading support.
1457class GTEST_API_ AutoHandle {
1458 public:
1459 // Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to
1460 // avoid including <windows.h> in this header file. Including <windows.h> is
1461 // undesirable because it defines a lot of symbols and macros that tend to
1462 // conflict with client code. This assumption is verified by
1463 // WindowsTypesTest.HANDLEIsVoidStar.
1464 typedef void* Handle;
1465 AutoHandle();
1466 explicit AutoHandle(Handle handle);
1467
1468 ~AutoHandle();
1469
1470 Handle Get() const;
1471 void Reset();
1472 void Reset(Handle handle);
1473
1474 private:
1475 // Returns true if and only if the handle is a valid handle object that can be
1476 // closed.
1477 bool IsCloseable() const;
1478
1479 Handle handle_;
1480
1482};
1483
1484// Allows a controller thread to pause execution of newly created
1485// threads until notified. Instances of this class must be created
1486// and destroyed in the controller thread.
1487//
1488// This class is only for testing Google Test's own constructs. Do not
1489// use it in user tests, either directly or indirectly.
1490class GTEST_API_ Notification {
1491 public:
1492 Notification();
1493 void Notify();
1494 void WaitForNotification();
1495
1496 private:
1497 AutoHandle event_;
1498
1499 GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
1500};
1501# endif // GTEST_HAS_NOTIFICATION_
1502
1503// On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD
1504// defined, but we don't want to use MinGW's pthreads implementation, which
1505// has conformance problems with some versions of the POSIX standard.
1506# if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW
1507
1508// As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
1509// Consequently, it cannot select a correct instantiation of ThreadWithParam
1510// in order to call its Run(). Introducing ThreadWithParamBase as a
1511// non-templated base class for ThreadWithParam allows us to bypass this
1512// problem.
1513class ThreadWithParamBase {
1514 public:
1515 virtual ~ThreadWithParamBase() {}
1516 virtual void Run() = 0;
1517};
1518
1519// pthread_create() accepts a pointer to a function type with the C linkage.
1520// According to the Standard (7.5/1), function types with different linkages
1521// are different even if they are otherwise identical. Some compilers (for
1522// example, SunStudio) treat them as different types. Since class methods
1523// cannot be defined with C-linkage we need to define a free C-function to
1524// pass into pthread_create().
1525extern "C" inline void* ThreadFuncWithCLinkage(void* thread) {
1526 static_cast<ThreadWithParamBase*>(thread)->Run();
1527 return nullptr;
1528}
1529
1530// Helper class for testing Google Test's multi-threading constructs.
1531// To use it, write:
1532//
1533// void ThreadFunc(int param) { /* Do things with param */ }
1534// Notification thread_can_start;
1535// ...
1536// // The thread_can_start parameter is optional; you can supply NULL.
1537// ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);
1538// thread_can_start.Notify();
1539//
1540// These classes are only for testing Google Test's own constructs. Do
1541// not use them in user tests, either directly or indirectly.
1542template <typename T>
1543class ThreadWithParam : public ThreadWithParamBase {
1544 public:
1545 typedef void UserThreadFunc(T);
1546
1547 ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
1548 : func_(func),
1549 param_(param),
1550 thread_can_start_(thread_can_start),
1551 finished_(false) {
1552 ThreadWithParamBase* const base = this;
1553 // The thread can be created only after all fields except thread_
1554 // have been initialized.
1556 pthread_create(&thread_, nullptr, &ThreadFuncWithCLinkage, base));
1557 }
1558 ~ThreadWithParam() override { Join(); }
1559
1560 void Join() {
1561 if (!finished_) {
1562 GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, nullptr));
1563 finished_ = true;
1564 }
1565 }
1566
1567 void Run() override {
1568 if (thread_can_start_ != nullptr) thread_can_start_->WaitForNotification();
1569 func_(param_);
1570 }
1571
1572 private:
1573 UserThreadFunc* const func_; // User-supplied thread function.
1574 const T param_; // User-supplied parameter to the thread function.
1575 // When non-NULL, used to block execution until the controller thread
1576 // notifies.
1577 Notification* const thread_can_start_;
1578 bool finished_; // true if and only if we know that the thread function has
1579 // finished.
1580 pthread_t thread_; // The native thread object.
1581
1582 GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
1583};
1584# endif // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD ||
1585 // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
1586
1587# if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
1588// Mutex and ThreadLocal have already been imported into the namespace.
1589// Nothing to do here.
1590
1591# elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
1592
1593// Mutex implements mutex on Windows platforms. It is used in conjunction
1594// with class MutexLock:
1595//
1596// Mutex mutex;
1597// ...
1598// MutexLock lock(&mutex); // Acquires the mutex and releases it at the
1599// // end of the current scope.
1600//
1601// A static Mutex *must* be defined or declared using one of the following
1602// macros:
1603// GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);
1604// GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
1605//
1606// (A non-static Mutex is defined/declared in the usual way).
1607class GTEST_API_ Mutex {
1608 public:
1609 enum MutexType { kStatic = 0, kDynamic = 1 };
1610 // We rely on kStaticMutex being 0 as it is to what the linker initializes
1611 // type_ in static mutexes. critical_section_ will be initialized lazily
1612 // in ThreadSafeLazyInit().
1613 enum StaticConstructorSelector { kStaticMutex = 0 };
1614
1615 // This constructor intentionally does nothing. It relies on type_ being
1616 // statically initialized to 0 (effectively setting it to kStatic) and on
1617 // ThreadSafeLazyInit() to lazily initialize the rest of the members.
1618 explicit Mutex(StaticConstructorSelector /*dummy*/) {}
1619
1620 Mutex();
1621 ~Mutex();
1622
1623 void Lock();
1624
1625 void Unlock();
1626
1627 // Does nothing if the current thread holds the mutex. Otherwise, crashes
1628 // with high probability.
1629 void AssertHeld();
1630
1631 private:
1632 // Initializes owner_thread_id_ and critical_section_ in static mutexes.
1633 void ThreadSafeLazyInit();
1634
1635 // Per https://blogs.msdn.microsoft.com/oldnewthing/20040223-00/?p=40503,
1636 // we assume that 0 is an invalid value for thread IDs.
1637 unsigned int owner_thread_id_;
1638
1639 // For static mutexes, we rely on these members being initialized to zeros
1640 // by the linker.
1641 MutexType type_;
1642 long critical_section_init_phase_; // NOLINT
1643 GTEST_CRITICAL_SECTION* critical_section_;
1644
1646};
1647
1648# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
1649 extern ::testing::internal::Mutex mutex
1650
1651# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
1652 ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex)
1653
1654// We cannot name this class MutexLock because the ctor declaration would
1655// conflict with a macro named MutexLock, which is defined on some
1656// platforms. That macro is used as a defensive measure to prevent against
1657// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
1658// "MutexLock l(&mu)". Hence the typedef trick below.
1659class GTestMutexLock {
1660 public:
1661 explicit GTestMutexLock(Mutex* mutex)
1662 : mutex_(mutex) { mutex_->Lock(); }
1663
1664 ~GTestMutexLock() { mutex_->Unlock(); }
1665
1666 private:
1667 Mutex* const mutex_;
1668
1670};
1671
1672typedef GTestMutexLock MutexLock;
1673
1674// Base class for ValueHolder<T>. Allows a caller to hold and delete a value
1675// without knowing its type.
1676class ThreadLocalValueHolderBase {
1677 public:
1678 virtual ~ThreadLocalValueHolderBase() {}
1679};
1680
1681// Provides a way for a thread to send notifications to a ThreadLocal
1682// regardless of its parameter type.
1683class ThreadLocalBase {
1684 public:
1685 // Creates a new ValueHolder<T> object holding a default value passed to
1686 // this ThreadLocal<T>'s constructor and returns it. It is the caller's
1687 // responsibility not to call this when the ThreadLocal<T> instance already
1688 // has a value on the current thread.
1689 virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0;
1690
1691 protected:
1692 ThreadLocalBase() {}
1693 virtual ~ThreadLocalBase() {}
1694
1695 private:
1696 GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocalBase);
1697};
1698
1699// Maps a thread to a set of ThreadLocals that have values instantiated on that
1700// thread and notifies them when the thread exits. A ThreadLocal instance is
1701// expected to persist until all threads it has values on have terminated.
1702class GTEST_API_ ThreadLocalRegistry {
1703 public:
1704 // Registers thread_local_instance as having value on the current thread.
1705 // Returns a value that can be used to identify the thread from other threads.
1706 static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
1707 const ThreadLocalBase* thread_local_instance);
1708
1709 // Invoked when a ThreadLocal instance is destroyed.
1710 static void OnThreadLocalDestroyed(
1711 const ThreadLocalBase* thread_local_instance);
1712};
1713
1714class GTEST_API_ ThreadWithParamBase {
1715 public:
1716 void Join();
1717
1718 protected:
1719 class Runnable {
1720 public:
1721 virtual ~Runnable() {}
1722 virtual void Run() = 0;
1723 };
1724
1725 ThreadWithParamBase(Runnable *runnable, Notification* thread_can_start);
1726 virtual ~ThreadWithParamBase();
1727
1728 private:
1729 AutoHandle thread_;
1730};
1731
1732// Helper class for testing Google Test's multi-threading constructs.
1733template <typename T>
1734class ThreadWithParam : public ThreadWithParamBase {
1735 public:
1736 typedef void UserThreadFunc(T);
1737
1738 ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
1739 : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {
1740 }
1741 virtual ~ThreadWithParam() {}
1742
1743 private:
1744 class RunnableImpl : public Runnable {
1745 public:
1746 RunnableImpl(UserThreadFunc* func, T param)
1747 : func_(func),
1748 param_(param) {
1749 }
1750 virtual ~RunnableImpl() {}
1751 virtual void Run() {
1752 func_(param_);
1753 }
1754
1755 private:
1756 UserThreadFunc* const func_;
1757 const T param_;
1758
1759 GTEST_DISALLOW_COPY_AND_ASSIGN_(RunnableImpl);
1760 };
1761
1762 GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
1763};
1764
1765// Implements thread-local storage on Windows systems.
1766//
1767// // Thread 1
1768// ThreadLocal<int> tl(100); // 100 is the default value for each thread.
1769//
1770// // Thread 2
1771// tl.set(150); // Changes the value for thread 2 only.
1772// EXPECT_EQ(150, tl.get());
1773//
1774// // Thread 1
1775// EXPECT_EQ(100, tl.get()); // In thread 1, tl has the original value.
1776// tl.set(200);
1777// EXPECT_EQ(200, tl.get());
1778//
1779// The template type argument T must have a public copy constructor.
1780// In addition, the default ThreadLocal constructor requires T to have
1781// a public default constructor.
1782//
1783// The users of a TheadLocal instance have to make sure that all but one
1784// threads (including the main one) using that instance have exited before
1785// destroying it. Otherwise, the per-thread objects managed for them by the
1786// ThreadLocal instance are not guaranteed to be destroyed on all platforms.
1787//
1788// Google Test only uses global ThreadLocal objects. That means they
1789// will die after main() has returned. Therefore, no per-thread
1790// object managed by Google Test will be leaked as long as all threads
1791// using Google Test have exited when main() returns.
1792template <typename T>
1793class ThreadLocal : public ThreadLocalBase {
1794 public:
1795 ThreadLocal() : default_factory_(new DefaultValueHolderFactory()) {}
1796 explicit ThreadLocal(const T& value)
1797 : default_factory_(new InstanceValueHolderFactory(value)) {}
1798
1799 ~ThreadLocal() { ThreadLocalRegistry::OnThreadLocalDestroyed(this); }
1800
1801 T* pointer() { return GetOrCreateValue(); }
1802 const T* pointer() const { return GetOrCreateValue(); }
1803 const T& get() const { return *pointer(); }
1804 void set(const T& value) { *pointer() = value; }
1805
1806 private:
1807 // Holds a value of T. Can be deleted via its base class without the caller
1808 // knowing the type of T.
1809 class ValueHolder : public ThreadLocalValueHolderBase {
1810 public:
1811 ValueHolder() : value_() {}
1812 explicit ValueHolder(const T& value) : value_(value) {}
1813
1814 T* pointer() { return &value_; }
1815
1816 private:
1817 T value_;
1819 };
1820
1821
1822 T* GetOrCreateValue() const {
1823 return static_cast<ValueHolder*>(
1824 ThreadLocalRegistry::GetValueOnCurrentThread(this))->pointer();
1825 }
1826
1827 virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const {
1828 return default_factory_->MakeNewHolder();
1829 }
1830
1831 class ValueHolderFactory {
1832 public:
1833 ValueHolderFactory() {}
1834 virtual ~ValueHolderFactory() {}
1835 virtual ValueHolder* MakeNewHolder() const = 0;
1836
1837 private:
1838 GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
1839 };
1840
1841 class DefaultValueHolderFactory : public ValueHolderFactory {
1842 public:
1843 DefaultValueHolderFactory() {}
1844 virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); }
1845
1846 private:
1847 GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
1848 };
1849
1850 class InstanceValueHolderFactory : public ValueHolderFactory {
1851 public:
1852 explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
1853 virtual ValueHolder* MakeNewHolder() const {
1854 return new ValueHolder(value_);
1855 }
1856
1857 private:
1858 const T value_; // The value for each thread.
1859
1860 GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
1861 };
1862
1863 std::unique_ptr<ValueHolderFactory> default_factory_;
1864
1866};
1867
1868# elif GTEST_HAS_PTHREAD
1869
1870// MutexBase and Mutex implement mutex on pthreads-based platforms.
1871class MutexBase {
1872 public:
1873 // Acquires this mutex.
1874 void Lock() {
1875 GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
1876 owner_ = pthread_self();
1877 has_owner_ = true;
1878 }
1879
1880 // Releases this mutex.
1881 void Unlock() {
1882 // Since the lock is being released the owner_ field should no longer be
1883 // considered valid. We don't protect writing to has_owner_ here, as it's
1884 // the caller's responsibility to ensure that the current thread holds the
1885 // mutex when this is called.
1886 has_owner_ = false;
1887 GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
1888 }
1889
1890 // Does nothing if the current thread holds the mutex. Otherwise, crashes
1891 // with high probability.
1892 void AssertHeld() const {
1893 GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
1894 << "The current thread is not holding the mutex @" << this;
1895 }
1896
1897 // A static mutex may be used before main() is entered. It may even
1898 // be used before the dynamic initialization stage. Therefore we
1899 // must be able to initialize a static mutex object at link time.
1900 // This means MutexBase has to be a POD and its member variables
1901 // have to be public.
1902 public:
1903 pthread_mutex_t mutex_; // The underlying pthread mutex.
1904 // has_owner_ indicates whether the owner_ field below contains a valid thread
1905 // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All
1906 // accesses to the owner_ field should be protected by a check of this field.
1907 // An alternative might be to memset() owner_ to all zeros, but there's no
1908 // guarantee that a zero'd pthread_t is necessarily invalid or even different
1909 // from pthread_self().
1910 bool has_owner_;
1911 pthread_t owner_; // The thread holding the mutex.
1912};
1913
1914// Forward-declares a static mutex.
1915# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
1916 extern ::testing::internal::MutexBase mutex
1917
1918// Defines and statically (i.e. at link time) initializes a static mutex.
1919// The initialization list here does not explicitly initialize each field,
1920// instead relying on default initialization for the unspecified fields. In
1921// particular, the owner_ field (a pthread_t) is not explicitly initialized.
1922// This allows initialization to work whether pthread_t is a scalar or struct.
1923// The flag -Wmissing-field-initializers must not be specified for this to work.
1924#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
1925 ::testing::internal::MutexBase mutex = {PTHREAD_MUTEX_INITIALIZER, false, 0}
1926
1927// The Mutex class can only be used for mutexes created at runtime. It
1928// shares its API with MutexBase otherwise.
1929class Mutex : public MutexBase {
1930 public:
1931 Mutex() {
1932 GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, nullptr));
1933 has_owner_ = false;
1934 }
1935 ~Mutex() {
1936 GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
1937 }
1938
1939 private:
1941};
1942
1943// We cannot name this class MutexLock because the ctor declaration would
1944// conflict with a macro named MutexLock, which is defined on some
1945// platforms. That macro is used as a defensive measure to prevent against
1946// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
1947// "MutexLock l(&mu)". Hence the typedef trick below.
1948class GTestMutexLock {
1949 public:
1950 explicit GTestMutexLock(MutexBase* mutex)
1951 : mutex_(mutex) { mutex_->Lock(); }
1952
1953 ~GTestMutexLock() { mutex_->Unlock(); }
1954
1955 private:
1956 MutexBase* const mutex_;
1957
1959};
1960
1961typedef GTestMutexLock MutexLock;
1962
1963// Helpers for ThreadLocal.
1964
1965// pthread_key_create() requires DeleteThreadLocalValue() to have
1966// C-linkage. Therefore it cannot be templatized to access
1967// ThreadLocal<T>. Hence the need for class
1968// ThreadLocalValueHolderBase.
1969class ThreadLocalValueHolderBase {
1970 public:
1971 virtual ~ThreadLocalValueHolderBase() {}
1972};
1973
1974// Called by pthread to delete thread-local data stored by
1975// pthread_setspecific().
1976extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
1977 delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
1978}
1979
1980// Implements thread-local storage on pthreads-based systems.
1981template <typename T>
1982class GTEST_API_ ThreadLocal {
1983 public:
1984 ThreadLocal()
1985 : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {}
1986 explicit ThreadLocal(const T& value)
1987 : key_(CreateKey()),
1988 default_factory_(new InstanceValueHolderFactory(value)) {}
1989
1990 ~ThreadLocal() {
1991 // Destroys the managed object for the current thread, if any.
1992 DeleteThreadLocalValue(pthread_getspecific(key_));
1993
1994 // Releases resources associated with the key. This will *not*
1995 // delete managed objects for other threads.
1996 GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));
1997 }
1998
1999 T* pointer() { return GetOrCreateValue(); }
2000 const T* pointer() const { return GetOrCreateValue(); }
2001 const T& get() const { return *pointer(); }
2002 void set(const T& value) { *pointer() = value; }
2003
2004 private:
2005 // Holds a value of type T.
2006 class ValueHolder : public ThreadLocalValueHolderBase {
2007 public:
2008 ValueHolder() : value_() {}
2009 explicit ValueHolder(const T& value) : value_(value) {}
2010
2011 T* pointer() { return &value_; }
2012
2013 private:
2014 T value_;
2016 };
2017
2018 static pthread_key_t CreateKey() {
2019 pthread_key_t key;
2020 // When a thread exits, DeleteThreadLocalValue() will be called on
2021 // the object managed for that thread.
2023 pthread_key_create(&key, &DeleteThreadLocalValue));
2024 return key;
2025 }
2026
2027 T* GetOrCreateValue() const {
2028 ThreadLocalValueHolderBase* const holder =
2029 static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));
2030 if (holder != nullptr) {
2031 return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
2032 }
2033
2034 ValueHolder* const new_holder = default_factory_->MakeNewHolder();
2035 ThreadLocalValueHolderBase* const holder_base = new_holder;
2036 GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
2037 return new_holder->pointer();
2038 }
2039
2040 class ValueHolderFactory {
2041 public:
2042 ValueHolderFactory() {}
2043 virtual ~ValueHolderFactory() {}
2044 virtual ValueHolder* MakeNewHolder() const = 0;
2045
2046 private:
2047 GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
2048 };
2049
2050 class DefaultValueHolderFactory : public ValueHolderFactory {
2051 public:
2052 DefaultValueHolderFactory() {}
2053 virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); }
2054
2055 private:
2056 GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
2057 };
2058
2059 class InstanceValueHolderFactory : public ValueHolderFactory {
2060 public:
2061 explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
2062 virtual ValueHolder* MakeNewHolder() const {
2063 return new ValueHolder(value_);
2064 }
2065
2066 private:
2067 const T value_; // The value for each thread.
2068
2069 GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
2070 };
2071
2072 // A key pthreads uses for looking up per-thread values.
2073 const pthread_key_t key_;
2074 std::unique_ptr<ValueHolderFactory> default_factory_;
2075
2077};
2078
2079# endif // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
2080
2081#else // GTEST_IS_THREADSAFE
2082
2083// A dummy implementation of synchronization primitives (mutex, lock,
2084// and thread-local variable). Necessary for compiling Google Test where
2085// mutex is not supported - using Google Test in multiple threads is not
2086// supported on such platforms.
2087
2088class Mutex {
2089 public:
2091 void Lock() {}
2092 void Unlock() {}
2093 void AssertHeld() const {}
2094};
2095
2096# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
2097 extern ::testing::internal::Mutex mutex
2098
2099# define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
2100
2101// We cannot name this class MutexLock because the ctor declaration would
2102// conflict with a macro named MutexLock, which is defined on some
2103// platforms. That macro is used as a defensive measure to prevent against
2104// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
2105// "MutexLock l(&mu)". Hence the typedef trick below.
2107 public:
2108 explicit GTestMutexLock(Mutex*) {} // NOLINT
2109};
2110
2112
2113template <typename T>
2115 public:
2116 ThreadLocal() : value_() {}
2117 explicit ThreadLocal(const T& value) : value_(value) {}
2118 T* pointer() { return &value_; }
2119 const T* pointer() const { return &value_; }
2120 const T& get() const { return value_; }
2121 void set(const T& value) { value_ = value; }
2122 private:
2123 T value_;
2124};
2125
2126#endif // GTEST_IS_THREADSAFE
2127
2128// Returns the number of threads running in the process, or 0 to indicate that
2129// we cannot detect it.
2131
2132template <bool B>
2133using bool_constant = std::integral_constant<bool, B>;
2134
2135#if GTEST_OS_WINDOWS
2136# define GTEST_PATH_SEP_ "\\"
2137# define GTEST_HAS_ALT_PATH_SEP_ 1
2138// The biggest signed integer type the compiler supports.
2139typedef __int64 BiggestInt;
2140#else
2141# define GTEST_PATH_SEP_ "/"
2142# define GTEST_HAS_ALT_PATH_SEP_ 0
2143typedef long long BiggestInt; // NOLINT
2144#endif // GTEST_OS_WINDOWS
2145
2146// Utilities for char.
2147
2148// isspace(int ch) and friends accept an unsigned char or EOF. char
2149// may be signed, depending on the compiler (or compiler flags).
2150// Therefore we need to cast a char to unsigned char before calling
2151// isspace(), etc.
2152
2153inline bool IsAlpha(char ch) {
2154 return isalpha(static_cast<unsigned char>(ch)) != 0;
2155}
2156inline bool IsAlNum(char ch) {
2157 return isalnum(static_cast<unsigned char>(ch)) != 0;
2158}
2159inline bool IsDigit(char ch) {
2160 return isdigit(static_cast<unsigned char>(ch)) != 0;
2161}
2162inline bool IsLower(char ch) {
2163 return islower(static_cast<unsigned char>(ch)) != 0;
2164}
2165inline bool IsSpace(char ch) {
2166 return isspace(static_cast<unsigned char>(ch)) != 0;
2167}
2168inline bool IsUpper(char ch) {
2169 return isupper(static_cast<unsigned char>(ch)) != 0;
2170}
2171inline bool IsXDigit(char ch) {
2172 return isxdigit(static_cast<unsigned char>(ch)) != 0;
2173}
2174inline bool IsXDigit(wchar_t ch) {
2175 const unsigned char low_byte = static_cast<unsigned char>(ch);
2176 return ch == low_byte && isxdigit(low_byte) != 0;
2177}
2178
2179inline char ToLower(char ch) {
2180 return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
2181}
2182inline char ToUpper(char ch) {
2183 return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
2184}
2185
2187 std::string::iterator it = str.end();
2188 while (it != str.begin() && IsSpace(*--it))
2189 it = str.erase(it);
2190 return str;
2191}
2192
2193// The testing::internal::posix namespace holds wrappers for common
2194// POSIX functions. These wrappers hide the differences between
2195// Windows/MSVC and POSIX systems. Since some compilers define these
2196// standard functions as macros, the wrapper cannot have the same name
2197// as the wrapped function.
2198
2199namespace posix {
2200
2201// Functions with a different name on Windows.
2202
2203#if GTEST_OS_WINDOWS
2204
2205typedef struct _stat StatStruct;
2206
2207# ifdef __BORLANDC__
2208inline int IsATTY(int fd) { return isatty(fd); }
2209inline int StrCaseCmp(const char* s1, const char* s2) {
2210 return stricmp(s1, s2);
2211}
2212inline char* StrDup(const char* src) { return strdup(src); }
2213# else // !__BORLANDC__
2214# if GTEST_OS_WINDOWS_MOBILE
2215inline int IsATTY(int /* fd */) { return 0; }
2216# else
2217inline int IsATTY(int fd) { return _isatty(fd); }
2218# endif // GTEST_OS_WINDOWS_MOBILE
2219inline int StrCaseCmp(const char* s1, const char* s2) {
2220 return _stricmp(s1, s2);
2221}
2222inline char* StrDup(const char* src) { return _strdup(src); }
2223# endif // __BORLANDC__
2224
2225# if GTEST_OS_WINDOWS_MOBILE
2226inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
2227// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
2228// time and thus not defined there.
2229# else
2230inline int FileNo(FILE* file) { return _fileno(file); }
2231inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
2232inline int RmDir(const char* dir) { return _rmdir(dir); }
2233inline bool IsDir(const StatStruct& st) {
2234 return (_S_IFDIR & st.st_mode) != 0;
2235}
2236# endif // GTEST_OS_WINDOWS_MOBILE
2237
2238#else
2239
2240typedef struct stat StatStruct;
2241
2242inline int FileNo(FILE* file) { return fileno(file); }
2243inline int IsATTY(int fd) { return isatty(fd); }
2244inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }
2245inline int StrCaseCmp(const char* s1, const char* s2) {
2246 return strcasecmp(s1, s2);
2247}
2248inline char* StrDup(const char* src) { return strdup(src); }
2249inline int RmDir(const char* dir) { return rmdir(dir); }
2250inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
2251
2252#endif // GTEST_OS_WINDOWS
2253
2254// Functions deprecated by MSVC 8.0.
2255
2257
2258inline const char* StrNCpy(char* dest, const char* src, size_t n) {
2259 return strncpy(dest, src, n);
2260}
2261
2262// ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
2263// StrError() aren't needed on Windows CE at this time and thus not
2264// defined there.
2265
2266#if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
2267inline int ChDir(const char* dir) { return chdir(dir); }
2268#endif
2269inline FILE* FOpen(const char* path, const char* mode) {
2270 return fopen(path, mode);
2271}
2272#if !GTEST_OS_WINDOWS_MOBILE
2273inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
2274 return freopen(path, mode, stream);
2275}
2276inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
2277#endif
2278inline int FClose(FILE* fp) { return fclose(fp); }
2279#if !GTEST_OS_WINDOWS_MOBILE
2280inline int Read(int fd, void* buf, unsigned int count) {
2281 return static_cast<int>(read(fd, buf, count));
2282}
2283inline int Write(int fd, const void* buf, unsigned int count) {
2284 return static_cast<int>(write(fd, buf, count));
2285}
2286inline int Close(int fd) { return close(fd); }
2287inline const char* StrError(int errnum) { return strerror(errnum); }
2288#endif
2289inline const char* GetEnv(const char* name) {
2290#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
2291 // We are on Windows CE, which has no environment variables.
2292 static_cast<void>(name); // To prevent 'unused argument' warning.
2293 return nullptr;
2294#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
2295 // Environment variables which we programmatically clear will be set to the
2296 // empty string rather than unset (NULL). Handle that case.
2297 const char* const env = getenv(name);
2298 return (env != nullptr && env[0] != '\0') ? env : nullptr;
2299#else
2300 return getenv(name);
2301#endif
2302}
2303
2305
2306#if GTEST_OS_WINDOWS_MOBILE
2307// Windows CE has no C library. The abort() function is used in
2308// several places in Google Test. This implementation provides a reasonable
2309// imitation of standard behaviour.
2310[[noreturn]] void Abort();
2311#else
2312[[noreturn]] inline void Abort() { abort(); }
2313#endif // GTEST_OS_WINDOWS_MOBILE
2314
2315} // namespace posix
2316
2317// MSVC "deprecates" snprintf and issues warnings wherever it is used. In
2318// order to avoid these warnings, we need to use _snprintf or _snprintf_s on
2319// MSVC-based platforms. We map the GTEST_SNPRINTF_ macro to the appropriate
2320// function in order to achieve that. We use macro definition here because
2321// snprintf is a variadic function.
2322#if _MSC_VER && !GTEST_OS_WINDOWS_MOBILE
2323// MSVC 2005 and above support variadic macros.
2324# define GTEST_SNPRINTF_(buffer, size, format, ...) \
2325 _snprintf_s(buffer, size, size, format, __VA_ARGS__)
2326#elif defined(_MSC_VER)
2327// Windows CE does not define _snprintf_s
2328# define GTEST_SNPRINTF_ _snprintf
2329#else
2330# define GTEST_SNPRINTF_ snprintf
2331#endif
2332
2333// The maximum number a BiggestInt can represent. This definition
2334// works no matter BiggestInt is represented in one's complement or
2335// two's complement.
2336//
2337// We cannot rely on numeric_limits in STL, as __int64 and long long
2338// are not part of standard C++ and numeric_limits doesn't need to be
2339// defined for them.
2341 ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));
2342
2343// This template class serves as a compile-time function from size to
2344// type. It maps a size in bytes to a primitive type with that
2345// size. e.g.
2346//
2347// TypeWithSize<4>::UInt
2348//
2349// is typedef-ed to be unsigned int (unsigned integer made up of 4
2350// bytes).
2351//
2352// Such functionality should belong to STL, but I cannot find it
2353// there.
2354//
2355// Google Test uses this class in the implementation of floating-point
2356// comparison.
2357//
2358// For now it only handles UInt (unsigned int) as that's all Google Test
2359// needs. Other types can be easily added in the future if need
2360// arises.
2361template <size_t size>
2363 public:
2364 // This prevents the user from using TypeWithSize<N> with incorrect
2365 // values of N.
2366 typedef void UInt;
2367};
2368
2369// The specialization for size 4.
2370template <>
2372 public:
2373 // unsigned int has size 4 in both gcc and MSVC.
2374 //
2375 // As base/basictypes.h doesn't compile on Windows, we cannot use
2376 // uint32, uint64, and etc here.
2377 typedef int Int;
2378 typedef unsigned int UInt;
2379};
2380
2381// The specialization for size 8.
2382template <>
2384 public:
2385#if GTEST_OS_WINDOWS
2386 typedef __int64 Int;
2387 typedef unsigned __int64 UInt;
2388#else
2389 typedef long long Int; // NOLINT
2390 typedef unsigned long long UInt; // NOLINT
2391#endif // GTEST_OS_WINDOWS
2392};
2393
2394// Integer types of known sizes.
2399typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
2400
2401// Utilities for command line flags and environment variables.
2402
2403// Macro for referencing flags.
2404#if !defined(GTEST_FLAG)
2405# define GTEST_FLAG(name) FLAGS_gtest_##name
2406#endif // !defined(GTEST_FLAG)
2407
2408#if !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
2409# define GTEST_USE_OWN_FLAGFILE_FLAG_ 1
2410#endif // !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
2411
2412#if !defined(GTEST_DECLARE_bool_)
2413# define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver
2414
2415// Macros for declaring flags.
2416# define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
2417# define GTEST_DECLARE_int32_(name) \
2418 GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
2419# define GTEST_DECLARE_string_(name) \
2420 GTEST_API_ extern ::std::string GTEST_FLAG(name)
2421
2422// Macros for defining flags.
2423# define GTEST_DEFINE_bool_(name, default_val, doc) \
2424 GTEST_API_ bool GTEST_FLAG(name) = (default_val)
2425# define GTEST_DEFINE_int32_(name, default_val, doc) \
2426 GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
2427# define GTEST_DEFINE_string_(name, default_val, doc) \
2428 GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
2429
2430#endif // !defined(GTEST_DECLARE_bool_)
2431
2432// Thread annotations
2433#if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
2434# define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
2435# define GTEST_LOCK_EXCLUDED_(locks)
2436#endif // !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
2437
2438// Parses 'str' for a 32-bit signed integer. If successful, writes the result
2439// to *value and returns true; otherwise leaves *value unchanged and returns
2440// false.
2441bool ParseInt32(const Message& src_text, const char* str, Int32* value);
2442
2443// Parses a bool/Int32/string from the environment variable
2444// corresponding to the given Google Test flag.
2445bool BoolFromGTestEnv(const char* flag, bool default_val);
2446GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
2448const char* StringFromGTestEnv(const char* flag, const char* default_val);
2449
2450} // namespace internal
2451} // namespace testing
2452
2453#if !defined(GTEST_INTERNAL_DEPRECATED)
2454
2455// Internal Macro to mark an API deprecated, for googletest usage only
2456// Usage: class GTEST_INTERNAL_DEPRECATED(message) MyClass or
2457// GTEST_INTERNAL_DEPRECATED(message) <return_type> myFunction(); Every usage of
2458// a deprecated entity will trigger a warning when compiled with
2459// `-Wdeprecated-declarations` option (clang, gcc, any __GNUC__ compiler).
2460// For msvc /W3 option will need to be used
2461// Note that for 'other' compilers this macro evaluates to nothing to prevent
2462// compilations errors.
2463#if defined(_MSC_VER)
2464#define GTEST_INTERNAL_DEPRECATED(message) __declspec(deprecated(message))
2465#elif defined(__GNUC__)
2466#define GTEST_INTERNAL_DEPRECATED(message) __attribute__((deprecated(message)))
2467#else
2468#define GTEST_INTERNAL_DEPRECATED(message)
2469#endif
2470
2471#endif // !defined(GTEST_INTERNAL_DEPRECATED)
2472
2473#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
2474
2475#if GTEST_OS_LINUX
2476# include <stdlib.h>
2477# include <sys/types.h>
2478# include <sys/wait.h>
2479# include <unistd.h>
2480#endif // GTEST_OS_LINUX
2481
2482#if GTEST_HAS_EXCEPTIONS
2483# include <stdexcept>
2484#endif
2485
2486#include <ctype.h>
2487#include <float.h>
2488#include <string.h>
2489#include <iomanip>
2490#include <limits>
2491#include <map>
2492#include <set>
2493#include <string>
2494#include <type_traits>
2495#include <vector>
2496
2497// Copyright 2005, Google Inc.
2498// All rights reserved.
2499//
2500// Redistribution and use in source and binary forms, with or without
2501// modification, are permitted provided that the following conditions are
2502// met:
2503//
2504// * Redistributions of source code must retain the above copyright
2505// notice, this list of conditions and the following disclaimer.
2506// * Redistributions in binary form must reproduce the above
2507// copyright notice, this list of conditions and the following disclaimer
2508// in the documentation and/or other materials provided with the
2509// distribution.
2510// * Neither the name of Google Inc. nor the names of its
2511// contributors may be used to endorse or promote products derived from
2512// this software without specific prior written permission.
2513//
2514// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2515// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2516// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2517// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2518// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2519// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2520// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2521// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2522// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2523// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2524// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525
2526//
2527// The Google C++ Testing and Mocking Framework (Google Test)
2528//
2529// This header file defines the Message class.
2530//
2531// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
2532// leave some internal implementation details in this header file.
2533// They are clearly marked by comments like this:
2534//
2535// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
2536//
2537// Such code is NOT meant to be used by a user directly, and is subject
2538// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
2539// program!
2540
2541// GOOGLETEST_CM0001 DO NOT DELETE
2542
2543#ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
2544#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
2545
2546#include <limits>
2547#include <memory>
2548
2549
2551/* class A needs to have dll-interface to be used by clients of class B */)
2552
2553// Ensures that there is at least one operator<< in the global namespace.
2554// See Message& operator<<(...) below for why.
2555void operator<<(const testing::internal::Secret&, int);
2556
2557namespace testing {
2558
2559// The Message class works like an ostream repeater.
2560//
2561// Typical usage:
2562//
2563// 1. You stream a bunch of values to a Message object.
2564// It will remember the text in a stringstream.
2565// 2. Then you stream the Message object to an ostream.
2566// This causes the text in the Message to be streamed
2567// to the ostream.
2568//
2569// For example;
2570//
2571// testing::Message foo;
2572// foo << 1 << " != " << 2;
2573// std::cout << foo;
2574//
2575// will print "1 != 2".
2576//
2577// Message is not intended to be inherited from. In particular, its
2578// destructor is not virtual.
2579//
2580// Note that stringstream behaves differently in gcc and in MSVC. You
2581// can stream a NULL char pointer to it in the former, but not in the
2582// latter (it causes an access violation if you do). The Message
2583// class hides this difference by treating a NULL char pointer as
2584// "(null)".
2586 private:
2587 // The type of basic IO manipulators (endl, ends, and flush) for
2588 // narrow streams.
2589 typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
2590
2591 public:
2592 // Constructs an empty Message.
2594
2595 // Copy constructor.
2596 Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT
2597 *ss_ << msg.GetString();
2598 }
2599
2600 // Constructs a Message from a C-string.
2601 explicit Message(const char* str) : ss_(new ::std::stringstream) {
2602 *ss_ << str;
2603 }
2604
2605 // Streams a non-pointer value to this object.
2606 template <typename T>
2607 inline Message& operator <<(const T& val) {
2608 // Some libraries overload << for STL containers. These
2609 // overloads are defined in the global namespace instead of ::std.
2610 //
2611 // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
2612 // overloads are visible in either the std namespace or the global
2613 // namespace, but not other namespaces, including the testing
2614 // namespace which Google Test's Message class is in.
2615 //
2616 // To allow STL containers (and other types that has a << operator
2617 // defined in the global namespace) to be used in Google Test
2618 // assertions, testing::Message must access the custom << operator
2619 // from the global namespace. With this using declaration,
2620 // overloads of << defined in the global namespace and those
2621 // visible via Koenig lookup are both exposed in this function.
2622 using ::operator <<;
2623 *ss_ << val;
2624 return *this;
2625 }
2626
2627 // Streams a pointer value to this object.
2628 //
2629 // This function is an overload of the previous one. When you
2630 // stream a pointer to a Message, this definition will be used as it
2631 // is more specialized. (The C++ Standard, section
2632 // [temp.func.order].) If you stream a non-pointer, then the
2633 // previous definition will be used.
2634 //
2635 // The reason for this overload is that streaming a NULL pointer to
2636 // ostream is undefined behavior. Depending on the compiler, you
2637 // may get "0", "(nil)", "(null)", or an access violation. To
2638 // ensure consistent result across compilers, we always treat NULL
2639 // as "(null)".
2640 template <typename T>
2641 inline Message& operator <<(T* const& pointer) { // NOLINT
2642 if (pointer == nullptr) {
2643 *ss_ << "(null)";
2644 } else {
2645 *ss_ << pointer;
2646 }
2647 return *this;
2648 }
2649
2650 // Since the basic IO manipulators are overloaded for both narrow
2651 // and wide streams, we have to provide this specialized definition
2652 // of operator <<, even though its body is the same as the
2653 // templatized version above. Without this definition, streaming
2654 // endl or other basic IO manipulators to Message will confuse the
2655 // compiler.
2656 Message& operator <<(BasicNarrowIoManip val) {
2657 *ss_ << val;
2658 return *this;
2659 }
2660
2661 // Instead of 1/0, we want to see true/false for bool values.
2663 return *this << (b ? "true" : "false");
2664 }
2665
2666 // These two overloads allow streaming a wide C string to a Message
2667 // using the UTF-8 encoding.
2668 Message& operator <<(const wchar_t* wide_c_str);
2669 Message& operator <<(wchar_t* wide_c_str);
2670
2671#if GTEST_HAS_STD_WSTRING
2672 // Converts the given wide string to a narrow string using the UTF-8
2673 // encoding, and streams the result to this Message object.
2674 Message& operator <<(const ::std::wstring& wstr);
2675#endif // GTEST_HAS_STD_WSTRING
2676
2677 // Gets the text streamed to this object so far as an std::string.
2678 // Each '\0' character in the buffer is replaced with "\\0".
2679 //
2680 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
2682
2683 private:
2684 // We'll hold the text streamed to this object here.
2685 const std::unique_ptr< ::std::stringstream> ss_;
2686
2687 // We declare (but don't implement) this to prevent the compiler
2688 // from implementing the assignment operator.
2689 void operator=(const Message&);
2690};
2691
2692// Streams a Message to an ostream.
2693inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
2694 return os << sb.GetString();
2695}
2696
2697namespace internal {
2698
2699// Converts a streamable value to an std::string. A NULL pointer is
2700// converted to "(null)". When the input value is a ::string,
2701// ::std::string, ::wstring, or ::std::wstring object, each NUL
2702// character in it is replaced with "\\0".
2703template <typename T>
2704std::string StreamableToString(const T& streamable) {
2705 return (Message() << streamable).GetString();
2706}
2707
2708} // namespace internal
2709} // namespace testing
2710
2712
2713#endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
2714// Copyright 2008, Google Inc.
2715// All rights reserved.
2716//
2717// Redistribution and use in source and binary forms, with or without
2718// modification, are permitted provided that the following conditions are
2719// met:
2720//
2721// * Redistributions of source code must retain the above copyright
2722// notice, this list of conditions and the following disclaimer.
2723// * Redistributions in binary form must reproduce the above
2724// copyright notice, this list of conditions and the following disclaimer
2725// in the documentation and/or other materials provided with the
2726// distribution.
2727// * Neither the name of Google Inc. nor the names of its
2728// contributors may be used to endorse or promote products derived from
2729// this software without specific prior written permission.
2730//
2731// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2732// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2733// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2734// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2735// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2736// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2737// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2738// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2739// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2740// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2741// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2742//
2743// Google Test filepath utilities
2744//
2745// This header file declares classes and functions used internally by
2746// Google Test. They are subject to change without notice.
2747//
2748// This file is #included in gtest/internal/gtest-internal.h.
2749// Do not include this header file separately!
2750
2751// GOOGLETEST_CM0001 DO NOT DELETE
2752
2753#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
2754#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
2755
2756// Copyright 2005, Google Inc.
2757// All rights reserved.
2758//
2759// Redistribution and use in source and binary forms, with or without
2760// modification, are permitted provided that the following conditions are
2761// met:
2762//
2763// * Redistributions of source code must retain the above copyright
2764// notice, this list of conditions and the following disclaimer.
2765// * Redistributions in binary form must reproduce the above
2766// copyright notice, this list of conditions and the following disclaimer
2767// in the documentation and/or other materials provided with the
2768// distribution.
2769// * Neither the name of Google Inc. nor the names of its
2770// contributors may be used to endorse or promote products derived from
2771// this software without specific prior written permission.
2772//
2773// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2774// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2775// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2776// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2777// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2778// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2779// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2780// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2781// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2782// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2783// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2784//
2785// The Google C++ Testing and Mocking Framework (Google Test)
2786//
2787// This header file declares the String class and functions used internally by
2788// Google Test. They are subject to change without notice. They should not used
2789// by code external to Google Test.
2790//
2791// This header file is #included by gtest-internal.h.
2792// It should not be #included by other files.
2793
2794// GOOGLETEST_CM0001 DO NOT DELETE
2795
2796#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
2797#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
2798
2799#ifdef __BORLANDC__
2800// string.h is not guaranteed to provide strcpy on C++ Builder.
2801# include <mem.h>
2802#endif
2803
2804#include <string.h>
2805#include <string>
2806
2807
2808namespace testing {
2809namespace internal {
2810
2811// String - an abstract class holding static string utilities.
2812class GTEST_API_ String {
2813 public:
2814 // Static utility methods
2815
2816 // Clones a 0-terminated C string, allocating memory using new. The
2817 // caller is responsible for deleting the return value using
2818 // delete[]. Returns the cloned string, or NULL if the input is
2819 // NULL.
2820 //
2821 // This is different from strdup() in string.h, which allocates
2822 // memory using malloc().
2823 static const char* CloneCString(const char* c_str);
2824
2825#if GTEST_OS_WINDOWS_MOBILE
2826 // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
2827 // able to pass strings to Win32 APIs on CE we need to convert them
2828 // to 'Unicode', UTF-16.
2829
2830 // Creates a UTF-16 wide string from the given ANSI string, allocating
2831 // memory using new. The caller is responsible for deleting the return
2832 // value using delete[]. Returns the wide string, or NULL if the
2833 // input is NULL.
2834 //
2835 // The wide string is created using the ANSI codepage (CP_ACP) to
2836 // match the behaviour of the ANSI versions of Win32 calls and the
2837 // C runtime.
2838 static LPCWSTR AnsiToUtf16(const char* c_str);
2839
2840 // Creates an ANSI string from the given wide string, allocating
2841 // memory using new. The caller is responsible for deleting the return
2842 // value using delete[]. Returns the ANSI string, or NULL if the
2843 // input is NULL.
2844 //
2845 // The returned string is created using the ANSI codepage (CP_ACP) to
2846 // match the behaviour of the ANSI versions of Win32 calls and the
2847 // C runtime.
2848 static const char* Utf16ToAnsi(LPCWSTR utf16_str);
2849#endif
2850
2851 // Compares two C strings. Returns true if and only if they have the same
2852 // content.
2853 //
2854 // Unlike strcmp(), this function can handle NULL argument(s). A
2855 // NULL C string is considered different to any non-NULL C string,
2856 // including the empty string.
2857 static bool CStringEquals(const char* lhs, const char* rhs);
2858
2859 // Converts a wide C string to a String using the UTF-8 encoding.
2860 // NULL will be converted to "(null)". If an error occurred during
2861 // the conversion, "(failed to convert from wide string)" is
2862 // returned.
2863 static std::string ShowWideCString(const wchar_t* wide_c_str);
2864
2865 // Compares two wide C strings. Returns true if and only if they have the
2866 // same content.
2867 //
2868 // Unlike wcscmp(), this function can handle NULL argument(s). A
2869 // NULL C string is considered different to any non-NULL C string,
2870 // including the empty string.
2871 static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
2872
2873 // Compares two C strings, ignoring case. Returns true if and only if
2874 // they have the same content.
2875 //
2876 // Unlike strcasecmp(), this function can handle NULL argument(s).
2877 // A NULL C string is considered different to any non-NULL C string,
2878 // including the empty string.
2879 static bool CaseInsensitiveCStringEquals(const char* lhs,
2880 const char* rhs);
2881
2882 // Compares two wide C strings, ignoring case. Returns true if and only if
2883 // they have the same content.
2884 //
2885 // Unlike wcscasecmp(), this function can handle NULL argument(s).
2886 // A NULL C string is considered different to any non-NULL wide C string,
2887 // including the empty string.
2888 // NB: The implementations on different platforms slightly differ.
2889 // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
2890 // environment variable. On GNU platform this method uses wcscasecmp
2891 // which compares according to LC_CTYPE category of the current locale.
2892 // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
2893 // current locale.
2894 static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
2895 const wchar_t* rhs);
2896
2897 // Returns true if and only if the given string ends with the given suffix,
2898 // ignoring case. Any string is considered to end with an empty suffix.
2899 static bool EndsWithCaseInsensitive(
2900 const std::string& str, const std::string& suffix);
2901
2902 // Formats an int value as "%02d".
2903 static std::string FormatIntWidth2(int value); // "%02d" for width == 2
2904
2905 // Formats an int value as "%X".
2906 static std::string FormatHexInt(int value);
2907
2908 // Formats an int value as "%X".
2909 static std::string FormatHexUInt32(UInt32 value);
2910
2911 // Formats a byte as "%02X".
2912 static std::string FormatByte(unsigned char value);
2913
2914 private:
2915 String(); // Not meant to be instantiated.
2916}; // class String
2917
2918// Gets the content of the stringstream's buffer as an std::string. Each '\0'
2919// character in the buffer is replaced with "\\0".
2920GTEST_API_ std::string StringStreamToString(::std::stringstream* stream);
2921
2922} // namespace internal
2923} // namespace testing
2924
2925#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
2926
2928/* class A needs to have dll-interface to be used by clients of class B */)
2929
2930namespace testing {
2931namespace internal {
2932
2933// FilePath - a class for file and directory pathname manipulation which
2934// handles platform-specific conventions (like the pathname separator).
2935// Used for helper functions for naming files in a directory for xml output.
2936// Except for Set methods, all methods are const or static, which provides an
2937// "immutable value object" -- useful for peace of mind.
2938// A FilePath with a value ending in a path separator ("like/this/") represents
2939// a directory, otherwise it is assumed to represent a file. In either case,
2940// it may or may not represent an actual file or directory in the file system.
2941// Names are NOT checked for syntax correctness -- no checking for illegal
2942// characters, malformed paths, etc.
2943
2944class GTEST_API_ FilePath {
2945 public:
2946 FilePath() : pathname_("") { }
2947 FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
2948
2949 explicit FilePath(const std::string& pathname) : pathname_(pathname) {
2950 Normalize();
2951 }
2952
2953 FilePath& operator=(const FilePath& rhs) {
2954 Set(rhs);
2955 return *this;
2956 }
2957
2958 void Set(const FilePath& rhs) {
2959 pathname_ = rhs.pathname_;
2960 }
2961
2962 const std::string& string() const { return pathname_; }
2963 const char* c_str() const { return pathname_.c_str(); }
2964
2965 // Returns the current working directory, or "" if unsuccessful.
2966 static FilePath GetCurrentDir();
2967
2968 // Given directory = "dir", base_name = "test", number = 0,
2969 // extension = "xml", returns "dir/test.xml". If number is greater
2970 // than zero (e.g., 12), returns "dir/test_12.xml".
2971 // On Windows platform, uses \ as the separator rather than /.
2972 static FilePath MakeFileName(const FilePath& directory,
2973 const FilePath& base_name,
2974 int number,
2975 const char* extension);
2976
2977 // Given directory = "dir", relative_path = "test.xml",
2978 // returns "dir/test.xml".
2979 // On Windows, uses \ as the separator rather than /.
2980 static FilePath ConcatPaths(const FilePath& directory,
2981 const FilePath& relative_path);
2982
2983 // Returns a pathname for a file that does not currently exist. The pathname
2984 // will be directory/base_name.extension or
2985 // directory/base_name_<number>.extension if directory/base_name.extension
2986 // already exists. The number will be incremented until a pathname is found
2987 // that does not already exist.
2988 // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
2989 // There could be a race condition if two or more processes are calling this
2990 // function at the same time -- they could both pick the same filename.
2991 static FilePath GenerateUniqueFileName(const FilePath& directory,
2992 const FilePath& base_name,
2993 const char* extension);
2994
2995 // Returns true if and only if the path is "".
2996 bool IsEmpty() const { return pathname_.empty(); }
2997
2998 // If input name has a trailing separator character, removes it and returns
2999 // the name, otherwise return the name string unmodified.
3000 // On Windows platform, uses \ as the separator, other platforms use /.
3001 FilePath RemoveTrailingPathSeparator() const;
3002
3003 // Returns a copy of the FilePath with the directory part removed.
3004 // Example: FilePath("path/to/file").RemoveDirectoryName() returns
3005 // FilePath("file"). If there is no directory part ("just_a_file"), it returns
3006 // the FilePath unmodified. If there is no file part ("just_a_dir/") it
3007 // returns an empty FilePath ("").
3008 // On Windows platform, '\' is the path separator, otherwise it is '/'.
3009 FilePath RemoveDirectoryName() const;
3010
3011 // RemoveFileName returns the directory path with the filename removed.
3012 // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
3013 // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
3014 // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
3015 // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
3016 // On Windows platform, '\' is the path separator, otherwise it is '/'.
3017 FilePath RemoveFileName() const;
3018
3019 // Returns a copy of the FilePath with the case-insensitive extension removed.
3020 // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
3021 // FilePath("dir/file"). If a case-insensitive extension is not
3022 // found, returns a copy of the original FilePath.
3023 FilePath RemoveExtension(const char* extension) const;
3024
3025 // Creates directories so that path exists. Returns true if successful or if
3026 // the directories already exist; returns false if unable to create
3027 // directories for any reason. Will also return false if the FilePath does
3028 // not represent a directory (that is, it doesn't end with a path separator).
3029 bool CreateDirectoriesRecursively() const;
3030
3031 // Create the directory so that path exists. Returns true if successful or
3032 // if the directory already exists; returns false if unable to create the
3033 // directory for any reason, including if the parent directory does not
3034 // exist. Not named "CreateDirectory" because that's a macro on Windows.
3035 bool CreateFolder() const;
3036
3037 // Returns true if FilePath describes something in the file-system,
3038 // either a file, directory, or whatever, and that something exists.
3039 bool FileOrDirectoryExists() const;
3040
3041 // Returns true if pathname describes a directory in the file-system
3042 // that exists.
3043 bool DirectoryExists() const;
3044
3045 // Returns true if FilePath ends with a path separator, which indicates that
3046 // it is intended to represent a directory. Returns false otherwise.
3047 // This does NOT check that a directory (or file) actually exists.
3048 bool IsDirectory() const;
3049
3050 // Returns true if pathname describes a root directory. (Windows has one
3051 // root directory per disk drive.)
3052 bool IsRootDirectory() const;
3053
3054 // Returns true if pathname describes an absolute path.
3055 bool IsAbsolutePath() const;
3056
3057 private:
3058 // Replaces multiple consecutive separators with a single separator.
3059 // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
3060 // redundancies that might be in a pathname involving "." or "..".
3061 //
3062 // A pathname with multiple consecutive separators may occur either through
3063 // user error or as a result of some scripts or APIs that generate a pathname
3064 // with a trailing separator. On other platforms the same API or script
3065 // may NOT generate a pathname with a trailing "/". Then elsewhere that
3066 // pathname may have another "/" and pathname components added to it,
3067 // without checking for the separator already being there.
3068 // The script language and operating system may allow paths like "foo//bar"
3069 // but some of the functions in FilePath will not handle that correctly. In
3070 // particular, RemoveTrailingPathSeparator() only removes one separator, and
3071 // it is called in CreateDirectoriesRecursively() assuming that it will change
3072 // a pathname from directory syntax (trailing separator) to filename syntax.
3073 //
3074 // On Windows this method also replaces the alternate path separator '/' with
3075 // the primary path separator '\\', so that for example "bar\\/\\foo" becomes
3076 // "bar\\foo".
3077
3078 void Normalize();
3079
3080 // Returns a pointer to the last occurence of a valid path separator in
3081 // the FilePath. On Windows, for example, both '/' and '\' are valid path
3082 // separators. Returns NULL if no path separator was found.
3083 const char* FindLastPathSeparator() const;
3084
3085 std::string pathname_;
3086}; // class FilePath
3087
3088} // namespace internal
3089} // namespace testing
3090
3092
3093#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
3094// This file was GENERATED by command:
3095// pump.py gtest-type-util.h.pump
3096// DO NOT EDIT BY HAND!!!
3097
3098// Copyright 2008 Google Inc.
3099// All Rights Reserved.
3100//
3101// Redistribution and use in source and binary forms, with or without
3102// modification, are permitted provided that the following conditions are
3103// met:
3104//
3105// * Redistributions of source code must retain the above copyright
3106// notice, this list of conditions and the following disclaimer.
3107// * Redistributions in binary form must reproduce the above
3108// copyright notice, this list of conditions and the following disclaimer
3109// in the documentation and/or other materials provided with the
3110// distribution.
3111// * Neither the name of Google Inc. nor the names of its
3112// contributors may be used to endorse or promote products derived from
3113// this software without specific prior written permission.
3114//
3115// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3116// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3117// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3118// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3119// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3120// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3121// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3122// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3123// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3124// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3125// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3126
3127// Type utilities needed for implementing typed and type-parameterized
3128// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
3129//
3130// Currently we support at most 50 types in a list, and at most 50
3131// type-parameterized tests in one type-parameterized test suite.
3132// Please contact googletestframework@googlegroups.com if you need
3133// more.
3134
3135// GOOGLETEST_CM0001 DO NOT DELETE
3136
3137#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
3138#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
3139
3140
3141// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
3142// libstdc++ (which is where cxxabi.h comes from).
3143# if GTEST_HAS_CXXABI_H_
3144# include <cxxabi.h>
3145# elif defined(__HP_aCC)
3146# include <acxx_demangle.h>
3147# endif // GTEST_HASH_CXXABI_H_
3148
3149namespace testing {
3150namespace internal {
3151
3152// Canonicalizes a given name with respect to the Standard C++ Library.
3153// This handles removing the inline namespace within `std` that is
3154// used by various standard libraries (e.g., `std::__1`). Names outside
3155// of namespace std are returned unmodified.
3156inline std::string CanonicalizeForStdLibVersioning(std::string s) {
3157 static const char prefix[] = "std::__";
3158 if (s.compare(0, strlen(prefix), prefix) == 0) {
3159 std::string::size_type end = s.find("::", strlen(prefix));
3160 if (end != s.npos) {
3161 // Erase everything between the initial `std` and the second `::`.
3162 s.erase(strlen("std"), end - strlen("std"));
3163 }
3164 }
3165 return s;
3166}
3167
3168// GetTypeName<T>() returns a human-readable name of type T.
3169// NB: This function is also used in Google Mock, so don't move it inside of
3170// the typed-test-only section below.
3171template <typename T>
3172std::string GetTypeName() {
3173# if GTEST_HAS_RTTI
3174
3175 const char* const name = typeid(T).name();
3176# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
3177 int status = 0;
3178 // gcc's implementation of typeid(T).name() mangles the type name,
3179 // so we have to demangle it.
3180# if GTEST_HAS_CXXABI_H_
3181 using abi::__cxa_demangle;
3182# endif // GTEST_HAS_CXXABI_H_
3183 char* const readable_name = __cxa_demangle(name, nullptr, nullptr, &status);
3184 const std::string name_str(status == 0 ? readable_name : name);
3185 free(readable_name);
3186 return CanonicalizeForStdLibVersioning(name_str);
3187# else
3188 return name;
3189# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
3190
3191# else
3192
3193 return "<type>";
3194
3195# endif // GTEST_HAS_RTTI
3196}
3197
3198#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
3199
3200// A unique type used as the default value for the arguments of class
3201// template Types. This allows us to simulate variadic templates
3202// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
3203// support directly.
3204struct None {};
3205
3206// The following family of struct and struct templates are used to
3207// represent type lists. In particular, TypesN<T1, T2, ..., TN>
3208// represents a type list with N types (T1, T2, ..., and TN) in it.
3209// Except for Types0, every struct in the family has two member types:
3210// Head for the first type in the list, and Tail for the rest of the
3211// list.
3212
3213// The empty type list.
3214struct Types0 {};
3215
3216// Type lists of length 1, 2, 3, and so on.
3217
3218template <typename T1>
3219struct Types1 {
3220 typedef T1 Head;
3221 typedef Types0 Tail;
3222};
3223template <typename T1, typename T2>
3224struct Types2 {
3225 typedef T1 Head;
3226 typedef Types1<T2> Tail;
3227};
3228
3229template <typename T1, typename T2, typename T3>
3230struct Types3 {
3231 typedef T1 Head;
3232 typedef Types2<T2, T3> Tail;
3233};
3234
3235template <typename T1, typename T2, typename T3, typename T4>
3236struct Types4 {
3237 typedef T1 Head;
3238 typedef Types3<T2, T3, T4> Tail;
3239};
3240
3241template <typename T1, typename T2, typename T3, typename T4, typename T5>
3242struct Types5 {
3243 typedef T1 Head;
3244 typedef Types4<T2, T3, T4, T5> Tail;
3245};
3246
3247template <typename T1, typename T2, typename T3, typename T4, typename T5,
3248 typename T6>
3249struct Types6 {
3250 typedef T1 Head;
3251 typedef Types5<T2, T3, T4, T5, T6> Tail;
3252};
3253
3254template <typename T1, typename T2, typename T3, typename T4, typename T5,
3255 typename T6, typename T7>
3256struct Types7 {
3257 typedef T1 Head;
3258 typedef Types6<T2, T3, T4, T5, T6, T7> Tail;
3259};
3260
3261template <typename T1, typename T2, typename T3, typename T4, typename T5,
3262 typename T6, typename T7, typename T8>
3263struct Types8 {
3264 typedef T1 Head;
3265 typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;
3266};
3267
3268template <typename T1, typename T2, typename T3, typename T4, typename T5,
3269 typename T6, typename T7, typename T8, typename T9>
3270struct Types9 {
3271 typedef T1 Head;
3272 typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
3273};
3274
3275template <typename T1, typename T2, typename T3, typename T4, typename T5,
3276 typename T6, typename T7, typename T8, typename T9, typename T10>
3277struct Types10 {
3278 typedef T1 Head;
3279 typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
3280};
3281
3282template <typename T1, typename T2, typename T3, typename T4, typename T5,
3283 typename T6, typename T7, typename T8, typename T9, typename T10,
3284 typename T11>
3285struct Types11 {
3286 typedef T1 Head;
3287 typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
3288};
3289
3290template <typename T1, typename T2, typename T3, typename T4, typename T5,
3291 typename T6, typename T7, typename T8, typename T9, typename T10,
3292 typename T11, typename T12>
3293struct Types12 {
3294 typedef T1 Head;
3295 typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
3296};
3297
3298template <typename T1, typename T2, typename T3, typename T4, typename T5,
3299 typename T6, typename T7, typename T8, typename T9, typename T10,
3300 typename T11, typename T12, typename T13>
3301struct Types13 {
3302 typedef T1 Head;
3303 typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
3304};
3305
3306template <typename T1, typename T2, typename T3, typename T4, typename T5,
3307 typename T6, typename T7, typename T8, typename T9, typename T10,
3308 typename T11, typename T12, typename T13, typename T14>
3309struct Types14 {
3310 typedef T1 Head;
3311 typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;
3312};
3313
3314template <typename T1, typename T2, typename T3, typename T4, typename T5,
3315 typename T6, typename T7, typename T8, typename T9, typename T10,
3316 typename T11, typename T12, typename T13, typename T14, typename T15>
3317struct Types15 {
3318 typedef T1 Head;
3319 typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
3320 T15> Tail;
3321};
3322
3323template <typename T1, typename T2, typename T3, typename T4, typename T5,
3324 typename T6, typename T7, typename T8, typename T9, typename T10,
3325 typename T11, typename T12, typename T13, typename T14, typename T15,
3326 typename T16>
3327struct Types16 {
3328 typedef T1 Head;
3329 typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3330 T16> Tail;
3331};
3332
3333template <typename T1, typename T2, typename T3, typename T4, typename T5,
3334 typename T6, typename T7, typename T8, typename T9, typename T10,
3335 typename T11, typename T12, typename T13, typename T14, typename T15,
3336 typename T16, typename T17>
3337struct Types17 {
3338 typedef T1 Head;
3339 typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3340 T16, T17> Tail;
3341};
3342
3343template <typename T1, typename T2, typename T3, typename T4, typename T5,
3344 typename T6, typename T7, typename T8, typename T9, typename T10,
3345 typename T11, typename T12, typename T13, typename T14, typename T15,
3346 typename T16, typename T17, typename T18>
3347struct Types18 {
3348 typedef T1 Head;
3349 typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3350 T16, T17, T18> Tail;
3351};
3352
3353template <typename T1, typename T2, typename T3, typename T4, typename T5,
3354 typename T6, typename T7, typename T8, typename T9, typename T10,
3355 typename T11, typename T12, typename T13, typename T14, typename T15,
3356 typename T16, typename T17, typename T18, typename T19>
3357struct Types19 {
3358 typedef T1 Head;
3359 typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3360 T16, T17, T18, T19> Tail;
3361};
3362
3363template <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, typename T13, typename T14, typename T15,
3366 typename T16, typename T17, typename T18, typename T19, typename T20>
3367struct Types20 {
3368 typedef T1 Head;
3369 typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3370 T16, T17, T18, T19, T20> Tail;
3371};
3372
3373template <typename T1, typename T2, typename T3, typename T4, typename T5,
3374 typename T6, typename T7, typename T8, typename T9, typename T10,
3375 typename T11, typename T12, typename T13, typename T14, typename T15,
3376 typename T16, typename T17, typename T18, typename T19, typename T20,
3377 typename T21>
3378struct Types21 {
3379 typedef T1 Head;
3380 typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3381 T16, T17, T18, T19, T20, T21> Tail;
3382};
3383
3384template <typename T1, typename T2, typename T3, typename T4, typename T5,
3385 typename T6, typename T7, typename T8, typename T9, typename T10,
3386 typename T11, typename T12, typename T13, typename T14, typename T15,
3387 typename T16, typename T17, typename T18, typename T19, typename T20,
3388 typename T21, typename T22>
3389struct Types22 {
3390 typedef T1 Head;
3391 typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3392 T16, T17, T18, T19, T20, T21, T22> Tail;
3393};
3394
3395template <typename T1, typename T2, typename T3, typename T4, typename T5,
3396 typename T6, typename T7, typename T8, typename T9, typename T10,
3397 typename T11, typename T12, typename T13, typename T14, typename T15,
3398 typename T16, typename T17, typename T18, typename T19, typename T20,
3399 typename T21, typename T22, typename T23>
3400struct Types23 {
3401 typedef T1 Head;
3402 typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3403 T16, T17, T18, T19, T20, T21, T22, T23> Tail;
3404};
3405
3406template <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, typename T18, typename T19, typename T20,
3410 typename T21, typename T22, typename T23, typename T24>
3411struct Types24 {
3412 typedef T1 Head;
3413 typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3414 T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
3415};
3416
3417template <typename T1, typename T2, typename T3, typename T4, typename T5,
3418 typename T6, typename T7, typename T8, typename T9, typename T10,
3419 typename T11, typename T12, typename T13, typename T14, typename T15,
3420 typename T16, typename T17, typename T18, typename T19, typename T20,
3421 typename T21, typename T22, typename T23, typename T24, typename T25>
3422struct Types25 {
3423 typedef T1 Head;
3424 typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3425 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
3426};
3427
3428template <typename T1, typename T2, typename T3, typename T4, typename T5,
3429 typename T6, typename T7, typename T8, typename T9, typename T10,
3430 typename T11, typename T12, typename T13, typename T14, typename T15,
3431 typename T16, typename T17, typename T18, typename T19, typename T20,
3432 typename T21, typename T22, typename T23, typename T24, typename T25,
3433 typename T26>
3434struct Types26 {
3435 typedef T1 Head;
3436 typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3437 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
3438};
3439
3440template <typename T1, typename T2, typename T3, typename T4, typename T5,
3441 typename T6, typename T7, typename T8, typename T9, typename T10,
3442 typename T11, typename T12, typename T13, typename T14, typename T15,
3443 typename T16, typename T17, typename T18, typename T19, typename T20,
3444 typename T21, typename T22, typename T23, typename T24, typename T25,
3445 typename T26, typename T27>
3446struct Types27 {
3447 typedef T1 Head;
3448 typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3449 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
3450};
3451
3452template <typename T1, typename T2, typename T3, typename T4, typename T5,
3453 typename T6, typename T7, typename T8, typename T9, typename T10,
3454 typename T11, typename T12, typename T13, typename T14, typename T15,
3455 typename T16, typename T17, typename T18, typename T19, typename T20,
3456 typename T21, typename T22, typename T23, typename T24, typename T25,
3457 typename T26, typename T27, typename T28>
3458struct Types28 {
3459 typedef T1 Head;
3460 typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3461 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;
3462};
3463
3464template <typename T1, typename T2, typename T3, typename T4, typename T5,
3465 typename T6, typename T7, typename T8, typename T9, typename T10,
3466 typename T11, typename T12, typename T13, typename T14, typename T15,
3467 typename T16, typename T17, typename T18, typename T19, typename T20,
3468 typename T21, typename T22, typename T23, typename T24, typename T25,
3469 typename T26, typename T27, typename T28, typename T29>
3470struct Types29 {
3471 typedef T1 Head;
3472 typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3473 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
3474 T29> Tail;
3475};
3476
3477template <typename T1, typename T2, typename T3, typename T4, typename T5,
3478 typename T6, typename T7, typename T8, typename T9, typename T10,
3479 typename T11, typename T12, typename T13, typename T14, typename T15,
3480 typename T16, typename T17, typename T18, typename T19, typename T20,
3481 typename T21, typename T22, typename T23, typename T24, typename T25,
3482 typename T26, typename T27, typename T28, typename T29, typename T30>
3483struct Types30 {
3484 typedef T1 Head;
3485 typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3486 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3487 T30> Tail;
3488};
3489
3490template <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 typename T26, typename T27, typename T28, typename T29, typename T30,
3496 typename T31>
3497struct Types31 {
3498 typedef T1 Head;
3499 typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3500 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3501 T30, T31> Tail;
3502};
3503
3504template <typename T1, typename T2, typename T3, typename T4, typename T5,
3505 typename T6, typename T7, typename T8, typename T9, typename T10,
3506 typename T11, typename T12, typename T13, typename T14, typename T15,
3507 typename T16, typename T17, typename T18, typename T19, typename T20,
3508 typename T21, typename T22, typename T23, typename T24, typename T25,
3509 typename T26, typename T27, typename T28, typename T29, typename T30,
3510 typename T31, typename T32>
3511struct Types32 {
3512 typedef T1 Head;
3513 typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3514 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3515 T30, T31, T32> Tail;
3516};
3517
3518template <typename T1, typename T2, typename T3, typename T4, typename T5,
3519 typename T6, typename T7, typename T8, typename T9, typename T10,
3520 typename T11, typename T12, typename T13, typename T14, typename T15,
3521 typename T16, typename T17, typename T18, typename T19, typename T20,
3522 typename T21, typename T22, typename T23, typename T24, typename T25,
3523 typename T26, typename T27, typename T28, typename T29, typename T30,
3524 typename T31, typename T32, typename T33>
3525struct Types33 {
3526 typedef T1 Head;
3527 typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3528 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3529 T30, T31, T32, T33> Tail;
3530};
3531
3532template <typename T1, typename T2, typename T3, typename T4, typename T5,
3533 typename T6, typename T7, typename T8, typename T9, typename T10,
3534 typename T11, typename T12, typename T13, typename T14, typename T15,
3535 typename T16, typename T17, typename T18, typename T19, typename T20,
3536 typename T21, typename T22, typename T23, typename T24, typename T25,
3537 typename T26, typename T27, typename T28, typename T29, typename T30,
3538 typename T31, typename T32, typename T33, typename T34>
3539struct Types34 {
3540 typedef T1 Head;
3541 typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3542 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3543 T30, T31, T32, T33, T34> Tail;
3544};
3545
3546template <typename T1, typename T2, typename T3, typename T4, typename T5,
3547 typename T6, typename T7, typename T8, typename T9, typename T10,
3548 typename T11, typename T12, typename T13, typename T14, typename T15,
3549 typename T16, typename T17, typename T18, typename T19, typename T20,
3550 typename T21, typename T22, typename T23, typename T24, typename T25,
3551 typename T26, typename T27, typename T28, typename T29, typename T30,
3552 typename T31, typename T32, typename T33, typename T34, typename T35>
3553struct Types35 {
3554 typedef T1 Head;
3555 typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3556 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3557 T30, T31, T32, T33, T34, T35> Tail;
3558};
3559
3560template <typename T1, typename T2, typename T3, typename T4, typename T5,
3561 typename T6, typename T7, typename T8, typename T9, typename T10,
3562 typename T11, typename T12, typename T13, typename T14, typename T15,
3563 typename T16, typename T17, typename T18, typename T19, typename T20,
3564 typename T21, typename T22, typename T23, typename T24, typename T25,
3565 typename T26, typename T27, typename T28, typename T29, typename T30,
3566 typename T31, typename T32, typename T33, typename T34, typename T35,
3567 typename T36>
3568struct Types36 {
3569 typedef T1 Head;
3570 typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3571 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3572 T30, T31, T32, T33, T34, T35, T36> Tail;
3573};
3574
3575template <typename T1, typename T2, typename T3, typename T4, typename T5,
3576 typename T6, typename T7, typename T8, typename T9, typename T10,
3577 typename T11, typename T12, typename T13, typename T14, typename T15,
3578 typename T16, typename T17, typename T18, typename T19, typename T20,
3579 typename T21, typename T22, typename T23, typename T24, typename T25,
3580 typename T26, typename T27, typename T28, typename T29, typename T30,
3581 typename T31, typename T32, typename T33, typename T34, typename T35,
3582 typename T36, typename T37>
3583struct Types37 {
3584 typedef T1 Head;
3585 typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3586 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3587 T30, T31, T32, T33, T34, T35, T36, T37> Tail;
3588};
3589
3590template <typename T1, typename T2, typename T3, typename T4, typename T5,
3591 typename T6, typename T7, typename T8, typename T9, typename T10,
3592 typename T11, typename T12, typename T13, typename T14, typename T15,
3593 typename T16, typename T17, typename T18, typename T19, typename T20,
3594 typename T21, typename T22, typename T23, typename T24, typename T25,
3595 typename T26, typename T27, typename T28, typename T29, typename T30,
3596 typename T31, typename T32, typename T33, typename T34, typename T35,
3597 typename T36, typename T37, typename T38>
3598struct Types38 {
3599 typedef T1 Head;
3600 typedef Types37<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, T34, T35, T36, T37, T38> Tail;
3603};
3604
3605template <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, typename T35,
3612 typename T36, typename T37, typename T38, typename T39>
3613struct Types39 {
3614 typedef T1 Head;
3615 typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3616 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3617 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
3618};
3619
3620template <typename T1, typename T2, typename T3, typename T4, typename T5,
3621 typename T6, typename T7, typename T8, typename T9, typename T10,
3622 typename T11, typename T12, typename T13, typename T14, typename T15,
3623 typename T16, typename T17, typename T18, typename T19, typename T20,
3624 typename T21, typename T22, typename T23, typename T24, typename T25,
3625 typename T26, typename T27, typename T28, typename T29, typename T30,
3626 typename T31, typename T32, typename T33, typename T34, typename T35,
3627 typename T36, typename T37, typename T38, typename T39, typename T40>
3628struct Types40 {
3629 typedef T1 Head;
3630 typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3631 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3632 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
3633};
3634
3635template <typename T1, typename T2, typename T3, typename T4, typename T5,
3636 typename T6, typename T7, typename T8, typename T9, typename T10,
3637 typename T11, typename T12, typename T13, typename T14, typename T15,
3638 typename T16, typename T17, typename T18, typename T19, typename T20,
3639 typename T21, typename T22, typename T23, typename T24, typename T25,
3640 typename T26, typename T27, typename T28, typename T29, typename T30,
3641 typename T31, typename T32, typename T33, typename T34, typename T35,
3642 typename T36, typename T37, typename T38, typename T39, typename T40,
3643 typename T41>
3644struct Types41 {
3645 typedef T1 Head;
3646 typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3647 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3648 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
3649};
3650
3651template <typename T1, typename T2, typename T3, typename T4, typename T5,
3652 typename T6, typename T7, typename T8, typename T9, typename T10,
3653 typename T11, typename T12, typename T13, typename T14, typename T15,
3654 typename T16, typename T17, typename T18, typename T19, typename T20,
3655 typename T21, typename T22, typename T23, typename T24, typename T25,
3656 typename T26, typename T27, typename T28, typename T29, typename T30,
3657 typename T31, typename T32, typename T33, typename T34, typename T35,
3658 typename T36, typename T37, typename T38, typename T39, typename T40,
3659 typename T41, typename T42>
3660struct Types42 {
3661 typedef T1 Head;
3662 typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3663 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3664 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;
3665};
3666
3667template <typename T1, typename T2, typename T3, typename T4, typename T5,
3668 typename T6, typename T7, typename T8, typename T9, typename T10,
3669 typename T11, typename T12, typename T13, typename T14, typename T15,
3670 typename T16, typename T17, typename T18, typename T19, typename T20,
3671 typename T21, typename T22, typename T23, typename T24, typename T25,
3672 typename T26, typename T27, typename T28, typename T29, typename T30,
3673 typename T31, typename T32, typename T33, typename T34, typename T35,
3674 typename T36, typename T37, typename T38, typename T39, typename T40,
3675 typename T41, typename T42, typename T43>
3676struct Types43 {
3677 typedef T1 Head;
3678 typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3679 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3680 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
3681 T43> Tail;
3682};
3683
3684template <typename T1, typename T2, typename T3, typename T4, typename T5,
3685 typename T6, typename T7, typename T8, typename T9, typename T10,
3686 typename T11, typename T12, typename T13, typename T14, typename T15,
3687 typename T16, typename T17, typename T18, typename T19, typename T20,
3688 typename T21, typename T22, typename T23, typename T24, typename T25,
3689 typename T26, typename T27, typename T28, typename T29, typename T30,
3690 typename T31, typename T32, typename T33, typename T34, typename T35,
3691 typename T36, typename T37, typename T38, typename T39, typename T40,
3692 typename T41, typename T42, typename T43, typename T44>
3693struct Types44 {
3694 typedef T1 Head;
3695 typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3696 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3697 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3698 T44> Tail;
3699};
3700
3701template <typename T1, typename T2, typename T3, typename T4, typename T5,
3702 typename T6, typename T7, typename T8, typename T9, typename T10,
3703 typename T11, typename T12, typename T13, typename T14, typename T15,
3704 typename T16, typename T17, typename T18, typename T19, typename T20,
3705 typename T21, typename T22, typename T23, typename T24, typename T25,
3706 typename T26, typename T27, typename T28, typename T29, typename T30,
3707 typename T31, typename T32, typename T33, typename T34, typename T35,
3708 typename T36, typename T37, typename T38, typename T39, typename T40,
3709 typename T41, typename T42, typename T43, typename T44, typename T45>
3710struct Types45 {
3711 typedef T1 Head;
3712 typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3713 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3714 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3715 T44, T45> Tail;
3716};
3717
3718template <typename T1, typename T2, typename T3, typename T4, typename T5,
3719 typename T6, typename T7, typename T8, typename T9, typename T10,
3720 typename T11, typename T12, typename T13, typename T14, typename T15,
3721 typename T16, typename T17, typename T18, typename T19, typename T20,
3722 typename T21, typename T22, typename T23, typename T24, typename T25,
3723 typename T26, typename T27, typename T28, typename T29, typename T30,
3724 typename T31, typename T32, typename T33, typename T34, typename T35,
3725 typename T36, typename T37, typename T38, typename T39, typename T40,
3726 typename T41, typename T42, typename T43, typename T44, typename T45,
3727 typename T46>
3728struct Types46 {
3729 typedef T1 Head;
3730 typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3731 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3732 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3733 T44, T45, T46> Tail;
3734};
3735
3736template <typename T1, typename T2, typename T3, typename T4, typename T5,
3737 typename T6, typename T7, typename T8, typename T9, typename T10,
3738 typename T11, typename T12, typename T13, typename T14, typename T15,
3739 typename T16, typename T17, typename T18, typename T19, typename T20,
3740 typename T21, typename T22, typename T23, typename T24, typename T25,
3741 typename T26, typename T27, typename T28, typename T29, typename T30,
3742 typename T31, typename T32, typename T33, typename T34, typename T35,
3743 typename T36, typename T37, typename T38, typename T39, typename T40,
3744 typename T41, typename T42, typename T43, typename T44, typename T45,
3745 typename T46, typename T47>
3746struct Types47 {
3747 typedef T1 Head;
3748 typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3749 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3750 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3751 T44, T45, T46, T47> Tail;
3752};
3753
3754template <typename T1, typename T2, typename T3, typename T4, typename T5,
3755 typename T6, typename T7, typename T8, typename T9, typename T10,
3756 typename T11, typename T12, typename T13, typename T14, typename T15,
3757 typename T16, typename T17, typename T18, typename T19, typename T20,
3758 typename T21, typename T22, typename T23, typename T24, typename T25,
3759 typename T26, typename T27, typename T28, typename T29, typename T30,
3760 typename T31, typename T32, typename T33, typename T34, typename T35,
3761 typename T36, typename T37, typename T38, typename T39, typename T40,
3762 typename T41, typename T42, typename T43, typename T44, typename T45,
3763 typename T46, typename T47, typename T48>
3764struct Types48 {
3765 typedef T1 Head;
3766 typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3767 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3768 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3769 T44, T45, T46, T47, T48> Tail;
3770};
3771
3772template <typename T1, typename T2, typename T3, typename T4, typename T5,
3773 typename T6, typename T7, typename T8, typename T9, typename T10,
3774 typename T11, typename T12, typename T13, typename T14, typename T15,
3775 typename T16, typename T17, typename T18, typename T19, typename T20,
3776 typename T21, typename T22, typename T23, typename T24, typename T25,
3777 typename T26, typename T27, typename T28, typename T29, typename T30,
3778 typename T31, typename T32, typename T33, typename T34, typename T35,
3779 typename T36, typename T37, typename T38, typename T39, typename T40,
3780 typename T41, typename T42, typename T43, typename T44, typename T45,
3781 typename T46, typename T47, typename T48, typename T49>
3782struct Types49 {
3783 typedef T1 Head;
3784 typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3785 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3786 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3787 T44, T45, T46, T47, T48, T49> Tail;
3788};
3789
3790template <typename T1, typename T2, typename T3, typename T4, typename T5,
3791 typename T6, typename T7, typename T8, typename T9, typename T10,
3792 typename T11, typename T12, typename T13, typename T14, typename T15,
3793 typename T16, typename T17, typename T18, typename T19, typename T20,
3794 typename T21, typename T22, typename T23, typename T24, typename T25,
3795 typename T26, typename T27, typename T28, typename T29, typename T30,
3796 typename T31, typename T32, typename T33, typename T34, typename T35,
3797 typename T36, typename T37, typename T38, typename T39, typename T40,
3798 typename T41, typename T42, typename T43, typename T44, typename T45,
3799 typename T46, typename T47, typename T48, typename T49, typename T50>
3800struct Types50 {
3801 typedef T1 Head;
3802 typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3803 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3804 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
3805 T44, T45, T46, T47, T48, T49, T50> Tail;
3806};
3807
3808
3809} // namespace internal
3810
3811// We don't want to require the users to write TypesN<...> directly,
3812// as that would require them to count the length. Types<...> is much
3813// easier to write, but generates horrible messages when there is a
3814// compiler error, as gcc insists on printing out each template
3815// argument, even if it has the default value (this means Types<int>
3816// will appear as Types<int, None, None, ..., None> in the compiler
3817// errors).
3818//
3819// Our solution is to combine the best part of the two approaches: a
3820// user would write Types<T1, ..., TN>, and Google Test will translate
3821// that to TypesN<T1, ..., TN> internally to make error messages
3822// readable. The translation is done by the 'type' member of the
3823// Types template.
3824template <typename T1 = internal::None, typename T2 = internal::None,
3825 typename T3 = internal::None, typename T4 = internal::None,
3826 typename T5 = internal::None, typename T6 = internal::None,
3827 typename T7 = internal::None, typename T8 = internal::None,
3828 typename T9 = internal::None, typename T10 = internal::None,
3829 typename T11 = internal::None, typename T12 = internal::None,
3830 typename T13 = internal::None, typename T14 = internal::None,
3831 typename T15 = internal::None, typename T16 = internal::None,
3832 typename T17 = internal::None, typename T18 = internal::None,
3833 typename T19 = internal::None, typename T20 = internal::None,
3834 typename T21 = internal::None, typename T22 = internal::None,
3835 typename T23 = internal::None, typename T24 = internal::None,
3836 typename T25 = internal::None, typename T26 = internal::None,
3837 typename T27 = internal::None, typename T28 = internal::None,
3838 typename T29 = internal::None, typename T30 = internal::None,
3839 typename T31 = internal::None, typename T32 = internal::None,
3840 typename T33 = internal::None, typename T34 = internal::None,
3841 typename T35 = internal::None, typename T36 = internal::None,
3842 typename T37 = internal::None, typename T38 = internal::None,
3843 typename T39 = internal::None, typename T40 = internal::None,
3844 typename T41 = internal::None, typename T42 = internal::None,
3845 typename T43 = internal::None, typename T44 = internal::None,
3846 typename T45 = internal::None, typename T46 = internal::None,
3847 typename T47 = internal::None, typename T48 = internal::None,
3848 typename T49 = internal::None, typename T50 = internal::None>
3849struct Types {
3850 typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
3851 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
3852 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
3853 T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
3854};
3855
3856template <>
3857struct Types<internal::None, internal::None, internal::None, internal::None,
3858 internal::None, internal::None, internal::None, internal::None,
3859 internal::None, internal::None, internal::None, internal::None,
3860 internal::None, internal::None, internal::None, internal::None,
3861 internal::None, internal::None, internal::None, internal::None,
3862 internal::None, internal::None, internal::None, internal::None,
3863 internal::None, internal::None, internal::None, internal::None,
3864 internal::None, internal::None, internal::None, internal::None,
3865 internal::None, internal::None, internal::None, internal::None,
3866 internal::None, internal::None, internal::None, internal::None,
3867 internal::None, internal::None, internal::None, internal::None,
3868 internal::None, internal::None, internal::None, internal::None,
3869 internal::None, internal::None> {
3870 typedef internal::Types0 type;
3871};
3872template <typename T1>
3873struct Types<T1, internal::None, internal::None, internal::None,
3874 internal::None, internal::None, internal::None, internal::None,
3875 internal::None, internal::None, internal::None, internal::None,
3876 internal::None, internal::None, internal::None, internal::None,
3877 internal::None, internal::None, internal::None, internal::None,
3878 internal::None, internal::None, internal::None, internal::None,
3879 internal::None, internal::None, internal::None, internal::None,
3880 internal::None, internal::None, internal::None, internal::None,
3881 internal::None, internal::None, internal::None, internal::None,
3882 internal::None, internal::None, internal::None, internal::None,
3883 internal::None, internal::None, internal::None, internal::None,
3884 internal::None, internal::None, internal::None, internal::None,
3885 internal::None, internal::None> {
3886 typedef internal::Types1<T1> type;
3887};
3888template <typename T1, typename T2>
3889struct Types<T1, T2, internal::None, internal::None, internal::None,
3890 internal::None, internal::None, internal::None, internal::None,
3891 internal::None, internal::None, internal::None, internal::None,
3892 internal::None, internal::None, internal::None, internal::None,
3893 internal::None, internal::None, internal::None, internal::None,
3894 internal::None, internal::None, internal::None, internal::None,
3895 internal::None, internal::None, internal::None, internal::None,
3896 internal::None, internal::None, internal::None, internal::None,
3897 internal::None, internal::None, internal::None, internal::None,
3898 internal::None, internal::None, internal::None, internal::None,
3899 internal::None, internal::None, internal::None, internal::None,
3900 internal::None, internal::None, internal::None, internal::None,
3901 internal::None> {
3902 typedef internal::Types2<T1, T2> type;
3903};
3904template <typename T1, typename T2, typename T3>
3905struct Types<T1, T2, T3, internal::None, internal::None, internal::None,
3906 internal::None, internal::None, internal::None, internal::None,
3907 internal::None, internal::None, internal::None, internal::None,
3908 internal::None, internal::None, internal::None, internal::None,
3909 internal::None, internal::None, internal::None, internal::None,
3910 internal::None, internal::None, internal::None, internal::None,
3911 internal::None, internal::None, internal::None, internal::None,
3912 internal::None, internal::None, internal::None, internal::None,
3913 internal::None, internal::None, internal::None, internal::None,
3914 internal::None, internal::None, internal::None, internal::None,
3915 internal::None, internal::None, internal::None, internal::None,
3916 internal::None, internal::None, internal::None, internal::None> {
3917 typedef internal::Types3<T1, T2, T3> type;
3918};
3919template <typename T1, typename T2, typename T3, typename T4>
3920struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None,
3921 internal::None, internal::None, internal::None, internal::None,
3922 internal::None, internal::None, internal::None, internal::None,
3923 internal::None, internal::None, internal::None, internal::None,
3924 internal::None, internal::None, internal::None, internal::None,
3925 internal::None, internal::None, internal::None, internal::None,
3926 internal::None, internal::None, internal::None, internal::None,
3927 internal::None, internal::None, internal::None, internal::None,
3928 internal::None, internal::None, internal::None, internal::None,
3929 internal::None, internal::None, internal::None, internal::None,
3930 internal::None, internal::None, internal::None, internal::None,
3931 internal::None, internal::None, internal::None> {
3932 typedef internal::Types4<T1, T2, T3, T4> type;
3933};
3934template <typename T1, typename T2, typename T3, typename T4, typename T5>
3935struct Types<T1, T2, T3, T4, T5, 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, internal::None, internal::None,
3943 internal::None, internal::None, internal::None, internal::None,
3944 internal::None, internal::None, internal::None, internal::None,
3945 internal::None, internal::None, internal::None, internal::None,
3946 internal::None, internal::None, internal::None> {
3947 typedef internal::Types5<T1, T2, T3, T4, T5> type;
3948};
3949template <typename T1, typename T2, typename T3, typename T4, typename T5,
3950 typename T6>
3951struct Types<T1, T2, T3, T4, T5, T6, 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, internal::None, internal::None,
3959 internal::None, internal::None, internal::None, internal::None,
3960 internal::None, internal::None, internal::None, internal::None,
3961 internal::None, internal::None, internal::None, internal::None,
3962 internal::None, internal::None> {
3963 typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;
3964};
3965template <typename T1, typename T2, typename T3, typename T4, typename T5,
3966 typename T6, typename T7>
3967struct Types<T1, T2, T3, T4, T5, T6, T7, 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, internal::None, internal::None, internal::None,
3975 internal::None, internal::None, internal::None, internal::None,
3976 internal::None, internal::None, internal::None, internal::None,
3977 internal::None, internal::None, internal::None, internal::None,
3978 internal::None> {
3979 typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;
3980};
3981template <typename T1, typename T2, typename T3, typename T4, typename T5,
3982 typename T6, typename T7, typename T8>
3983struct Types<T1, T2, T3, T4, T5, T6, T7, T8, 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 internal::None, internal::None, internal::None, internal::None,
3991 internal::None, internal::None, internal::None, internal::None,
3992 internal::None, internal::None, internal::None, internal::None,
3993 internal::None, internal::None, internal::None, internal::None> {
3994 typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;
3995};
3996template <typename T1, typename T2, typename T3, typename T4, typename T5,
3997 typename T6, typename T7, typename T8, typename T9>
3998struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, 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, internal::None,
4005 internal::None, internal::None, internal::None, internal::None,
4006 internal::None, internal::None, internal::None, internal::None,
4007 internal::None, internal::None, internal::None, internal::None,
4008 internal::None, internal::None, internal::None, internal::None> {
4009 typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
4010};
4011template <typename T1, typename T2, typename T3, typename T4, typename T5,
4012 typename T6, typename T7, typename T8, typename T9, typename T10>
4013struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, 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, internal::None,
4020 internal::None, internal::None, internal::None, internal::None,
4021 internal::None, internal::None, internal::None, internal::None,
4022 internal::None, internal::None, internal::None, internal::None,
4023 internal::None, internal::None, internal::None> {
4024 typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
4025};
4026template <typename T1, typename T2, typename T3, typename T4, typename T5,
4027 typename T6, typename T7, typename T8, typename T9, typename T10,
4028 typename T11>
4029struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, 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, internal::None, internal::None,
4036 internal::None, internal::None, internal::None, internal::None,
4037 internal::None, internal::None, internal::None, internal::None,
4038 internal::None, internal::None, internal::None, internal::None,
4039 internal::None, internal::None> {
4040 typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
4041};
4042template <typename T1, typename T2, typename T3, typename T4, typename T5,
4043 typename T6, typename T7, typename T8, typename T9, typename T10,
4044 typename T11, typename T12>
4045struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, 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, internal::None, internal::None, internal::None,
4052 internal::None, internal::None, internal::None, internal::None,
4053 internal::None, internal::None, internal::None, internal::None,
4054 internal::None, internal::None, internal::None, internal::None,
4055 internal::None> {
4056 typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
4057 T12> type;
4058};
4059template <typename T1, typename T2, typename T3, typename T4, typename T5,
4060 typename T6, typename T7, typename T8, typename T9, typename T10,
4061 typename T11, typename T12, typename T13>
4062struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
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 internal::None, internal::None, internal::None, internal::None,
4068 internal::None, internal::None, internal::None, internal::None,
4069 internal::None, internal::None, internal::None, internal::None,
4070 internal::None, internal::None, internal::None, internal::None,
4071 internal::None, internal::None, internal::None, internal::None,
4072 internal::None> {
4073 typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4074 T13> type;
4075};
4076template <typename T1, typename T2, typename T3, typename T4, typename T5,
4077 typename T6, typename T7, typename T8, typename T9, typename T10,
4078 typename T11, typename T12, typename T13, typename T14>
4079struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4080 internal::None, internal::None, internal::None, internal::None,
4081 internal::None, internal::None, internal::None, internal::None,
4082 internal::None, internal::None, internal::None, internal::None,
4083 internal::None, internal::None, internal::None, internal::None,
4084 internal::None, internal::None, internal::None, internal::None,
4085 internal::None, internal::None, internal::None, internal::None,
4086 internal::None, internal::None, internal::None, internal::None,
4087 internal::None, internal::None, internal::None, internal::None,
4088 internal::None, internal::None, internal::None, internal::None> {
4089 typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4090 T13, T14> type;
4091};
4092template <typename T1, typename T2, typename T3, typename T4, typename T5,
4093 typename T6, typename T7, typename T8, typename T9, typename T10,
4094 typename T11, typename T12, typename T13, typename T14, typename T15>
4095struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4096 internal::None, internal::None, internal::None, internal::None,
4097 internal::None, internal::None, internal::None, internal::None,
4098 internal::None, internal::None, internal::None, internal::None,
4099 internal::None, internal::None, internal::None, internal::None,
4100 internal::None, internal::None, internal::None, internal::None,
4101 internal::None, internal::None, internal::None, internal::None,
4102 internal::None, internal::None, internal::None, internal::None,
4103 internal::None, internal::None, internal::None, internal::None,
4104 internal::None, internal::None, internal::None> {
4105 typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4106 T13, T14, T15> type;
4107};
4108template <typename T1, typename T2, typename T3, typename T4, typename T5,
4109 typename T6, typename T7, typename T8, typename T9, typename T10,
4110 typename T11, typename T12, typename T13, typename T14, typename T15,
4111 typename T16>
4112struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4113 T16, internal::None, internal::None, internal::None, internal::None,
4114 internal::None, internal::None, internal::None, internal::None,
4115 internal::None, internal::None, internal::None, internal::None,
4116 internal::None, internal::None, internal::None, internal::None,
4117 internal::None, internal::None, internal::None, internal::None,
4118 internal::None, internal::None, internal::None, 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> {
4122 typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4123 T13, T14, T15, T16> type;
4124};
4125template <typename T1, typename T2, typename T3, typename T4, typename T5,
4126 typename T6, typename T7, typename T8, typename T9, typename T10,
4127 typename T11, typename T12, typename T13, typename T14, typename T15,
4128 typename T16, typename T17>
4129struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4130 T16, T17, internal::None, internal::None, internal::None, internal::None,
4131 internal::None, internal::None, internal::None, internal::None,
4132 internal::None, internal::None, internal::None, internal::None,
4133 internal::None, internal::None, internal::None, internal::None,
4134 internal::None, internal::None, internal::None, internal::None,
4135 internal::None, internal::None, internal::None, internal::None,
4136 internal::None, internal::None, internal::None, internal::None,
4137 internal::None, internal::None, internal::None, internal::None,
4138 internal::None> {
4139 typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4140 T13, T14, T15, T16, T17> type;
4141};
4142template <typename T1, typename T2, typename T3, typename T4, typename T5,
4143 typename T6, typename T7, typename T8, typename T9, typename T10,
4144 typename T11, typename T12, typename T13, typename T14, typename T15,
4145 typename T16, typename T17, typename T18>
4146struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4147 T16, T17, T18, internal::None, internal::None, internal::None,
4148 internal::None, internal::None, internal::None, internal::None,
4149 internal::None, internal::None, internal::None, internal::None,
4150 internal::None, internal::None, internal::None, internal::None,
4151 internal::None, internal::None, internal::None, internal::None,
4152 internal::None, internal::None, internal::None, internal::None,
4153 internal::None, internal::None, internal::None, internal::None,
4154 internal::None, internal::None, internal::None, internal::None,
4155 internal::None> {
4156 typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4157 T13, T14, T15, T16, T17, T18> type;
4158};
4159template <typename T1, typename T2, typename T3, typename T4, typename T5,
4160 typename T6, typename T7, typename T8, typename T9, typename T10,
4161 typename T11, typename T12, typename T13, typename T14, typename T15,
4162 typename T16, typename T17, typename T18, typename T19>
4163struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4164 T16, T17, T18, T19, internal::None, internal::None, internal::None,
4165 internal::None, internal::None, internal::None, internal::None,
4166 internal::None, internal::None, internal::None, internal::None,
4167 internal::None, internal::None, internal::None, internal::None,
4168 internal::None, internal::None, internal::None, internal::None,
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 typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4173 T13, T14, T15, T16, T17, T18, T19> type;
4174};
4175template <typename T1, typename T2, typename T3, typename T4, typename T5,
4176 typename T6, typename T7, typename T8, typename T9, typename T10,
4177 typename T11, typename T12, typename T13, typename T14, typename T15,
4178 typename T16, typename T17, typename T18, typename T19, typename T20>
4179struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4180 T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,
4181 internal::None, internal::None, internal::None, internal::None,
4182 internal::None, internal::None, internal::None, internal::None,
4183 internal::None, internal::None, internal::None, internal::None,
4184 internal::None, internal::None, internal::None, internal::None,
4185 internal::None, internal::None, internal::None, internal::None,
4186 internal::None, internal::None, internal::None, internal::None,
4187 internal::None, internal::None, internal::None> {
4188 typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4189 T13, T14, T15, T16, T17, T18, T19, T20> type;
4190};
4191template <typename T1, typename T2, typename T3, typename T4, typename T5,
4192 typename T6, typename T7, typename T8, typename T9, typename T10,
4193 typename T11, typename T12, typename T13, typename T14, typename T15,
4194 typename T16, typename T17, typename T18, typename T19, typename T20,
4195 typename T21>
4196struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4197 T16, T17, T18, T19, T20, T21, internal::None, internal::None,
4198 internal::None, internal::None, internal::None, internal::None,
4199 internal::None, internal::None, internal::None, internal::None,
4200 internal::None, internal::None, internal::None, internal::None,
4201 internal::None, internal::None, internal::None, internal::None,
4202 internal::None, internal::None, internal::None, internal::None,
4203 internal::None, internal::None, internal::None, internal::None,
4204 internal::None, internal::None, internal::None> {
4205 typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4206 T13, T14, T15, T16, T17, T18, T19, T20, T21> type;
4207};
4208template <typename T1, typename T2, typename T3, typename T4, typename T5,
4209 typename T6, typename T7, typename T8, typename T9, typename T10,
4210 typename T11, typename T12, typename T13, typename T14, typename T15,
4211 typename T16, typename T17, typename T18, typename T19, typename T20,
4212 typename T21, typename T22>
4213struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4214 T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,
4215 internal::None, internal::None, internal::None, internal::None,
4216 internal::None, internal::None, internal::None, internal::None,
4217 internal::None, internal::None, internal::None, internal::None,
4218 internal::None, internal::None, internal::None, internal::None,
4219 internal::None, internal::None, internal::None, internal::None,
4220 internal::None, internal::None, internal::None, internal::None,
4221 internal::None, internal::None> {
4222 typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4223 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
4224};
4225template <typename T1, typename T2, typename T3, typename T4, typename T5,
4226 typename T6, typename T7, typename T8, typename T9, typename T10,
4227 typename T11, typename T12, typename T13, typename T14, typename T15,
4228 typename T16, typename T17, typename T18, typename T19, typename T20,
4229 typename T21, typename T22, typename T23>
4230struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4231 T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,
4232 internal::None, internal::None, internal::None, internal::None,
4233 internal::None, internal::None, internal::None, internal::None,
4234 internal::None, internal::None, internal::None, internal::None,
4235 internal::None, internal::None, internal::None, internal::None,
4236 internal::None, internal::None, internal::None, internal::None,
4237 internal::None, internal::None, internal::None, internal::None,
4238 internal::None> {
4239 typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4240 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
4241};
4242template <typename T1, typename T2, typename T3, typename T4, typename T5,
4243 typename T6, typename T7, typename T8, typename T9, typename T10,
4244 typename T11, typename T12, typename T13, typename T14, typename T15,
4245 typename T16, typename T17, typename T18, typename T19, typename T20,
4246 typename T21, typename T22, typename T23, typename T24>
4247struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4248 T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,
4249 internal::None, internal::None, internal::None, internal::None,
4250 internal::None, internal::None, internal::None, internal::None,
4251 internal::None, internal::None, internal::None, internal::None,
4252 internal::None, internal::None, internal::None, internal::None,
4253 internal::None, internal::None, internal::None, internal::None,
4254 internal::None, internal::None, internal::None, internal::None,
4255 internal::None> {
4256 typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4257 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
4258};
4259template <typename T1, typename T2, typename T3, typename T4, typename T5,
4260 typename T6, typename T7, typename T8, typename T9, typename T10,
4261 typename T11, typename T12, typename T13, typename T14, typename T15,
4262 typename T16, typename T17, typename T18, typename T19, typename T20,
4263 typename T21, typename T22, typename T23, typename T24, typename T25>
4264struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4265 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,
4266 internal::None, internal::None, internal::None, internal::None,
4267 internal::None, internal::None, internal::None, internal::None,
4268 internal::None, internal::None, internal::None, internal::None,
4269 internal::None, internal::None, internal::None, internal::None,
4270 internal::None, internal::None, internal::None, internal::None,
4271 internal::None, internal::None, internal::None, internal::None> {
4272 typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4273 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
4274};
4275template <typename T1, typename T2, typename T3, typename T4, typename T5,
4276 typename T6, typename T7, typename T8, typename T9, typename T10,
4277 typename T11, typename T12, typename T13, typename T14, typename T15,
4278 typename T16, typename T17, typename T18, typename T19, typename T20,
4279 typename T21, typename T22, typename T23, typename T24, typename T25,
4280 typename T26>
4281struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4282 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,
4283 internal::None, internal::None, internal::None, internal::None,
4284 internal::None, internal::None, internal::None, internal::None,
4285 internal::None, internal::None, internal::None, internal::None,
4286 internal::None, internal::None, internal::None, internal::None,
4287 internal::None, internal::None, internal::None, internal::None,
4288 internal::None, internal::None, internal::None> {
4289 typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4290 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
4291 T26> type;
4292};
4293template <typename T1, typename T2, typename T3, typename T4, typename T5,
4294 typename T6, typename T7, typename T8, typename T9, typename T10,
4295 typename T11, typename T12, typename T13, typename T14, typename T15,
4296 typename T16, typename T17, typename T18, typename T19, typename T20,
4297 typename T21, typename T22, typename T23, typename T24, typename T25,
4298 typename T26, typename T27>
4299struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4300 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,
4301 internal::None, internal::None, internal::None, internal::None,
4302 internal::None, internal::None, internal::None, internal::None,
4303 internal::None, internal::None, internal::None, internal::None,
4304 internal::None, internal::None, internal::None, internal::None,
4305 internal::None, internal::None, internal::None, internal::None,
4306 internal::None, internal::None> {
4307 typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4308 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4309 T27> type;
4310};
4311template <typename T1, typename T2, typename T3, typename T4, typename T5,
4312 typename T6, typename T7, typename T8, typename T9, typename T10,
4313 typename T11, typename T12, typename T13, typename T14, typename T15,
4314 typename T16, typename T17, typename T18, typename T19, typename T20,
4315 typename T21, typename T22, typename T23, typename T24, typename T25,
4316 typename T26, typename T27, typename T28>
4317struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4318 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
4319 internal::None, internal::None, internal::None, internal::None,
4320 internal::None, internal::None, internal::None, internal::None,
4321 internal::None, internal::None, internal::None, 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> {
4325 typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4326 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4327 T27, T28> type;
4328};
4329template <typename T1, typename T2, typename T3, typename T4, typename T5,
4330 typename T6, typename T7, typename T8, typename T9, typename T10,
4331 typename T11, typename T12, typename T13, typename T14, typename T15,
4332 typename T16, typename T17, typename T18, typename T19, typename T20,
4333 typename T21, typename T22, typename T23, typename T24, typename T25,
4334 typename T26, typename T27, typename T28, typename T29>
4335struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4336 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4337 internal::None, internal::None, internal::None, internal::None,
4338 internal::None, internal::None, internal::None, 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> {
4343 typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4344 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4345 T27, T28, T29> type;
4346};
4347template <typename T1, typename T2, typename T3, typename T4, typename T5,
4348 typename T6, typename T7, typename T8, typename T9, typename T10,
4349 typename T11, typename T12, typename T13, typename T14, typename T15,
4350 typename T16, typename T17, typename T18, typename T19, typename T20,
4351 typename T21, typename T22, typename T23, typename T24, typename T25,
4352 typename T26, typename T27, typename T28, typename T29, typename T30>
4353struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4354 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4355 internal::None, internal::None, internal::None, 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 typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4361 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4362 T27, T28, T29, T30> type;
4363};
4364template <typename T1, typename T2, typename T3, typename T4, typename T5,
4365 typename T6, typename T7, typename T8, typename T9, typename T10,
4366 typename T11, typename T12, typename T13, typename T14, typename T15,
4367 typename T16, typename T17, typename T18, typename T19, typename T20,
4368 typename T21, typename T22, typename T23, typename T24, typename T25,
4369 typename T26, typename T27, typename T28, typename T29, typename T30,
4370 typename T31>
4371struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4372 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4373 T31, internal::None, internal::None, internal::None, 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> {
4378 typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4379 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4380 T27, T28, T29, T30, T31> type;
4381};
4382template <typename T1, typename T2, typename T3, typename T4, typename T5,
4383 typename T6, typename T7, typename T8, typename T9, typename T10,
4384 typename T11, typename T12, typename T13, typename T14, typename T15,
4385 typename T16, typename T17, typename T18, typename T19, typename T20,
4386 typename T21, typename T22, typename T23, typename T24, typename T25,
4387 typename T26, typename T27, typename T28, typename T29, typename T30,
4388 typename T31, typename T32>
4389struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4390 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4391 T31, T32, internal::None, internal::None, internal::None, internal::None,
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> {
4396 typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4397 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4398 T27, T28, T29, T30, T31, T32> type;
4399};
4400template <typename T1, typename T2, typename T3, typename T4, typename T5,
4401 typename T6, typename T7, typename T8, typename T9, typename T10,
4402 typename T11, typename T12, typename T13, typename T14, typename T15,
4403 typename T16, typename T17, typename T18, typename T19, typename T20,
4404 typename T21, typename T22, typename T23, typename T24, typename T25,
4405 typename T26, typename T27, typename T28, typename T29, typename T30,
4406 typename T31, typename T32, typename T33>
4407struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4408 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4409 T31, T32, T33, internal::None, internal::None, internal::None,
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> {
4414 typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4415 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4416 T27, T28, T29, T30, T31, T32, T33> type;
4417};
4418template <typename T1, typename T2, typename T3, typename T4, typename T5,
4419 typename T6, typename T7, typename T8, typename T9, typename T10,
4420 typename T11, typename T12, typename T13, typename T14, typename T15,
4421 typename T16, typename T17, typename T18, typename T19, typename T20,
4422 typename T21, typename T22, typename T23, typename T24, typename T25,
4423 typename T26, typename T27, typename T28, typename T29, typename T30,
4424 typename T31, typename T32, typename T33, typename T34>
4425struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4426 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4427 T31, T32, T33, T34, internal::None, internal::None, internal::None,
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> {
4432 typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4433 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4434 T27, T28, T29, T30, T31, T32, T33, T34> type;
4435};
4436template <typename T1, typename T2, typename T3, typename T4, typename T5,
4437 typename T6, typename T7, typename T8, typename T9, typename T10,
4438 typename T11, typename T12, typename T13, typename T14, typename T15,
4439 typename T16, typename T17, typename T18, typename T19, typename T20,
4440 typename T21, typename T22, typename T23, typename T24, typename T25,
4441 typename T26, typename T27, typename T28, typename T29, typename T30,
4442 typename T31, typename T32, typename T33, typename T34, typename T35>
4443struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4444 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4445 T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,
4446 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 typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4450 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4451 T27, T28, T29, T30, T31, T32, T33, T34, T35> type;
4452};
4453template <typename T1, typename T2, typename T3, typename T4, typename T5,
4454 typename T6, typename T7, typename T8, typename T9, typename T10,
4455 typename T11, typename T12, typename T13, typename T14, typename T15,
4456 typename T16, typename T17, typename T18, typename T19, typename T20,
4457 typename T21, typename T22, typename T23, typename T24, typename T25,
4458 typename T26, typename T27, typename T28, typename T29, typename T30,
4459 typename T31, typename T32, typename T33, typename T34, typename T35,
4460 typename T36>
4461struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4462 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4463 T31, T32, T33, T34, T35, T36, internal::None, internal::None,
4464 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 typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4468 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4469 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
4470};
4471template <typename T1, typename T2, typename T3, typename T4, typename T5,
4472 typename T6, typename T7, typename T8, typename T9, typename T10,
4473 typename T11, typename T12, typename T13, typename T14, typename T15,
4474 typename T16, typename T17, typename T18, typename T19, typename T20,
4475 typename T21, typename T22, typename T23, typename T24, typename T25,
4476 typename T26, typename T27, typename T28, typename T29, typename T30,
4477 typename T31, typename T32, typename T33, typename T34, typename T35,
4478 typename T36, typename T37>
4479struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4480 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4481 T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,
4482 internal::None, internal::None, internal::None, internal::None,
4483 internal::None, internal::None, internal::None, internal::None,
4484 internal::None, internal::None, internal::None> {
4485 typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4486 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4487 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
4488};
4489template <typename T1, typename T2, typename T3, typename T4, typename T5,
4490 typename T6, typename T7, typename T8, typename T9, typename T10,
4491 typename T11, typename T12, typename T13, typename T14, typename T15,
4492 typename T16, typename T17, typename T18, typename T19, typename T20,
4493 typename T21, typename T22, typename T23, typename T24, typename T25,
4494 typename T26, typename T27, typename T28, typename T29, typename T30,
4495 typename T31, typename T32, typename T33, typename T34, typename T35,
4496 typename T36, typename T37, typename T38>
4497struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4498 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4499 T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,
4500 internal::None, internal::None, internal::None, internal::None,
4501 internal::None, internal::None, internal::None, internal::None,
4502 internal::None, internal::None> {
4503 typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4504 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4505 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
4506};
4507template <typename T1, typename T2, typename T3, typename T4, typename T5,
4508 typename T6, typename T7, typename T8, typename T9, typename T10,
4509 typename T11, typename T12, typename T13, typename T14, typename T15,
4510 typename T16, typename T17, typename T18, typename T19, typename T20,
4511 typename T21, typename T22, typename T23, typename T24, typename T25,
4512 typename T26, typename T27, typename T28, typename T29, typename T30,
4513 typename T31, typename T32, typename T33, typename T34, typename T35,
4514 typename T36, typename T37, typename T38, typename T39>
4515struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4516 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4517 T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,
4518 internal::None, internal::None, internal::None, internal::None,
4519 internal::None, internal::None, internal::None, internal::None,
4520 internal::None, internal::None> {
4521 typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4522 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4523 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
4524};
4525template <typename T1, typename T2, typename T3, typename T4, typename T5,
4526 typename T6, typename T7, typename T8, typename T9, typename T10,
4527 typename T11, typename T12, typename T13, typename T14, typename T15,
4528 typename T16, typename T17, typename T18, typename T19, typename T20,
4529 typename T21, typename T22, typename T23, typename T24, typename T25,
4530 typename T26, typename T27, typename T28, typename T29, typename T30,
4531 typename T31, typename T32, typename T33, typename T34, typename T35,
4532 typename T36, typename T37, typename T38, typename T39, typename T40>
4533struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4534 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4535 T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,
4536 internal::None, internal::None, internal::None, internal::None,
4537 internal::None, internal::None, internal::None, internal::None,
4538 internal::None> {
4539 typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4540 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4541 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
4542 T40> type;
4543};
4544template <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, typename T38, typename T39, typename T40,
4552 typename T41>
4553struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4554 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4555 T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,
4556 internal::None, internal::None, internal::None, internal::None,
4557 internal::None, internal::None, internal::None, internal::None> {
4558 typedef internal::Types41<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, T38, T39, T40,
4561 T41> type;
4562};
4563template <typename T1, typename T2, typename T3, typename T4, typename T5,
4564 typename T6, typename T7, typename T8, typename T9, typename T10,
4565 typename T11, typename T12, typename T13, typename T14, typename T15,
4566 typename T16, typename T17, typename T18, typename T19, typename T20,
4567 typename T21, typename T22, typename T23, typename T24, typename T25,
4568 typename T26, typename T27, typename T28, typename T29, typename T30,
4569 typename T31, typename T32, typename T33, typename T34, typename T35,
4570 typename T36, typename T37, typename T38, typename T39, typename T40,
4571 typename T41, typename T42>
4572struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4573 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4574 T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,
4575 internal::None, internal::None, internal::None, internal::None,
4576 internal::None, internal::None, internal::None> {
4577 typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4578 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4579 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4580 T41, T42> type;
4581};
4582template <typename T1, typename T2, typename T3, typename T4, typename T5,
4583 typename T6, typename T7, typename T8, typename T9, typename T10,
4584 typename T11, typename T12, typename T13, typename T14, typename T15,
4585 typename T16, typename T17, typename T18, typename T19, typename T20,
4586 typename T21, typename T22, typename T23, typename T24, typename T25,
4587 typename T26, typename T27, typename T28, typename T29, typename T30,
4588 typename T31, typename T32, typename T33, typename T34, typename T35,
4589 typename T36, typename T37, typename T38, typename T39, typename T40,
4590 typename T41, typename T42, typename T43>
4591struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4592 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4593 T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4594 internal::None, internal::None, internal::None, internal::None,
4595 internal::None, internal::None, internal::None> {
4596 typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4597 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4598 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4599 T41, T42, T43> type;
4600};
4601template <typename T1, typename T2, typename T3, typename T4, typename T5,
4602 typename T6, typename T7, typename T8, typename T9, typename T10,
4603 typename T11, typename T12, typename T13, typename T14, typename T15,
4604 typename T16, typename T17, typename T18, typename T19, typename T20,
4605 typename T21, typename T22, typename T23, typename T24, typename T25,
4606 typename T26, typename T27, typename T28, typename T29, typename T30,
4607 typename T31, typename T32, typename T33, typename T34, typename T35,
4608 typename T36, typename T37, typename T38, typename T39, typename T40,
4609 typename T41, typename T42, typename T43, typename T44>
4610struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4611 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4612 T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
4613 internal::None, internal::None, internal::None, internal::None,
4614 internal::None, internal::None> {
4615 typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4616 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4617 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4618 T41, T42, T43, T44> type;
4619};
4620template <typename T1, typename T2, typename T3, typename T4, typename T5,
4621 typename T6, typename T7, typename T8, typename T9, typename T10,
4622 typename T11, typename T12, typename T13, typename T14, typename T15,
4623 typename T16, typename T17, typename T18, typename T19, typename T20,
4624 typename T21, typename T22, typename T23, typename T24, typename T25,
4625 typename T26, typename T27, typename T28, typename T29, typename T30,
4626 typename T31, typename T32, typename T33, typename T34, typename T35,
4627 typename T36, typename T37, typename T38, typename T39, typename T40,
4628 typename T41, typename T42, typename T43, typename T44, typename T45>
4629struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4630 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4631 T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
4632 internal::None, internal::None, internal::None, internal::None,
4633 internal::None> {
4634 typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4635 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4636 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4637 T41, T42, T43, T44, T45> type;
4638};
4639template <typename T1, typename T2, typename T3, typename T4, typename T5,
4640 typename T6, typename T7, typename T8, typename T9, typename T10,
4641 typename T11, typename T12, typename T13, typename T14, typename T15,
4642 typename T16, typename T17, typename T18, typename T19, typename T20,
4643 typename T21, typename T22, typename T23, typename T24, typename T25,
4644 typename T26, typename T27, typename T28, typename T29, typename T30,
4645 typename T31, typename T32, typename T33, typename T34, typename T35,
4646 typename T36, typename T37, typename T38, typename T39, typename T40,
4647 typename T41, typename T42, typename T43, typename T44, typename T45,
4648 typename T46>
4649struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4650 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4651 T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
4652 T46, internal::None, internal::None, internal::None, internal::None> {
4653 typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4654 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4655 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4656 T41, T42, T43, T44, T45, T46> type;
4657};
4658template <typename T1, typename T2, typename T3, typename T4, typename T5,
4659 typename T6, typename T7, typename T8, typename T9, typename T10,
4660 typename T11, typename T12, typename T13, typename T14, typename T15,
4661 typename T16, typename T17, typename T18, typename T19, typename T20,
4662 typename T21, typename T22, typename T23, typename T24, typename T25,
4663 typename T26, typename T27, typename T28, typename T29, typename T30,
4664 typename T31, typename T32, typename T33, typename T34, typename T35,
4665 typename T36, typename T37, typename T38, typename T39, typename T40,
4666 typename T41, typename T42, typename T43, typename T44, typename T45,
4667 typename T46, typename T47>
4668struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4669 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4670 T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
4671 T46, T47, internal::None, internal::None, internal::None> {
4672 typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4673 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4674 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4675 T41, T42, T43, T44, T45, T46, T47> type;
4676};
4677template <typename T1, typename T2, typename T3, typename T4, typename T5,
4678 typename T6, typename T7, typename T8, typename T9, typename T10,
4679 typename T11, typename T12, typename T13, typename T14, typename T15,
4680 typename T16, typename T17, typename T18, typename T19, typename T20,
4681 typename T21, typename T22, typename T23, typename T24, typename T25,
4682 typename T26, typename T27, typename T28, typename T29, typename T30,
4683 typename T31, typename T32, typename T33, typename T34, typename T35,
4684 typename T36, typename T37, typename T38, typename T39, typename T40,
4685 typename T41, typename T42, typename T43, typename T44, typename T45,
4686 typename T46, typename T47, typename T48>
4687struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4688 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4689 T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
4690 T46, T47, T48, internal::None, internal::None> {
4691 typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4692 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4693 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4694 T41, T42, T43, T44, T45, T46, T47, T48> type;
4695};
4696template <typename T1, typename T2, typename T3, typename T4, typename T5,
4697 typename T6, typename T7, typename T8, typename T9, typename T10,
4698 typename T11, typename T12, typename T13, typename T14, typename T15,
4699 typename T16, typename T17, typename T18, typename T19, typename T20,
4700 typename T21, typename T22, typename T23, typename T24, typename T25,
4701 typename T26, typename T27, typename T28, typename T29, typename T30,
4702 typename T31, typename T32, typename T33, typename T34, typename T35,
4703 typename T36, typename T37, typename T38, typename T39, typename T40,
4704 typename T41, typename T42, typename T43, typename T44, typename T45,
4705 typename T46, typename T47, typename T48, typename T49>
4706struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4707 T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4708 T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
4709 T46, T47, T48, T49, internal::None> {
4710 typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4711 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4712 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4713 T41, T42, T43, T44, T45, T46, T47, T48, T49> type;
4714};
4715
4716namespace internal {
4717
4718# define GTEST_TEMPLATE_ template <typename T> class
4719
4720// The template "selector" struct TemplateSel<Tmpl> is used to
4721// represent Tmpl, which must be a class template with one type
4722// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
4723// as the type Tmpl<T>. This allows us to actually instantiate the
4724// template "selected" by TemplateSel<Tmpl>.
4725//
4726// This trick is necessary for simulating typedef for class templates,
4727// which C++ doesn't support directly.
4728template <GTEST_TEMPLATE_ Tmpl>
4729struct TemplateSel {
4730 template <typename T>
4731 struct Bind {
4732 typedef Tmpl<T> type;
4733 };
4734};
4735
4736# define GTEST_BIND_(TmplSel, T) \
4737 TmplSel::template Bind<T>::type
4738
4739// A unique struct template used as the default value for the
4740// arguments of class template Templates. This allows us to simulate
4741// variadic templates (e.g. Templates<int>, Templates<int, double>,
4742// and etc), which C++ doesn't support directly.
4743template <typename T>
4744struct NoneT {};
4745
4746// The following family of struct and struct templates are used to
4747// represent template lists. In particular, TemplatesN<T1, T2, ...,
4748// TN> represents a list of N templates (T1, T2, ..., and TN). Except
4749// for Templates0, every struct in the family has two member types:
4750// Head for the selector of the first template in the list, and Tail
4751// for the rest of the list.
4752
4753// The empty template list.
4754struct Templates0 {};
4755
4756// Template lists of length 1, 2, 3, and so on.
4757
4758template <GTEST_TEMPLATE_ T1>
4759struct Templates1 {
4760 typedef TemplateSel<T1> Head;
4761 typedef Templates0 Tail;
4762};
4763template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
4764struct Templates2 {
4765 typedef TemplateSel<T1> Head;
4766 typedef Templates1<T2> Tail;
4767};
4768
4769template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
4770struct Templates3 {
4771 typedef TemplateSel<T1> Head;
4772 typedef Templates2<T2, T3> Tail;
4773};
4774
4775template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4776 GTEST_TEMPLATE_ T4>
4777struct Templates4 {
4778 typedef TemplateSel<T1> Head;
4779 typedef Templates3<T2, T3, T4> Tail;
4780};
4781
4782template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4783 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
4784struct Templates5 {
4785 typedef TemplateSel<T1> Head;
4786 typedef Templates4<T2, T3, T4, T5> Tail;
4787};
4788
4789template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4790 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
4791struct Templates6 {
4792 typedef TemplateSel<T1> Head;
4793 typedef Templates5<T2, T3, T4, T5, T6> Tail;
4794};
4795
4796template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4797 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4798 GTEST_TEMPLATE_ T7>
4799struct Templates7 {
4800 typedef TemplateSel<T1> Head;
4801 typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;
4802};
4803
4804template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4805 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4806 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
4807struct Templates8 {
4808 typedef TemplateSel<T1> Head;
4809 typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;
4810};
4811
4812template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4813 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4814 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
4815struct Templates9 {
4816 typedef TemplateSel<T1> Head;
4817 typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
4818};
4819
4820template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4821 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4822 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4823 GTEST_TEMPLATE_ T10>
4824struct Templates10 {
4825 typedef TemplateSel<T1> Head;
4826 typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
4827};
4828
4829template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4830 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4831 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4832 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
4833struct Templates11 {
4834 typedef TemplateSel<T1> Head;
4835 typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
4836};
4837
4838template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4839 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4840 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4841 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
4842struct Templates12 {
4843 typedef TemplateSel<T1> Head;
4844 typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
4845};
4846
4847template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4848 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4849 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4850 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4851 GTEST_TEMPLATE_ T13>
4852struct Templates13 {
4853 typedef TemplateSel<T1> Head;
4854 typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
4855};
4856
4857template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4858 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4859 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4860 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4861 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
4862struct Templates14 {
4863 typedef TemplateSel<T1> Head;
4864 typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
4865 T14> Tail;
4866};
4867
4868template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4869 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4870 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4871 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4872 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
4873struct Templates15 {
4874 typedef TemplateSel<T1> Head;
4875 typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4876 T15> Tail;
4877};
4878
4879template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4880 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4881 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4882 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4883 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
4884 GTEST_TEMPLATE_ T16>
4885struct Templates16 {
4886 typedef TemplateSel<T1> Head;
4887 typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4888 T15, T16> Tail;
4889};
4890
4891template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4892 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4893 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4894 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4895 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
4896 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
4897struct Templates17 {
4898 typedef TemplateSel<T1> Head;
4899 typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4900 T15, T16, T17> Tail;
4901};
4902
4903template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4904 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4905 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4906 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4907 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
4908 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
4909struct Templates18 {
4910 typedef TemplateSel<T1> Head;
4911 typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4912 T15, T16, T17, T18> Tail;
4913};
4914
4915template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4916 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4917 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4918 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4919 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
4920 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
4921 GTEST_TEMPLATE_ T19>
4922struct Templates19 {
4923 typedef TemplateSel<T1> Head;
4924 typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4925 T15, T16, T17, T18, T19> Tail;
4926};
4927
4928template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4929 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4930 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4931 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4932 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
4933 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
4934 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
4935struct Templates20 {
4936 typedef TemplateSel<T1> Head;
4937 typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4938 T15, T16, T17, T18, T19, T20> Tail;
4939};
4940
4941template <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 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
4947 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
4948struct Templates21 {
4949 typedef TemplateSel<T1> Head;
4950 typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4951 T15, T16, T17, T18, T19, T20, T21> Tail;
4952};
4953
4954template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4955 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4956 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4957 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4958 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
4959 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
4960 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
4961 GTEST_TEMPLATE_ T22>
4962struct Templates22 {
4963 typedef TemplateSel<T1> Head;
4964 typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4965 T15, T16, T17, T18, T19, T20, T21, T22> Tail;
4966};
4967
4968template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4969 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4970 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4971 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4972 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
4973 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
4974 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
4975 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
4976struct Templates23 {
4977 typedef TemplateSel<T1> Head;
4978 typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4979 T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;
4980};
4981
4982template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4983 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4984 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4985 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
4986 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
4987 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
4988 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
4989 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
4990struct Templates24 {
4991 typedef TemplateSel<T1> Head;
4992 typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4993 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
4994};
4995
4996template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
4997 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
4998 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
4999 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5000 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5001 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5002 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5003 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5004 GTEST_TEMPLATE_ T25>
5005struct Templates25 {
5006 typedef TemplateSel<T1> Head;
5007 typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5008 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
5009};
5010
5011template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5012 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5013 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5014 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5015 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5016 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5017 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5018 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5019 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
5020struct Templates26 {
5021 typedef TemplateSel<T1> Head;
5022 typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5023 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
5024};
5025
5026template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5027 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5028 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5029 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5030 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5031 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5032 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5033 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5034 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
5035struct Templates27 {
5036 typedef TemplateSel<T1> Head;
5037 typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5038 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
5039};
5040
5041template <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, GTEST_TEMPLATE_ T24,
5049 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5050 GTEST_TEMPLATE_ T28>
5051struct Templates28 {
5052 typedef TemplateSel<T1> Head;
5053 typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5054 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
5055 T28> Tail;
5056};
5057
5058template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5059 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5060 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5061 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5062 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5063 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5064 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5065 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5066 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5067 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
5068struct Templates29 {
5069 typedef TemplateSel<T1> Head;
5070 typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5071 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5072 T29> Tail;
5073};
5074
5075template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5076 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5077 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5078 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5079 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5080 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5081 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5082 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5083 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5084 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
5085struct Templates30 {
5086 typedef TemplateSel<T1> Head;
5087 typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5088 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5089 T29, T30> Tail;
5090};
5091
5092template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5093 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5094 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5095 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5096 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5097 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5098 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5099 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5100 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5101 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5102 GTEST_TEMPLATE_ T31>
5103struct Templates31 {
5104 typedef TemplateSel<T1> Head;
5105 typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5106 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5107 T29, T30, T31> Tail;
5108};
5109
5110template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5111 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5112 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5113 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5114 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5115 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5116 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5117 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5118 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5119 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5120 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
5121struct Templates32 {
5122 typedef TemplateSel<T1> Head;
5123 typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5124 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5125 T29, T30, T31, T32> Tail;
5126};
5127
5128template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5129 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5130 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5131 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5132 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5133 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5134 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5135 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5136 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5137 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5138 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
5139struct Templates33 {
5140 typedef TemplateSel<T1> Head;
5141 typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5142 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5143 T29, T30, T31, T32, T33> Tail;
5144};
5145
5146template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5147 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5148 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5149 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5150 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5151 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5152 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5153 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5154 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5155 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5156 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5157 GTEST_TEMPLATE_ T34>
5158struct Templates34 {
5159 typedef TemplateSel<T1> Head;
5160 typedef Templates33<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, T31, T32, T33, T34> Tail;
5163};
5164
5165template <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, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5176 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
5177struct Templates35 {
5178 typedef TemplateSel<T1> Head;
5179 typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5180 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5181 T29, T30, T31, T32, T33, T34, T35> Tail;
5182};
5183
5184template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5185 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5186 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5187 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5188 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5189 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5190 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5191 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5192 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5193 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5194 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5195 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
5196struct Templates36 {
5197 typedef TemplateSel<T1> Head;
5198 typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5199 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5200 T29, T30, T31, T32, T33, T34, T35, T36> Tail;
5201};
5202
5203template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5204 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5205 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5206 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5207 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5208 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5209 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5210 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5211 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5212 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5213 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5214 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5215 GTEST_TEMPLATE_ T37>
5216struct Templates37 {
5217 typedef TemplateSel<T1> Head;
5218 typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5219 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5220 T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;
5221};
5222
5223template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5224 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5225 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5226 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5227 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5228 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5229 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5230 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5231 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5232 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5233 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5234 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5235 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
5236struct Templates38 {
5237 typedef TemplateSel<T1> Head;
5238 typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5239 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5240 T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
5241};
5242
5243template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5244 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5245 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5246 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5247 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5248 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5249 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5250 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5251 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5252 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5253 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5254 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5255 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
5256struct Templates39 {
5257 typedef TemplateSel<T1> Head;
5258 typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5259 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5260 T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
5261};
5262
5263template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5264 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5265 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5266 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5267 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5268 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5269 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5270 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5271 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5272 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5273 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5274 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5275 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5276 GTEST_TEMPLATE_ T40>
5277struct Templates40 {
5278 typedef TemplateSel<T1> Head;
5279 typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5280 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5281 T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
5282};
5283
5284template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5285 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5286 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5287 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5288 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5289 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5290 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5291 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5292 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5293 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5294 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5295 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5296 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5297 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
5298struct Templates41 {
5299 typedef TemplateSel<T1> Head;
5300 typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5301 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5302 T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
5303};
5304
5305template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5306 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5307 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5308 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5309 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5310 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5311 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5312 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5313 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5314 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5315 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5316 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5317 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5318 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
5319struct Templates42 {
5320 typedef TemplateSel<T1> Head;
5321 typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5322 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5323 T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
5324 T42> Tail;
5325};
5326
5327template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5328 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5329 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5330 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5331 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5332 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5333 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5334 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5335 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5336 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5337 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5338 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5339 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5340 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5341 GTEST_TEMPLATE_ T43>
5342struct Templates43 {
5343 typedef TemplateSel<T1> Head;
5344 typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5345 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5346 T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5347 T43> Tail;
5348};
5349
5350template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5351 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5352 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5353 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5354 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5355 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5356 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5357 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5358 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5359 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5360 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5361 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5362 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5363 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5364 GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
5365struct Templates44 {
5366 typedef TemplateSel<T1> Head;
5367 typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5368 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5369 T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5370 T43, T44> Tail;
5371};
5372
5373template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5374 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5375 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5376 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5377 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5378 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5379 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5380 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5381 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5382 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5383 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5384 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5385 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5386 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5387 GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
5388struct Templates45 {
5389 typedef TemplateSel<T1> Head;
5390 typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5391 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5392 T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5393 T43, T44, T45> Tail;
5394};
5395
5396template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5397 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5398 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5399 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5400 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5401 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5402 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5403 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5404 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5405 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5406 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5407 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5408 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5409 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5410 GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5411 GTEST_TEMPLATE_ T46>
5412struct Templates46 {
5413 typedef TemplateSel<T1> Head;
5414 typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5415 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5416 T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5417 T43, T44, T45, T46> Tail;
5418};
5419
5420template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5421 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5422 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5423 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5424 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5425 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5426 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5427 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5428 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5429 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5430 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5431 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5432 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5433 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5434 GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5435 GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
5436struct Templates47 {
5437 typedef TemplateSel<T1> Head;
5438 typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5439 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5440 T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5441 T43, T44, T45, T46, T47> Tail;
5442};
5443
5444template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5445 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5446 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5447 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5448 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5449 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5450 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5451 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5452 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5453 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5454 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5455 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5456 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5457 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5458 GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5459 GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
5460struct Templates48 {
5461 typedef TemplateSel<T1> Head;
5462 typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5463 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5464 T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5465 T43, T44, T45, T46, T47, T48> Tail;
5466};
5467
5468template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5469 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5470 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5471 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5472 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5473 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5474 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5475 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5476 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5477 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5478 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5479 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5480 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5481 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5482 GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5483 GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
5484 GTEST_TEMPLATE_ T49>
5485struct Templates49 {
5486 typedef TemplateSel<T1> Head;
5487 typedef Templates48<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, T47, T48, T49> Tail;
5491};
5492
5493template <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, GTEST_TEMPLATE_ T48,
5509 GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>
5510struct Templates50 {
5511 typedef TemplateSel<T1> Head;
5512 typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5513 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5514 T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5515 T43, T44, T45, T46, T47, T48, T49, T50> Tail;
5516};
5517
5518
5519// We don't want to require the users to write TemplatesN<...> directly,
5520// as that would require them to count the length. Templates<...> is much
5521// easier to write, but generates horrible messages when there is a
5522// compiler error, as gcc insists on printing out each template
5523// argument, even if it has the default value (this means Templates<list>
5524// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
5525// errors).
5526//
5527// Our solution is to combine the best part of the two approaches: a
5528// user would write Templates<T1, ..., TN>, and Google Test will translate
5529// that to TemplatesN<T1, ..., TN> internally to make error messages
5530// readable. The translation is done by the 'type' member of the
5531// Templates template.
5532template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,
5533 GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,
5534 GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,
5535 GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,
5536 GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,
5537 GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,
5538 GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,
5539 GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,
5540 GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,
5541 GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,
5542 GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,
5543 GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,
5544 GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,
5545 GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,
5546 GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,
5547 GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,
5548 GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,
5549 GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,
5550 GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,
5551 GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,
5552 GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,
5553 GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,
5554 GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,
5555 GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,
5556 GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>
5557struct Templates {
5558 typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5559 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
5560 T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
5561 T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
5562};
5563
5564template <>
5565struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5566 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5567 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5568 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5569 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5570 NoneT> {
5571 typedef Templates0 type;
5572};
5573template <GTEST_TEMPLATE_ T1>
5574struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5575 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5576 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5577 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5578 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5579 NoneT> {
5580 typedef Templates1<T1> type;
5581};
5582template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
5583struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5584 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5585 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5586 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5587 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5588 NoneT> {
5589 typedef Templates2<T1, T2> type;
5590};
5591template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
5592struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5593 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5594 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5595 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5596 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5597 typedef Templates3<T1, T2, T3> type;
5598};
5599template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5600 GTEST_TEMPLATE_ T4>
5601struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5602 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5603 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5604 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5605 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5606 typedef Templates4<T1, T2, T3, T4> type;
5607};
5608template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5609 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
5610struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5611 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5612 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5613 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5614 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5615 typedef Templates5<T1, T2, T3, T4, T5> type;
5616};
5617template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5618 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
5619struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,
5620 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5621 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5622 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5623 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5624 typedef Templates6<T1, T2, T3, T4, T5, T6> type;
5625};
5626template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5627 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5628 GTEST_TEMPLATE_ T7>
5629struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,
5630 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5631 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5632 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5633 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5634 typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;
5635};
5636template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5637 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5638 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
5639struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, 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, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5644 typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;
5645};
5646template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5647 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5648 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
5649struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, 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, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5653 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5654 typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
5655};
5656template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5657 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5658 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5659 GTEST_TEMPLATE_ T10>
5660struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,
5661 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5662 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5663 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5664 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5665 typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
5666};
5667template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5668 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5669 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5670 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
5671struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,
5672 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5673 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5674 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5675 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5676 typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
5677};
5678template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5679 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5680 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5681 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
5682struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,
5683 NoneT, NoneT, NoneT, NoneT, 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> {
5687 typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;
5688};
5689template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5690 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5691 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5692 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5693 GTEST_TEMPLATE_ T13>
5694struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,
5695 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5696 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5697 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5698 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5699 typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5700 T13> type;
5701};
5702template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5703 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5704 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5705 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5706 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
5707struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5708 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5709 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5710 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5711 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5712 typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5713 T14> type;
5714};
5715template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5716 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5717 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5718 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5719 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
5720struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5721 T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5722 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5723 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5724 NoneT, NoneT, NoneT, NoneT, NoneT> {
5725 typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5726 T14, T15> type;
5727};
5728template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5729 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5730 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5731 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5732 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5733 GTEST_TEMPLATE_ T16>
5734struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5735 T15, T16, 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, NoneT, NoneT, NoneT,
5738 NoneT, NoneT, NoneT, NoneT, NoneT> {
5739 typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5740 T14, T15, T16> type;
5741};
5742template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5743 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5744 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5745 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5746 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5747 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
5748struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5749 T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5750 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5751 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5752 NoneT, NoneT, NoneT, NoneT, NoneT> {
5753 typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5754 T14, T15, T16, T17> type;
5755};
5756template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5757 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5758 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5759 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5760 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5761 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
5762struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5763 T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5764 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5765 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5766 NoneT, NoneT, NoneT, NoneT> {
5767 typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5768 T14, T15, T16, T17, T18> type;
5769};
5770template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5771 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5772 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5773 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5774 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5775 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5776 GTEST_TEMPLATE_ T19>
5777struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5778 T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5779 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5780 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5781 NoneT, NoneT, NoneT, NoneT> {
5782 typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5783 T14, T15, T16, T17, T18, T19> type;
5784};
5785template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5786 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5787 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5788 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5789 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5790 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5791 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
5792struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5793 T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5794 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> {
5797 typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5798 T14, T15, T16, T17, T18, T19, T20> type;
5799};
5800template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5801 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5802 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5803 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5804 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5805 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5806 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
5807struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5808 T15, T16, T17, T18, T19, T20, T21, 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> {
5812 typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5813 T14, T15, T16, T17, T18, T19, T20, T21> type;
5814};
5815template <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, GTEST_TEMPLATE_ T18,
5821 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5822 GTEST_TEMPLATE_ T22>
5823struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5824 T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,
5825 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5826 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5827 NoneT, NoneT, NoneT> {
5828 typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5829 T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
5830};
5831template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5832 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5833 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5834 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5835 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5836 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5837 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5838 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
5839struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5840 T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,
5841 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5842 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5843 NoneT, NoneT, NoneT> {
5844 typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5845 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
5846};
5847template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5848 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5849 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5850 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5851 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5852 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5853 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5854 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
5855struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5856 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,
5857 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5858 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5859 NoneT, NoneT, NoneT> {
5860 typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5861 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
5862};
5863template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5864 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5865 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5866 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5867 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5868 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5869 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5870 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5871 GTEST_TEMPLATE_ T25>
5872struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5873 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,
5874 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5875 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5876 NoneT, NoneT> {
5877 typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5878 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
5879};
5880template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5881 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5882 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5883 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5884 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5885 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5886 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5887 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5888 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
5889struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5890 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,
5891 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5892 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5893 NoneT, NoneT> {
5894 typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5895 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;
5896};
5897template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5898 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5899 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5900 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5901 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5902 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5903 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5904 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5905 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
5906struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5907 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,
5908 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5909 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5910 NoneT, NoneT> {
5911 typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5912 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5913 T27> type;
5914};
5915template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5916 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5917 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5918 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5919 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5920 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5921 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5922 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5923 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5924 GTEST_TEMPLATE_ T28>
5925struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5926 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5927 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5928 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5929 NoneT, NoneT> {
5930 typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5931 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
5932 T28> type;
5933};
5934template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5935 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5936 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5937 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5938 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5939 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5940 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5941 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5942 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5943 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
5944struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5945 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5946 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5947 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5948 NoneT> {
5949 typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5950 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
5951 T28, T29> type;
5952};
5953template <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, GTEST_TEMPLATE_ T27,
5962 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
5963struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5964 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5965 T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5966 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5967 typedef Templates30<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, T27,
5969 T28, T29, T30> type;
5970};
5971template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5972 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5973 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5974 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5975 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5976 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5977 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5978 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5979 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5980 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5981 GTEST_TEMPLATE_ T31>
5982struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5983 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5984 T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5985 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5986 typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5987 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
5988 T28, T29, T30, T31> type;
5989};
5990template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5991 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5992 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5993 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5994 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5995 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5996 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5997 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5998 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5999 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6000 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
6001struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6002 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6003 T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6004 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6005 typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6006 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6007 T28, T29, T30, T31, T32> type;
6008};
6009template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6010 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6011 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6012 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6013 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6014 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6015 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6016 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6017 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6018 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6019 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
6020struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6021 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6022 T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6023 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6024 typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6025 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6026 T28, T29, T30, T31, T32, T33> type;
6027};
6028template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6029 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6030 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6031 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6032 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6033 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6034 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6035 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6036 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6037 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6038 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6039 GTEST_TEMPLATE_ T34>
6040struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6041 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6042 T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6043 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6044 typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6045 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6046 T28, T29, T30, T31, T32, T33, T34> type;
6047};
6048template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6049 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6050 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6051 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6052 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6053 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6054 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6055 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6056 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6057 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6058 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6059 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
6060struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6061 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6062 T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6063 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6064 typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6065 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6066 T28, T29, T30, T31, T32, T33, T34, T35> type;
6067};
6068template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6069 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6070 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6071 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6072 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6073 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6074 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6075 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6076 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6077 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6078 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6079 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
6080struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6081 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6082 T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,
6083 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6084 typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6085 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6086 T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
6087};
6088template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6089 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6090 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6091 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6092 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6093 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6094 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6095 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6096 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6097 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6098 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6099 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6100 GTEST_TEMPLATE_ T37>
6101struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6102 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6103 T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,
6104 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6105 typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6106 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6107 T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
6108};
6109template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6110 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6111 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6112 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6113 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6114 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6115 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6116 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6117 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6118 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6119 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6120 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6121 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
6122struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6123 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6124 T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,
6125 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6126 typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6127 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6128 T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
6129};
6130template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6131 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6132 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6133 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6134 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6135 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6136 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6137 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6138 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6139 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6140 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6141 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6142 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
6143struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6144 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6145 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,
6146 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6147 typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6148 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6149 T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
6150};
6151template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6152 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6153 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6154 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6155 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6156 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6157 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6158 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6159 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6160 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6161 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6162 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6163 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6164 GTEST_TEMPLATE_ T40>
6165struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6166 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6167 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,
6168 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6169 typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6170 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6171 T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;
6172};
6173template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6174 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6175 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6176 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6177 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6178 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6179 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6180 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6181 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6182 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6183 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6184 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6185 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6186 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
6187struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6188 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6189 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,
6190 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6191 typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6192 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6193 T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6194 T41> type;
6195};
6196template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6197 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6198 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6199 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6200 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6201 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6202 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6203 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6204 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6205 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6206 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6207 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6208 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6209 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
6210struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6211 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6212 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,
6213 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6214 typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6215 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6216 T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6217 T42> type;
6218};
6219template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6220 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6221 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6222 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6223 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6224 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6225 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6226 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6227 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6228 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6229 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6230 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6231 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6232 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6233 GTEST_TEMPLATE_ T43>
6234struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6235 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6236 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
6237 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6238 typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6239 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6240 T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6241 T42, T43> type;
6242};
6243template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6244 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6245 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6246 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6247 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6248 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6249 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6250 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6251 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6252 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6253 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6254 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6255 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6256 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6257 GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
6258struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6259 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6260 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6261 NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6262 typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6263 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6264 T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6265 T42, T43, T44> type;
6266};
6267template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6268 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6269 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6270 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6271 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6272 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6273 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6274 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6275 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6276 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6277 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6278 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6279 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6280 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6281 GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
6282struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6283 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6284 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6285 T45, NoneT, NoneT, NoneT, NoneT, NoneT> {
6286 typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6287 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6288 T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6289 T42, T43, T44, T45> type;
6290};
6291template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6292 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6293 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6294 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6295 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6296 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6297 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6298 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6299 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6300 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6301 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6302 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6303 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6304 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6305 GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6306 GTEST_TEMPLATE_ T46>
6307struct 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, T44,
6310 T45, T46, NoneT, NoneT, NoneT, NoneT> {
6311 typedef Templates46<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, T44, T45, T46> type;
6315};
6316template <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, GTEST_TEMPLATE_ T45,
6331 GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
6332struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6333 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6334 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6335 T45, T46, T47, NoneT, NoneT, NoneT> {
6336 typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6337 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6338 T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6339 T42, T43, T44, T45, T46, T47> type;
6340};
6341template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6342 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6343 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6344 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6345 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6346 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6347 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6348 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6349 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6350 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6351 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6352 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6353 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6354 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6355 GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6356 GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
6357struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6358 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6359 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6360 T45, T46, T47, T48, NoneT, NoneT> {
6361 typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6362 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6363 T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6364 T42, T43, T44, T45, T46, T47, T48> type;
6365};
6366template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6367 GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6368 GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6369 GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6370 GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6371 GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6372 GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6373 GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6374 GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6375 GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6376 GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6377 GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6378 GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6379 GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6380 GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6381 GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
6382 GTEST_TEMPLATE_ T49>
6383struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6384 T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6385 T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6386 T45, T46, T47, T48, T49, NoneT> {
6387 typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6388 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6389 T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6390 T42, T43, T44, T45, T46, T47, T48, T49> type;
6391};
6392
6393// The TypeList template makes it possible to use either a single type
6394// or a Types<...> list in TYPED_TEST_SUITE() and
6395// INSTANTIATE_TYPED_TEST_SUITE_P().
6396
6397template <typename T>
6398struct TypeList {
6399 typedef Types1<T> type;
6400};
6401
6402template <typename T1, typename T2, typename T3, typename T4, typename T5,
6403 typename T6, typename T7, typename T8, typename T9, typename T10,
6404 typename T11, typename T12, typename T13, typename T14, typename T15,
6405 typename T16, typename T17, typename T18, typename T19, typename T20,
6406 typename T21, typename T22, typename T23, typename T24, typename T25,
6407 typename T26, typename T27, typename T28, typename T29, typename T30,
6408 typename T31, typename T32, typename T33, typename T34, typename T35,
6409 typename T36, typename T37, typename T38, typename T39, typename T40,
6410 typename T41, typename T42, typename T43, typename T44, typename T45,
6411 typename T46, typename T47, typename T48, typename T49, typename T50>
6412struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6413 T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6414 T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
6415 T44, T45, T46, T47, T48, T49, T50> > {
6416 typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6417 T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6418 T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6419 T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;
6420};
6421
6422#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
6423
6424} // namespace internal
6425} // namespace testing
6426
6427#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
6428
6429// Due to C++ preprocessor weirdness, we need double indirection to
6430// concatenate two tokens when one of them is __LINE__. Writing
6431//
6432// foo ## __LINE__
6433//
6434// will result in the token foo__LINE__, instead of foo followed by
6435// the current line number. For more details, see
6436// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
6437#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
6438#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
6439
6440// Stringifies its argument.
6441#define GTEST_STRINGIFY_(name) #name
6442
6443namespace proto2 { class Message; }
6444
6445namespace testing {
6446
6447// Forward declarations.
6448
6449class AssertionResult; // Result of an assertion.
6450class Message; // Represents a failure message.
6451class Test; // Represents a test.
6452class TestInfo; // Information about a test.
6453class TestPartResult; // Result of a test part.
6454class UnitTest; // A collection of test suites.
6455
6456template <typename T>
6458
6459namespace internal {
6460
6461struct TraceInfo; // Information about a trace point.
6462class TestInfoImpl; // Opaque implementation of TestInfo
6463class UnitTestImpl; // Opaque implementation of UnitTest
6464
6465// The text used in failure messages to indicate the start of the
6466// stack trace.
6467GTEST_API_ extern const char kStackTraceMarker[];
6468
6469// An IgnoredValue object can be implicitly constructed from ANY value.
6471 struct Sink {};
6472 public:
6473 // This constructor template allows any value to be implicitly
6474 // converted to IgnoredValue. The object has no data member and
6475 // doesn't try to remember anything about the argument. We
6476 // deliberately omit the 'explicit' keyword in order to allow the
6477 // conversion to be implicit.
6478 // Disable the conversion if T already has a magical conversion operator.
6479 // Otherwise we get ambiguity.
6480 template <typename T,
6482 int>::type = 0>
6483 IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
6484};
6485
6486// Appends the user-supplied message to the Google-Test-generated message.
6488 const std::string& gtest_msg, const Message& user_msg);
6489
6490#if GTEST_HAS_EXCEPTIONS
6491
6493/* an exported class was derived from a class that was not exported */)
6494
6495// This exception is thrown by (and only by) a failed Google Test
6496// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
6497// are enabled). We derive it from std::runtime_error, which is for
6498// errors presumably detectable only at run time. Since
6499// std::runtime_error inherits from std::exception, many testing
6500// frameworks know how to extract and print the message inside it.
6501class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
6502 public:
6503 explicit GoogleTestFailureException(const TestPartResult& failure);
6504};
6505
6507
6508#endif // GTEST_HAS_EXCEPTIONS
6509
6510namespace edit_distance {
6511// Returns the optimal edits to go from 'left' to 'right'.
6512// All edits cost the same, with replace having lower priority than
6513// add/remove.
6514// Simple implementation of the Wagner-Fischer algorithm.
6515// See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm
6517GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
6518 const std::vector<size_t>& left, const std::vector<size_t>& right);
6519
6520// Same as above, but the input is represented as strings.
6521GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
6522 const std::vector<std::string>& left,
6523 const std::vector<std::string>& right);
6524
6525// Create a diff of the input strings in Unified diff format.
6526GTEST_API_ std::string CreateUnifiedDiff(const std::vector<std::string>& left,
6527 const std::vector<std::string>& right,
6528 size_t context = 2);
6529
6530} // namespace edit_distance
6531
6532// Calculate the diff between 'left' and 'right' and return it in unified diff
6533// format.
6534// If not null, stores in 'total_line_count' the total number of lines found
6535// in left + right.
6537 const std::string& right,
6538 size_t* total_line_count);
6539
6540// Constructs and returns the message for an equality assertion
6541// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
6542//
6543// The first four parameters are the expressions used in the assertion
6544// and their values, as strings. For example, for ASSERT_EQ(foo, bar)
6545// where foo is 5 and bar is 6, we have:
6546//
6547// expected_expression: "foo"
6548// actual_expression: "bar"
6549// expected_value: "5"
6550// actual_value: "6"
6551//
6552// The ignoring_case parameter is true if and only if the assertion is a
6553// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
6554// be inserted into the message.
6555GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
6556 const char* actual_expression,
6557 const std::string& expected_value,
6558 const std::string& actual_value,
6559 bool ignoring_case);
6560
6561// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
6563 const AssertionResult& assertion_result,
6564 const char* expression_text,
6565 const char* actual_predicate_value,
6566 const char* expected_predicate_value);
6567
6568// This template class represents an IEEE floating-point number
6569// (either single-precision or double-precision, depending on the
6570// template parameters).
6571//
6572// The purpose of this class is to do more sophisticated number
6573// comparison. (Due to round-off error, etc, it's very unlikely that
6574// two floating-points will be equal exactly. Hence a naive
6575// comparison by the == operation often doesn't work.)
6576//
6577// Format of IEEE floating-point:
6578//
6579// The most-significant bit being the leftmost, an IEEE
6580// floating-point looks like
6581//
6582// sign_bit exponent_bits fraction_bits
6583//
6584// Here, sign_bit is a single bit that designates the sign of the
6585// number.
6586//
6587// For float, there are 8 exponent bits and 23 fraction bits.
6588//
6589// For double, there are 11 exponent bits and 52 fraction bits.
6590//
6591// More details can be found at
6592// http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
6593//
6594// Template parameter:
6595//
6596// RawType: the raw floating-point type (either float or double)
6597template <typename RawType>
6599 public:
6600 // Defines the unsigned integer type that has the same size as the
6601 // floating point number.
6602 typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;
6603
6604 // Constants.
6605
6606 // # of bits in a number.
6607 static const size_t kBitCount = 8*sizeof(RawType);
6608
6609 // # of fraction bits in a number.
6610 static const size_t kFractionBitCount =
6611 std::numeric_limits<RawType>::digits - 1;
6612
6613 // # of exponent bits in a number.
6614 static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
6615
6616 // The mask for the sign bit.
6617 static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
6618
6619 // The mask for the fraction bits.
6620 static const Bits kFractionBitMask =
6621 ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
6622
6623 // The mask for the exponent bits.
6625
6626 // How many ULP's (Units in the Last Place) we want to tolerate when
6627 // comparing two numbers. The larger the value, the more error we
6628 // allow. A 0 value means that two numbers must be exactly the same
6629 // to be considered equal.
6630 //
6631 // The maximum error of a single floating-point operation is 0.5
6632 // units in the last place. On Intel CPU's, all floating-point
6633 // calculations are done with 80-bit precision, while double has 64
6634 // bits. Therefore, 4 should be enough for ordinary use.
6635 //
6636 // See the following article for more details on ULP:
6637 // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
6638 static const size_t kMaxUlps = 4;
6639
6640 // Constructs a FloatingPoint from a raw floating-point number.
6641 //
6642 // On an Intel CPU, passing a non-normalized NAN (Not a Number)
6643 // around may change its bits, although the new value is guaranteed
6644 // to be also a NAN. Therefore, don't expect this constructor to
6645 // preserve the bits in x when x is a NAN.
6646 explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
6647
6648 // Static methods
6649
6650 // Reinterprets a bit pattern as a floating-point number.
6651 //
6652 // This function is needed to test the AlmostEquals() method.
6653 static RawType ReinterpretBits(const Bits bits) {
6654 FloatingPoint fp(0);
6655 fp.u_.bits_ = bits;
6656 return fp.u_.value_;
6657 }
6658
6659 // Returns the floating-point number that represent positive infinity.
6660 static RawType Infinity() {
6662 }
6663
6664 // Returns the maximum representable finite floating-point number.
6665 static RawType Max();
6666
6667 // Non-static methods
6668
6669 // Returns the bits that represents this number.
6670 const Bits &bits() const { return u_.bits_; }
6671
6672 // Returns the exponent bits of this number.
6673 Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
6674
6675 // Returns the fraction bits of this number.
6676 Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
6677
6678 // Returns the sign bit of this number.
6679 Bits sign_bit() const { return kSignBitMask & u_.bits_; }
6680
6681 // Returns true if and only if this is NAN (not a number).
6682 bool is_nan() const {
6683 // It's a NAN if the exponent bits are all ones and the fraction
6684 // bits are not entirely zeros.
6685 return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
6686 }
6687
6688 // Returns true if and only if this number is at most kMaxUlps ULP's away
6689 // from rhs. In particular, this function:
6690 //
6691 // - returns false if either number is (or both are) NAN.
6692 // - treats really large numbers as almost equal to infinity.
6693 // - thinks +0.0 and -0.0 are 0 DLP's apart.
6694 bool AlmostEquals(const FloatingPoint& rhs) const {
6695 // The IEEE standard says that any comparison operation involving
6696 // a NAN must return false.
6697 if (is_nan() || rhs.is_nan()) return false;
6698
6699 return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
6700 <= kMaxUlps;
6701 }
6702
6703 private:
6704 // The data type used to store the actual floating-point number.
6705 union FloatingPointUnion {
6706 RawType value_; // The raw floating-point number.
6707 Bits bits_; // The bits that represent the number.
6708 };
6709
6710 // Converts an integer from the sign-and-magnitude representation to
6711 // the biased representation. More precisely, let N be 2 to the
6712 // power of (kBitCount - 1), an integer x is represented by the
6713 // unsigned number x + N.
6714 //
6715 // For instance,
6716 //
6717 // -N + 1 (the most negative number representable using
6718 // sign-and-magnitude) is represented by 1;
6719 // 0 is represented by N; and
6720 // N - 1 (the biggest number representable using
6721 // sign-and-magnitude) is represented by 2N - 1.
6722 //
6723 // Read http://en.wikipedia.org/wiki/Signed_number_representations
6724 // for more details on signed number representations.
6725 static Bits SignAndMagnitudeToBiased(const Bits &sam) {
6726 if (kSignBitMask & sam) {
6727 // sam represents a negative number.
6728 return ~sam + 1;
6729 } else {
6730 // sam represents a positive number.
6731 return kSignBitMask | sam;
6732 }
6733 }
6734
6735 // Given two numbers in the sign-and-magnitude representation,
6736 // returns the distance between them as an unsigned number.
6737 static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
6738 const Bits &sam2) {
6739 const Bits biased1 = SignAndMagnitudeToBiased(sam1);
6740 const Bits biased2 = SignAndMagnitudeToBiased(sam2);
6741 return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
6742 }
6743
6744 FloatingPointUnion u_;
6745};
6746
6747// We cannot use std::numeric_limits<T>::max() as it clashes with the max()
6748// macro defined by <windows.h>.
6749template <>
6750inline float FloatingPoint<float>::Max() { return FLT_MAX; }
6751template <>
6752inline double FloatingPoint<double>::Max() { return DBL_MAX; }
6753
6754// Typedefs the instances of the FloatingPoint template class that we
6755// care to use.
6758
6759// In order to catch the mistake of putting tests that use different
6760// test fixture classes in the same test suite, we need to assign
6761// unique IDs to fixture classes and compare them. The TypeId type is
6762// used to hold such IDs. The user should treat TypeId as an opaque
6763// type: the only operation allowed on TypeId values is to compare
6764// them for equality using the == operator.
6765typedef const void* TypeId;
6766
6767template <typename T>
6769 public:
6770 // dummy_ must not have a const type. Otherwise an overly eager
6771 // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
6772 // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
6773 static bool dummy_;
6774};
6775
6776template <typename T>
6777bool TypeIdHelper<T>::dummy_ = false;
6778
6779// GetTypeId<T>() returns the ID of type T. Different values will be
6780// returned for different types. Calling the function twice with the
6781// same type argument is guaranteed to return the same ID.
6782template <typename T>
6784 // The compiler is required to allocate a different
6785 // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
6786 // the template. Therefore, the address of dummy_ is guaranteed to
6787 // be unique.
6788 return &(TypeIdHelper<T>::dummy_);
6789}
6790
6791// Returns the type ID of ::testing::Test. Always call this instead
6792// of GetTypeId< ::testing::Test>() to get the type ID of
6793// ::testing::Test, as the latter may give the wrong result due to a
6794// suspected linker bug when compiling Google Test as a Mac OS X
6795// framework.
6797
6798// Defines the abstract factory interface that creates instances
6799// of a Test object.
6801 public:
6802 virtual ~TestFactoryBase() {}
6803
6804 // Creates a test instance to run. The instance is both created and destroyed
6805 // within TestInfoImpl::Run()
6806 virtual Test* CreateTest() = 0;
6807
6808 protected:
6810
6811 private:
6812 GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
6813};
6814
6815// This class provides implementation of TeastFactoryBase interface.
6816// It is used in TEST and TEST_F macros.
6817template <class TestClass>
6819 public:
6820 Test* CreateTest() override { return new TestClass; }
6821};
6822
6823#if GTEST_OS_WINDOWS
6824
6825// Predicate-formatters for implementing the HRESULT checking macros
6826// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
6827// We pass a long instead of HRESULT to avoid causing an
6828// include dependency for the HRESULT type.
6829GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
6830 long hr); // NOLINT
6831GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
6832 long hr); // NOLINT
6833
6834#endif // GTEST_OS_WINDOWS
6835
6836// Types of SetUpTestSuite() and TearDownTestSuite() functions.
6837using SetUpTestSuiteFunc = void (*)();
6838using TearDownTestSuiteFunc = void (*)();
6839
6841 CodeLocation(const std::string& a_file, int a_line)
6842 : file(a_file), line(a_line) {}
6843
6845 int line;
6846};
6847
6848// Helper to identify which setup function for TestCase / TestSuite to call.
6849// Only one function is allowed, either TestCase or TestSute but not both.
6850
6851// Utility functions to help SuiteApiResolver
6853
6856 return a == def ? nullptr : a;
6857}
6858
6859template <typename T>
6860// Note that SuiteApiResolver inherits from T because
6861// SetUpTestSuite()/TearDownTestSuite() could be protected. Ths way
6862// SuiteApiResolver can access them.
6864 // testing::Test is only forward declared at this point. So we make it a
6865 // dependend class for the compiler to be OK with it.
6866 using Test =
6867 typename std::conditional<sizeof(T) != 0, ::testing::Test, void>::type;
6868
6870 int line_num) {
6871 SetUpTearDownSuiteFuncType test_case_fp =
6872 GetNotDefaultOrNull(&T::SetUpTestCase, &Test::SetUpTestCase);
6873 SetUpTearDownSuiteFuncType test_suite_fp =
6874 GetNotDefaultOrNull(&T::SetUpTestSuite, &Test::SetUpTestSuite);
6875
6876 GTEST_CHECK_(!test_case_fp || !test_suite_fp)
6877 << "Test can not provide both SetUpTestSuite and SetUpTestCase, please "
6878 "make sure there is only one present at "
6879 << filename << ":" << line_num;
6880
6881 return test_case_fp != nullptr ? test_case_fp : test_suite_fp;
6882 }
6883
6885 int line_num) {
6886 SetUpTearDownSuiteFuncType test_case_fp =
6887 GetNotDefaultOrNull(&T::TearDownTestCase, &Test::TearDownTestCase);
6888 SetUpTearDownSuiteFuncType test_suite_fp =
6889 GetNotDefaultOrNull(&T::TearDownTestSuite, &Test::TearDownTestSuite);
6890
6891 GTEST_CHECK_(!test_case_fp || !test_suite_fp)
6892 << "Test can not provide both TearDownTestSuite and TearDownTestCase,"
6893 " please make sure there is only one present at"
6894 << filename << ":" << line_num;
6895
6896 return test_case_fp != nullptr ? test_case_fp : test_suite_fp;
6897 }
6898};
6899
6900// Creates a new TestInfo object and registers it with Google Test;
6901// returns the created object.
6902//
6903// Arguments:
6904//
6905// test_suite_name: name of the test suite
6906// name: name of the test
6907// type_param the name of the test's type parameter, or NULL if
6908// this is not a typed or a type-parameterized test.
6909// value_param text representation of the test's value parameter,
6910// or NULL if this is not a type-parameterized test.
6911// code_location: code location where the test is defined
6912// fixture_class_id: ID of the test fixture class
6913// set_up_tc: pointer to the function that sets up the test suite
6914// tear_down_tc: pointer to the function that tears down the test suite
6915// factory: pointer to the factory that creates a test object.
6916// The newly created TestInfo instance will assume
6917// ownership of the factory object.
6919 const char* test_suite_name, const char* name, const char* type_param,
6920 const char* value_param, CodeLocation code_location,
6921 TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc,
6922 TearDownTestSuiteFunc tear_down_tc, TestFactoryBase* factory);
6923
6924// If *pstr starts with the given prefix, modifies *pstr to be right
6925// past the prefix and returns true; otherwise leaves *pstr unchanged
6926// and returns false. None of pstr, *pstr, and prefix can be NULL.
6927GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
6928
6929#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
6930
6932/* class A needs to have dll-interface to be used by clients of class B */)
6933
6934// State of the definition of a type-parameterized test suite.
6935class GTEST_API_ TypedTestSuitePState {
6936 public:
6937 TypedTestSuitePState() : registered_(false) {}
6938
6939 // Adds the given test name to defined_test_names_ and return true
6940 // if the test suite hasn't been registered; otherwise aborts the
6941 // program.
6942 bool AddTestName(const char* file, int line, const char* case_name,
6943 const char* test_name) {
6944 if (registered_) {
6945 fprintf(stderr,
6946 "%s Test %s must be defined before "
6947 "REGISTER_TYPED_TEST_SUITE_P(%s, ...).\n",
6948 FormatFileLocation(file, line).c_str(), test_name, case_name);
6949 fflush(stderr);
6950 posix::Abort();
6951 }
6952 registered_tests_.insert(
6953 ::std::make_pair(test_name, CodeLocation(file, line)));
6954 return true;
6955 }
6956
6957 bool TestExists(const std::string& test_name) const {
6958 return registered_tests_.count(test_name) > 0;
6959 }
6960
6961 const CodeLocation& GetCodeLocation(const std::string& test_name) const {
6962 RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name);
6963 GTEST_CHECK_(it != registered_tests_.end());
6964 return it->second;
6965 }
6966
6967 // Verifies that registered_tests match the test names in
6968 // defined_test_names_; returns registered_tests if successful, or
6969 // aborts the program otherwise.
6970 const char* VerifyRegisteredTestNames(
6971 const char* file, int line, const char* registered_tests);
6972
6973 private:
6974 typedef ::std::map<std::string, CodeLocation> RegisteredTestsMap;
6975
6976 bool registered_;
6977 RegisteredTestsMap registered_tests_;
6978};
6979
6980// Legacy API is deprecated but still available
6981#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
6982using TypedTestCasePState = TypedTestSuitePState;
6983#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
6984
6986
6987// Skips to the first non-space char after the first comma in 'str';
6988// returns NULL if no comma is found in 'str'.
6989inline const char* SkipComma(const char* str) {
6990 const char* comma = strchr(str, ',');
6991 if (comma == nullptr) {
6992 return nullptr;
6993 }
6994 while (IsSpace(*(++comma))) {}
6995 return comma;
6996}
6997
6998// Returns the prefix of 'str' before the first comma in it; returns
6999// the entire string if it contains no comma.
7000inline std::string GetPrefixUntilComma(const char* str) {
7001 const char* comma = strchr(str, ',');
7002 return comma == nullptr ? str : std::string(str, comma);
7003}
7004
7005// Splits a given string on a given delimiter, populating a given
7006// vector with the fields.
7007void SplitString(const ::std::string& str, char delimiter,
7008 ::std::vector< ::std::string>* dest);
7009
7010// The default argument to the template below for the case when the user does
7011// not provide a name generator.
7012struct DefaultNameGenerator {
7013 template <typename T>
7014 static std::string GetName(int i) {
7015 return StreamableToString(i);
7016 }
7017};
7018
7019template <typename Provided = DefaultNameGenerator>
7020struct NameGeneratorSelector {
7021 typedef Provided type;
7022};
7023
7024template <typename NameGenerator>
7025void GenerateNamesRecursively(Types0, std::vector<std::string>*, int) {}
7026
7027template <typename NameGenerator, typename Types>
7028void GenerateNamesRecursively(Types, std::vector<std::string>* result, int i) {
7029 result->push_back(NameGenerator::template GetName<typename Types::Head>(i));
7030 GenerateNamesRecursively<NameGenerator>(typename Types::Tail(), result,
7031 i + 1);
7032}
7033
7034template <typename NameGenerator, typename Types>
7035std::vector<std::string> GenerateNames() {
7036 std::vector<std::string> result;
7037 GenerateNamesRecursively<NameGenerator>(Types(), &result, 0);
7038 return result;
7039}
7040
7041// TypeParameterizedTest<Fixture, TestSel, Types>::Register()
7042// registers a list of type-parameterized tests with Google Test. The
7043// return value is insignificant - we just need to return something
7044// such that we can call this function in a namespace scope.
7045//
7046// Implementation note: The GTEST_TEMPLATE_ macro declares a template
7047// template parameter. It's defined in gtest-type-util.h.
7048template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
7049class TypeParameterizedTest {
7050 public:
7051 // 'index' is the index of the test in the type list 'Types'
7052 // specified in INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, TestSuite,
7053 // Types). Valid values for 'index' are [0, N - 1] where N is the
7054 // length of Types.
7055 static bool Register(const char* prefix, const CodeLocation& code_location,
7056 const char* case_name, const char* test_names, int index,
7057 const std::vector<std::string>& type_names =
7058 GenerateNames<DefaultNameGenerator, Types>()) {
7059 typedef typename Types::Head Type;
7060 typedef Fixture<Type> FixtureClass;
7061 typedef typename GTEST_BIND_(TestSel, Type) TestClass;
7062
7063 // First, registers the first type-parameterized test in the type
7064 // list.
7066 (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name +
7067 "/" + type_names[static_cast<size_t>(index)])
7068 .c_str(),
7069 StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(),
7070 GetTypeName<Type>().c_str(),
7071 nullptr, // No value parameter.
7072 code_location, GetTypeId<FixtureClass>(),
7074 code_location.file.c_str(), code_location.line),
7076 code_location.file.c_str(), code_location.line),
7077 new TestFactoryImpl<TestClass>);
7078
7079 // Next, recurses (at compile time) with the tail of the type list.
7080 return TypeParameterizedTest<Fixture, TestSel,
7081 typename Types::Tail>::Register(prefix,
7082 code_location,
7083 case_name,
7084 test_names,
7085 index + 1,
7086 type_names);
7087 }
7088};
7089
7090// The base case for the compile time recursion.
7091template <GTEST_TEMPLATE_ Fixture, class TestSel>
7092class TypeParameterizedTest<Fixture, TestSel, Types0> {
7093 public:
7094 static bool Register(const char* /*prefix*/, const CodeLocation&,
7095 const char* /*case_name*/, const char* /*test_names*/,
7096 int /*index*/,
7097 const std::vector<std::string>& =
7098 std::vector<std::string>() /*type_names*/) {
7099 return true;
7100 }
7101};
7102
7103// TypeParameterizedTestSuite<Fixture, Tests, Types>::Register()
7104// registers *all combinations* of 'Tests' and 'Types' with Google
7105// Test. The return value is insignificant - we just need to return
7106// something such that we can call this function in a namespace scope.
7107template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
7108class TypeParameterizedTestSuite {
7109 public:
7110 static bool Register(const char* prefix, CodeLocation code_location,
7111 const TypedTestSuitePState* state, const char* case_name,
7112 const char* test_names,
7113 const std::vector<std::string>& type_names =
7114 GenerateNames<DefaultNameGenerator, Types>()) {
7115 std::string test_name = StripTrailingSpaces(
7116 GetPrefixUntilComma(test_names));
7117 if (!state->TestExists(test_name)) {
7118 fprintf(stderr, "Failed to get code location for test %s.%s at %s.",
7119 case_name, test_name.c_str(),
7120 FormatFileLocation(code_location.file.c_str(),
7121 code_location.line).c_str());
7122 fflush(stderr);
7123 posix::Abort();
7124 }
7125 const CodeLocation& test_location = state->GetCodeLocation(test_name);
7126
7127 typedef typename Tests::Head Head;
7128
7129 // First, register the first test in 'Test' for each type in 'Types'.
7130 TypeParameterizedTest<Fixture, Head, Types>::Register(
7131 prefix, test_location, case_name, test_names, 0, type_names);
7132
7133 // Next, recurses (at compile time) with the tail of the test list.
7134 return TypeParameterizedTestSuite<Fixture, typename Tests::Tail,
7135 Types>::Register(prefix, code_location,
7136 state, case_name,
7137 SkipComma(test_names),
7138 type_names);
7139 }
7140};
7141
7142// The base case for the compile time recursion.
7143template <GTEST_TEMPLATE_ Fixture, typename Types>
7144class TypeParameterizedTestSuite<Fixture, Templates0, Types> {
7145 public:
7146 static bool Register(const char* /*prefix*/, const CodeLocation&,
7147 const TypedTestSuitePState* /*state*/,
7148 const char* /*case_name*/, const char* /*test_names*/,
7149 const std::vector<std::string>& =
7150 std::vector<std::string>() /*type_names*/) {
7151 return true;
7152 }
7153};
7154
7155#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
7156
7157// Returns the current OS stack trace as an std::string.
7158//
7159// The maximum number of stack frames to be included is specified by
7160// the gtest_stack_trace_depth flag. The skip_count parameter
7161// specifies the number of top frames to be skipped, which doesn't
7162// count against the number of frames to be included.
7163//
7164// For example, if Foo() calls Bar(), which in turn calls
7165// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
7166// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
7168 UnitTest* unit_test, int skip_count);
7169
7170// Helpers for suppressing warnings on unreachable code or constant
7171// condition.
7172
7173// Always returns true.
7175
7176// Always returns false.
7177inline bool AlwaysFalse() { return !AlwaysTrue(); }
7178
7179// Helper for suppressing false warning from Clang on a const char*
7180// variable declared in a conditional expression always being NULL in
7181// the else branch.
7183 ConstCharPtr(const char* str) : value(str) {}
7184 operator bool() const { return true; }
7185 const char* value;
7186};
7187
7188// A simple Linear Congruential Generator for generating random
7189// numbers with a uniform distribution. Unlike rand() and srand(), it
7190// doesn't use global state (and therefore can't interfere with user
7191// code). Unlike rand_r(), it's portable. An LCG isn't very random,
7192// but it's good enough for our purposes.
7194 public:
7195 static const UInt32 kMaxRange = 1u << 31;
7196
7197 explicit Random(UInt32 seed) : state_(seed) {}
7198
7199 void Reseed(UInt32 seed) { state_ = seed; }
7200
7201 // Generates a random number from [0, range). Crashes if 'range' is
7202 // 0 or greater than kMaxRange.
7204
7205 private:
7206 UInt32 state_;
7208};
7209
7210// Turns const U&, U&, const U, and U all into U.
7211#define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
7212 typename std::remove_const<typename std::remove_reference<T>::type>::type
7213
7214// IsAProtocolMessage<T>::value is a compile-time bool constant that's
7215// true if and only if T is type proto2::Message or a subclass of it.
7216template <typename T>
7218 : public bool_constant<
7219 std::is_convertible<const T*, const ::proto2::Message*>::value> {};
7220
7221// When the compiler sees expression IsContainerTest<C>(0), if C is an
7222// STL-style container class, the first overload of IsContainerTest
7223// will be viable (since both C::iterator* and C::const_iterator* are
7224// valid types and NULL can be implicitly converted to them). It will
7225// be picked over the second overload as 'int' is a perfect match for
7226// the type of argument 0. If C::iterator or C::const_iterator is not
7227// a valid type, the first overload is not viable, and the second
7228// overload will be picked. Therefore, we can determine whether C is
7229// a container class by checking the type of IsContainerTest<C>(0).
7230// The value of the expression is insignificant.
7231//
7232// In C++11 mode we check the existence of a const_iterator and that an
7233// iterator is properly implemented for the container.
7234//
7235// For pre-C++11 that we look for both C::iterator and C::const_iterator.
7236// The reason is that C++ injects the name of a class as a member of the
7237// class itself (e.g. you can refer to class iterator as either
7238// 'iterator' or 'iterator::iterator'). If we look for C::iterator
7239// only, for example, we would mistakenly think that a class named
7240// iterator is an STL container.
7241//
7242// Also note that the simpler approach of overloading
7243// IsContainerTest(typename C::const_iterator*) and
7244// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
7245typedef int IsContainer;
7246template <class C,
7247 class Iterator = decltype(::std::declval<const C&>().begin()),
7248 class = decltype(::std::declval<const C&>().end()),
7249 class = decltype(++::std::declval<Iterator&>()),
7250 class = decltype(*::std::declval<Iterator>()),
7251 class = typename C::const_iterator>
7253 return 0;
7254}
7255
7256typedef char IsNotContainer;
7257template <class C>
7258IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
7259
7260// Trait to detect whether a type T is a hash table.
7261// The heuristic used is that the type contains an inner type `hasher` and does
7262// not contain an inner type `reverse_iterator`.
7263// If the container is iterable in reverse, then order might actually matter.
7264template <typename T>
7266 private:
7267 template <typename U>
7268 static char test(typename U::hasher*, typename U::reverse_iterator*);
7269 template <typename U>
7270 static int test(typename U::hasher*, ...);
7271 template <typename U>
7272 static char test(...);
7273
7274 public:
7275 static const bool value = sizeof(test<T>(nullptr, nullptr)) == sizeof(int);
7276};
7277
7278template <typename T>
7279const bool IsHashTable<T>::value;
7280
7281template <typename C,
7282 bool = sizeof(IsContainerTest<C>(0)) == sizeof(IsContainer)>
7284
7285template <typename C>
7286struct IsRecursiveContainerImpl<C, false> : public std::false_type {};
7287
7288// Since the IsRecursiveContainerImpl depends on the IsContainerTest we need to
7289// obey the same inconsistencies as the IsContainerTest, namely check if
7290// something is a container is relying on only const_iterator in C++11 and
7291// is relying on both const_iterator and iterator otherwise
7292template <typename C>
7294 using value_type = decltype(*std::declval<typename C::const_iterator>());
7295 using type =
7296 std::is_same<typename std::remove_const<
7297 typename std::remove_reference<value_type>::type>::type,
7298 C>;
7299};
7300
7301// IsRecursiveContainer<Type> is a unary compile-time predicate that
7302// evaluates whether C is a recursive container type. A recursive container
7303// type is a container type whose value_type is equal to the container type
7304// itself. An example for a recursive container type is
7305// boost::filesystem::path, whose iterator has a value_type that is equal to
7306// boost::filesystem::path.
7307template <typename C>
7309
7310// Utilities for native arrays.
7311
7312// ArrayEq() compares two k-dimensional native arrays using the
7313// elements' operator==, where k can be any integer >= 0. When k is
7314// 0, ArrayEq() degenerates into comparing a single pair of values.
7315
7316template <typename T, typename U>
7317bool ArrayEq(const T* lhs, size_t size, const U* rhs);
7318
7319// This generic version is used when k is 0.
7320template <typename T, typename U>
7321inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
7322
7323// This overload is used when k >= 1.
7324template <typename T, typename U, size_t N>
7325inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
7326 return internal::ArrayEq(lhs, N, rhs);
7327}
7328
7329// This helper reduces code bloat. If we instead put its logic inside
7330// the previous ArrayEq() function, arrays with different sizes would
7331// lead to different copies of the template code.
7332template <typename T, typename U>
7333bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
7334 for (size_t i = 0; i != size; i++) {
7335 if (!internal::ArrayEq(lhs[i], rhs[i]))
7336 return false;
7337 }
7338 return true;
7339}
7340
7341// Finds the first element in the iterator range [begin, end) that
7342// equals elem. Element may be a native array type itself.
7343template <typename Iter, typename Element>
7344Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
7345 for (Iter it = begin; it != end; ++it) {
7346 if (internal::ArrayEq(*it, elem))
7347 return it;
7348 }
7349 return end;
7350}
7351
7352// CopyArray() copies a k-dimensional native array using the elements'
7353// operator=, where k can be any integer >= 0. When k is 0,
7354// CopyArray() degenerates into copying a single value.
7355
7356template <typename T, typename U>
7357void CopyArray(const T* from, size_t size, U* to);
7358
7359// This generic version is used when k is 0.
7360template <typename T, typename U>
7361inline void CopyArray(const T& from, U* to) { *to = from; }
7362
7363// This overload is used when k >= 1.
7364template <typename T, typename U, size_t N>
7365inline void CopyArray(const T(&from)[N], U(*to)[N]) {
7367}
7368
7369// This helper reduces code bloat. If we instead put its logic inside
7370// the previous CopyArray() function, arrays with different sizes
7371// would lead to different copies of the template code.
7372template <typename T, typename U>
7373void CopyArray(const T* from, size_t size, U* to) {
7374 for (size_t i = 0; i != size; i++) {
7375 internal::CopyArray(from[i], to + i);
7376 }
7377}
7378
7379// The relation between an NativeArray object (see below) and the
7380// native array it represents.
7381// We use 2 different structs to allow non-copyable types to be used, as long
7382// as RelationToSourceReference() is passed.
7385
7386// Adapts a native array to a read-only STL-style container. Instead
7387// of the complete STL container concept, this adaptor only implements
7388// members useful for Google Mock's container matchers. New members
7389// should be added as needed. To simplify the implementation, we only
7390// support Element being a raw type (i.e. having no top-level const or
7391// reference modifier). It's the client's responsibility to satisfy
7392// this requirement. Element can be an array type itself (hence
7393// multi-dimensional arrays are supported).
7394template <typename Element>
7396 public:
7397 // STL-style container typedefs.
7398 typedef Element value_type;
7399 typedef Element* iterator;
7400 typedef const Element* const_iterator;
7401
7402 // Constructs from a native array. References the source.
7403 NativeArray(const Element* array, size_t count, RelationToSourceReference) {
7404 InitRef(array, count);
7405 }
7406
7407 // Constructs from a native array. Copies the source.
7408 NativeArray(const Element* array, size_t count, RelationToSourceCopy) {
7409 InitCopy(array, count);
7410 }
7411
7412 // Copy constructor.
7414 (this->*rhs.clone_)(rhs.array_, rhs.size_);
7415 }
7416
7418 if (clone_ != &NativeArray::InitRef)
7419 delete[] array_;
7420 }
7421
7422 // STL-style container methods.
7423 size_t size() const { return size_; }
7424 const_iterator begin() const { return array_; }
7425 const_iterator end() const { return array_ + size_; }
7426 bool operator==(const NativeArray& rhs) const {
7427 return size() == rhs.size() &&
7428 ArrayEq(begin(), size(), rhs.begin());
7429 }
7430
7431 private:
7432 static_assert(!std::is_const<Element>::value, "Type must not be const");
7433 static_assert(!std::is_reference<Element>::value,
7434 "Type must not be a reference");
7435
7436 // Initializes this object with a copy of the input.
7437 void InitCopy(const Element* array, size_t a_size) {
7438 Element* const copy = new Element[a_size];
7439 CopyArray(array, a_size, copy);
7440 array_ = copy;
7441 size_ = a_size;
7442 clone_ = &NativeArray::InitCopy;
7443 }
7444
7445 // Initializes this object with a reference of the input.
7446 void InitRef(const Element* array, size_t a_size) {
7447 array_ = array;
7448 size_ = a_size;
7449 clone_ = &NativeArray::InitRef;
7450 }
7451
7452 const Element* array_;
7453 size_t size_;
7454 void (NativeArray::*clone_)(const Element*, size_t);
7455
7456 GTEST_DISALLOW_ASSIGN_(NativeArray);
7457};
7458
7459// Backport of std::index_sequence.
7460template <size_t... Is>
7463};
7464
7465// Double the IndexSequence, and one if plus_one is true.
7466template <bool plus_one, typename T, size_t sizeofT>
7468template <size_t... I, size_t sizeofT>
7469struct DoubleSequence<true, IndexSequence<I...>, sizeofT> {
7470 using type = IndexSequence<I..., (sizeofT + I)..., 2 * sizeofT>;
7471};
7472template <size_t... I, size_t sizeofT>
7473struct DoubleSequence<false, IndexSequence<I...>, sizeofT> {
7474 using type = IndexSequence<I..., (sizeofT + I)...>;
7475};
7476
7477// Backport of std::make_index_sequence.
7478// It uses O(ln(N)) instantiation depth.
7479template <size_t N>
7481 : DoubleSequence<N % 2 == 1, typename MakeIndexSequence<N / 2>::type,
7482 N / 2>::type {};
7483
7484template <>
7486
7487// FIXME: This implementation of ElemFromList is O(1) in instantiation depth,
7488// but it is O(N^2) in total instantiations. Not sure if this is the best
7489// tradeoff, as it will make it somewhat slow to compile.
7490template <typename T, size_t, size_t>
7492
7493template <typename T, size_t I>
7494struct ElemFromListImpl<T, I, I> {
7495 using type = T;
7496};
7497
7498// Get the Nth element from T...
7499// It uses O(1) instantiation depth.
7500template <size_t N, typename I, typename... T>
7502
7503template <size_t N, size_t... I, typename... T>
7504struct ElemFromList<N, IndexSequence<I...>, T...>
7505 : ElemFromListImpl<T, N, I>... {};
7506
7507template <typename... T>
7508class FlatTuple;
7509
7510template <typename Derived, size_t I>
7512
7513template <typename... T, size_t I>
7516 typename ElemFromList<I, typename MakeIndexSequence<sizeof...(T)>::type,
7517 T...>::type;
7519 explicit FlatTupleElemBase(value_type t) : value(std::move(t)) {}
7521};
7522
7523template <typename Derived, typename Idx>
7525
7526template <size_t... Idx, typename... T>
7528 : FlatTupleElemBase<FlatTuple<T...>, Idx>... {
7529 using Indices = IndexSequence<Idx...>;
7530 FlatTupleBase() = default;
7531 explicit FlatTupleBase(T... t)
7532 : FlatTupleElemBase<FlatTuple<T...>, Idx>(std::move(t))... {}
7533};
7534
7535// Analog to std::tuple but with different tradeoffs.
7536// This class minimizes the template instantiation depth, thus allowing more
7537// elements that std::tuple would. std::tuple has been seen to require an
7538// instantiation depth of more than 10x the number of elements in some
7539// implementations.
7540// FlatTuple and ElemFromList are not recursive and have a fixed depth
7541// regardless of T...
7542// MakeIndexSequence, on the other hand, it is recursive but with an
7543// instantiation depth of O(ln(N)).
7544template <typename... T>
7546 : private FlatTupleBase<FlatTuple<T...>,
7547 typename MakeIndexSequence<sizeof...(T)>::type> {
7548 using Indices = typename FlatTuple::FlatTupleBase::Indices;
7549
7550 public:
7551 FlatTuple() = default;
7552 explicit FlatTuple(T... t) : FlatTuple::FlatTupleBase(std::move(t)...) {}
7553
7554 template <size_t I>
7555 const typename ElemFromList<I, Indices, T...>::type& Get() const {
7556 return static_cast<const FlatTupleElemBase<FlatTuple, I>*>(this)->value;
7557 }
7558
7559 template <size_t I>
7560 typename ElemFromList<I, Indices, T...>::type& Get() {
7561 return static_cast<FlatTupleElemBase<FlatTuple, I>*>(this)->value;
7562 }
7563};
7564
7565// Utility functions to be called with static_assert to induce deprecation
7566// warnings.
7568 "INSTANTIATE_TEST_CASE_P is deprecated, please use "
7569 "INSTANTIATE_TEST_SUITE_P")
7570constexpr bool InstantiateTestCase_P_IsDeprecated() { return true; }
7571
7573 "TYPED_TEST_CASE_P is deprecated, please use "
7574 "TYPED_TEST_SUITE_P")
7575constexpr bool TypedTestCase_P_IsDeprecated() { return true; }
7576
7578 "TYPED_TEST_CASE is deprecated, please use "
7579 "TYPED_TEST_SUITE")
7580constexpr bool TypedTestCaseIsDeprecated() { return true; }
7581
7583 "REGISTER_TYPED_TEST_CASE_P is deprecated, please use "
7584 "REGISTER_TYPED_TEST_SUITE_P")
7585constexpr bool RegisterTypedTestCase_P_IsDeprecated() { return true; }
7586
7588 "INSTANTIATE_TYPED_TEST_CASE_P is deprecated, please use "
7589 "INSTANTIATE_TYPED_TEST_SUITE_P")
7590constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; }
7591
7592} // namespace internal
7593} // namespace testing
7594
7595#define GTEST_MESSAGE_AT_(file, line, message, result_type) \
7596 ::testing::internal::AssertHelper(result_type, file, line, message) \
7597 = ::testing::Message()
7598
7599#define GTEST_MESSAGE_(message, result_type) \
7600 GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
7601
7602#define GTEST_FATAL_FAILURE_(message) \
7603 return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
7604
7605#define GTEST_NONFATAL_FAILURE_(message) \
7606 GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
7607
7608#define GTEST_SUCCESS_(message) \
7609 GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
7610
7611#define GTEST_SKIP_(message) \
7612 return GTEST_MESSAGE_(message, ::testing::TestPartResult::kSkip)
7613
7614// Suppress MSVC warning 4072 (unreachable code) for the code following
7615// statement if it returns or throws (or doesn't return or throw in some
7616// situations).
7617#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
7618 if (::testing::internal::AlwaysTrue()) { statement; }
7619
7620#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
7621 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7622 if (::testing::internal::ConstCharPtr gtest_msg = "") { \
7623 bool gtest_caught_expected = false; \
7624 try { \
7625 GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
7626 } \
7627 catch (expected_exception const&) { \
7628 gtest_caught_expected = true; \
7629 } \
7630 catch (...) { \
7631 gtest_msg.value = \
7632 "Expected: " #statement " throws an exception of type " \
7633 #expected_exception ".\n Actual: it throws a different type."; \
7634 goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
7635 } \
7636 if (!gtest_caught_expected) { \
7637 gtest_msg.value = \
7638 "Expected: " #statement " throws an exception of type " \
7639 #expected_exception ".\n Actual: it throws nothing."; \
7640 goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
7641 } \
7642 } else \
7643 GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
7644 fail(gtest_msg.value)
7645
7646#define GTEST_TEST_NO_THROW_(statement, fail) \
7647 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7648 if (::testing::internal::AlwaysTrue()) { \
7649 try { \
7650 GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
7651 } \
7652 catch (...) { \
7653 goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
7654 } \
7655 } else \
7656 GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
7657 fail("Expected: " #statement " doesn't throw an exception.\n" \
7658 " Actual: it throws.")
7659
7660#define GTEST_TEST_ANY_THROW_(statement, fail) \
7661 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7662 if (::testing::internal::AlwaysTrue()) { \
7663 bool gtest_caught_any = false; \
7664 try { \
7665 GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
7666 } \
7667 catch (...) { \
7668 gtest_caught_any = true; \
7669 } \
7670 if (!gtest_caught_any) { \
7671 goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
7672 } \
7673 } else \
7674 GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
7675 fail("Expected: " #statement " throws an exception.\n" \
7676 " Actual: it doesn't.")
7677
7678
7679// Implements Boolean test assertions such as EXPECT_TRUE. expression can be
7680// either a boolean expression or an AssertionResult. text is a textual
7681// represenation of expression as it was passed into the EXPECT_TRUE.
7682#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
7683 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7684 if (const ::testing::AssertionResult gtest_ar_ = \
7685 ::testing::AssertionResult(expression)) \
7686 ; \
7687 else \
7688 fail(::testing::internal::GetBoolAssertionFailureMessage(\
7689 gtest_ar_, text, #actual, #expected).c_str())
7690
7691#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
7692 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7693 if (::testing::internal::AlwaysTrue()) { \
7694 ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
7695 GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
7696 if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
7697 goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
7698 } \
7699 } else \
7700 GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
7701 fail("Expected: " #statement " doesn't generate new fatal " \
7702 "failures in the current thread.\n" \
7703 " Actual: it does.")
7704
7705// Expands to the name of the class that implements the given test.
7706#define GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
7707 test_suite_name##_##test_name##_Test
7708
7709// Helper macro for defining tests.
7710#define GTEST_TEST_(test_suite_name, test_name, parent_class, parent_id) \
7711 static_assert(sizeof(GTEST_STRINGIFY_(test_suite_name)) > 1, \
7712 "test_suite_name must not be empty"); \
7713 static_assert(sizeof(GTEST_STRINGIFY_(test_name)) > 1, \
7714 "test_name must not be empty"); \
7715 class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
7716 : public parent_class { \
7717 public: \
7718 GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
7719 \
7720 private: \
7721 virtual void TestBody(); \
7722 static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_; \
7723 GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
7724 test_name)); \
7725 }; \
7726 \
7727 ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_suite_name, \
7728 test_name)::test_info_ = \
7729 ::testing::internal::MakeAndRegisterTestInfo( \
7730 #test_suite_name, #test_name, nullptr, nullptr, \
7731 ::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \
7732 ::testing::internal::SuiteApiResolver< \
7733 parent_class>::GetSetUpCaseOrSuite(__FILE__, __LINE__), \
7734 ::testing::internal::SuiteApiResolver< \
7735 parent_class>::GetTearDownCaseOrSuite(__FILE__, __LINE__), \
7736 new ::testing::internal::TestFactoryImpl<GTEST_TEST_CLASS_NAME_( \
7737 test_suite_name, test_name)>); \
7738 void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
7739
7740#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
7741// Copyright 2005, Google Inc.
7742// All rights reserved.
7743//
7744// Redistribution and use in source and binary forms, with or without
7745// modification, are permitted provided that the following conditions are
7746// met:
7747//
7748// * Redistributions of source code must retain the above copyright
7749// notice, this list of conditions and the following disclaimer.
7750// * Redistributions in binary form must reproduce the above
7751// copyright notice, this list of conditions and the following disclaimer
7752// in the documentation and/or other materials provided with the
7753// distribution.
7754// * Neither the name of Google Inc. nor the names of its
7755// contributors may be used to endorse or promote products derived from
7756// this software without specific prior written permission.
7757//
7758// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7759// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7760// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7761// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7762// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
7763// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
7764// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
7765// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
7766// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7767// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
7768// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7769
7770//
7771// The Google C++ Testing and Mocking Framework (Google Test)
7772//
7773// This header file defines the public API for death tests. It is
7774// #included by gtest.h so a user doesn't need to include this
7775// directly.
7776// GOOGLETEST_CM0001 DO NOT DELETE
7777
7778#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
7779#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
7780
7781// Copyright 2005, Google Inc.
7782// All rights reserved.
7783//
7784// Redistribution and use in source and binary forms, with or without
7785// modification, are permitted provided that the following conditions are
7786// met:
7787//
7788// * Redistributions of source code must retain the above copyright
7789// notice, this list of conditions and the following disclaimer.
7790// * Redistributions in binary form must reproduce the above
7791// copyright notice, this list of conditions and the following disclaimer
7792// in the documentation and/or other materials provided with the
7793// distribution.
7794// * Neither the name of Google Inc. nor the names of its
7795// contributors may be used to endorse or promote products derived from
7796// this software without specific prior written permission.
7797//
7798// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7799// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7800// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7801// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7802// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
7803// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
7804// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
7805// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
7806// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7807// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
7808// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7809//
7810// The Google C++ Testing and Mocking Framework (Google Test)
7811//
7812// This header file defines internal utilities needed for implementing
7813// death tests. They are subject to change without notice.
7814// GOOGLETEST_CM0001 DO NOT DELETE
7815
7816#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
7817#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
7818
7819// Copyright 2007, Google Inc.
7820// All rights reserved.
7821//
7822// Redistribution and use in source and binary forms, with or without
7823// modification, are permitted provided that the following conditions are
7824// met:
7825//
7826// * Redistributions of source code must retain the above copyright
7827// notice, this list of conditions and the following disclaimer.
7828// * Redistributions in binary form must reproduce the above
7829// copyright notice, this list of conditions and the following disclaimer
7830// in the documentation and/or other materials provided with the
7831// distribution.
7832// * Neither the name of Google Inc. nor the names of its
7833// contributors may be used to endorse or promote products derived from
7834// this software without specific prior written permission.
7835//
7836// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7837// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7838// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7839// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7840// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
7841// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
7842// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
7843// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
7844// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7845// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
7846// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7847
7848// The Google C++ Testing and Mocking Framework (Google Test)
7849//
7850// This file implements just enough of the matcher interface to allow
7851// EXPECT_DEATH and friends to accept a matcher argument.
7852
7853// IWYU pragma: private, include "testing/base/public/gunit.h"
7854// IWYU pragma: friend third_party/googletest/googlemock/.*
7855// IWYU pragma: friend third_party/googletest/googletest/.*
7856
7857#ifndef GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
7858#define GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
7859
7860#include <memory>
7861#include <ostream>
7862#include <string>
7863#include <type_traits>
7864
7865// Copyright 2007, Google Inc.
7866// All rights reserved.
7867//
7868// Redistribution and use in source and binary forms, with or without
7869// modification, are permitted provided that the following conditions are
7870// met:
7871//
7872// * Redistributions of source code must retain the above copyright
7873// notice, this list of conditions and the following disclaimer.
7874// * Redistributions in binary form must reproduce the above
7875// copyright notice, this list of conditions and the following disclaimer
7876// in the documentation and/or other materials provided with the
7877// distribution.
7878// * Neither the name of Google Inc. nor the names of its
7879// contributors may be used to endorse or promote products derived from
7880// this software without specific prior written permission.
7881//
7882// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7883// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7884// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7885// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7886// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
7887// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
7888// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
7889// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
7890// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7891// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
7892// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7893
7894
7895// Google Test - The Google C++ Testing and Mocking Framework
7896//
7897// This file implements a universal value printer that can print a
7898// value of any type T:
7899//
7900// void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
7901//
7902// A user can teach this function how to print a class type T by
7903// defining either operator<<() or PrintTo() in the namespace that
7904// defines T. More specifically, the FIRST defined function in the
7905// following list will be used (assuming T is defined in namespace
7906// foo):
7907//
7908// 1. foo::PrintTo(const T&, ostream*)
7909// 2. operator<<(ostream&, const T&) defined in either foo or the
7910// global namespace.
7911//
7912// However if T is an STL-style container then it is printed element-wise
7913// unless foo::PrintTo(const T&, ostream*) is defined. Note that
7914// operator<<() is ignored for container types.
7915//
7916// If none of the above is defined, it will print the debug string of
7917// the value if it is a protocol buffer, or print the raw bytes in the
7918// value otherwise.
7919//
7920// To aid debugging: when T is a reference type, the address of the
7921// value is also printed; when T is a (const) char pointer, both the
7922// pointer value and the NUL-terminated string it points to are
7923// printed.
7924//
7925// We also provide some convenient wrappers:
7926//
7927// // Prints a value to a string. For a (const or not) char
7928// // pointer, the NUL-terminated string (but not the pointer) is
7929// // printed.
7930// std::string ::testing::PrintToString(const T& value);
7931//
7932// // Prints a value tersely: for a reference type, the referenced
7933// // value (but not the address) is printed; for a (const or not) char
7934// // pointer, the NUL-terminated string (but not the pointer) is
7935// // printed.
7936// void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
7937//
7938// // Prints value using the type inferred by the compiler. The difference
7939// // from UniversalTersePrint() is that this function prints both the
7940// // pointer and the NUL-terminated string for a (const or not) char pointer.
7941// void ::testing::internal::UniversalPrint(const T& value, ostream*);
7942//
7943// // Prints the fields of a tuple tersely to a string vector, one
7944// // element for each field. Tuple support must be enabled in
7945// // gtest-port.h.
7946// std::vector<string> UniversalTersePrintTupleFieldsToStrings(
7947// const Tuple& value);
7948//
7949// Known limitation:
7950//
7951// The print primitives print the elements of an STL-style container
7952// using the compiler-inferred type of *iter where iter is a
7953// const_iterator of the container. When const_iterator is an input
7954// iterator but not a forward iterator, this inferred type may not
7955// match value_type, and the print output may be incorrect. In
7956// practice, this is rarely a problem as for most containers
7957// const_iterator is a forward iterator. We'll fix this if there's an
7958// actual need for it. Note that this fix cannot rely on value_type
7959// being defined as many user-defined container types don't have
7960// value_type.
7961
7962// GOOGLETEST_CM0001 DO NOT DELETE
7963
7964#ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
7965#define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
7966
7967#include <functional>
7968#include <ostream> // NOLINT
7969#include <sstream>
7970#include <string>
7971#include <tuple>
7972#include <type_traits>
7973#include <utility>
7974#include <vector>
7975
7976#if GTEST_HAS_ABSL
7977#include "absl/strings/string_view.h"
7978#include "absl/types/optional.h"
7979#include "absl/types/variant.h"
7980#endif // GTEST_HAS_ABSL
7981
7982namespace testing {
7983
7984// Definitions in the 'internal' and 'internal2' name spaces are
7985// subject to change without notice. DO NOT USE THEM IN USER CODE!
7986namespace internal2 {
7987
7988// Prints the given number of bytes in the given object to the given
7989// ostream.
7990GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
7991 size_t count,
7992 ::std::ostream* os);
7993
7994// For selecting which printer to use when a given type has neither <<
7995// nor PrintTo().
7997 kProtobuf, // a protobuf type
7998 kConvertibleToInteger, // a type implicitly convertible to BiggestInt
7999 // (e.g. a named or unnamed enum type)
8000#if GTEST_HAS_ABSL
8001 kConvertibleToStringView, // a type implicitly convertible to
8002 // absl::string_view
8003#endif
8004 kOtherType // anything else
8006
8007// TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called
8008// by the universal printer to print a value of type T when neither
8009// operator<< nor PrintTo() is defined for T, where kTypeKind is the
8010// "kind" of T as defined by enum TypeKind.
8011template <typename T, TypeKind kTypeKind>
8013 public:
8014 // This default version is called when kTypeKind is kOtherType.
8015 static void PrintValue(const T& value, ::std::ostream* os) {
8017 static_cast<const unsigned char*>(
8018 reinterpret_cast<const void*>(std::addressof(value))),
8019 sizeof(value), os);
8020 }
8021};
8022
8023// We print a protobuf using its ShortDebugString() when the string
8024// doesn't exceed this many characters; otherwise we print it using
8025// DebugString() for better readability.
8027
8028template <typename T>
8030 public:
8031 static void PrintValue(const T& value, ::std::ostream* os) {
8032 std::string pretty_str = value.ShortDebugString();
8033 if (pretty_str.length() > kProtobufOneLinerMaxLength) {
8034 pretty_str = "\n" + value.DebugString();
8035 }
8036 *os << ("<" + pretty_str + ">");
8037 }
8038};
8039
8040template <typename T>
8042 public:
8043 // Since T has no << operator or PrintTo() but can be implicitly
8044 // converted to BiggestInt, we print it as a BiggestInt.
8045 //
8046 // Most likely T is an enum type (either named or unnamed), in which
8047 // case printing it as an integer is the desired behavior. In case
8048 // T is not an enum, printing it as an integer is the best we can do
8049 // given that it has no user-defined printer.
8050 static void PrintValue(const T& value, ::std::ostream* os) {
8051 const internal::BiggestInt kBigInt = value;
8052 *os << kBigInt;
8053 }
8054};
8055
8056#if GTEST_HAS_ABSL
8057template <typename T>
8058class TypeWithoutFormatter<T, kConvertibleToStringView> {
8059 public:
8060 // Since T has neither operator<< nor PrintTo() but can be implicitly
8061 // converted to absl::string_view, we print it as a absl::string_view.
8062 //
8063 // Note: the implementation is further below, as it depends on
8064 // internal::PrintTo symbol which is defined later in the file.
8065 static void PrintValue(const T& value, ::std::ostream* os);
8066};
8067#endif
8068
8069// Prints the given value to the given ostream. If the value is a
8070// protocol message, its debug string is printed; if it's an enum or
8071// of a type implicitly convertible to BiggestInt, it's printed as an
8072// integer; otherwise the bytes in the value are printed. This is
8073// what UniversalPrinter<T>::Print() does when it knows nothing about
8074// type T and T has neither << operator nor PrintTo().
8075//
8076// A user can override this behavior for a class type Foo by defining
8077// a << operator in the namespace where Foo is defined.
8078//
8079// We put this operator in namespace 'internal2' instead of 'internal'
8080// to simplify the implementation, as much code in 'internal' needs to
8081// use << in STL, which would conflict with our own << were it defined
8082// in 'internal'.
8083//
8084// Note that this operator<< takes a generic std::basic_ostream<Char,
8085// CharTraits> type instead of the more restricted std::ostream. If
8086// we define it to take an std::ostream instead, we'll get an
8087// "ambiguous overloads" compiler error when trying to print a type
8088// Foo that supports streaming to std::basic_ostream<Char,
8089// CharTraits>, as the compiler cannot tell whether
8090// operator<<(std::ostream&, const T&) or
8091// operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more
8092// specific.
8093template <typename Char, typename CharTraits, typename T>
8094::std::basic_ostream<Char, CharTraits>& operator<<(
8095 ::std::basic_ostream<Char, CharTraits>& os, const T& x) {
8096 TypeWithoutFormatter<T, (internal::IsAProtocolMessage<T>::value
8097 ? kProtobuf
8098 : std::is_convertible<
8101 :
8102#if GTEST_HAS_ABSL
8103 std::is_convertible<
8104 const T&, absl::string_view>::value
8105 ? kConvertibleToStringView
8106 :
8107#endif
8108 kOtherType)>::PrintValue(x, &os);
8109 return os;
8110}
8111
8112} // namespace internal2
8113} // namespace testing
8114
8115// This namespace MUST NOT BE NESTED IN ::testing, or the name look-up
8116// magic needed for implementing UniversalPrinter won't work.
8118
8119// Used to print a value that is not an STL-style container when the
8120// user doesn't define PrintTo() for it.
8121template <typename T>
8122void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
8123 // With the following statement, during unqualified name lookup,
8124 // testing::internal2::operator<< appears as if it was declared in
8125 // the nearest enclosing namespace that contains both
8126 // ::testing_internal and ::testing::internal2, i.e. the global
8127 // namespace. For more details, refer to the C++ Standard section
8128 // 7.3.4-1 [namespace.udir]. This allows us to fall back onto
8129 // testing::internal2::operator<< in case T doesn't come with a <<
8130 // operator.
8131 //
8132 // We cannot write 'using ::testing::internal2::operator<<;', which
8133 // gcc 3.3 fails to compile due to a compiler bug.
8134 using namespace ::testing::internal2; // NOLINT
8135
8136 // Assuming T is defined in namespace foo, in the next statement,
8137 // the compiler will consider all of:
8138 //
8139 // 1. foo::operator<< (thanks to Koenig look-up),
8140 // 2. ::operator<< (as the current namespace is enclosed in ::),
8141 // 3. testing::internal2::operator<< (thanks to the using statement above).
8142 //
8143 // The operator<< whose type matches T best will be picked.
8144 //
8145 // We deliberately allow #2 to be a candidate, as sometimes it's
8146 // impossible to define #1 (e.g. when foo is ::std, defining
8147 // anything in it is undefined behavior unless you are a compiler
8148 // vendor.).
8149 *os << value;
8150}
8151
8152} // namespace testing_internal
8153
8154namespace testing {
8155namespace internal {
8156
8157// FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
8158// value of type ToPrint that is an operand of a comparison assertion
8159// (e.g. ASSERT_EQ). OtherOperand is the type of the other operand in
8160// the comparison, and is used to help determine the best way to
8161// format the value. In particular, when the value is a C string
8162// (char pointer) and the other operand is an STL string object, we
8163// want to format the C string as a string, since we know it is
8164// compared by value with the string object. If the value is a char
8165// pointer but the other operand is not an STL string object, we don't
8166// know whether the pointer is supposed to point to a NUL-terminated
8167// string, and thus want to print it as a pointer to be safe.
8168//
8169// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
8170
8171// The default case.
8172template <typename ToPrint, typename OtherOperand>
8174 public:
8177 }
8178};
8179
8180// Array.
8181template <typename ToPrint, size_t N, typename OtherOperand>
8182class FormatForComparison<ToPrint[N], OtherOperand> {
8183 public:
8186 }
8187};
8188
8189// By default, print C string as pointers to be safe, as we don't know
8190// whether they actually point to a NUL-terminated string.
8191
8192#define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType) \
8193 template <typename OtherOperand> \
8194 class FormatForComparison<CharType*, OtherOperand> { \
8195 public: \
8196 static ::std::string Format(CharType* value) { \
8197 return ::testing::PrintToString(static_cast<const void*>(value)); \
8198 } \
8199 }
8200
8205
8206#undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
8207
8208// If a C string is compared with an STL string object, we know it's meant
8209// to point to a NUL-terminated string, and thus can print it as a string.
8210
8211#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
8212 template <> \
8213 class FormatForComparison<CharType*, OtherStringType> { \
8214 public: \
8215 static ::std::string Format(CharType* value) { \
8216 return ::testing::PrintToString(value); \
8217 } \
8218 }
8219
8222
8223#if GTEST_HAS_STD_WSTRING
8225GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
8226#endif
8227
8228#undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
8229
8230// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
8231// operand to be used in a failure message. The type (but not value)
8232// of the other operand may affect the format. This allows us to
8233// print a char* as a raw pointer when it is compared against another
8234// char* or void*, and print it as a C string when it is compared
8235// against an std::string object, for example.
8236//
8237// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
8238template <typename T1, typename T2>
8240 const T1& value, const T2& /* other_operand */) {
8242}
8243
8244// UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
8245// value to the given ostream. The caller must ensure that
8246// 'ostream_ptr' is not NULL, or the behavior is undefined.
8247//
8248// We define UniversalPrinter as a class template (as opposed to a
8249// function template), as we need to partially specialize it for
8250// reference types, which cannot be done with function templates.
8251template <typename T>
8252class UniversalPrinter;
8253
8254template <typename T>
8255void UniversalPrint(const T& value, ::std::ostream* os);
8256
8262};
8263template <DefaultPrinterType type> struct WrapPrinterType {};
8264
8265// Used to print an STL-style container when the user doesn't define
8266// a PrintTo() for it.
8267template <typename C>
8269 const C& container, ::std::ostream* os) {
8270 const size_t kMaxCount = 32; // The maximum number of elements to print.
8271 *os << '{';
8272 size_t count = 0;
8273 for (typename C::const_iterator it = container.begin();
8274 it != container.end(); ++it, ++count) {
8275 if (count > 0) {
8276 *os << ',';
8277 if (count == kMaxCount) { // Enough has been printed.
8278 *os << " ...";
8279 break;
8280 }
8281 }
8282 *os << ' ';
8283 // We cannot call PrintTo(*it, os) here as PrintTo() doesn't
8284 // handle *it being a native array.
8285 internal::UniversalPrint(*it, os);
8286 }
8287
8288 if (count > 0) {
8289 *os << ' ';
8290 }
8291 *os << '}';
8292}
8293
8294// Used to print a pointer that is neither a char pointer nor a member
8295// pointer, when the user doesn't define PrintTo() for it. (A member
8296// variable pointer or member function pointer doesn't really point to
8297// a location in the address space. Their representation is
8298// implementation-defined. Therefore they will be printed as raw
8299// bytes.)
8300template <typename T>
8302 T* p, ::std::ostream* os) {
8303 if (p == nullptr) {
8304 *os << "NULL";
8305 } else {
8306 // T is not a function type. We just call << to print p,
8307 // relying on ADL to pick up user-defined << for their pointer
8308 // types, if any.
8309 *os << p;
8310 }
8311}
8312template <typename T>
8314 T* p, ::std::ostream* os) {
8315 if (p == nullptr) {
8316 *os << "NULL";
8317 } else {
8318 // T is a function type, so '*os << p' doesn't do what we want
8319 // (it just prints p as bool). We want to print p as a const
8320 // void*.
8321 *os << reinterpret_cast<const void*>(p);
8322 }
8323}
8324
8325// Used to print a non-container, non-pointer value when the user
8326// doesn't define PrintTo() for it.
8327template <typename T>
8329 const T& value, ::std::ostream* os) {
8331}
8332
8333// Prints the given value using the << operator if it has one;
8334// otherwise prints the bytes in it. This is what
8335// UniversalPrinter<T>::Print() does when PrintTo() is not specialized
8336// or overloaded for type T.
8337//
8338// A user can override this behavior for a class type Foo by defining
8339// an overload of PrintTo() in the namespace where Foo is defined. We
8340// give the user this option as sometimes defining a << operator for
8341// Foo is not desirable (e.g. the coding style may prevent doing it,
8342// or there is already a << operator but it doesn't do what the user
8343// wants).
8344template <typename T>
8345void PrintTo(const T& value, ::std::ostream* os) {
8346 // DefaultPrintTo() is overloaded. The type of its first argument
8347 // determines which version will be picked.
8348 //
8349 // Note that we check for container types here, prior to we check
8350 // for protocol message types in our operator<<. The rationale is:
8351 //
8352 // For protocol messages, we want to give people a chance to
8353 // override Google Mock's format by defining a PrintTo() or
8354 // operator<<. For STL containers, other formats can be
8355 // incompatible with Google Mock's format for the container
8356 // elements; therefore we check for container types here to ensure
8357 // that our format is used.
8358 //
8359 // Note that MSVC and clang-cl do allow an implicit conversion from
8360 // pointer-to-function to pointer-to-object, but clang-cl warns on it.
8361 // So don't use ImplicitlyConvertible if it can be helped since it will
8362 // cause this warning, and use a separate overload of DefaultPrintTo for
8363 // function pointers so that the `*os << p` in the object pointer overload
8364 // doesn't cause that warning either.
8367 (sizeof(IsContainerTest<T>(0)) == sizeof(IsContainer)) &&
8371 ? kPrintOther
8372 : std::is_function<typename std::remove_pointer<T>::type>::value
8374 : kPrintPointer > (),
8375 value, os);
8376}
8377
8378// The following list of PrintTo() overloads tells
8379// UniversalPrinter<T>::Print() how to print standard types (built-in
8380// types, strings, plain arrays, and pointers).
8381
8382// Overloads for various char types.
8383GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);
8384GTEST_API_ void PrintTo(signed char c, ::std::ostream* os);
8385inline void PrintTo(char c, ::std::ostream* os) {
8386 // When printing a plain char, we always treat it as unsigned. This
8387 // way, the output won't be affected by whether the compiler thinks
8388 // char is signed or not.
8389 PrintTo(static_cast<unsigned char>(c), os);
8390}
8391
8392// Overloads for other simple built-in types.
8393inline void PrintTo(bool x, ::std::ostream* os) {
8394 *os << (x ? "true" : "false");
8395}
8396
8397// Overload for wchar_t type.
8398// Prints a wchar_t as a symbol if it is printable or as its internal
8399// code otherwise and also as its decimal code (except for L'\0').
8400// The L'\0' char is printed as "L'\\0'". The decimal code is printed
8401// as signed integer when wchar_t is implemented by the compiler
8402// as a signed type and is printed as an unsigned integer when wchar_t
8403// is implemented as an unsigned type.
8404GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
8405
8406// Overloads for C strings.
8407GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
8408inline void PrintTo(char* s, ::std::ostream* os) {
8409 PrintTo(ImplicitCast_<const char*>(s), os);
8410}
8411
8412// signed/unsigned char is often used for representing binary data, so
8413// we print pointers to it as void* to be safe.
8414inline void PrintTo(const signed char* s, ::std::ostream* os) {
8415 PrintTo(ImplicitCast_<const void*>(s), os);
8416}
8417inline void PrintTo(signed char* s, ::std::ostream* os) {
8418 PrintTo(ImplicitCast_<const void*>(s), os);
8419}
8420inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
8421 PrintTo(ImplicitCast_<const void*>(s), os);
8422}
8423inline void PrintTo(unsigned char* s, ::std::ostream* os) {
8424 PrintTo(ImplicitCast_<const void*>(s), os);
8425}
8426
8427// MSVC can be configured to define wchar_t as a typedef of unsigned
8428// short. It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
8429// type. When wchar_t is a typedef, defining an overload for const
8430// wchar_t* would cause unsigned short* be printed as a wide string,
8431// possibly causing invalid memory accesses.
8432#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
8433// Overloads for wide C strings
8434GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);
8435inline void PrintTo(wchar_t* s, ::std::ostream* os) {
8436 PrintTo(ImplicitCast_<const wchar_t*>(s), os);
8437}
8438#endif
8439
8440// Overload for C arrays. Multi-dimensional arrays are printed
8441// properly.
8442
8443// Prints the given number of elements in an array, without printing
8444// the curly braces.
8445template <typename T>
8446void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
8447 UniversalPrint(a[0], os);
8448 for (size_t i = 1; i != count; i++) {
8449 *os << ", ";
8450 UniversalPrint(a[i], os);
8451 }
8452}
8453
8454// Overloads for ::std::string.
8456inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
8457 PrintStringTo(s, os);
8458}
8459
8460// Overloads for ::std::wstring.
8461#if GTEST_HAS_STD_WSTRING
8462GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
8463inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
8464 PrintWideStringTo(s, os);
8465}
8466#endif // GTEST_HAS_STD_WSTRING
8467
8468#if GTEST_HAS_ABSL
8469// Overload for absl::string_view.
8470inline void PrintTo(absl::string_view sp, ::std::ostream* os) {
8471 PrintTo(::std::string(sp), os);
8472}
8473#endif // GTEST_HAS_ABSL
8474
8475inline void PrintTo(std::nullptr_t, ::std::ostream* os) { *os << "(nullptr)"; }
8476
8477template <typename T>
8478void PrintTo(std::reference_wrapper<T> ref, ::std::ostream* os) {
8479 UniversalPrinter<T&>::Print(ref.get(), os);
8480}
8481
8482// Helper function for printing a tuple. T must be instantiated with
8483// a tuple type.
8484template <typename T>
8485void PrintTupleTo(const T&, std::integral_constant<size_t, 0>,
8486 ::std::ostream*) {}
8487
8488template <typename T, size_t I>
8489void PrintTupleTo(const T& t, std::integral_constant<size_t, I>,
8490 ::std::ostream* os) {
8491 PrintTupleTo(t, std::integral_constant<size_t, I - 1>(), os);
8493 if (I > 1) {
8495 *os << ", ";
8496 }
8497 UniversalPrinter<typename std::tuple_element<I - 1, T>::type>::Print(
8498 std::get<I - 1>(t), os);
8499}
8500
8501template <typename... Types>
8502void PrintTo(const ::std::tuple<Types...>& t, ::std::ostream* os) {
8503 *os << "(";
8504 PrintTupleTo(t, std::integral_constant<size_t, sizeof...(Types)>(), os);
8505 *os << ")";
8506}
8507
8508// Overload for std::pair.
8509template <typename T1, typename T2>
8510void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
8511 *os << '(';
8512 // We cannot use UniversalPrint(value.first, os) here, as T1 may be
8513 // a reference type. The same for printing value.second.
8515 *os << ", ";
8517 *os << ')';
8518}
8519
8520// Implements printing a non-reference type T by letting the compiler
8521// pick the right overload of PrintTo() for T.
8522template <typename T>
8524 public:
8525 // MSVC warns about adding const to a function type, so we want to
8526 // disable the warning.
8528
8529 // Note: we deliberately don't call this PrintTo(), as that name
8530 // conflicts with ::testing::internal::PrintTo in the body of the
8531 // function.
8532 static void Print(const T& value, ::std::ostream* os) {
8533 // By default, ::testing::internal::PrintTo() is used for printing
8534 // the value.
8535 //
8536 // Thanks to Koenig look-up, if T is a class and has its own
8537 // PrintTo() function defined in its namespace, that function will
8538 // be visible here. Since it is more specific than the generic ones
8539 // in ::testing::internal, it will be picked by the compiler in the
8540 // following statement - exactly what we want.
8541 PrintTo(value, os);
8542 }
8543
8545};
8546
8547#if GTEST_HAS_ABSL
8548
8549// Printer for absl::optional
8550
8551template <typename T>
8552class UniversalPrinter<::absl::optional<T>> {
8553 public:
8554 static void Print(const ::absl::optional<T>& value, ::std::ostream* os) {
8555 *os << '(';
8556 if (!value) {
8557 *os << "nullopt";
8558 } else {
8559 UniversalPrint(*value, os);
8560 }
8561 *os << ')';
8562 }
8563};
8564
8565// Printer for absl::variant
8566
8567template <typename... T>
8568class UniversalPrinter<::absl::variant<T...>> {
8569 public:
8570 static void Print(const ::absl::variant<T...>& value, ::std::ostream* os) {
8571 *os << '(';
8572 absl::visit(Visitor{os}, value);
8573 *os << ')';
8574 }
8575
8576 private:
8577 struct Visitor {
8578 template <typename U>
8579 void operator()(const U& u) const {
8580 *os << "'" << GetTypeName<U>() << "' with value ";
8581 UniversalPrint(u, os);
8582 }
8583 ::std::ostream* os;
8584 };
8585};
8586
8587#endif // GTEST_HAS_ABSL
8588
8589// UniversalPrintArray(begin, len, os) prints an array of 'len'
8590// elements, starting at address 'begin'.
8591template <typename T>
8592void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
8593 if (len == 0) {
8594 *os << "{}";
8595 } else {
8596 *os << "{ ";
8597 const size_t kThreshold = 18;
8598 const size_t kChunkSize = 8;
8599 // If the array has more than kThreshold elements, we'll have to
8600 // omit some details by printing only the first and the last
8601 // kChunkSize elements.
8602 if (len <= kThreshold) {
8603 PrintRawArrayTo(begin, len, os);
8604 } else {
8605 PrintRawArrayTo(begin, kChunkSize, os);
8606 *os << ", ..., ";
8607 PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
8608 }
8609 *os << " }";
8610 }
8611}
8612// This overload prints a (const) char array compactly.
8614 const char* begin, size_t len, ::std::ostream* os);
8615
8616// This overload prints a (const) wchar_t array compactly.
8618 const wchar_t* begin, size_t len, ::std::ostream* os);
8619
8620// Implements printing an array type T[N].
8621template <typename T, size_t N>
8622class UniversalPrinter<T[N]> {
8623 public:
8624 // Prints the given array, omitting some elements when there are too
8625 // many.
8626 static void Print(const T (&a)[N], ::std::ostream* os) {
8627 UniversalPrintArray(a, N, os);
8628 }
8629};
8630
8631// Implements printing a reference type T&.
8632template <typename T>
8634 public:
8635 // MSVC warns about adding const to a function type, so we want to
8636 // disable the warning.
8638
8639 static void Print(const T& value, ::std::ostream* os) {
8640 // Prints the address of the value. We use reinterpret_cast here
8641 // as static_cast doesn't compile when T is a function type.
8642 *os << "@" << reinterpret_cast<const void*>(&value) << " ";
8643
8644 // Then prints the value itself.
8645 UniversalPrint(value, os);
8646 }
8647
8649};
8650
8651// Prints a value tersely: for a reference type, the referenced value
8652// (but not the address) is printed; for a (const) char pointer, the
8653// NUL-terminated string (but not the pointer) is printed.
8654
8655template <typename T>
8657 public:
8658 static void Print(const T& value, ::std::ostream* os) {
8659 UniversalPrint(value, os);
8660 }
8661};
8662template <typename T>
8664 public:
8665 static void Print(const T& value, ::std::ostream* os) {
8666 UniversalPrint(value, os);
8667 }
8668};
8669template <typename T, size_t N>
8671 public:
8672 static void Print(const T (&value)[N], ::std::ostream* os) {
8674 }
8675};
8676template <>
8677class UniversalTersePrinter<const char*> {
8678 public:
8679 static void Print(const char* str, ::std::ostream* os) {
8680 if (str == nullptr) {
8681 *os << "NULL";
8682 } else {
8683 UniversalPrint(std::string(str), os);
8684 }
8685 }
8686};
8687template <>
8689 public:
8690 static void Print(char* str, ::std::ostream* os) {
8692 }
8693};
8694
8695#if GTEST_HAS_STD_WSTRING
8696template <>
8697class UniversalTersePrinter<const wchar_t*> {
8698 public:
8699 static void Print(const wchar_t* str, ::std::ostream* os) {
8700 if (str == nullptr) {
8701 *os << "NULL";
8702 } else {
8703 UniversalPrint(::std::wstring(str), os);
8704 }
8705 }
8706};
8707#endif
8708
8709template <>
8710class UniversalTersePrinter<wchar_t*> {
8711 public:
8712 static void Print(wchar_t* str, ::std::ostream* os) {
8714 }
8715};
8716
8717template <typename T>
8718void UniversalTersePrint(const T& value, ::std::ostream* os) {
8720}
8721
8722// Prints a value using the type inferred by the compiler. The
8723// difference between this and UniversalTersePrint() is that for a
8724// (const) char pointer, this prints both the pointer and the
8725// NUL-terminated string.
8726template <typename T>
8727void UniversalPrint(const T& value, ::std::ostream* os) {
8728 // A workarond for the bug in VC++ 7.1 that prevents us from instantiating
8729 // UniversalPrinter with T directly.
8730 typedef T T1;
8732}
8733
8734typedef ::std::vector< ::std::string> Strings;
8735
8736 // Tersely prints the first N fields of a tuple to a string vector,
8737 // one element for each field.
8738template <typename Tuple>
8739void TersePrintPrefixToStrings(const Tuple&, std::integral_constant<size_t, 0>,
8740 Strings*) {}
8741template <typename Tuple, size_t I>
8743 std::integral_constant<size_t, I>,
8744 Strings* strings) {
8745 TersePrintPrefixToStrings(t, std::integral_constant<size_t, I - 1>(),
8746 strings);
8747 ::std::stringstream ss;
8748 UniversalTersePrint(std::get<I - 1>(t), &ss);
8749 strings->push_back(ss.str());
8750}
8751
8752// Prints the fields of a tuple tersely to a string vector, one
8753// element for each field. See the comment before
8754// UniversalTersePrint() for how we define "tersely".
8755template <typename Tuple>
8757 Strings result;
8759 value, std::integral_constant<size_t, std::tuple_size<Tuple>::value>(),
8760 &result);
8761 return result;
8762}
8763
8764} // namespace internal
8765
8766#if GTEST_HAS_ABSL
8767namespace internal2 {
8768template <typename T>
8770 const T& value, ::std::ostream* os) {
8771 internal::PrintTo(absl::string_view(value), os);
8772}
8773} // namespace internal2
8774#endif
8775
8776template <typename T>
8778 ::std::stringstream ss;
8780 return ss.str();
8781}
8782
8783} // namespace testing
8784
8785// Include any custom printer added by the local installation.
8786// We must include this header at the end to make sure it can use the
8787// declarations from this file.
8788// Copyright 2015, Google Inc.
8789// All rights reserved.
8790//
8791// Redistribution and use in source and binary forms, with or without
8792// modification, are permitted provided that the following conditions are
8793// met:
8794//
8795// * Redistributions of source code must retain the above copyright
8796// notice, this list of conditions and the following disclaimer.
8797// * Redistributions in binary form must reproduce the above
8798// copyright notice, this list of conditions and the following disclaimer
8799// in the documentation and/or other materials provided with the
8800// distribution.
8801// * Neither the name of Google Inc. nor the names of its
8802// contributors may be used to endorse or promote products derived from
8803// this software without specific prior written permission.
8804//
8805// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8806// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8807// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8808// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8809// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8810// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8811// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8812// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8813// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8814// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
8815// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8816//
8817// This file provides an injection point for custom printers in a local
8818// installation of gTest.
8819// It will be included from gtest-printers.h and the overrides in this file
8820// will be visible to everyone.
8821//
8822// Injection point for custom user configurations. See README for details
8823//
8824// ** Custom implementation starts here **
8825
8826#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
8827#define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
8828
8829#endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
8830
8831#endif // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
8832
8833// MSVC warning C5046 is new as of VS2017 version 15.8.
8834#if defined(_MSC_VER) && _MSC_VER >= 1915
8835#define GTEST_MAYBE_5046_ 5046
8836#else
8837#define GTEST_MAYBE_5046_
8838#endif
8839
8841 4251 GTEST_MAYBE_5046_ /* class A needs to have dll-interface to be used by
8842 clients of class B */
8843 /* Symbol involving type with internal linkage not defined */)
8844
8845namespace testing {
8846
8847// To implement a matcher Foo for type T, define:
8848// 1. a class FooMatcherImpl that implements the
8849// MatcherInterface<T> interface, and
8850// 2. a factory function that creates a Matcher<T> object from a
8851// FooMatcherImpl*.
8852//
8853// The two-level delegation design makes it possible to allow a user
8854// to write "v" instead of "Eq(v)" where a Matcher is expected, which
8855// is impossible if we pass matchers by pointers. It also eases
8856// ownership management as Matcher objects can now be copied like
8857// plain values.
8858
8859// MatchResultListener is an abstract class. Its << operator can be
8860// used by a matcher to explain why a value matches or doesn't match.
8861//
8862class MatchResultListener {
8863 public:
8864 // Creates a listener object with the given underlying ostream. The
8865 // listener does not own the ostream, and does not dereference it
8866 // in the constructor or destructor.
8867 explicit MatchResultListener(::std::ostream* os) : stream_(os) {}
8868 virtual ~MatchResultListener() = 0; // Makes this class abstract.
8869
8870 // Streams x to the underlying ostream; does nothing if the ostream
8871 // is NULL.
8872 template <typename T>
8873 MatchResultListener& operator<<(const T& x) {
8874 if (stream_ != nullptr) *stream_ << x;
8875 return *this;
8876 }
8877
8878 // Returns the underlying ostream.
8879 ::std::ostream* stream() { return stream_; }
8880
8881 // Returns true if and only if the listener is interested in an explanation
8882 // of the match result. A matcher's MatchAndExplain() method can use
8883 // this information to avoid generating the explanation when no one
8884 // intends to hear it.
8885 bool IsInterested() const { return stream_ != nullptr; }
8886
8887 private:
8888 ::std::ostream* const stream_;
8889
8890 GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener);
8891};
8892
8893inline MatchResultListener::~MatchResultListener() {
8894}
8895
8896// An instance of a subclass of this knows how to describe itself as a
8897// matcher.
8898class MatcherDescriberInterface {
8899 public:
8900 virtual ~MatcherDescriberInterface() {}
8901
8902 // Describes this matcher to an ostream. The function should print
8903 // a verb phrase that describes the property a value matching this
8904 // matcher should have. The subject of the verb phrase is the value
8905 // being matched. For example, the DescribeTo() method of the Gt(7)
8906 // matcher prints "is greater than 7".
8907 virtual void DescribeTo(::std::ostream* os) const = 0;
8908
8909 // Describes the negation of this matcher to an ostream. For
8910 // example, if the description of this matcher is "is greater than
8911 // 7", the negated description could be "is not greater than 7".
8912 // You are not required to override this when implementing
8913 // MatcherInterface, but it is highly advised so that your matcher
8914 // can produce good error messages.
8915 virtual void DescribeNegationTo(::std::ostream* os) const {
8916 *os << "not (";
8917 DescribeTo(os);
8918 *os << ")";
8919 }
8920};
8921
8922// The implementation of a matcher.
8923template <typename T>
8924class MatcherInterface : public MatcherDescriberInterface {
8925 public:
8926 // Returns true if and only if the matcher matches x; also explains the
8927 // match result to 'listener' if necessary (see the next paragraph), in
8928 // the form of a non-restrictive relative clause ("which ...",
8929 // "whose ...", etc) that describes x. For example, the
8930 // MatchAndExplain() method of the Pointee(...) matcher should
8931 // generate an explanation like "which points to ...".
8932 //
8933 // Implementations of MatchAndExplain() should add an explanation of
8934 // the match result *if and only if* they can provide additional
8935 // information that's not already present (or not obvious) in the
8936 // print-out of x and the matcher's description. Whether the match
8937 // succeeds is not a factor in deciding whether an explanation is
8938 // needed, as sometimes the caller needs to print a failure message
8939 // when the match succeeds (e.g. when the matcher is used inside
8940 // Not()).
8941 //
8942 // For example, a "has at least 10 elements" matcher should explain
8943 // what the actual element count is, regardless of the match result,
8944 // as it is useful information to the reader; on the other hand, an
8945 // "is empty" matcher probably only needs to explain what the actual
8946 // size is when the match fails, as it's redundant to say that the
8947 // size is 0 when the value is already known to be empty.
8948 //
8949 // You should override this method when defining a new matcher.
8950 //
8951 // It's the responsibility of the caller (Google Test) to guarantee
8952 // that 'listener' is not NULL. This helps to simplify a matcher's
8953 // implementation when it doesn't care about the performance, as it
8954 // can talk to 'listener' without checking its validity first.
8955 // However, in order to implement dummy listeners efficiently,
8956 // listener->stream() may be NULL.
8957 virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0;
8958
8959 // Inherits these methods from MatcherDescriberInterface:
8960 // virtual void DescribeTo(::std::ostream* os) const = 0;
8961 // virtual void DescribeNegationTo(::std::ostream* os) const;
8962};
8963
8964namespace internal {
8965
8966// Converts a MatcherInterface<T> to a MatcherInterface<const T&>.
8967template <typename T>
8968class MatcherInterfaceAdapter : public MatcherInterface<const T&> {
8969 public:
8970 explicit MatcherInterfaceAdapter(const MatcherInterface<T>* impl)
8971 : impl_(impl) {}
8972 ~MatcherInterfaceAdapter() override { delete impl_; }
8973
8974 void DescribeTo(::std::ostream* os) const override { impl_->DescribeTo(os); }
8975
8976 void DescribeNegationTo(::std::ostream* os) const override {
8977 impl_->DescribeNegationTo(os);
8978 }
8979
8980 bool MatchAndExplain(const T& x,
8981 MatchResultListener* listener) const override {
8982 return impl_->MatchAndExplain(x, listener);
8983 }
8984
8985 private:
8986 const MatcherInterface<T>* const impl_;
8987
8988 GTEST_DISALLOW_COPY_AND_ASSIGN_(MatcherInterfaceAdapter);
8989};
8990
8991struct AnyEq {
8992 template <typename A, typename B>
8993 bool operator()(const A& a, const B& b) const { return a == b; }
8994};
8995struct AnyNe {
8996 template <typename A, typename B>
8997 bool operator()(const A& a, const B& b) const { return a != b; }
8998};
8999struct AnyLt {
9000 template <typename A, typename B>
9001 bool operator()(const A& a, const B& b) const { return a < b; }
9002};
9003struct AnyGt {
9004 template <typename A, typename B>
9005 bool operator()(const A& a, const B& b) const { return a > b; }
9006};
9007struct AnyLe {
9008 template <typename A, typename B>
9009 bool operator()(const A& a, const B& b) const { return a <= b; }
9010};
9011struct AnyGe {
9012 template <typename A, typename B>
9013 bool operator()(const A& a, const B& b) const { return a >= b; }
9014};
9015
9016// A match result listener that ignores the explanation.
9017class DummyMatchResultListener : public MatchResultListener {
9018 public:
9019 DummyMatchResultListener() : MatchResultListener(nullptr) {}
9020
9021 private:
9022 GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener);
9023};
9024
9025// A match result listener that forwards the explanation to a given
9026// ostream. The difference between this and MatchResultListener is
9027// that the former is concrete.
9028class StreamMatchResultListener : public MatchResultListener {
9029 public:
9030 explicit StreamMatchResultListener(::std::ostream* os)
9031 : MatchResultListener(os) {}
9032
9033 private:
9034 GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener);
9035};
9036
9037// An internal class for implementing Matcher<T>, which will derive
9038// from it. We put functionalities common to all Matcher<T>
9039// specializations here to avoid code duplication.
9040template <typename T>
9041class MatcherBase {
9042 public:
9043 // Returns true if and only if the matcher matches x; also explains the
9044 // match result to 'listener'.
9045 bool MatchAndExplain(const T& x, MatchResultListener* listener) const {
9046 return impl_->MatchAndExplain(x, listener);
9047 }
9048
9049 // Returns true if and only if this matcher matches x.
9050 bool Matches(const T& x) const {
9051 DummyMatchResultListener dummy;
9052 return MatchAndExplain(x, &dummy);
9053 }
9054
9055 // Describes this matcher to an ostream.
9056 void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); }
9057
9058 // Describes the negation of this matcher to an ostream.
9059 void DescribeNegationTo(::std::ostream* os) const {
9060 impl_->DescribeNegationTo(os);
9061 }
9062
9063 // Explains why x matches, or doesn't match, the matcher.
9064 void ExplainMatchResultTo(const T& x, ::std::ostream* os) const {
9065 StreamMatchResultListener listener(os);
9066 MatchAndExplain(x, &listener);
9067 }
9068
9069 // Returns the describer for this matcher object; retains ownership
9070 // of the describer, which is only guaranteed to be alive when
9071 // this matcher object is alive.
9072 const MatcherDescriberInterface* GetDescriber() const {
9073 return impl_.get();
9074 }
9075
9076 protected:
9077 MatcherBase() {}
9078
9079 // Constructs a matcher from its implementation.
9080 explicit MatcherBase(const MatcherInterface<const T&>* impl) : impl_(impl) {}
9081
9082 template <typename U>
9083 explicit MatcherBase(
9084 const MatcherInterface<U>* impl,
9085 typename std::enable_if<!std::is_same<U, const U&>::value>::type* =
9086 nullptr)
9087 : impl_(new internal::MatcherInterfaceAdapter<U>(impl)) {}
9088
9089 MatcherBase(const MatcherBase&) = default;
9090 MatcherBase& operator=(const MatcherBase&) = default;
9091 MatcherBase(MatcherBase&&) = default;
9092 MatcherBase& operator=(MatcherBase&&) = default;
9093
9094 virtual ~MatcherBase() {}
9095
9096 private:
9097 std::shared_ptr<const MatcherInterface<const T&>> impl_;
9098};
9099
9100} // namespace internal
9101
9102// A Matcher<T> is a copyable and IMMUTABLE (except by assignment)
9103// object that can check whether a value of type T matches. The
9104// implementation of Matcher<T> is just a std::shared_ptr to const
9105// MatcherInterface<T>. Don't inherit from Matcher!
9106template <typename T>
9107class Matcher : public internal::MatcherBase<T> {
9108 public:
9109 // Constructs a null matcher. Needed for storing Matcher objects in STL
9110 // containers. A default-constructed matcher is not yet initialized. You
9111 // cannot use it until a valid value has been assigned to it.
9112 explicit Matcher() {} // NOLINT
9113
9114 // Constructs a matcher from its implementation.
9115 explicit Matcher(const MatcherInterface<const T&>* impl)
9116 : internal::MatcherBase<T>(impl) {}
9117
9118 template <typename U>
9119 explicit Matcher(
9120 const MatcherInterface<U>* impl,
9121 typename std::enable_if<!std::is_same<U, const U&>::value>::type* =
9122 nullptr)
9123 : internal::MatcherBase<T>(impl) {}
9124
9125 // Implicit constructor here allows people to write
9126 // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes
9127 Matcher(T value); // NOLINT
9128};
9129
9130// The following two specializations allow the user to write str
9131// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string
9132// matcher is expected.
9133template <>
9134class GTEST_API_ Matcher<const std::string&>
9135 : public internal::MatcherBase<const std::string&> {
9136 public:
9137 Matcher() {}
9138
9139 explicit Matcher(const MatcherInterface<const std::string&>* impl)
9140 : internal::MatcherBase<const std::string&>(impl) {}
9141
9142 // Allows the user to write str instead of Eq(str) sometimes, where
9143 // str is a std::string object.
9144 Matcher(const std::string& s); // NOLINT
9145
9146 // Allows the user to write "foo" instead of Eq("foo") sometimes.
9147 Matcher(const char* s); // NOLINT
9148};
9149
9150template <>
9151class GTEST_API_ Matcher<std::string>
9152 : public internal::MatcherBase<std::string> {
9153 public:
9154 Matcher() {}
9155
9156 explicit Matcher(const MatcherInterface<const std::string&>* impl)
9157 : internal::MatcherBase<std::string>(impl) {}
9158 explicit Matcher(const MatcherInterface<std::string>* impl)
9159 : internal::MatcherBase<std::string>(impl) {}
9160
9161 // Allows the user to write str instead of Eq(str) sometimes, where
9162 // str is a string object.
9163 Matcher(const std::string& s); // NOLINT
9164
9165 // Allows the user to write "foo" instead of Eq("foo") sometimes.
9166 Matcher(const char* s); // NOLINT
9167};
9168
9169#if GTEST_HAS_ABSL
9170// The following two specializations allow the user to write str
9171// instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
9172// matcher is expected.
9173template <>
9174class GTEST_API_ Matcher<const absl::string_view&>
9175 : public internal::MatcherBase<const absl::string_view&> {
9176 public:
9177 Matcher() {}
9178
9179 explicit Matcher(const MatcherInterface<const absl::string_view&>* impl)
9180 : internal::MatcherBase<const absl::string_view&>(impl) {}
9181
9182 // Allows the user to write str instead of Eq(str) sometimes, where
9183 // str is a std::string object.
9184 Matcher(const std::string& s); // NOLINT
9185
9186 // Allows the user to write "foo" instead of Eq("foo") sometimes.
9187 Matcher(const char* s); // NOLINT
9188
9189 // Allows the user to pass absl::string_views directly.
9190 Matcher(absl::string_view s); // NOLINT
9191};
9192
9193template <>
9194class GTEST_API_ Matcher<absl::string_view>
9195 : public internal::MatcherBase<absl::string_view> {
9196 public:
9197 Matcher() {}
9198
9199 explicit Matcher(const MatcherInterface<const absl::string_view&>* impl)
9200 : internal::MatcherBase<absl::string_view>(impl) {}
9201 explicit Matcher(const MatcherInterface<absl::string_view>* impl)
9202 : internal::MatcherBase<absl::string_view>(impl) {}
9203
9204 // Allows the user to write str instead of Eq(str) sometimes, where
9205 // str is a std::string object.
9206 Matcher(const std::string& s); // NOLINT
9207
9208 // Allows the user to write "foo" instead of Eq("foo") sometimes.
9209 Matcher(const char* s); // NOLINT
9210
9211 // Allows the user to pass absl::string_views directly.
9212 Matcher(absl::string_view s); // NOLINT
9213};
9214#endif // GTEST_HAS_ABSL
9215
9216// Prints a matcher in a human-readable format.
9217template <typename T>
9218std::ostream& operator<<(std::ostream& os, const Matcher<T>& matcher) {
9219 matcher.DescribeTo(&os);
9220 return os;
9221}
9222
9223// The PolymorphicMatcher class template makes it easy to implement a
9224// polymorphic matcher (i.e. a matcher that can match values of more
9225// than one type, e.g. Eq(n) and NotNull()).
9226//
9227// To define a polymorphic matcher, a user should provide an Impl
9228// class that has a DescribeTo() method and a DescribeNegationTo()
9229// method, and define a member function (or member function template)
9230//
9231// bool MatchAndExplain(const Value& value,
9232// MatchResultListener* listener) const;
9233//
9234// See the definition of NotNull() for a complete example.
9235template <class Impl>
9236class PolymorphicMatcher {
9237 public:
9238 explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {}
9239
9240 // Returns a mutable reference to the underlying matcher
9241 // implementation object.
9242 Impl& mutable_impl() { return impl_; }
9243
9244 // Returns an immutable reference to the underlying matcher
9245 // implementation object.
9246 const Impl& impl() const { return impl_; }
9247
9248 template <typename T>
9249 operator Matcher<T>() const {
9250 return Matcher<T>(new MonomorphicImpl<const T&>(impl_));
9251 }
9252
9253 private:
9254 template <typename T>
9255 class MonomorphicImpl : public MatcherInterface<T> {
9256 public:
9257 explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
9258
9259 virtual void DescribeTo(::std::ostream* os) const { impl_.DescribeTo(os); }
9260
9261 virtual void DescribeNegationTo(::std::ostream* os) const {
9262 impl_.DescribeNegationTo(os);
9263 }
9264
9265 virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
9266 return impl_.MatchAndExplain(x, listener);
9267 }
9268
9269 private:
9270 const Impl impl_;
9271 };
9272
9273 Impl impl_;
9274};
9275
9276// Creates a matcher from its implementation.
9277// DEPRECATED: Especially in the generic code, prefer:
9278// Matcher<T>(new MyMatcherImpl<const T&>(...));
9279//
9280// MakeMatcher may create a Matcher that accepts its argument by value, which
9281// leads to unnecessary copies & lack of support for non-copyable types.
9282template <typename T>
9283inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) {
9284 return Matcher<T>(impl);
9285}
9286
9287// Creates a polymorphic matcher from its implementation. This is
9288// easier to use than the PolymorphicMatcher<Impl> constructor as it
9289// doesn't require you to explicitly write the template argument, e.g.
9290//
9291// MakePolymorphicMatcher(foo);
9292// vs
9293// PolymorphicMatcher<TypeOfFoo>(foo);
9294template <class Impl>
9295inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) {
9296 return PolymorphicMatcher<Impl>(impl);
9297}
9298
9299namespace internal {
9300// Implements a matcher that compares a given value with a
9301// pre-supplied value using one of the ==, <=, <, etc, operators. The
9302// two values being compared don't have to have the same type.
9303//
9304// The matcher defined here is polymorphic (for example, Eq(5) can be
9305// used to match an int, a short, a double, etc). Therefore we use
9306// a template type conversion operator in the implementation.
9307//
9308// The following template definition assumes that the Rhs parameter is
9309// a "bare" type (i.e. neither 'const T' nor 'T&').
9310template <typename D, typename Rhs, typename Op>
9311class ComparisonBase {
9312 public:
9313 explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {}
9314 template <typename Lhs>
9315 operator Matcher<Lhs>() const {
9316 return Matcher<Lhs>(new Impl<const Lhs&>(rhs_));
9317 }
9318
9319 private:
9320 template <typename T>
9321 static const T& Unwrap(const T& v) { return v; }
9322 template <typename T>
9323 static const T& Unwrap(std::reference_wrapper<T> v) { return v; }
9324
9325 template <typename Lhs, typename = Rhs>
9326 class Impl : public MatcherInterface<Lhs> {
9327 public:
9328 explicit Impl(const Rhs& rhs) : rhs_(rhs) {}
9329 bool MatchAndExplain(Lhs lhs,
9330 MatchResultListener* /* listener */) const override {
9331 return Op()(lhs, Unwrap(rhs_));
9332 }
9333 void DescribeTo(::std::ostream* os) const override {
9334 *os << D::Desc() << " ";
9335 UniversalPrint(Unwrap(rhs_), os);
9336 }
9337 void DescribeNegationTo(::std::ostream* os) const override {
9338 *os << D::NegatedDesc() << " ";
9339 UniversalPrint(Unwrap(rhs_), os);
9340 }
9341
9342 private:
9343 Rhs rhs_;
9344 };
9345 Rhs rhs_;
9346};
9347
9348template <typename Rhs>
9349class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq> {
9350 public:
9351 explicit EqMatcher(const Rhs& rhs)
9352 : ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq>(rhs) { }
9353 static const char* Desc() { return "is equal to"; }
9354 static const char* NegatedDesc() { return "isn't equal to"; }
9355};
9356template <typename Rhs>
9357class NeMatcher : public ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe> {
9358 public:
9359 explicit NeMatcher(const Rhs& rhs)
9360 : ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe>(rhs) { }
9361 static const char* Desc() { return "isn't equal to"; }
9362 static const char* NegatedDesc() { return "is equal to"; }
9363};
9364template <typename Rhs>
9365class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt> {
9366 public:
9367 explicit LtMatcher(const Rhs& rhs)
9368 : ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt>(rhs) { }
9369 static const char* Desc() { return "is <"; }
9370 static const char* NegatedDesc() { return "isn't <"; }
9371};
9372template <typename Rhs>
9373class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt> {
9374 public:
9375 explicit GtMatcher(const Rhs& rhs)
9376 : ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt>(rhs) { }
9377 static const char* Desc() { return "is >"; }
9378 static const char* NegatedDesc() { return "isn't >"; }
9379};
9380template <typename Rhs>
9381class LeMatcher : public ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe> {
9382 public:
9383 explicit LeMatcher(const Rhs& rhs)
9384 : ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe>(rhs) { }
9385 static const char* Desc() { return "is <="; }
9386 static const char* NegatedDesc() { return "isn't <="; }
9387};
9388template <typename Rhs>
9389class GeMatcher : public ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe> {
9390 public:
9391 explicit GeMatcher(const Rhs& rhs)
9392 : ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe>(rhs) { }
9393 static const char* Desc() { return "is >="; }
9394 static const char* NegatedDesc() { return "isn't >="; }
9395};
9396
9397// Implements polymorphic matchers MatchesRegex(regex) and
9398// ContainsRegex(regex), which can be used as a Matcher<T> as long as
9399// T can be converted to a string.
9400class MatchesRegexMatcher {
9401 public:
9402 MatchesRegexMatcher(const RE* regex, bool full_match)
9403 : regex_(regex), full_match_(full_match) {}
9404
9405#if GTEST_HAS_ABSL
9406 bool MatchAndExplain(const absl::string_view& s,
9407 MatchResultListener* listener) const {
9408 return MatchAndExplain(std::string(s), listener);
9409 }
9410#endif // GTEST_HAS_ABSL
9411
9412 // Accepts pointer types, particularly:
9413 // const char*
9414 // char*
9415 // const wchar_t*
9416 // wchar_t*
9417 template <typename CharType>
9418 bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
9419 return s != nullptr && MatchAndExplain(std::string(s), listener);
9420 }
9421
9422 // Matches anything that can convert to std::string.
9423 //
9424 // This is a template, not just a plain function with const std::string&,
9425 // because absl::string_view has some interfering non-explicit constructors.
9426 template <class MatcheeStringType>
9427 bool MatchAndExplain(const MatcheeStringType& s,
9428 MatchResultListener* /* listener */) const {
9429 const std::string& s2(s);
9430 return full_match_ ? RE::FullMatch(s2, *regex_)
9431 : RE::PartialMatch(s2, *regex_);
9432 }
9433
9434 void DescribeTo(::std::ostream* os) const {
9435 *os << (full_match_ ? "matches" : "contains") << " regular expression ";
9436 UniversalPrinter<std::string>::Print(regex_->pattern(), os);
9437 }
9438
9439 void DescribeNegationTo(::std::ostream* os) const {
9440 *os << "doesn't " << (full_match_ ? "match" : "contain")
9441 << " regular expression ";
9442 UniversalPrinter<std::string>::Print(regex_->pattern(), os);
9443 }
9444
9445 private:
9446 const std::shared_ptr<const RE> regex_;
9447 const bool full_match_;
9448};
9449} // namespace internal
9450
9451// Matches a string that fully matches regular expression 'regex'.
9452// The matcher takes ownership of 'regex'.
9453inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
9454 const internal::RE* regex) {
9455 return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
9456}
9457inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
9458 const std::string& regex) {
9459 return MatchesRegex(new internal::RE(regex));
9460}
9461
9462// Matches a string that contains regular expression 'regex'.
9463// The matcher takes ownership of 'regex'.
9464inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
9465 const internal::RE* regex) {
9466 return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
9467}
9468inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
9469 const std::string& regex) {
9470 return ContainsRegex(new internal::RE(regex));
9471}
9472
9473// Creates a polymorphic matcher that matches anything equal to x.
9474// Note: if the parameter of Eq() were declared as const T&, Eq("foo")
9475// wouldn't compile.
9476template <typename T>
9477inline internal::EqMatcher<T> Eq(T x) { return internal::EqMatcher<T>(x); }
9478
9479// Constructs a Matcher<T> from a 'value' of type T. The constructed
9480// matcher matches any value that's equal to 'value'.
9481template <typename T>
9482Matcher<T>::Matcher(T value) { *this = Eq(value); }
9483
9484// Creates a monomorphic matcher that matches anything with type Lhs
9485// and equal to rhs. A user may need to use this instead of Eq(...)
9486// in order to resolve an overloading ambiguity.
9487//
9488// TypedEq<T>(x) is just a convenient short-hand for Matcher<T>(Eq(x))
9489// or Matcher<T>(x), but more readable than the latter.
9490//
9491// We could define similar monomorphic matchers for other comparison
9492// operations (e.g. TypedLt, TypedGe, and etc), but decided not to do
9493// it yet as those are used much less than Eq() in practice. A user
9494// can always write Matcher<T>(Lt(5)) to be explicit about the type,
9495// for example.
9496template <typename Lhs, typename Rhs>
9497inline Matcher<Lhs> TypedEq(const Rhs& rhs) { return Eq(rhs); }
9498
9499// Creates a polymorphic matcher that matches anything >= x.
9500template <typename Rhs>
9501inline internal::GeMatcher<Rhs> Ge(Rhs x) {
9502 return internal::GeMatcher<Rhs>(x);
9503}
9504
9505// Creates a polymorphic matcher that matches anything > x.
9506template <typename Rhs>
9507inline internal::GtMatcher<Rhs> Gt(Rhs x) {
9508 return internal::GtMatcher<Rhs>(x);
9509}
9510
9511// Creates a polymorphic matcher that matches anything <= x.
9512template <typename Rhs>
9513inline internal::LeMatcher<Rhs> Le(Rhs x) {
9514 return internal::LeMatcher<Rhs>(x);
9515}
9516
9517// Creates a polymorphic matcher that matches anything < x.
9518template <typename Rhs>
9519inline internal::LtMatcher<Rhs> Lt(Rhs x) {
9520 return internal::LtMatcher<Rhs>(x);
9521}
9522
9523// Creates a polymorphic matcher that matches anything != x.
9524template <typename Rhs>
9525inline internal::NeMatcher<Rhs> Ne(Rhs x) {
9526 return internal::NeMatcher<Rhs>(x);
9527}
9528} // namespace testing
9529
9531
9532#endif // GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
9533
9534#include <stdio.h>
9535#include <memory>
9536
9537namespace testing {
9538namespace internal {
9539
9540GTEST_DECLARE_string_(internal_run_death_test);
9541
9542// Names of the flags (needed for parsing Google Test flags).
9543const char kDeathTestStyleFlag[] = "death_test_style";
9544const char kDeathTestUseFork[] = "death_test_use_fork";
9545const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
9546
9547#if GTEST_HAS_DEATH_TEST
9548
9550/* class A needs to have dll-interface to be used by clients of class B */)
9551
9552// DeathTest is a class that hides much of the complexity of the
9553// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
9554// returns a concrete class that depends on the prevailing death test
9555// style, as defined by the --gtest_death_test_style and/or
9556// --gtest_internal_run_death_test flags.
9557
9558// In describing the results of death tests, these terms are used with
9559// the corresponding definitions:
9560//
9561// exit status: The integer exit information in the format specified
9562// by wait(2)
9563// exit code: The integer code passed to exit(3), _exit(2), or
9564// returned from main()
9565class GTEST_API_ DeathTest {
9566 public:
9567 // Create returns false if there was an error determining the
9568 // appropriate action to take for the current death test; for example,
9569 // if the gtest_death_test_style flag is set to an invalid value.
9570 // The LastMessage method will return a more detailed message in that
9571 // case. Otherwise, the DeathTest pointer pointed to by the "test"
9572 // argument is set. If the death test should be skipped, the pointer
9573 // is set to NULL; otherwise, it is set to the address of a new concrete
9574 // DeathTest object that controls the execution of the current test.
9575 static bool Create(const char* statement, Matcher<const std::string&> matcher,
9576 const char* file, int line, DeathTest** test);
9577 DeathTest();
9578 virtual ~DeathTest() { }
9579
9580 // A helper class that aborts a death test when it's deleted.
9581 class ReturnSentinel {
9582 public:
9583 explicit ReturnSentinel(DeathTest* test) : test_(test) { }
9584 ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
9585 private:
9586 DeathTest* const test_;
9587 GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
9589
9590 // An enumeration of possible roles that may be taken when a death
9591 // test is encountered. EXECUTE means that the death test logic should
9592 // be executed immediately. OVERSEE means that the program should prepare
9593 // the appropriate environment for a child process to execute the death
9594 // test, then wait for it to complete.
9595 enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
9596
9597 // An enumeration of the three reasons that a test might be aborted.
9598 enum AbortReason {
9599 TEST_ENCOUNTERED_RETURN_STATEMENT,
9600 TEST_THREW_EXCEPTION,
9601 TEST_DID_NOT_DIE
9602 };
9603
9604 // Assumes one of the above roles.
9605 virtual TestRole AssumeRole() = 0;
9606
9607 // Waits for the death test to finish and returns its status.
9608 virtual int Wait() = 0;
9609
9610 // Returns true if the death test passed; that is, the test process
9611 // exited during the test, its exit status matches a user-supplied
9612 // predicate, and its stderr output matches a user-supplied regular
9613 // expression.
9614 // The user-supplied predicate may be a macro expression rather
9615 // than a function pointer or functor, or else Wait and Passed could
9616 // be combined.
9617 virtual bool Passed(bool exit_status_ok) = 0;
9618
9619 // Signals that the death test did not die as expected.
9620 virtual void Abort(AbortReason reason) = 0;
9621
9622 // Returns a human-readable outcome message regarding the outcome of
9623 // the last death test.
9624 static const char* LastMessage();
9625
9626 static void set_last_death_test_message(const std::string& message);
9627
9628 private:
9629 // A string containing a description of the outcome of the last death test.
9630 static std::string last_death_test_message_;
9631
9633};
9634
9636
9637// Factory interface for death tests. May be mocked out for testing.
9638class DeathTestFactory {
9639 public:
9640 virtual ~DeathTestFactory() { }
9641 virtual bool Create(const char* statement,
9642 Matcher<const std::string&> matcher, const char* file,
9643 int line, DeathTest** test) = 0;
9644};
9645
9646// A concrete DeathTestFactory implementation for normal use.
9647class DefaultDeathTestFactory : public DeathTestFactory {
9648 public:
9649 bool Create(const char* statement, Matcher<const std::string&> matcher,
9650 const char* file, int line, DeathTest** test) override;
9651};
9652
9653// Returns true if exit_status describes a process that was terminated
9654// by a signal, or exited normally with a nonzero exit code.
9655GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
9656
9657// A string passed to EXPECT_DEATH (etc.) is caught by one of these overloads
9658// and interpreted as a regex (rather than an Eq matcher) for legacy
9659// compatibility.
9660inline Matcher<const ::std::string&> MakeDeathTestMatcher(
9662 return ContainsRegex(regex.pattern());
9663}
9664inline Matcher<const ::std::string&> MakeDeathTestMatcher(const char* regex) {
9665 return ContainsRegex(regex);
9666}
9667inline Matcher<const ::std::string&> MakeDeathTestMatcher(
9668 const ::std::string& regex) {
9669 return ContainsRegex(regex);
9670}
9671
9672// If a Matcher<const ::std::string&> is passed to EXPECT_DEATH (etc.), it's
9673// used directly.
9674inline Matcher<const ::std::string&> MakeDeathTestMatcher(
9675 Matcher<const ::std::string&> matcher) {
9676 return matcher;
9677}
9678
9679// Traps C++ exceptions escaping statement and reports them as test
9680// failures. Note that trapping SEH exceptions is not implemented here.
9681# if GTEST_HAS_EXCEPTIONS
9682# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
9683 try { \
9684 GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
9685 } catch (const ::std::exception& gtest_exception) { \
9686 fprintf(\
9687 stderr, \
9688 "\n%s: Caught std::exception-derived exception escaping the " \
9689 "death test statement. Exception message: %s\n", \
9690 ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
9691 gtest_exception.what()); \
9692 fflush(stderr); \
9693 death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
9694 } catch (...) { \
9695 death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
9696 }
9697
9698# else
9699# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
9700 GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
9701
9702# endif
9703
9704// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
9705// ASSERT_EXIT*, and EXPECT_EXIT*.
9706#define GTEST_DEATH_TEST_(statement, predicate, regex_or_matcher, fail) \
9707 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
9708 if (::testing::internal::AlwaysTrue()) { \
9709 ::testing::internal::DeathTest* gtest_dt; \
9710 if (!::testing::internal::DeathTest::Create( \
9711 #statement, \
9712 ::testing::internal::MakeDeathTestMatcher(regex_or_matcher), \
9713 __FILE__, __LINE__, &gtest_dt)) { \
9714 goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
9715 } \
9716 if (gtest_dt != nullptr) { \
9717 std::unique_ptr< ::testing::internal::DeathTest> gtest_dt_ptr(gtest_dt); \
9718 switch (gtest_dt->AssumeRole()) { \
9719 case ::testing::internal::DeathTest::OVERSEE_TEST: \
9720 if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
9721 goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
9722 } \
9723 break; \
9724 case ::testing::internal::DeathTest::EXECUTE_TEST: { \
9725 ::testing::internal::DeathTest::ReturnSentinel gtest_sentinel( \
9726 gtest_dt); \
9727 GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \
9728 gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
9729 break; \
9730 } \
9731 default: \
9732 break; \
9733 } \
9734 } \
9735 } else \
9736 GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__) \
9737 : fail(::testing::internal::DeathTest::LastMessage())
9738// The symbol "fail" here expands to something into which a message
9739// can be streamed.
9740
9741// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
9742// NDEBUG mode. In this case we need the statements to be executed and the macro
9743// must accept a streamed message even though the message is never printed.
9744// The regex object is not evaluated, but it is used to prevent "unused"
9745// warnings and to avoid an expression that doesn't compile in debug mode.
9746#define GTEST_EXECUTE_STATEMENT_(statement, regex_or_matcher) \
9747 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
9748 if (::testing::internal::AlwaysTrue()) { \
9749 GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
9750 } else if (!::testing::internal::AlwaysTrue()) { \
9751 ::testing::internal::MakeDeathTestMatcher(regex_or_matcher); \
9752 } else \
9753 ::testing::Message()
9754
9755// A class representing the parsed contents of the
9756// --gtest_internal_run_death_test flag, as it existed when
9757// RUN_ALL_TESTS was called.
9758class InternalRunDeathTestFlag {
9759 public:
9760 InternalRunDeathTestFlag(const std::string& a_file,
9761 int a_line,
9762 int an_index,
9763 int a_write_fd)
9764 : file_(a_file), line_(a_line), index_(an_index),
9765 write_fd_(a_write_fd) {}
9766
9767 ~InternalRunDeathTestFlag() {
9768 if (write_fd_ >= 0)
9769 posix::Close(write_fd_);
9770 }
9771
9772 const std::string& file() const { return file_; }
9773 int line() const { return line_; }
9774 int index() const { return index_; }
9775 int write_fd() const { return write_fd_; }
9776
9777 private:
9778 std::string file_;
9779 int line_;
9780 int index_;
9781 int write_fd_;
9782
9783 GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
9784};
9785
9786// Returns a newly created InternalRunDeathTestFlag object with fields
9787// initialized from the GTEST_FLAG(internal_run_death_test) flag if
9788// the flag is specified; otherwise returns NULL.
9789InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
9790
9791#endif // GTEST_HAS_DEATH_TEST
9792
9793} // namespace internal
9794} // namespace testing
9795
9796#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
9797
9798namespace testing {
9799
9800// This flag controls the style of death tests. Valid values are "threadsafe",
9801// meaning that the death test child process will re-execute the test binary
9802// from the start, running only a single death test, or "fast",
9803// meaning that the child process will execute the test logic immediately
9804// after forking.
9805GTEST_DECLARE_string_(death_test_style);
9806
9807#if GTEST_HAS_DEATH_TEST
9808
9809namespace internal {
9810
9811// Returns a Boolean value indicating whether the caller is currently
9812// executing in the context of the death test child process. Tools such as
9813// Valgrind heap checkers may need this to modify their behavior in death
9814// tests. IMPORTANT: This is an internal utility. Using it may break the
9815// implementation of death tests. User code MUST NOT use it.
9816GTEST_API_ bool InDeathTestChild();
9817
9818} // namespace internal
9819
9820// The following macros are useful for writing death tests.
9821
9822// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
9823// executed:
9824//
9825// 1. It generates a warning if there is more than one active
9826// thread. This is because it's safe to fork() or clone() only
9827// when there is a single thread.
9828//
9829// 2. The parent process clone()s a sub-process and runs the death
9830// test in it; the sub-process exits with code 0 at the end of the
9831// death test, if it hasn't exited already.
9832//
9833// 3. The parent process waits for the sub-process to terminate.
9834//
9835// 4. The parent process checks the exit code and error message of
9836// the sub-process.
9837//
9838// Examples:
9839//
9840// ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
9841// for (int i = 0; i < 5; i++) {
9842// EXPECT_DEATH(server.ProcessRequest(i),
9843// "Invalid request .* in ProcessRequest()")
9844// << "Failed to die on request " << i;
9845// }
9846//
9847// ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
9848//
9849// bool KilledBySIGHUP(int exit_code) {
9850// return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
9851// }
9852//
9853// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
9854//
9855// On the regular expressions used in death tests:
9856//
9857// GOOGLETEST_CM0005 DO NOT DELETE
9858// On POSIX-compliant systems (*nix), we use the <regex.h> library,
9859// which uses the POSIX extended regex syntax.
9860//
9861// On other platforms (e.g. Windows or Mac), we only support a simple regex
9862// syntax implemented as part of Google Test. This limited
9863// implementation should be enough most of the time when writing
9864// death tests; though it lacks many features you can find in PCRE
9865// or POSIX extended regex syntax. For example, we don't support
9866// union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
9867// repetition count ("x{5,7}"), among others.
9868//
9869// Below is the syntax that we do support. We chose it to be a
9870// subset of both PCRE and POSIX extended regex, so it's easy to
9871// learn wherever you come from. In the following: 'A' denotes a
9872// literal character, period (.), or a single \\ escape sequence;
9873// 'x' and 'y' denote regular expressions; 'm' and 'n' are for
9874// natural numbers.
9875//
9876// c matches any literal character c
9877// \\d matches any decimal digit
9878// \\D matches any character that's not a decimal digit
9879// \\f matches \f
9880// \\n matches \n
9881// \\r matches \r
9882// \\s matches any ASCII whitespace, including \n
9883// \\S matches any character that's not a whitespace
9884// \\t matches \t
9885// \\v matches \v
9886// \\w matches any letter, _, or decimal digit
9887// \\W matches any character that \\w doesn't match
9888// \\c matches any literal character c, which must be a punctuation
9889// . matches any single character except \n
9890// A? matches 0 or 1 occurrences of A
9891// A* matches 0 or many occurrences of A
9892// A+ matches 1 or many occurrences of A
9893// ^ matches the beginning of a string (not that of each line)
9894// $ matches the end of a string (not that of each line)
9895// xy matches x followed by y
9896//
9897// If you accidentally use PCRE or POSIX extended regex features
9898// not implemented by us, you will get a run-time failure. In that
9899// case, please try to rewrite your regular expression within the
9900// above syntax.
9901//
9902// This implementation is *not* meant to be as highly tuned or robust
9903// as a compiled regex library, but should perform well enough for a
9904// death test, which already incurs significant overhead by launching
9905// a child process.
9906//
9907// Known caveats:
9908//
9909// A "threadsafe" style death test obtains the path to the test
9910// program from argv[0] and re-executes it in the sub-process. For
9911// simplicity, the current implementation doesn't search the PATH
9912// when launching the sub-process. This means that the user must
9913// invoke the test program via a path that contains at least one
9914// path separator (e.g. path/to/foo_test and
9915// /absolute/path/to/bar_test are fine, but foo_test is not). This
9916// is rarely a problem as people usually don't put the test binary
9917// directory in PATH.
9918//
9919
9920// Asserts that a given statement causes the program to exit, with an
9921// integer exit status that satisfies predicate, and emitting error output
9922// that matches regex.
9923# define ASSERT_EXIT(statement, predicate, regex) \
9924 GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
9925
9926// Like ASSERT_EXIT, but continues on to successive tests in the
9927// test suite, if any:
9928# define EXPECT_EXIT(statement, predicate, regex) \
9929 GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
9930
9931// Asserts that a given statement causes the program to exit, either by
9932// explicitly exiting with a nonzero exit code or being killed by a
9933// signal, and emitting error output that matches regex.
9934# define ASSERT_DEATH(statement, regex) \
9935 ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
9936
9937// Like ASSERT_DEATH, but continues on to successive tests in the
9938// test suite, if any:
9939# define EXPECT_DEATH(statement, regex) \
9940 EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
9941
9942// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
9943
9944// Tests that an exit code describes a normal exit with a given exit code.
9945class GTEST_API_ ExitedWithCode {
9946 public:
9947 explicit ExitedWithCode(int exit_code);
9948 bool operator()(int exit_status) const;
9949 private:
9950 // No implementation - assignment is unsupported.
9951 void operator=(const ExitedWithCode& other);
9952
9953 const int exit_code_;
9954};
9955
9956# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
9957// Tests that an exit code describes an exit due to termination by a
9958// given signal.
9959// GOOGLETEST_CM0006 DO NOT DELETE
9960class GTEST_API_ KilledBySignal {
9961 public:
9962 explicit KilledBySignal(int signum);
9963 bool operator()(int exit_status) const;
9964 private:
9965 const int signum_;
9966};
9967# endif // !GTEST_OS_WINDOWS
9968
9969// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
9970// The death testing framework causes this to have interesting semantics,
9971// since the sideeffects of the call are only visible in opt mode, and not
9972// in debug mode.
9973//
9974// In practice, this can be used to test functions that utilize the
9975// LOG(DFATAL) macro using the following style:
9976//
9977// int DieInDebugOr12(int* sideeffect) {
9978// if (sideeffect) {
9979// *sideeffect = 12;
9980// }
9981// LOG(DFATAL) << "death";
9982// return 12;
9983// }
9984//
9985// TEST(TestSuite, TestDieOr12WorksInDgbAndOpt) {
9986// int sideeffect = 0;
9987// // Only asserts in dbg.
9988// EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
9989//
9990// #ifdef NDEBUG
9991// // opt-mode has sideeffect visible.
9992// EXPECT_EQ(12, sideeffect);
9993// #else
9994// // dbg-mode no visible sideeffect.
9995// EXPECT_EQ(0, sideeffect);
9996// #endif
9997// }
9998//
9999// This will assert that DieInDebugReturn12InOpt() crashes in debug
10000// mode, usually due to a DCHECK or LOG(DFATAL), but returns the
10001// appropriate fallback value (12 in this case) in opt mode. If you
10002// need to test that a function has appropriate side-effects in opt
10003// mode, include assertions against the side-effects. A general
10004// pattern for this is:
10005//
10006// EXPECT_DEBUG_DEATH({
10007// // Side-effects here will have an effect after this statement in
10008// // opt mode, but none in debug mode.
10009// EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
10010// }, "death");
10011//
10012# ifdef NDEBUG
10013
10014# define EXPECT_DEBUG_DEATH(statement, regex) \
10015 GTEST_EXECUTE_STATEMENT_(statement, regex)
10016
10017# define ASSERT_DEBUG_DEATH(statement, regex) \
10018 GTEST_EXECUTE_STATEMENT_(statement, regex)
10019
10020# else
10021
10022# define EXPECT_DEBUG_DEATH(statement, regex) \
10023 EXPECT_DEATH(statement, regex)
10024
10025# define ASSERT_DEBUG_DEATH(statement, regex) \
10026 ASSERT_DEATH(statement, regex)
10027
10028# endif // NDEBUG for EXPECT_DEBUG_DEATH
10029#endif // GTEST_HAS_DEATH_TEST
10030
10031// This macro is used for implementing macros such as
10032// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
10033// death tests are not supported. Those macros must compile on such systems
10034// if and only if EXPECT_DEATH and ASSERT_DEATH compile with the same parameters
10035// on systems that support death tests. This allows one to write such a macro on
10036// a system that does not support death tests and be sure that it will compile
10037// on a death-test supporting system. It is exposed publicly so that systems
10038// that have death-tests with stricter requirements than GTEST_HAS_DEATH_TEST
10039// can write their own equivalent of EXPECT_DEATH_IF_SUPPORTED and
10040// ASSERT_DEATH_IF_SUPPORTED.
10041//
10042// Parameters:
10043// statement - A statement that a macro such as EXPECT_DEATH would test
10044// for program termination. This macro has to make sure this
10045// statement is compiled but not executed, to ensure that
10046// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
10047// parameter if and only if EXPECT_DEATH compiles with it.
10048// regex - A regex that a macro such as EXPECT_DEATH would use to test
10049// the output of statement. This parameter has to be
10050// compiled but not evaluated by this macro, to ensure that
10051// this macro only accepts expressions that a macro such as
10052// EXPECT_DEATH would accept.
10053// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
10054// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
10055// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
10056// compile inside functions where ASSERT_DEATH doesn't
10057// compile.
10058//
10059// The branch that has an always false condition is used to ensure that
10060// statement and regex are compiled (and thus syntactically correct) but
10061// never executed. The unreachable code macro protects the terminator
10062// statement from generating an 'unreachable code' warning in case
10063// statement unconditionally returns or throws. The Message constructor at
10064// the end allows the syntax of streaming additional messages into the
10065// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
10066# define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
10067 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
10068 if (::testing::internal::AlwaysTrue()) { \
10069 GTEST_LOG_(WARNING) \
10070 << "Death tests are not supported on this platform.\n" \
10071 << "Statement '" #statement "' cannot be verified."; \
10072 } else if (::testing::internal::AlwaysFalse()) { \
10073 ::testing::internal::RE::PartialMatch(".*", (regex)); \
10074 GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
10075 terminator; \
10076 } else \
10077 ::testing::Message()
10078
10079// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
10080// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
10081// death tests are supported; otherwise they just issue a warning. This is
10082// useful when you are combining death test assertions with normal test
10083// assertions in one test.
10084#if GTEST_HAS_DEATH_TEST
10085# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
10086 EXPECT_DEATH(statement, regex)
10087# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
10088 ASSERT_DEATH(statement, regex)
10089#else
10090# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
10091 GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, )
10092# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
10093 GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return)
10094#endif
10095
10096} // namespace testing
10097
10098#endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
10099// Copyright 2008, Google Inc.
10100// All rights reserved.
10101//
10102// Redistribution and use in source and binary forms, with or without
10103// modification, are permitted provided that the following conditions are
10104// met:
10105//
10106// * Redistributions of source code must retain the above copyright
10107// notice, this list of conditions and the following disclaimer.
10108// * Redistributions in binary form must reproduce the above
10109// copyright notice, this list of conditions and the following disclaimer
10110// in the documentation and/or other materials provided with the
10111// distribution.
10112// * Neither the name of Google Inc. nor the names of its
10113// contributors may be used to endorse or promote products derived from
10114// this software without specific prior written permission.
10115//
10116// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
10117// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
10118// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
10119// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
10120// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10121// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10122// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10123// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
10124// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
10125// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
10126// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10127//
10128// Macros and functions for implementing parameterized tests
10129// in Google C++ Testing and Mocking Framework (Google Test)
10130//
10131// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
10132//
10133// GOOGLETEST_CM0001 DO NOT DELETE
10134#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
10135#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
10136
10137
10138// Value-parameterized tests allow you to test your code with different
10139// parameters without writing multiple copies of the same test.
10140//
10141// Here is how you use value-parameterized tests:
10142
10143#if 0
10144
10145// To write value-parameterized tests, first you should define a fixture
10146// class. It is usually derived from testing::TestWithParam<T> (see below for
10147// another inheritance scheme that's sometimes useful in more complicated
10148// class hierarchies), where the type of your parameter values.
10149// TestWithParam<T> is itself derived from testing::Test. T can be any
10150// copyable type. If it's a raw pointer, you are responsible for managing the
10151// lifespan of the pointed values.
10152
10153class FooTest : public ::testing::TestWithParam<const char*> {
10154 // You can implement all the usual class fixture members here.
10155};
10156
10157// Then, use the TEST_P macro to define as many parameterized tests
10158// for this fixture as you want. The _P suffix is for "parameterized"
10159// or "pattern", whichever you prefer to think.
10160
10161TEST_P(FooTest, DoesBlah) {
10162 // Inside a test, access the test parameter with the GetParam() method
10163 // of the TestWithParam<T> class:
10164 EXPECT_TRUE(foo.Blah(GetParam()));
10165 ...
10166}
10167
10168TEST_P(FooTest, HasBlahBlah) {
10169 ...
10170}
10171
10172// Finally, you can use INSTANTIATE_TEST_SUITE_P to instantiate the test
10173// case with any set of parameters you want. Google Test defines a number
10174// of functions for generating test parameters. They return what we call
10175// (surprise!) parameter generators. Here is a summary of them, which
10176// are all in the testing namespace:
10177//
10178//
10179// Range(begin, end [, step]) - Yields values {begin, begin+step,
10180// begin+step+step, ...}. The values do not
10181// include end. step defaults to 1.
10182// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
10183// ValuesIn(container) - Yields values from a C-style array, an STL
10184// ValuesIn(begin,end) container, or an iterator range [begin, end).
10185// Bool() - Yields sequence {false, true}.
10186// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
10187// for the math savvy) of the values generated
10188// by the N generators.
10189//
10190// For more details, see comments at the definitions of these functions below
10191// in this file.
10192//
10193// The following statement will instantiate tests from the FooTest test suite
10194// each with parameter values "meeny", "miny", and "moe".
10195
10196INSTANTIATE_TEST_SUITE_P(InstantiationName,
10197 FooTest,
10198 Values("meeny", "miny", "moe"));
10199
10200// To distinguish different instances of the pattern, (yes, you
10201// can instantiate it more than once) the first argument to the
10202// INSTANTIATE_TEST_SUITE_P macro is a prefix that will be added to the
10203// actual test suite name. Remember to pick unique prefixes for different
10204// instantiations. The tests from the instantiation above will have
10205// these names:
10206//
10207// * InstantiationName/FooTest.DoesBlah/0 for "meeny"
10208// * InstantiationName/FooTest.DoesBlah/1 for "miny"
10209// * InstantiationName/FooTest.DoesBlah/2 for "moe"
10210// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
10211// * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
10212// * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
10213//
10214// You can use these names in --gtest_filter.
10215//
10216// This statement will instantiate all tests from FooTest again, each
10217// with parameter values "cat" and "dog":
10218
10219const char* pets[] = {"cat", "dog"};
10220INSTANTIATE_TEST_SUITE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
10221
10222// The tests from the instantiation above will have these names:
10223//
10224// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
10225// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
10226// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
10227// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
10228//
10229// Please note that INSTANTIATE_TEST_SUITE_P will instantiate all tests
10230// in the given test suite, whether their definitions come before or
10231// AFTER the INSTANTIATE_TEST_SUITE_P statement.
10232//
10233// Please also note that generator expressions (including parameters to the
10234// generators) are evaluated in InitGoogleTest(), after main() has started.
10235// This allows the user on one hand, to adjust generator parameters in order
10236// to dynamically determine a set of tests to run and on the other hand,
10237// give the user a chance to inspect the generated tests with Google Test
10238// reflection API before RUN_ALL_TESTS() is executed.
10239//
10240// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
10241// for more examples.
10242//
10243// In the future, we plan to publish the API for defining new parameter
10244// generators. But for now this interface remains part of the internal
10245// implementation and is subject to change.
10246//
10247//
10248// A parameterized test fixture must be derived from testing::Test and from
10249// testing::WithParamInterface<T>, where T is the type of the parameter
10250// values. Inheriting from TestWithParam<T> satisfies that requirement because
10251// TestWithParam<T> inherits from both Test and WithParamInterface. In more
10252// complicated hierarchies, however, it is occasionally useful to inherit
10253// separately from Test and WithParamInterface. For example:
10254
10255class BaseTest : public ::testing::Test {
10256 // You can inherit all the usual members for a non-parameterized test
10257 // fixture here.
10258};
10259
10260class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
10261 // The usual test fixture members go here too.
10262};
10263
10264TEST_F(BaseTest, HasFoo) {
10265 // This is an ordinary non-parameterized test.
10266}
10267
10268TEST_P(DerivedTest, DoesBlah) {
10269 // GetParam works just the same here as if you inherit from TestWithParam.
10270 EXPECT_TRUE(foo.Blah(GetParam()));
10271}
10272
10273#endif // 0
10274
10275#include <iterator>
10276#include <utility>
10277
10278// Copyright 2008 Google Inc.
10279// All Rights Reserved.
10280//
10281// Redistribution and use in source and binary forms, with or without
10282// modification, are permitted provided that the following conditions are
10283// met:
10284//
10285// * Redistributions of source code must retain the above copyright
10286// notice, this list of conditions and the following disclaimer.
10287// * Redistributions in binary form must reproduce the above
10288// copyright notice, this list of conditions and the following disclaimer
10289// in the documentation and/or other materials provided with the
10290// distribution.
10291// * Neither the name of Google Inc. nor the names of its
10292// contributors may be used to endorse or promote products derived from
10293// this software without specific prior written permission.
10294//
10295// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
10296// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
10297// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
10298// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
10299// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10300// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10301// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10302// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
10303// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
10304// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
10305// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10306
10307
10308// Type and function utilities for implementing parameterized tests.
10309
10310// GOOGLETEST_CM0001 DO NOT DELETE
10311
10312#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
10313#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
10314
10315#include <ctype.h>
10316
10317#include <cassert>
10318#include <iterator>
10319#include <memory>
10320#include <set>
10321#include <tuple>
10322#include <utility>
10323#include <vector>
10324
10325
10326namespace testing {
10327// Input to a parameterized test name generator, describing a test parameter.
10328// Consists of the parameter value and the integer parameter index.
10329template <class ParamType>
10331 TestParamInfo(const ParamType& a_param, size_t an_index) :
10332 param(a_param),
10333 index(an_index) {}
10334 ParamType param;
10335 size_t index;
10336};
10337
10338// A builtin parameterized test name generator which returns the result of
10339// testing::PrintToString.
10341 template <class ParamType>
10343 return PrintToString(info.param);
10344 }
10345};
10346
10347namespace internal {
10348
10349// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10350// Utility Functions
10351
10352// Outputs a message explaining invalid registration of different
10353// fixture class for the same test suite. This may happen when
10354// TEST_P macro is used to define two tests with the same name
10355// but in different namespaces.
10356GTEST_API_ void ReportInvalidTestSuiteType(const char* test_suite_name,
10357 CodeLocation code_location);
10358
10359template <typename> class ParamGeneratorInterface;
10360template <typename> class ParamGenerator;
10361
10362// Interface for iterating over elements provided by an implementation
10363// of ParamGeneratorInterface<T>.
10364template <typename T>
10366 public:
10368 // A pointer to the base generator instance.
10369 // Used only for the purposes of iterator comparison
10370 // to make sure that two iterators belong to the same generator.
10371 virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;
10372 // Advances iterator to point to the next element
10373 // provided by the generator. The caller is responsible
10374 // for not calling Advance() on an iterator equal to
10375 // BaseGenerator()->End().
10376 virtual void Advance() = 0;
10377 // Clones the iterator object. Used for implementing copy semantics
10378 // of ParamIterator<T>.
10379 virtual ParamIteratorInterface* Clone() const = 0;
10380 // Dereferences the current iterator and provides (read-only) access
10381 // to the pointed value. It is the caller's responsibility not to call
10382 // Current() on an iterator equal to BaseGenerator()->End().
10383 // Used for implementing ParamGenerator<T>::operator*().
10384 virtual const T* Current() const = 0;
10385 // Determines whether the given iterator and other point to the same
10386 // element in the sequence generated by the generator.
10387 // Used for implementing ParamGenerator<T>::operator==().
10388 virtual bool Equals(const ParamIteratorInterface& other) const = 0;
10389};
10390
10391// Class iterating over elements provided by an implementation of
10392// ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>
10393// and implements the const forward iterator concept.
10394template <typename T>
10396 public:
10397 typedef T value_type;
10398 typedef const T& reference;
10399 typedef ptrdiff_t difference_type;
10400
10401 // ParamIterator assumes ownership of the impl_ pointer.
10402 ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
10404 if (this != &other)
10405 impl_.reset(other.impl_->Clone());
10406 return *this;
10407 }
10408
10409 const T& operator*() const { return *impl_->Current(); }
10410 const T* operator->() const { return impl_->Current(); }
10411 // Prefix version of operator++.
10413 impl_->Advance();
10414 return *this;
10415 }
10416 // Postfix version of operator++.
10417 ParamIterator operator++(int /*unused*/) {
10418 ParamIteratorInterface<T>* clone = impl_->Clone();
10419 impl_->Advance();
10420 return ParamIterator(clone);
10421 }
10422 bool operator==(const ParamIterator& other) const {
10423 return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
10424 }
10425 bool operator!=(const ParamIterator& other) const {
10426 return !(*this == other);
10427 }
10428
10429 private:
10430 friend class ParamGenerator<T>;
10431 explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
10432 std::unique_ptr<ParamIteratorInterface<T> > impl_;
10433};
10434
10435// ParamGeneratorInterface<T> is the binary interface to access generators
10436// defined in other translation units.
10437template <typename T>
10439 public:
10440 typedef T ParamType;
10441
10443
10444 // Generator interface definition
10445 virtual ParamIteratorInterface<T>* Begin() const = 0;
10446 virtual ParamIteratorInterface<T>* End() const = 0;
10447};
10448
10449// Wraps ParamGeneratorInterface<T> and provides general generator syntax
10450// compatible with the STL Container concept.
10451// This class implements copy initialization semantics and the contained
10452// ParamGeneratorInterface<T> instance is shared among all copies
10453// of the original object. This is possible because that instance is immutable.
10454template<typename T>
10456 public:
10458
10459 explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}
10460 ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}
10461
10463 impl_ = other.impl_;
10464 return *this;
10465 }
10466
10467 iterator begin() const { return iterator(impl_->Begin()); }
10468 iterator end() const { return iterator(impl_->End()); }
10469
10470 private:
10471 std::shared_ptr<const ParamGeneratorInterface<T> > impl_;
10472};
10473
10474// Generates values from a range of two comparable values. Can be used to
10475// generate sequences of user-defined types that implement operator+() and
10476// operator<().
10477// This class is used in the Range() function.
10478template <typename T, typename IncrementT>
10480 public:
10481 RangeGenerator(T begin, T end, IncrementT step)
10482 : begin_(begin), end_(end),
10483 step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
10484 ~RangeGenerator() override {}
10485
10487 return new Iterator(this, begin_, 0, step_);
10488 }
10489 ParamIteratorInterface<T>* End() const override {
10490 return new Iterator(this, end_, end_index_, step_);
10491 }
10492
10493 private:
10494 class Iterator : public ParamIteratorInterface<T> {
10495 public:
10496 Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
10497 IncrementT step)
10498 : base_(base), value_(value), index_(index), step_(step) {}
10499 ~Iterator() override {}
10500
10501 const ParamGeneratorInterface<T>* BaseGenerator() const override {
10502 return base_;
10503 }
10504 void Advance() override {
10505 value_ = static_cast<T>(value_ + step_);
10506 index_++;
10507 }
10508 ParamIteratorInterface<T>* Clone() const override {
10509 return new Iterator(*this);
10510 }
10511 const T* Current() const override { return &value_; }
10512 bool Equals(const ParamIteratorInterface<T>& other) const override {
10513 // Having the same base generator guarantees that the other
10514 // iterator is of the same type and we can downcast.
10515 GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
10516 << "The program attempted to compare iterators "
10517 << "from different generators." << std::endl;
10518 const int other_index =
10519 CheckedDowncastToActualType<const Iterator>(&other)->index_;
10520 return index_ == other_index;
10521 }
10522
10523 private:
10524 Iterator(const Iterator& other)
10525 : ParamIteratorInterface<T>(),
10526 base_(other.base_), value_(other.value_), index_(other.index_),
10527 step_(other.step_) {}
10528
10529 // No implementation - assignment is unsupported.
10530 void operator=(const Iterator& other);
10531
10532 const ParamGeneratorInterface<T>* const base_;
10533 T value_;
10534 int index_;
10535 const IncrementT step_;
10536 }; // class RangeGenerator::Iterator
10537
10538 static int CalculateEndIndex(const T& begin,
10539 const T& end,
10540 const IncrementT& step) {
10541 int end_index = 0;
10542 for (T i = begin; i < end; i = static_cast<T>(i + step))
10543 end_index++;
10544 return end_index;
10545 }
10546
10547 // No implementation - assignment is unsupported.
10548 void operator=(const RangeGenerator& other);
10549
10550 const T begin_;
10551 const T end_;
10552 const IncrementT step_;
10553 // The index for the end() iterator. All the elements in the generated
10554 // sequence are indexed (0-based) to aid iterator comparison.
10555 const int end_index_;
10556}; // class RangeGenerator
10557
10558
10559// Generates values from a pair of STL-style iterators. Used in the
10560// ValuesIn() function. The elements are copied from the source range
10561// since the source can be located on the stack, and the generator
10562// is likely to persist beyond that stack frame.
10563template <typename T>
10565 public:
10566 template <typename ForwardIterator>
10567 ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
10568 : container_(begin, end) {}
10570
10572 return new Iterator(this, container_.begin());
10573 }
10574 ParamIteratorInterface<T>* End() const override {
10575 return new Iterator(this, container_.end());
10576 }
10577
10578 private:
10579 typedef typename ::std::vector<T> ContainerType;
10580
10581 class Iterator : public ParamIteratorInterface<T> {
10582 public:
10583 Iterator(const ParamGeneratorInterface<T>* base,
10584 typename ContainerType::const_iterator iterator)
10585 : base_(base), iterator_(iterator) {}
10586 ~Iterator() override {}
10587
10588 const ParamGeneratorInterface<T>* BaseGenerator() const override {
10589 return base_;
10590 }
10591 void Advance() override {
10592 ++iterator_;
10593 value_.reset();
10594 }
10595 ParamIteratorInterface<T>* Clone() const override {
10596 return new Iterator(*this);
10597 }
10598 // We need to use cached value referenced by iterator_ because *iterator_
10599 // can return a temporary object (and of type other then T), so just
10600 // having "return &*iterator_;" doesn't work.
10601 // value_ is updated here and not in Advance() because Advance()
10602 // can advance iterator_ beyond the end of the range, and we cannot
10603 // detect that fact. The client code, on the other hand, is
10604 // responsible for not calling Current() on an out-of-range iterator.
10605 const T* Current() const override {
10606 if (value_.get() == nullptr) value_.reset(new T(*iterator_));
10607 return value_.get();
10608 }
10609 bool Equals(const ParamIteratorInterface<T>& other) const override {
10610 // Having the same base generator guarantees that the other
10611 // iterator is of the same type and we can downcast.
10612 GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
10613 << "The program attempted to compare iterators "
10614 << "from different generators." << std::endl;
10615 return iterator_ ==
10616 CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
10617 }
10618
10619 private:
10620 Iterator(const Iterator& other)
10621 // The explicit constructor call suppresses a false warning
10622 // emitted by gcc when supplied with the -Wextra option.
10623 : ParamIteratorInterface<T>(),
10624 base_(other.base_),
10625 iterator_(other.iterator_) {}
10626
10627 const ParamGeneratorInterface<T>* const base_;
10628 typename ContainerType::const_iterator iterator_;
10629 // A cached value of *iterator_. We keep it here to allow access by
10630 // pointer in the wrapping iterator's operator->().
10631 // value_ needs to be mutable to be accessed in Current().
10632 // Use of std::unique_ptr helps manage cached value's lifetime,
10633 // which is bound by the lifespan of the iterator itself.
10634 mutable std::unique_ptr<const T> value_;
10635 }; // class ValuesInIteratorRangeGenerator::Iterator
10636
10637 // No implementation - assignment is unsupported.
10638 void operator=(const ValuesInIteratorRangeGenerator& other);
10639
10640 const ContainerType container_;
10641}; // class ValuesInIteratorRangeGenerator
10642
10643// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10644//
10645// Default parameterized test name generator, returns a string containing the
10646// integer test parameter index.
10647template <class ParamType>
10649 Message name_stream;
10650 name_stream << info.index;
10651 return name_stream.GetString();
10652}
10653
10654template <typename T = int>
10656 static_assert(sizeof(T) == 0, "Empty arguments are not allowed.");
10657}
10658template <typename T = int>
10659void TestNotEmpty(const T&) {}
10660
10661// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10662//
10663// Stores a parameter value and later creates tests parameterized with that
10664// value.
10665template <class TestClass>
10667 public:
10668 typedef typename TestClass::ParamType ParamType;
10670 parameter_(parameter) {}
10671 Test* CreateTest() override {
10672 TestClass::SetParam(&parameter_);
10673 return new TestClass();
10674 }
10675
10676 private:
10677 const ParamType parameter_;
10678
10679 GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
10680};
10681
10682// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10683//
10684// TestMetaFactoryBase is a base class for meta-factories that create
10685// test factories for passing into MakeAndRegisterTestInfo function.
10686template <class ParamType>
10688 public:
10690
10691 virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
10692};
10693
10694// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10695//
10696// TestMetaFactory creates test factories for passing into
10697// MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives
10698// ownership of test factory pointer, same factory object cannot be passed
10699// into that method twice. But ParameterizedTestSuiteInfo is going to call
10700// it for each Test/Parameter value combination. Thus it needs meta factory
10701// creator class.
10702template <class TestSuite>
10704 : public TestMetaFactoryBase<typename TestSuite::ParamType> {
10705 public:
10706 using ParamType = typename TestSuite::ParamType;
10707
10709
10711 return new ParameterizedTestFactory<TestSuite>(parameter);
10712 }
10713
10714 private:
10715 GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
10716};
10717
10718// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10719//
10720// ParameterizedTestSuiteInfoBase is a generic interface
10721// to ParameterizedTestSuiteInfo classes. ParameterizedTestSuiteInfoBase
10722// accumulates test information provided by TEST_P macro invocations
10723// and generators provided by INSTANTIATE_TEST_SUITE_P macro invocations
10724// and uses that information to register all resulting test instances
10725// in RegisterTests method. The ParameterizeTestSuiteRegistry class holds
10726// a collection of pointers to the ParameterizedTestSuiteInfo objects
10727// and calls RegisterTests() on each of them when asked.
10729 public:
10731
10732 // Base part of test suite name for display purposes.
10733 virtual const std::string& GetTestSuiteName() const = 0;
10734 // Test case id to verify identity.
10735 virtual TypeId GetTestSuiteTypeId() const = 0;
10736 // UnitTest class invokes this method to register tests in this
10737 // test suite right before running them in RUN_ALL_TESTS macro.
10738 // This method should not be called more than once on any single
10739 // instance of a ParameterizedTestSuiteInfoBase derived class.
10740 virtual void RegisterTests() = 0;
10741
10742 protected:
10744
10745 private:
10746 GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfoBase);
10747};
10748
10749// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10750//
10751// ParameterizedTestSuiteInfo accumulates tests obtained from TEST_P
10752// macro invocations for a particular test suite and generators
10753// obtained from INSTANTIATE_TEST_SUITE_P macro invocations for that
10754// test suite. It registers tests with all values generated by all
10755// generators when asked.
10756template <class TestSuite>
10758 public:
10759 // ParamType and GeneratorCreationFunc are private types but are required
10760 // for declarations of public methods AddTestPattern() and
10761 // AddTestSuiteInstantiation().
10762 using ParamType = typename TestSuite::ParamType;
10763 // A function that returns an instance of appropriate generator type.
10764 typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
10766
10767 explicit ParameterizedTestSuiteInfo(const char* name,
10768 CodeLocation code_location)
10769 : test_suite_name_(name), code_location_(code_location) {}
10770
10771 // Test case base name for display purposes.
10772 const std::string& GetTestSuiteName() const override {
10773 return test_suite_name_;
10774 }
10775 // Test case id to verify identity.
10776 TypeId GetTestSuiteTypeId() const override { return GetTypeId<TestSuite>(); }
10777 // TEST_P macro uses AddTestPattern() to record information
10778 // about a single test in a LocalTestInfo structure.
10779 // test_suite_name is the base name of the test suite (without invocation
10780 // prefix). test_base_name is the name of an individual test without
10781 // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
10782 // test suite base name and DoBar is test base name.
10783 void AddTestPattern(const char* test_suite_name, const char* test_base_name,
10784 TestMetaFactoryBase<ParamType>* meta_factory) {
10785 tests_.push_back(std::shared_ptr<TestInfo>(
10786 new TestInfo(test_suite_name, test_base_name, meta_factory)));
10787 }
10788 // INSTANTIATE_TEST_SUITE_P macro uses AddGenerator() to record information
10789 // about a generator.
10790 int AddTestSuiteInstantiation(const std::string& instantiation_name,
10791 GeneratorCreationFunc* func,
10792 ParamNameGeneratorFunc* name_func,
10793 const char* file, int line) {
10794 instantiations_.push_back(
10795 InstantiationInfo(instantiation_name, func, name_func, file, line));
10796 return 0; // Return value used only to run this method in namespace scope.
10797 }
10798 // UnitTest class invokes this method to register tests in this test suite
10799 // test suites right before running tests in RUN_ALL_TESTS macro.
10800 // This method should not be called more than once on any single
10801 // instance of a ParameterizedTestSuiteInfoBase derived class.
10802 // UnitTest has a guard to prevent from calling this method more than once.
10803 void RegisterTests() override {
10804 for (typename TestInfoContainer::iterator test_it = tests_.begin();
10805 test_it != tests_.end(); ++test_it) {
10806 std::shared_ptr<TestInfo> test_info = *test_it;
10807 for (typename InstantiationContainer::iterator gen_it =
10808 instantiations_.begin(); gen_it != instantiations_.end();
10809 ++gen_it) {
10810 const std::string& instantiation_name = gen_it->name;
10811 ParamGenerator<ParamType> generator((*gen_it->generator)());
10812 ParamNameGeneratorFunc* name_func = gen_it->name_func;
10813 const char* file = gen_it->file;
10814 int line = gen_it->line;
10815
10816 std::string test_suite_name;
10817 if ( !instantiation_name.empty() )
10818 test_suite_name = instantiation_name + "/";
10819 test_suite_name += test_info->test_suite_base_name;
10820
10821 size_t i = 0;
10822 std::set<std::string> test_param_names;
10823 for (typename ParamGenerator<ParamType>::iterator param_it =
10824 generator.begin();
10825 param_it != generator.end(); ++param_it, ++i) {
10826 Message test_name_stream;
10827
10828 std::string param_name = name_func(
10829 TestParamInfo<ParamType>(*param_it, i));
10830
10831 GTEST_CHECK_(IsValidParamName(param_name))
10832 << "Parameterized test name '" << param_name
10833 << "' is invalid, in " << file
10834 << " line " << line << std::endl;
10835
10836 GTEST_CHECK_(test_param_names.count(param_name) == 0)
10837 << "Duplicate parameterized test name '" << param_name
10838 << "', in " << file << " line " << line << std::endl;
10839
10840 test_param_names.insert(param_name);
10841
10842 if (!test_info->test_base_name.empty()) {
10843 test_name_stream << test_info->test_base_name << "/";
10844 }
10845 test_name_stream << param_name;
10847 test_suite_name.c_str(), test_name_stream.GetString().c_str(),
10848 nullptr, // No type parameter.
10849 PrintToString(*param_it).c_str(), code_location_,
10853 test_info->test_meta_factory->CreateTestFactory(*param_it));
10854 } // for param_it
10855 } // for gen_it
10856 } // for test_it
10857 } // RegisterTests
10858
10859 private:
10860 // LocalTestInfo structure keeps information about a single test registered
10861 // with TEST_P macro.
10862 struct TestInfo {
10863 TestInfo(const char* a_test_suite_base_name, const char* a_test_base_name,
10864 TestMetaFactoryBase<ParamType>* a_test_meta_factory)
10865 : test_suite_base_name(a_test_suite_base_name),
10866 test_base_name(a_test_base_name),
10867 test_meta_factory(a_test_meta_factory) {}
10868
10869 const std::string test_suite_base_name;
10870 const std::string test_base_name;
10871 const std::unique_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
10872 };
10873 using TestInfoContainer = ::std::vector<std::shared_ptr<TestInfo> >;
10874 // Records data received from INSTANTIATE_TEST_SUITE_P macros:
10875 // <Instantiation name, Sequence generator creation function,
10876 // Name generator function, Source file, Source line>
10877 struct InstantiationInfo {
10878 InstantiationInfo(const std::string &name_in,
10879 GeneratorCreationFunc* generator_in,
10880 ParamNameGeneratorFunc* name_func_in,
10881 const char* file_in,
10882 int line_in)
10883 : name(name_in),
10884 generator(generator_in),
10885 name_func(name_func_in),
10886 file(file_in),
10887 line(line_in) {}
10888
10890 GeneratorCreationFunc* generator;
10891 ParamNameGeneratorFunc* name_func;
10892 const char* file;
10893 int line;
10894 };
10895 typedef ::std::vector<InstantiationInfo> InstantiationContainer;
10896
10897 static bool IsValidParamName(const std::string& name) {
10898 // Check for empty string
10899 if (name.empty())
10900 return false;
10901
10902 // Check for invalid characters
10903 for (std::string::size_type index = 0; index < name.size(); ++index) {
10904 if (!isalnum(name[index]) && name[index] != '_')
10905 return false;
10906 }
10907
10908 return true;
10909 }
10910
10911 const std::string test_suite_name_;
10912 CodeLocation code_location_;
10913 TestInfoContainer tests_;
10914 InstantiationContainer instantiations_;
10915
10916 GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfo);
10917}; // class ParameterizedTestSuiteInfo
10918
10919// Legacy API is deprecated but still available
10920#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
10921template <class TestCase>
10923#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
10924
10925// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10926//
10927// ParameterizedTestSuiteRegistry contains a map of
10928// ParameterizedTestSuiteInfoBase classes accessed by test suite names. TEST_P
10929// and INSTANTIATE_TEST_SUITE_P macros use it to locate their corresponding
10930// ParameterizedTestSuiteInfo descriptors.
10932 public:
10935 for (auto& test_suite_info : test_suite_infos_) {
10936 delete test_suite_info;
10937 }
10938 }
10939
10940 // Looks up or creates and returns a structure containing information about
10941 // tests and instantiations of a particular test suite.
10942 template <class TestSuite>
10944 const char* test_suite_name, CodeLocation code_location) {
10945 ParameterizedTestSuiteInfo<TestSuite>* typed_test_info = nullptr;
10946 for (auto& test_suite_info : test_suite_infos_) {
10947 if (test_suite_info->GetTestSuiteName() == test_suite_name) {
10948 if (test_suite_info->GetTestSuiteTypeId() != GetTypeId<TestSuite>()) {
10949 // Complain about incorrect usage of Google Test facilities
10950 // and terminate the program since we cannot guaranty correct
10951 // test suite setup and tear-down in this case.
10952 ReportInvalidTestSuiteType(test_suite_name, code_location);
10953 posix::Abort();
10954 } else {
10955 // At this point we are sure that the object we found is of the same
10956 // type we are looking for, so we downcast it to that type
10957 // without further checks.
10958 typed_test_info = CheckedDowncastToActualType<
10959 ParameterizedTestSuiteInfo<TestSuite> >(test_suite_info);
10960 }
10961 break;
10962 }
10963 }
10964 if (typed_test_info == nullptr) {
10965 typed_test_info = new ParameterizedTestSuiteInfo<TestSuite>(
10966 test_suite_name, code_location);
10967 test_suite_infos_.push_back(typed_test_info);
10968 }
10969 return typed_test_info;
10970 }
10972 for (auto& test_suite_info : test_suite_infos_) {
10973 test_suite_info->RegisterTests();
10974 }
10975 }
10976// Legacy API is deprecated but still available
10977#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
10978 template <class TestCase>
10980 const char* test_case_name, CodeLocation code_location) {
10981 return GetTestSuitePatternHolder<TestCase>(test_case_name, code_location);
10982 }
10983
10984#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
10985
10986 private:
10987 using TestSuiteInfoContainer = ::std::vector<ParameterizedTestSuiteInfoBase*>;
10988
10989 TestSuiteInfoContainer test_suite_infos_;
10990
10991 GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteRegistry);
10992};
10993
10994} // namespace internal
10995
10996// Forward declarations of ValuesIn(), which is implemented in
10997// include/gtest/gtest-param-test.h.
10998template <class Container>
10999internal::ParamGenerator<typename Container::value_type> ValuesIn(
11000 const Container& container);
11001
11002namespace internal {
11003// Used in the Values() function to provide polymorphic capabilities.
11004
11005template <typename... Ts>
11007 public:
11008 ValueArray(Ts... v) : v_{std::move(v)...} {}
11009
11010 template <typename T>
11011 operator ParamGenerator<T>() const { // NOLINT
11012 return ValuesIn(MakeVector<T>(MakeIndexSequence<sizeof...(Ts)>()));
11013 }
11014
11015 private:
11016 template <typename T, size_t... I>
11017 std::vector<T> MakeVector(IndexSequence<I...>) const {
11018 return std::vector<T>{static_cast<T>(v_.template Get<I>())...};
11019 }
11020
11021 FlatTuple<Ts...> v_;
11022};
11023
11024template <typename... T>
11026 : public ParamGeneratorInterface<::std::tuple<T...>> {
11027 public:
11028 typedef ::std::tuple<T...> ParamType;
11029
11031 : generators_(g) {}
11033
11035 return new Iterator(this, generators_, false);
11036 }
11038 return new Iterator(this, generators_, true);
11039 }
11040
11041 private:
11042 template <class I>
11043 class IteratorImpl;
11044 template <size_t... I>
11045 class IteratorImpl<IndexSequence<I...>>
11046 : public ParamIteratorInterface<ParamType> {
11047 public:
11048 IteratorImpl(const ParamGeneratorInterface<ParamType>* base,
11049 const std::tuple<ParamGenerator<T>...>& generators, bool is_end)
11050 : base_(base),
11051 begin_(std::get<I>(generators).begin()...),
11052 end_(std::get<I>(generators).end()...),
11053 current_(is_end ? end_ : begin_) {
11054 ComputeCurrentValue();
11055 }
11056 ~IteratorImpl() override {}
11057
11058 const ParamGeneratorInterface<ParamType>* BaseGenerator() const override {
11059 return base_;
11060 }
11061 // Advance should not be called on beyond-of-range iterators
11062 // so no component iterators must be beyond end of range, either.
11063 void Advance() override {
11064 assert(!AtEnd());
11065 // Advance the last iterator.
11066 ++std::get<sizeof...(T) - 1>(current_);
11067 // if that reaches end, propagate that up.
11068 AdvanceIfEnd<sizeof...(T) - 1>();
11069 ComputeCurrentValue();
11070 }
11071 ParamIteratorInterface<ParamType>* Clone() const override {
11072 return new IteratorImpl(*this);
11073 }
11074
11075 const ParamType* Current() const override { return current_value_.get(); }
11076
11077 bool Equals(const ParamIteratorInterface<ParamType>& other) const override {
11078 // Having the same base generator guarantees that the other
11079 // iterator is of the same type and we can downcast.
11080 GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
11081 << "The program attempted to compare iterators "
11082 << "from different generators." << std::endl;
11083 const IteratorImpl* typed_other =
11084 CheckedDowncastToActualType<const IteratorImpl>(&other);
11085
11086 // We must report iterators equal if they both point beyond their
11087 // respective ranges. That can happen in a variety of fashions,
11088 // so we have to consult AtEnd().
11089 if (AtEnd() && typed_other->AtEnd()) return true;
11090
11091 bool same = true;
11092 bool dummy[] = {
11093 (same = same && std::get<I>(current_) ==
11094 std::get<I>(typed_other->current_))...};
11095 (void)dummy;
11096 return same;
11097 }
11098
11099 private:
11100 template <size_t ThisI>
11101 void AdvanceIfEnd() {
11102 if (std::get<ThisI>(current_) != std::get<ThisI>(end_)) return;
11103
11104 bool last = ThisI == 0;
11105 if (last) {
11106 // We are done. Nothing else to propagate.
11107 return;
11108 }
11109
11110 constexpr size_t NextI = ThisI - (ThisI != 0);
11111 std::get<ThisI>(current_) = std::get<ThisI>(begin_);
11112 ++std::get<NextI>(current_);
11113 AdvanceIfEnd<NextI>();
11114 }
11115
11116 void ComputeCurrentValue() {
11117 if (!AtEnd())
11118 current_value_ = std::make_shared<ParamType>(*std::get<I>(current_)...);
11119 }
11120 bool AtEnd() const {
11121 bool at_end = false;
11122 bool dummy[] = {
11123 (at_end = at_end || std::get<I>(current_) == std::get<I>(end_))...};
11124 (void)dummy;
11125 return at_end;
11126 }
11127
11128 const ParamGeneratorInterface<ParamType>* const base_;
11129 std::tuple<typename ParamGenerator<T>::iterator...> begin_;
11130 std::tuple<typename ParamGenerator<T>::iterator...> end_;
11131 std::tuple<typename ParamGenerator<T>::iterator...> current_;
11132 std::shared_ptr<ParamType> current_value_;
11133 };
11134
11135 using Iterator = IteratorImpl<typename MakeIndexSequence<sizeof...(T)>::type>;
11136
11137 std::tuple<ParamGenerator<T>...> generators_;
11138};
11139
11140template <class... Gen>
11142 public:
11143 CartesianProductHolder(const Gen&... g) : generators_(g...) {}
11144 template <typename... T>
11145 operator ParamGenerator<::std::tuple<T...>>() const {
11146 return ParamGenerator<::std::tuple<T...>>(
11147 new CartesianProductGenerator<T...>(generators_));
11148 }
11149
11150 private:
11151 std::tuple<Gen...> generators_;
11152};
11153
11154} // namespace internal
11155} // namespace testing
11156
11157#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
11158
11159namespace testing {
11160
11161// Functions producing parameter generators.
11162//
11163// Google Test uses these generators to produce parameters for value-
11164// parameterized tests. When a parameterized test suite is instantiated
11165// with a particular generator, Google Test creates and runs tests
11166// for each element in the sequence produced by the generator.
11167//
11168// In the following sample, tests from test suite FooTest are instantiated
11169// each three times with parameter values 3, 5, and 8:
11170//
11171// class FooTest : public TestWithParam<int> { ... };
11172//
11173// TEST_P(FooTest, TestThis) {
11174// }
11175// TEST_P(FooTest, TestThat) {
11176// }
11177// INSTANTIATE_TEST_SUITE_P(TestSequence, FooTest, Values(3, 5, 8));
11178//
11179
11180// Range() returns generators providing sequences of values in a range.
11181//
11182// Synopsis:
11183// Range(start, end)
11184// - returns a generator producing a sequence of values {start, start+1,
11185// start+2, ..., }.
11186// Range(start, end, step)
11187// - returns a generator producing a sequence of values {start, start+step,
11188// start+step+step, ..., }.
11189// Notes:
11190// * The generated sequences never include end. For example, Range(1, 5)
11191// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
11192// returns a generator producing {1, 3, 5, 7}.
11193// * start and end must have the same type. That type may be any integral or
11194// floating-point type or a user defined type satisfying these conditions:
11195// * It must be assignable (have operator=() defined).
11196// * It must have operator+() (operator+(int-compatible type) for
11197// two-operand version).
11198// * It must have operator<() defined.
11199// Elements in the resulting sequences will also have that type.
11200// * Condition start < end must be satisfied in order for resulting sequences
11201// to contain any elements.
11202//
11203template <typename T, typename IncrementT>
11204internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
11206 new internal::RangeGenerator<T, IncrementT>(start, end, step));
11207}
11208
11209template <typename T>
11211 return Range(start, end, 1);
11212}
11213
11214// ValuesIn() function allows generation of tests with parameters coming from
11215// a container.
11216//
11217// Synopsis:
11218// ValuesIn(const T (&array)[N])
11219// - returns a generator producing sequences with elements from
11220// a C-style array.
11221// ValuesIn(const Container& container)
11222// - returns a generator producing sequences with elements from
11223// an STL-style container.
11224// ValuesIn(Iterator begin, Iterator end)
11225// - returns a generator producing sequences with elements from
11226// a range [begin, end) defined by a pair of STL-style iterators. These
11227// iterators can also be plain C pointers.
11228//
11229// Please note that ValuesIn copies the values from the containers
11230// passed in and keeps them to generate tests in RUN_ALL_TESTS().
11231//
11232// Examples:
11233//
11234// This instantiates tests from test suite StringTest
11235// each with C-string values of "foo", "bar", and "baz":
11236//
11237// const char* strings[] = {"foo", "bar", "baz"};
11238// INSTANTIATE_TEST_SUITE_P(StringSequence, StringTest, ValuesIn(strings));
11239//
11240// This instantiates tests from test suite StlStringTest
11241// each with STL strings with values "a" and "b":
11242//
11243// ::std::vector< ::std::string> GetParameterStrings() {
11244// ::std::vector< ::std::string> v;
11245// v.push_back("a");
11246// v.push_back("b");
11247// return v;
11248// }
11249//
11250// INSTANTIATE_TEST_SUITE_P(CharSequence,
11251// StlStringTest,
11252// ValuesIn(GetParameterStrings()));
11253//
11254//
11255// This will also instantiate tests from CharTest
11256// each with parameter values 'a' and 'b':
11257//
11258// ::std::list<char> GetParameterChars() {
11259// ::std::list<char> list;
11260// list.push_back('a');
11261// list.push_back('b');
11262// return list;
11263// }
11264// ::std::list<char> l = GetParameterChars();
11265// INSTANTIATE_TEST_SUITE_P(CharSequence2,
11266// CharTest,
11267// ValuesIn(l.begin(), l.end()));
11268//
11269template <typename ForwardIterator>
11270internal::ParamGenerator<
11271 typename std::iterator_traits<ForwardIterator>::value_type>
11272ValuesIn(ForwardIterator begin, ForwardIterator end) {
11273 typedef typename std::iterator_traits<ForwardIterator>::value_type ParamType;
11276}
11277
11278template <typename T, size_t N>
11280 return ValuesIn(array, array + N);
11281}
11282
11283template <class Container>
11285 const Container& container) {
11286 return ValuesIn(container.begin(), container.end());
11287}
11288
11289// Values() allows generating tests from explicitly specified list of
11290// parameters.
11291//
11292// Synopsis:
11293// Values(T v1, T v2, ..., T vN)
11294// - returns a generator producing sequences with elements v1, v2, ..., vN.
11295//
11296// For example, this instantiates tests from test suite BarTest each
11297// with values "one", "two", and "three":
11298//
11299// INSTANTIATE_TEST_SUITE_P(NumSequence,
11300// BarTest,
11301// Values("one", "two", "three"));
11302//
11303// This instantiates tests from test suite BazTest each with values 1, 2, 3.5.
11304// The exact type of values will depend on the type of parameter in BazTest.
11305//
11306// INSTANTIATE_TEST_SUITE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
11307//
11308//
11309template <typename... T>
11311 return internal::ValueArray<T...>(std::move(v)...);
11312}
11313
11314// Bool() allows generating tests with parameters in a set of (false, true).
11315//
11316// Synopsis:
11317// Bool()
11318// - returns a generator producing sequences with elements {false, true}.
11319//
11320// It is useful when testing code that depends on Boolean flags. Combinations
11321// of multiple flags can be tested when several Bool()'s are combined using
11322// Combine() function.
11323//
11324// In the following example all tests in the test suite FlagDependentTest
11325// will be instantiated twice with parameters false and true.
11326//
11327// class FlagDependentTest : public testing::TestWithParam<bool> {
11328// virtual void SetUp() {
11329// external_flag = GetParam();
11330// }
11331// }
11332// INSTANTIATE_TEST_SUITE_P(BoolSequence, FlagDependentTest, Bool());
11333//
11335 return Values(false, true);
11336}
11337
11338// Combine() allows the user to combine two or more sequences to produce
11339// values of a Cartesian product of those sequences' elements.
11340//
11341// Synopsis:
11342// Combine(gen1, gen2, ..., genN)
11343// - returns a generator producing sequences with elements coming from
11344// the Cartesian product of elements from the sequences generated by
11345// gen1, gen2, ..., genN. The sequence elements will have a type of
11346// std::tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
11347// of elements from sequences produces by gen1, gen2, ..., genN.
11348//
11349// Combine can have up to 10 arguments.
11350//
11351// Example:
11352//
11353// This will instantiate tests in test suite AnimalTest each one with
11354// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
11355// tuple("dog", BLACK), and tuple("dog", WHITE):
11356//
11357// enum Color { BLACK, GRAY, WHITE };
11358// class AnimalTest
11359// : public testing::TestWithParam<std::tuple<const char*, Color> > {...};
11360//
11361// TEST_P(AnimalTest, AnimalLooksNice) {...}
11362//
11363// INSTANTIATE_TEST_SUITE_P(AnimalVariations, AnimalTest,
11364// Combine(Values("cat", "dog"),
11365// Values(BLACK, WHITE)));
11366//
11367// This will instantiate tests in FlagDependentTest with all variations of two
11368// Boolean flags:
11369//
11370// class FlagDependentTest
11371// : public testing::TestWithParam<std::tuple<bool, bool> > {
11372// virtual void SetUp() {
11373// // Assigns external_flag_1 and external_flag_2 values from the tuple.
11374// std::tie(external_flag_1, external_flag_2) = GetParam();
11375// }
11376// };
11377//
11378// TEST_P(FlagDependentTest, TestFeature1) {
11379// // Test your code using external_flag_1 and external_flag_2 here.
11380// }
11381// INSTANTIATE_TEST_SUITE_P(TwoBoolSequence, FlagDependentTest,
11382// Combine(Bool(), Bool()));
11383//
11384template <typename... Generator>
11385internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) {
11386 return internal::CartesianProductHolder<Generator...>(g...);
11387}
11388
11389#define TEST_P(test_suite_name, test_name) \
11390 class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
11391 : public test_suite_name { \
11392 public: \
11393 GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
11394 virtual void TestBody(); \
11395 \
11396 private: \
11397 static int AddToRegistry() { \
11398 ::testing::UnitTest::GetInstance() \
11399 ->parameterized_test_registry() \
11400 .GetTestSuitePatternHolder<test_suite_name>( \
11401 #test_suite_name, \
11402 ::testing::internal::CodeLocation(__FILE__, __LINE__)) \
11403 ->AddTestPattern( \
11404 GTEST_STRINGIFY_(test_suite_name), GTEST_STRINGIFY_(test_name), \
11405 new ::testing::internal::TestMetaFactory<GTEST_TEST_CLASS_NAME_( \
11406 test_suite_name, test_name)>()); \
11407 return 0; \
11408 } \
11409 static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
11410 GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
11411 test_name)); \
11412 }; \
11413 int GTEST_TEST_CLASS_NAME_(test_suite_name, \
11414 test_name)::gtest_registering_dummy_ = \
11415 GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \
11416 void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
11417
11418// The last argument to INSTANTIATE_TEST_SUITE_P allows the user to specify
11419// generator and an optional function or functor that generates custom test name
11420// suffixes based on the test parameters. Such a function or functor should
11421// accept one argument of type testing::TestParamInfo<class ParamType>, and
11422// return std::string.
11423//
11424// testing::PrintToStringParamName is a builtin test suffix generator that
11425// returns the value of testing::PrintToString(GetParam()).
11426//
11427// Note: test names must be non-empty, unique, and may only contain ASCII
11428// alphanumeric characters or underscore. Because PrintToString adds quotes
11429// to std::string and C strings, it won't work for these types.
11430
11431#define GTEST_EXPAND_(arg) arg
11432#define GTEST_GET_FIRST_(first, ...) first
11433#define GTEST_GET_SECOND_(first, second, ...) second
11434
11435#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \
11436 static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \
11437 gtest_##prefix##test_suite_name##_EvalGenerator_() { \
11438 return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \
11439 } \
11440 static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \
11441 const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \
11442 if (::testing::internal::AlwaysFalse()) { \
11443 ::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \
11444 __VA_ARGS__, \
11445 ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
11446 DUMMY_PARAM_))); \
11447 auto t = std::make_tuple(__VA_ARGS__); \
11448 static_assert(std::tuple_size<decltype(t)>::value <= 2, \
11449 "Too Many Args!"); \
11450 } \
11451 return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \
11452 __VA_ARGS__, \
11453 ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
11454 DUMMY_PARAM_))))(info); \
11455 } \
11456 static int gtest_##prefix##test_suite_name##_dummy_ \
11457 GTEST_ATTRIBUTE_UNUSED_ = \
11458 ::testing::UnitTest::GetInstance() \
11459 ->parameterized_test_registry() \
11460 .GetTestSuitePatternHolder<test_suite_name>( \
11461 #test_suite_name, \
11462 ::testing::internal::CodeLocation(__FILE__, __LINE__)) \
11463 ->AddTestSuiteInstantiation( \
11464 #prefix, &gtest_##prefix##test_suite_name##_EvalGenerator_, \
11465 &gtest_##prefix##test_suite_name##_EvalGenerateName_, \
11466 __FILE__, __LINE__)
11467
11468// Legacy API is deprecated but still available
11469#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
11470#define INSTANTIATE_TEST_CASE_P \
11471 static_assert(::testing::internal::InstantiateTestCase_P_IsDeprecated(), \
11472 ""); \
11473 INSTANTIATE_TEST_SUITE_P
11474#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
11475
11476} // namespace testing
11477
11478#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
11479// Copyright 2006, Google Inc.
11480// All rights reserved.
11481//
11482// Redistribution and use in source and binary forms, with or without
11483// modification, are permitted provided that the following conditions are
11484// met:
11485//
11486// * Redistributions of source code must retain the above copyright
11487// notice, this list of conditions and the following disclaimer.
11488// * Redistributions in binary form must reproduce the above
11489// copyright notice, this list of conditions and the following disclaimer
11490// in the documentation and/or other materials provided with the
11491// distribution.
11492// * Neither the name of Google Inc. nor the names of its
11493// contributors may be used to endorse or promote products derived from
11494// this software without specific prior written permission.
11495//
11496// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
11497// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
11498// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
11499// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
11500// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
11501// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11502// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11503// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11504// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11505// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
11506// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11507
11508//
11509// Google C++ Testing and Mocking Framework definitions useful in production code.
11510// GOOGLETEST_CM0003 DO NOT DELETE
11511
11512#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
11513#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
11514
11515// When you need to test the private or protected members of a class,
11516// use the FRIEND_TEST macro to declare your tests as friends of the
11517// class. For example:
11518//
11519// class MyClass {
11520// private:
11521// void PrivateMethod();
11522// FRIEND_TEST(MyClassTest, PrivateMethodWorks);
11523// };
11524//
11525// class MyClassTest : public testing::Test {
11526// // ...
11527// };
11528//
11529// TEST_F(MyClassTest, PrivateMethodWorks) {
11530// // Can call MyClass::PrivateMethod() here.
11531// }
11532//
11533// Note: The test class must be in the same namespace as the class being tested.
11534// For example, putting MyClassTest in an anonymous namespace will not work.
11535
11536#define FRIEND_TEST(test_case_name, test_name)\
11537friend class test_case_name##_##test_name##_Test
11538
11539#endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
11540// Copyright 2008, Google Inc.
11541// All rights reserved.
11542//
11543// Redistribution and use in source and binary forms, with or without
11544// modification, are permitted provided that the following conditions are
11545// met:
11546//
11547// * Redistributions of source code must retain the above copyright
11548// notice, this list of conditions and the following disclaimer.
11549// * Redistributions in binary form must reproduce the above
11550// copyright notice, this list of conditions and the following disclaimer
11551// in the documentation and/or other materials provided with the
11552// distribution.
11553// * Neither the name of Google Inc. nor the names of its
11554// contributors may be used to endorse or promote products derived from
11555// this software without specific prior written permission.
11556//
11557// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
11558// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
11559// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
11560// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
11561// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
11562// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11563// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11564// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11565// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11566// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
11567// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11568//
11569// GOOGLETEST_CM0001 DO NOT DELETE
11570
11571#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
11572#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
11573
11574#include <iosfwd>
11575#include <vector>
11576
11578/* class A needs to have dll-interface to be used by clients of class B */)
11579
11580namespace testing {
11581
11582// A copyable object representing the result of a test part (i.e. an
11583// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
11584//
11585// Don't inherit from TestPartResult as its destructor is not virtual.
11586class GTEST_API_ TestPartResult {
11587 public:
11588 // The possible outcomes of a test part (i.e. an assertion or an
11589 // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
11590 enum Type {
11591 kSuccess, // Succeeded.
11592 kNonFatalFailure, // Failed but the test can continue.
11593 kFatalFailure, // Failed and the test should be terminated.
11594 kSkip // Skipped.
11595 };
11596
11597 // C'tor. TestPartResult does NOT have a default constructor.
11598 // Always use this constructor (with parameters) to create a
11599 // TestPartResult object.
11600 TestPartResult(Type a_type, const char* a_file_name, int a_line_number,
11601 const char* a_message)
11602 : type_(a_type),
11603 file_name_(a_file_name == nullptr ? "" : a_file_name),
11604 line_number_(a_line_number),
11605 summary_(ExtractSummary(a_message)),
11606 message_(a_message) {}
11607
11608 // Gets the outcome of the test part.
11609 Type type() const { return type_; }
11610
11611 // Gets the name of the source file where the test part took place, or
11612 // NULL if it's unknown.
11613 const char* file_name() const {
11614 return file_name_.empty() ? nullptr : file_name_.c_str();
11615 }
11616
11617 // Gets the line in the source file where the test part took place,
11618 // or -1 if it's unknown.
11619 int line_number() const { return line_number_; }
11620
11621 // Gets the summary of the failure message.
11622 const char* summary() const { return summary_.c_str(); }
11623
11624 // Gets the message associated with the test part.
11625 const char* message() const { return message_.c_str(); }
11626
11627 // Returns true if and only if the test part was skipped.
11628 bool skipped() const { return type_ == kSkip; }
11629
11630 // Returns true if and only if the test part passed.
11631 bool passed() const { return type_ == kSuccess; }
11632
11633 // Returns true if and only if the test part non-fatally failed.
11634 bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
11635
11636 // Returns true if and only if the test part fatally failed.
11637 bool fatally_failed() const { return type_ == kFatalFailure; }
11638
11639 // Returns true if and only if the test part failed.
11640 bool failed() const { return fatally_failed() || nonfatally_failed(); }
11641
11642 private:
11643 Type type_;
11644
11645 // Gets the summary of the failure message by omitting the stack
11646 // trace in it.
11647 static std::string ExtractSummary(const char* message);
11648
11649 // The name of the source file where the test part took place, or
11650 // "" if the source file is unknown.
11651 std::string file_name_;
11652 // The line in the source file where the test part took place, or -1
11653 // if the line number is unknown.
11654 int line_number_;
11655 std::string summary_; // The test failure summary.
11656 std::string message_; // The test failure message.
11657};
11658
11659// Prints a TestPartResult object.
11660std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
11661
11662// An array of TestPartResult objects.
11663//
11664// Don't inherit from TestPartResultArray as its destructor is not
11665// virtual.
11666class GTEST_API_ TestPartResultArray {
11667 public:
11668 TestPartResultArray() {}
11669
11670 // Appends the given TestPartResult to the array.
11671 void Append(const TestPartResult& result);
11672
11673 // Returns the TestPartResult at the given index (0-based).
11674 const TestPartResult& GetTestPartResult(int index) const;
11675
11676 // Returns the number of TestPartResult objects in the array.
11677 int size() const;
11678
11679 private:
11680 std::vector<TestPartResult> array_;
11681
11682 GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
11683};
11684
11685// This interface knows how to report a test part result.
11686class GTEST_API_ TestPartResultReporterInterface {
11687 public:
11688 virtual ~TestPartResultReporterInterface() {}
11689
11690 virtual void ReportTestPartResult(const TestPartResult& result) = 0;
11691};
11692
11693namespace internal {
11694
11695// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
11696// statement generates new fatal failures. To do so it registers itself as the
11697// current test part result reporter. Besides checking if fatal failures were
11698// reported, it only delegates the reporting to the former result reporter.
11699// The original result reporter is restored in the destructor.
11700// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
11701class GTEST_API_ HasNewFatalFailureHelper
11702 : public TestPartResultReporterInterface {
11703 public:
11704 HasNewFatalFailureHelper();
11705 ~HasNewFatalFailureHelper() override;
11706 void ReportTestPartResult(const TestPartResult& result) override;
11707 bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
11708 private:
11709 bool has_new_fatal_failure_;
11710 TestPartResultReporterInterface* original_reporter_;
11711
11712 GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
11713};
11714
11715} // namespace internal
11716
11717} // namespace testing
11718
11720
11721#endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
11722// Copyright 2008 Google Inc.
11723// All Rights Reserved.
11724//
11725// Redistribution and use in source and binary forms, with or without
11726// modification, are permitted provided that the following conditions are
11727// met:
11728//
11729// * Redistributions of source code must retain the above copyright
11730// notice, this list of conditions and the following disclaimer.
11731// * Redistributions in binary form must reproduce the above
11732// copyright notice, this list of conditions and the following disclaimer
11733// in the documentation and/or other materials provided with the
11734// distribution.
11735// * Neither the name of Google Inc. nor the names of its
11736// contributors may be used to endorse or promote products derived from
11737// this software without specific prior written permission.
11738//
11739// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
11740// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
11741// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
11742// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
11743// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
11744// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11745// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11746// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11747// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11748// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
11749// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11750
11751
11752// GOOGLETEST_CM0001 DO NOT DELETE
11753
11754#ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
11755#define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
11756
11757// This header implements typed tests and type-parameterized tests.
11758
11759// Typed (aka type-driven) tests repeat the same test for types in a
11760// list. You must know which types you want to test with when writing
11761// typed tests. Here's how you do it:
11762
11763#if 0
11764
11765// First, define a fixture class template. It should be parameterized
11766// by a type. Remember to derive it from testing::Test.
11767template <typename T>
11768class FooTest : public testing::Test {
11769 public:
11770 ...
11771 typedef std::list<T> List;
11772 static T shared_;
11773 T value_;
11774};
11775
11776// Next, associate a list of types with the test suite, which will be
11777// repeated for each type in the list. The typedef is necessary for
11778// the macro to parse correctly.
11779typedef testing::Types<char, int, unsigned int> MyTypes;
11780TYPED_TEST_SUITE(FooTest, MyTypes);
11781
11782// If the type list contains only one type, you can write that type
11783// directly without Types<...>:
11784// TYPED_TEST_SUITE(FooTest, int);
11785
11786// Then, use TYPED_TEST() instead of TEST_F() to define as many typed
11787// tests for this test suite as you want.
11788TYPED_TEST(FooTest, DoesBlah) {
11789 // Inside a test, refer to the special name TypeParam to get the type
11790 // parameter. Since we are inside a derived class template, C++ requires
11791 // us to visit the members of FooTest via 'this'.
11792 TypeParam n = this->value_;
11793
11794 // To visit static members of the fixture, add the TestFixture::
11795 // prefix.
11796 n += TestFixture::shared_;
11797
11798 // To refer to typedefs in the fixture, add the "typename
11799 // TestFixture::" prefix.
11800 typename TestFixture::List values;
11801 values.push_back(n);
11802 ...
11803}
11804
11805TYPED_TEST(FooTest, HasPropertyA) { ... }
11806
11807// TYPED_TEST_SUITE takes an optional third argument which allows to specify a
11808// class that generates custom test name suffixes based on the type. This should
11809// be a class which has a static template function GetName(int index) returning
11810// a string for each type. The provided integer index equals the index of the
11811// type in the provided type list. In many cases the index can be ignored.
11812//
11813// For example:
11814// class MyTypeNames {
11815// public:
11816// template <typename T>
11817// static std::string GetName(int) {
11818// if (std::is_same<T, char>()) return "char";
11819// if (std::is_same<T, int>()) return "int";
11820// if (std::is_same<T, unsigned int>()) return "unsignedInt";
11821// }
11822// };
11823// TYPED_TEST_SUITE(FooTest, MyTypes, MyTypeNames);
11824
11825#endif // 0
11826
11827// Type-parameterized tests are abstract test patterns parameterized
11828// by a type. Compared with typed tests, type-parameterized tests
11829// allow you to define the test pattern without knowing what the type
11830// parameters are. The defined pattern can be instantiated with
11831// different types any number of times, in any number of translation
11832// units.
11833//
11834// If you are designing an interface or concept, you can define a
11835// suite of type-parameterized tests to verify properties that any
11836// valid implementation of the interface/concept should have. Then,
11837// each implementation can easily instantiate the test suite to verify
11838// that it conforms to the requirements, without having to write
11839// similar tests repeatedly. Here's an example:
11840
11841#if 0
11842
11843// First, define a fixture class template. It should be parameterized
11844// by a type. Remember to derive it from testing::Test.
11845template <typename T>
11846class FooTest : public testing::Test {
11847 ...
11848};
11849
11850// Next, declare that you will define a type-parameterized test suite
11851// (the _P suffix is for "parameterized" or "pattern", whichever you
11852// prefer):
11853TYPED_TEST_SUITE_P(FooTest);
11854
11855// Then, use TYPED_TEST_P() to define as many type-parameterized tests
11856// for this type-parameterized test suite as you want.
11857TYPED_TEST_P(FooTest, DoesBlah) {
11858 // Inside a test, refer to TypeParam to get the type parameter.
11859 TypeParam n = 0;
11860 ...
11861}
11862
11863TYPED_TEST_P(FooTest, HasPropertyA) { ... }
11864
11865// Now the tricky part: you need to register all test patterns before
11866// you can instantiate them. The first argument of the macro is the
11867// test suite name; the rest are the names of the tests in this test
11868// case.
11869REGISTER_TYPED_TEST_SUITE_P(FooTest,
11870 DoesBlah, HasPropertyA);
11871
11872// Finally, you are free to instantiate the pattern with the types you
11873// want. If you put the above code in a header file, you can #include
11874// it in multiple C++ source files and instantiate it multiple times.
11875//
11876// To distinguish different instances of the pattern, the first
11877// argument to the INSTANTIATE_* macro is a prefix that will be added
11878// to the actual test suite name. Remember to pick unique prefixes for
11879// different instances.
11880typedef testing::Types<char, int, unsigned int> MyTypes;
11881INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
11882
11883// If the type list contains only one type, you can write that type
11884// directly without Types<...>:
11885// INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, int);
11886//
11887// Similar to the optional argument of TYPED_TEST_SUITE above,
11888// INSTANTIATE_TEST_SUITE_P takes an optional fourth argument which allows to
11889// generate custom names.
11890// INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes, MyTypeNames);
11891
11892#endif // 0
11893
11894
11895// Implements typed tests.
11896
11897#if GTEST_HAS_TYPED_TEST
11898
11899// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11900//
11901// Expands to the name of the typedef for the type parameters of the
11902// given test suite.
11903#define GTEST_TYPE_PARAMS_(TestSuiteName) gtest_type_params_##TestSuiteName##_
11904
11905// Expands to the name of the typedef for the NameGenerator, responsible for
11906// creating the suffixes of the name.
11907#define GTEST_NAME_GENERATOR_(TestSuiteName) \
11908 gtest_type_params_##TestSuiteName##_NameGenerator
11909
11910#define TYPED_TEST_SUITE(CaseName, Types, ...) \
11911 typedef ::testing::internal::TypeList<Types>::type GTEST_TYPE_PARAMS_( \
11912 CaseName); \
11913 typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \
11914 GTEST_NAME_GENERATOR_(CaseName)
11915
11916# define TYPED_TEST(CaseName, TestName) \
11917 template <typename gtest_TypeParam_> \
11918 class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
11919 : public CaseName<gtest_TypeParam_> { \
11920 private: \
11921 typedef CaseName<gtest_TypeParam_> TestFixture; \
11922 typedef gtest_TypeParam_ TypeParam; \
11923 virtual void TestBody(); \
11924 }; \
11925 static bool gtest_##CaseName##_##TestName##_registered_ \
11926 GTEST_ATTRIBUTE_UNUSED_ = \
11927 ::testing::internal::TypeParameterizedTest< \
11928 CaseName, \
11929 ::testing::internal::TemplateSel<GTEST_TEST_CLASS_NAME_(CaseName, \
11930 TestName)>, \
11931 GTEST_TYPE_PARAMS_( \
11932 CaseName)>::Register("", \
11933 ::testing::internal::CodeLocation( \
11934 __FILE__, __LINE__), \
11935 #CaseName, #TestName, 0, \
11936 ::testing::internal::GenerateNames< \
11937 GTEST_NAME_GENERATOR_(CaseName), \
11938 GTEST_TYPE_PARAMS_(CaseName)>()); \
11939 template <typename gtest_TypeParam_> \
11940 void GTEST_TEST_CLASS_NAME_(CaseName, \
11941 TestName)<gtest_TypeParam_>::TestBody()
11942
11943// Legacy API is deprecated but still available
11944#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
11945#define TYPED_TEST_CASE \
11946 static_assert(::testing::internal::TypedTestCaseIsDeprecated(), ""); \
11947 TYPED_TEST_SUITE
11948#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
11949
11950#endif // GTEST_HAS_TYPED_TEST
11951
11952// Implements type-parameterized tests.
11953
11954#if GTEST_HAS_TYPED_TEST_P
11955
11956// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11957//
11958// Expands to the namespace name that the type-parameterized tests for
11959// the given type-parameterized test suite are defined in. The exact
11960// name of the namespace is subject to change without notice.
11961#define GTEST_SUITE_NAMESPACE_(TestSuiteName) gtest_suite_##TestSuiteName##_
11962
11963// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11964//
11965// Expands to the name of the variable used to remember the names of
11966// the defined tests in the given test suite.
11967#define GTEST_TYPED_TEST_SUITE_P_STATE_(TestSuiteName) \
11968 gtest_typed_test_suite_p_state_##TestSuiteName##_
11969
11970// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
11971//
11972// Expands to the name of the variable used to remember the names of
11973// the registered tests in the given test suite.
11974#define GTEST_REGISTERED_TEST_NAMES_(TestSuiteName) \
11975 gtest_registered_test_names_##TestSuiteName##_
11976
11977// The variables defined in the type-parameterized test macros are
11978// static as typically these macros are used in a .h file that can be
11979// #included in multiple translation units linked together.
11980#define TYPED_TEST_SUITE_P(SuiteName) \
11981 static ::testing::internal::TypedTestSuitePState \
11982 GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName)
11983
11984// Legacy API is deprecated but still available
11985#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
11986#define TYPED_TEST_CASE_P \
11987 static_assert(::testing::internal::TypedTestCase_P_IsDeprecated(), ""); \
11988 TYPED_TEST_SUITE_P
11989#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
11990
11991#define TYPED_TEST_P(SuiteName, TestName) \
11992 namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
11993 template <typename gtest_TypeParam_> \
11994 class TestName : public SuiteName<gtest_TypeParam_> { \
11995 private: \
11996 typedef SuiteName<gtest_TypeParam_> TestFixture; \
11997 typedef gtest_TypeParam_ TypeParam; \
11998 virtual void TestBody(); \
11999 }; \
12000 static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
12001 GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \
12002 __FILE__, __LINE__, #SuiteName, #TestName); \
12003 } \
12004 template <typename gtest_TypeParam_> \
12005 void GTEST_SUITE_NAMESPACE_( \
12006 SuiteName)::TestName<gtest_TypeParam_>::TestBody()
12007
12008#define REGISTER_TYPED_TEST_SUITE_P(SuiteName, ...) \
12009 namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
12010 typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
12011 } \
12012 static const char* const GTEST_REGISTERED_TEST_NAMES_( \
12013 SuiteName) GTEST_ATTRIBUTE_UNUSED_ = \
12014 GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).VerifyRegisteredTestNames( \
12015 __FILE__, __LINE__, #__VA_ARGS__)
12016
12017// Legacy API is deprecated but still available
12018#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
12019#define REGISTER_TYPED_TEST_CASE_P \
12020 static_assert(::testing::internal::RegisterTypedTestCase_P_IsDeprecated(), \
12021 ""); \
12022 REGISTER_TYPED_TEST_SUITE_P
12023#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
12024
12025#define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types, ...) \
12026 static bool gtest_##Prefix##_##SuiteName GTEST_ATTRIBUTE_UNUSED_ = \
12027 ::testing::internal::TypeParameterizedTestSuite< \
12028 SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \
12029 ::testing::internal::TypeList<Types>::type>:: \
12030 Register(#Prefix, \
12031 ::testing::internal::CodeLocation(__FILE__, __LINE__), \
12032 &GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName), #SuiteName, \
12033 GTEST_REGISTERED_TEST_NAMES_(SuiteName), \
12034 ::testing::internal::GenerateNames< \
12035 ::testing::internal::NameGeneratorSelector< \
12036 __VA_ARGS__>::type, \
12037 ::testing::internal::TypeList<Types>::type>())
12038
12039// Legacy API is deprecated but still available
12040#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
12041#define INSTANTIATE_TYPED_TEST_CASE_P \
12042 static_assert( \
12043 ::testing::internal::InstantiateTypedTestCase_P_IsDeprecated(), ""); \
12044 INSTANTIATE_TYPED_TEST_SUITE_P
12045#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
12046
12047#endif // GTEST_HAS_TYPED_TEST_P
12048
12049#endif // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
12050
12052/* class A needs to have dll-interface to be used by clients of class B */)
12053
12054namespace testing {
12055
12056// Silence C4100 (unreferenced formal parameter) and 4805
12057// unsafe mix of type 'const int' and type 'const bool'
12058#ifdef _MSC_VER
12059# pragma warning(push)
12060# pragma warning(disable:4805)
12061# pragma warning(disable:4100)
12062#endif
12063
12064
12065// Declares the flags.
12066
12067// This flag temporary enables the disabled tests.
12068GTEST_DECLARE_bool_(also_run_disabled_tests);
12069
12070// This flag brings the debugger on an assertion failure.
12071GTEST_DECLARE_bool_(break_on_failure);
12072
12073// This flag controls whether Google Test catches all test-thrown exceptions
12074// and logs them as failures.
12075GTEST_DECLARE_bool_(catch_exceptions);
12076
12077// This flag enables using colors in terminal output. Available values are
12078// "yes" to enable colors, "no" (disable colors), or "auto" (the default)
12079// to let Google Test decide.
12081
12082// This flag sets up the filter to select by name using a glob pattern
12083// the tests to run. If the filter is not given all tests are executed.
12084GTEST_DECLARE_string_(filter);
12085
12086// This flag controls whether Google Test installs a signal handler that dumps
12087// debugging information when fatal signals are raised.
12088GTEST_DECLARE_bool_(install_failure_signal_handler);
12089
12090// This flag causes the Google Test to list tests. None of the tests listed
12091// are actually run if the flag is provided.
12092GTEST_DECLARE_bool_(list_tests);
12093
12094// This flag controls whether Google Test emits a detailed XML report to a file
12095// in addition to its normal textual output.
12096GTEST_DECLARE_string_(output);
12097
12098// This flags control whether Google Test prints the elapsed time for each
12099// test.
12100GTEST_DECLARE_bool_(print_time);
12101
12102// This flags control whether Google Test prints UTF8 characters as text.
12103GTEST_DECLARE_bool_(print_utf8);
12104
12105// This flag specifies the random number seed.
12106GTEST_DECLARE_int32_(random_seed);
12107
12108// This flag sets how many times the tests are repeated. The default value
12109// is 1. If the value is -1 the tests are repeating forever.
12110GTEST_DECLARE_int32_(repeat);
12111
12112// This flag controls whether Google Test includes Google Test internal
12113// stack frames in failure stack traces.
12114GTEST_DECLARE_bool_(show_internal_stack_frames);
12115
12116// When this flag is specified, tests' order is randomized on every iteration.
12117GTEST_DECLARE_bool_(shuffle);
12118
12119// This flag specifies the maximum number of stack frames to be
12120// printed in a failure message.
12121GTEST_DECLARE_int32_(stack_trace_depth);
12122
12123// When this flag is specified, a failed assertion will throw an
12124// exception if exceptions are enabled, or exit the program with a
12125// non-zero code otherwise. For use with an external test framework.
12126GTEST_DECLARE_bool_(throw_on_failure);
12127
12128// When this flag is set with a "host:port" string, on supported
12129// platforms test results are streamed to the specified port on
12130// the specified host machine.
12131GTEST_DECLARE_string_(stream_result_to);
12132
12133#if GTEST_USE_OWN_FLAGFILE_FLAG_
12134GTEST_DECLARE_string_(flagfile);
12135#endif // GTEST_USE_OWN_FLAGFILE_FLAG_
12136
12137// The upper limit for valid stack trace depths.
12138const int kMaxStackTraceDepth = 100;
12139
12140namespace internal {
12141
12142class AssertHelper;
12143class DefaultGlobalTestPartResultReporter;
12144class ExecDeathTest;
12145class NoExecDeathTest;
12146class FinalSuccessChecker;
12147class GTestFlagSaver;
12148class StreamingListenerTest;
12149class TestResultAccessor;
12150class TestEventListenersAccessor;
12151class TestEventRepeater;
12152class UnitTestRecordPropertyTestHelper;
12153class WindowsDeathTest;
12154class FuchsiaDeathTest;
12155class UnitTestImpl* GetUnitTestImpl();
12156void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
12157 const std::string& message);
12158
12159} // namespace internal
12160
12161// The friend relationship of some of these classes is cyclic.
12162// If we don't forward declare them the compiler might confuse the classes
12163// in friendship clauses with same named classes on the scope.
12164class Test;
12165class TestSuite;
12166
12167// Old API is still available but deprecated
12168#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
12169using TestCase = TestSuite;
12170#endif
12171class TestInfo;
12172class UnitTest;
12173
12174// A class for indicating whether an assertion was successful. When
12175// the assertion wasn't successful, the AssertionResult object
12176// remembers a non-empty message that describes how it failed.
12177//
12178// To create an instance of this class, use one of the factory functions
12179// (AssertionSuccess() and AssertionFailure()).
12180//
12181// This class is useful for two purposes:
12182// 1. Defining predicate functions to be used with Boolean test assertions
12183// EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
12184// 2. Defining predicate-format functions to be
12185// used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
12186//
12187// For example, if you define IsEven predicate:
12188//
12189// testing::AssertionResult IsEven(int n) {
12190// if ((n % 2) == 0)
12191// return testing::AssertionSuccess();
12192// else
12193// return testing::AssertionFailure() << n << " is odd";
12194// }
12195//
12196// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
12197// will print the message
12198//
12199// Value of: IsEven(Fib(5))
12200// Actual: false (5 is odd)
12201// Expected: true
12202//
12203// instead of a more opaque
12204//
12205// Value of: IsEven(Fib(5))
12206// Actual: false
12207// Expected: true
12208//
12209// in case IsEven is a simple Boolean predicate.
12210//
12211// If you expect your predicate to be reused and want to support informative
12212// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
12213// about half as often as positive ones in our tests), supply messages for
12214// both success and failure cases:
12215//
12216// testing::AssertionResult IsEven(int n) {
12217// if ((n % 2) == 0)
12218// return testing::AssertionSuccess() << n << " is even";
12219// else
12220// return testing::AssertionFailure() << n << " is odd";
12221// }
12222//
12223// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
12224//
12225// Value of: IsEven(Fib(6))
12226// Actual: true (8 is even)
12227// Expected: false
12228//
12229// NB: Predicates that support negative Boolean assertions have reduced
12230// performance in positive ones so be careful not to use them in tests
12231// that have lots (tens of thousands) of positive Boolean assertions.
12232//
12233// To use this class with EXPECT_PRED_FORMAT assertions such as:
12234//
12235// // Verifies that Foo() returns an even number.
12236// EXPECT_PRED_FORMAT1(IsEven, Foo());
12237//
12238// you need to define:
12239//
12240// testing::AssertionResult IsEven(const char* expr, int n) {
12241// if ((n % 2) == 0)
12242// return testing::AssertionSuccess();
12243// else
12244// return testing::AssertionFailure()
12245// << "Expected: " << expr << " is even\n Actual: it's " << n;
12246// }
12247//
12248// If Foo() returns 5, you will see the following message:
12249//
12250// Expected: Foo() is even
12251// Actual: it's 5
12252//
12253class GTEST_API_ AssertionResult {
12254 public:
12255 // Copy constructor.
12256 // Used in EXPECT_TRUE/FALSE(assertion_result).
12257 AssertionResult(const AssertionResult& other);
12258
12259#if defined(_MSC_VER) && _MSC_VER < 1910
12260 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
12261#endif
12262
12263 // Used in the EXPECT_TRUE/FALSE(bool_expression).
12264 //
12265 // T must be contextually convertible to bool.
12266 //
12267 // The second parameter prevents this overload from being considered if
12268 // the argument is implicitly convertible to AssertionResult. In that case
12269 // we want AssertionResult's copy constructor to be used.
12270 template <typename T>
12271 explicit AssertionResult(
12272 const T& success,
12273 typename std::enable_if<
12275 /*enabler*/
12276 = nullptr)
12277 : success_(success) {}
12278
12279#if defined(_MSC_VER) && _MSC_VER < 1910
12281#endif
12282
12283 // Assignment operator.
12284 AssertionResult& operator=(AssertionResult other) {
12285 swap(other);
12286 return *this;
12287 }
12288
12289 // Returns true if and only if the assertion succeeded.
12290 operator bool() const { return success_; } // NOLINT
12291
12292 // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
12293 AssertionResult operator!() const;
12294
12295 // Returns the text streamed into this AssertionResult. Test assertions
12296 // use it when they fail (i.e., the predicate's outcome doesn't match the
12297 // assertion's expectation). When nothing has been streamed into the
12298 // object, returns an empty string.
12299 const char* message() const {
12300 return message_.get() != nullptr ? message_->c_str() : "";
12301 }
12302 // Deprecated; please use message() instead.
12303 const char* failure_message() const { return message(); }
12304
12305 // Streams a custom failure message into this object.
12306 template <typename T> AssertionResult& operator<<(const T& value) {
12307 AppendMessage(Message() << value);
12308 return *this;
12309 }
12310
12311 // Allows streaming basic output manipulators such as endl or flush into
12312 // this object.
12313 AssertionResult& operator<<(
12314 ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
12315 AppendMessage(Message() << basic_manipulator);
12316 return *this;
12317 }
12318
12319 private:
12320 // Appends the contents of message to message_.
12321 void AppendMessage(const Message& a_message) {
12322 if (message_.get() == nullptr) message_.reset(new ::std::string);
12323 message_->append(a_message.GetString().c_str());
12324 }
12325
12326 // Swap the contents of this AssertionResult with other.
12327 void swap(AssertionResult& other);
12328
12329 // Stores result of the assertion predicate.
12330 bool success_;
12331 // Stores the message describing the condition in case the expectation
12332 // construct is not satisfied with the predicate's outcome.
12333 // Referenced via a pointer to avoid taking too much stack frame space
12334 // with test assertions.
12335 std::unique_ptr< ::std::string> message_;
12336};
12337
12338// Makes a successful assertion result.
12339GTEST_API_ AssertionResult AssertionSuccess();
12340
12341// Makes a failed assertion result.
12342GTEST_API_ AssertionResult AssertionFailure();
12343
12344// Makes a failed assertion result with the given failure message.
12345// Deprecated; use AssertionFailure() << msg.
12346GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
12347
12348} // namespace testing
12349
12350// Includes the auto-generated header that implements a family of generic
12351// predicate assertion macros. This include comes late because it relies on
12352// APIs declared above.
12353// Copyright 2006, Google Inc.
12354// All rights reserved.
12355//
12356// Redistribution and use in source and binary forms, with or without
12357// modification, are permitted provided that the following conditions are
12358// met:
12359//
12360// * Redistributions of source code must retain the above copyright
12361// notice, this list of conditions and the following disclaimer.
12362// * Redistributions in binary form must reproduce the above
12363// copyright notice, this list of conditions and the following disclaimer
12364// in the documentation and/or other materials provided with the
12365// distribution.
12366// * Neither the name of Google Inc. nor the names of its
12367// contributors may be used to endorse or promote products derived from
12368// this software without specific prior written permission.
12369//
12370// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
12371// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
12372// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
12373// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
12374// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
12375// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
12376// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12377// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12378// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12379// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
12380// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12381
12382// This file is AUTOMATICALLY GENERATED on 01/02/2019 by command
12383// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
12384//
12385// Implements a family of generic predicate assertion macros.
12386// GOOGLETEST_CM0001 DO NOT DELETE
12387
12388#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
12389#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
12390
12391
12392namespace testing {
12393
12394// This header implements a family of generic predicate assertion
12395// macros:
12396//
12397// ASSERT_PRED_FORMAT1(pred_format, v1)
12398// ASSERT_PRED_FORMAT2(pred_format, v1, v2)
12399// ...
12400//
12401// where pred_format is a function or functor that takes n (in the
12402// case of ASSERT_PRED_FORMATn) values and their source expression
12403// text, and returns a testing::AssertionResult. See the definition
12404// of ASSERT_EQ in gtest.h for an example.
12405//
12406// If you don't care about formatting, you can use the more
12407// restrictive version:
12408//
12409// ASSERT_PRED1(pred, v1)
12410// ASSERT_PRED2(pred, v1, v2)
12411// ...
12412//
12413// where pred is an n-ary function or functor that returns bool,
12414// and the values v1, v2, ..., must support the << operator for
12415// streaming to std::ostream.
12416//
12417// We also define the EXPECT_* variations.
12418//
12419// For now we only support predicates whose arity is at most 5.
12420// Please email googletestframework@googlegroups.com if you need
12421// support for higher arities.
12422
12423// GTEST_ASSERT_ is the basic statement to which all of the assertions
12424// in this file reduce. Don't use this in your code.
12425
12426#define GTEST_ASSERT_(expression, on_failure) \
12427 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
12428 if (const ::testing::AssertionResult gtest_ar = (expression)) \
12429 ; \
12430 else \
12431 on_failure(gtest_ar.failure_message())
12432
12433
12434// Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use
12435// this in your code.
12436template <typename Pred,
12437 typename T1>
12438AssertionResult AssertPred1Helper(const char* pred_text,
12439 const char* e1,
12440 Pred pred,
12441 const T1& v1) {
12442 if (pred(v1)) return AssertionSuccess();
12443
12444 return AssertionFailure()
12445 << pred_text << "(" << e1 << ") evaluates to false, where"
12446 << "\n"
12447 << e1 << " evaluates to " << ::testing::PrintToString(v1);
12448}
12449
12450// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
12451// Don't use this in your code.
12452#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
12453 GTEST_ASSERT_(pred_format(#v1, v1), \
12454 on_failure)
12455
12456// Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use
12457// this in your code.
12458#define GTEST_PRED1_(pred, v1, on_failure)\
12459 GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
12460 #v1, \
12461 pred, \
12462 v1), on_failure)
12463
12464// Unary predicate assertion macros.
12465#define EXPECT_PRED_FORMAT1(pred_format, v1) \
12466 GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
12467#define EXPECT_PRED1(pred, v1) \
12468 GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
12469#define ASSERT_PRED_FORMAT1(pred_format, v1) \
12470 GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
12471#define ASSERT_PRED1(pred, v1) \
12472 GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
12473
12474
12475
12476// Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use
12477// this in your code.
12478template <typename Pred,
12479 typename T1,
12480 typename T2>
12481AssertionResult AssertPred2Helper(const char* pred_text,
12482 const char* e1,
12483 const char* e2,
12484 Pred pred,
12485 const T1& v1,
12486 const T2& v2) {
12487 if (pred(v1, v2)) return AssertionSuccess();
12488
12489 return AssertionFailure()
12490 << pred_text << "(" << e1 << ", " << e2
12491 << ") evaluates to false, where"
12492 << "\n"
12493 << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
12494 << e2 << " evaluates to " << ::testing::PrintToString(v2);
12495}
12496
12497// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
12498// Don't use this in your code.
12499#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
12500 GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
12501 on_failure)
12502
12503// Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use
12504// this in your code.
12505#define GTEST_PRED2_(pred, v1, v2, on_failure)\
12506 GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
12507 #v1, \
12508 #v2, \
12509 pred, \
12510 v1, \
12511 v2), on_failure)
12512
12513// Binary predicate assertion macros.
12514#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
12515 GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
12516#define EXPECT_PRED2(pred, v1, v2) \
12517 GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
12518#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
12519 GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
12520#define ASSERT_PRED2(pred, v1, v2) \
12521 GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
12522
12523
12524
12525// Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use
12526// this in your code.
12527template <typename Pred,
12528 typename T1,
12529 typename T2,
12530 typename T3>
12531AssertionResult AssertPred3Helper(const char* pred_text,
12532 const char* e1,
12533 const char* e2,
12534 const char* e3,
12535 Pred pred,
12536 const T1& v1,
12537 const T2& v2,
12538 const T3& v3) {
12539 if (pred(v1, v2, v3)) return AssertionSuccess();
12540
12541 return AssertionFailure()
12542 << pred_text << "(" << e1 << ", " << e2 << ", " << e3
12543 << ") evaluates to false, where"
12544 << "\n"
12545 << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
12546 << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
12547 << e3 << " evaluates to " << ::testing::PrintToString(v3);
12548}
12549
12550// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
12551// Don't use this in your code.
12552#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
12553 GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
12554 on_failure)
12555
12556// Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use
12557// this in your code.
12558#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
12559 GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
12560 #v1, \
12561 #v2, \
12562 #v3, \
12563 pred, \
12564 v1, \
12565 v2, \
12566 v3), on_failure)
12567
12568// Ternary predicate assertion macros.
12569#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
12570 GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
12571#define EXPECT_PRED3(pred, v1, v2, v3) \
12572 GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
12573#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
12574 GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
12575#define ASSERT_PRED3(pred, v1, v2, v3) \
12576 GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
12577
12578
12579
12580// Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use
12581// this in your code.
12582template <typename Pred,
12583 typename T1,
12584 typename T2,
12585 typename T3,
12586 typename T4>
12587AssertionResult AssertPred4Helper(const char* pred_text,
12588 const char* e1,
12589 const char* e2,
12590 const char* e3,
12591 const char* e4,
12592 Pred pred,
12593 const T1& v1,
12594 const T2& v2,
12595 const T3& v3,
12596 const T4& v4) {
12597 if (pred(v1, v2, v3, v4)) return AssertionSuccess();
12598
12599 return AssertionFailure()
12600 << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4
12601 << ") evaluates to false, where"
12602 << "\n"
12603 << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
12604 << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
12605 << e3 << " evaluates to " << ::testing::PrintToString(v3) << "\n"
12606 << e4 << " evaluates to " << ::testing::PrintToString(v4);
12607}
12608
12609// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
12610// Don't use this in your code.
12611#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
12612 GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
12613 on_failure)
12614
12615// Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use
12616// this in your code.
12617#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
12618 GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
12619 #v1, \
12620 #v2, \
12621 #v3, \
12622 #v4, \
12623 pred, \
12624 v1, \
12625 v2, \
12626 v3, \
12627 v4), on_failure)
12628
12629// 4-ary predicate assertion macros.
12630#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
12631 GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
12632#define EXPECT_PRED4(pred, v1, v2, v3, v4) \
12633 GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
12634#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
12635 GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
12636#define ASSERT_PRED4(pred, v1, v2, v3, v4) \
12637 GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
12638
12639
12640
12641// Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use
12642// this in your code.
12643template <typename Pred,
12644 typename T1,
12645 typename T2,
12646 typename T3,
12647 typename T4,
12648 typename T5>
12649AssertionResult AssertPred5Helper(const char* pred_text,
12650 const char* e1,
12651 const char* e2,
12652 const char* e3,
12653 const char* e4,
12654 const char* e5,
12655 Pred pred,
12656 const T1& v1,
12657 const T2& v2,
12658 const T3& v3,
12659 const T4& v4,
12660 const T5& v5) {
12661 if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
12662
12663 return AssertionFailure()
12664 << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4
12665 << ", " << e5 << ") evaluates to false, where"
12666 << "\n"
12667 << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
12668 << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
12669 << e3 << " evaluates to " << ::testing::PrintToString(v3) << "\n"
12670 << e4 << " evaluates to " << ::testing::PrintToString(v4) << "\n"
12671 << e5 << " evaluates to " << ::testing::PrintToString(v5);
12672}
12673
12674// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
12675// Don't use this in your code.
12676#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
12677 GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
12678 on_failure)
12679
12680// Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use
12681// this in your code.
12682#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
12683 GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
12684 #v1, \
12685 #v2, \
12686 #v3, \
12687 #v4, \
12688 #v5, \
12689 pred, \
12690 v1, \
12691 v2, \
12692 v3, \
12693 v4, \
12694 v5), on_failure)
12695
12696// 5-ary predicate assertion macros.
12697#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
12698 GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
12699#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
12700 GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
12701#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
12702 GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
12703#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
12704 GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
12705
12706
12707
12708} // namespace testing
12709
12710#endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
12711
12712namespace testing {
12713
12714// The abstract class that all tests inherit from.
12715//
12716// In Google Test, a unit test program contains one or many TestSuites, and
12717// each TestSuite contains one or many Tests.
12718//
12719// When you define a test using the TEST macro, you don't need to
12720// explicitly derive from Test - the TEST macro automatically does
12721// this for you.
12722//
12723// The only time you derive from Test is when defining a test fixture
12724// to be used in a TEST_F. For example:
12725//
12726// class FooTest : public testing::Test {
12727// protected:
12728// void SetUp() override { ... }
12729// void TearDown() override { ... }
12730// ...
12731// };
12732//
12733// TEST_F(FooTest, Bar) { ... }
12734// TEST_F(FooTest, Baz) { ... }
12735//
12736// Test is not copyable.
12738 public:
12739 friend class TestInfo;
12740
12741 // The d'tor is virtual as we intend to inherit from Test.
12742 virtual ~Test();
12743
12744 // Sets up the stuff shared by all tests in this test case.
12745 //
12746 // Google Test will call Foo::SetUpTestSuite() before running the first
12747 // test in test case Foo. Hence a sub-class can define its own
12748 // SetUpTestSuite() method to shadow the one defined in the super
12749 // class.
12750 // Failures that happen during SetUpTestSuite are logged but otherwise
12751 // ignored.
12752 static void SetUpTestSuite() {}
12753
12754 // Tears down the stuff shared by all tests in this test suite.
12755 //
12756 // Google Test will call Foo::TearDownTestSuite() after running the last
12757 // test in test case Foo. Hence a sub-class can define its own
12758 // TearDownTestSuite() method to shadow the one defined in the super
12759 // class.
12760 // Failures that happen during TearDownTestSuite are logged but otherwise
12761 // ignored.
12762 static void TearDownTestSuite() {}
12763
12764 // Legacy API is deprecated but still available
12765#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
12766 static void TearDownTestCase() {}
12767 static void SetUpTestCase() {}
12768#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
12769
12770 // Returns true if and only if the current test has a fatal failure.
12771 static bool HasFatalFailure();
12772
12773 // Returns true if and only if the current test has a non-fatal failure.
12774 static bool HasNonfatalFailure();
12775
12776 // Returns true if and only if the current test was skipped.
12777 static bool IsSkipped();
12778
12779 // Returns true if and only if the current test has a (either fatal or
12780 // non-fatal) failure.
12781 static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
12782
12783 // Logs a property for the current test, test suite, or for the entire
12784 // invocation of the test program when used outside of the context of a
12785 // test suite. Only the last value for a given key is remembered. These
12786 // are public static so they can be called from utility functions that are
12787 // not members of the test fixture. Calls to RecordProperty made during
12788 // lifespan of the test (from the moment its constructor starts to the
12789 // moment its destructor finishes) will be output in XML as attributes of
12790 // the <testcase> element. Properties recorded from fixture's
12791 // SetUpTestSuite or TearDownTestSuite are logged as attributes of the
12792 // corresponding <testsuite> element. Calls to RecordProperty made in the
12793 // global context (before or after invocation of RUN_ALL_TESTS and from
12794 // SetUp/TearDown method of Environment objects registered with Google
12795 // Test) will be output as attributes of the <testsuites> element.
12796 static void RecordProperty(const std::string& key, const std::string& value);
12797 static void RecordProperty(const std::string& key, int value);
12798
12799 protected:
12800 // Creates a Test object.
12802
12803 // Sets up the test fixture.
12804 virtual void SetUp();
12805
12806 // Tears down the test fixture.
12807 virtual void TearDown();
12808
12809 private:
12810 // Returns true if and only if the current test has the same fixture class
12811 // as the first test in the current test suite.
12812 static bool HasSameFixtureClass();
12813
12814 // Runs the test after the test fixture has been set up.
12815 //
12816 // A sub-class must implement this to define the test logic.
12817 //
12818 // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
12819 // Instead, use the TEST or TEST_F macro.
12820 virtual void TestBody() = 0;
12821
12822 // Sets up, executes, and tears down the test.
12823 void Run();
12824
12825 // Deletes self. We deliberately pick an unusual name for this
12826 // internal method to avoid clashing with names used in user TESTs.
12827 void DeleteSelf_() { delete this; }
12828
12829 const std::unique_ptr<GTEST_FLAG_SAVER_> gtest_flag_saver_;
12830
12831 // Often a user misspells SetUp() as Setup() and spends a long time
12832 // wondering why it is never called by Google Test. The declaration of
12833 // the following method is solely for catching such an error at
12834 // compile time:
12835 //
12836 // - The return type is deliberately chosen to be not void, so it
12837 // will be a conflict if void Setup() is declared in the user's
12838 // test fixture.
12839 //
12840 // - This method is private, so it will be another compiler error
12841 // if the method is called from the user's test fixture.
12842 //
12843 // DO NOT OVERRIDE THIS FUNCTION.
12844 //
12845 // If you see an error about overriding the following function or
12846 // about it being private, you have mis-spelled SetUp() as Setup().
12847 struct Setup_should_be_spelled_SetUp {};
12848 virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; }
12849
12850 // We disallow copying Tests.
12852};
12853
12855
12856// A copyable object representing a user specified test property which can be
12857// output as a key/value string pair.
12858//
12859// Don't inherit from TestProperty as its destructor is not virtual.
12861 public:
12862 // C'tor. TestProperty does NOT have a default constructor.
12863 // Always use this constructor (with parameters) to create a
12864 // TestProperty object.
12865 TestProperty(const std::string& a_key, const std::string& a_value) :
12866 key_(a_key), value_(a_value) {
12867 }
12868
12869 // Gets the user supplied key.
12870 const char* key() const {
12871 return key_.c_str();
12872 }
12873
12874 // Gets the user supplied value.
12875 const char* value() const {
12876 return value_.c_str();
12877 }
12878
12879 // Sets a new value, overriding the one supplied in the constructor.
12880 void SetValue(const std::string& new_value) {
12881 value_ = new_value;
12882 }
12883
12884 private:
12885 // The key supplied by the user.
12886 std::string key_;
12887 // The value supplied by the user.
12888 std::string value_;
12889};
12890
12891// The result of a single Test. This includes a list of
12892// TestPartResults, a list of TestProperties, a count of how many
12893// death tests there are in the Test, and how much time it took to run
12894// the Test.
12895//
12896// TestResult is not copyable.
12898 public:
12899 // Creates an empty TestResult.
12901
12902 // D'tor. Do not inherit from TestResult.
12904
12905 // Gets the number of all test parts. This is the sum of the number
12906 // of successful test parts and the number of failed test parts.
12907 int total_part_count() const;
12908
12909 // Returns the number of the test properties.
12911
12912 // Returns true if and only if the test passed (i.e. no test part failed).
12913 bool Passed() const { return !Skipped() && !Failed(); }
12914
12915 // Returns true if and only if the test was skipped.
12916 bool Skipped() const;
12917
12918 // Returns true if and only if the test failed.
12919 bool Failed() const;
12920
12921 // Returns true if and only if the test fatally failed.
12922 bool HasFatalFailure() const;
12923
12924 // Returns true if and only if the test has a non-fatal failure.
12926
12927 // Returns the elapsed time, in milliseconds.
12928 TimeInMillis elapsed_time() const { return elapsed_time_; }
12929
12930 // Gets the time of the test case start, in ms from the start of the
12931 // UNIX epoch.
12932 TimeInMillis start_timestamp() const { return start_timestamp_; }
12933
12934 // Returns the i-th test part result among all the results. i can range from 0
12935 // to total_part_count() - 1. If i is not in that range, aborts the program.
12936 const TestPartResult& GetTestPartResult(int i) const;
12937
12938 // Returns the i-th test property. i can range from 0 to
12939 // test_property_count() - 1. If i is not in that range, aborts the
12940 // program.
12941 const TestProperty& GetTestProperty(int i) const;
12942
12943 private:
12944 friend class TestInfo;
12945 friend class TestSuite;
12946 friend class UnitTest;
12947 friend class internal::DefaultGlobalTestPartResultReporter;
12948 friend class internal::ExecDeathTest;
12949 friend class internal::TestResultAccessor;
12950 friend class internal::UnitTestImpl;
12951 friend class internal::WindowsDeathTest;
12952 friend class internal::FuchsiaDeathTest;
12953
12954 // Gets the vector of TestPartResults.
12955 const std::vector<TestPartResult>& test_part_results() const {
12956 return test_part_results_;
12957 }
12958
12959 // Gets the vector of TestProperties.
12960 const std::vector<TestProperty>& test_properties() const {
12961 return test_properties_;
12962 }
12963
12964 // Sets the start time.
12965 void set_start_timestamp(TimeInMillis start) { start_timestamp_ = start; }
12966
12967 // Sets the elapsed time.
12968 void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
12969
12970 // Adds a test property to the list. The property is validated and may add
12971 // a non-fatal failure if invalid (e.g., if it conflicts with reserved
12972 // key names). If a property is already recorded for the same key, the
12973 // value will be updated, rather than storing multiple values for the same
12974 // key. xml_element specifies the element for which the property is being
12975 // recorded and is used for validation.
12976 void RecordProperty(const std::string& xml_element,
12977 const TestProperty& test_property);
12978
12979 // Adds a failure if the key is a reserved attribute of Google Test
12980 // testsuite tags. Returns true if the property is valid.
12981 // FIXME: Validate attribute names are legal and human readable.
12982 static bool ValidateTestProperty(const std::string& xml_element,
12983 const TestProperty& test_property);
12984
12985 // Adds a test part result to the list.
12986 void AddTestPartResult(const TestPartResult& test_part_result);
12987
12988 // Returns the death test count.
12989 int death_test_count() const { return death_test_count_; }
12990
12991 // Increments the death test count, returning the new count.
12992 int increment_death_test_count() { return ++death_test_count_; }
12993
12994 // Clears the test part results.
12995 void ClearTestPartResults();
12996
12997 // Clears the object.
12998 void Clear();
12999
13000 // Protects mutable state of the property vector and of owned
13001 // properties, whose values may be updated.
13002 internal::Mutex test_properites_mutex_;
13003
13004 // The vector of TestPartResults
13005 std::vector<TestPartResult> test_part_results_;
13006 // The vector of TestProperties
13007 std::vector<TestProperty> test_properties_;
13008 // Running count of death tests.
13009 int death_test_count_;
13010 // The start time, in milliseconds since UNIX Epoch.
13011 TimeInMillis start_timestamp_;
13012 // The elapsed time, in milliseconds.
13013 TimeInMillis elapsed_time_;
13014
13015 // We disallow copying TestResult.
13017}; // class TestResult
13018
13019// A TestInfo object stores the following information about a test:
13020//
13021// Test suite name
13022// Test name
13023// Whether the test should be run
13024// A function pointer that creates the test object when invoked
13025// Test result
13026//
13027// The constructor of TestInfo registers itself with the UnitTest
13028// singleton such that the RUN_ALL_TESTS() macro knows which tests to
13029// run.
13031 public:
13032 // Destructs a TestInfo object. This function is not virtual, so
13033 // don't inherit from TestInfo.
13035
13036 // Returns the test suite name.
13037 const char* test_suite_name() const { return test_suite_name_.c_str(); }
13038
13039// Legacy API is deprecated but still available
13040#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13041 const char* test_case_name() const { return test_suite_name(); }
13042#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13043
13044 // Returns the test name.
13045 const char* name() const { return name_.c_str(); }
13046
13047 // Returns the name of the parameter type, or NULL if this is not a typed
13048 // or a type-parameterized test.
13049 const char* type_param() const {
13050 if (type_param_.get() != nullptr) return type_param_->c_str();
13051 return nullptr;
13052 }
13053
13054 // Returns the text representation of the value parameter, or NULL if this
13055 // is not a value-parameterized test.
13056 const char* value_param() const {
13057 if (value_param_.get() != nullptr) return value_param_->c_str();
13058 return nullptr;
13059 }
13060
13061 // Returns the file name where this test is defined.
13062 const char* file() const { return location_.file.c_str(); }
13063
13064 // Returns the line where this test is defined.
13065 int line() const { return location_.line; }
13066
13067 // Return true if this test should not be run because it's in another shard.
13068 bool is_in_another_shard() const { return is_in_another_shard_; }
13069
13070 // Returns true if this test should run, that is if the test is not
13071 // disabled (or it is disabled but the also_run_disabled_tests flag has
13072 // been specified) and its full name matches the user-specified filter.
13073 //
13074 // Google Test allows the user to filter the tests by their full names.
13075 // The full name of a test Bar in test suite Foo is defined as
13076 // "Foo.Bar". Only the tests that match the filter will run.
13077 //
13078 // A filter is a colon-separated list of glob (not regex) patterns,
13079 // optionally followed by a '-' and a colon-separated list of
13080 // negative patterns (tests to exclude). A test is run if it
13081 // matches one of the positive patterns and does not match any of
13082 // the negative patterns.
13083 //
13084 // For example, *A*:Foo.* is a filter that matches any string that
13085 // contains the character 'A' or starts with "Foo.".
13086 bool should_run() const { return should_run_; }
13087
13088 // Returns true if and only if this test will appear in the XML report.
13089 bool is_reportable() const {
13090 // The XML report includes tests matching the filter, excluding those
13091 // run in other shards.
13092 return matches_filter_ && !is_in_another_shard_;
13093 }
13094
13095 // Returns the result of the test.
13096 const TestResult* result() const { return &result_; }
13097
13098 private:
13099#if GTEST_HAS_DEATH_TEST
13100 friend class internal::DefaultDeathTestFactory;
13101#endif // GTEST_HAS_DEATH_TEST
13102 friend class Test;
13103 friend class TestSuite;
13104 friend class internal::UnitTestImpl;
13105 friend class internal::StreamingListenerTest;
13107 const char* test_suite_name, const char* name, const char* type_param,
13108 const char* value_param, internal::CodeLocation code_location,
13109 internal::TypeId fixture_class_id, internal::SetUpTestSuiteFunc set_up_tc,
13111 internal::TestFactoryBase* factory);
13112
13113 // Constructs a TestInfo object. The newly constructed instance assumes
13114 // ownership of the factory object.
13115 TestInfo(const std::string& test_suite_name, const std::string& name,
13116 const char* a_type_param, // NULL if not a type-parameterized test
13117 const char* a_value_param, // NULL if not a value-parameterized test
13118 internal::CodeLocation a_code_location,
13119 internal::TypeId fixture_class_id,
13120 internal::TestFactoryBase* factory);
13121
13122 // Increments the number of death tests encountered in this test so
13123 // far.
13124 int increment_death_test_count() {
13125 return result_.increment_death_test_count();
13126 }
13127
13128 // Creates the test object, runs it, records its result, and then
13129 // deletes it.
13130 void Run();
13131
13132 static void ClearTestResult(TestInfo* test_info) {
13133 test_info->result_.Clear();
13134 }
13135
13136 // These fields are immutable properties of the test.
13137 const std::string test_suite_name_; // test suite name
13138 const std::string name_; // Test name
13139 // Name of the parameter type, or NULL if this is not a typed or a
13140 // type-parameterized test.
13141 const std::unique_ptr<const ::std::string> type_param_;
13142 // Text representation of the value parameter, or NULL if this is not a
13143 // value-parameterized test.
13144 const std::unique_ptr<const ::std::string> value_param_;
13145 internal::CodeLocation location_;
13146 const internal::TypeId fixture_class_id_; // ID of the test fixture class
13147 bool should_run_; // True if and only if this test should run
13148 bool is_disabled_; // True if and only if this test is disabled
13149 bool matches_filter_; // True if this test matches the
13150 // user-specified filter.
13151 bool is_in_another_shard_; // Will be run in another shard.
13152 internal::TestFactoryBase* const factory_; // The factory that creates
13153 // the test object
13154
13155 // This field is mutable and needs to be reset before running the
13156 // test for the second time.
13157 TestResult result_;
13158
13160};
13161
13162// A test suite, which consists of a vector of TestInfos.
13163//
13164// TestSuite is not copyable.
13166 public:
13167 // Creates a TestSuite with the given name.
13168 //
13169 // TestSuite does NOT have a default constructor. Always use this
13170 // constructor to create a TestSuite object.
13171 //
13172 // Arguments:
13173 //
13174 // name: name of the test suite
13175 // a_type_param: the name of the test's type parameter, or NULL if
13176 // this is not a type-parameterized test.
13177 // set_up_tc: pointer to the function that sets up the test suite
13178 // tear_down_tc: pointer to the function that tears down the test suite
13179 TestSuite(const char* name, const char* a_type_param,
13181 internal::TearDownTestSuiteFunc tear_down_tc);
13182
13183 // Destructor of TestSuite.
13184 virtual ~TestSuite();
13185
13186 // Gets the name of the TestSuite.
13187 const char* name() const { return name_.c_str(); }
13188
13189 // Returns the name of the parameter type, or NULL if this is not a
13190 // type-parameterized test suite.
13191 const char* type_param() const {
13192 if (type_param_.get() != nullptr) return type_param_->c_str();
13193 return nullptr;
13194 }
13195
13196 // Returns true if any test in this test suite should run.
13197 bool should_run() const { return should_run_; }
13198
13199 // Gets the number of successful tests in this test suite.
13201
13202 // Gets the number of skipped tests in this test suite.
13204
13205 // Gets the number of failed tests in this test suite.
13207
13208 // Gets the number of disabled tests that will be reported in the XML report.
13210
13211 // Gets the number of disabled tests in this test suite.
13213
13214 // Gets the number of tests to be printed in the XML report.
13216
13217 // Get the number of tests in this test suite that should run.
13219
13220 // Gets the number of all tests in this test suite.
13221 int total_test_count() const;
13222
13223 // Returns true if and only if the test suite passed.
13224 bool Passed() const { return !Failed(); }
13225
13226 // Returns true if and only if the test suite failed.
13227 bool Failed() const { return failed_test_count() > 0; }
13228
13229 // Returns the elapsed time, in milliseconds.
13230 TimeInMillis elapsed_time() const { return elapsed_time_; }
13231
13232 // Gets the time of the test suite start, in ms from the start of the
13233 // UNIX epoch.
13234 TimeInMillis start_timestamp() const { return start_timestamp_; }
13235
13236 // Returns the i-th test among all the tests. i can range from 0 to
13237 // total_test_count() - 1. If i is not in that range, returns NULL.
13238 const TestInfo* GetTestInfo(int i) const;
13239
13240 // Returns the TestResult that holds test properties recorded during
13241 // execution of SetUpTestSuite and TearDownTestSuite.
13242 const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }
13243
13244 private:
13245 friend class Test;
13246 friend class internal::UnitTestImpl;
13247
13248 // Gets the (mutable) vector of TestInfos in this TestSuite.
13249 std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
13250
13251 // Gets the (immutable) vector of TestInfos in this TestSuite.
13252 const std::vector<TestInfo*>& test_info_list() const {
13253 return test_info_list_;
13254 }
13255
13256 // Returns the i-th test among all the tests. i can range from 0 to
13257 // total_test_count() - 1. If i is not in that range, returns NULL.
13258 TestInfo* GetMutableTestInfo(int i);
13259
13260 // Sets the should_run member.
13261 void set_should_run(bool should) { should_run_ = should; }
13262
13263 // Adds a TestInfo to this test suite. Will delete the TestInfo upon
13264 // destruction of the TestSuite object.
13265 void AddTestInfo(TestInfo * test_info);
13266
13267 // Clears the results of all tests in this test suite.
13268 void ClearResult();
13269
13270 // Clears the results of all tests in the given test suite.
13271 static void ClearTestSuiteResult(TestSuite* test_suite) {
13272 test_suite->ClearResult();
13273 }
13274
13275 // Runs every test in this TestSuite.
13276 void Run();
13277
13278 // Runs SetUpTestSuite() for this TestSuite. This wrapper is needed
13279 // for catching exceptions thrown from SetUpTestSuite().
13280 void RunSetUpTestSuite() {
13281 if (set_up_tc_ != nullptr) {
13282 (*set_up_tc_)();
13283 }
13284 }
13285
13286 // Runs TearDownTestSuite() for this TestSuite. This wrapper is
13287 // needed for catching exceptions thrown from TearDownTestSuite().
13288 void RunTearDownTestSuite() {
13289 if (tear_down_tc_ != nullptr) {
13290 (*tear_down_tc_)();
13291 }
13292 }
13293
13294 // Returns true if and only if test passed.
13295 static bool TestPassed(const TestInfo* test_info) {
13296 return test_info->should_run() && test_info->result()->Passed();
13297 }
13298
13299 // Returns true if and only if test skipped.
13300 static bool TestSkipped(const TestInfo* test_info) {
13301 return test_info->should_run() && test_info->result()->Skipped();
13302 }
13303
13304 // Returns true if and only if test failed.
13305 static bool TestFailed(const TestInfo* test_info) {
13306 return test_info->should_run() && test_info->result()->Failed();
13307 }
13308
13309 // Returns true if and only if the test is disabled and will be reported in
13310 // the XML report.
13311 static bool TestReportableDisabled(const TestInfo* test_info) {
13312 return test_info->is_reportable() && test_info->is_disabled_;
13313 }
13314
13315 // Returns true if and only if test is disabled.
13316 static bool TestDisabled(const TestInfo* test_info) {
13317 return test_info->is_disabled_;
13318 }
13319
13320 // Returns true if and only if this test will appear in the XML report.
13321 static bool TestReportable(const TestInfo* test_info) {
13322 return test_info->is_reportable();
13323 }
13324
13325 // Returns true if the given test should run.
13326 static bool ShouldRunTest(const TestInfo* test_info) {
13327 return test_info->should_run();
13328 }
13329
13330 // Shuffles the tests in this test suite.
13331 void ShuffleTests(internal::Random* random);
13332
13333 // Restores the test order to before the first shuffle.
13334 void UnshuffleTests();
13335
13336 // Name of the test suite.
13337 std::string name_;
13338 // Name of the parameter type, or NULL if this is not a typed or a
13339 // type-parameterized test.
13340 const std::unique_ptr<const ::std::string> type_param_;
13341 // The vector of TestInfos in their original order. It owns the
13342 // elements in the vector.
13343 std::vector<TestInfo*> test_info_list_;
13344 // Provides a level of indirection for the test list to allow easy
13345 // shuffling and restoring the test order. The i-th element in this
13346 // vector is the index of the i-th test in the shuffled test list.
13347 std::vector<int> test_indices_;
13348 // Pointer to the function that sets up the test suite.
13350 // Pointer to the function that tears down the test suite.
13351 internal::TearDownTestSuiteFunc tear_down_tc_;
13352 // True if and only if any test in this test suite should run.
13353 bool should_run_;
13354 // The start time, in milliseconds since UNIX Epoch.
13355 TimeInMillis start_timestamp_;
13356 // Elapsed time, in milliseconds.
13357 TimeInMillis elapsed_time_;
13358 // Holds test properties recorded during execution of SetUpTestSuite and
13359 // TearDownTestSuite.
13360 TestResult ad_hoc_test_result_;
13361
13362 // We disallow copying TestSuites.
13364};
13365
13366// An Environment object is capable of setting up and tearing down an
13367// environment. You should subclass this to define your own
13368// environment(s).
13369//
13370// An Environment object does the set-up and tear-down in virtual
13371// methods SetUp() and TearDown() instead of the constructor and the
13372// destructor, as:
13373//
13374// 1. You cannot safely throw from a destructor. This is a problem
13375// as in some cases Google Test is used where exceptions are enabled, and
13376// we may want to implement ASSERT_* using exceptions where they are
13377// available.
13378// 2. You cannot use ASSERT_* directly in a constructor or
13379// destructor.
13381 public:
13382 // The d'tor is virtual as we need to subclass Environment.
13383 virtual ~Environment() {}
13384
13385 // Override this to define how to set up the environment.
13386 virtual void SetUp() {}
13387
13388 // Override this to define how to tear down the environment.
13389 virtual void TearDown() {}
13390 private:
13391 // If you see an error about overriding the following function or
13392 // about it being private, you have mis-spelled SetUp() as Setup().
13393 struct Setup_should_be_spelled_SetUp {};
13394 virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; }
13395};
13396
13397#if GTEST_HAS_EXCEPTIONS
13398
13399// Exception which can be thrown from TestEventListener::OnTestPartResult.
13400class GTEST_API_ AssertionException
13401 : public internal::GoogleTestFailureException {
13402 public:
13403 explicit AssertionException(const TestPartResult& result)
13404 : GoogleTestFailureException(result) {}
13405};
13406
13407#endif // GTEST_HAS_EXCEPTIONS
13408
13409// The interface for tracing execution of tests. The methods are organized in
13410// the order the corresponding events are fired.
13412 public:
13414
13415 // Fired before any test activity starts.
13416 virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
13417
13418 // Fired before each iteration of tests starts. There may be more than
13419 // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
13420 // index, starting from 0.
13421 virtual void OnTestIterationStart(const UnitTest& unit_test,
13422 int iteration) = 0;
13423
13424 // Fired before environment set-up for each iteration of tests starts.
13425 virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
13426
13427 // Fired after environment set-up for each iteration of tests ends.
13428 virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
13429
13430 // Fired before the test suite starts.
13431 virtual void OnTestSuiteStart(const TestSuite& /*test_suite*/) {}
13432
13433 // Legacy API is deprecated but still available
13434#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13435 virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
13436#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13437
13438 // Fired before the test starts.
13439 virtual void OnTestStart(const TestInfo& test_info) = 0;
13440
13441 // Fired after a failed assertion or a SUCCEED() invocation.
13442 // If you want to throw an exception from this function to skip to the next
13443 // TEST, it must be AssertionException defined above, or inherited from it.
13444 virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
13445
13446 // Fired after the test ends.
13447 virtual void OnTestEnd(const TestInfo& test_info) = 0;
13448
13449 // Fired after the test suite ends.
13450 virtual void OnTestSuiteEnd(const TestSuite& /*test_suite*/) {}
13451
13452// Legacy API is deprecated but still available
13453#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13454 virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
13455#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13456
13457 // Fired before environment tear-down for each iteration of tests starts.
13458 virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
13459
13460 // Fired after environment tear-down for each iteration of tests ends.
13461 virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
13462
13463 // Fired after each iteration of tests finishes.
13464 virtual void OnTestIterationEnd(const UnitTest& unit_test,
13465 int iteration) = 0;
13466
13467 // Fired after all test activities have ended.
13468 virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
13469};
13470
13471// The convenience class for users who need to override just one or two
13472// methods and are not concerned that a possible change to a signature of
13473// the methods they override will not be caught during the build. For
13474// comments about each method please see the definition of TestEventListener
13475// above.
13477 public:
13478 void OnTestProgramStart(const UnitTest& /*unit_test*/) override {}
13479 void OnTestIterationStart(const UnitTest& /*unit_test*/,
13480 int /*iteration*/) override {}
13481 void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) override {}
13482 void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
13483 void OnTestSuiteStart(const TestSuite& /*test_suite*/) override {}
13484// Legacy API is deprecated but still available
13485#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13486 void OnTestCaseStart(const TestCase& /*test_case*/) override {}
13487#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13488
13489 void OnTestStart(const TestInfo& /*test_info*/) override {}
13490 void OnTestPartResult(const TestPartResult& /*test_part_result*/) override {}
13491 void OnTestEnd(const TestInfo& /*test_info*/) override {}
13492 void OnTestSuiteEnd(const TestSuite& /*test_suite*/) override {}
13493#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13494 void OnTestCaseEnd(const TestCase& /*test_case*/) override {}
13495#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13496
13497 void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) override {}
13498 void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) override {}
13499 void OnTestIterationEnd(const UnitTest& /*unit_test*/,
13500 int /*iteration*/) override {}
13501 void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {}
13502};
13503
13504// TestEventListeners lets users add listeners to track events in Google Test.
13506 public:
13509
13510 // Appends an event listener to the end of the list. Google Test assumes
13511 // the ownership of the listener (i.e. it will delete the listener when
13512 // the test program finishes).
13513 void Append(TestEventListener* listener);
13514
13515 // Removes the given event listener from the list and returns it. It then
13516 // becomes the caller's responsibility to delete the listener. Returns
13517 // NULL if the listener is not found in the list.
13519
13520 // Returns the standard listener responsible for the default console
13521 // output. Can be removed from the listeners list to shut down default
13522 // console output. Note that removing this object from the listener list
13523 // with Release transfers its ownership to the caller and makes this
13524 // function return NULL the next time.
13526 return default_result_printer_;
13527 }
13528
13529 // Returns the standard listener responsible for the default XML output
13530 // controlled by the --gtest_output=xml flag. Can be removed from the
13531 // listeners list by users who want to shut down the default XML output
13532 // controlled by this flag and substitute it with custom one. Note that
13533 // removing this object from the listener list with Release transfers its
13534 // ownership to the caller and makes this function return NULL the next
13535 // time.
13537 return default_xml_generator_;
13538 }
13539
13540 private:
13541 friend class TestSuite;
13542 friend class TestInfo;
13543 friend class internal::DefaultGlobalTestPartResultReporter;
13544 friend class internal::NoExecDeathTest;
13545 friend class internal::TestEventListenersAccessor;
13546 friend class internal::UnitTestImpl;
13547
13548 // Returns repeater that broadcasts the TestEventListener events to all
13549 // subscribers.
13550 TestEventListener* repeater();
13551
13552 // Sets the default_result_printer attribute to the provided listener.
13553 // The listener is also added to the listener list and previous
13554 // default_result_printer is removed from it and deleted. The listener can
13555 // also be NULL in which case it will not be added to the list. Does
13556 // nothing if the previous and the current listener objects are the same.
13557 void SetDefaultResultPrinter(TestEventListener* listener);
13558
13559 // Sets the default_xml_generator attribute to the provided listener. The
13560 // listener is also added to the listener list and previous
13561 // default_xml_generator is removed from it and deleted. The listener can
13562 // also be NULL in which case it will not be added to the list. Does
13563 // nothing if the previous and the current listener objects are the same.
13564 void SetDefaultXmlGenerator(TestEventListener* listener);
13565
13566 // Controls whether events will be forwarded by the repeater to the
13567 // listeners in the list.
13568 bool EventForwardingEnabled() const;
13569 void SuppressEventForwarding();
13570
13571 // The actual list of listeners.
13572 internal::TestEventRepeater* repeater_;
13573 // Listener responsible for the standard result output.
13574 TestEventListener* default_result_printer_;
13575 // Listener responsible for the creation of the XML output file.
13576 TestEventListener* default_xml_generator_;
13577
13578 // We disallow copying TestEventListeners.
13580};
13581
13582// A UnitTest consists of a vector of TestSuites.
13583//
13584// This is a singleton class. The only instance of UnitTest is
13585// created when UnitTest::GetInstance() is first called. This
13586// instance is never deleted.
13587//
13588// UnitTest is not copyable.
13589//
13590// This class is thread-safe as long as the methods are called
13591// according to their specification.
13593 public:
13594 // Gets the singleton UnitTest object. The first time this method
13595 // is called, a UnitTest object is constructed and returned.
13596 // Consecutive calls will return the same object.
13598
13599 // Runs all tests in this UnitTest object and prints the result.
13600 // Returns 0 if successful, or 1 otherwise.
13601 //
13602 // This method can only be called from the main thread.
13603 //
13604 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
13606
13607 // Returns the working directory when the first TEST() or TEST_F()
13608 // was executed. The UnitTest object owns the string.
13609 const char* original_working_dir() const;
13610
13611 // Returns the TestSuite object for the test that's currently running,
13612 // or NULL if no test is running.
13613 const TestSuite* current_test_suite() const GTEST_LOCK_EXCLUDED_(mutex_);
13614
13615// Legacy API is still available but deprecated
13616#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13617 const TestCase* current_test_case() const GTEST_LOCK_EXCLUDED_(mutex_);
13618#endif
13619
13620 // Returns the TestInfo object for the test that's currently running,
13621 // or NULL if no test is running.
13623 GTEST_LOCK_EXCLUDED_(mutex_);
13624
13625 // Returns the random seed used at the start of the current test run.
13626 int random_seed() const;
13627
13628 // Returns the ParameterizedTestSuiteRegistry object used to keep track of
13629 // value-parameterized tests and instantiate and register them.
13630 //
13631 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
13632 internal::ParameterizedTestSuiteRegistry& parameterized_test_registry()
13633 GTEST_LOCK_EXCLUDED_(mutex_);
13634
13635 // Gets the number of successful test suites.
13636 int successful_test_suite_count() const;
13637
13638 // Gets the number of failed test suites.
13639 int failed_test_suite_count() const;
13640
13641 // Gets the number of all test suites.
13642 int total_test_suite_count() const;
13643
13644 // Gets the number of all test suites that contain at least one test
13645 // that should run.
13646 int test_suite_to_run_count() const;
13647
13648 // Legacy API is deprecated but still available
13649#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13654#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13655
13656 // Gets the number of successful tests.
13658
13659 // Gets the number of skipped tests.
13661
13662 // Gets the number of failed tests.
13664
13665 // Gets the number of disabled tests that will be reported in the XML report.
13667
13668 // Gets the number of disabled tests.
13670
13671 // Gets the number of tests to be printed in the XML report.
13673
13674 // Gets the number of all tests.
13675 int total_test_count() const;
13676
13677 // Gets the number of tests that should run.
13679
13680 // Gets the time of the test program start, in ms from the start of the
13681 // UNIX epoch.
13683
13684 // Gets the elapsed time, in milliseconds.
13686
13687 // Returns true if and only if the unit test passed (i.e. all test suites
13688 // passed).
13689 bool Passed() const;
13690
13691 // Returns true if and only if the unit test failed (i.e. some test suite
13692 // failed or something outside of all tests failed).
13693 bool Failed() const;
13694
13695 // Gets the i-th test suite among all the test suites. i can range from 0 to
13696 // total_test_suite_count() - 1. If i is not in that range, returns NULL.
13697 const TestSuite* GetTestSuite(int i) const;
13698
13699// Legacy API is deprecated but still available
13700#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13701 const TestCase* GetTestCase(int i) const;
13702#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
13703
13704 // Returns the TestResult containing information on test failures and
13705 // properties logged outside of individual test suites.
13707
13708 // Returns the list of event listeners that can be used to track events
13709 // inside Google Test.
13711
13712 private:
13713 // Registers and returns a global test environment. When a test
13714 // program is run, all global test environments will be set-up in
13715 // the order they were registered. After all tests in the program
13716 // have finished, all global test environments will be torn-down in
13717 // the *reverse* order they were registered.
13718 //
13719 // The UnitTest object takes ownership of the given environment.
13720 //
13721 // This method can only be called from the main thread.
13722 Environment* AddEnvironment(Environment* env);
13723
13724 // Adds a TestPartResult to the current TestResult object. All
13725 // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
13726 // eventually call this to report their results. The user code
13727 // should use the assertion macros instead of calling this directly.
13728 void AddTestPartResult(TestPartResult::Type result_type,
13729 const char* file_name,
13730 int line_number,
13731 const std::string& message,
13732 const std::string& os_stack_trace)
13733 GTEST_LOCK_EXCLUDED_(mutex_);
13734
13735 // Adds a TestProperty to the current TestResult object when invoked from
13736 // inside a test, to current TestSuite's ad_hoc_test_result_ when invoked
13737 // from SetUpTestSuite or TearDownTestSuite, or to the global property set
13738 // when invoked elsewhere. If the result already contains a property with
13739 // the same key, the value will be updated.
13740 void RecordProperty(const std::string& key, const std::string& value);
13741
13742 // Gets the i-th test suite among all the test suites. i can range from 0 to
13743 // total_test_suite_count() - 1. If i is not in that range, returns NULL.
13744 TestSuite* GetMutableTestSuite(int i);
13745
13746 // Accessors for the implementation object.
13747 internal::UnitTestImpl* impl() { return impl_; }
13748 const internal::UnitTestImpl* impl() const { return impl_; }
13749
13750 // These classes and functions are friends as they need to access private
13751 // members of UnitTest.
13752 friend class ScopedTrace;
13753 friend class Test;
13755 friend class internal::StreamingListenerTest;
13756 friend class internal::UnitTestRecordPropertyTestHelper;
13758 friend internal::UnitTestImpl* internal::GetUnitTestImpl();
13759 friend void internal::ReportFailureInUnknownLocation(
13760 TestPartResult::Type result_type,
13761 const std::string& message);
13762
13763 // Creates an empty UnitTest.
13764 UnitTest();
13765
13766 // D'tor
13767 virtual ~UnitTest();
13768
13769 // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
13770 // Google Test trace stack.
13771 void PushGTestTrace(const internal::TraceInfo& trace)
13772 GTEST_LOCK_EXCLUDED_(mutex_);
13773
13774 // Pops a trace from the per-thread Google Test trace stack.
13775 void PopGTestTrace()
13776 GTEST_LOCK_EXCLUDED_(mutex_);
13777
13778 // Protects mutable state in *impl_. This is mutable as some const
13779 // methods need to lock it too.
13780 mutable internal::Mutex mutex_;
13781
13782 // Opaque implementation object. This field is never changed once
13783 // the object is constructed. We don't mark it as const here, as
13784 // doing so will cause a warning in the constructor of UnitTest.
13785 // Mutable state in *impl_ is protected by mutex_.
13786 internal::UnitTestImpl* impl_;
13787
13788 // We disallow copying UnitTest.
13790};
13791
13792// A convenient wrapper for adding an environment for the test
13793// program.
13794//
13795// You should call this before RUN_ALL_TESTS() is called, probably in
13796// main(). If you use gtest_main, you need to call this before main()
13797// starts for it to take effect. For example, you can define a global
13798// variable like this:
13799//
13800// testing::Environment* const foo_env =
13801// testing::AddGlobalTestEnvironment(new FooEnvironment);
13802//
13803// However, we strongly recommend you to write your own main() and
13804// call AddGlobalTestEnvironment() there, as relying on initialization
13805// of global variables makes the code harder to read and may cause
13806// problems when you register multiple environments from different
13807// translation units and the environments have dependencies among them
13808// (remember that the compiler doesn't guarantee the order in which
13809// global variables from different translation units are initialized).
13811 return UnitTest::GetInstance()->AddEnvironment(env);
13812}
13813
13814// Initializes Google Test. This must be called before calling
13815// RUN_ALL_TESTS(). In particular, it parses a command line for the
13816// flags that Google Test recognizes. Whenever a Google Test flag is
13817// seen, it is removed from argv, and *argc is decremented.
13818//
13819// No value is returned. Instead, the Google Test flag variables are
13820// updated.
13821//
13822// Calling the function for the second time has no user-visible effect.
13823GTEST_API_ void InitGoogleTest(int* argc, char** argv);
13824
13825// This overloaded version can be used in Windows programs compiled in
13826// UNICODE mode.
13827GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
13828
13829// This overloaded version can be used on Arduino/embedded platforms where
13830// there is no argc/argv.
13832
13833namespace internal {
13834
13835// Separate the error generating code from the code path to reduce the stack
13836// frame size of CmpHelperEQ. This helps reduce the overhead of some sanitizers
13837// when calling EXPECT_* in a tight loop.
13838template <typename T1, typename T2>
13839AssertionResult CmpHelperEQFailure(const char* lhs_expression,
13840 const char* rhs_expression,
13841 const T1& lhs, const T2& rhs) {
13842 return EqFailure(lhs_expression,
13843 rhs_expression,
13846 false);
13847}
13848
13849// This block of code defines operator==/!=
13850// to block lexical scope lookup.
13851// It prevents using invalid operator==/!= defined at namespace scope.
13852struct faketype {};
13853inline bool operator==(faketype, faketype) { return true; }
13854inline bool operator!=(faketype, faketype) { return false; }
13855
13856// The helper function for {ASSERT|EXPECT}_EQ.
13857template <typename T1, typename T2>
13858AssertionResult CmpHelperEQ(const char* lhs_expression,
13859 const char* rhs_expression,
13860 const T1& lhs,
13861 const T2& rhs) {
13862 if (lhs == rhs) {
13863 return AssertionSuccess();
13864 }
13865
13866 return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);
13867}
13868
13869// With this overloaded version, we allow anonymous enums to be used
13870// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
13871// can be implicitly cast to BiggestInt.
13872GTEST_API_ AssertionResult CmpHelperEQ(const char* lhs_expression,
13873 const char* rhs_expression,
13874 BiggestInt lhs,
13875 BiggestInt rhs);
13876
13878 public:
13879 // This templatized version is for the general case.
13880 template <
13881 typename T1, typename T2,
13882 // Disable this overload for cases where one argument is a pointer
13883 // and the other is the null pointer constant.
13885 !std::is_pointer<T2>::value>::type* = nullptr>
13886 static AssertionResult Compare(const char* lhs_expression,
13887 const char* rhs_expression, const T1& lhs,
13888 const T2& rhs) {
13889 return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
13890 }
13891
13892 // With this overloaded version, we allow anonymous enums to be used
13893 // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
13894 // enums can be implicitly cast to BiggestInt.
13895 //
13896 // Even though its body looks the same as the above version, we
13897 // cannot merge the two, as it will make anonymous enums unhappy.
13898 static AssertionResult Compare(const char* lhs_expression,
13899 const char* rhs_expression,
13900 BiggestInt lhs,
13901 BiggestInt rhs) {
13902 return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
13903 }
13904
13905 template <typename T>
13906 static AssertionResult Compare(
13907 const char* lhs_expression, const char* rhs_expression,
13908 // Handle cases where '0' is used as a null pointer literal.
13909 std::nullptr_t /* lhs */, T* rhs) {
13910 // We already know that 'lhs' is a null pointer.
13911 return CmpHelperEQ(lhs_expression, rhs_expression, static_cast<T*>(nullptr),
13912 rhs);
13913 }
13914};
13915
13916// Separate the error generating code from the code path to reduce the stack
13917// frame size of CmpHelperOP. This helps reduce the overhead of some sanitizers
13918// when calling EXPECT_OP in a tight loop.
13919template <typename T1, typename T2>
13920AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2,
13921 const T1& val1, const T2& val2,
13922 const char* op) {
13923 return AssertionFailure()
13924 << "Expected: (" << expr1 << ") " << op << " (" << expr2
13925 << "), actual: " << FormatForComparisonFailureMessage(val1, val2)
13926 << " vs " << FormatForComparisonFailureMessage(val2, val1);
13927}
13928
13929// A macro for implementing the helper functions needed to implement
13930// ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste
13931// of similar code.
13932//
13933// For each templatized helper function, we also define an overloaded
13934// version for BiggestInt in order to reduce code bloat and allow
13935// anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
13936// with gcc 4.
13937//
13938// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
13939
13940#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
13941template <typename T1, typename T2>\
13942AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
13943 const T1& val1, const T2& val2) {\
13944 if (val1 op val2) {\
13945 return AssertionSuccess();\
13946 } else {\
13947 return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
13948 }\
13949}\
13950GTEST_API_ AssertionResult CmpHelper##op_name(\
13951 const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
13952
13953// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
13954
13955// Implements the helper function for {ASSERT|EXPECT}_NE
13957// Implements the helper function for {ASSERT|EXPECT}_LE
13959// Implements the helper function for {ASSERT|EXPECT}_LT
13961// Implements the helper function for {ASSERT|EXPECT}_GE
13963// Implements the helper function for {ASSERT|EXPECT}_GT
13965
13966#undef GTEST_IMPL_CMP_HELPER_
13967
13968// The helper function for {ASSERT|EXPECT}_STREQ.
13969//
13970// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
13971GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
13972 const char* s2_expression,
13973 const char* s1,
13974 const char* s2);
13975
13976// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
13977//
13978// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
13979GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression,
13980 const char* s2_expression,
13981 const char* s1,
13982 const char* s2);
13983
13984// The helper function for {ASSERT|EXPECT}_STRNE.
13985//
13986// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
13987GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
13988 const char* s2_expression,
13989 const char* s1,
13990 const char* s2);
13991
13992// The helper function for {ASSERT|EXPECT}_STRCASENE.
13993//
13994// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
13995GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
13996 const char* s2_expression,
13997 const char* s1,
13998 const char* s2);
13999
14000
14001// Helper function for *_STREQ on wide strings.
14002//
14003// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
14004GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
14005 const char* s2_expression,
14006 const wchar_t* s1,
14007 const wchar_t* s2);
14008
14009// Helper function for *_STRNE on wide strings.
14010//
14011// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
14012GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
14013 const char* s2_expression,
14014 const wchar_t* s1,
14015 const wchar_t* s2);
14016
14017} // namespace internal
14018
14019// IsSubstring() and IsNotSubstring() are intended to be used as the
14020// first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
14021// themselves. They check whether needle is a substring of haystack
14022// (NULL is considered a substring of itself only), and return an
14023// appropriate error message when they fail.
14024//
14025// The {needle,haystack}_expr arguments are the stringified
14026// expressions that generated the two real arguments.
14027GTEST_API_ AssertionResult IsSubstring(
14028 const char* needle_expr, const char* haystack_expr,
14029 const char* needle, const char* haystack);
14030GTEST_API_ AssertionResult IsSubstring(
14031 const char* needle_expr, const char* haystack_expr,
14032 const wchar_t* needle, const wchar_t* haystack);
14034 const char* needle_expr, const char* haystack_expr,
14035 const char* needle, const char* haystack);
14037 const char* needle_expr, const char* haystack_expr,
14038 const wchar_t* needle, const wchar_t* haystack);
14039GTEST_API_ AssertionResult IsSubstring(
14040 const char* needle_expr, const char* haystack_expr,
14041 const ::std::string& needle, const ::std::string& haystack);
14043 const char* needle_expr, const char* haystack_expr,
14044 const ::std::string& needle, const ::std::string& haystack);
14045
14046#if GTEST_HAS_STD_WSTRING
14047GTEST_API_ AssertionResult IsSubstring(
14048 const char* needle_expr, const char* haystack_expr,
14049 const ::std::wstring& needle, const ::std::wstring& haystack);
14051 const char* needle_expr, const char* haystack_expr,
14052 const ::std::wstring& needle, const ::std::wstring& haystack);
14053#endif // GTEST_HAS_STD_WSTRING
14054
14055namespace internal {
14056
14057// Helper template function for comparing floating-points.
14058//
14059// Template parameter:
14060//
14061// RawType: the raw floating-point type (either float or double)
14062//
14063// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
14064template <typename RawType>
14065AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
14066 const char* rhs_expression,
14067 RawType lhs_value,
14068 RawType rhs_value) {
14069 const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
14070
14071 if (lhs.AlmostEquals(rhs)) {
14072 return AssertionSuccess();
14073 }
14074
14075 ::std::stringstream lhs_ss;
14076 lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
14077 << lhs_value;
14078
14079 ::std::stringstream rhs_ss;
14080 rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
14081 << rhs_value;
14082
14083 return EqFailure(lhs_expression,
14084 rhs_expression,
14085 StringStreamToString(&lhs_ss),
14086 StringStreamToString(&rhs_ss),
14087 false);
14088}
14089
14090// Helper function for implementing ASSERT_NEAR.
14091//
14092// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
14093GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
14094 const char* expr2,
14095 const char* abs_error_expr,
14096 double val1,
14097 double val2,
14098 double abs_error);
14099
14100// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
14101// A class that enables one to stream messages to assertion macros
14103 public:
14104 // Constructor.
14105 AssertHelper(TestPartResult::Type type,
14106 const char* file,
14107 int line,
14108 const char* message);
14110
14111 // Message assignment is a semantic trick to enable assertion
14112 // streaming; see the GTEST_MESSAGE_ macro below.
14113 void operator=(const Message& message) const;
14114
14115 private:
14116 // We put our data in a struct so that the size of the AssertHelper class can
14117 // be as small as possible. This is important because gcc is incapable of
14118 // re-using stack space even for temporary variables, so every EXPECT_EQ
14119 // reserves stack space for another AssertHelper.
14120 struct AssertHelperData {
14121 AssertHelperData(TestPartResult::Type t,
14122 const char* srcfile,
14123 int line_num,
14124 const char* msg)
14125 : type(t), file(srcfile), line(line_num), message(msg) { }
14126
14127 TestPartResult::Type const type;
14128 const char* const file;
14129 int const line;
14130 std::string const message;
14131
14132 private:
14133 GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
14134 };
14135
14136 AssertHelperData* const data_;
14137
14138 GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
14139};
14140
14142
14143GTEST_API_ GTEST_ATTRIBUTE_PRINTF_(2, 3) void ColoredPrintf(GTestColor color,
14144 const char* fmt,
14145 ...);
14146
14147} // namespace internal
14148
14149// The pure interface class that all value-parameterized tests inherit from.
14150// A value-parameterized class must inherit from both ::testing::Test and
14151// ::testing::WithParamInterface. In most cases that just means inheriting
14152// from ::testing::TestWithParam, but more complicated test hierarchies
14153// may need to inherit from Test and WithParamInterface at different levels.
14154//
14155// This interface has support for accessing the test parameter value via
14156// the GetParam() method.
14157//
14158// Use it with one of the parameter generator defining functions, like Range(),
14159// Values(), ValuesIn(), Bool(), and Combine().
14160//
14161// class FooTest : public ::testing::TestWithParam<int> {
14162// protected:
14163// FooTest() {
14164// // Can use GetParam() here.
14165// }
14166// ~FooTest() override {
14167// // Can use GetParam() here.
14168// }
14169// void SetUp() override {
14170// // Can use GetParam() here.
14171// }
14172// void TearDown override {
14173// // Can use GetParam() here.
14174// }
14175// };
14176// TEST_P(FooTest, DoesBar) {
14177// // Can use GetParam() method here.
14178// Foo foo;
14179// ASSERT_TRUE(foo.DoesBar(GetParam()));
14180// }
14181// INSTANTIATE_TEST_SUITE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
14182
14183template <typename T>
14185 public:
14186 typedef T ParamType;
14188
14189 // The current parameter value. Is also available in the test fixture's
14190 // constructor.
14191 static const ParamType& GetParam() {
14192 GTEST_CHECK_(parameter_ != nullptr)
14193 << "GetParam() can only be called inside a value-parameterized test "
14194 << "-- did you intend to write TEST_P instead of TEST_F?";
14195 return *parameter_;
14196 }
14197
14198 private:
14199 // Sets parameter value. The caller is responsible for making sure the value
14200 // remains alive and unchanged throughout the current test.
14201 static void SetParam(const ParamType* parameter) {
14202 parameter_ = parameter;
14203 }
14204
14205 // Static value used for accessing parameter during a test lifetime.
14206 static const ParamType* parameter_;
14207
14208 // TestClass must be a subclass of WithParamInterface<T> and Test.
14209 template <class TestClass> friend class internal::ParameterizedTestFactory;
14210};
14211
14212template <typename T>
14213const T* WithParamInterface<T>::parameter_ = nullptr;
14214
14215// Most value-parameterized classes can ignore the existence of
14216// WithParamInterface, and can just inherit from ::testing::TestWithParam.
14217
14218template <typename T>
14219class TestWithParam : public Test, public WithParamInterface<T> {
14220};
14221
14222// Macros for indicating success/failure in test code.
14223
14224// Skips test in runtime.
14225// Skipping test aborts current function.
14226// Skipped tests are neither successful nor failed.
14227#define GTEST_SKIP() GTEST_SKIP_("Skipped")
14228
14229// ADD_FAILURE unconditionally adds a failure to the current test.
14230// SUCCEED generates a success - it doesn't automatically make the
14231// current test successful, as a test is only successful when it has
14232// no failure.
14233//
14234// EXPECT_* verifies that a certain condition is satisfied. If not,
14235// it behaves like ADD_FAILURE. In particular:
14236//
14237// EXPECT_TRUE verifies that a Boolean condition is true.
14238// EXPECT_FALSE verifies that a Boolean condition is false.
14239//
14240// FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
14241// that they will also abort the current function on failure. People
14242// usually want the fail-fast behavior of FAIL and ASSERT_*, but those
14243// writing data-driven tests often find themselves using ADD_FAILURE
14244// and EXPECT_* more.
14245
14246// Generates a nonfatal failure with a generic message.
14247#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
14248
14249// Generates a nonfatal failure at the given source file location with
14250// a generic message.
14251#define ADD_FAILURE_AT(file, line) \
14252 GTEST_MESSAGE_AT_(file, line, "Failed", \
14253 ::testing::TestPartResult::kNonFatalFailure)
14254
14255// Generates a fatal failure with a generic message.
14256#define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
14257
14258// Like GTEST_FAIL(), but at the given source file location.
14259#define GTEST_FAIL_AT(file, line) \
14260 GTEST_MESSAGE_AT_(file, line, "Failed", \
14261 ::testing::TestPartResult::kFatalFailure)
14262
14263// Define this macro to 1 to omit the definition of FAIL(), which is a
14264// generic name and clashes with some other libraries.
14265#if !GTEST_DONT_DEFINE_FAIL
14266# define FAIL() GTEST_FAIL()
14267#endif
14268
14269// Generates a success with a generic message.
14270#define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
14271
14272// Define this macro to 1 to omit the definition of SUCCEED(), which
14273// is a generic name and clashes with some other libraries.
14274#if !GTEST_DONT_DEFINE_SUCCEED
14275# define SUCCEED() GTEST_SUCCEED()
14276#endif
14277
14278// Macros for testing exceptions.
14279//
14280// * {ASSERT|EXPECT}_THROW(statement, expected_exception):
14281// Tests that the statement throws the expected exception.
14282// * {ASSERT|EXPECT}_NO_THROW(statement):
14283// Tests that the statement doesn't throw any exception.
14284// * {ASSERT|EXPECT}_ANY_THROW(statement):
14285// Tests that the statement throws an exception.
14286
14287#define EXPECT_THROW(statement, expected_exception) \
14288 GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
14289#define EXPECT_NO_THROW(statement) \
14290 GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
14291#define EXPECT_ANY_THROW(statement) \
14292 GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
14293#define ASSERT_THROW(statement, expected_exception) \
14294 GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
14295#define ASSERT_NO_THROW(statement) \
14296 GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
14297#define ASSERT_ANY_THROW(statement) \
14298 GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
14299
14300// Boolean assertions. Condition can be either a Boolean expression or an
14301// AssertionResult. For more information on how to use AssertionResult with
14302// these macros see comments on that class.
14303#define EXPECT_TRUE(condition) \
14304 GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
14305 GTEST_NONFATAL_FAILURE_)
14306#define EXPECT_FALSE(condition) \
14307 GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
14308 GTEST_NONFATAL_FAILURE_)
14309#define ASSERT_TRUE(condition) \
14310 GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
14311 GTEST_FATAL_FAILURE_)
14312#define ASSERT_FALSE(condition) \
14313 GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
14314 GTEST_FATAL_FAILURE_)
14315
14316// Macros for testing equalities and inequalities.
14317//
14318// * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2
14319// * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
14320// * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
14321// * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
14322// * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
14323// * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
14324//
14325// When they are not, Google Test prints both the tested expressions and
14326// their actual values. The values must be compatible built-in types,
14327// or you will get a compiler error. By "compatible" we mean that the
14328// values can be compared by the respective operator.
14329//
14330// Note:
14331//
14332// 1. It is possible to make a user-defined type work with
14333// {ASSERT|EXPECT}_??(), but that requires overloading the
14334// comparison operators and is thus discouraged by the Google C++
14335// Usage Guide. Therefore, you are advised to use the
14336// {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
14337// equal.
14338//
14339// 2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
14340// pointers (in particular, C strings). Therefore, if you use it
14341// with two C strings, you are testing how their locations in memory
14342// are related, not how their content is related. To compare two C
14343// strings by content, use {ASSERT|EXPECT}_STR*().
14344//
14345// 3. {ASSERT|EXPECT}_EQ(v1, v2) is preferred to
14346// {ASSERT|EXPECT}_TRUE(v1 == v2), as the former tells you
14347// what the actual value is when it fails, and similarly for the
14348// other comparisons.
14349//
14350// 4. Do not depend on the order in which {ASSERT|EXPECT}_??()
14351// evaluate their arguments, which is undefined.
14352//
14353// 5. These macros evaluate their arguments exactly once.
14354//
14355// Examples:
14356//
14357// EXPECT_NE(Foo(), 5);
14358// EXPECT_EQ(a_pointer, NULL);
14359// ASSERT_LT(i, array_size);
14360// ASSERT_GT(records.size(), 0) << "There is no record left.";
14361
14362#define EXPECT_EQ(val1, val2) \
14363 EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
14364#define EXPECT_NE(val1, val2) \
14365 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
14366#define EXPECT_LE(val1, val2) \
14367 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
14368#define EXPECT_LT(val1, val2) \
14369 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
14370#define EXPECT_GE(val1, val2) \
14371 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
14372#define EXPECT_GT(val1, val2) \
14373 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
14374
14375#define GTEST_ASSERT_EQ(val1, val2) \
14376 ASSERT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
14377#define GTEST_ASSERT_NE(val1, val2) \
14378 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
14379#define GTEST_ASSERT_LE(val1, val2) \
14380 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
14381#define GTEST_ASSERT_LT(val1, val2) \
14382 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
14383#define GTEST_ASSERT_GE(val1, val2) \
14384 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
14385#define GTEST_ASSERT_GT(val1, val2) \
14386 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
14387
14388// Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
14389// ASSERT_XY(), which clashes with some users' own code.
14390
14391#if !GTEST_DONT_DEFINE_ASSERT_EQ
14392# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
14393#endif
14394
14395#if !GTEST_DONT_DEFINE_ASSERT_NE
14396# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
14397#endif
14398
14399#if !GTEST_DONT_DEFINE_ASSERT_LE
14400# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
14401#endif
14402
14403#if !GTEST_DONT_DEFINE_ASSERT_LT
14404# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
14405#endif
14406
14407#if !GTEST_DONT_DEFINE_ASSERT_GE
14408# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
14409#endif
14410
14411#if !GTEST_DONT_DEFINE_ASSERT_GT
14412# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
14413#endif
14414
14415// C-string Comparisons. All tests treat NULL and any non-NULL string
14416// as different. Two NULLs are equal.
14417//
14418// * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2
14419// * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2
14420// * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
14421// * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
14422//
14423// For wide or narrow string objects, you can use the
14424// {ASSERT|EXPECT}_??() macros.
14425//
14426// Don't depend on the order in which the arguments are evaluated,
14427// which is undefined.
14428//
14429// These macros evaluate their arguments exactly once.
14430
14431#define EXPECT_STREQ(s1, s2) \
14432 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
14433#define EXPECT_STRNE(s1, s2) \
14434 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
14435#define EXPECT_STRCASEEQ(s1, s2) \
14436 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
14437#define EXPECT_STRCASENE(s1, s2)\
14438 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
14439
14440#define ASSERT_STREQ(s1, s2) \
14441 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
14442#define ASSERT_STRNE(s1, s2) \
14443 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
14444#define ASSERT_STRCASEEQ(s1, s2) \
14445 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
14446#define ASSERT_STRCASENE(s1, s2)\
14447 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
14448
14449// Macros for comparing floating-point numbers.
14450//
14451// * {ASSERT|EXPECT}_FLOAT_EQ(val1, val2):
14452// Tests that two float values are almost equal.
14453// * {ASSERT|EXPECT}_DOUBLE_EQ(val1, val2):
14454// Tests that two double values are almost equal.
14455// * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
14456// Tests that v1 and v2 are within the given distance to each other.
14457//
14458// Google Test uses ULP-based comparison to automatically pick a default
14459// error bound that is appropriate for the operands. See the
14460// FloatingPoint template class in gtest-internal.h if you are
14461// interested in the implementation details.
14462
14463#define EXPECT_FLOAT_EQ(val1, val2)\
14464 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
14465 val1, val2)
14466
14467#define EXPECT_DOUBLE_EQ(val1, val2)\
14468 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
14469 val1, val2)
14470
14471#define ASSERT_FLOAT_EQ(val1, val2)\
14472 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
14473 val1, val2)
14474
14475#define ASSERT_DOUBLE_EQ(val1, val2)\
14476 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
14477 val1, val2)
14478
14479#define EXPECT_NEAR(val1, val2, abs_error)\
14480 EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
14481 val1, val2, abs_error)
14482
14483#define ASSERT_NEAR(val1, val2, abs_error)\
14484 ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
14485 val1, val2, abs_error)
14486
14487// These predicate format functions work on floating-point values, and
14488// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
14489//
14490// EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
14491
14492// Asserts that val1 is less than, or almost equal to, val2. Fails
14493// otherwise. In particular, it fails if either val1 or val2 is NaN.
14494GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
14495 float val1, float val2);
14496GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
14497 double val1, double val2);
14498
14499
14500#if GTEST_OS_WINDOWS
14501
14502// Macros that test for HRESULT failure and success, these are only useful
14503// on Windows, and rely on Windows SDK macros and APIs to compile.
14504//
14505// * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
14506//
14507// When expr unexpectedly fails or succeeds, Google Test prints the
14508// expected result and the actual result with both a human-readable
14509// string representation of the error, if available, as well as the
14510// hex result code.
14511# define EXPECT_HRESULT_SUCCEEDED(expr) \
14512 EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
14513
14514# define ASSERT_HRESULT_SUCCEEDED(expr) \
14515 ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
14516
14517# define EXPECT_HRESULT_FAILED(expr) \
14518 EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
14519
14520# define ASSERT_HRESULT_FAILED(expr) \
14521 ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
14522
14523#endif // GTEST_OS_WINDOWS
14524
14525// Macros that execute statement and check that it doesn't generate new fatal
14526// failures in the current thread.
14527//
14528// * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
14529//
14530// Examples:
14531//
14532// EXPECT_NO_FATAL_FAILURE(Process());
14533// ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
14534//
14535#define ASSERT_NO_FATAL_FAILURE(statement) \
14536 GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
14537#define EXPECT_NO_FATAL_FAILURE(statement) \
14538 GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
14539
14540// Causes a trace (including the given source file path and line number,
14541// and the given message) to be included in every test failure message generated
14542// by code in the scope of the lifetime of an instance of this class. The effect
14543// is undone with the destruction of the instance.
14544//
14545// The message argument can be anything streamable to std::ostream.
14546//
14547// Example:
14548// testing::ScopedTrace trace("file.cc", 123, "message");
14549//
14551 public:
14552 // The c'tor pushes the given source file location and message onto
14553 // a trace stack maintained by Google Test.
14554
14555 // Template version. Uses Message() to convert the values into strings.
14556 // Slow, but flexible.
14557 template <typename T>
14558 ScopedTrace(const char* file, int line, const T& message) {
14559 PushTrace(file, line, (Message() << message).GetString());
14560 }
14561
14562 // Optimize for some known types.
14563 ScopedTrace(const char* file, int line, const char* message) {
14564 PushTrace(file, line, message ? message : "(null)");
14565 }
14566
14567 ScopedTrace(const char* file, int line, const std::string& message) {
14568 PushTrace(file, line, message);
14569 }
14570
14571 // The d'tor pops the info pushed by the c'tor.
14572 //
14573 // Note that the d'tor is not virtual in order to be efficient.
14574 // Don't inherit from ScopedTrace!
14576
14577 private:
14578 void PushTrace(const char* file, int line, std::string message);
14579
14581} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
14582 // c'tor and d'tor. Therefore it doesn't
14583 // need to be used otherwise.
14584
14585// Causes a trace (including the source file path, the current line
14586// number, and the given message) to be included in every test failure
14587// message generated by code in the current scope. The effect is
14588// undone when the control leaves the current scope.
14589//
14590// The message argument can be anything streamable to std::ostream.
14591//
14592// In the implementation, we include the current line number as part
14593// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
14594// to appear in the same block - as long as they are on different
14595// lines.
14596//
14597// Assuming that each thread maintains its own stack of traces.
14598// Therefore, a SCOPED_TRACE() would (correctly) only affect the
14599// assertions in its own thread.
14600#define SCOPED_TRACE(message) \
14601 ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
14602 __FILE__, __LINE__, (message))
14603
14604// Compile-time assertion for type equality.
14605// StaticAssertTypeEq<type1, type2>() compiles if and only if type1 and type2
14606// are the same type. The value it returns is not interesting.
14607//
14608// Instead of making StaticAssertTypeEq a class template, we make it a
14609// function template that invokes a helper class template. This
14610// prevents a user from misusing StaticAssertTypeEq<T1, T2> by
14611// defining objects of that type.
14612//
14613// CAVEAT:
14614//
14615// When used inside a method of a class template,
14616// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
14617// instantiated. For example, given:
14618//
14619// template <typename T> class Foo {
14620// public:
14621// void Bar() { testing::StaticAssertTypeEq<int, T>(); }
14622// };
14623//
14624// the code:
14625//
14626// void Test1() { Foo<bool> foo; }
14627//
14628// will NOT generate a compiler error, as Foo<bool>::Bar() is never
14629// actually instantiated. Instead, you need:
14630//
14631// void Test2() { Foo<bool> foo; foo.Bar(); }
14632//
14633// to cause a compiler error.
14634template <typename T1, typename T2>
14635constexpr bool StaticAssertTypeEq() noexcept {
14636 static_assert(std::is_same<T1, T2>::value,
14637 "type1 and type2 are not the same type");
14638 return true;
14639}
14640
14641// Defines a test.
14642//
14643// The first parameter is the name of the test suite, and the second
14644// parameter is the name of the test within the test suite.
14645//
14646// The convention is to end the test suite name with "Test". For
14647// example, a test suite for the Foo class can be named FooTest.
14648//
14649// Test code should appear between braces after an invocation of
14650// this macro. Example:
14651//
14652// TEST(FooTest, InitializesCorrectly) {
14653// Foo foo;
14654// EXPECT_TRUE(foo.StatusIsOK());
14655// }
14656
14657// Note that we call GetTestTypeId() instead of GetTypeId<
14658// ::testing::Test>() here to get the type ID of testing::Test. This
14659// is to work around a suspected linker bug when using Google Test as
14660// a framework on Mac OS X. The bug causes GetTypeId<
14661// ::testing::Test>() to return different values depending on whether
14662// the call is from the Google Test framework itself or from user test
14663// code. GetTestTypeId() is guaranteed to always return the same
14664// value, as it always calls GetTypeId<>() from the Google Test
14665// framework.
14666#define GTEST_TEST(test_suite_name, test_name) \
14667 GTEST_TEST_(test_suite_name, test_name, ::testing::Test, \
14668 ::testing::internal::GetTestTypeId())
14669
14670// Define this macro to 1 to omit the definition of TEST(), which
14671// is a generic name and clashes with some other libraries.
14672#if !GTEST_DONT_DEFINE_TEST
14673#define TEST(test_suite_name, test_name) GTEST_TEST(test_suite_name, test_name)
14674#endif
14675
14676// Defines a test that uses a test fixture.
14677//
14678// The first parameter is the name of the test fixture class, which
14679// also doubles as the test suite name. The second parameter is the
14680// name of the test within the test suite.
14681//
14682// A test fixture class must be declared earlier. The user should put
14683// the test code between braces after using this macro. Example:
14684//
14685// class FooTest : public testing::Test {
14686// protected:
14687// void SetUp() override { b_.AddElement(3); }
14688//
14689// Foo a_;
14690// Foo b_;
14691// };
14692//
14693// TEST_F(FooTest, InitializesCorrectly) {
14694// EXPECT_TRUE(a_.StatusIsOK());
14695// }
14696//
14697// TEST_F(FooTest, ReturnsElementCountCorrectly) {
14698// EXPECT_EQ(a_.size(), 0);
14699// EXPECT_EQ(b_.size(), 1);
14700// }
14701//
14702// GOOGLETEST_CM0011 DO NOT DELETE
14703#define TEST_F(test_fixture, test_name)\
14704 GTEST_TEST_(test_fixture, test_name, test_fixture, \
14705 ::testing::internal::GetTypeId<test_fixture>())
14706
14707// Returns a path to temporary directory.
14708// Tries to determine an appropriate directory for the platform.
14710
14711#ifdef _MSC_VER
14712# pragma warning(pop)
14713#endif
14714
14715// Dynamically registers a test with the framework.
14716//
14717// This is an advanced API only to be used when the `TEST` macros are
14718// insufficient. The macros should be preferred when possible, as they avoid
14719// most of the complexity of calling this function.
14720//
14721// The `factory` argument is a factory callable (move-constructible) object or
14722// function pointer that creates a new instance of the Test object. It
14723// handles ownership to the caller. The signature of the callable is
14724// `Fixture*()`, where `Fixture` is the test fixture class for the test. All
14725// tests registered with the same `test_suite_name` must return the same
14726// fixture type. This is checked at runtime.
14727//
14728// The framework will infer the fixture class from the factory and will call
14729// the `SetUpTestSuite` and `TearDownTestSuite` for it.
14730//
14731// Must be called before `RUN_ALL_TESTS()` is invoked, otherwise behavior is
14732// undefined.
14733//
14734// Use case example:
14735//
14736// class MyFixture : public ::testing::Test {
14737// public:
14738// // All of these optional, just like in regular macro usage.
14739// static void SetUpTestSuite() { ... }
14740// static void TearDownTestSuite() { ... }
14741// void SetUp() override { ... }
14742// void TearDown() override { ... }
14743// };
14744//
14745// class MyTest : public MyFixture {
14746// public:
14747// explicit MyTest(int data) : data_(data) {}
14748// void TestBody() override { ... }
14749//
14750// private:
14751// int data_;
14752// };
14753//
14754// void RegisterMyTests(const std::vector<int>& values) {
14755// for (int v : values) {
14756// ::testing::RegisterTest(
14757// "MyFixture", ("Test" + std::to_string(v)).c_str(), nullptr,
14758// std::to_string(v).c_str(),
14759// __FILE__, __LINE__,
14760// // Important to use the fixture type as the return type here.
14761// [=]() -> MyFixture* { return new MyTest(v); });
14762// }
14763// }
14764// ...
14765// int main(int argc, char** argv) {
14766// std::vector<int> values_to_test = LoadValuesFromConfig();
14767// RegisterMyTests(values_to_test);
14768// ...
14769// return RUN_ALL_TESTS();
14770// }
14771//
14772template <int&... ExplicitParameterBarrier, typename Factory>
14773TestInfo* RegisterTest(const char* test_suite_name, const char* test_name,
14774 const char* type_param, const char* value_param,
14775 const char* file, int line, Factory factory) {
14776 using TestT = typename std::remove_pointer<decltype(factory())>::type;
14777
14778 class FactoryImpl : public internal::TestFactoryBase {
14779 public:
14780 explicit FactoryImpl(Factory f) : factory_(std::move(f)) {}
14781 Test* CreateTest() override { return factory_(); }
14782
14783 private:
14784 Factory factory_;
14785 };
14786
14788 test_suite_name, test_name, type_param, value_param,
14789 internal::CodeLocation(file, line), internal::GetTypeId<TestT>(),
14792 new FactoryImpl{std::move(factory)});
14793}
14794
14795} // namespace testing
14796
14797// Use this function in main() to run all tests. It returns 0 if all
14798// tests are successful, or 1 otherwise.
14799//
14800// RUN_ALL_TESTS() should be invoked after the command line has been
14801// parsed by InitGoogleTest().
14802//
14803// This function was formerly a macro; thus, it is in the global
14804// namespace and has an all-caps name.
14806
14807inline int RUN_ALL_TESTS() {
14808 return ::testing::UnitTest::GetInstance()->Run();
14809}
14810
14812
14813#endif // GTEST_INCLUDE_GTEST_GTEST_H_
const char *const const double number
Definition: cJSON.h:262
const cJSON *const b
Definition: cJSON.h:251
const char *const name
Definition: cJSON.h:258
int index
Definition: cJSON.h:168
int cJSON_bool fmt
Definition: cJSON.h:158
int count
Definition: cJSON.h:212
const char *const string
Definition: cJSON.h:170
Definition: gtest.h:13476
void OnTestStart(const TestInfo &) override
Definition: gtest.h:13489
void OnTestSuiteStart(const TestSuite &) override
Definition: gtest.h:13483
void OnTestIterationStart(const UnitTest &, int) override
Definition: gtest.h:13479
void OnEnvironmentsTearDownStart(const UnitTest &) override
Definition: gtest.h:13497
void OnEnvironmentsSetUpStart(const UnitTest &) override
Definition: gtest.h:13481
void OnTestEnd(const TestInfo &) override
Definition: gtest.h:13491
void OnTestCaseStart(const TestCase &) override
Definition: gtest.h:13486
void OnEnvironmentsSetUpEnd(const UnitTest &) override
Definition: gtest.h:13482
void OnTestProgramEnd(const UnitTest &) override
Definition: gtest.h:13501
void OnTestIterationEnd(const UnitTest &, int) override
Definition: gtest.h:13499
void OnTestPartResult(const TestPartResult &) override
Definition: gtest.h:13490
void OnTestCaseEnd(const TestCase &) override
Definition: gtest.h:13494
void OnTestProgramStart(const UnitTest &) override
Definition: gtest.h:13478
void OnEnvironmentsTearDownEnd(const UnitTest &) override
Definition: gtest.h:13498
void OnTestSuiteEnd(const TestSuite &) override
Definition: gtest.h:13492
Definition: gtest.h:13380
virtual void TearDown()
Definition: gtest.h:13389
virtual ~Environment()
Definition: gtest.h:13383
virtual void SetUp()
Definition: gtest.h:13386
Definition: gtest.h:2585
std::string GetString() const
Message(const char *str)
Definition: gtest.h:2601
Message(const Message &msg)
Definition: gtest.h:2596
Definition: gtest.h:14550
ScopedTrace(const char *file, int line, const std::string &message)
Definition: gtest.h:14567
ScopedTrace(const char *file, int line, const T &message)
Definition: gtest.h:14558
ScopedTrace(const char *file, int line, const char *message)
Definition: gtest.h:14563
Definition: gtest.h:13411
virtual void OnTestPartResult(const TestPartResult &test_part_result)=0
virtual void OnTestSuiteStart(const TestSuite &)
Definition: gtest.h:13431
virtual ~TestEventListener()
Definition: gtest.h:13413
virtual void OnEnvironmentsTearDownStart(const UnitTest &unit_test)=0
virtual void OnTestIterationEnd(const UnitTest &unit_test, int iteration)=0
virtual void OnTestProgramStart(const UnitTest &unit_test)=0
virtual void OnTestIterationStart(const UnitTest &unit_test, int iteration)=0
virtual void OnTestCaseEnd(const TestCase &)
Definition: gtest.h:13454
virtual void OnTestSuiteEnd(const TestSuite &)
Definition: gtest.h:13450
virtual void OnEnvironmentsTearDownEnd(const UnitTest &unit_test)=0
virtual void OnEnvironmentsSetUpStart(const UnitTest &unit_test)=0
virtual void OnEnvironmentsSetUpEnd(const UnitTest &unit_test)=0
virtual void OnTestStart(const TestInfo &test_info)=0
virtual void OnTestEnd(const TestInfo &test_info)=0
virtual void OnTestCaseStart(const TestCase &)
Definition: gtest.h:13435
virtual void OnTestProgramEnd(const UnitTest &unit_test)=0
Definition: gtest.h:13505
TestEventListener * Release(TestEventListener *listener)
void Append(TestEventListener *listener)
TestEventListener * default_result_printer() const
Definition: gtest.h:13525
TestEventListener * default_xml_generator() const
Definition: gtest.h:13536
Definition: gtest.h:13030
const char * file() const
Definition: gtest.h:13062
const char * value_param() const
Definition: gtest.h:13056
bool is_reportable() const
Definition: gtest.h:13089
bool is_in_another_shard() const
Definition: gtest.h:13068
bool should_run() const
Definition: gtest.h:13086
const char * type_param() const
Definition: gtest.h:13049
const char * name() const
Definition: gtest.h:13045
const TestResult * result() const
Definition: gtest.h:13096
const char * test_case_name() const
Definition: gtest.h:13041
const char * test_suite_name() const
Definition: gtest.h:13037
int line() const
Definition: gtest.h:13065
Definition: gtest.h:12737
static bool HasNonfatalFailure()
static bool HasFatalFailure()
static bool IsSkipped()
static void SetUpTestCase()
Definition: gtest.h:12767
static void TearDownTestSuite()
Definition: gtest.h:12762
static bool HasFailure()
Definition: gtest.h:12781
virtual void SetUp()
virtual void TearDown()
virtual ~Test()
static void RecordProperty(const std::string &key, const std::string &value)
static void SetUpTestSuite()
Definition: gtest.h:12752
static void TearDownTestCase()
Definition: gtest.h:12766
static void RecordProperty(const std::string &key, int value)
Definition: gtest.h:12860
const char * value() const
Definition: gtest.h:12875
TestProperty(const std::string &a_key, const std::string &a_value)
Definition: gtest.h:12865
void SetValue(const std::string &new_value)
Definition: gtest.h:12880
const char * key() const
Definition: gtest.h:12870
Definition: gtest.h:12897
bool HasFatalFailure() const
bool Skipped() const
bool HasNonfatalFailure() const
int total_part_count() const
const TestProperty & GetTestProperty(int i) const
TimeInMillis elapsed_time() const
Definition: gtest.h:12928
const TestPartResult & GetTestPartResult(int i) const
bool Passed() const
Definition: gtest.h:12913
TimeInMillis start_timestamp() const
Definition: gtest.h:12932
bool Failed() const
int test_property_count() const
Definition: gtest.h:13165
int test_to_run_count() const
int reportable_test_count() const
const char * name() const
Definition: gtest.h:13187
TestSuite(const char *name, const char *a_type_param, internal::SetUpTestSuiteFunc set_up_tc, internal::TearDownTestSuiteFunc tear_down_tc)
TimeInMillis elapsed_time() const
Definition: gtest.h:13230
int total_test_count() const
const char * type_param() const
Definition: gtest.h:13191
const TestResult & ad_hoc_test_result() const
Definition: gtest.h:13242
const TestInfo * GetTestInfo(int i) const
virtual ~TestSuite()
int successful_test_count() const
bool should_run() const
Definition: gtest.h:13197
int failed_test_count() const
int reportable_disabled_test_count() const
TimeInMillis start_timestamp() const
Definition: gtest.h:13234
int disabled_test_count() const
bool Passed() const
Definition: gtest.h:13224
bool Failed() const
Definition: gtest.h:13227
int skipped_test_count() const
Definition: gtest.h:14219
Definition: gtest.h:13592
int skipped_test_count() const
const TestInfo * current_test_info() const GTEST_LOCK_EXCLUDED_(mutex_)
int reportable_disabled_test_count() const
const TestCase * current_test_case() const GTEST_LOCK_EXCLUDED_(mutex_)
int Run() GTEST_MUST_USE_RESULT_
TimeInMillis elapsed_time() const
int reportable_test_count() const
static UnitTest * GetInstance()
int test_to_run_count() const
int successful_test_count() const
bool Failed() const
const TestCase * GetTestCase(int i) const
bool Passed() const
int total_test_case_count() const
int test_case_to_run_count() const
const TestSuite * GetTestSuite(int i) const
const TestResult & ad_hoc_test_result() const
TestEventListeners & listeners()
TimeInMillis start_timestamp() const
int failed_test_case_count() const
int successful_test_case_count() const
int failed_test_count() const
int disabled_test_count() const
int total_test_count() const
Definition: gtest.h:14184
static const ParamType & GetParam()
Definition: gtest.h:14191
T ParamType
Definition: gtest.h:14186
virtual ~WithParamInterface()
Definition: gtest.h:14187
static void PrintValue(const T &value, ::std::ostream *os)
Definition: gtest.h:8050
static void PrintValue(const T &value, ::std::ostream *os)
Definition: gtest.h:8031
static void PrintValue(const T &value, ::std::ostream *os)
Definition: gtest.h:8015
Definition: gtest.h:14102
void operator=(const Message &message) const
AssertHelper(TestPartResult::Type type, const char *file, int line, const char *message)
ParamIteratorInterface< ParamType > * Begin() const override
Definition: gtest.h:11034
~CartesianProductGenerator() override
Definition: gtest.h:11032
ParamIteratorInterface< ParamType > * End() const override
Definition: gtest.h:11037
::std::tuple< T... > ParamType
Definition: gtest.h:11028
CartesianProductGenerator(const std::tuple< ParamGenerator< T >... > &g)
Definition: gtest.h:11030
CartesianProductHolder(const Gen &... g)
Definition: gtest.h:11143
Definition: gtest.h:13877
static AssertionResult Compare(const char *lhs_expression, const char *rhs_expression, const T1 &lhs, const T2 &rhs)
Definition: gtest.h:13886
static AssertionResult Compare(const char *lhs_expression, const char *rhs_expression, std::nullptr_t, T *rhs)
Definition: gtest.h:13906
static AssertionResult Compare(const char *lhs_expression, const char *rhs_expression, BiggestInt lhs, BiggestInt rhs)
Definition: gtest.h:13898
Definition: gtest.h:7547
ElemFromList< I, Indices, T... >::type & Get()
Definition: gtest.h:7560
FlatTuple(T... t)
Definition: gtest.h:7552
const ElemFromList< I, Indices, T... >::type & Get() const
Definition: gtest.h:7555
Definition: gtest.h:6598
static const Bits kFractionBitMask
Definition: gtest.h:6620
static const size_t kFractionBitCount
Definition: gtest.h:6610
FloatingPoint(const RawType &x)
Definition: gtest.h:6646
static const size_t kExponentBitCount
Definition: gtest.h:6614
bool is_nan() const
Definition: gtest.h:6682
static RawType Infinity()
Definition: gtest.h:6660
static const Bits kExponentBitMask
Definition: gtest.h:6624
bool AlmostEquals(const FloatingPoint &rhs) const
Definition: gtest.h:6694
Bits fraction_bits() const
Definition: gtest.h:6676
static const size_t kMaxUlps
Definition: gtest.h:6638
static const size_t kBitCount
Definition: gtest.h:6607
TypeWithSize< sizeof(RawType)>::UInt Bits
Definition: gtest.h:6602
static RawType ReinterpretBits(const Bits bits)
Definition: gtest.h:6653
static const Bits kSignBitMask
Definition: gtest.h:6617
const Bits & bits() const
Definition: gtest.h:6670
Bits exponent_bits() const
Definition: gtest.h:6673
Bits sign_bit() const
Definition: gtest.h:6679
::std::string Format(const ToPrint *value)
Definition: gtest.h:8184
::std::string Format(const ToPrint &value)
Definition: gtest.h:8175
Definition: gtest.h:1192
GTestLog(GTestLogSeverity severity, const char *file, int line)
::std::ostream & GetStream()
Definition: gtest.h:1199
Definition: gtest.h:2106
GTestMutexLock(Mutex *)
Definition: gtest.h:2108
Definition: gtest.h:6470
IgnoredValue(const T &)
Definition: gtest.h:6483
Definition: gtest.h:2088
void Unlock()
Definition: gtest.h:2092
Mutex()
Definition: gtest.h:2090
void Lock()
Definition: gtest.h:2091
void AssertHeld() const
Definition: gtest.h:2093
Definition: gtest.h:7395
Element value_type
Definition: gtest.h:7398
const_iterator begin() const
Definition: gtest.h:7424
NativeArray(const Element *array, size_t count, RelationToSourceReference)
Definition: gtest.h:7403
~NativeArray()
Definition: gtest.h:7417
bool operator==(const NativeArray &rhs) const
Definition: gtest.h:7426
const Element * const_iterator
Definition: gtest.h:7400
NativeArray(const NativeArray &rhs)
Definition: gtest.h:7413
Element * iterator
Definition: gtest.h:7399
NativeArray(const Element *array, size_t count, RelationToSourceCopy)
Definition: gtest.h:7408
const_iterator end() const
Definition: gtest.h:7425
size_t size() const
Definition: gtest.h:7423
virtual ParamIteratorInterface< T > * End() const =0
T ParamType
Definition: gtest.h:10440
virtual ~ParamGeneratorInterface()
Definition: gtest.h:10442
virtual ParamIteratorInterface< T > * Begin() const =0
Definition: gtest.h:10455
iterator begin() const
Definition: gtest.h:10467
ParamIterator< T > iterator
Definition: gtest.h:10457
ParamGenerator(const ParamGenerator &other)
Definition: gtest.h:10460
ParamGenerator(ParamGeneratorInterface< T > *impl)
Definition: gtest.h:10459
iterator end() const
Definition: gtest.h:10468
ParamGenerator & operator=(const ParamGenerator &other)
Definition: gtest.h:10462
virtual ParamIteratorInterface * Clone() const =0
virtual const ParamGeneratorInterface< T > * BaseGenerator() const =0
virtual const T * Current() const =0
virtual bool Equals(const ParamIteratorInterface &other) const =0
virtual ~ParamIteratorInterface()
Definition: gtest.h:10367
Definition: gtest.h:10395
T value_type
Definition: gtest.h:10397
ptrdiff_t difference_type
Definition: gtest.h:10399
const T & operator*() const
Definition: gtest.h:10409
bool operator!=(const ParamIterator &other) const
Definition: gtest.h:10425
ParamIterator & operator++()
Definition: gtest.h:10412
ParamIterator(const ParamIterator &other)
Definition: gtest.h:10402
const T * operator->() const
Definition: gtest.h:10410
const T & reference
Definition: gtest.h:10398
ParamIterator & operator=(const ParamIterator &other)
Definition: gtest.h:10403
bool operator==(const ParamIterator &other) const
Definition: gtest.h:10422
ParamIterator operator++(int)
Definition: gtest.h:10417
ParameterizedTestFactory(ParamType parameter)
Definition: gtest.h:10669
Test * CreateTest() override
Definition: gtest.h:10671
TestClass::ParamType ParamType
Definition: gtest.h:10668
ParameterizedTestSuiteInfoBase()
Definition: gtest.h:10743
virtual const std::string & GetTestSuiteName() const =0
virtual ~ParameterizedTestSuiteInfoBase()
Definition: gtest.h:10730
void AddTestPattern(const char *test_suite_name, const char *test_base_name, TestMetaFactoryBase< ParamType > *meta_factory)
Definition: gtest.h:10783
typename TestSuite::ParamType ParamType
Definition: gtest.h:10762
int AddTestSuiteInstantiation(const std::string &instantiation_name, GeneratorCreationFunc *func, ParamNameGeneratorFunc *name_func, const char *file, int line)
Definition: gtest.h:10790
std::string(const TestParamInfo< ParamType > &) ParamNameGeneratorFunc
Definition: gtest.h:10765
ParameterizedTestSuiteInfo(const char *name, CodeLocation code_location)
Definition: gtest.h:10767
void RegisterTests() override
Definition: gtest.h:10803
const std::string & GetTestSuiteName() const override
Definition: gtest.h:10772
TypeId GetTestSuiteTypeId() const override
Definition: gtest.h:10776
void RegisterTests()
Definition: gtest.h:10971
ParameterizedTestCaseInfo< TestCase > * GetTestCasePatternHolder(const char *test_case_name, CodeLocation code_location)
Definition: gtest.h:10979
ParameterizedTestSuiteInfo< TestSuite > * GetTestSuitePatternHolder(const char *test_suite_name, CodeLocation code_location)
Definition: gtest.h:10943
~ParameterizedTestSuiteRegistry()
Definition: gtest.h:10934
ParameterizedTestSuiteRegistry()
Definition: gtest.h:10933
Definition: gtest.h:1116
static bool PartialMatch(const ::std::string &str, const RE &re)
Definition: gtest.h:1138
static bool FullMatch(const char *str, const RE &re)
const char * pattern() const
Definition: gtest.h:1129
RE(const ::std::string &regex)
Definition: gtest.h:1123
RE(const char *regex)
Definition: gtest.h:1125
static bool PartialMatch(const char *str, const RE &re)
static bool FullMatch(const ::std::string &str, const RE &re)
Definition: gtest.h:1135
RE(const RE &other)
Definition: gtest.h:1120
Definition: gtest.h:7193
Random(UInt32 seed)
Definition: gtest.h:7197
UInt32 Generate(UInt32 range)
void Reseed(UInt32 seed)
Definition: gtest.h:7199
Definition: gtest.h:10479
RangeGenerator(T begin, T end, IncrementT step)
Definition: gtest.h:10481
~RangeGenerator() override
Definition: gtest.h:10484
ParamIteratorInterface< T > * Begin() const override
Definition: gtest.h:10486
ParamIteratorInterface< T > * End() const override
Definition: gtest.h:10489
Definition: gtest.h:6800
virtual ~TestFactoryBase()
Definition: gtest.h:6802
TestFactoryBase()
Definition: gtest.h:6809
Definition: gtest.h:6818
Test * CreateTest() override
Definition: gtest.h:6820
virtual ~TestMetaFactoryBase()
Definition: gtest.h:10689
virtual TestFactoryBase * CreateTestFactory(ParamType parameter)=0
Definition: gtest.h:10704
TestMetaFactory()
Definition: gtest.h:10708
typename TestSuite::ParamType ParamType
Definition: gtest.h:10706
TestFactoryBase * CreateTestFactory(ParamType parameter) override
Definition: gtest.h:10710
Definition: gtest.h:2114
ThreadLocal()
Definition: gtest.h:2116
T * pointer()
Definition: gtest.h:2118
ThreadLocal(const T &value)
Definition: gtest.h:2117
void set(const T &value)
Definition: gtest.h:2121
const T * pointer() const
Definition: gtest.h:2119
const T & get() const
Definition: gtest.h:2120
Definition: gtest.h:6768
static bool dummy_
Definition: gtest.h:6773
unsigned int UInt
Definition: gtest.h:2378
int Int
Definition: gtest.h:2377
long long Int
Definition: gtest.h:2389
unsigned long long UInt
Definition: gtest.h:2390
Definition: gtest.h:2362
void UInt
Definition: gtest.h:2366
static void Print(const T(&a)[N], ::std::ostream *os)
Definition: gtest.h:8626
Definition: gtest.h:8523
static void Print(const T &value, ::std::ostream *os)
Definition: gtest.h:8532
static void Print(const T &value, ::std::ostream *os)
Definition: gtest.h:8665
static void Print(const T(&value)[N], ::std::ostream *os)
Definition: gtest.h:8672
static void Print(char *str, ::std::ostream *os)
Definition: gtest.h:8690
static void Print(const char *str, ::std::ostream *os)
Definition: gtest.h:8679
static void Print(const wchar_t *str, ::std::ostream *os)
Definition: gtest.h:8699
static void Print(wchar_t *str, ::std::ostream *os)
Definition: gtest.h:8712
static void Print(const T &value, ::std::ostream *os)
Definition: gtest.h:8658
Definition: gtest.h:11006
ValueArray(Ts... v)
Definition: gtest.h:11008
ParamIteratorInterface< T > * End() const override
Definition: gtest.h:10574
ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
Definition: gtest.h:10567
~ValuesInIteratorRangeGenerator() override
Definition: gtest.h:10569
ParamIteratorInterface< T > * Begin() const override
Definition: gtest.h:10571
#define TEST_F(test_fixture, test_name)
Definition: gtest.h:14703
#define GTEST_DECLARE_bool_(name)
Definition: gtest.h:2416
#define TEST_P(test_suite_name, test_name)
Definition: gtest.h:11389
#define GTEST_CHECK_POSIX_SUCCESS_(posix_call)
Definition: gtest.h:1246
#define GTEST_IMPL_CMP_HELPER_(op_name, op)
Definition: gtest.h:13940
#define GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
Definition: gtest.h:564
#define GTEST_LOCK_EXCLUDED_(locks)
Definition: gtest.h:2435
#define GTEST_INTENTIONAL_CONST_COND_PUSH_()
Definition: gtest.h:951
#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name,...)
Definition: gtest.h:11435
#define GTEST_MAYBE_5046_
Definition: gtest.h:8837
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: gtest.h:14807
#define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
Definition: gtest.h:550
#define GTEST_MUST_USE_RESULT_
Definition: gtest.h:940
#define GTEST_DECLARE_string_(name)
Definition: gtest.h:2419
#define GTEST_DISABLE_MSC_DEPRECATED_POP_()
Definition: gtest.h:566
#define GTEST_API_
Definition: gtest.h:999
#define GTEST_DECLARE_int32_(name)
Definition: gtest.h:2417
#define GTEST_CHECK_(condition)
Definition: gtest.h:1233
#define EXPECT_TRUE(condition)
Definition: gtest.h:14303
#define GTEST_DISALLOW_ASSIGN_(type)
Definition: gtest.h:923
#define GTEST_INTENTIONAL_CONST_COND_POP_()
Definition: gtest.h:953
#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
Definition: gtest.h:917
#define GTEST_DISABLE_MSC_WARNINGS_POP_()
Definition: gtest.h:551
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
Definition: gtest.h:928
#define true
Definition: msvc_stdbool.h:18
#define false
Definition: msvc_stdbool.h:19
char bool
Definition: msvc_stdbool.h:17
StdString::RegexMatcher Matches(std::string const &regex, CaseSensitive::Choice caseSensitivity=CaseSensitive::Yes)
StdString::EqualsMatcher Equals(std::string const &str, CaseSensitive::Choice caseSensitivity=CaseSensitive::Yes)
std::ostream & cerr()
not_this_one begin(...)
void write(const ::Opm::EclipseState &es, const ::Opm::EclipseGrid &grid, const ::Opm::Schedule &schedule, const ::Opm::data::Solution &simProps, std::map< std::string, std::vector< int > > int_data, const ::Opm::NNC &nnc, ::Opm::EclIO::OutputStream::Init &initFile)
function get(const std::string &func, double alpha, double beta)
constexpr double to(const double q, const double unit)
Definition: custom-opm-common/opm-common/opm/parser/eclipse/Units/Units.hpp:247
constexpr double from(const double q, const double unit)
Definition: custom-opm-common/opm-common/opm/parser/eclipse/Units/Units.hpp:224
status
Definition: value_status.hpp:27
@ end
Definition: ActionValue.hpp:20
std::string extension(const std::string &fname)
bool is_function(const expression_node< T > *node)
Definition: exprtk.hpp:5363
const T1 const T2 const T3
Definition: exprtk.hpp:14424
const T1
Definition: exprtk.hpp:14380
T value(details::expression_node< T > *n)
Definition: exprtk.hpp:12955
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t t(t+t)") define_sfop3(16
const T1 const T2
Definition: exprtk.hpp:14402
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t x(y+z)
Definition: gtest.h:6443
Definition: gtest.h:7986
const size_t kProtobufOneLinerMaxLength
Definition: gtest.h:8026
GTEST_API_ void PrintBytesInObjectTo(const unsigned char *obj_bytes, size_t count, ::std::ostream *os)
::std::basic_ostream< Char, CharTraits > & operator<<(::std::basic_ostream< Char, CharTraits > &os, const T &x)
Definition: gtest.h:8094
TypeKind
Definition: gtest.h:7996
@ kProtobuf
Definition: gtest.h:7997
@ kConvertibleToInteger
Definition: gtest.h:7998
@ kOtherType
Definition: gtest.h:8004
GTEST_API_ std::vector< EditType > CalculateOptimalEdits(const std::vector< size_t > &left, const std::vector< size_t > &right)
GTEST_API_ std::string CreateUnifiedDiff(const std::vector< std::string > &left, const std::vector< std::string > &right, size_t context=2)
EditType
Definition: gtest.h:6516
@ kAdd
Definition: gtest.h:6516
@ kMatch
Definition: gtest.h:6516
@ kRemove
Definition: gtest.h:6516
@ kReplace
Definition: gtest.h:6516
int Close(int fd)
Definition: gtest.h:2286
int IsATTY(int fd)
Definition: gtest.h:2243
int ChDir(const char *dir)
Definition: gtest.h:2267
int StrCaseCmp(const char *s1, const char *s2)
Definition: gtest.h:2245
int Stat(const char *path, StatStruct *buf)
Definition: gtest.h:2244
int FileNo(FILE *file)
Definition: gtest.h:2242
int Read(int fd, void *buf, unsigned int count)
Definition: gtest.h:2280
const char * StrNCpy(char *dest, const char *src, size_t n)
Definition: gtest.h:2258
char * StrDup(const char *src)
Definition: gtest.h:2248
void Abort()
Definition: gtest.h:2312
const char * StrError(int errnum)
Definition: gtest.h:2287
FILE * FReopen(const char *path, const char *mode, FILE *stream)
Definition: gtest.h:2273
FILE * FDOpen(int fd, const char *mode)
Definition: gtest.h:2276
struct stat StatStruct
Definition: gtest.h:2240
const char * GetEnv(const char *name)
Definition: gtest.h:2289
int RmDir(const char *dir)
Definition: gtest.h:2249
bool IsDir(const StatStruct &st)
Definition: gtest.h:2250
int Write(int fd, const void *buf, unsigned int count)
Definition: gtest.h:2283
int FClose(FILE *fp)
Definition: gtest.h:2278
FILE * FOpen(const char *path, const char *mode)
Definition: gtest.h:2269
GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
FloatingPoint< float > Float
Definition: gtest.h:6756
void(*)() SetUpTearDownSuiteFuncType
Definition: gtest.h:6852
long long BiggestInt
Definition: gtest.h:2143
void LogToStderr()
Definition: gtest.h:1213
GTestMutexLock MutexLock
Definition: gtest.h:2111
std::string OutputFlagAlsoCheckEnvVar()
DefaultPrinterType
Definition: gtest.h:8257
@ kPrintFunctionPointer
Definition: gtest.h:8260
@ kPrintOther
Definition: gtest.h:8261
@ kPrintPointer
Definition: gtest.h:8259
@ kPrintContainer
Definition: gtest.h:8258
To DownCast_(From *f)
Definition: gtest.h:1316
AssertionResult CmpHelperEQFailure(const char *lhs_expression, const char *rhs_expression, const T1 &lhs, const T2 &rhs)
Definition: gtest.h:13839
GTEST_API_ TypeId GetTestTypeId()
GTEST_API_ AssertionResult CmpHelperEQ(const char *lhs_expression, const char *rhs_expression, BiggestInt lhs, BiggestInt rhs)
GTEST_API_::std::string FormatCompilerIndependentFileLocation(const char *file, int line)
void FlushInfoLog()
Definition: gtest.h:1214
GTEST_API_ Int32 Int32FromGTestEnv(const char *flag, Int32 default_val)
TypeWithSize< 8 >::Int Int64
Definition: gtest.h:2397
void DefaultPrintTo(WrapPrinterType< kPrintContainer >, const C &container, ::std::ostream *os)
Definition: gtest.h:8268
void UniversalPrint(const T &value, ::std::ostream *os)
Definition: gtest.h:8727
GTEST_API_::std::string FormatFileLocation(const char *file, int line)
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char)
GTEST_API_ std::string GetCapturedStderr()
GTEST_API_ size_t GetFileSize(FILE *file)
TypeWithSize< 4 >::UInt UInt32
Definition: gtest.h:2396
bool AlwaysFalse()
Definition: gtest.h:7177
bool IsDigit(char ch)
Definition: gtest.h:2159
GTEST_API_ bool AlwaysTrue()
::std::vector< ::std::string > Strings
Definition: gtest.h:8734
GTEST_API_ std::string DiffStrings(const std::string &left, const std::string &right, size_t *total_line_count)
GTEST_API_ void ReportInvalidTestSuiteType(const char *test_suite_name, CodeLocation code_location)
bool operator==(faketype, faketype)
Definition: gtest.h:13853
GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
void TersePrintPrefixToStrings(const Tuple &, std::integral_constant< size_t, 0 >, Strings *)
Definition: gtest.h:8739
GTestColor
Definition: gtest.h:14141
@ COLOR_YELLOW
Definition: gtest.h:14141
@ COLOR_GREEN
Definition: gtest.h:14141
@ COLOR_RED
Definition: gtest.h:14141
@ COLOR_DEFAULT
Definition: gtest.h:14141
FloatingPoint< double > Double
Definition: gtest.h:6757
TypeWithSize< 8 >::Int TimeInMillis
Definition: gtest.h:2399
bool BoolFromGTestEnv(const char *flag, bool default_val)
TypeId GetTypeId()
Definition: gtest.h:6783
GTEST_API_ AssertionResult CmpHelperSTRNE(const char *s1_expression, const char *s2_expression, const wchar_t *s1, const wchar_t *s2)
void PrintTupleTo(const T &, std::integral_constant< size_t, 0 >, ::std::ostream *)
Definition: gtest.h:8485
IsContainer IsContainerTest(int)
Definition: gtest.h:7252
Strings UniversalTersePrintTupleFieldsToStrings(const Tuple &value)
Definition: gtest.h:8756
const char * StringFromGTestEnv(const char *flag, const char *default_val)
void(*)() TearDownTestSuiteFunc
Definition: gtest.h:6838
bool IsAlNum(char ch)
Definition: gtest.h:2156
void(*)() SetUpTestSuiteFunc
Definition: gtest.h:6837
bool IsUpper(char ch)
Definition: gtest.h:2168
AssertionResult CmpHelperOpFailure(const char *expr1, const char *expr2, const T1 &val1, const T2 &val2, const char *op)
Definition: gtest.h:13920
GTEST_API_ void PrintStringTo(const ::std::string &s, ::std::ostream *os)
GTEST_API_ size_t GetThreadCount()
std::integral_constant< bool, B > bool_constant
Definition: gtest.h:2133
GTEST_API_ void CaptureStderr()
TypeWithSize< 4 >::Int Int32
Definition: gtest.h:2395
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
Definition: gtest.h:8239
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)
Iter ArrayAwareFind(Iter begin, Iter end, const Element &elem)
Definition: gtest.h:7344
std::string DefaultParamName(const TestParamInfo< ParamType > &info)
Definition: gtest.h:10648
SetUpTearDownSuiteFuncType GetNotDefaultOrNull(SetUpTearDownSuiteFuncType a, SetUpTearDownSuiteFuncType def)
Definition: gtest.h:6854
To ImplicitCast_(To x)
Definition: gtest.h:1292
AssertionResult CmpHelperFloatingPointEQ(const char *lhs_expression, const char *rhs_expression, RawType lhs_value, RawType rhs_value)
Definition: gtest.h:14065
GTEST_API_ const char kStackTraceMarker[]
void TestNotEmpty()
Definition: gtest.h:10655
bool IsXDigit(char ch)
Definition: gtest.h:2171
GTestLogSeverity
Definition: gtest.h:1182
@ GTEST_ERROR
Definition: gtest.h:1185
@ GTEST_FATAL
Definition: gtest.h:1186
@ GTEST_WARNING
Definition: gtest.h:1184
@ GTEST_INFO
Definition: gtest.h:1183
TypeWithSize< 8 >::UInt UInt64
Definition: gtest.h:2398
std::string StripTrailingSpaces(std::string str)
Definition: gtest.h:2186
GTEST_API_ bool SkipPrefix(const char *prefix, const char **pstr)
std::string StreamableToString(const T &streamable)
Definition: gtest.h:2704
GTEST_API_ std::vector< std::string > GetArgvs()
const void * TypeId
Definition: gtest.h:6765
GTEST_API_ bool IsTrue(bool condition)
GTEST_API_ std::string ReadEntireFile(FILE *file)
char IsNotContainer
Definition: gtest.h:7256
bool ParseInt32(const Message &src_text, const char *str, Int32 *value)
char ToUpper(char ch)
Definition: gtest.h:2182
bool IsLower(char ch)
Definition: gtest.h:2162
GTEST_INTERNAL_DEPRECATED("INSTANTIATE_TEST_CASE_P is deprecated, please use " "INSTANTIATE_TEST_SUITE_P") const expr bool InstantiateTestCase_P_IsDeprecated()
Definition: gtest.h:7567
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)
GTEST_API_ void CaptureStdout()
void PrintRawArrayTo(const T a[], size_t count, ::std::ostream *os)
Definition: gtest.h:8446
GTEST_API_ AssertionResult CmpHelperSTREQ(const char *s1_expression, const char *s2_expression, const wchar_t *s1, const wchar_t *s2)
void UniversalPrintArray(const T *begin, size_t len, ::std::ostream *os)
Definition: gtest.h:8592
int IsContainer
Definition: gtest.h:7245
const BiggestInt kMaxBiggestInt
Definition: gtest.h:2340
char ToLower(char ch)
Definition: gtest.h:2179
void PrintTo(const T &value, ::std::ostream *os)
Definition: gtest.h:8345
GTEST_API_ void PrintWideStringTo(const ::std::wstring &s, ::std::ostream *os)
GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(UnitTest *unit_test, int skip_count)
GTEST_API_ AssertionResult DoubleNearPredFormat(const char *expr1, const char *expr2, const char *abs_error_expr, double val1, double val2, double abs_error)
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string)
bool IsAlpha(char ch)
Definition: gtest.h:2153
GTEST_API_ std::string GetCapturedStdout()
GTEST_API_ std::string GetBoolAssertionFailureMessage(const AssertionResult &assertion_result, const char *expression_text, const char *actual_predicate_value, const char *expected_predicate_value)
bool IsSpace(char ch)
Definition: gtest.h:2165
bool ArrayEq(const T *lhs, size_t size, const U *rhs)
Definition: gtest.h:7333
Derived * CheckedDowncastToActualType(Base *base)
Definition: gtest.h:1341
GTEST_API_ std::string AppendUserMessage(const std::string &gtest_msg, const Message &user_msg)
bool operator!=(faketype, faketype)
Definition: gtest.h:13854
void UniversalTersePrint(const T &value, ::std::ostream *os)
Definition: gtest.h:8718
void CopyArray(const T *from, size_t size, U *to)
Definition: gtest.h:7373
Definition: gtest.h:8117
void DefaultPrintNonContainerTo(const T &value, ::std::ostream *os)
Definition: gtest.h:8122
Definition: gtest.h:1071
internal::ParamGenerator< bool > Bool()
Definition: gtest.h:11334
Environment * AddGlobalTestEnvironment(Environment *env)
Definition: gtest.h:13810
std::ostream & operator<<(std::ostream &os, const Message &sb)
Definition: gtest.h:2693
GTEST_DECLARE_string_(death_test_style)
internal::ParamGenerator< T > Range(T start, T end, IncrementT step)
Definition: gtest.h:11204
GTEST_API_ AssertionResult IsSubstring(const char *needle_expr, const char *haystack_expr, const char *needle, const char *haystack)
GTEST_API_ AssertionResult FloatLE(const char *expr1, const char *expr2, float val1, float val2)
AssertionResult AssertPred1Helper(const char *pred_text, const char *e1, Pred pred, const T1 &v1)
Definition: gtest.h:12438
constexpr bool StaticAssertTypeEq() noexcept
Definition: gtest.h:14635
GTEST_API_ AssertionResult DoubleLE(const char *expr1, const char *expr2, double val1, double val2)
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:14773
internal::TimeInMillis TimeInMillis
Definition: gtest.h:12854
::std::string PrintToString(const T &value)
Definition: gtest.h:8777
AssertionResult AssertPred2Helper(const char *pred_text, const char *e1, const char *e2, Pred pred, const T1 &v1, const T2 &v2)
Definition: gtest.h:12481
internal::ParamGenerator< typename Container::value_type > ValuesIn(const Container &container)
Definition: gtest.h:11284
internal::CartesianProductHolder< Generator... > Combine(const Generator &... g)
Definition: gtest.h:11385
GTEST_API_ AssertionResult IsNotSubstring(const char *needle_expr, const char *haystack_expr, const char *needle, const char *haystack)
GTEST_API_ std::string TempDir()
internal::ValueArray< T... > Values(T... v)
Definition: gtest.h:11310
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:12531
class GTEST_API_ testing::ScopedTrace GTEST_ATTRIBUTE_UNUSED_
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:12649
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:12587
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
internal::ParamGenerator< T > ValuesIn(const T(&array)[N])
Definition: gtest.h:11279
Definition: gtest.h:10340
std::string operator()(const TestParamInfo< ParamType > &info) const
Definition: gtest.h:10342
Definition: gtest.h:10330
ParamType param
Definition: gtest.h:10334
TestParamInfo(const ParamType &a_param, size_t an_index)
Definition: gtest.h:10331
size_t index
Definition: gtest.h:10335
Definition: gtest.h:6840
int line
Definition: gtest.h:6845
CodeLocation(const std::string &a_file, int a_line)
Definition: gtest.h:6841
std::string file
Definition: gtest.h:6844
Definition: gtest.h:7182
const char * value
Definition: gtest.h:7185
ConstCharPtr(const char *str)
Definition: gtest.h:7183
T & type
Definition: gtest.h:1265
Definition: gtest.h:1263
const T & type
Definition: gtest.h:1263
Definition: gtest.h:7467
Definition: gtest.h:7491
Definition: gtest.h:7501
Definition: gtest.h:7524
FlatTupleElemBase(value_type t)
Definition: gtest.h:7519
typename ElemFromList< I, typename MakeIndexSequence< sizeof...(T)>::type, T... >::type value_type
Definition: gtest.h:7517
Definition: gtest.h:7511
Definition: gtest.h:7461
Definition: gtest.h:7265
decltype(*std::declval< typename C::const_iterator >()) value_type
Definition: gtest.h:7294
std::is_same< typename std::remove_const< typename std::remove_reference< value_type >::type >::type, C > type
Definition: gtest.h:7298
Definition: gtest.h:7482
Definition: gtest.h:6863
typename std::conditional< sizeof(T) !=0, ::testing::Test, void >::type Test
Definition: gtest.h:6867
static SetUpTearDownSuiteFuncType GetTearDownCaseOrSuite(const char *filename, int line_num)
Definition: gtest.h:6884
static SetUpTearDownSuiteFuncType GetSetUpCaseOrSuite(const char *filename, int line_num)
Definition: gtest.h:6869
Definition: gtest.h:8263
Definition: gtest.h:13852