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// Author: wan@google.com (Zhanyong Wan)
31//
32// The Google C++ Testing Framework (Google Test)
33//
34// This header file defines the public API for Google Test.  It should be
35// included by any test program that uses Google Test.
36//
37// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
38// leave some internal implementation details in this header file.
39// They are clearly marked by comments like this:
40//
41//   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
42//
43// Such code is NOT meant to be used by a user directly, and is subject
44// to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user
45// program!
46//
47// Acknowledgment: Google Test borrowed the idea of automatic test
48// registration from Barthelemy Dagenais' (barthelemy@prologique.com)
49// easyUnit framework.
50
51#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
52#define GTEST_INCLUDE_GTEST_GTEST_H_
53
54#include <limits>
55#include <vector>
56
57// Copyright 2005, Google Inc.
58// All rights reserved.
59//
60// Redistribution and use in source and binary forms, with or without
61// modification, are permitted provided that the following conditions are
62// met:
63//
64//     * Redistributions of source code must retain the above copyright
65// notice, this list of conditions and the following disclaimer.
66//     * Redistributions in binary form must reproduce the above
67// copyright notice, this list of conditions and the following disclaimer
68// in the documentation and/or other materials provided with the
69// distribution.
70//     * Neither the name of Google Inc. nor the names of its
71// contributors may be used to endorse or promote products derived from
72// this software without specific prior written permission.
73//
74// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
75// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
76// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
77// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
78// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
79// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
80// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
81// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
82// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
83// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
84// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
85//
86// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
87//
88// The Google C++ Testing Framework (Google Test)
89//
90// This header file declares functions and macros used internally by
91// Google Test.  They are subject to change without notice.
92
93#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
94#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
95
96// Copyright 2005, Google Inc.
97// All rights reserved.
98//
99// Redistribution and use in source and binary forms, with or without
100// modification, are permitted provided that the following conditions are
101// met:
102//
103//     * Redistributions of source code must retain the above copyright
104// notice, this list of conditions and the following disclaimer.
105//     * Redistributions in binary form must reproduce the above
106// copyright notice, this list of conditions and the following disclaimer
107// in the documentation and/or other materials provided with the
108// distribution.
109//     * Neither the name of Google Inc. nor the names of its
110// contributors may be used to endorse or promote products derived from
111// this software without specific prior written permission.
112//
113// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
114// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
115// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
116// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
117// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
118// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
119// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
120// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
121// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
122// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
123// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
124//
125// Authors: wan@google.com (Zhanyong Wan)
126//
127// Low-level types and utilities for porting Google Test to various
128// platforms.  They are subject to change without notice.  DO NOT USE
129// THEM IN USER CODE.
130
131#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
132#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
133
134// The user can define the following macros in the build script to
135// control Google Test's behavior.  If the user doesn't define a macro
136// in this list, Google Test will define it.
137//
138//   GTEST_HAS_CLONE          - Define it to 1/0 to indicate that clone(2)
139//                              is/isn't available.
140//   GTEST_HAS_EXCEPTIONS     - Define it to 1/0 to indicate that exceptions
141//                              are enabled.
142//   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string
143//                              is/isn't available (some systems define
144//                              ::string, which is different to std::string).
145//   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
146//                              is/isn't available (some systems define
147//                              ::wstring, which is different to std::wstring).
148//   GTEST_HAS_POSIX_RE       - Define it to 1/0 to indicate that POSIX regular
149//                              expressions are/aren't available.
150//   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h>
151//                              is/isn't available.
152//   GTEST_HAS_RTTI           - Define it to 1/0 to indicate that RTTI is/isn't
153//                              enabled.
154//   GTEST_HAS_STD_WSTRING    - Define it to 1/0 to indicate that
155//                              std::wstring does/doesn't work (Google Test can
156//                              be used where std::wstring is unavailable).
157//   GTEST_HAS_TR1_TUPLE      - Define it to 1/0 to indicate tr1::tuple
158//                              is/isn't available.
159//   GTEST_HAS_SEH            - Define it to 1/0 to indicate whether the
160//                              compiler supports Microsoft's "Structured
161//                              Exception Handling".
162//   GTEST_HAS_STREAM_REDIRECTION
163//                            - Define it to 1/0 to indicate whether the
164//                              platform supports I/O stream redirection using
165//                              dup() and dup2().
166//   GTEST_USE_OWN_TR1_TUPLE  - Define it to 1/0 to indicate whether Google
167//                              Test's own tr1 tuple implementation should be
168//                              used.  Unused when the user sets
169//                              GTEST_HAS_TR1_TUPLE to 0.
170//   GTEST_LINKED_AS_SHARED_LIBRARY
171//                            - Define to 1 when compiling tests that use
172//                              Google Test as a shared library (known as
173//                              DLL on Windows).
174//   GTEST_CREATE_SHARED_LIBRARY
175//                            - Define to 1 when compiling Google Test itself
176//                              as a shared library.
177
178// This header defines the following utilities:
179//
180// Macros indicating the current platform (defined to 1 if compiled on
181// the given platform; otherwise undefined):
182//   GTEST_OS_AIX      - IBM AIX
183//   GTEST_OS_CYGWIN   - Cygwin
184//   GTEST_OS_HPUX     - HP-UX
185//   GTEST_OS_LINUX    - Linux
186//     GTEST_OS_LINUX_ANDROID - Google Android
187//   GTEST_OS_MAC      - Mac OS X
188//   GTEST_OS_NACL     - Google Native Client (NaCl)
189//   GTEST_OS_SOLARIS  - Sun Solaris
190//   GTEST_OS_SYMBIAN  - Symbian
191//   GTEST_OS_WINDOWS  - Windows (Desktop, MinGW, or Mobile)
192//     GTEST_OS_WINDOWS_DESKTOP  - Windows Desktop
193//     GTEST_OS_WINDOWS_MINGW    - MinGW
194//     GTEST_OS_WINDOWS_MOBILE   - Windows Mobile
195//   GTEST_OS_ZOS      - z/OS
196//
197// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
198// most stable support.  Since core members of the Google Test project
199// don't have access to other platforms, support for them may be less
200// stable.  If you notice any problems on your platform, please notify
201// googletestframework@googlegroups.com (patches for fixing them are
202// even more welcome!).
203//
204// Note that it is possible that none of the GTEST_OS_* macros are defined.
205//
206// Macros indicating available Google Test features (defined to 1 if
207// the corresponding feature is supported; otherwise undefined):
208//   GTEST_HAS_COMBINE      - the Combine() function (for value-parameterized
209//                            tests)
210//   GTEST_HAS_DEATH_TEST   - death tests
211//   GTEST_HAS_PARAM_TEST   - value-parameterized tests
212//   GTEST_HAS_TYPED_TEST   - typed tests
213//   GTEST_HAS_TYPED_TEST_P - type-parameterized tests
214//   GTEST_USES_POSIX_RE    - enhanced POSIX regex is used. Do not confuse with
215//                            GTEST_HAS_POSIX_RE (see above) which users can
216//                            define themselves.
217//   GTEST_USES_SIMPLE_RE   - our own simple regex is used;
218//                            the above two are mutually exclusive.
219//   GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
220//
221// Macros for basic C++ coding:
222//   GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
223//   GTEST_ATTRIBUTE_UNUSED_  - declares that a class' instances or a
224//                              variable don't have to be used.
225//   GTEST_DISALLOW_ASSIGN_   - disables operator=.
226//   GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
227//   GTEST_MUST_USE_RESULT_   - declares that a function's result must be used.
228//
229// Synchronization:
230//   Mutex, MutexLock, ThreadLocal, GetThreadCount()
231//                  - synchronization primitives.
232//   GTEST_IS_THREADSAFE - defined to 1 to indicate that the above
233//                         synchronization primitives have real implementations
234//                         and Google Test is thread-safe; or 0 otherwise.
235//
236// Template meta programming:
237//   is_pointer     - as in TR1; needed on Symbian and IBM XL C/C++ only.
238//   IteratorTraits - partial implementation of std::iterator_traits, which
239//                    is not available in libCstd when compiled with Sun C++.
240//
241// Smart pointers:
242//   scoped_ptr     - as in TR2.
243//
244// Regular expressions:
245//   RE             - a simple regular expression class using the POSIX
246//                    Extended Regular Expression syntax on UNIX-like
247//                    platforms, or a reduced regular exception syntax on
248//                    other platforms, including Windows.
249//
250// Logging:
251//   GTEST_LOG_()   - logs messages at the specified severity level.
252//   LogToStderr()  - directs all log messages to stderr.
253//   FlushInfoLog() - flushes informational log messages.
254//
255// Stdout and stderr capturing:
256//   CaptureStdout()     - starts capturing stdout.
257//   GetCapturedStdout() - stops capturing stdout and returns the captured
258//                         string.
259//   CaptureStderr()     - starts capturing stderr.
260//   GetCapturedStderr() - stops capturing stderr and returns the captured
261//                         string.
262//
263// Integer types:
264//   TypeWithSize   - maps an integer to a int type.
265//   Int32, UInt32, Int64, UInt64, TimeInMillis
266//                  - integers of known sizes.
267//   BiggestInt     - the biggest signed integer type.
268//
269// Command-line utilities:
270//   GTEST_FLAG()       - references a flag.
271//   GTEST_DECLARE_*()  - declares a flag.
272//   GTEST_DEFINE_*()   - defines a flag.
273//   GetArgvs()         - returns the command line as a vector of strings.
274//
275// Environment variable utilities:
276//   GetEnv()             - gets the value of an environment variable.
277//   BoolFromGTestEnv()   - parses a bool environment variable.
278//   Int32FromGTestEnv()  - parses an Int32 environment variable.
279//   StringFromGTestEnv() - parses a string environment variable.
280
281#include <ctype.h>   // for isspace, etc
282#include <stddef.h>  // for ptrdiff_t
283#include <stdlib.h>
284#include <stdio.h>
285#include <string.h>
286#ifndef _WIN32_WCE
287# include <sys/types.h>
288# include <sys/stat.h>
289#endif  // !_WIN32_WCE
290
291#include <iostream>  // NOLINT
292#include <sstream>  // NOLINT
293#include <string>  // NOLINT
294
295#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
296#define GTEST_FLAG_PREFIX_ "gtest_"
297#define GTEST_FLAG_PREFIX_DASH_ "gtest-"
298#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
299#define GTEST_NAME_ "Google Test"
300#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
301
302// Determines the version of gcc that is used to compile this.
303#ifdef __GNUC__
304// 40302 means version 4.3.2.
305# define GTEST_GCC_VER_ \
306    (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
307#endif  // __GNUC__
308
309// Determines the platform on which Google Test is compiled.
310#ifdef __CYGWIN__
311# define GTEST_OS_CYGWIN 1
312#elif defined __SYMBIAN32__
313# define GTEST_OS_SYMBIAN 1
314#elif defined _WIN32
315# define GTEST_OS_WINDOWS 1
316# ifdef _WIN32_WCE
317#  define GTEST_OS_WINDOWS_MOBILE 1
318# elif defined(__MINGW__) || defined(__MINGW32__)
319#  define GTEST_OS_WINDOWS_MINGW 1
320# else
321#  define GTEST_OS_WINDOWS_DESKTOP 1
322# endif  // _WIN32_WCE
323#elif defined __APPLE__
324# define GTEST_OS_MAC 1
325#elif defined __linux__
326# define GTEST_OS_LINUX 1
327# ifdef ANDROID
328#  define GTEST_OS_LINUX_ANDROID 1
329# endif  // ANDROID
330#elif defined __MVS__
331# define GTEST_OS_ZOS 1
332#elif defined(__sun) && defined(__SVR4)
333# define GTEST_OS_SOLARIS 1
334#elif defined(_AIX)
335# define GTEST_OS_AIX 1
336#elif defined(__hpux)
337# define GTEST_OS_HPUX 1
338#elif defined __native_client__
339# define GTEST_OS_NACL 1
340#endif  // __CYGWIN__
341
342// Brings in definitions for functions used in the testing::internal::posix
343// namespace (read, write, close, chdir, isatty, stat). We do not currently
344// use them on Windows Mobile.
345#if !GTEST_OS_WINDOWS
346// This assumes that non-Windows OSes provide unistd.h. For OSes where this
347// is not the case, we need to include headers that provide the functions
348// mentioned above.
349# include <unistd.h>
350# if !GTEST_OS_NACL
351// TODO(vladl@google.com): Remove this condition when Native Client SDK adds
352// strings.h (tracked in
353// http://code.google.com/p/nativeclient/issues/detail?id=1175).
354#  include <strings.h>  // Native Client doesn't provide strings.h.
355# endif
356#elif !GTEST_OS_WINDOWS_MOBILE
357# include <direct.h>
358# include <io.h>
359#endif
360
361// Defines this to true iff Google Test can use POSIX regular expressions.
362#ifndef GTEST_HAS_POSIX_RE
363# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
364#endif
365
366#if GTEST_HAS_POSIX_RE
367
368// On some platforms, <regex.h> needs someone to define size_t, and
369// won't compile otherwise.  We can #include it here as we already
370// included <stdlib.h>, which is guaranteed to define size_t through
371// <stddef.h>.
372# include <regex.h>  // NOLINT
373
374# define GTEST_USES_POSIX_RE 1
375
376#elif GTEST_OS_WINDOWS
377
378// <regex.h> is not available on Windows.  Use our own simple regex
379// implementation instead.
380# define GTEST_USES_SIMPLE_RE 1
381
382#else
383
384// <regex.h> may not be available on this platform.  Use our own
385// simple regex implementation instead.
386# define GTEST_USES_SIMPLE_RE 1
387
388#endif  // GTEST_HAS_POSIX_RE
389
390#ifndef GTEST_HAS_EXCEPTIONS
391// The user didn't tell us whether exceptions are enabled, so we need
392// to figure it out.
393# if defined(_MSC_VER) || defined(__BORLANDC__)
394// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
395// macro to enable exceptions, so we'll do the same.
396// Assumes that exceptions are enabled by default.
397#  ifndef _HAS_EXCEPTIONS
398#   define _HAS_EXCEPTIONS 1
399#  endif  // _HAS_EXCEPTIONS
400#  define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
401# elif defined(__GNUC__) && __EXCEPTIONS
402// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
403#  define GTEST_HAS_EXCEPTIONS 1
404# elif defined(__SUNPRO_CC)
405// Sun Pro CC supports exceptions.  However, there is no compile-time way of
406// detecting whether they are enabled or not.  Therefore, we assume that
407// they are enabled unless the user tells us otherwise.
408#  define GTEST_HAS_EXCEPTIONS 1
409# elif defined(__IBMCPP__) && __EXCEPTIONS
410// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
411#  define GTEST_HAS_EXCEPTIONS 1
412# elif defined(__HP_aCC)
413// Exception handling is in effect by default in HP aCC compiler. It has to
414// be turned of by +noeh compiler option if desired.
415#  define GTEST_HAS_EXCEPTIONS 1
416# else
417// For other compilers, we assume exceptions are disabled to be
418// conservative.
419#  define GTEST_HAS_EXCEPTIONS 0
420# endif  // defined(_MSC_VER) || defined(__BORLANDC__)
421#endif  // GTEST_HAS_EXCEPTIONS
422
423#if !defined(GTEST_HAS_STD_STRING)
424// Even though we don't use this macro any longer, we keep it in case
425// some clients still depend on it.
426# define GTEST_HAS_STD_STRING 1
427#elif !GTEST_HAS_STD_STRING
428// The user told us that ::std::string isn't available.
429# error "Google Test cannot be used where ::std::string isn't available."
430#endif  // !defined(GTEST_HAS_STD_STRING)
431
432#ifndef GTEST_HAS_GLOBAL_STRING
433// The user didn't tell us whether ::string is available, so we need
434// to figure it out.
435
436# define GTEST_HAS_GLOBAL_STRING 0
437
438#endif  // GTEST_HAS_GLOBAL_STRING
439
440#ifndef GTEST_HAS_STD_WSTRING
441// The user didn't tell us whether ::std::wstring is available, so we need
442// to figure it out.
443// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
444//   is available.
445
446// Cygwin 1.7 and below doesn't support ::std::wstring.
447// Solaris' libc++ doesn't support it either.  Android has
448// no support for it at least as recent as Froyo (2.2).
449# define GTEST_HAS_STD_WSTRING \
450    (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
451
452#endif  // GTEST_HAS_STD_WSTRING
453
454#ifndef GTEST_HAS_GLOBAL_WSTRING
455// The user didn't tell us whether ::wstring is available, so we need
456// to figure it out.
457# define GTEST_HAS_GLOBAL_WSTRING \
458    (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
459#endif  // GTEST_HAS_GLOBAL_WSTRING
460
461// Determines whether RTTI is available.
462#ifndef GTEST_HAS_RTTI
463// The user didn't tell us whether RTTI is enabled, so we need to
464// figure it out.
465
466# ifdef _MSC_VER
467
468#  ifdef _CPPRTTI  // MSVC defines this macro iff RTTI is enabled.
469#   define GTEST_HAS_RTTI 1
470#  else
471#   define GTEST_HAS_RTTI 0
472#  endif
473
474// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
475# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
476
477#  ifdef __GXX_RTTI
478#   define GTEST_HAS_RTTI 1
479#  else
480#   define GTEST_HAS_RTTI 0
481#  endif  // __GXX_RTTI
482
483// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
484// both the typeid and dynamic_cast features are present.
485# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
486
487#  ifdef __RTTI_ALL__
488#   define GTEST_HAS_RTTI 1
489#  else
490#   define GTEST_HAS_RTTI 0
491#  endif
492
493# else
494
495// For all other compilers, we assume RTTI is enabled.
496#  define GTEST_HAS_RTTI 1
497
498# endif  // _MSC_VER
499
500#endif  // GTEST_HAS_RTTI
501
502// It's this header's responsibility to #include <typeinfo> when RTTI
503// is enabled.
504#if GTEST_HAS_RTTI
505# include <typeinfo>
506#endif
507
508// Determines whether Google Test can use the pthreads library.
509#ifndef GTEST_HAS_PTHREAD
510// The user didn't tell us explicitly, so we assume pthreads support is
511// available on Linux and Mac.
512//
513// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
514// to your compiler flags.
515# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX)
516#endif  // GTEST_HAS_PTHREAD
517
518#if GTEST_HAS_PTHREAD
519// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
520// true.
521# include <pthread.h>  // NOLINT
522
523// For timespec and nanosleep, used below.
524# include <time.h>  // NOLINT
525#endif
526
527// Determines whether Google Test can use tr1/tuple.  You can define
528// this macro to 0 to prevent Google Test from using tuple (any
529// feature depending on tuple with be disabled in this mode).
530#ifndef GTEST_HAS_TR1_TUPLE
531// The user didn't tell us not to do it, so we assume it's OK.
532# define GTEST_HAS_TR1_TUPLE 1
533#endif  // GTEST_HAS_TR1_TUPLE
534
535// Determines whether Google Test's own tr1 tuple implementation
536// should be used.
537#ifndef GTEST_USE_OWN_TR1_TUPLE
538// The user didn't tell us, so we need to figure it out.
539
540// We use our own TR1 tuple if we aren't sure the user has an
541// implementation of it already.  At this time, GCC 4.0.0+ and MSVC
542// 2010 are the only mainstream compilers that come with a TR1 tuple
543// implementation.  NVIDIA's CUDA NVCC compiler pretends to be GCC by
544// defining __GNUC__ and friends, but cannot compile GCC's tuple
545// implementation.  MSVC 2008 (9.0) provides TR1 tuple in a 323 MB
546// Feature Pack download, which we cannot assume the user has.
547# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \
548    || _MSC_VER >= 1600
549#  define GTEST_USE_OWN_TR1_TUPLE 0
550# else
551#  define GTEST_USE_OWN_TR1_TUPLE 1
552# endif
553
554#endif  // GTEST_USE_OWN_TR1_TUPLE
555
556// To avoid conditional compilation everywhere, we make it
557// gtest-port.h's responsibility to #include the header implementing
558// tr1/tuple.
559#if GTEST_HAS_TR1_TUPLE
560
561# if GTEST_USE_OWN_TR1_TUPLE
562// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
563
564// Copyright 2009 Google Inc.
565// All Rights Reserved.
566//
567// Redistribution and use in source and binary forms, with or without
568// modification, are permitted provided that the following conditions are
569// met:
570//
571//     * Redistributions of source code must retain the above copyright
572// notice, this list of conditions and the following disclaimer.
573//     * Redistributions in binary form must reproduce the above
574// copyright notice, this list of conditions and the following disclaimer
575// in the documentation and/or other materials provided with the
576// distribution.
577//     * Neither the name of Google Inc. nor the names of its
578// contributors may be used to endorse or promote products derived from
579// this software without specific prior written permission.
580//
581// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
582// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
583// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
584// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
585// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
586// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
587// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
588// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
589// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
590// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
591// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
592//
593// Author: wan@google.com (Zhanyong Wan)
594
595// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
596
597#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
598#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
599
600#include <utility>  // For ::std::pair.
601
602// The compiler used in Symbian has a bug that prevents us from declaring the
603// tuple template as a friend (it complains that tuple is redefined).  This
604// hack bypasses the bug by declaring the members that should otherwise be
605// private as public.
606// Sun Studio versions < 12 also have the above bug.
607#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
608# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
609#else
610# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
611    template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
612   private:
613#endif
614
615// GTEST_n_TUPLE_(T) is the type of an n-tuple.
616#define GTEST_0_TUPLE_(T) tuple<>
617#define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
618    void, void, void>
619#define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
620    void, void, void>
621#define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
622    void, void, void>
623#define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
624    void, void, void>
625#define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
626    void, void, void>
627#define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
628    void, void, void>
629#define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
630    void, void, void>
631#define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
632    T##7, void, void>
633#define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
634    T##7, T##8, void>
635#define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
636    T##7, T##8, T##9>
637
638// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
639#define GTEST_0_TYPENAMES_(T)
640#define GTEST_1_TYPENAMES_(T) typename T##0
641#define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
642#define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
643#define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
644    typename T##3
645#define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
646    typename T##3, typename T##4
647#define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
648    typename T##3, typename T##4, typename T##5
649#define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
650    typename T##3, typename T##4, typename T##5, typename T##6
651#define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
652    typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
653#define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
654    typename T##3, typename T##4, typename T##5, typename T##6, \
655    typename T##7, typename T##8
656#define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
657    typename T##3, typename T##4, typename T##5, typename T##6, \
658    typename T##7, typename T##8, typename T##9
659
660// In theory, defining stuff in the ::std namespace is undefined
661// behavior.  We can do this as we are playing the role of a standard
662// library vendor.
663namespace std {
664namespace tr1 {
665
666template <typename T0 = void, typename T1 = void, typename T2 = void,
667    typename T3 = void, typename T4 = void, typename T5 = void,
668    typename T6 = void, typename T7 = void, typename T8 = void,
669    typename T9 = void>
670class tuple;
671
672// Anything in namespace gtest_internal is Google Test's INTERNAL
673// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
674namespace gtest_internal {
675
676// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
677template <typename T>
678struct ByRef { typedef const T& type; };  // NOLINT
679template <typename T>
680struct ByRef<T&> { typedef T& type; };  // NOLINT
681
682// A handy wrapper for ByRef.
683#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
684
685// AddRef<T>::type is T if T is a reference; otherwise it's T&.  This
686// is the same as tr1::add_reference<T>::type.
687template <typename T>
688struct AddRef { typedef T& type; };  // NOLINT
689template <typename T>
690struct AddRef<T&> { typedef T& type; };  // NOLINT
691
692// A handy wrapper for AddRef.
693#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
694
695// A helper for implementing get<k>().
696template <int k> class Get;
697
698// A helper for implementing tuple_element<k, T>.  kIndexValid is true
699// iff k < the number of fields in tuple type T.
700template <bool kIndexValid, int kIndex, class Tuple>
701struct TupleElement;
702
703template <GTEST_10_TYPENAMES_(T)>
704struct TupleElement<true, 0, GTEST_10_TUPLE_(T)> { typedef T0 type; };
705
706template <GTEST_10_TYPENAMES_(T)>
707struct TupleElement<true, 1, GTEST_10_TUPLE_(T)> { typedef T1 type; };
708
709template <GTEST_10_TYPENAMES_(T)>
710struct TupleElement<true, 2, GTEST_10_TUPLE_(T)> { typedef T2 type; };
711
712template <GTEST_10_TYPENAMES_(T)>
713struct TupleElement<true, 3, GTEST_10_TUPLE_(T)> { typedef T3 type; };
714
715template <GTEST_10_TYPENAMES_(T)>
716struct TupleElement<true, 4, GTEST_10_TUPLE_(T)> { typedef T4 type; };
717
718template <GTEST_10_TYPENAMES_(T)>
719struct TupleElement<true, 5, GTEST_10_TUPLE_(T)> { typedef T5 type; };
720
721template <GTEST_10_TYPENAMES_(T)>
722struct TupleElement<true, 6, GTEST_10_TUPLE_(T)> { typedef T6 type; };
723
724template <GTEST_10_TYPENAMES_(T)>
725struct TupleElement<true, 7, GTEST_10_TUPLE_(T)> { typedef T7 type; };
726
727template <GTEST_10_TYPENAMES_(T)>
728struct TupleElement<true, 8, GTEST_10_TUPLE_(T)> { typedef T8 type; };
729
730template <GTEST_10_TYPENAMES_(T)>
731struct TupleElement<true, 9, GTEST_10_TUPLE_(T)> { typedef T9 type; };
732
733}  // namespace gtest_internal
734
735template <>
736class tuple<> {
737 public:
738  tuple() {}
739  tuple(const tuple& /* t */)  {}
740  tuple& operator=(const tuple& /* t */) { return *this; }
741};
742
743template <GTEST_1_TYPENAMES_(T)>
744class GTEST_1_TUPLE_(T) {
745 public:
746  template <int k> friend class gtest_internal::Get;
747
748  tuple() : f0_() {}
749
750  explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
751
752  tuple(const tuple& t) : f0_(t.f0_) {}
753
754  template <GTEST_1_TYPENAMES_(U)>
755  tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
756
757  tuple& operator=(const tuple& t) { return CopyFrom(t); }
758
759  template <GTEST_1_TYPENAMES_(U)>
760  tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
761    return CopyFrom(t);
762  }
763
764  GTEST_DECLARE_TUPLE_AS_FRIEND_
765
766  template <GTEST_1_TYPENAMES_(U)>
767  tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
768    f0_ = t.f0_;
769    return *this;
770  }
771
772  T0 f0_;
773};
774
775template <GTEST_2_TYPENAMES_(T)>
776class GTEST_2_TUPLE_(T) {
777 public:
778  template <int k> friend class gtest_internal::Get;
779
780  tuple() : f0_(), f1_() {}
781
782  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
783      f1_(f1) {}
784
785  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
786
787  template <GTEST_2_TYPENAMES_(U)>
788  tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
789  template <typename U0, typename U1>
790  tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
791
792  tuple& operator=(const tuple& t) { return CopyFrom(t); }
793
794  template <GTEST_2_TYPENAMES_(U)>
795  tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
796    return CopyFrom(t);
797  }
798  template <typename U0, typename U1>
799  tuple& operator=(const ::std::pair<U0, U1>& p) {
800    f0_ = p.first;
801    f1_ = p.second;
802    return *this;
803  }
804
805  GTEST_DECLARE_TUPLE_AS_FRIEND_
806
807  template <GTEST_2_TYPENAMES_(U)>
808  tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
809    f0_ = t.f0_;
810    f1_ = t.f1_;
811    return *this;
812  }
813
814  T0 f0_;
815  T1 f1_;
816};
817
818template <GTEST_3_TYPENAMES_(T)>
819class GTEST_3_TUPLE_(T) {
820 public:
821  template <int k> friend class gtest_internal::Get;
822
823  tuple() : f0_(), f1_(), f2_() {}
824
825  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
826      GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
827
828  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
829
830  template <GTEST_3_TYPENAMES_(U)>
831  tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
832
833  tuple& operator=(const tuple& t) { return CopyFrom(t); }
834
835  template <GTEST_3_TYPENAMES_(U)>
836  tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
837    return CopyFrom(t);
838  }
839
840  GTEST_DECLARE_TUPLE_AS_FRIEND_
841
842  template <GTEST_3_TYPENAMES_(U)>
843  tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
844    f0_ = t.f0_;
845    f1_ = t.f1_;
846    f2_ = t.f2_;
847    return *this;
848  }
849
850  T0 f0_;
851  T1 f1_;
852  T2 f2_;
853};
854
855template <GTEST_4_TYPENAMES_(T)>
856class GTEST_4_TUPLE_(T) {
857 public:
858  template <int k> friend class gtest_internal::Get;
859
860  tuple() : f0_(), f1_(), f2_(), f3_() {}
861
862  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
863      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
864      f3_(f3) {}
865
866  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
867
868  template <GTEST_4_TYPENAMES_(U)>
869  tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
870      f3_(t.f3_) {}
871
872  tuple& operator=(const tuple& t) { return CopyFrom(t); }
873
874  template <GTEST_4_TYPENAMES_(U)>
875  tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
876    return CopyFrom(t);
877  }
878
879  GTEST_DECLARE_TUPLE_AS_FRIEND_
880
881  template <GTEST_4_TYPENAMES_(U)>
882  tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
883    f0_ = t.f0_;
884    f1_ = t.f1_;
885    f2_ = t.f2_;
886    f3_ = t.f3_;
887    return *this;
888  }
889
890  T0 f0_;
891  T1 f1_;
892  T2 f2_;
893  T3 f3_;
894};
895
896template <GTEST_5_TYPENAMES_(T)>
897class GTEST_5_TUPLE_(T) {
898 public:
899  template <int k> friend class gtest_internal::Get;
900
901  tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
902
903  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
904      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
905      GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
906
907  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
908      f4_(t.f4_) {}
909
910  template <GTEST_5_TYPENAMES_(U)>
911  tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
912      f3_(t.f3_), f4_(t.f4_) {}
913
914  tuple& operator=(const tuple& t) { return CopyFrom(t); }
915
916  template <GTEST_5_TYPENAMES_(U)>
917  tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
918    return CopyFrom(t);
919  }
920
921  GTEST_DECLARE_TUPLE_AS_FRIEND_
922
923  template <GTEST_5_TYPENAMES_(U)>
924  tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
925    f0_ = t.f0_;
926    f1_ = t.f1_;
927    f2_ = t.f2_;
928    f3_ = t.f3_;
929    f4_ = t.f4_;
930    return *this;
931  }
932
933  T0 f0_;
934  T1 f1_;
935  T2 f2_;
936  T3 f3_;
937  T4 f4_;
938};
939
940template <GTEST_6_TYPENAMES_(T)>
941class GTEST_6_TUPLE_(T) {
942 public:
943  template <int k> friend class gtest_internal::Get;
944
945  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
946
947  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
948      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
949      GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
950      f5_(f5) {}
951
952  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
953      f4_(t.f4_), f5_(t.f5_) {}
954
955  template <GTEST_6_TYPENAMES_(U)>
956  tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
957      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
958
959  tuple& operator=(const tuple& t) { return CopyFrom(t); }
960
961  template <GTEST_6_TYPENAMES_(U)>
962  tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
963    return CopyFrom(t);
964  }
965
966  GTEST_DECLARE_TUPLE_AS_FRIEND_
967
968  template <GTEST_6_TYPENAMES_(U)>
969  tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
970    f0_ = t.f0_;
971    f1_ = t.f1_;
972    f2_ = t.f2_;
973    f3_ = t.f3_;
974    f4_ = t.f4_;
975    f5_ = t.f5_;
976    return *this;
977  }
978
979  T0 f0_;
980  T1 f1_;
981  T2 f2_;
982  T3 f3_;
983  T4 f4_;
984  T5 f5_;
985};
986
987template <GTEST_7_TYPENAMES_(T)>
988class GTEST_7_TUPLE_(T) {
989 public:
990  template <int k> friend class gtest_internal::Get;
991
992  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
993
994  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
995      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
996      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
997      f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
998
999  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1000      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
1001
1002  template <GTEST_7_TYPENAMES_(U)>
1003  tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1004      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
1005
1006  tuple& operator=(const tuple& t) { return CopyFrom(t); }
1007
1008  template <GTEST_7_TYPENAMES_(U)>
1009  tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
1010    return CopyFrom(t);
1011  }
1012
1013  GTEST_DECLARE_TUPLE_AS_FRIEND_
1014
1015  template <GTEST_7_TYPENAMES_(U)>
1016  tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
1017    f0_ = t.f0_;
1018    f1_ = t.f1_;
1019    f2_ = t.f2_;
1020    f3_ = t.f3_;
1021    f4_ = t.f4_;
1022    f5_ = t.f5_;
1023    f6_ = t.f6_;
1024    return *this;
1025  }
1026
1027  T0 f0_;
1028  T1 f1_;
1029  T2 f2_;
1030  T3 f3_;
1031  T4 f4_;
1032  T5 f5_;
1033  T6 f6_;
1034};
1035
1036template <GTEST_8_TYPENAMES_(T)>
1037class GTEST_8_TUPLE_(T) {
1038 public:
1039  template <int k> friend class gtest_internal::Get;
1040
1041  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
1042
1043  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1044      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1045      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
1046      GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
1047      f5_(f5), f6_(f6), f7_(f7) {}
1048
1049  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1050      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
1051
1052  template <GTEST_8_TYPENAMES_(U)>
1053  tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1054      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
1055
1056  tuple& operator=(const tuple& t) { return CopyFrom(t); }
1057
1058  template <GTEST_8_TYPENAMES_(U)>
1059  tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
1060    return CopyFrom(t);
1061  }
1062
1063  GTEST_DECLARE_TUPLE_AS_FRIEND_
1064
1065  template <GTEST_8_TYPENAMES_(U)>
1066  tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
1067    f0_ = t.f0_;
1068    f1_ = t.f1_;
1069    f2_ = t.f2_;
1070    f3_ = t.f3_;
1071    f4_ = t.f4_;
1072    f5_ = t.f5_;
1073    f6_ = t.f6_;
1074    f7_ = t.f7_;
1075    return *this;
1076  }
1077
1078  T0 f0_;
1079  T1 f1_;
1080  T2 f2_;
1081  T3 f3_;
1082  T4 f4_;
1083  T5 f5_;
1084  T6 f6_;
1085  T7 f7_;
1086};
1087
1088template <GTEST_9_TYPENAMES_(T)>
1089class GTEST_9_TUPLE_(T) {
1090 public:
1091  template <int k> friend class gtest_internal::Get;
1092
1093  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
1094
1095  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1096      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1097      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
1098      GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
1099      f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
1100
1101  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1102      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
1103
1104  template <GTEST_9_TYPENAMES_(U)>
1105  tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1106      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
1107
1108  tuple& operator=(const tuple& t) { return CopyFrom(t); }
1109
1110  template <GTEST_9_TYPENAMES_(U)>
1111  tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
1112    return CopyFrom(t);
1113  }
1114
1115  GTEST_DECLARE_TUPLE_AS_FRIEND_
1116
1117  template <GTEST_9_TYPENAMES_(U)>
1118  tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
1119    f0_ = t.f0_;
1120    f1_ = t.f1_;
1121    f2_ = t.f2_;
1122    f3_ = t.f3_;
1123    f4_ = t.f4_;
1124    f5_ = t.f5_;
1125    f6_ = t.f6_;
1126    f7_ = t.f7_;
1127    f8_ = t.f8_;
1128    return *this;
1129  }
1130
1131  T0 f0_;
1132  T1 f1_;
1133  T2 f2_;
1134  T3 f3_;
1135  T4 f4_;
1136  T5 f5_;
1137  T6 f6_;
1138  T7 f7_;
1139  T8 f8_;
1140};
1141
1142template <GTEST_10_TYPENAMES_(T)>
1143class tuple {
1144 public:
1145  template <int k> friend class gtest_internal::Get;
1146
1147  tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
1148      f9_() {}
1149
1150  explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1151      GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1152      GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
1153      GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
1154      f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
1155
1156  tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1157      f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
1158
1159  template <GTEST_10_TYPENAMES_(U)>
1160  tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1161      f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
1162      f9_(t.f9_) {}
1163
1164  tuple& operator=(const tuple& t) { return CopyFrom(t); }
1165
1166  template <GTEST_10_TYPENAMES_(U)>
1167  tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
1168    return CopyFrom(t);
1169  }
1170
1171  GTEST_DECLARE_TUPLE_AS_FRIEND_
1172
1173  template <GTEST_10_TYPENAMES_(U)>
1174  tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
1175    f0_ = t.f0_;
1176    f1_ = t.f1_;
1177    f2_ = t.f2_;
1178    f3_ = t.f3_;
1179    f4_ = t.f4_;
1180    f5_ = t.f5_;
1181    f6_ = t.f6_;
1182    f7_ = t.f7_;
1183    f8_ = t.f8_;
1184    f9_ = t.f9_;
1185    return *this;
1186  }
1187
1188  T0 f0_;
1189  T1 f1_;
1190  T2 f2_;
1191  T3 f3_;
1192  T4 f4_;
1193  T5 f5_;
1194  T6 f6_;
1195  T7 f7_;
1196  T8 f8_;
1197  T9 f9_;
1198};
1199
1200// 6.1.3.2 Tuple creation functions.
1201
1202// Known limitations: we don't support passing an
1203// std::tr1::reference_wrapper<T> to make_tuple().  And we don't
1204// implement tie().
1205
1206inline tuple<> make_tuple() { return tuple<>(); }
1207
1208template <GTEST_1_TYPENAMES_(T)>
1209inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
1210  return GTEST_1_TUPLE_(T)(f0);
1211}
1212
1213template <GTEST_2_TYPENAMES_(T)>
1214inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
1215  return GTEST_2_TUPLE_(T)(f0, f1);
1216}
1217
1218template <GTEST_3_TYPENAMES_(T)>
1219inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
1220  return GTEST_3_TUPLE_(T)(f0, f1, f2);
1221}
1222
1223template <GTEST_4_TYPENAMES_(T)>
1224inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1225    const T3& f3) {
1226  return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
1227}
1228
1229template <GTEST_5_TYPENAMES_(T)>
1230inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1231    const T3& f3, const T4& f4) {
1232  return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
1233}
1234
1235template <GTEST_6_TYPENAMES_(T)>
1236inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1237    const T3& f3, const T4& f4, const T5& f5) {
1238  return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
1239}
1240
1241template <GTEST_7_TYPENAMES_(T)>
1242inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1243    const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
1244  return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
1245}
1246
1247template <GTEST_8_TYPENAMES_(T)>
1248inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1249    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
1250  return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
1251}
1252
1253template <GTEST_9_TYPENAMES_(T)>
1254inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1255    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
1256    const T8& f8) {
1257  return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
1258}
1259
1260template <GTEST_10_TYPENAMES_(T)>
1261inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1262    const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
1263    const T8& f8, const T9& f9) {
1264  return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
1265}
1266
1267// 6.1.3.3 Tuple helper classes.
1268
1269template <typename Tuple> struct tuple_size;
1270
1271template <GTEST_0_TYPENAMES_(T)>
1272struct tuple_size<GTEST_0_TUPLE_(T)> { static const int value = 0; };
1273
1274template <GTEST_1_TYPENAMES_(T)>
1275struct tuple_size<GTEST_1_TUPLE_(T)> { static const int value = 1; };
1276
1277template <GTEST_2_TYPENAMES_(T)>
1278struct tuple_size<GTEST_2_TUPLE_(T)> { static const int value = 2; };
1279
1280template <GTEST_3_TYPENAMES_(T)>
1281struct tuple_size<GTEST_3_TUPLE_(T)> { static const int value = 3; };
1282
1283template <GTEST_4_TYPENAMES_(T)>
1284struct tuple_size<GTEST_4_TUPLE_(T)> { static const int value = 4; };
1285
1286template <GTEST_5_TYPENAMES_(T)>
1287struct tuple_size<GTEST_5_TUPLE_(T)> { static const int value = 5; };
1288
1289template <GTEST_6_TYPENAMES_(T)>
1290struct tuple_size<GTEST_6_TUPLE_(T)> { static const int value = 6; };
1291
1292template <GTEST_7_TYPENAMES_(T)>
1293struct tuple_size<GTEST_7_TUPLE_(T)> { static const int value = 7; };
1294
1295template <GTEST_8_TYPENAMES_(T)>
1296struct tuple_size<GTEST_8_TUPLE_(T)> { static const int value = 8; };
1297
1298template <GTEST_9_TYPENAMES_(T)>
1299struct tuple_size<GTEST_9_TUPLE_(T)> { static const int value = 9; };
1300
1301template <GTEST_10_TYPENAMES_(T)>
1302struct tuple_size<GTEST_10_TUPLE_(T)> { static const int value = 10; };
1303
1304template <int k, class Tuple>
1305struct tuple_element {
1306  typedef typename gtest_internal::TupleElement<
1307      k < (tuple_size<Tuple>::value), k, Tuple>::type type;
1308};
1309
1310#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
1311
1312// 6.1.3.4 Element access.
1313
1314namespace gtest_internal {
1315
1316template <>
1317class Get<0> {
1318 public:
1319  template <class Tuple>
1320  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
1321  Field(Tuple& t) { return t.f0_; }  // NOLINT
1322
1323  template <class Tuple>
1324  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
1325  ConstField(const Tuple& t) { return t.f0_; }
1326};
1327
1328template <>
1329class Get<1> {
1330 public:
1331  template <class Tuple>
1332  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
1333  Field(Tuple& t) { return t.f1_; }  // NOLINT
1334
1335  template <class Tuple>
1336  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
1337  ConstField(const Tuple& t) { return t.f1_; }
1338};
1339
1340template <>
1341class Get<2> {
1342 public:
1343  template <class Tuple>
1344  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
1345  Field(Tuple& t) { return t.f2_; }  // NOLINT
1346
1347  template <class Tuple>
1348  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
1349  ConstField(const Tuple& t) { return t.f2_; }
1350};
1351
1352template <>
1353class Get<3> {
1354 public:
1355  template <class Tuple>
1356  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
1357  Field(Tuple& t) { return t.f3_; }  // NOLINT
1358
1359  template <class Tuple>
1360  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
1361  ConstField(const Tuple& t) { return t.f3_; }
1362};
1363
1364template <>
1365class Get<4> {
1366 public:
1367  template <class Tuple>
1368  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
1369  Field(Tuple& t) { return t.f4_; }  // NOLINT
1370
1371  template <class Tuple>
1372  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
1373  ConstField(const Tuple& t) { return t.f4_; }
1374};
1375
1376template <>
1377class Get<5> {
1378 public:
1379  template <class Tuple>
1380  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
1381  Field(Tuple& t) { return t.f5_; }  // NOLINT
1382
1383  template <class Tuple>
1384  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
1385  ConstField(const Tuple& t) { return t.f5_; }
1386};
1387
1388template <>
1389class Get<6> {
1390 public:
1391  template <class Tuple>
1392  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
1393  Field(Tuple& t) { return t.f6_; }  // NOLINT
1394
1395  template <class Tuple>
1396  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
1397  ConstField(const Tuple& t) { return t.f6_; }
1398};
1399
1400template <>
1401class Get<7> {
1402 public:
1403  template <class Tuple>
1404  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
1405  Field(Tuple& t) { return t.f7_; }  // NOLINT
1406
1407  template <class Tuple>
1408  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
1409  ConstField(const Tuple& t) { return t.f7_; }
1410};
1411
1412template <>
1413class Get<8> {
1414 public:
1415  template <class Tuple>
1416  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
1417  Field(Tuple& t) { return t.f8_; }  // NOLINT
1418
1419  template <class Tuple>
1420  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
1421  ConstField(const Tuple& t) { return t.f8_; }
1422};
1423
1424template <>
1425class Get<9> {
1426 public:
1427  template <class Tuple>
1428  static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
1429  Field(Tuple& t) { return t.f9_; }  // NOLINT
1430
1431  template <class Tuple>
1432  static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
1433  ConstField(const Tuple& t) { return t.f9_; }
1434};
1435
1436}  // namespace gtest_internal
1437
1438template <int k, GTEST_10_TYPENAMES_(T)>
1439GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
1440get(GTEST_10_TUPLE_(T)& t) {
1441  return gtest_internal::Get<k>::Field(t);
1442}
1443
1444template <int k, GTEST_10_TYPENAMES_(T)>
1445GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k,  GTEST_10_TUPLE_(T)))
1446get(const GTEST_10_TUPLE_(T)& t) {
1447  return gtest_internal::Get<k>::ConstField(t);
1448}
1449
1450// 6.1.3.5 Relational operators
1451
1452// We only implement == and !=, as we don't have a need for the rest yet.
1453
1454namespace gtest_internal {
1455
1456// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
1457// first k fields of t1 equals the first k fields of t2.
1458// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
1459// k1 != k2.
1460template <int kSize1, int kSize2>
1461struct SameSizeTuplePrefixComparator;
1462
1463template <>
1464struct SameSizeTuplePrefixComparator<0, 0> {
1465  template <class Tuple1, class Tuple2>
1466  static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
1467    return true;
1468  }
1469};
1470
1471template <int k>
1472struct SameSizeTuplePrefixComparator<k, k> {
1473  template <class Tuple1, class Tuple2>
1474  static bool Eq(const Tuple1& t1, const Tuple2& t2) {
1475    return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
1476        ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
1477  }
1478};
1479
1480}  // namespace gtest_internal
1481
1482template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
1483inline bool operator==(const GTEST_10_TUPLE_(T)& t,
1484                       const GTEST_10_TUPLE_(U)& u) {
1485  return gtest_internal::SameSizeTuplePrefixComparator<
1486      tuple_size<GTEST_10_TUPLE_(T)>::value,
1487      tuple_size<GTEST_10_TUPLE_(U)>::value>::Eq(t, u);
1488}
1489
1490template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
1491inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
1492                       const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
1493
1494// 6.1.4 Pairs.
1495// Unimplemented.
1496
1497}  // namespace tr1
1498}  // namespace std
1499
1500#undef GTEST_0_TUPLE_
1501#undef GTEST_1_TUPLE_
1502#undef GTEST_2_TUPLE_
1503#undef GTEST_3_TUPLE_
1504#undef GTEST_4_TUPLE_
1505#undef GTEST_5_TUPLE_
1506#undef GTEST_6_TUPLE_
1507#undef GTEST_7_TUPLE_
1508#undef GTEST_8_TUPLE_
1509#undef GTEST_9_TUPLE_
1510#undef GTEST_10_TUPLE_
1511
1512#undef GTEST_0_TYPENAMES_
1513#undef GTEST_1_TYPENAMES_
1514#undef GTEST_2_TYPENAMES_
1515#undef GTEST_3_TYPENAMES_
1516#undef GTEST_4_TYPENAMES_
1517#undef GTEST_5_TYPENAMES_
1518#undef GTEST_6_TYPENAMES_
1519#undef GTEST_7_TYPENAMES_
1520#undef GTEST_8_TYPENAMES_
1521#undef GTEST_9_TYPENAMES_
1522#undef GTEST_10_TYPENAMES_
1523
1524#undef GTEST_DECLARE_TUPLE_AS_FRIEND_
1525#undef GTEST_BY_REF_
1526#undef GTEST_ADD_REF_
1527#undef GTEST_TUPLE_ELEMENT_
1528
1529#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
1530# elif GTEST_OS_SYMBIAN
1531
1532// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
1533// use STLport's tuple implementation, which unfortunately doesn't
1534// work as the copy of STLport distributed with Symbian is incomplete.
1535// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
1536// use its own tuple implementation.
1537#  ifdef BOOST_HAS_TR1_TUPLE
1538#   undef BOOST_HAS_TR1_TUPLE
1539#  endif  // BOOST_HAS_TR1_TUPLE
1540
1541// This prevents <boost/tr1/detail/config.hpp>, which defines
1542// BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
1543#  define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
1544#  include <tuple>
1545
1546# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
1547// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header.  This does
1548// not conform to the TR1 spec, which requires the header to be <tuple>.
1549
1550#  if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
1551// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
1552// which is #included by <tr1/tuple>, to not compile when RTTI is
1553// disabled.  _TR1_FUNCTIONAL is the header guard for
1554// <tr1/functional>.  Hence the following #define is a hack to prevent
1555// <tr1/functional> from being included.
1556#   define _TR1_FUNCTIONAL 1
1557#   include <tr1/tuple>
1558#   undef _TR1_FUNCTIONAL  // Allows the user to #include
1559                        // <tr1/functional> if he chooses to.
1560#  else
1561#   include <tr1/tuple>  // NOLINT
1562#  endif  // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
1563
1564# else
1565// If the compiler is not GCC 4.0+, we assume the user is using a
1566// spec-conforming TR1 implementation.
1567#  include <tuple>  // NOLINT
1568# endif  // GTEST_USE_OWN_TR1_TUPLE
1569
1570#endif  // GTEST_HAS_TR1_TUPLE
1571
1572// Determines whether clone(2) is supported.
1573// Usually it will only be available on Linux, excluding
1574// Linux on the Itanium architecture.
1575// Also see http://linux.die.net/man/2/clone.
1576#ifndef GTEST_HAS_CLONE
1577// The user didn't tell us, so we need to figure it out.
1578
1579# if GTEST_OS_LINUX && !defined(__ia64__)
1580#  define GTEST_HAS_CLONE 1
1581# else
1582#  define GTEST_HAS_CLONE 0
1583# endif  // GTEST_OS_LINUX && !defined(__ia64__)
1584
1585#endif  // GTEST_HAS_CLONE
1586
1587// Determines whether to support stream redirection. This is used to test
1588// output correctness and to implement death tests.
1589#ifndef GTEST_HAS_STREAM_REDIRECTION
1590// By default, we assume that stream redirection is supported on all
1591// platforms except known mobile ones.
1592# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN
1593#  define GTEST_HAS_STREAM_REDIRECTION 0
1594# else
1595#  define GTEST_HAS_STREAM_REDIRECTION 1
1596# endif  // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
1597#endif  // GTEST_HAS_STREAM_REDIRECTION
1598
1599// Determines whether to support death tests.
1600// Google Test does not support death tests for VC 7.1 and earlier as
1601// abort() in a VC 7.1 application compiled as GUI in debug config
1602// pops up a dialog window that cannot be suppressed programmatically.
1603#if (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
1604     (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
1605     GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX)
1606# define GTEST_HAS_DEATH_TEST 1
1607# include <vector>  // NOLINT
1608#endif
1609
1610// We don't support MSVC 7.1 with exceptions disabled now.  Therefore
1611// all the compilers we care about are adequate for supporting
1612// value-parameterized tests.
1613#define GTEST_HAS_PARAM_TEST 1
1614
1615// Determines whether to support type-driven tests.
1616
1617// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
1618// Sun Pro CC, IBM Visual Age, and HP aCC support.
1619#if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \
1620    defined(__IBMCPP__) || defined(__HP_aCC)
1621# define GTEST_HAS_TYPED_TEST 1
1622# define GTEST_HAS_TYPED_TEST_P 1
1623#endif
1624
1625// Determines whether to support Combine(). This only makes sense when
1626// value-parameterized tests are enabled.  The implementation doesn't
1627// work on Sun Studio since it doesn't understand templated conversion
1628// operators.
1629#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
1630# define GTEST_HAS_COMBINE 1
1631#endif
1632
1633// Determines whether the system compiler uses UTF-16 for encoding wide strings.
1634#define GTEST_WIDE_STRING_USES_UTF16_ \
1635    (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX)
1636
1637// Determines whether test results can be streamed to a socket.
1638#if GTEST_OS_LINUX
1639# define GTEST_CAN_STREAM_RESULTS_ 1
1640#endif
1641
1642// Defines some utility macros.
1643
1644// The GNU compiler emits a warning if nested "if" statements are followed by
1645// an "else" statement and braces are not used to explicitly disambiguate the
1646// "else" binding.  This leads to problems with code like:
1647//
1648//   if (gate)
1649//     ASSERT_*(condition) << "Some message";
1650//
1651// The "switch (0) case 0:" idiom is used to suppress this.
1652#ifdef __INTEL_COMPILER
1653# define GTEST_AMBIGUOUS_ELSE_BLOCKER_
1654#else
1655# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default:  // NOLINT
1656#endif
1657
1658// Use this annotation at the end of a struct/class definition to
1659// prevent the compiler from optimizing away instances that are never
1660// used.  This is useful when all interesting logic happens inside the
1661// c'tor and / or d'tor.  Example:
1662//
1663//   struct Foo {
1664//     Foo() { ... }
1665//   } GTEST_ATTRIBUTE_UNUSED_;
1666//
1667// Also use it after a variable or parameter declaration to tell the
1668// compiler the variable/parameter does not have to be used.
1669#if defined(__GNUC__) && !defined(COMPILER_ICC)
1670# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
1671#else
1672# define GTEST_ATTRIBUTE_UNUSED_
1673#endif
1674
1675// A macro to disallow operator=
1676// This should be used in the private: declarations for a class.
1677#define GTEST_DISALLOW_ASSIGN_(type)\
1678  void operator=(type const &)
1679
1680// A macro to disallow copy constructor and operator=
1681// This should be used in the private: declarations for a class.
1682#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
1683  type(type const &);\
1684  GTEST_DISALLOW_ASSIGN_(type)
1685
1686// Tell the compiler to warn about unused return values for functions declared
1687// with this macro.  The macro should be used on function declarations
1688// following the argument list:
1689//
1690//   Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
1691#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
1692# define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
1693#else
1694# define GTEST_MUST_USE_RESULT_
1695#endif  // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
1696
1697// Determine whether the compiler supports Microsoft's Structured Exception
1698// Handling.  This is supported by several Windows compilers but generally
1699// does not exist on any other system.
1700#ifndef GTEST_HAS_SEH
1701// The user didn't tell us, so we need to figure it out.
1702
1703# if defined(_MSC_VER) || defined(__BORLANDC__)
1704// These two compilers are known to support SEH.
1705#  define GTEST_HAS_SEH 1
1706# else
1707// Assume no SEH.
1708#  define GTEST_HAS_SEH 0
1709# endif
1710
1711#endif  // GTEST_HAS_SEH
1712
1713#ifdef _MSC_VER
1714
1715# if GTEST_LINKED_AS_SHARED_LIBRARY
1716#  define GTEST_API_ __declspec(dllimport)
1717# elif GTEST_CREATE_SHARED_LIBRARY
1718#  define GTEST_API_ __declspec(dllexport)
1719# endif
1720
1721#endif  // _MSC_VER
1722
1723#ifndef GTEST_API_
1724# define GTEST_API_
1725#endif
1726
1727#ifdef __GNUC__
1728// Ask the compiler to never inline a given function.
1729# define GTEST_NO_INLINE_ __attribute__((noinline))
1730#else
1731# define GTEST_NO_INLINE_
1732#endif
1733
1734namespace testing {
1735
1736class Message;
1737
1738namespace internal {
1739
1740class String;
1741
1742// The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time
1743// expression is true. For example, you could use it to verify the
1744// size of a static array:
1745//
1746//   GTEST_COMPILE_ASSERT_(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES,
1747//                         content_type_names_incorrect_size);
1748//
1749// or to make sure a struct is smaller than a certain size:
1750//
1751//   GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large);
1752//
1753// The second argument to the macro is the name of the variable. If
1754// the expression is false, most compilers will issue a warning/error
1755// containing the name of the variable.
1756
1757template <bool>
1758struct CompileAssert {
1759};
1760
1761#define GTEST_COMPILE_ASSERT_(expr, msg) \
1762  typedef ::testing::internal::CompileAssert<(bool(expr))> \
1763      msg[bool(expr) ? 1 : -1]
1764
1765// Implementation details of GTEST_COMPILE_ASSERT_:
1766//
1767// - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
1768//   elements (and thus is invalid) when the expression is false.
1769//
1770// - The simpler definition
1771//
1772//    #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]
1773//
1774//   does not work, as gcc supports variable-length arrays whose sizes
1775//   are determined at run-time (this is gcc's extension and not part
1776//   of the C++ standard).  As a result, gcc fails to reject the
1777//   following code with the simple definition:
1778//
1779//     int foo;
1780//     GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is
1781//                                      // not a compile-time constant.
1782//
1783// - By using the type CompileAssert<(bool(expr))>, we ensures that
1784//   expr is a compile-time constant.  (Template arguments must be
1785//   determined at compile-time.)
1786//
1787// - The outter parentheses in CompileAssert<(bool(expr))> are necessary
1788//   to work around a bug in gcc 3.4.4 and 4.0.1.  If we had written
1789//
1790//     CompileAssert<bool(expr)>
1791//
1792//   instead, these compilers will refuse to compile
1793//
1794//     GTEST_COMPILE_ASSERT_(5 > 0, some_message);
1795//
1796//   (They seem to think the ">" in "5 > 0" marks the end of the
1797//   template argument list.)
1798//
1799// - The array size is (bool(expr) ? 1 : -1), instead of simply
1800//
1801//     ((expr) ? 1 : -1).
1802//
1803//   This is to avoid running into a bug in MS VC 7.1, which
1804//   causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
1805
1806// StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.
1807//
1808// This template is declared, but intentionally undefined.
1809template <typename T1, typename T2>
1810struct StaticAssertTypeEqHelper;
1811
1812template <typename T>
1813struct StaticAssertTypeEqHelper<T, T> {};
1814
1815#if GTEST_HAS_GLOBAL_STRING
1816typedef ::string string;
1817#else
1818typedef ::std::string string;
1819#endif  // GTEST_HAS_GLOBAL_STRING
1820
1821#if GTEST_HAS_GLOBAL_WSTRING
1822typedef ::wstring wstring;
1823#elif GTEST_HAS_STD_WSTRING
1824typedef ::std::wstring wstring;
1825#endif  // GTEST_HAS_GLOBAL_WSTRING
1826
1827// A helper for suppressing warnings on constant condition.  It just
1828// returns 'condition'.
1829GTEST_API_ bool IsTrue(bool condition);
1830
1831// Defines scoped_ptr.
1832
1833// This implementation of scoped_ptr is PARTIAL - it only contains
1834// enough stuff to satisfy Google Test's need.
1835template <typename T>
1836class scoped_ptr {
1837 public:
1838  typedef T element_type;
1839
1840  explicit scoped_ptr(T* p = NULL) : ptr_(p) {}
1841  ~scoped_ptr() { reset(); }
1842
1843  T& operator*() const { return *ptr_; }
1844  T* operator->() const { return ptr_; }
1845  T* get() const { return ptr_; }
1846
1847  T* release() {
1848    T* const ptr = ptr_;
1849    ptr_ = NULL;
1850    return ptr;
1851  }
1852
1853  void reset(T* p = NULL) {
1854    if (p != ptr_) {
1855      if (IsTrue(sizeof(T) > 0)) {  // Makes sure T is a complete type.
1856        delete ptr_;
1857      }
1858      ptr_ = p;
1859    }
1860  }
1861 private:
1862  T* ptr_;
1863
1864  GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
1865};
1866
1867// Defines RE.
1868
1869// A simple C++ wrapper for <regex.h>.  It uses the POSIX Extended
1870// Regular Expression syntax.
1871class GTEST_API_ RE {
1872 public:
1873  // A copy constructor is required by the Standard to initialize object
1874  // references from r-values.
1875  RE(const RE& other) { Init(other.pattern()); }
1876
1877  // Constructs an RE from a string.
1878  RE(const ::std::string& regex) { Init(regex.c_str()); }  // NOLINT
1879
1880#if GTEST_HAS_GLOBAL_STRING
1881
1882  RE(const ::string& regex) { Init(regex.c_str()); }  // NOLINT
1883
1884#endif  // GTEST_HAS_GLOBAL_STRING
1885
1886  RE(const char* regex) { Init(regex); }  // NOLINT
1887  ~RE();
1888
1889  // Returns the string representation of the regex.
1890  const char* pattern() const { return pattern_; }
1891
1892  // FullMatch(str, re) returns true iff regular expression re matches
1893  // the entire str.
1894  // PartialMatch(str, re) returns true iff regular expression re
1895  // matches a substring of str (including str itself).
1896  //
1897  // TODO(wan@google.com): make FullMatch() and PartialMatch() work
1898  // when str contains NUL characters.
1899  static bool FullMatch(const ::std::string& str, const RE& re) {
1900    return FullMatch(str.c_str(), re);
1901  }
1902  static bool PartialMatch(const ::std::string& str, const RE& re) {
1903    return PartialMatch(str.c_str(), re);
1904  }
1905
1906#if GTEST_HAS_GLOBAL_STRING
1907
1908  static bool FullMatch(const ::string& str, const RE& re) {
1909    return FullMatch(str.c_str(), re);
1910  }
1911  static bool PartialMatch(const ::string& str, const RE& re) {
1912    return PartialMatch(str.c_str(), re);
1913  }
1914
1915#endif  // GTEST_HAS_GLOBAL_STRING
1916
1917  static bool FullMatch(const char* str, const RE& re);
1918  static bool PartialMatch(const char* str, const RE& re);
1919
1920 private:
1921  void Init(const char* regex);
1922
1923  // We use a const char* instead of a string, as Google Test may be used
1924  // where string is not available.  We also do not use Google Test's own
1925  // String type here, in order to simplify dependencies between the
1926  // files.
1927  const char* pattern_;
1928  bool is_valid_;
1929
1930#if GTEST_USES_POSIX_RE
1931
1932  regex_t full_regex_;     // For FullMatch().
1933  regex_t partial_regex_;  // For PartialMatch().
1934
1935#else  // GTEST_USES_SIMPLE_RE
1936
1937  const char* full_pattern_;  // For FullMatch();
1938
1939#endif
1940
1941  GTEST_DISALLOW_ASSIGN_(RE);
1942};
1943
1944// Formats a source file path and a line number as they would appear
1945// in an error message from the compiler used to compile this code.
1946GTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
1947
1948// Formats a file location for compiler-independent XML output.
1949// Although this function is not platform dependent, we put it next to
1950// FormatFileLocation in order to contrast the two functions.
1951GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,
1952                                                               int line);
1953
1954// Defines logging utilities:
1955//   GTEST_LOG_(severity) - logs messages at the specified severity level. The
1956//                          message itself is streamed into the macro.
1957//   LogToStderr()  - directs all log messages to stderr.
1958//   FlushInfoLog() - flushes informational log messages.
1959
1960enum GTestLogSeverity {
1961  GTEST_INFO,
1962  GTEST_WARNING,
1963  GTEST_ERROR,
1964  GTEST_FATAL
1965};
1966
1967// Formats log entry severity, provides a stream object for streaming the
1968// log message, and terminates the message with a newline when going out of
1969// scope.
1970class GTEST_API_ GTestLog {
1971 public:
1972  GTestLog(GTestLogSeverity severity, const char* file, int line);
1973
1974  // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
1975  ~GTestLog();
1976
1977  ::std::ostream& GetStream() { return ::std::cerr; }
1978
1979 private:
1980  const GTestLogSeverity severity_;
1981
1982  GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
1983};
1984
1985#define GTEST_LOG_(severity) \
1986    ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
1987                                  __FILE__, __LINE__).GetStream()
1988
1989inline void LogToStderr() {}
1990inline void FlushInfoLog() { fflush(NULL); }
1991
1992// INTERNAL IMPLEMENTATION - DO NOT USE.
1993//
1994// GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
1995// is not satisfied.
1996//  Synopsys:
1997//    GTEST_CHECK_(boolean_condition);
1998//     or
1999//    GTEST_CHECK_(boolean_condition) << "Additional message";
2000//
2001//    This checks the condition and if the condition is not satisfied
2002//    it prints message about the condition violation, including the
2003//    condition itself, plus additional message streamed into it, if any,
2004//    and then it aborts the program. It aborts the program irrespective of
2005//    whether it is built in the debug mode or not.
2006#define GTEST_CHECK_(condition) \
2007    GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
2008    if (::testing::internal::IsTrue(condition)) \
2009      ; \
2010    else \
2011      GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
2012
2013// An all-mode assert to verify that the given POSIX-style function
2014// call returns 0 (indicating success).  Known limitation: this
2015// doesn't expand to a balanced 'if' statement, so enclose the macro
2016// in {} if you need to use it as the only statement in an 'if'
2017// branch.
2018#define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
2019  if (const int gtest_error = (posix_call)) \
2020    GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
2021                      << gtest_error
2022
2023// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
2024//
2025// Use ImplicitCast_ as a safe version of static_cast for upcasting in
2026// the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a
2027// const Foo*).  When you use ImplicitCast_, the compiler checks that
2028// the cast is safe.  Such explicit ImplicitCast_s are necessary in
2029// surprisingly many situations where C++ demands an exact type match
2030// instead of an argument type convertable to a target type.
2031//
2032// The syntax for using ImplicitCast_ is the same as for static_cast:
2033//
2034//   ImplicitCast_<ToType>(expr)
2035//
2036// ImplicitCast_ would have been part of the C++ standard library,
2037// but the proposal was submitted too late.  It will probably make
2038// its way into the language in the future.
2039//
2040// This relatively ugly name is intentional. It prevents clashes with
2041// similar functions users may have (e.g., implicit_cast). The internal
2042// namespace alone is not enough because the function can be found by ADL.
2043template<typename To>
2044inline To ImplicitCast_(To x) { return x; }
2045
2046// When you upcast (that is, cast a pointer from type Foo to type
2047// SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts
2048// always succeed.  When you downcast (that is, cast a pointer from
2049// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
2050// how do you know the pointer is really of type SubclassOfFoo?  It
2051// could be a bare Foo, or of type DifferentSubclassOfFoo.  Thus,
2052// when you downcast, you should use this macro.  In debug mode, we
2053// use dynamic_cast<> to double-check the downcast is legal (we die
2054// if it's not).  In normal mode, we do the efficient static_cast<>
2055// instead.  Thus, it's important to test in debug mode to make sure
2056// the cast is legal!
2057//    This is the only place in the code we should use dynamic_cast<>.
2058// In particular, you SHOULDN'T be using dynamic_cast<> in order to
2059// do RTTI (eg code like this:
2060//    if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
2061//    if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
2062// You should design the code some other way not to need this.
2063//
2064// This relatively ugly name is intentional. It prevents clashes with
2065// similar functions users may have (e.g., down_cast). The internal
2066// namespace alone is not enough because the function can be found by ADL.
2067template<typename To, typename From>  // use like this: DownCast_<T*>(foo);
2068inline To DownCast_(From* f) {  // so we only accept pointers
2069  // Ensures that To is a sub-type of From *.  This test is here only
2070  // for compile-time type checking, and has no overhead in an
2071  // optimized build at run-time, as it will be optimized away
2072  // completely.
2073  if (false) {
2074    const To to = NULL;
2075    ::testing::internal::ImplicitCast_<From*>(to);
2076  }
2077
2078#if GTEST_HAS_RTTI
2079  // RTTI: debug mode only!
2080  GTEST_CHECK_(f == NULL || dynamic_cast<To>(f) != NULL);
2081#endif
2082  return static_cast<To>(f);
2083}
2084
2085// Downcasts the pointer of type Base to Derived.
2086// Derived must be a subclass of Base. The parameter MUST
2087// point to a class of type Derived, not any subclass of it.
2088// When RTTI is available, the function performs a runtime
2089// check to enforce this.
2090template <class Derived, class Base>
2091Derived* CheckedDowncastToActualType(Base* base) {
2092#if GTEST_HAS_RTTI
2093  GTEST_CHECK_(typeid(*base) == typeid(Derived));
2094  return dynamic_cast<Derived*>(base);  // NOLINT
2095#else
2096  return static_cast<Derived*>(base);  // Poor man's downcast.
2097#endif
2098}
2099
2100#if GTEST_HAS_STREAM_REDIRECTION
2101
2102// Defines the stderr capturer:
2103//   CaptureStdout     - starts capturing stdout.
2104//   GetCapturedStdout - stops capturing stdout and returns the captured string.
2105//   CaptureStderr     - starts capturing stderr.
2106//   GetCapturedStderr - stops capturing stderr and returns the captured string.
2107//
2108GTEST_API_ void CaptureStdout();
2109GTEST_API_ String GetCapturedStdout();
2110GTEST_API_ void CaptureStderr();
2111GTEST_API_ String GetCapturedStderr();
2112
2113#endif  // GTEST_HAS_STREAM_REDIRECTION
2114
2115
2116#if GTEST_HAS_DEATH_TEST
2117
2118// A copy of all command line arguments.  Set by InitGoogleTest().
2119extern ::std::vector<String> g_argvs;
2120
2121// GTEST_HAS_DEATH_TEST implies we have ::std::string.
2122const ::std::vector<String>& GetArgvs();
2123
2124#endif  // GTEST_HAS_DEATH_TEST
2125
2126// Defines synchronization primitives.
2127
2128#if GTEST_HAS_PTHREAD
2129
2130// Sleeps for (roughly) n milli-seconds.  This function is only for
2131// testing Google Test's own constructs.  Don't use it in user tests,
2132// either directly or indirectly.
2133inline void SleepMilliseconds(int n) {
2134  const timespec time = {
2135    0,                  // 0 seconds.
2136    n * 1000L * 1000L,  // And n ms.
2137  };
2138  nanosleep(&time, NULL);
2139}
2140
2141// Allows a controller thread to pause execution of newly created
2142// threads until notified.  Instances of this class must be created
2143// and destroyed in the controller thread.
2144//
2145// This class is only for testing Google Test's own constructs. Do not
2146// use it in user tests, either directly or indirectly.
2147class Notification {
2148 public:
2149  Notification() : notified_(false) {}
2150
2151  // Notifies all threads created with this notification to start. Must
2152  // be called from the controller thread.
2153  void Notify() { notified_ = true; }
2154
2155  // Blocks until the controller thread notifies. Must be called from a test
2156  // thread.
2157  void WaitForNotification() {
2158    while(!notified_) {
2159      SleepMilliseconds(10);
2160    }
2161  }
2162
2163 private:
2164  volatile bool notified_;
2165
2166  GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
2167};
2168
2169// As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
2170// Consequently, it cannot select a correct instantiation of ThreadWithParam
2171// in order to call its Run(). Introducing ThreadWithParamBase as a
2172// non-templated base class for ThreadWithParam allows us to bypass this
2173// problem.
2174class ThreadWithParamBase {
2175 public:
2176  virtual ~ThreadWithParamBase() {}
2177  virtual void Run() = 0;
2178};
2179
2180// pthread_create() accepts a pointer to a function type with the C linkage.
2181// According to the Standard (7.5/1), function types with different linkages
2182// are different even if they are otherwise identical.  Some compilers (for
2183// example, SunStudio) treat them as different types.  Since class methods
2184// cannot be defined with C-linkage we need to define a free C-function to
2185// pass into pthread_create().
2186extern "C" inline void* ThreadFuncWithCLinkage(void* thread) {
2187  static_cast<ThreadWithParamBase*>(thread)->Run();
2188  return NULL;
2189}
2190
2191// Helper class for testing Google Test's multi-threading constructs.
2192// To use it, write:
2193//
2194//   void ThreadFunc(int param) { /* Do things with param */ }
2195//   Notification thread_can_start;
2196//   ...
2197//   // The thread_can_start parameter is optional; you can supply NULL.
2198//   ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);
2199//   thread_can_start.Notify();
2200//
2201// These classes are only for testing Google Test's own constructs. Do
2202// not use them in user tests, either directly or indirectly.
2203template <typename T>
2204class ThreadWithParam : public ThreadWithParamBase {
2205 public:
2206  typedef void (*UserThreadFunc)(T);
2207
2208  ThreadWithParam(
2209      UserThreadFunc func, T param, Notification* thread_can_start)
2210      : func_(func),
2211        param_(param),
2212        thread_can_start_(thread_can_start),
2213        finished_(false) {
2214    ThreadWithParamBase* const base = this;
2215    // The thread can be created only after all fields except thread_
2216    // have been initialized.
2217    GTEST_CHECK_POSIX_SUCCESS_(
2218        pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base));
2219  }
2220  ~ThreadWithParam() { Join(); }
2221
2222  void Join() {
2223    if (!finished_) {
2224      GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0));
2225      finished_ = true;
2226    }
2227  }
2228
2229  virtual void Run() {
2230    if (thread_can_start_ != NULL)
2231      thread_can_start_->WaitForNotification();
2232    func_(param_);
2233  }
2234
2235 private:
2236  const UserThreadFunc func_;  // User-supplied thread function.
2237  const T param_;  // User-supplied parameter to the thread function.
2238  // When non-NULL, used to block execution until the controller thread
2239  // notifies.
2240  Notification* const thread_can_start_;
2241  bool finished_;  // true iff we know that the thread function has finished.
2242  pthread_t thread_;  // The native thread object.
2243
2244  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
2245};
2246
2247// MutexBase and Mutex implement mutex on pthreads-based platforms. They
2248// are used in conjunction with class MutexLock:
2249//
2250//   Mutex mutex;
2251//   ...
2252//   MutexLock lock(&mutex);  // Acquires the mutex and releases it at the end
2253//                            // of the current scope.
2254//
2255// MutexBase implements behavior for both statically and dynamically
2256// allocated mutexes.  Do not use MutexBase directly.  Instead, write
2257// the following to define a static mutex:
2258//
2259//   GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);
2260//
2261// You can forward declare a static mutex like this:
2262//
2263//   GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
2264//
2265// To create a dynamic mutex, just define an object of type Mutex.
2266class MutexBase {
2267 public:
2268  // Acquires this mutex.
2269  void Lock() {
2270    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
2271    owner_ = pthread_self();
2272  }
2273
2274  // Releases this mutex.
2275  void Unlock() {
2276    // We don't protect writing to owner_ here, as it's the caller's
2277    // responsibility to ensure that the current thread holds the
2278    // mutex when this is called.
2279    owner_ = 0;
2280    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
2281  }
2282
2283  // Does nothing if the current thread holds the mutex. Otherwise, crashes
2284  // with high probability.
2285  void AssertHeld() const {
2286    GTEST_CHECK_(owner_ == pthread_self())
2287        << "The current thread is not holding the mutex @" << this;
2288  }
2289
2290  // A static mutex may be used before main() is entered.  It may even
2291  // be used before the dynamic initialization stage.  Therefore we
2292  // must be able to initialize a static mutex object at link time.
2293  // This means MutexBase has to be a POD and its member variables
2294  // have to be public.
2295 public:
2296  pthread_mutex_t mutex_;  // The underlying pthread mutex.
2297  pthread_t owner_;  // The thread holding the mutex; 0 means no one holds it.
2298};
2299
2300// Forward-declares a static mutex.
2301# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
2302    extern ::testing::internal::MutexBase mutex
2303
2304// Defines and statically (i.e. at link time) initializes a static mutex.
2305# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
2306    ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, 0 }
2307
2308// The Mutex class can only be used for mutexes created at runtime. It
2309// shares its API with MutexBase otherwise.
2310class Mutex : public MutexBase {
2311 public:
2312  Mutex() {
2313    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
2314    owner_ = 0;
2315  }
2316  ~Mutex() {
2317    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
2318  }
2319
2320 private:
2321  GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
2322};
2323
2324// We cannot name this class MutexLock as the ctor declaration would
2325// conflict with a macro named MutexLock, which is defined on some
2326// platforms.  Hence the typedef trick below.
2327class GTestMutexLock {
2328 public:
2329  explicit GTestMutexLock(MutexBase* mutex)
2330      : mutex_(mutex) { mutex_->Lock(); }
2331
2332  ~GTestMutexLock() { mutex_->Unlock(); }
2333
2334 private:
2335  MutexBase* const mutex_;
2336
2337  GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
2338};
2339
2340typedef GTestMutexLock MutexLock;
2341
2342// Helpers for ThreadLocal.
2343
2344// pthread_key_create() requires DeleteThreadLocalValue() to have
2345// C-linkage.  Therefore it cannot be templatized to access
2346// ThreadLocal<T>.  Hence the need for class
2347// ThreadLocalValueHolderBase.
2348class ThreadLocalValueHolderBase {
2349 public:
2350  virtual ~ThreadLocalValueHolderBase() {}
2351};
2352
2353// Called by pthread to delete thread-local data stored by
2354// pthread_setspecific().
2355extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
2356  delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
2357}
2358
2359// Implements thread-local storage on pthreads-based systems.
2360//
2361//   // Thread 1
2362//   ThreadLocal<int> tl(100);  // 100 is the default value for each thread.
2363//
2364//   // Thread 2
2365//   tl.set(150);  // Changes the value for thread 2 only.
2366//   EXPECT_EQ(150, tl.get());
2367//
2368//   // Thread 1
2369//   EXPECT_EQ(100, tl.get());  // In thread 1, tl has the original value.
2370//   tl.set(200);
2371//   EXPECT_EQ(200, tl.get());
2372//
2373// The template type argument T must have a public copy constructor.
2374// In addition, the default ThreadLocal constructor requires T to have
2375// a public default constructor.
2376//
2377// An object managed for a thread by a ThreadLocal instance is deleted
2378// when the thread exits.  Or, if the ThreadLocal instance dies in
2379// that thread, when the ThreadLocal dies.  It's the user's
2380// responsibility to ensure that all other threads using a ThreadLocal
2381// have exited when it dies, or the per-thread objects for those
2382// threads will not be deleted.
2383//
2384// Google Test only uses global ThreadLocal objects.  That means they
2385// will die after main() has returned.  Therefore, no per-thread
2386// object managed by Google Test will be leaked as long as all threads
2387// using Google Test have exited when main() returns.
2388template <typename T>
2389class ThreadLocal {
2390 public:
2391  ThreadLocal() : key_(CreateKey()),
2392                  default_() {}
2393  explicit ThreadLocal(const T& value) : key_(CreateKey()),
2394                                         default_(value) {}
2395
2396  ~ThreadLocal() {
2397    // Destroys the managed object for the current thread, if any.
2398    DeleteThreadLocalValue(pthread_getspecific(key_));
2399
2400    // Releases resources associated with the key.  This will *not*
2401    // delete managed objects for other threads.
2402    GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));
2403  }
2404
2405  T* pointer() { return GetOrCreateValue(); }
2406  const T* pointer() const { return GetOrCreateValue(); }
2407  const T& get() const { return *pointer(); }
2408  void set(const T& value) { *pointer() = value; }
2409
2410 private:
2411  // Holds a value of type T.
2412  class ValueHolder : public ThreadLocalValueHolderBase {
2413   public:
2414    explicit ValueHolder(const T& value) : value_(value) {}
2415
2416    T* pointer() { return &value_; }
2417
2418   private:
2419    T value_;
2420    GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
2421  };
2422
2423  static pthread_key_t CreateKey() {
2424    pthread_key_t key;
2425    // When a thread exits, DeleteThreadLocalValue() will be called on
2426    // the object managed for that thread.
2427    GTEST_CHECK_POSIX_SUCCESS_(
2428        pthread_key_create(&key, &DeleteThreadLocalValue));
2429    return key;
2430  }
2431
2432  T* GetOrCreateValue() const {
2433    ThreadLocalValueHolderBase* const holder =
2434        static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));
2435    if (holder != NULL) {
2436      return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
2437    }
2438
2439    ValueHolder* const new_holder = new ValueHolder(default_);
2440    ThreadLocalValueHolderBase* const holder_base = new_holder;
2441    GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
2442    return new_holder->pointer();
2443  }
2444
2445  // A key pthreads uses for looking up per-thread values.
2446  const pthread_key_t key_;
2447  const T default_;  // The default value for each thread.
2448
2449  GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
2450};
2451
2452# define GTEST_IS_THREADSAFE 1
2453
2454#else  // GTEST_HAS_PTHREAD
2455
2456// A dummy implementation of synchronization primitives (mutex, lock,
2457// and thread-local variable).  Necessary for compiling Google Test where
2458// mutex is not supported - using Google Test in multiple threads is not
2459// supported on such platforms.
2460
2461class Mutex {
2462 public:
2463  Mutex() {}
2464  void AssertHeld() const {}
2465};
2466
2467# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
2468  extern ::testing::internal::Mutex mutex
2469
2470# define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
2471
2472class GTestMutexLock {
2473 public:
2474  explicit GTestMutexLock(Mutex*) {}  // NOLINT
2475};
2476
2477typedef GTestMutexLock MutexLock;
2478
2479template <typename T>
2480class ThreadLocal {
2481 public:
2482  ThreadLocal() : value_() {}
2483  explicit ThreadLocal(const T& value) : value_(value) {}
2484  T* pointer() { return &value_; }
2485  const T* pointer() const { return &value_; }
2486  const T& get() const { return value_; }
2487  void set(const T& value) { value_ = value; }
2488 private:
2489  T value_;
2490};
2491
2492// The above synchronization primitives have dummy implementations.
2493// Therefore Google Test is not thread-safe.
2494# define GTEST_IS_THREADSAFE 0
2495
2496#endif  // GTEST_HAS_PTHREAD
2497
2498// Returns the number of threads running in the process, or 0 to indicate that
2499// we cannot detect it.
2500GTEST_API_ size_t GetThreadCount();
2501
2502// Passing non-POD classes through ellipsis (...) crashes the ARM
2503// compiler and generates a warning in Sun Studio.  The Nokia Symbian
2504// and the IBM XL C/C++ compiler try to instantiate a copy constructor
2505// for objects passed through ellipsis (...), failing for uncopyable
2506// objects.  We define this to ensure that only POD is passed through
2507// ellipsis on these systems.
2508#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
2509// We lose support for NULL detection where the compiler doesn't like
2510// passing non-POD classes through ellipsis (...).
2511# define GTEST_ELLIPSIS_NEEDS_POD_ 1
2512#else
2513# define GTEST_CAN_COMPARE_NULL 1
2514#endif
2515
2516// The Nokia Symbian and IBM XL C/C++ compilers cannot decide between
2517// const T& and const T* in a function template.  These compilers
2518// _can_ decide between class template specializations for T and T*,
2519// so a tr1::type_traits-like is_pointer works.
2520#if defined(__SYMBIAN32__) || defined(__IBMCPP__)
2521# define GTEST_NEEDS_IS_POINTER_ 1
2522#endif
2523
2524template <bool bool_value>
2525struct bool_constant {
2526  typedef bool_constant<bool_value> type;
2527  static const bool value = bool_value;
2528};
2529template <bool bool_value> const bool bool_constant<bool_value>::value;
2530
2531typedef bool_constant<false> false_type;
2532typedef bool_constant<true> true_type;
2533
2534template <typename T>
2535struct is_pointer : public false_type {};
2536
2537template <typename T>
2538struct is_pointer<T*> : public true_type {};
2539
2540template <typename Iterator>
2541struct IteratorTraits {
2542  typedef typename Iterator::value_type value_type;
2543};
2544
2545template <typename T>
2546struct IteratorTraits<T*> {
2547  typedef T value_type;
2548};
2549
2550template <typename T>
2551struct IteratorTraits<const T*> {
2552  typedef T value_type;
2553};
2554
2555#if GTEST_OS_WINDOWS
2556# define GTEST_PATH_SEP_ "\\"
2557# define GTEST_HAS_ALT_PATH_SEP_ 1
2558// The biggest signed integer type the compiler supports.
2559typedef __int64 BiggestInt;
2560#else
2561# define GTEST_PATH_SEP_ "/"
2562# define GTEST_HAS_ALT_PATH_SEP_ 0
2563typedef long long BiggestInt;  // NOLINT
2564#endif  // GTEST_OS_WINDOWS
2565
2566// Utilities for char.
2567
2568// isspace(int ch) and friends accept an unsigned char or EOF.  char
2569// may be signed, depending on the compiler (or compiler flags).
2570// Therefore we need to cast a char to unsigned char before calling
2571// isspace(), etc.
2572
2573inline bool IsAlpha(char ch) {
2574  return isalpha(static_cast<unsigned char>(ch)) != 0;
2575}
2576inline bool IsAlNum(char ch) {
2577  return isalnum(static_cast<unsigned char>(ch)) != 0;
2578}
2579inline bool IsDigit(char ch) {
2580  return isdigit(static_cast<unsigned char>(ch)) != 0;
2581}
2582inline bool IsLower(char ch) {
2583  return islower(static_cast<unsigned char>(ch)) != 0;
2584}
2585inline bool IsSpace(char ch) {
2586  return isspace(static_cast<unsigned char>(ch)) != 0;
2587}
2588inline bool IsUpper(char ch) {
2589  return isupper(static_cast<unsigned char>(ch)) != 0;
2590}
2591inline bool IsXDigit(char ch) {
2592  return isxdigit(static_cast<unsigned char>(ch)) != 0;
2593}
2594
2595inline char ToLower(char ch) {
2596  return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
2597}
2598inline char ToUpper(char ch) {
2599  return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
2600}
2601
2602// The testing::internal::posix namespace holds wrappers for common
2603// POSIX functions.  These wrappers hide the differences between
2604// Windows/MSVC and POSIX systems.  Since some compilers define these
2605// standard functions as macros, the wrapper cannot have the same name
2606// as the wrapped function.
2607
2608namespace posix {
2609
2610// Functions with a different name on Windows.
2611
2612#if GTEST_OS_WINDOWS
2613
2614typedef struct _stat StatStruct;
2615
2616# ifdef __BORLANDC__
2617inline int IsATTY(int fd) { return isatty(fd); }
2618inline int StrCaseCmp(const char* s1, const char* s2) {
2619  return stricmp(s1, s2);
2620}
2621inline char* StrDup(const char* src) { return strdup(src); }
2622# else  // !__BORLANDC__
2623#  if GTEST_OS_WINDOWS_MOBILE
2624inline int IsATTY(int /* fd */) { return 0; }
2625#  else
2626inline int IsATTY(int fd) { return _isatty(fd); }
2627#  endif  // GTEST_OS_WINDOWS_MOBILE
2628inline int StrCaseCmp(const char* s1, const char* s2) {
2629  return _stricmp(s1, s2);
2630}
2631inline char* StrDup(const char* src) { return _strdup(src); }
2632# endif  // __BORLANDC__
2633
2634# if GTEST_OS_WINDOWS_MOBILE
2635inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
2636// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
2637// time and thus not defined there.
2638# else
2639inline int FileNo(FILE* file) { return _fileno(file); }
2640inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
2641inline int RmDir(const char* dir) { return _rmdir(dir); }
2642inline bool IsDir(const StatStruct& st) {
2643  return (_S_IFDIR & st.st_mode) != 0;
2644}
2645# endif  // GTEST_OS_WINDOWS_MOBILE
2646
2647#else
2648
2649typedef struct stat StatStruct;
2650
2651inline int FileNo(FILE* file) { return fileno(file); }
2652inline int IsATTY(int fd) { return isatty(fd); }
2653inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }
2654inline int StrCaseCmp(const char* s1, const char* s2) {
2655  return strcasecmp(s1, s2);
2656}
2657inline char* StrDup(const char* src) { return strdup(src); }
2658inline int RmDir(const char* dir) { return rmdir(dir); }
2659inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
2660
2661#endif  // GTEST_OS_WINDOWS
2662
2663// Functions deprecated by MSVC 8.0.
2664
2665#ifdef _MSC_VER
2666// Temporarily disable warning 4996 (deprecated function).
2667# pragma warning(push)
2668# pragma warning(disable:4996)
2669#endif
2670
2671inline const char* StrNCpy(char* dest, const char* src, size_t n) {
2672  return strncpy(dest, src, n);
2673}
2674
2675// ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
2676// StrError() aren't needed on Windows CE at this time and thus not
2677// defined there.
2678
2679#if !GTEST_OS_WINDOWS_MOBILE
2680inline int ChDir(const char* dir) { return chdir(dir); }
2681#endif
2682inline FILE* FOpen(const char* path, const char* mode) {
2683  return fopen(path, mode);
2684}
2685#if !GTEST_OS_WINDOWS_MOBILE
2686inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
2687  return freopen(path, mode, stream);
2688}
2689inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
2690#endif
2691inline int FClose(FILE* fp) { return fclose(fp); }
2692#if !GTEST_OS_WINDOWS_MOBILE
2693inline int Read(int fd, void* buf, unsigned int count) {
2694  return static_cast<int>(read(fd, buf, count));
2695}
2696inline int Write(int fd, const void* buf, unsigned int count) {
2697  return static_cast<int>(write(fd, buf, count));
2698}
2699inline int Close(int fd) { return close(fd); }
2700inline const char* StrError(int errnum) { return strerror(errnum); }
2701#endif
2702inline const char* GetEnv(const char* name) {
2703#if GTEST_OS_WINDOWS_MOBILE
2704  // We are on Windows CE, which has no environment variables.
2705  return NULL;
2706#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
2707  // Environment variables which we programmatically clear will be set to the
2708  // empty string rather than unset (NULL).  Handle that case.
2709  const char* const env = getenv(name);
2710  return (env != NULL && env[0] != '\0') ? env : NULL;
2711#else
2712  return getenv(name);
2713#endif
2714}
2715
2716#ifdef _MSC_VER
2717# pragma warning(pop)  // Restores the warning state.
2718#endif
2719
2720#if GTEST_OS_WINDOWS_MOBILE
2721// Windows CE has no C library. The abort() function is used in
2722// several places in Google Test. This implementation provides a reasonable
2723// imitation of standard behaviour.
2724void Abort();
2725#else
2726inline void Abort() { abort(); }
2727#endif  // GTEST_OS_WINDOWS_MOBILE
2728
2729}  // namespace posix
2730
2731// The maximum number a BiggestInt can represent.  This definition
2732// works no matter BiggestInt is represented in one's complement or
2733// two's complement.
2734//
2735// We cannot rely on numeric_limits in STL, as __int64 and long long
2736// are not part of standard C++ and numeric_limits doesn't need to be
2737// defined for them.
2738const BiggestInt kMaxBiggestInt =
2739    ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));
2740
2741// This template class serves as a compile-time function from size to
2742// type.  It maps a size in bytes to a primitive type with that
2743// size. e.g.
2744//
2745//   TypeWithSize<4>::UInt
2746//
2747// is typedef-ed to be unsigned int (unsigned integer made up of 4
2748// bytes).
2749//
2750// Such functionality should belong to STL, but I cannot find it
2751// there.
2752//
2753// Google Test uses this class in the implementation of floating-point
2754// comparison.
2755//
2756// For now it only handles UInt (unsigned int) as that's all Google Test
2757// needs.  Other types can be easily added in the future if need
2758// arises.
2759template <size_t size>
2760class TypeWithSize {
2761 public:
2762  // This prevents the user from using TypeWithSize<N> with incorrect
2763  // values of N.
2764  typedef void UInt;
2765};
2766
2767// The specialization for size 4.
2768template <>
2769class TypeWithSize<4> {
2770 public:
2771  // unsigned int has size 4 in both gcc and MSVC.
2772  //
2773  // As base/basictypes.h doesn't compile on Windows, we cannot use
2774  // uint32, uint64, and etc here.
2775  typedef int Int;
2776  typedef unsigned int UInt;
2777};
2778
2779// The specialization for size 8.
2780template <>
2781class TypeWithSize<8> {
2782 public:
2783
2784#if GTEST_OS_WINDOWS
2785  typedef __int64 Int;
2786  typedef unsigned __int64 UInt;
2787#else
2788  typedef long long Int;  // NOLINT
2789  typedef unsigned long long UInt;  // NOLINT
2790#endif  // GTEST_OS_WINDOWS
2791};
2792
2793// Integer types of known sizes.
2794typedef TypeWithSize<4>::Int Int32;
2795typedef TypeWithSize<4>::UInt UInt32;
2796typedef TypeWithSize<8>::Int Int64;
2797typedef TypeWithSize<8>::UInt UInt64;
2798typedef TypeWithSize<8>::Int TimeInMillis;  // Represents time in milliseconds.
2799
2800// Utilities for command line flags and environment variables.
2801
2802// Macro for referencing flags.
2803#define GTEST_FLAG(name) FLAGS_gtest_##name
2804
2805// Macros for declaring flags.
2806#define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
2807#define GTEST_DECLARE_int32_(name) \
2808    GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
2809#define GTEST_DECLARE_string_(name) \
2810    GTEST_API_ extern ::testing::internal::String GTEST_FLAG(name)
2811
2812// Macros for defining flags.
2813#define GTEST_DEFINE_bool_(name, default_val, doc) \
2814    GTEST_API_ bool GTEST_FLAG(name) = (default_val)
2815#define GTEST_DEFINE_int32_(name, default_val, doc) \
2816    GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
2817#define GTEST_DEFINE_string_(name, default_val, doc) \
2818    GTEST_API_ ::testing::internal::String GTEST_FLAG(name) = (default_val)
2819
2820// Parses 'str' for a 32-bit signed integer.  If successful, writes the result
2821// to *value and returns true; otherwise leaves *value unchanged and returns
2822// false.
2823// TODO(chandlerc): Find a better way to refactor flag and environment parsing
2824// out of both gtest-port.cc and gtest.cc to avoid exporting this utility
2825// function.
2826bool ParseInt32(const Message& src_text, const char* str, Int32* value);
2827
2828// Parses a bool/Int32/string from the environment variable
2829// corresponding to the given Google Test flag.
2830bool BoolFromGTestEnv(const char* flag, bool default_val);
2831GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
2832const char* StringFromGTestEnv(const char* flag, const char* default_val);
2833
2834}  // namespace internal
2835}  // namespace testing
2836
2837#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
2838
2839#if GTEST_OS_LINUX
2840# include <stdlib.h>
2841# include <sys/types.h>
2842# include <sys/wait.h>
2843# include <unistd.h>
2844#endif  // GTEST_OS_LINUX
2845
2846#include <ctype.h>
2847#include <string.h>
2848#include <iomanip>
2849#include <limits>
2850#include <set>
2851
2852// Copyright 2005, Google Inc.
2853// All rights reserved.
2854//
2855// Redistribution and use in source and binary forms, with or without
2856// modification, are permitted provided that the following conditions are
2857// met:
2858//
2859//     * Redistributions of source code must retain the above copyright
2860// notice, this list of conditions and the following disclaimer.
2861//     * Redistributions in binary form must reproduce the above
2862// copyright notice, this list of conditions and the following disclaimer
2863// in the documentation and/or other materials provided with the
2864// distribution.
2865//     * Neither the name of Google Inc. nor the names of its
2866// contributors may be used to endorse or promote products derived from
2867// this software without specific prior written permission.
2868//
2869// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2870// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2871// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2872// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2873// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2874// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2875// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2876// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2877// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2878// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2879// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2880//
2881// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
2882//
2883// The Google C++ Testing Framework (Google Test)
2884//
2885// This header file declares the String class and functions used internally by
2886// Google Test.  They are subject to change without notice. They should not used
2887// by code external to Google Test.
2888//
2889// This header file is #included by <gtest/internal/gtest-internal.h>.
2890// It should not be #included by other files.
2891
2892#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
2893#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
2894
2895#ifdef __BORLANDC__
2896// string.h is not guaranteed to provide strcpy on C++ Builder.
2897# include <mem.h>
2898#endif
2899
2900#include <string.h>
2901
2902#include <string>
2903
2904namespace testing {
2905namespace internal {
2906
2907// String - a UTF-8 string class.
2908//
2909// For historic reasons, we don't use std::string.
2910//
2911// TODO(wan@google.com): replace this class with std::string or
2912// implement it in terms of the latter.
2913//
2914// Note that String can represent both NULL and the empty string,
2915// while std::string cannot represent NULL.
2916//
2917// NULL and the empty string are considered different.  NULL is less
2918// than anything (including the empty string) except itself.
2919//
2920// This class only provides minimum functionality necessary for
2921// implementing Google Test.  We do not intend to implement a full-fledged
2922// string class here.
2923//
2924// Since the purpose of this class is to provide a substitute for
2925// std::string on platforms where it cannot be used, we define a copy
2926// constructor and assignment operators such that we don't need
2927// conditional compilation in a lot of places.
2928//
2929// In order to make the representation efficient, the d'tor of String
2930// is not virtual.  Therefore DO NOT INHERIT FROM String.
2931class GTEST_API_ String {
2932 public:
2933  // Static utility methods
2934
2935  // Returns the input enclosed in double quotes if it's not NULL;
2936  // otherwise returns "(null)".  For example, "\"Hello\"" is returned
2937  // for input "Hello".
2938  //
2939  // This is useful for printing a C string in the syntax of a literal.
2940  //
2941  // Known issue: escape sequences are not handled yet.
2942  static String ShowCStringQuoted(const char* c_str);
2943
2944  // Clones a 0-terminated C string, allocating memory using new.  The
2945  // caller is responsible for deleting the return value using
2946  // delete[].  Returns the cloned string, or NULL if the input is
2947  // NULL.
2948  //
2949  // This is different from strdup() in string.h, which allocates
2950  // memory using malloc().
2951  static const char* CloneCString(const char* c_str);
2952
2953#if GTEST_OS_WINDOWS_MOBILE
2954  // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
2955  // able to pass strings to Win32 APIs on CE we need to convert them
2956  // to 'Unicode', UTF-16.
2957
2958  // Creates a UTF-16 wide string from the given ANSI string, allocating
2959  // memory using new. The caller is responsible for deleting the return
2960  // value using delete[]. Returns the wide string, or NULL if the
2961  // input is NULL.
2962  //
2963  // The wide string is created using the ANSI codepage (CP_ACP) to
2964  // match the behaviour of the ANSI versions of Win32 calls and the
2965  // C runtime.
2966  static LPCWSTR AnsiToUtf16(const char* c_str);
2967
2968  // Creates an ANSI string from the given wide string, allocating
2969  // memory using new. The caller is responsible for deleting the return
2970  // value using delete[]. Returns the ANSI string, or NULL if the
2971  // input is NULL.
2972  //
2973  // The returned string is created using the ANSI codepage (CP_ACP) to
2974  // match the behaviour of the ANSI versions of Win32 calls and the
2975  // C runtime.
2976  static const char* Utf16ToAnsi(LPCWSTR utf16_str);
2977#endif
2978
2979  // Compares two C strings.  Returns true iff they have the same content.
2980  //
2981  // Unlike strcmp(), this function can handle NULL argument(s).  A
2982  // NULL C string is considered different to any non-NULL C string,
2983  // including the empty string.
2984  static bool CStringEquals(const char* lhs, const char* rhs);
2985
2986  // Converts a wide C string to a String using the UTF-8 encoding.
2987  // NULL will be converted to "(null)".  If an error occurred during
2988  // the conversion, "(failed to convert from wide string)" is
2989  // returned.
2990  static String ShowWideCString(const wchar_t* wide_c_str);
2991
2992  // Similar to ShowWideCString(), except that this function encloses
2993  // the converted string in double quotes.
2994  static String ShowWideCStringQuoted(const wchar_t* wide_c_str);
2995
2996  // Compares two wide C strings.  Returns true iff they have the same
2997  // content.
2998  //
2999  // Unlike wcscmp(), this function can handle NULL argument(s).  A
3000  // NULL C string is considered different to any non-NULL C string,
3001  // including the empty string.
3002  static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
3003
3004  // Compares two C strings, ignoring case.  Returns true iff they
3005  // have the same content.
3006  //
3007  // Unlike strcasecmp(), this function can handle NULL argument(s).
3008  // A NULL C string is considered different to any non-NULL C string,
3009  // including the empty string.
3010  static bool CaseInsensitiveCStringEquals(const char* lhs,
3011                                           const char* rhs);
3012
3013  // Compares two wide C strings, ignoring case.  Returns true iff they
3014  // have the same content.
3015  //
3016  // Unlike wcscasecmp(), this function can handle NULL argument(s).
3017  // A NULL C string is considered different to any non-NULL wide C string,
3018  // including the empty string.
3019  // NB: The implementations on different platforms slightly differ.
3020  // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
3021  // environment variable. On GNU platform this method uses wcscasecmp
3022  // which compares according to LC_CTYPE category of the current locale.
3023  // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
3024  // current locale.
3025  static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
3026                                               const wchar_t* rhs);
3027
3028  // Formats a list of arguments to a String, using the same format
3029  // spec string as for printf.
3030  //
3031  // We do not use the StringPrintf class as it is not universally
3032  // available.
3033  //
3034  // The result is limited to 4096 characters (including the tailing
3035  // 0).  If 4096 characters are not enough to format the input,
3036  // "<buffer exceeded>" is returned.
3037  static String Format(const char* format, ...);
3038
3039  // C'tors
3040
3041  // The default c'tor constructs a NULL string.
3042  String() : c_str_(NULL), length_(0) {}
3043
3044  // Constructs a String by cloning a 0-terminated C string.
3045  String(const char* a_c_str) {  // NOLINT
3046    if (a_c_str == NULL) {
3047      c_str_ = NULL;
3048      length_ = 0;
3049    } else {
3050      ConstructNonNull(a_c_str, strlen(a_c_str));
3051    }
3052  }
3053
3054  // Constructs a String by copying a given number of chars from a
3055  // buffer.  E.g. String("hello", 3) creates the string "hel",
3056  // String("a\0bcd", 4) creates "a\0bc", String(NULL, 0) creates "",
3057  // and String(NULL, 1) results in access violation.
3058  String(const char* buffer, size_t a_length) {
3059    ConstructNonNull(buffer, a_length);
3060  }
3061
3062  // The copy c'tor creates a new copy of the string.  The two
3063  // String objects do not share content.
3064  String(const String& str) : c_str_(NULL), length_(0) { *this = str; }
3065
3066  // D'tor.  String is intended to be a final class, so the d'tor
3067  // doesn't need to be virtual.
3068  ~String() { delete[] c_str_; }
3069
3070  // Allows a String to be implicitly converted to an ::std::string or
3071  // ::string, and vice versa.  Converting a String containing a NULL
3072  // pointer to ::std::string or ::string is undefined behavior.
3073  // Converting a ::std::string or ::string containing an embedded NUL
3074  // character to a String will result in the prefix up to the first
3075  // NUL character.
3076  String(const ::std::string& str) {
3077    ConstructNonNull(str.c_str(), str.length());
3078  }
3079
3080  operator ::std::string() const { return ::std::string(c_str(), length()); }
3081
3082#if GTEST_HAS_GLOBAL_STRING
3083  String(const ::string& str) {
3084    ConstructNonNull(str.c_str(), str.length());
3085  }
3086
3087  operator ::string() const { return ::string(c_str(), length()); }
3088#endif  // GTEST_HAS_GLOBAL_STRING
3089
3090  // Returns true iff this is an empty string (i.e. "").
3091  bool empty() const { return (c_str() != NULL) && (length() == 0); }
3092
3093  // Compares this with another String.
3094  // Returns < 0 if this is less than rhs, 0 if this is equal to rhs, or > 0
3095  // if this is greater than rhs.
3096  int Compare(const String& rhs) const;
3097
3098  // Returns true iff this String equals the given C string.  A NULL
3099  // string and a non-NULL string are considered not equal.
3100  bool operator==(const char* a_c_str) const { return Compare(a_c_str) == 0; }
3101
3102  // Returns true iff this String is less than the given String.  A
3103  // NULL string is considered less than "".
3104  bool operator<(const String& rhs) const { return Compare(rhs) < 0; }
3105
3106  // Returns true iff this String doesn't equal the given C string.  A NULL
3107  // string and a non-NULL string are considered not equal.
3108  bool operator!=(const char* a_c_str) const { return !(*this == a_c_str); }
3109
3110  // Returns true iff this String ends with the given suffix.  *Any*
3111  // String is considered to end with a NULL or empty suffix.
3112  bool EndsWith(const char* suffix) const;
3113
3114  // Returns true iff this String ends with the given suffix, not considering
3115  // case. Any String is considered to end with a NULL or empty suffix.
3116  bool EndsWithCaseInsensitive(const char* suffix) const;
3117
3118  // Returns the length of the encapsulated string, or 0 if the
3119  // string is NULL.
3120  size_t length() const { return length_; }
3121
3122  // Gets the 0-terminated C string this String object represents.
3123  // The String object still owns the string.  Therefore the caller
3124  // should NOT delete the return value.
3125  const char* c_str() const { return c_str_; }
3126
3127  // Assigns a C string to this object.  Self-assignment works.
3128  const String& operator=(const char* a_c_str) {
3129    return *this = String(a_c_str);
3130  }
3131
3132  // Assigns a String object to this object.  Self-assignment works.
3133  const String& operator=(const String& rhs) {
3134    if (this != &rhs) {
3135      delete[] c_str_;
3136      if (rhs.c_str() == NULL) {
3137        c_str_ = NULL;
3138        length_ = 0;
3139      } else {
3140        ConstructNonNull(rhs.c_str(), rhs.length());
3141      }
3142    }
3143
3144    return *this;
3145  }
3146
3147 private:
3148  // Constructs a non-NULL String from the given content.  This
3149  // function can only be called when c_str_ has not been allocated.
3150  // ConstructNonNull(NULL, 0) results in an empty string ("").
3151  // ConstructNonNull(NULL, non_zero) is undefined behavior.
3152  void ConstructNonNull(const char* buffer, size_t a_length) {
3153    char* const str = new char[a_length + 1];
3154    memcpy(str, buffer, a_length);
3155    str[a_length] = '\0';
3156    c_str_ = str;
3157    length_ = a_length;
3158  }
3159
3160  const char* c_str_;
3161  size_t length_;
3162};  // class String
3163
3164// Streams a String to an ostream.  Each '\0' character in the String
3165// is replaced with "\\0".
3166inline ::std::ostream& operator<<(::std::ostream& os, const String& str) {
3167  if (str.c_str() == NULL) {
3168    os << "(null)";
3169  } else {
3170    const char* const c_str = str.c_str();
3171    for (size_t i = 0; i != str.length(); i++) {
3172      if (c_str[i] == '\0') {
3173        os << "\\0";
3174      } else {
3175        os << c_str[i];
3176      }
3177    }
3178  }
3179  return os;
3180}
3181
3182// Gets the content of the stringstream's buffer as a String.  Each '\0'
3183// character in the buffer is replaced with "\\0".
3184GTEST_API_ String StringStreamToString(::std::stringstream* stream);
3185
3186// Converts a streamable value to a String.  A NULL pointer is
3187// converted to "(null)".  When the input value is a ::string,
3188// ::std::string, ::wstring, or ::std::wstring object, each NUL
3189// character in it is replaced with "\\0".
3190
3191// Declared here but defined in gtest.h, so that it has access
3192// to the definition of the Message class, required by the ARM
3193// compiler.
3194template <typename T>
3195String StreamableToString(const T& streamable);
3196
3197}  // namespace internal
3198}  // namespace testing
3199
3200#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
3201// Copyright 2008, Google Inc.
3202// All rights reserved.
3203//
3204// Redistribution and use in source and binary forms, with or without
3205// modification, are permitted provided that the following conditions are
3206// met:
3207//
3208//     * Redistributions of source code must retain the above copyright
3209// notice, this list of conditions and the following disclaimer.
3210//     * Redistributions in binary form must reproduce the above
3211// copyright notice, this list of conditions and the following disclaimer
3212// in the documentation and/or other materials provided with the
3213// distribution.
3214//     * Neither the name of Google Inc. nor the names of its
3215// contributors may be used to endorse or promote products derived from
3216// this software without specific prior written permission.
3217//
3218// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3219// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3220// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3221// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3222// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3223// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3224// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3225// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3226// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3227// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3228// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3229//
3230// Author: keith.ray@gmail.com (Keith Ray)
3231//
3232// Google Test filepath utilities
3233//
3234// This header file declares classes and functions used internally by
3235// Google Test.  They are subject to change without notice.
3236//
3237// This file is #included in <gtest/internal/gtest-internal.h>.
3238// Do not include this header file separately!
3239
3240#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
3241#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
3242
3243
3244namespace testing {
3245namespace internal {
3246
3247// FilePath - a class for file and directory pathname manipulation which
3248// handles platform-specific conventions (like the pathname separator).
3249// Used for helper functions for naming files in a directory for xml output.
3250// Except for Set methods, all methods are const or static, which provides an
3251// "immutable value object" -- useful for peace of mind.
3252// A FilePath with a value ending in a path separator ("like/this/") represents
3253// a directory, otherwise it is assumed to represent a file. In either case,
3254// it may or may not represent an actual file or directory in the file system.
3255// Names are NOT checked for syntax correctness -- no checking for illegal
3256// characters, malformed paths, etc.
3257
3258class GTEST_API_ FilePath {
3259 public:
3260  FilePath() : pathname_("") { }
3261  FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
3262
3263  explicit FilePath(const char* pathname) : pathname_(pathname) {
3264    Normalize();
3265  }
3266
3267  explicit FilePath(const String& pathname) : pathname_(pathname) {
3268    Normalize();
3269  }
3270
3271  FilePath& operator=(const FilePath& rhs) {
3272    Set(rhs);
3273    return *this;
3274  }
3275
3276  void Set(const FilePath& rhs) {
3277    pathname_ = rhs.pathname_;
3278  }
3279
3280  String ToString() const { return pathname_; }
3281  const char* c_str() const { return pathname_.c_str(); }
3282
3283  // Returns the current working directory, or "" if unsuccessful.
3284  static FilePath GetCurrentDir();
3285
3286  // Given directory = "dir", base_name = "test", number = 0,
3287  // extension = "xml", returns "dir/test.xml". If number is greater
3288  // than zero (e.g., 12), returns "dir/test_12.xml".
3289  // On Windows platform, uses \ as the separator rather than /.
3290  static FilePath MakeFileName(const FilePath& directory,
3291                               const FilePath& base_name,
3292                               int number,
3293                               const char* extension);
3294
3295  // Given directory = "dir", relative_path = "test.xml",
3296  // returns "dir/test.xml".
3297  // On Windows, uses \ as the separator rather than /.
3298  static FilePath ConcatPaths(const FilePath& directory,
3299                              const FilePath& relative_path);
3300
3301  // Returns a pathname for a file that does not currently exist. The pathname
3302  // will be directory/base_name.extension or
3303  // directory/base_name_<number>.extension if directory/base_name.extension
3304  // already exists. The number will be incremented until a pathname is found
3305  // that does not already exist.
3306  // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
3307  // There could be a race condition if two or more processes are calling this
3308  // function at the same time -- they could both pick the same filename.
3309  static FilePath GenerateUniqueFileName(const FilePath& directory,
3310                                         const FilePath& base_name,
3311                                         const char* extension);
3312
3313  // Returns true iff the path is NULL or "".
3314  bool IsEmpty() const { return c_str() == NULL || *c_str() == '\0'; }
3315
3316  // If input name has a trailing separator character, removes it and returns
3317  // the name, otherwise return the name string unmodified.
3318  // On Windows platform, uses \ as the separator, other platforms use /.
3319  FilePath RemoveTrailingPathSeparator() const;
3320
3321  // Returns a copy of the FilePath with the directory part removed.
3322  // Example: FilePath("path/to/file").RemoveDirectoryName() returns
3323  // FilePath("file"). If there is no directory part ("just_a_file"), it returns
3324  // the FilePath unmodified. If there is no file part ("just_a_dir/") it
3325  // returns an empty FilePath ("").
3326  // On Windows platform, '\' is the path separator, otherwise it is '/'.
3327  FilePath RemoveDirectoryName() const;
3328
3329  // RemoveFileName returns the directory path with the filename removed.
3330  // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
3331  // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
3332  // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
3333  // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
3334  // On Windows platform, '\' is the path separator, otherwise it is '/'.
3335  FilePath RemoveFileName() const;
3336
3337  // Returns a copy of the FilePath with the case-insensitive extension removed.
3338  // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
3339  // FilePath("dir/file"). If a case-insensitive extension is not
3340  // found, returns a copy of the original FilePath.
3341  FilePath RemoveExtension(const char* extension) const;
3342
3343  // Creates directories so that path exists. Returns true if successful or if
3344  // the directories already exist; returns false if unable to create
3345  // directories for any reason. Will also return false if the FilePath does
3346  // not represent a directory (that is, it doesn't end with a path separator).
3347  bool CreateDirectoriesRecursively() const;
3348
3349  // Create the directory so that path exists. Returns true if successful or
3350  // if the directory already exists; returns false if unable to create the
3351  // directory for any reason, including if the parent directory does not
3352  // exist. Not named "CreateDirectory" because that's a macro on Windows.
3353  bool CreateFolder() const;
3354
3355  // Returns true if FilePath describes something in the file-system,
3356  // either a file, directory, or whatever, and that something exists.
3357  bool FileOrDirectoryExists() const;
3358
3359  // Returns true if pathname describes a directory in the file-system
3360  // that exists.
3361  bool DirectoryExists() const;
3362
3363  // Returns true if FilePath ends with a path separator, which indicates that
3364  // it is intended to represent a directory. Returns false otherwise.
3365  // This does NOT check that a directory (or file) actually exists.
3366  bool IsDirectory() const;
3367
3368  // Returns true if pathname describes a root directory. (Windows has one
3369  // root directory per disk drive.)
3370  bool IsRootDirectory() const;
3371
3372  // Returns true if pathname describes an absolute path.
3373  bool IsAbsolutePath() const;
3374
3375 private:
3376  // Replaces multiple consecutive separators with a single separator.
3377  // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
3378  // redundancies that might be in a pathname involving "." or "..".
3379  //
3380  // A pathname with multiple consecutive separators may occur either through
3381  // user error or as a result of some scripts or APIs that generate a pathname
3382  // with a trailing separator. On other platforms the same API or script
3383  // may NOT generate a pathname with a trailing "/". Then elsewhere that
3384  // pathname may have another "/" and pathname components added to it,
3385  // without checking for the separator already being there.
3386  // The script language and operating system may allow paths like "foo//bar"
3387  // but some of the functions in FilePath will not handle that correctly. In
3388  // particular, RemoveTrailingPathSeparator() only removes one separator, and
3389  // it is called in CreateDirectoriesRecursively() assuming that it will change
3390  // a pathname from directory syntax (trailing separator) to filename syntax.
3391  //
3392  // On Windows this method also replaces the alternate path separator '/' with
3393  // the primary path separator '\\', so that for example "bar\\/\\foo" becomes
3394  // "bar\\foo".
3395
3396  void Normalize();
3397
3398  // Returns a pointer to the last occurence of a valid path separator in
3399  // the FilePath. On Windows, for example, both '/' and '\' are valid path
3400  // separators. Returns NULL if no path separator was found.
3401  const char* FindLastPathSeparator() const;
3402
3403  String pathname_;
3404};  // class FilePath
3405
3406}  // namespace internal
3407}  // namespace testing
3408
3409#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
3410// This file was GENERATED by command:
3411//     pump.py gtest-type-util.h.pump
3412// DO NOT EDIT BY HAND!!!
3413
3414// Copyright 2008 Google Inc.
3415// All Rights Reserved.
3416//
3417// Redistribution and use in source and binary forms, with or without
3418// modification, are permitted provided that the following conditions are
3419// met:
3420//
3421//     * Redistributions of source code must retain the above copyright
3422// notice, this list of conditions and the following disclaimer.
3423//     * Redistributions in binary form must reproduce the above
3424// copyright notice, this list of conditions and the following disclaimer
3425// in the documentation and/or other materials provided with the
3426// distribution.
3427//     * Neither the name of Google Inc. nor the names of its
3428// contributors may be used to endorse or promote products derived from
3429// this software without specific prior written permission.
3430//
3431// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3432// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3433// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3434// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3435// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3436// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3437// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3438// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3439// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3440// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3441// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3442//
3443// Author: wan@google.com (Zhanyong Wan)
3444
3445// Type utilities needed for implementing typed and type-parameterized
3446// tests.  This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
3447//
3448// Currently we support at most 50 types in a list, and at most 50
3449// type-parameterized tests in one type-parameterized test case.
3450// Please contact googletestframework@googlegroups.com if you need
3451// more.
3452
3453#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
3454#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
3455
3456
3457// #ifdef __GNUC__ is too general here.  It is possible to use gcc without using
3458// libstdc++ (which is where cxxabi.h comes from).
3459# ifdef __GLIBCXX__
3460#  include <cxxabi.h>
3461# elif defined(__HP_aCC)
3462#  include <acxx_demangle.h>
3463# endif  // __GLIBCXX__
3464
3465namespace testing {
3466namespace internal {
3467
3468// GetTypeName<T>() returns a human-readable name of type T.
3469// NB: This function is also used in Google Mock, so don't move it inside of
3470// the typed-test-only section below.
3471template <typename T>
3472String GetTypeName() {
3473# if GTEST_HAS_RTTI
3474
3475  const char* const name = typeid(T).name();
3476#  if defined(__GLIBCXX__) || defined(__HP_aCC)
3477  int status = 0;
3478  // gcc's implementation of typeid(T).name() mangles the type name,
3479  // so we have to demangle it.
3480#   ifdef __GLIBCXX__
3481  using abi::__cxa_demangle;
3482#   endif // __GLIBCXX__
3483  char* const readable_name = __cxa_demangle(name, 0, 0, &status);
3484  const String name_str(status == 0 ? readable_name : name);
3485  free(readable_name);
3486  return name_str;
3487#  else
3488  return name;
3489#  endif  // __GLIBCXX__ || __HP_aCC
3490
3491# else
3492
3493  return "<type>";
3494
3495# endif  // GTEST_HAS_RTTI
3496}
3497
3498#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
3499
3500// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
3501// type.  This can be used as a compile-time assertion to ensure that
3502// two types are equal.
3503
3504template <typename T1, typename T2>
3505struct AssertTypeEq;
3506
3507template <typename T>
3508struct AssertTypeEq<T, T> {
3509  typedef bool type;
3510};
3511
3512// A unique type used as the default value for the arguments of class
3513// template Types.  This allows us to simulate variadic templates
3514// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
3515// support directly.
3516struct None {};
3517
3518// The following family of struct and struct templates are used to
3519// represent type lists.  In particular, TypesN<T1, T2, ..., TN>
3520// represents a type list with N types (T1, T2, ..., and TN) in it.
3521// Except for Types0, every struct in the family has two member types:
3522// Head for the first type in the list, and Tail for the rest of the
3523// list.
3524
3525// The empty type list.
3526struct Types0 {};
3527
3528// Type lists of length 1, 2, 3, and so on.
3529
3530template <typename T1>
3531struct Types1 {
3532  typedef T1 Head;
3533  typedef Types0 Tail;
3534};
3535template <typename T1, typename T2>
3536struct Types2 {
3537  typedef T1 Head;
3538  typedef Types1<T2> Tail;
3539};
3540
3541template <typename T1, typename T2, typename T3>
3542struct Types3 {
3543  typedef T1 Head;
3544  typedef Types2<T2, T3> Tail;
3545};
3546
3547template <typename T1, typename T2, typename T3, typename T4>
3548struct Types4 {
3549  typedef T1 Head;
3550  typedef Types3<T2, T3, T4> Tail;
3551};
3552
3553template <typename T1, typename T2, typename T3, typename T4, typename T5>
3554struct Types5 {
3555  typedef T1 Head;
3556  typedef Types4<T2, T3, T4, T5> Tail;
3557};
3558
3559template <typename T1, typename T2, typename T3, typename T4, typename T5,
3560    typename T6>
3561struct Types6 {
3562  typedef T1 Head;
3563  typedef Types5<T2, T3, T4, T5, T6> Tail;
3564};
3565
3566template <typename T1, typename T2, typename T3, typename T4, typename T5,
3567    typename T6, typename T7>
3568struct Types7 {
3569  typedef T1 Head;
3570  typedef Types6<T2, T3, T4, T5, T6, T7> Tail;
3571};
3572
3573template <typename T1, typename T2, typename T3, typename T4, typename T5,
3574    typename T6, typename T7, typename T8>
3575struct Types8 {
3576  typedef T1 Head;
3577  typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;
3578};
3579
3580template <typename T1, typename T2, typename T3, typename T4, typename T5,
3581    typename T6, typename T7, typename T8, typename T9>
3582struct Types9 {
3583  typedef T1 Head;
3584  typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
3585};
3586
3587template <typename T1, typename T2, typename T3, typename T4, typename T5,
3588    typename T6, typename T7, typename T8, typename T9, typename T10>
3589struct Types10 {
3590  typedef T1 Head;
3591  typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
3592};
3593
3594template <typename T1, typename T2, typename T3, typename T4, typename T5,
3595    typename T6, typename T7, typename T8, typename T9, typename T10,
3596    typename T11>
3597struct Types11 {
3598  typedef T1 Head;
3599  typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
3600};
3601
3602template <typename T1, typename T2, typename T3, typename T4, typename T5,
3603    typename T6, typename T7, typename T8, typename T9, typename T10,
3604    typename T11, typename T12>
3605struct Types12 {
3606  typedef T1 Head;
3607  typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
3608};
3609
3610template <typename T1, typename T2, typename T3, typename T4, typename T5,
3611    typename T6, typename T7, typename T8, typename T9, typename T10,
3612    typename T11, typename T12, typename T13>
3613struct Types13 {
3614  typedef T1 Head;
3615  typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
3616};
3617
3618template <typename T1, typename T2, typename T3, typename T4, typename T5,
3619    typename T6, typename T7, typename T8, typename T9, typename T10,
3620    typename T11, typename T12, typename T13, typename T14>
3621struct Types14 {
3622  typedef T1 Head;
3623  typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;
3624};
3625
3626template <typename T1, typename T2, typename T3, typename T4, typename T5,
3627    typename T6, typename T7, typename T8, typename T9, typename T10,
3628    typename T11, typename T12, typename T13, typename T14, typename T15>
3629struct Types15 {
3630  typedef T1 Head;
3631  typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
3632      T15> 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>
3639struct Types16 {
3640  typedef T1 Head;
3641  typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3642      T16> Tail;
3643};
3644
3645template <typename T1, typename T2, typename T3, typename T4, typename T5,
3646    typename T6, typename T7, typename T8, typename T9, typename T10,
3647    typename T11, typename T12, typename T13, typename T14, typename T15,
3648    typename T16, typename T17>
3649struct Types17 {
3650  typedef T1 Head;
3651  typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3652      T16, T17> Tail;
3653};
3654
3655template <typename T1, typename T2, typename T3, typename T4, typename T5,
3656    typename T6, typename T7, typename T8, typename T9, typename T10,
3657    typename T11, typename T12, typename T13, typename T14, typename T15,
3658    typename T16, typename T17, typename T18>
3659struct Types18 {
3660  typedef T1 Head;
3661  typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3662      T16, T17, T18> Tail;
3663};
3664
3665template <typename T1, typename T2, typename T3, typename T4, typename T5,
3666    typename T6, typename T7, typename T8, typename T9, typename T10,
3667    typename T11, typename T12, typename T13, typename T14, typename T15,
3668    typename T16, typename T17, typename T18, typename T19>
3669struct Types19 {
3670  typedef T1 Head;
3671  typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3672      T16, T17, T18, T19> Tail;
3673};
3674
3675template <typename T1, typename T2, typename T3, typename T4, typename T5,
3676    typename T6, typename T7, typename T8, typename T9, typename T10,
3677    typename T11, typename T12, typename T13, typename T14, typename T15,
3678    typename T16, typename T17, typename T18, typename T19, typename T20>
3679struct Types20 {
3680  typedef T1 Head;
3681  typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3682      T16, T17, T18, T19, T20> Tail;
3683};
3684
3685template <typename T1, typename T2, typename T3, typename T4, typename T5,
3686    typename T6, typename T7, typename T8, typename T9, typename T10,
3687    typename T11, typename T12, typename T13, typename T14, typename T15,
3688    typename T16, typename T17, typename T18, typename T19, typename T20,
3689    typename T21>
3690struct Types21 {
3691  typedef T1 Head;
3692  typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3693      T16, T17, T18, T19, T20, T21> Tail;
3694};
3695
3696template <typename T1, typename T2, typename T3, typename T4, typename T5,
3697    typename T6, typename T7, typename T8, typename T9, typename T10,
3698    typename T11, typename T12, typename T13, typename T14, typename T15,
3699    typename T16, typename T17, typename T18, typename T19, typename T20,
3700    typename T21, typename T22>
3701struct Types22 {
3702  typedef T1 Head;
3703  typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3704      T16, T17, T18, T19, T20, T21, T22> Tail;
3705};
3706
3707template <typename T1, typename T2, typename T3, typename T4, typename T5,
3708    typename T6, typename T7, typename T8, typename T9, typename T10,
3709    typename T11, typename T12, typename T13, typename T14, typename T15,
3710    typename T16, typename T17, typename T18, typename T19, typename T20,
3711    typename T21, typename T22, typename T23>
3712struct Types23 {
3713  typedef T1 Head;
3714  typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3715      T16, T17, T18, T19, T20, T21, T22, T23> 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>
3723struct Types24 {
3724  typedef T1 Head;
3725  typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3726      T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
3727};
3728
3729template <typename T1, typename T2, typename T3, typename T4, typename T5,
3730    typename T6, typename T7, typename T8, typename T9, typename T10,
3731    typename T11, typename T12, typename T13, typename T14, typename T15,
3732    typename T16, typename T17, typename T18, typename T19, typename T20,
3733    typename T21, typename T22, typename T23, typename T24, typename T25>
3734struct Types25 {
3735  typedef T1 Head;
3736  typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3737      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
3738};
3739
3740template <typename T1, typename T2, typename T3, typename T4, typename T5,
3741    typename T6, typename T7, typename T8, typename T9, typename T10,
3742    typename T11, typename T12, typename T13, typename T14, typename T15,
3743    typename T16, typename T17, typename T18, typename T19, typename T20,
3744    typename T21, typename T22, typename T23, typename T24, typename T25,
3745    typename T26>
3746struct Types26 {
3747  typedef T1 Head;
3748  typedef Types25<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> Tail;
3750};
3751
3752template <typename T1, typename T2, typename T3, typename T4, typename T5,
3753    typename T6, typename T7, typename T8, typename T9, typename T10,
3754    typename T11, typename T12, typename T13, typename T14, typename T15,
3755    typename T16, typename T17, typename T18, typename T19, typename T20,
3756    typename T21, typename T22, typename T23, typename T24, typename T25,
3757    typename T26, typename T27>
3758struct Types27 {
3759  typedef T1 Head;
3760  typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3761      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
3762};
3763
3764template <typename T1, typename T2, typename T3, typename T4, typename T5,
3765    typename T6, typename T7, typename T8, typename T9, typename T10,
3766    typename T11, typename T12, typename T13, typename T14, typename T15,
3767    typename T16, typename T17, typename T18, typename T19, typename T20,
3768    typename T21, typename T22, typename T23, typename T24, typename T25,
3769    typename T26, typename T27, typename T28>
3770struct Types28 {
3771  typedef T1 Head;
3772  typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3773      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;
3774};
3775
3776template <typename T1, typename T2, typename T3, typename T4, typename T5,
3777    typename T6, typename T7, typename T8, typename T9, typename T10,
3778    typename T11, typename T12, typename T13, typename T14, typename T15,
3779    typename T16, typename T17, typename T18, typename T19, typename T20,
3780    typename T21, typename T22, typename T23, typename T24, typename T25,
3781    typename T26, typename T27, typename T28, typename T29>
3782struct Types29 {
3783  typedef T1 Head;
3784  typedef Types28<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,
3786      T29> Tail;
3787};
3788
3789template <typename T1, typename T2, typename T3, typename T4, typename T5,
3790    typename T6, typename T7, typename T8, typename T9, typename T10,
3791    typename T11, typename T12, typename T13, typename T14, typename T15,
3792    typename T16, typename T17, typename T18, typename T19, typename T20,
3793    typename T21, typename T22, typename T23, typename T24, typename T25,
3794    typename T26, typename T27, typename T28, typename T29, typename T30>
3795struct Types30 {
3796  typedef T1 Head;
3797  typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3798      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3799      T30> Tail;
3800};
3801
3802template <typename T1, typename T2, typename T3, typename T4, typename T5,
3803    typename T6, typename T7, typename T8, typename T9, typename T10,
3804    typename T11, typename T12, typename T13, typename T14, typename T15,
3805    typename T16, typename T17, typename T18, typename T19, typename T20,
3806    typename T21, typename T22, typename T23, typename T24, typename T25,
3807    typename T26, typename T27, typename T28, typename T29, typename T30,
3808    typename T31>
3809struct Types31 {
3810  typedef T1 Head;
3811  typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3812      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3813      T30, T31> Tail;
3814};
3815
3816template <typename T1, typename T2, typename T3, typename T4, typename T5,
3817    typename T6, typename T7, typename T8, typename T9, typename T10,
3818    typename T11, typename T12, typename T13, typename T14, typename T15,
3819    typename T16, typename T17, typename T18, typename T19, typename T20,
3820    typename T21, typename T22, typename T23, typename T24, typename T25,
3821    typename T26, typename T27, typename T28, typename T29, typename T30,
3822    typename T31, typename T32>
3823struct Types32 {
3824  typedef T1 Head;
3825  typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3826      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3827      T30, T31, T32> Tail;
3828};
3829
3830template <typename T1, typename T2, typename T3, typename T4, typename T5,
3831    typename T6, typename T7, typename T8, typename T9, typename T10,
3832    typename T11, typename T12, typename T13, typename T14, typename T15,
3833    typename T16, typename T17, typename T18, typename T19, typename T20,
3834    typename T21, typename T22, typename T23, typename T24, typename T25,
3835    typename T26, typename T27, typename T28, typename T29, typename T30,
3836    typename T31, typename T32, typename T33>
3837struct Types33 {
3838  typedef T1 Head;
3839  typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3840      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3841      T30, T31, T32, T33> Tail;
3842};
3843
3844template <typename T1, typename T2, typename T3, typename T4, typename T5,
3845    typename T6, typename T7, typename T8, typename T9, typename T10,
3846    typename T11, typename T12, typename T13, typename T14, typename T15,
3847    typename T16, typename T17, typename T18, typename T19, typename T20,
3848    typename T21, typename T22, typename T23, typename T24, typename T25,
3849    typename T26, typename T27, typename T28, typename T29, typename T30,
3850    typename T31, typename T32, typename T33, typename T34>
3851struct Types34 {
3852  typedef T1 Head;
3853  typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3854      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3855      T30, T31, T32, T33, T34> Tail;
3856};
3857
3858template <typename T1, typename T2, typename T3, typename T4, typename T5,
3859    typename T6, typename T7, typename T8, typename T9, typename T10,
3860    typename T11, typename T12, typename T13, typename T14, typename T15,
3861    typename T16, typename T17, typename T18, typename T19, typename T20,
3862    typename T21, typename T22, typename T23, typename T24, typename T25,
3863    typename T26, typename T27, typename T28, typename T29, typename T30,
3864    typename T31, typename T32, typename T33, typename T34, typename T35>
3865struct Types35 {
3866  typedef T1 Head;
3867  typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3868      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3869      T30, T31, T32, T33, T34, T35> Tail;
3870};
3871
3872template <typename T1, typename T2, typename T3, typename T4, typename T5,
3873    typename T6, typename T7, typename T8, typename T9, typename T10,
3874    typename T11, typename T12, typename T13, typename T14, typename T15,
3875    typename T16, typename T17, typename T18, typename T19, typename T20,
3876    typename T21, typename T22, typename T23, typename T24, typename T25,
3877    typename T26, typename T27, typename T28, typename T29, typename T30,
3878    typename T31, typename T32, typename T33, typename T34, typename T35,
3879    typename T36>
3880struct Types36 {
3881  typedef T1 Head;
3882  typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3883      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3884      T30, T31, T32, T33, T34, T35, T36> Tail;
3885};
3886
3887template <typename T1, typename T2, typename T3, typename T4, typename T5,
3888    typename T6, typename T7, typename T8, typename T9, typename T10,
3889    typename T11, typename T12, typename T13, typename T14, typename T15,
3890    typename T16, typename T17, typename T18, typename T19, typename T20,
3891    typename T21, typename T22, typename T23, typename T24, typename T25,
3892    typename T26, typename T27, typename T28, typename T29, typename T30,
3893    typename T31, typename T32, typename T33, typename T34, typename T35,
3894    typename T36, typename T37>
3895struct Types37 {
3896  typedef T1 Head;
3897  typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3898      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3899      T30, T31, T32, T33, T34, T35, T36, T37> Tail;
3900};
3901
3902template <typename T1, typename T2, typename T3, typename T4, typename T5,
3903    typename T6, typename T7, typename T8, typename T9, typename T10,
3904    typename T11, typename T12, typename T13, typename T14, typename T15,
3905    typename T16, typename T17, typename T18, typename T19, typename T20,
3906    typename T21, typename T22, typename T23, typename T24, typename T25,
3907    typename T26, typename T27, typename T28, typename T29, typename T30,
3908    typename T31, typename T32, typename T33, typename T34, typename T35,
3909    typename T36, typename T37, typename T38>
3910struct Types38 {
3911  typedef T1 Head;
3912  typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3913      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3914      T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
3915};
3916
3917template <typename T1, typename T2, typename T3, typename T4, typename T5,
3918    typename T6, typename T7, typename T8, typename T9, typename T10,
3919    typename T11, typename T12, typename T13, typename T14, typename T15,
3920    typename T16, typename T17, typename T18, typename T19, typename T20,
3921    typename T21, typename T22, typename T23, typename T24, typename T25,
3922    typename T26, typename T27, typename T28, typename T29, typename T30,
3923    typename T31, typename T32, typename T33, typename T34, typename T35,
3924    typename T36, typename T37, typename T38, typename T39>
3925struct Types39 {
3926  typedef T1 Head;
3927  typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3928      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3929      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
3930};
3931
3932template <typename T1, typename T2, typename T3, typename T4, typename T5,
3933    typename T6, typename T7, typename T8, typename T9, typename T10,
3934    typename T11, typename T12, typename T13, typename T14, typename T15,
3935    typename T16, typename T17, typename T18, typename T19, typename T20,
3936    typename T21, typename T22, typename T23, typename T24, typename T25,
3937    typename T26, typename T27, typename T28, typename T29, typename T30,
3938    typename T31, typename T32, typename T33, typename T34, typename T35,
3939    typename T36, typename T37, typename T38, typename T39, typename T40>
3940struct Types40 {
3941  typedef T1 Head;
3942  typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3943      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3944      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
3945};
3946
3947template <typename T1, typename T2, typename T3, typename T4, typename T5,
3948    typename T6, typename T7, typename T8, typename T9, typename T10,
3949    typename T11, typename T12, typename T13, typename T14, typename T15,
3950    typename T16, typename T17, typename T18, typename T19, typename T20,
3951    typename T21, typename T22, typename T23, typename T24, typename T25,
3952    typename T26, typename T27, typename T28, typename T29, typename T30,
3953    typename T31, typename T32, typename T33, typename T34, typename T35,
3954    typename T36, typename T37, typename T38, typename T39, typename T40,
3955    typename T41>
3956struct Types41 {
3957  typedef T1 Head;
3958  typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3959      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3960      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
3961};
3962
3963template <typename T1, typename T2, typename T3, typename T4, typename T5,
3964    typename T6, typename T7, typename T8, typename T9, typename T10,
3965    typename T11, typename T12, typename T13, typename T14, typename T15,
3966    typename T16, typename T17, typename T18, typename T19, typename T20,
3967    typename T21, typename T22, typename T23, typename T24, typename T25,
3968    typename T26, typename T27, typename T28, typename T29, typename T30,
3969    typename T31, typename T32, typename T33, typename T34, typename T35,
3970    typename T36, typename T37, typename T38, typename T39, typename T40,
3971    typename T41, typename T42>
3972struct Types42 {
3973  typedef T1 Head;
3974  typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3975      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3976      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;
3977};
3978
3979template <typename T1, typename T2, typename T3, typename T4, typename T5,
3980    typename T6, typename T7, typename T8, typename T9, typename T10,
3981    typename T11, typename T12, typename T13, typename T14, typename T15,
3982    typename T16, typename T17, typename T18, typename T19, typename T20,
3983    typename T21, typename T22, typename T23, typename T24, typename T25,
3984    typename T26, typename T27, typename T28, typename T29, typename T30,
3985    typename T31, typename T32, typename T33, typename T34, typename T35,
3986    typename T36, typename T37, typename T38, typename T39, typename T40,
3987    typename T41, typename T42, typename T43>
3988struct Types43 {
3989  typedef T1 Head;
3990  typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
3991      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
3992      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
3993      T43> Tail;
3994};
3995
3996template <typename T1, typename T2, typename T3, typename T4, typename T5,
3997    typename T6, typename T7, typename T8, typename T9, typename T10,
3998    typename T11, typename T12, typename T13, typename T14, typename T15,
3999    typename T16, typename T17, typename T18, typename T19, typename T20,
4000    typename T21, typename T22, typename T23, typename T24, typename T25,
4001    typename T26, typename T27, typename T28, typename T29, typename T30,
4002    typename T31, typename T32, typename T33, typename T34, typename T35,
4003    typename T36, typename T37, typename T38, typename T39, typename T40,
4004    typename T41, typename T42, typename T43, typename T44>
4005struct Types44 {
4006  typedef T1 Head;
4007  typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4008      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4009      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4010      T44> Tail;
4011};
4012
4013template <typename T1, typename T2, typename T3, typename T4, typename T5,
4014    typename T6, typename T7, typename T8, typename T9, typename T10,
4015    typename T11, typename T12, typename T13, typename T14, typename T15,
4016    typename T16, typename T17, typename T18, typename T19, typename T20,
4017    typename T21, typename T22, typename T23, typename T24, typename T25,
4018    typename T26, typename T27, typename T28, typename T29, typename T30,
4019    typename T31, typename T32, typename T33, typename T34, typename T35,
4020    typename T36, typename T37, typename T38, typename T39, typename T40,
4021    typename T41, typename T42, typename T43, typename T44, typename T45>
4022struct Types45 {
4023  typedef T1 Head;
4024  typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4025      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4026      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4027      T44, T45> Tail;
4028};
4029
4030template <typename T1, typename T2, typename T3, typename T4, typename T5,
4031    typename T6, typename T7, typename T8, typename T9, typename T10,
4032    typename T11, typename T12, typename T13, typename T14, typename T15,
4033    typename T16, typename T17, typename T18, typename T19, typename T20,
4034    typename T21, typename T22, typename T23, typename T24, typename T25,
4035    typename T26, typename T27, typename T28, typename T29, typename T30,
4036    typename T31, typename T32, typename T33, typename T34, typename T35,
4037    typename T36, typename T37, typename T38, typename T39, typename T40,
4038    typename T41, typename T42, typename T43, typename T44, typename T45,
4039    typename T46>
4040struct Types46 {
4041  typedef T1 Head;
4042  typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4043      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4044      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4045      T44, T45, T46> Tail;
4046};
4047
4048template <typename T1, typename T2, typename T3, typename T4, typename T5,
4049    typename T6, typename T7, typename T8, typename T9, typename T10,
4050    typename T11, typename T12, typename T13, typename T14, typename T15,
4051    typename T16, typename T17, typename T18, typename T19, typename T20,
4052    typename T21, typename T22, typename T23, typename T24, typename T25,
4053    typename T26, typename T27, typename T28, typename T29, typename T30,
4054    typename T31, typename T32, typename T33, typename T34, typename T35,
4055    typename T36, typename T37, typename T38, typename T39, typename T40,
4056    typename T41, typename T42, typename T43, typename T44, typename T45,
4057    typename T46, typename T47>
4058struct Types47 {
4059  typedef T1 Head;
4060  typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4061      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4062      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4063      T44, T45, T46, T47> Tail;
4064};
4065
4066template <typename T1, typename T2, typename T3, typename T4, typename T5,
4067    typename T6, typename T7, typename T8, typename T9, typename T10,
4068    typename T11, typename T12, typename T13, typename T14, typename T15,
4069    typename T16, typename T17, typename T18, typename T19, typename T20,
4070    typename T21, typename T22, typename T23, typename T24, typename T25,
4071    typename T26, typename T27, typename T28, typename T29, typename T30,
4072    typename T31, typename T32, typename T33, typename T34, typename T35,
4073    typename T36, typename T37, typename T38, typename T39, typename T40,
4074    typename T41, typename T42, typename T43, typename T44, typename T45,
4075    typename T46, typename T47, typename T48>
4076struct Types48 {
4077  typedef T1 Head;
4078  typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4079      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4080      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4081      T44, T45, T46, T47, T48> Tail;
4082};
4083
4084template <typename T1, typename T2, typename T3, typename T4, typename T5,
4085    typename T6, typename T7, typename T8, typename T9, typename T10,
4086    typename T11, typename T12, typename T13, typename T14, typename T15,
4087    typename T16, typename T17, typename T18, typename T19, typename T20,
4088    typename T21, typename T22, typename T23, typename T24, typename T25,
4089    typename T26, typename T27, typename T28, typename T29, typename T30,
4090    typename T31, typename T32, typename T33, typename T34, typename T35,
4091    typename T36, typename T37, typename T38, typename T39, typename T40,
4092    typename T41, typename T42, typename T43, typename T44, typename T45,
4093    typename T46, typename T47, typename T48, typename T49>
4094struct Types49 {
4095  typedef T1 Head;
4096  typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4097      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4098      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4099      T44, T45, T46, T47, T48, T49> Tail;
4100};
4101
4102template <typename T1, typename T2, typename T3, typename T4, typename T5,
4103    typename T6, typename T7, typename T8, typename T9, typename T10,
4104    typename T11, typename T12, typename T13, typename T14, typename T15,
4105    typename T16, typename T17, typename T18, typename T19, typename T20,
4106    typename T21, typename T22, typename T23, typename T24, typename T25,
4107    typename T26, typename T27, typename T28, typename T29, typename T30,
4108    typename T31, typename T32, typename T33, typename T34, typename T35,
4109    typename T36, typename T37, typename T38, typename T39, typename T40,
4110    typename T41, typename T42, typename T43, typename T44, typename T45,
4111    typename T46, typename T47, typename T48, typename T49, typename T50>
4112struct Types50 {
4113  typedef T1 Head;
4114  typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4115      T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4116      T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4117      T44, T45, T46, T47, T48, T49, T50> Tail;
4118};
4119
4120
4121}  // namespace internal
4122
4123// We don't want to require the users to write TypesN<...> directly,
4124// as that would require them to count the length.  Types<...> is much
4125// easier to write, but generates horrible messages when there is a
4126// compiler error, as gcc insists on printing out each template
4127// argument, even if it has the default value (this means Types<int>
4128// will appear as Types<int, None, None, ..., None> in the compiler
4129// errors).
4130//
4131// Our solution is to combine the best part of the two approaches: a
4132// user would write Types<T1, ..., TN>, and Google Test will translate
4133// that to TypesN<T1, ..., TN> internally to make error messages
4134// readable.  The translation is done by the 'type' member of the
4135// Types template.
4136template <typename T1 = internal::None, typename T2 = internal::None,
4137    typename T3 = internal::None, typename T4 = internal::None,
4138    typename T5 = internal::None, typename T6 = internal::None,
4139    typename T7 = internal::None, typename T8 = internal::None,
4140    typename T9 = internal::None, typename T10 = internal::None,
4141    typename T11 = internal::None, typename T12 = internal::None,
4142    typename T13 = internal::None, typename T14 = internal::None,
4143    typename T15 = internal::None, typename T16 = internal::None,
4144    typename T17 = internal::None, typename T18 = internal::None,
4145    typename T19 = internal::None, typename T20 = internal::None,
4146    typename T21 = internal::None, typename T22 = internal::None,
4147    typename T23 = internal::None, typename T24 = internal::None,
4148    typename T25 = internal::None, typename T26 = internal::None,
4149    typename T27 = internal::None, typename T28 = internal::None,
4150    typename T29 = internal::None, typename T30 = internal::None,
4151    typename T31 = internal::None, typename T32 = internal::None,
4152    typename T33 = internal::None, typename T34 = internal::None,
4153    typename T35 = internal::None, typename T36 = internal::None,
4154    typename T37 = internal::None, typename T38 = internal::None,
4155    typename T39 = internal::None, typename T40 = internal::None,
4156    typename T41 = internal::None, typename T42 = internal::None,
4157    typename T43 = internal::None, typename T44 = internal::None,
4158    typename T45 = internal::None, typename T46 = internal::None,
4159    typename T47 = internal::None, typename T48 = internal::None,
4160    typename T49 = internal::None, typename T50 = internal::None>
4161struct Types {
4162  typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4163      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4164      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4165      T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
4166};
4167
4168template <>
4169struct Types<internal::None, internal::None, internal::None, internal::None,
4170    internal::None, internal::None, internal::None, internal::None,
4171    internal::None, internal::None, internal::None, internal::None,
4172    internal::None, internal::None, internal::None, internal::None,
4173    internal::None, internal::None, internal::None, internal::None,
4174    internal::None, internal::None, internal::None, internal::None,
4175    internal::None, internal::None, internal::None, internal::None,
4176    internal::None, internal::None, internal::None, internal::None,
4177    internal::None, internal::None, internal::None, internal::None,
4178    internal::None, internal::None, internal::None, internal::None,
4179    internal::None, internal::None, internal::None, internal::None,
4180    internal::None, internal::None, internal::None, internal::None,
4181    internal::None, internal::None> {
4182  typedef internal::Types0 type;
4183};
4184template <typename T1>
4185struct Types<T1, internal::None, internal::None, internal::None,
4186    internal::None, internal::None, internal::None, internal::None,
4187    internal::None, internal::None, internal::None, internal::None,
4188    internal::None, internal::None, internal::None, internal::None,
4189    internal::None, internal::None, internal::None, internal::None,
4190    internal::None, internal::None, internal::None, internal::None,
4191    internal::None, internal::None, internal::None, internal::None,
4192    internal::None, internal::None, internal::None, internal::None,
4193    internal::None, internal::None, internal::None, internal::None,
4194    internal::None, internal::None, internal::None, internal::None,
4195    internal::None, internal::None, internal::None, internal::None,
4196    internal::None, internal::None, internal::None, internal::None,
4197    internal::None, internal::None> {
4198  typedef internal::Types1<T1> type;
4199};
4200template <typename T1, typename T2>
4201struct Types<T1, T2, 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, internal::None,
4205    internal::None, internal::None, internal::None, internal::None,
4206    internal::None, internal::None, internal::None, internal::None,
4207    internal::None, internal::None, internal::None, internal::None,
4208    internal::None, internal::None, internal::None, internal::None,
4209    internal::None, internal::None, internal::None, internal::None,
4210    internal::None, internal::None, internal::None, internal::None,
4211    internal::None, internal::None, internal::None, internal::None,
4212    internal::None, internal::None, internal::None, internal::None,
4213    internal::None> {
4214  typedef internal::Types2<T1, T2> type;
4215};
4216template <typename T1, typename T2, typename T3>
4217struct Types<T1, T2, T3, 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, internal::None, internal::None,
4222    internal::None, internal::None, internal::None, internal::None,
4223    internal::None, internal::None, internal::None, internal::None,
4224    internal::None, internal::None, internal::None, internal::None,
4225    internal::None, internal::None, internal::None, internal::None,
4226    internal::None, internal::None, internal::None, internal::None,
4227    internal::None, internal::None, internal::None, internal::None,
4228    internal::None, internal::None, internal::None, internal::None> {
4229  typedef internal::Types3<T1, T2, T3> type;
4230};
4231template <typename T1, typename T2, typename T3, typename T4>
4232struct Types<T1, T2, T3, T4, 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, internal::None, internal::None, internal::None,
4239    internal::None, internal::None, internal::None, internal::None,
4240    internal::None, internal::None, internal::None, internal::None,
4241    internal::None, internal::None, internal::None, internal::None,
4242    internal::None, internal::None, internal::None, internal::None,
4243    internal::None, internal::None, internal::None> {
4244  typedef internal::Types4<T1, T2, T3, T4> type;
4245};
4246template <typename T1, typename T2, typename T3, typename T4, typename T5>
4247struct Types<T1, T2, T3, T4, T5, internal::None, internal::None,
4248    internal::None, internal::None, internal::None, 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, internal::None, internal::None, internal::None,
4256    internal::None, internal::None, internal::None, internal::None,
4257    internal::None, internal::None, internal::None, internal::None,
4258    internal::None, internal::None, internal::None> {
4259  typedef internal::Types5<T1, T2, T3, T4, T5> type;
4260};
4261template <typename T1, typename T2, typename T3, typename T4, typename T5,
4262    typename T6>
4263struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None,
4264    internal::None, internal::None, internal::None, internal::None,
4265    internal::None, internal::None, internal::None, 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    internal::None, internal::None, internal::None, internal::None,
4273    internal::None, internal::None, internal::None, internal::None,
4274    internal::None, internal::None> {
4275  typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;
4276};
4277template <typename T1, typename T2, typename T3, typename T4, typename T5,
4278    typename T6, typename T7>
4279struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None,
4280    internal::None, internal::None, internal::None, internal::None,
4281    internal::None, internal::None, internal::None, internal::None,
4282    internal::None, internal::None, internal::None, 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, internal::None,
4289    internal::None, internal::None, internal::None, internal::None,
4290    internal::None> {
4291  typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;
4292};
4293template <typename T1, typename T2, typename T3, typename T4, typename T5,
4294    typename T6, typename T7, typename T8>
4295struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None,
4296    internal::None, internal::None, internal::None, internal::None,
4297    internal::None, internal::None, internal::None, internal::None,
4298    internal::None, internal::None, internal::None, internal::None,
4299    internal::None, internal::None, internal::None, internal::None,
4300    internal::None, internal::None, internal::None, 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  typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;
4307};
4308template <typename T1, typename T2, typename T3, typename T4, typename T5,
4309    typename T6, typename T7, typename T8, typename T9>
4310struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None,
4311    internal::None, internal::None, internal::None, internal::None,
4312    internal::None, internal::None, internal::None, internal::None,
4313    internal::None, internal::None, internal::None, internal::None,
4314    internal::None, internal::None, internal::None, internal::None,
4315    internal::None, internal::None, internal::None, internal::None,
4316    internal::None, internal::None, internal::None, internal::None,
4317    internal::None, internal::None, internal::None, internal::None,
4318    internal::None, internal::None, internal::None, internal::None,
4319    internal::None, internal::None, internal::None, internal::None,
4320    internal::None, internal::None, internal::None, internal::None> {
4321  typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
4322};
4323template <typename T1, typename T2, typename T3, typename T4, typename T5,
4324    typename T6, typename T7, typename T8, typename T9, typename T10>
4325struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None,
4326    internal::None, internal::None, internal::None, internal::None,
4327    internal::None, internal::None, internal::None, internal::None,
4328    internal::None, internal::None, internal::None, internal::None,
4329    internal::None, internal::None, internal::None, internal::None,
4330    internal::None, internal::None, internal::None, internal::None,
4331    internal::None, internal::None, internal::None, internal::None,
4332    internal::None, internal::None, internal::None, internal::None,
4333    internal::None, internal::None, internal::None, internal::None,
4334    internal::None, internal::None, internal::None, internal::None,
4335    internal::None, internal::None, internal::None> {
4336  typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
4337};
4338template <typename T1, typename T2, typename T3, typename T4, typename T5,
4339    typename T6, typename T7, typename T8, typename T9, typename T10,
4340    typename T11>
4341struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None,
4342    internal::None, internal::None, internal::None, internal::None,
4343    internal::None, internal::None, internal::None, internal::None,
4344    internal::None, internal::None, internal::None, internal::None,
4345    internal::None, internal::None, internal::None, internal::None,
4346    internal::None, internal::None, internal::None, internal::None,
4347    internal::None, internal::None, internal::None, internal::None,
4348    internal::None, internal::None, internal::None, internal::None,
4349    internal::None, internal::None, internal::None, internal::None,
4350    internal::None, internal::None, internal::None, internal::None,
4351    internal::None, internal::None> {
4352  typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
4353};
4354template <typename T1, typename T2, typename T3, typename T4, typename T5,
4355    typename T6, typename T7, typename T8, typename T9, typename T10,
4356    typename T11, typename T12>
4357struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None,
4358    internal::None, internal::None, internal::None, internal::None,
4359    internal::None, internal::None, internal::None, internal::None,
4360    internal::None, internal::None, internal::None, internal::None,
4361    internal::None, internal::None, internal::None, internal::None,
4362    internal::None, internal::None, internal::None, internal::None,
4363    internal::None, internal::None, internal::None, internal::None,
4364    internal::None, internal::None, internal::None, internal::None,
4365    internal::None, internal::None, internal::None, internal::None,
4366    internal::None, internal::None, internal::None, internal::None,
4367    internal::None> {
4368  typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
4369      T12> type;
4370};
4371template <typename T1, typename T2, typename T3, typename T4, typename T5,
4372    typename T6, typename T7, typename T8, typename T9, typename T10,
4373    typename T11, typename T12, typename T13>
4374struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
4375    internal::None, internal::None, internal::None, internal::None,
4376    internal::None, internal::None, internal::None, internal::None,
4377    internal::None, internal::None, internal::None, internal::None,
4378    internal::None, internal::None, internal::None, internal::None,
4379    internal::None, internal::None, internal::None, internal::None,
4380    internal::None, internal::None, internal::None, internal::None,
4381    internal::None, internal::None, internal::None, internal::None,
4382    internal::None, internal::None, internal::None, internal::None,
4383    internal::None, internal::None, internal::None, internal::None,
4384    internal::None> {
4385  typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4386      T13> type;
4387};
4388template <typename T1, typename T2, typename T3, typename T4, typename T5,
4389    typename T6, typename T7, typename T8, typename T9, typename T10,
4390    typename T11, typename T12, typename T13, typename T14>
4391struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4392    internal::None, internal::None, internal::None, internal::None,
4393    internal::None, internal::None, internal::None, internal::None,
4394    internal::None, internal::None, internal::None, internal::None,
4395    internal::None, internal::None, internal::None, internal::None,
4396    internal::None, internal::None, internal::None, internal::None,
4397    internal::None, internal::None, internal::None, internal::None,
4398    internal::None, internal::None, internal::None, internal::None,
4399    internal::None, internal::None, internal::None, internal::None,
4400    internal::None, internal::None, internal::None, internal::None> {
4401  typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4402      T13, T14> type;
4403};
4404template <typename T1, typename T2, typename T3, typename T4, typename T5,
4405    typename T6, typename T7, typename T8, typename T9, typename T10,
4406    typename T11, typename T12, typename T13, typename T14, typename T15>
4407struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4408    internal::None, internal::None, internal::None, internal::None,
4409    internal::None, 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, internal::None, internal::None,
4414    internal::None, internal::None, internal::None, internal::None,
4415    internal::None, internal::None, internal::None, internal::None,
4416    internal::None, internal::None, internal::None> {
4417  typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4418      T13, T14, T15> type;
4419};
4420template <typename T1, typename T2, typename T3, typename T4, typename T5,
4421    typename T6, typename T7, typename T8, typename T9, typename T10,
4422    typename T11, typename T12, typename T13, typename T14, typename T15,
4423    typename T16>
4424struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4425    T16, internal::None, internal::None, internal::None, internal::None,
4426    internal::None, internal::None, internal::None, internal::None,
4427    internal::None, 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, internal::None, internal::None, internal::None,
4432    internal::None, internal::None, internal::None, internal::None,
4433    internal::None, internal::None> {
4434  typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4435      T13, T14, T15, T16> type;
4436};
4437template <typename T1, typename T2, typename T3, typename T4, typename T5,
4438    typename T6, typename T7, typename T8, typename T9, typename T10,
4439    typename T11, typename T12, typename T13, typename T14, typename T15,
4440    typename T16, typename T17>
4441struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4442    T16, T17, internal::None, internal::None, internal::None, internal::None,
4443    internal::None, internal::None, internal::None, internal::None,
4444    internal::None, internal::None, internal::None, internal::None,
4445    internal::None, 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    internal::None, internal::None, internal::None, internal::None,
4450    internal::None> {
4451  typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4452      T13, T14, T15, T16, T17> type;
4453};
4454template <typename T1, typename T2, typename T3, typename T4, typename T5,
4455    typename T6, typename T7, typename T8, typename T9, typename T10,
4456    typename T11, typename T12, typename T13, typename T14, typename T15,
4457    typename T16, typename T17, typename T18>
4458struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4459    T16, T17, T18, internal::None, internal::None, internal::None,
4460    internal::None, internal::None, internal::None, internal::None,
4461    internal::None, internal::None, internal::None, internal::None,
4462    internal::None, internal::None, internal::None, internal::None,
4463    internal::None, internal::None, 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    internal::None> {
4468  typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4469      T13, T14, T15, T16, T17, T18> 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>
4475struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4476    T16, T17, T18, T19, internal::None, internal::None, internal::None,
4477    internal::None, internal::None, internal::None, internal::None,
4478    internal::None, internal::None, internal::None, internal::None,
4479    internal::None, internal::None, internal::None, internal::None,
4480    internal::None, internal::None, internal::None, internal::None,
4481    internal::None, internal::None, internal::None, internal::None,
4482    internal::None, internal::None, internal::None, internal::None,
4483    internal::None, internal::None, internal::None, internal::None> {
4484  typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4485      T13, T14, T15, T16, T17, T18, T19> type;
4486};
4487template <typename T1, typename T2, typename T3, typename T4, typename T5,
4488    typename T6, typename T7, typename T8, typename T9, typename T10,
4489    typename T11, typename T12, typename T13, typename T14, typename T15,
4490    typename T16, typename T17, typename T18, typename T19, typename T20>
4491struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4492    T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,
4493    internal::None, internal::None, internal::None, internal::None,
4494    internal::None, internal::None, internal::None, internal::None,
4495    internal::None, internal::None, internal::None, internal::None,
4496    internal::None, internal::None, internal::None, internal::None,
4497    internal::None, internal::None, internal::None, internal::None,
4498    internal::None, internal::None, internal::None, internal::None,
4499    internal::None, internal::None, internal::None> {
4500  typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4501      T13, T14, T15, T16, T17, T18, T19, T20> type;
4502};
4503template <typename T1, typename T2, typename T3, typename T4, typename T5,
4504    typename T6, typename T7, typename T8, typename T9, typename T10,
4505    typename T11, typename T12, typename T13, typename T14, typename T15,
4506    typename T16, typename T17, typename T18, typename T19, typename T20,
4507    typename T21>
4508struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4509    T16, T17, T18, T19, T20, T21, internal::None, internal::None,
4510    internal::None, internal::None, internal::None, internal::None,
4511    internal::None, internal::None, internal::None, internal::None,
4512    internal::None, internal::None, internal::None, internal::None,
4513    internal::None, internal::None, internal::None, internal::None,
4514    internal::None, internal::None, internal::None, internal::None,
4515    internal::None, internal::None, internal::None, internal::None,
4516    internal::None, internal::None, internal::None> {
4517  typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4518      T13, T14, T15, T16, T17, T18, T19, T20, T21> type;
4519};
4520template <typename T1, typename T2, typename T3, typename T4, typename T5,
4521    typename T6, typename T7, typename T8, typename T9, typename T10,
4522    typename T11, typename T12, typename T13, typename T14, typename T15,
4523    typename T16, typename T17, typename T18, typename T19, typename T20,
4524    typename T21, typename T22>
4525struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4526    T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,
4527    internal::None, internal::None, internal::None, internal::None,
4528    internal::None, internal::None, internal::None, internal::None,
4529    internal::None, internal::None, internal::None, internal::None,
4530    internal::None, internal::None, internal::None, internal::None,
4531    internal::None, internal::None, internal::None, internal::None,
4532    internal::None, internal::None, internal::None, internal::None,
4533    internal::None, internal::None> {
4534  typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4535      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
4536};
4537template <typename T1, typename T2, typename T3, typename T4, typename T5,
4538    typename T6, typename T7, typename T8, typename T9, typename T10,
4539    typename T11, typename T12, typename T13, typename T14, typename T15,
4540    typename T16, typename T17, typename T18, typename T19, typename T20,
4541    typename T21, typename T22, typename T23>
4542struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4543    T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,
4544    internal::None, internal::None, internal::None, internal::None,
4545    internal::None, internal::None, internal::None, internal::None,
4546    internal::None, internal::None, internal::None, internal::None,
4547    internal::None, internal::None, internal::None, internal::None,
4548    internal::None, internal::None, internal::None, internal::None,
4549    internal::None, internal::None, internal::None, internal::None,
4550    internal::None> {
4551  typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4552      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
4553};
4554template <typename T1, typename T2, typename T3, typename T4, typename T5,
4555    typename T6, typename T7, typename T8, typename T9, typename T10,
4556    typename T11, typename T12, typename T13, typename T14, typename T15,
4557    typename T16, typename T17, typename T18, typename T19, typename T20,
4558    typename T21, typename T22, typename T23, typename T24>
4559struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4560    T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,
4561    internal::None, internal::None, internal::None, internal::None,
4562    internal::None, internal::None, internal::None, internal::None,
4563    internal::None, internal::None, internal::None, internal::None,
4564    internal::None, internal::None, internal::None, internal::None,
4565    internal::None, internal::None, internal::None, internal::None,
4566    internal::None, internal::None, internal::None, internal::None,
4567    internal::None> {
4568  typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4569      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
4570};
4571template <typename T1, typename T2, typename T3, typename T4, typename T5,
4572    typename T6, typename T7, typename T8, typename T9, typename T10,
4573    typename T11, typename T12, typename T13, typename T14, typename T15,
4574    typename T16, typename T17, typename T18, typename T19, typename T20,
4575    typename T21, typename T22, typename T23, typename T24, typename T25>
4576struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4577    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,
4578    internal::None, internal::None, internal::None, internal::None,
4579    internal::None, internal::None, internal::None, internal::None,
4580    internal::None, internal::None, internal::None, internal::None,
4581    internal::None, internal::None, internal::None, internal::None,
4582    internal::None, internal::None, internal::None, internal::None,
4583    internal::None, internal::None, internal::None, internal::None> {
4584  typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4585      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
4586};
4587template <typename T1, typename T2, typename T3, typename T4, typename T5,
4588    typename T6, typename T7, typename T8, typename T9, typename T10,
4589    typename T11, typename T12, typename T13, typename T14, typename T15,
4590    typename T16, typename T17, typename T18, typename T19, typename T20,
4591    typename T21, typename T22, typename T23, typename T24, typename T25,
4592    typename T26>
4593struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4594    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,
4595    internal::None, internal::None, internal::None, internal::None,
4596    internal::None, internal::None, internal::None, internal::None,
4597    internal::None, internal::None, internal::None, internal::None,
4598    internal::None, internal::None, internal::None, internal::None,
4599    internal::None, internal::None, internal::None, internal::None,
4600    internal::None, internal::None, internal::None> {
4601  typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4602      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
4603      T26> type;
4604};
4605template <typename T1, typename T2, typename T3, typename T4, typename T5,
4606    typename T6, typename T7, typename T8, typename T9, typename T10,
4607    typename T11, typename T12, typename T13, typename T14, typename T15,
4608    typename T16, typename T17, typename T18, typename T19, typename T20,
4609    typename T21, typename T22, typename T23, typename T24, typename T25,
4610    typename T26, typename T27>
4611struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4612    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,
4613    internal::None, internal::None, internal::None, internal::None,
4614    internal::None, internal::None, internal::None, internal::None,
4615    internal::None, internal::None, internal::None, internal::None,
4616    internal::None, internal::None, internal::None, internal::None,
4617    internal::None, internal::None, internal::None, internal::None,
4618    internal::None, internal::None> {
4619  typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4620      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4621      T27> type;
4622};
4623template <typename T1, typename T2, typename T3, typename T4, typename T5,
4624    typename T6, typename T7, typename T8, typename T9, typename T10,
4625    typename T11, typename T12, typename T13, typename T14, typename T15,
4626    typename T16, typename T17, typename T18, typename T19, typename T20,
4627    typename T21, typename T22, typename T23, typename T24, typename T25,
4628    typename T26, typename T27, typename T28>
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,
4631    internal::None, internal::None, internal::None, internal::None,
4632    internal::None, internal::None, internal::None, internal::None,
4633    internal::None, internal::None, internal::None, internal::None,
4634    internal::None, internal::None, internal::None, internal::None,
4635    internal::None, internal::None, internal::None, internal::None,
4636    internal::None, internal::None> {
4637  typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4638      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4639      T27, T28> type;
4640};
4641template <typename T1, typename T2, typename T3, typename T4, typename T5,
4642    typename T6, typename T7, typename T8, typename T9, typename T10,
4643    typename T11, typename T12, typename T13, typename T14, typename T15,
4644    typename T16, typename T17, typename T18, typename T19, typename T20,
4645    typename T21, typename T22, typename T23, typename T24, typename T25,
4646    typename T26, typename T27, typename T28, typename T29>
4647struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4648    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4649    internal::None, internal::None, internal::None, internal::None,
4650    internal::None, internal::None, internal::None, internal::None,
4651    internal::None, internal::None, internal::None, internal::None,
4652    internal::None, internal::None, internal::None, internal::None,
4653    internal::None, internal::None, internal::None, internal::None,
4654    internal::None> {
4655  typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4656      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4657      T27, T28, T29> type;
4658};
4659template <typename T1, typename T2, typename T3, typename T4, typename T5,
4660    typename T6, typename T7, typename T8, typename T9, typename T10,
4661    typename T11, typename T12, typename T13, typename T14, typename T15,
4662    typename T16, typename T17, typename T18, typename T19, typename T20,
4663    typename T21, typename T22, typename T23, typename T24, typename T25,
4664    typename T26, typename T27, typename T28, typename T29, typename T30>
4665struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4666    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4667    internal::None, internal::None, internal::None, internal::None,
4668    internal::None, internal::None, internal::None, internal::None,
4669    internal::None, internal::None, internal::None, internal::None,
4670    internal::None, internal::None, internal::None, internal::None,
4671    internal::None, internal::None, internal::None, internal::None> {
4672  typedef internal::Types30<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> type;
4675};
4676template <typename T1, typename T2, typename T3, typename T4, typename T5,
4677    typename T6, typename T7, typename T8, typename T9, typename T10,
4678    typename T11, typename T12, typename T13, typename T14, typename T15,
4679    typename T16, typename T17, typename T18, typename T19, typename T20,
4680    typename T21, typename T22, typename T23, typename T24, typename T25,
4681    typename T26, typename T27, typename T28, typename T29, typename T30,
4682    typename T31>
4683struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4684    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4685    T31, internal::None, internal::None, internal::None, internal::None,
4686    internal::None, internal::None, internal::None, internal::None,
4687    internal::None, internal::None, internal::None, internal::None,
4688    internal::None, internal::None, internal::None, internal::None,
4689    internal::None, internal::None, internal::None> {
4690  typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4691      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4692      T27, T28, T29, T30, T31> type;
4693};
4694template <typename T1, typename T2, typename T3, typename T4, typename T5,
4695    typename T6, typename T7, typename T8, typename T9, typename T10,
4696    typename T11, typename T12, typename T13, typename T14, typename T15,
4697    typename T16, typename T17, typename T18, typename T19, typename T20,
4698    typename T21, typename T22, typename T23, typename T24, typename T25,
4699    typename T26, typename T27, typename T28, typename T29, typename T30,
4700    typename T31, typename T32>
4701struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4702    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4703    T31, T32, internal::None, internal::None, internal::None, internal::None,
4704    internal::None, internal::None, internal::None, internal::None,
4705    internal::None, internal::None, internal::None, internal::None,
4706    internal::None, internal::None, internal::None, internal::None,
4707    internal::None, internal::None> {
4708  typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4709      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4710      T27, T28, T29, T30, T31, T32> type;
4711};
4712template <typename T1, typename T2, typename T3, typename T4, typename T5,
4713    typename T6, typename T7, typename T8, typename T9, typename T10,
4714    typename T11, typename T12, typename T13, typename T14, typename T15,
4715    typename T16, typename T17, typename T18, typename T19, typename T20,
4716    typename T21, typename T22, typename T23, typename T24, typename T25,
4717    typename T26, typename T27, typename T28, typename T29, typename T30,
4718    typename T31, typename T32, typename T33>
4719struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4720    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4721    T31, T32, T33, internal::None, internal::None, internal::None,
4722    internal::None, internal::None, internal::None, internal::None,
4723    internal::None, internal::None, internal::None, internal::None,
4724    internal::None, internal::None, internal::None, internal::None,
4725    internal::None, internal::None> {
4726  typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4727      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4728      T27, T28, T29, T30, T31, T32, T33> type;
4729};
4730template <typename T1, typename T2, typename T3, typename T4, typename T5,
4731    typename T6, typename T7, typename T8, typename T9, typename T10,
4732    typename T11, typename T12, typename T13, typename T14, typename T15,
4733    typename T16, typename T17, typename T18, typename T19, typename T20,
4734    typename T21, typename T22, typename T23, typename T24, typename T25,
4735    typename T26, typename T27, typename T28, typename T29, typename T30,
4736    typename T31, typename T32, typename T33, typename T34>
4737struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4738    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4739    T31, T32, T33, T34, internal::None, internal::None, internal::None,
4740    internal::None, internal::None, internal::None, internal::None,
4741    internal::None, internal::None, internal::None, internal::None,
4742    internal::None, internal::None, internal::None, internal::None,
4743    internal::None> {
4744  typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4745      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4746      T27, T28, T29, T30, T31, T32, T33, T34> type;
4747};
4748template <typename T1, typename T2, typename T3, typename T4, typename T5,
4749    typename T6, typename T7, typename T8, typename T9, typename T10,
4750    typename T11, typename T12, typename T13, typename T14, typename T15,
4751    typename T16, typename T17, typename T18, typename T19, typename T20,
4752    typename T21, typename T22, typename T23, typename T24, typename T25,
4753    typename T26, typename T27, typename T28, typename T29, typename T30,
4754    typename T31, typename T32, typename T33, typename T34, typename T35>
4755struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4756    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4757    T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,
4758    internal::None, internal::None, internal::None, internal::None,
4759    internal::None, internal::None, internal::None, internal::None,
4760    internal::None, internal::None, internal::None, internal::None> {
4761  typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4762      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4763      T27, T28, T29, T30, T31, T32, T33, T34, T35> type;
4764};
4765template <typename T1, typename T2, typename T3, typename T4, typename T5,
4766    typename T6, typename T7, typename T8, typename T9, typename T10,
4767    typename T11, typename T12, typename T13, typename T14, typename T15,
4768    typename T16, typename T17, typename T18, typename T19, typename T20,
4769    typename T21, typename T22, typename T23, typename T24, typename T25,
4770    typename T26, typename T27, typename T28, typename T29, typename T30,
4771    typename T31, typename T32, typename T33, typename T34, typename T35,
4772    typename T36>
4773struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4774    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4775    T31, T32, T33, T34, T35, T36, internal::None, internal::None,
4776    internal::None, internal::None, internal::None, internal::None,
4777    internal::None, internal::None, internal::None, internal::None,
4778    internal::None, internal::None, internal::None, internal::None> {
4779  typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4780      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4781      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
4782};
4783template <typename T1, typename T2, typename T3, typename T4, typename T5,
4784    typename T6, typename T7, typename T8, typename T9, typename T10,
4785    typename T11, typename T12, typename T13, typename T14, typename T15,
4786    typename T16, typename T17, typename T18, typename T19, typename T20,
4787    typename T21, typename T22, typename T23, typename T24, typename T25,
4788    typename T26, typename T27, typename T28, typename T29, typename T30,
4789    typename T31, typename T32, typename T33, typename T34, typename T35,
4790    typename T36, typename T37>
4791struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4792    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4793    T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,
4794    internal::None, internal::None, internal::None, internal::None,
4795    internal::None, internal::None, internal::None, internal::None,
4796    internal::None, internal::None, internal::None> {
4797  typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4798      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4799      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
4800};
4801template <typename T1, typename T2, typename T3, typename T4, typename T5,
4802    typename T6, typename T7, typename T8, typename T9, typename T10,
4803    typename T11, typename T12, typename T13, typename T14, typename T15,
4804    typename T16, typename T17, typename T18, typename T19, typename T20,
4805    typename T21, typename T22, typename T23, typename T24, typename T25,
4806    typename T26, typename T27, typename T28, typename T29, typename T30,
4807    typename T31, typename T32, typename T33, typename T34, typename T35,
4808    typename T36, typename T37, typename T38>
4809struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4810    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4811    T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,
4812    internal::None, internal::None, internal::None, internal::None,
4813    internal::None, internal::None, internal::None, internal::None,
4814    internal::None, internal::None> {
4815  typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4816      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4817      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
4818};
4819template <typename T1, typename T2, typename T3, typename T4, typename T5,
4820    typename T6, typename T7, typename T8, typename T9, typename T10,
4821    typename T11, typename T12, typename T13, typename T14, typename T15,
4822    typename T16, typename T17, typename T18, typename T19, typename T20,
4823    typename T21, typename T22, typename T23, typename T24, typename T25,
4824    typename T26, typename T27, typename T28, typename T29, typename T30,
4825    typename T31, typename T32, typename T33, typename T34, typename T35,
4826    typename T36, typename T37, typename T38, typename T39>
4827struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4828    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4829    T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,
4830    internal::None, internal::None, internal::None, internal::None,
4831    internal::None, internal::None, internal::None, internal::None,
4832    internal::None, internal::None> {
4833  typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4834      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4835      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
4836};
4837template <typename T1, typename T2, typename T3, typename T4, typename T5,
4838    typename T6, typename T7, typename T8, typename T9, typename T10,
4839    typename T11, typename T12, typename T13, typename T14, typename T15,
4840    typename T16, typename T17, typename T18, typename T19, typename T20,
4841    typename T21, typename T22, typename T23, typename T24, typename T25,
4842    typename T26, typename T27, typename T28, typename T29, typename T30,
4843    typename T31, typename T32, typename T33, typename T34, typename T35,
4844    typename T36, typename T37, typename T38, typename T39, typename T40>
4845struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4846    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4847    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,
4848    internal::None, internal::None, internal::None, internal::None,
4849    internal::None, internal::None, internal::None, internal::None,
4850    internal::None> {
4851  typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4852      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4853      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
4854      T40> type;
4855};
4856template <typename T1, typename T2, typename T3, typename T4, typename T5,
4857    typename T6, typename T7, typename T8, typename T9, typename T10,
4858    typename T11, typename T12, typename T13, typename T14, typename T15,
4859    typename T16, typename T17, typename T18, typename T19, typename T20,
4860    typename T21, typename T22, typename T23, typename T24, typename T25,
4861    typename T26, typename T27, typename T28, typename T29, typename T30,
4862    typename T31, typename T32, typename T33, typename T34, typename T35,
4863    typename T36, typename T37, typename T38, typename T39, typename T40,
4864    typename T41>
4865struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4866    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4867    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,
4868    internal::None, internal::None, internal::None, internal::None,
4869    internal::None, internal::None, internal::None, internal::None> {
4870  typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4871      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4872      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4873      T41> type;
4874};
4875template <typename T1, typename T2, typename T3, typename T4, typename T5,
4876    typename T6, typename T7, typename T8, typename T9, typename T10,
4877    typename T11, typename T12, typename T13, typename T14, typename T15,
4878    typename T16, typename T17, typename T18, typename T19, typename T20,
4879    typename T21, typename T22, typename T23, typename T24, typename T25,
4880    typename T26, typename T27, typename T28, typename T29, typename T30,
4881    typename T31, typename T32, typename T33, typename T34, typename T35,
4882    typename T36, typename T37, typename T38, typename T39, typename T40,
4883    typename T41, typename T42>
4884struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4885    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4886    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,
4887    internal::None, internal::None, internal::None, internal::None,
4888    internal::None, internal::None, internal::None> {
4889  typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4890      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4891      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4892      T41, T42> type;
4893};
4894template <typename T1, typename T2, typename T3, typename T4, typename T5,
4895    typename T6, typename T7, typename T8, typename T9, typename T10,
4896    typename T11, typename T12, typename T13, typename T14, typename T15,
4897    typename T16, typename T17, typename T18, typename T19, typename T20,
4898    typename T21, typename T22, typename T23, typename T24, typename T25,
4899    typename T26, typename T27, typename T28, typename T29, typename T30,
4900    typename T31, typename T32, typename T33, typename T34, typename T35,
4901    typename T36, typename T37, typename T38, typename T39, typename T40,
4902    typename T41, typename T42, typename T43>
4903struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4904    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4905    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
4906    internal::None, internal::None, internal::None, internal::None,
4907    internal::None, internal::None, internal::None> {
4908  typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4909      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4910      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4911      T41, T42, T43> type;
4912};
4913template <typename T1, typename T2, typename T3, typename T4, typename T5,
4914    typename T6, typename T7, typename T8, typename T9, typename T10,
4915    typename T11, typename T12, typename T13, typename T14, typename T15,
4916    typename T16, typename T17, typename T18, typename T19, typename T20,
4917    typename T21, typename T22, typename T23, typename T24, typename T25,
4918    typename T26, typename T27, typename T28, typename T29, typename T30,
4919    typename T31, typename T32, typename T33, typename T34, typename T35,
4920    typename T36, typename T37, typename T38, typename T39, typename T40,
4921    typename T41, typename T42, typename T43, typename T44>
4922struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4923    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4924    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
4925    internal::None, internal::None, internal::None, internal::None,
4926    internal::None, internal::None> {
4927  typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4928      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4929      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4930      T41, T42, T43, T44> type;
4931};
4932template <typename T1, typename T2, typename T3, typename T4, typename T5,
4933    typename T6, typename T7, typename T8, typename T9, typename T10,
4934    typename T11, typename T12, typename T13, typename T14, typename T15,
4935    typename T16, typename T17, typename T18, typename T19, typename T20,
4936    typename T21, typename T22, typename T23, typename T24, typename T25,
4937    typename T26, typename T27, typename T28, typename T29, typename T30,
4938    typename T31, typename T32, typename T33, typename T34, typename T35,
4939    typename T36, typename T37, typename T38, typename T39, typename T40,
4940    typename T41, typename T42, typename T43, typename T44, typename T45>
4941struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4942    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4943    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
4944    internal::None, internal::None, internal::None, internal::None,
4945    internal::None> {
4946  typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4947      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4948      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4949      T41, T42, T43, T44, T45> type;
4950};
4951template <typename T1, typename T2, typename T3, typename T4, typename T5,
4952    typename T6, typename T7, typename T8, typename T9, typename T10,
4953    typename T11, typename T12, typename T13, typename T14, typename T15,
4954    typename T16, typename T17, typename T18, typename T19, typename T20,
4955    typename T21, typename T22, typename T23, typename T24, typename T25,
4956    typename T26, typename T27, typename T28, typename T29, typename T30,
4957    typename T31, typename T32, typename T33, typename T34, typename T35,
4958    typename T36, typename T37, typename T38, typename T39, typename T40,
4959    typename T41, typename T42, typename T43, typename T44, typename T45,
4960    typename T46>
4961struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4962    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4963    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
4964    T46, internal::None, internal::None, internal::None, internal::None> {
4965  typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4966      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4967      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4968      T41, T42, T43, T44, T45, T46> type;
4969};
4970template <typename T1, typename T2, typename T3, typename T4, typename T5,
4971    typename T6, typename T7, typename T8, typename T9, typename T10,
4972    typename T11, typename T12, typename T13, typename T14, typename T15,
4973    typename T16, typename T17, typename T18, typename T19, typename T20,
4974    typename T21, typename T22, typename T23, typename T24, typename T25,
4975    typename T26, typename T27, typename T28, typename T29, typename T30,
4976    typename T31, typename T32, typename T33, typename T34, typename T35,
4977    typename T36, typename T37, typename T38, typename T39, typename T40,
4978    typename T41, typename T42, typename T43, typename T44, typename T45,
4979    typename T46, typename T47>
4980struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4981    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
4982    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
4983    T46, T47, internal::None, internal::None, internal::None> {
4984  typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
4985      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
4986      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
4987      T41, T42, T43, T44, T45, T46, T47> type;
4988};
4989template <typename T1, typename T2, typename T3, typename T4, typename T5,
4990    typename T6, typename T7, typename T8, typename T9, typename T10,
4991    typename T11, typename T12, typename T13, typename T14, typename T15,
4992    typename T16, typename T17, typename T18, typename T19, typename T20,
4993    typename T21, typename T22, typename T23, typename T24, typename T25,
4994    typename T26, typename T27, typename T28, typename T29, typename T30,
4995    typename T31, typename T32, typename T33, typename T34, typename T35,
4996    typename T36, typename T37, typename T38, typename T39, typename T40,
4997    typename T41, typename T42, typename T43, typename T44, typename T45,
4998    typename T46, typename T47, typename T48>
4999struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5000    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5001    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
5002    T46, T47, T48, internal::None, internal::None> {
5003  typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5004      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5005      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5006      T41, T42, T43, T44, T45, T46, T47, T48> type;
5007};
5008template <typename T1, typename T2, typename T3, typename T4, typename T5,
5009    typename T6, typename T7, typename T8, typename T9, typename T10,
5010    typename T11, typename T12, typename T13, typename T14, typename T15,
5011    typename T16, typename T17, typename T18, typename T19, typename T20,
5012    typename T21, typename T22, typename T23, typename T24, typename T25,
5013    typename T26, typename T27, typename T28, typename T29, typename T30,
5014    typename T31, typename T32, typename T33, typename T34, typename T35,
5015    typename T36, typename T37, typename T38, typename T39, typename T40,
5016    typename T41, typename T42, typename T43, typename T44, typename T45,
5017    typename T46, typename T47, typename T48, typename T49>
5018struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5019    T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5020    T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
5021    T46, T47, T48, T49, internal::None> {
5022  typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5023      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5024      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5025      T41, T42, T43, T44, T45, T46, T47, T48, T49> type;
5026};
5027
5028namespace internal {
5029
5030# define GTEST_TEMPLATE_ template <typename T> class
5031
5032// The template "selector" struct TemplateSel<Tmpl> is used to
5033// represent Tmpl, which must be a class template with one type
5034// parameter, as a type.  TemplateSel<Tmpl>::Bind<T>::type is defined
5035// as the type Tmpl<T>.  This allows us to actually instantiate the
5036// template "selected" by TemplateSel<Tmpl>.
5037//
5038// This trick is necessary for simulating typedef for class templates,
5039// which C++ doesn't support directly.
5040template <GTEST_TEMPLATE_ Tmpl>
5041struct TemplateSel {
5042  template <typename T>
5043  struct Bind {
5044    typedef Tmpl<T> type;
5045  };
5046};
5047
5048# define GTEST_BIND_(TmplSel, T) \
5049  TmplSel::template Bind<T>::type
5050
5051// A unique struct template used as the default value for the
5052// arguments of class template Templates.  This allows us to simulate
5053// variadic templates (e.g. Templates<int>, Templates<int, double>,
5054// and etc), which C++ doesn't support directly.
5055template <typename T>
5056struct NoneT {};
5057
5058// The following family of struct and struct templates are used to
5059// represent template lists.  In particular, TemplatesN<T1, T2, ...,
5060// TN> represents a list of N templates (T1, T2, ..., and TN).  Except
5061// for Templates0, every struct in the family has two member types:
5062// Head for the selector of the first template in the list, and Tail
5063// for the rest of the list.
5064
5065// The empty template list.
5066struct Templates0 {};
5067
5068// Template lists of length 1, 2, 3, and so on.
5069
5070template <GTEST_TEMPLATE_ T1>
5071struct Templates1 {
5072  typedef TemplateSel<T1> Head;
5073  typedef Templates0 Tail;
5074};
5075template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
5076struct Templates2 {
5077  typedef TemplateSel<T1> Head;
5078  typedef Templates1<T2> Tail;
5079};
5080
5081template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
5082struct Templates3 {
5083  typedef TemplateSel<T1> Head;
5084  typedef Templates2<T2, T3> Tail;
5085};
5086
5087template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5088    GTEST_TEMPLATE_ T4>
5089struct Templates4 {
5090  typedef TemplateSel<T1> Head;
5091  typedef Templates3<T2, T3, T4> Tail;
5092};
5093
5094template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5095    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
5096struct Templates5 {
5097  typedef TemplateSel<T1> Head;
5098  typedef Templates4<T2, T3, T4, T5> Tail;
5099};
5100
5101template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5102    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
5103struct Templates6 {
5104  typedef TemplateSel<T1> Head;
5105  typedef Templates5<T2, T3, T4, T5, T6> Tail;
5106};
5107
5108template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5109    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5110    GTEST_TEMPLATE_ T7>
5111struct Templates7 {
5112  typedef TemplateSel<T1> Head;
5113  typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;
5114};
5115
5116template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5117    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5118    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
5119struct Templates8 {
5120  typedef TemplateSel<T1> Head;
5121  typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;
5122};
5123
5124template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5125    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5126    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
5127struct Templates9 {
5128  typedef TemplateSel<T1> Head;
5129  typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
5130};
5131
5132template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5133    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5134    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5135    GTEST_TEMPLATE_ T10>
5136struct Templates10 {
5137  typedef TemplateSel<T1> Head;
5138  typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
5139};
5140
5141template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5142    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5143    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5144    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
5145struct Templates11 {
5146  typedef TemplateSel<T1> Head;
5147  typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
5148};
5149
5150template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5151    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5152    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5153    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
5154struct Templates12 {
5155  typedef TemplateSel<T1> Head;
5156  typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
5157};
5158
5159template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5160    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5161    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5162    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5163    GTEST_TEMPLATE_ T13>
5164struct Templates13 {
5165  typedef TemplateSel<T1> Head;
5166  typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
5167};
5168
5169template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5170    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5171    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5172    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5173    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
5174struct Templates14 {
5175  typedef TemplateSel<T1> Head;
5176  typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5177      T14> Tail;
5178};
5179
5180template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5181    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5182    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5183    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5184    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
5185struct Templates15 {
5186  typedef TemplateSel<T1> Head;
5187  typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5188      T15> Tail;
5189};
5190
5191template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5192    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5193    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5194    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5195    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5196    GTEST_TEMPLATE_ T16>
5197struct Templates16 {
5198  typedef TemplateSel<T1> Head;
5199  typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5200      T15, T16> 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>
5209struct Templates17 {
5210  typedef TemplateSel<T1> Head;
5211  typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5212      T15, T16, T17> Tail;
5213};
5214
5215template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5216    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5217    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5218    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5219    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5220    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
5221struct Templates18 {
5222  typedef TemplateSel<T1> Head;
5223  typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5224      T15, T16, T17, T18> Tail;
5225};
5226
5227template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5228    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5229    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5230    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5231    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5232    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5233    GTEST_TEMPLATE_ T19>
5234struct Templates19 {
5235  typedef TemplateSel<T1> Head;
5236  typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5237      T15, T16, T17, T18, T19> Tail;
5238};
5239
5240template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5241    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5242    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5243    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5244    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5245    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5246    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
5247struct Templates20 {
5248  typedef TemplateSel<T1> Head;
5249  typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5250      T15, T16, T17, T18, T19, T20> Tail;
5251};
5252
5253template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5254    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5255    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5256    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5257    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5258    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5259    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
5260struct Templates21 {
5261  typedef TemplateSel<T1> Head;
5262  typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5263      T15, T16, T17, T18, T19, T20, T21> Tail;
5264};
5265
5266template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5267    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5268    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5269    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5270    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5271    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5272    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5273    GTEST_TEMPLATE_ T22>
5274struct Templates22 {
5275  typedef TemplateSel<T1> Head;
5276  typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5277      T15, T16, T17, T18, T19, T20, T21, T22> Tail;
5278};
5279
5280template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5281    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5282    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5283    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5284    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5285    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5286    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5287    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
5288struct Templates23 {
5289  typedef TemplateSel<T1> Head;
5290  typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5291      T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;
5292};
5293
5294template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5295    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5296    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5297    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5298    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5299    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5300    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5301    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
5302struct Templates24 {
5303  typedef TemplateSel<T1> Head;
5304  typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5305      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
5306};
5307
5308template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5309    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5310    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5311    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5312    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5313    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5314    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5315    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5316    GTEST_TEMPLATE_ T25>
5317struct Templates25 {
5318  typedef TemplateSel<T1> Head;
5319  typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5320      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
5321};
5322
5323template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5324    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5325    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5326    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5327    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5328    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5329    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5330    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5331    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
5332struct Templates26 {
5333  typedef TemplateSel<T1> Head;
5334  typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5335      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
5336};
5337
5338template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5339    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5340    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5341    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5342    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5343    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5344    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5345    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5346    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
5347struct Templates27 {
5348  typedef TemplateSel<T1> Head;
5349  typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5350      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
5351};
5352
5353template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5354    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5355    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5356    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5357    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5358    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5359    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5360    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5361    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5362    GTEST_TEMPLATE_ T28>
5363struct Templates28 {
5364  typedef TemplateSel<T1> Head;
5365  typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5366      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
5367      T28> Tail;
5368};
5369
5370template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5371    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5372    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5373    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5374    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5375    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5376    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5377    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5378    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5379    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
5380struct Templates29 {
5381  typedef TemplateSel<T1> Head;
5382  typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5383      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5384      T29> Tail;
5385};
5386
5387template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5388    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5389    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5390    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5391    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5392    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5393    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5394    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5395    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5396    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
5397struct Templates30 {
5398  typedef TemplateSel<T1> Head;
5399  typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5400      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5401      T29, T30> Tail;
5402};
5403
5404template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5405    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5406    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5407    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5408    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5409    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5410    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5411    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5412    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5413    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5414    GTEST_TEMPLATE_ T31>
5415struct Templates31 {
5416  typedef TemplateSel<T1> Head;
5417  typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5418      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5419      T29, T30, T31> Tail;
5420};
5421
5422template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5423    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5424    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5425    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5426    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5427    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5428    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5429    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5430    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5431    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5432    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
5433struct Templates32 {
5434  typedef TemplateSel<T1> Head;
5435  typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5436      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5437      T29, T30, T31, T32> Tail;
5438};
5439
5440template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5441    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5442    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5443    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5444    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5445    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5446    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5447    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5448    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5449    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5450    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
5451struct Templates33 {
5452  typedef TemplateSel<T1> Head;
5453  typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5454      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5455      T29, T30, T31, T32, T33> Tail;
5456};
5457
5458template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5459    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5460    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5461    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5462    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5463    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5464    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5465    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5466    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5467    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5468    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5469    GTEST_TEMPLATE_ T34>
5470struct Templates34 {
5471  typedef TemplateSel<T1> Head;
5472  typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5473      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5474      T29, T30, T31, T32, T33, T34> Tail;
5475};
5476
5477template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5478    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5479    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5480    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5481    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5482    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5483    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5484    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5485    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5486    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5487    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5488    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
5489struct Templates35 {
5490  typedef TemplateSel<T1> Head;
5491  typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5492      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5493      T29, T30, T31, T32, T33, T34, T35> Tail;
5494};
5495
5496template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5497    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5498    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5499    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5500    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5501    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5502    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5503    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5504    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5505    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5506    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5507    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
5508struct Templates36 {
5509  typedef TemplateSel<T1> Head;
5510  typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5511      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5512      T29, T30, T31, T32, T33, T34, T35, T36> Tail;
5513};
5514
5515template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5516    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5517    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5518    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5519    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5520    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5521    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5522    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5523    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5524    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5525    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5526    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5527    GTEST_TEMPLATE_ T37>
5528struct Templates37 {
5529  typedef TemplateSel<T1> Head;
5530  typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5531      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5532      T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;
5533};
5534
5535template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5536    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5537    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5538    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5539    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5540    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5541    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5542    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5543    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5544    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5545    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5546    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5547    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
5548struct Templates38 {
5549  typedef TemplateSel<T1> Head;
5550  typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5551      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5552      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
5553};
5554
5555template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5556    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5557    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5558    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5559    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5560    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5561    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5562    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5563    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5564    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5565    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5566    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5567    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
5568struct Templates39 {
5569  typedef TemplateSel<T1> Head;
5570  typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5571      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5572      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
5573};
5574
5575template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5576    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5577    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5578    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5579    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5580    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5581    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5582    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5583    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5584    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5585    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5586    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5587    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5588    GTEST_TEMPLATE_ T40>
5589struct Templates40 {
5590  typedef TemplateSel<T1> Head;
5591  typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5592      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5593      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
5594};
5595
5596template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5597    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5598    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5599    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5600    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5601    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5602    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5603    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5604    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5605    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5606    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5607    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5608    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5609    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
5610struct Templates41 {
5611  typedef TemplateSel<T1> Head;
5612  typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5613      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5614      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
5615};
5616
5617template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5618    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5619    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5620    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5621    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5622    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5623    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5624    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5625    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5626    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5627    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5628    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5629    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5630    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
5631struct Templates42 {
5632  typedef TemplateSel<T1> Head;
5633  typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5634      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5635      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
5636      T42> Tail;
5637};
5638
5639template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5640    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5641    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5642    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5643    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5644    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5645    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5646    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5647    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5648    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5649    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5650    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5651    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5652    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5653    GTEST_TEMPLATE_ T43>
5654struct Templates43 {
5655  typedef TemplateSel<T1> Head;
5656  typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5657      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5658      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5659      T43> Tail;
5660};
5661
5662template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5663    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5664    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5665    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5666    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5667    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5668    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5669    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5670    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5671    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5672    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5673    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5674    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5675    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5676    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
5677struct Templates44 {
5678  typedef TemplateSel<T1> Head;
5679  typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5680      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5681      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5682      T43, T44> Tail;
5683};
5684
5685template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5686    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5687    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5688    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5689    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5690    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5691    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5692    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5693    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5694    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5695    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5696    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5697    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5698    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5699    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
5700struct Templates45 {
5701  typedef TemplateSel<T1> Head;
5702  typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5703      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5704      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5705      T43, T44, T45> Tail;
5706};
5707
5708template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5709    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5710    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5711    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5712    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5713    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5714    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5715    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5716    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5717    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5718    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5719    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5720    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5721    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5722    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5723    GTEST_TEMPLATE_ T46>
5724struct Templates46 {
5725  typedef TemplateSel<T1> Head;
5726  typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5727      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5728      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5729      T43, T44, T45, T46> Tail;
5730};
5731
5732template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5733    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5734    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5735    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5736    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5737    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5738    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5739    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5740    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5741    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5742    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5743    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5744    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5745    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5746    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5747    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
5748struct Templates47 {
5749  typedef TemplateSel<T1> Head;
5750  typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5751      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5752      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5753      T43, T44, T45, T46, T47> Tail;
5754};
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,
5762    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5763    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5764    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5765    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5766    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5767    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5768    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5769    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5770    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5771    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
5772struct Templates48 {
5773  typedef TemplateSel<T1> Head;
5774  typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5775      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5776      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5777      T43, T44, T45, T46, T47, T48> Tail;
5778};
5779
5780template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5781    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5782    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5783    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5784    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5785    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5786    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5787    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5788    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5789    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5790    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5791    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5792    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5793    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5794    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5795    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
5796    GTEST_TEMPLATE_ T49>
5797struct Templates49 {
5798  typedef TemplateSel<T1> Head;
5799  typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5800      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5801      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5802      T43, T44, T45, T46, T47, T48, T49> Tail;
5803};
5804
5805template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5806    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5807    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5808    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
5809    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
5810    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
5811    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
5812    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
5813    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
5814    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
5815    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
5816    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
5817    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
5818    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
5819    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
5820    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
5821    GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>
5822struct Templates50 {
5823  typedef TemplateSel<T1> Head;
5824  typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5825      T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5826      T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5827      T43, T44, T45, T46, T47, T48, T49, T50> Tail;
5828};
5829
5830
5831// We don't want to require the users to write TemplatesN<...> directly,
5832// as that would require them to count the length.  Templates<...> is much
5833// easier to write, but generates horrible messages when there is a
5834// compiler error, as gcc insists on printing out each template
5835// argument, even if it has the default value (this means Templates<list>
5836// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
5837// errors).
5838//
5839// Our solution is to combine the best part of the two approaches: a
5840// user would write Templates<T1, ..., TN>, and Google Test will translate
5841// that to TemplatesN<T1, ..., TN> internally to make error messages
5842// readable.  The translation is done by the 'type' member of the
5843// Templates template.
5844template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,
5845    GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,
5846    GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,
5847    GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,
5848    GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,
5849    GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,
5850    GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,
5851    GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,
5852    GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,
5853    GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,
5854    GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,
5855    GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,
5856    GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,
5857    GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,
5858    GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,
5859    GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,
5860    GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,
5861    GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,
5862    GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,
5863    GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,
5864    GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,
5865    GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,
5866    GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,
5867    GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,
5868    GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>
5869struct Templates {
5870  typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5871      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
5872      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
5873      T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
5874};
5875
5876template <>
5877struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5878    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5879    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5880    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5881    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5882    NoneT> {
5883  typedef Templates0 type;
5884};
5885template <GTEST_TEMPLATE_ T1>
5886struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5887    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5888    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5889    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5890    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5891    NoneT> {
5892  typedef Templates1<T1> type;
5893};
5894template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
5895struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5896    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5897    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5898    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5899    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5900    NoneT> {
5901  typedef Templates2<T1, T2> type;
5902};
5903template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
5904struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5905    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5906    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5907    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5908    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5909  typedef Templates3<T1, T2, T3> type;
5910};
5911template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5912    GTEST_TEMPLATE_ T4>
5913struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5914    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5915    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5916    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5917    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5918  typedef Templates4<T1, T2, T3, T4> type;
5919};
5920template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5921    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
5922struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5923    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5924    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5925    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5926    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5927  typedef Templates5<T1, T2, T3, T4, T5> type;
5928};
5929template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5930    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
5931struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,
5932    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5933    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5934    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5935    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5936  typedef Templates6<T1, T2, T3, T4, T5, T6> type;
5937};
5938template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5939    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5940    GTEST_TEMPLATE_ T7>
5941struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,
5942    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5943    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5944    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5945    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5946  typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;
5947};
5948template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5949    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5950    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
5951struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT,
5952    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5953    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5954    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5955    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5956  typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;
5957};
5958template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5959    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5960    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
5961struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT,
5962    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5963    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5964    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5965    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5966  typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
5967};
5968template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5969    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5970    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5971    GTEST_TEMPLATE_ T10>
5972struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,
5973    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5974    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5975    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5976    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5977  typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
5978};
5979template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
5980    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
5981    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
5982    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
5983struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,
5984    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5985    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5986    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5987    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5988  typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> 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>
5994struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,
5995    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5996    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5997    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
5998    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
5999  typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;
6000};
6001template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6002    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6003    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6004    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6005    GTEST_TEMPLATE_ T13>
6006struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,
6007    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6008    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6009    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6010    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6011  typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6012      T13> type;
6013};
6014template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6015    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6016    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6017    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6018    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
6019struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6020    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6021    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6022    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6023    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6024  typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6025      T14> type;
6026};
6027template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6028    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6029    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6030    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6031    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
6032struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6033    T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6034    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6035    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6036    NoneT, NoneT, NoneT, NoneT, NoneT> {
6037  typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6038      T14, T15> type;
6039};
6040template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6041    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6042    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6043    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6044    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6045    GTEST_TEMPLATE_ T16>
6046struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6047    T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6048    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6049    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6050    NoneT, NoneT, NoneT, NoneT, NoneT> {
6051  typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6052      T14, T15, T16> type;
6053};
6054template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6055    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6056    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6057    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6058    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6059    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
6060struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6061    T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6062    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6063    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6064    NoneT, NoneT, NoneT, NoneT, NoneT> {
6065  typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6066      T14, T15, T16, T17> 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>
6074struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6075    T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6076    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6077    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6078    NoneT, NoneT, NoneT, NoneT> {
6079  typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6080      T14, T15, T16, T17, T18> type;
6081};
6082template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6083    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6084    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6085    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6086    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6087    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6088    GTEST_TEMPLATE_ T19>
6089struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6090    T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6091    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6092    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6093    NoneT, NoneT, NoneT, NoneT> {
6094  typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6095      T14, T15, T16, T17, T18, T19> type;
6096};
6097template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6098    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6099    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6100    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6101    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6102    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6103    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
6104struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6105    T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6106    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6107    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6108    NoneT, NoneT, NoneT, NoneT> {
6109  typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6110      T14, T15, T16, T17, T18, T19, T20> type;
6111};
6112template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6113    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6114    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6115    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6116    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6117    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6118    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
6119struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6120    T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT,
6121    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6122    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6123    NoneT, NoneT, NoneT, NoneT> {
6124  typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6125      T14, T15, T16, T17, T18, T19, T20, T21> type;
6126};
6127template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6128    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6129    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6130    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6131    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6132    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6133    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6134    GTEST_TEMPLATE_ T22>
6135struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6136    T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,
6137    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6138    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6139    NoneT, NoneT, NoneT> {
6140  typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6141      T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
6142};
6143template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6144    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6145    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6146    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6147    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6148    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6149    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6150    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
6151struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6152    T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,
6153    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6154    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6155    NoneT, NoneT, NoneT> {
6156  typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6157      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
6158};
6159template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6160    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6161    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6162    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6163    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6164    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6165    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6166    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
6167struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6168    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,
6169    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6170    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6171    NoneT, NoneT, NoneT> {
6172  typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6173      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
6174};
6175template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6176    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6177    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6178    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6179    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6180    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6181    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6182    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6183    GTEST_TEMPLATE_ T25>
6184struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6185    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,
6186    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6187    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6188    NoneT, NoneT> {
6189  typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6190      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
6191};
6192template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6193    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6194    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6195    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6196    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6197    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6198    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6199    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6200    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
6201struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6202    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,
6203    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6204    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6205    NoneT, NoneT> {
6206  typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6207      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;
6208};
6209template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6210    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6211    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6212    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6213    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6214    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6215    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6216    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6217    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
6218struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6219    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,
6220    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6221    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6222    NoneT, NoneT> {
6223  typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6224      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6225      T27> type;
6226};
6227template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6228    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6229    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6230    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6231    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6232    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6233    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6234    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6235    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6236    GTEST_TEMPLATE_ T28>
6237struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6238    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6239    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6240    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6241    NoneT, NoneT> {
6242  typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6243      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6244      T28> type;
6245};
6246template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6247    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6248    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6249    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6250    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6251    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6252    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6253    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6254    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6255    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
6256struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6257    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6258    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6259    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6260    NoneT> {
6261  typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6262      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6263      T28, T29> type;
6264};
6265template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6266    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6267    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6268    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6269    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6270    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6271    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6272    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6273    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6274    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
6275struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6276    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6277    T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6278    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6279  typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6280      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6281      T28, T29, T30> type;
6282};
6283template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6284    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6285    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6286    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6287    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6288    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6289    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6290    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6291    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6292    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6293    GTEST_TEMPLATE_ T31>
6294struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6295    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6296    T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6297    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6298  typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6299      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6300      T28, T29, T30, T31> type;
6301};
6302template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6303    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6304    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6305    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6306    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6307    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6308    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6309    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6310    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6311    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6312    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
6313struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6314    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6315    T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6316    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6317  typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6318      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6319      T28, T29, T30, T31, T32> type;
6320};
6321template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6322    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6323    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6324    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6325    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6326    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6327    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6328    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6329    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6330    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6331    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
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, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6335    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6336  typedef Templates33<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> type;
6339};
6340template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6341    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6342    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6343    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6344    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6345    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6346    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6347    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6348    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6349    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6350    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6351    GTEST_TEMPLATE_ T34>
6352struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6353    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6354    T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6355    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6356  typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6357      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6358      T28, T29, T30, T31, T32, T33, T34> type;
6359};
6360template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6361    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6362    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6363    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6364    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6365    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6366    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6367    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6368    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6369    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6370    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6371    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
6372struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6373    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6374    T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6375    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6376  typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6377      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6378      T28, T29, T30, T31, T32, T33, T34, T35> type;
6379};
6380template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6381    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6382    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6383    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6384    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6385    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6386    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6387    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6388    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6389    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6390    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6391    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
6392struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6393    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6394    T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,
6395    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6396  typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6397      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6398      T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
6399};
6400template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6401    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6402    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6403    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6404    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6405    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6406    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6407    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6408    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6409    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6410    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6411    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6412    GTEST_TEMPLATE_ T37>
6413struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6414    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6415    T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,
6416    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6417  typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6418      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6419      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
6420};
6421template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6422    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6423    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6424    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6425    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6426    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6427    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6428    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6429    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6430    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6431    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6432    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6433    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
6434struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6435    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6436    T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,
6437    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6438  typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6439      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6440      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
6441};
6442template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6443    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6444    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6445    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6446    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6447    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6448    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6449    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6450    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6451    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6452    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6453    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6454    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
6455struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6456    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6457    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,
6458    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6459  typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6460      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6461      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
6462};
6463template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6464    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6465    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6466    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6467    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6468    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6469    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6470    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6471    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6472    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6473    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6474    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6475    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6476    GTEST_TEMPLATE_ T40>
6477struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6478    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6479    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,
6480    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6481  typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6482      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6483      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;
6484};
6485template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6486    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6487    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6488    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6489    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6490    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6491    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6492    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6493    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6494    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6495    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6496    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6497    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6498    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
6499struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6500    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6501    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,
6502    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6503  typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6504      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6505      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6506      T41> type;
6507};
6508template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6509    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6510    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6511    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6512    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6513    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6514    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6515    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6516    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6517    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6518    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6519    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6520    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6521    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
6522struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6523    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6524    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,
6525    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6526  typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6527      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6528      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6529      T42> type;
6530};
6531template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6532    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6533    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6534    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6535    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6536    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6537    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6538    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6539    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6540    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6541    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6542    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6543    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6544    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6545    GTEST_TEMPLATE_ T43>
6546struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6547    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6548    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
6549    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6550  typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6551      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6552      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6553      T42, T43> type;
6554};
6555template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6556    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6557    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6558    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6559    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6560    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6561    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6562    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6563    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6564    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6565    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6566    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6567    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6568    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6569    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
6570struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6571    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6572    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6573    NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6574  typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6575      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6576      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6577      T42, T43, T44> type;
6578};
6579template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6580    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6581    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6582    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6583    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6584    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6585    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6586    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6587    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6588    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6589    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6590    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6591    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6592    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6593    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
6594struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6595    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6596    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6597    T45, NoneT, NoneT, NoneT, NoneT, NoneT> {
6598  typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6599      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6600      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6601      T42, T43, T44, T45> type;
6602};
6603template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6604    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6605    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6606    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6607    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6608    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6609    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6610    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6611    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6612    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6613    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6614    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6615    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6616    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6617    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6618    GTEST_TEMPLATE_ T46>
6619struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6620    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6621    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6622    T45, T46, NoneT, NoneT, NoneT, NoneT> {
6623  typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6624      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6625      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6626      T42, T43, T44, T45, T46> type;
6627};
6628template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6629    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6630    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6631    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6632    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6633    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6634    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6635    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6636    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6637    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6638    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6639    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6640    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6641    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6642    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6643    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
6644struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6645    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6646    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6647    T45, T46, T47, NoneT, NoneT, NoneT> {
6648  typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6649      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6650      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6651      T42, T43, T44, T45, T46, T47> type;
6652};
6653template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6654    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6655    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6656    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6657    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6658    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6659    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6660    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6661    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6662    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6663    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6664    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6665    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6666    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6667    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6668    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
6669struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6670    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6671    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6672    T45, T46, T47, T48, NoneT, NoneT> {
6673  typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6674      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6675      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6676      T42, T43, T44, T45, T46, T47, T48> type;
6677};
6678template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6679    GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6680    GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6681    GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6682    GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6683    GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6684    GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6685    GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6686    GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6687    GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6688    GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6689    GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6690    GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6691    GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6692    GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6693    GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
6694    GTEST_TEMPLATE_ T49>
6695struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6696    T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
6697    T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
6698    T45, T46, T47, T48, T49, NoneT> {
6699  typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6700      T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6701      T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6702      T42, T43, T44, T45, T46, T47, T48, T49> type;
6703};
6704
6705// The TypeList template makes it possible to use either a single type
6706// or a Types<...> list in TYPED_TEST_CASE() and
6707// INSTANTIATE_TYPED_TEST_CASE_P().
6708
6709template <typename T>
6710struct TypeList { typedef Types1<T> type; };
6711
6712template <typename T1, typename T2, typename T3, typename T4, typename T5,
6713    typename T6, typename T7, typename T8, typename T9, typename T10,
6714    typename T11, typename T12, typename T13, typename T14, typename T15,
6715    typename T16, typename T17, typename T18, typename T19, typename T20,
6716    typename T21, typename T22, typename T23, typename T24, typename T25,
6717    typename T26, typename T27, typename T28, typename T29, typename T30,
6718    typename T31, typename T32, typename T33, typename T34, typename T35,
6719    typename T36, typename T37, typename T38, typename T39, typename T40,
6720    typename T41, typename T42, typename T43, typename T44, typename T45,
6721    typename T46, typename T47, typename T48, typename T49, typename T50>
6722struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6723    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6724    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
6725    T44, T45, T46, T47, T48, T49, T50> > {
6726  typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6727      T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6728      T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6729      T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;
6730};
6731
6732#endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
6733
6734}  // namespace internal
6735}  // namespace testing
6736
6737#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
6738
6739// Due to C++ preprocessor weirdness, we need double indirection to
6740// concatenate two tokens when one of them is __LINE__.  Writing
6741//
6742//   foo ## __LINE__
6743//
6744// will result in the token foo__LINE__, instead of foo followed by
6745// the current line number.  For more details, see
6746// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
6747#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
6748#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
6749
6750// Google Test defines the testing::Message class to allow construction of
6751// test messages via the << operator.  The idea is that anything
6752// streamable to std::ostream can be streamed to a testing::Message.
6753// This allows a user to use his own types in Google Test assertions by
6754// overloading the << operator.
6755//
6756// util/gtl/stl_logging-inl.h overloads << for STL containers.  These
6757// overloads cannot be defined in the std namespace, as that will be
6758// undefined behavior.  Therefore, they are defined in the global
6759// namespace instead.
6760//
6761// C++'s symbol lookup rule (i.e. Koenig lookup) says that these
6762// overloads are visible in either the std namespace or the global
6763// namespace, but not other namespaces, including the testing
6764// namespace which Google Test's Message class is in.
6765//
6766// To allow STL containers (and other types that has a << operator
6767// defined in the global namespace) to be used in Google Test assertions,
6768// testing::Message must access the custom << operator from the global
6769// namespace.  Hence this helper function.
6770//
6771// Note: Jeffrey Yasskin suggested an alternative fix by "using
6772// ::operator<<;" in the definition of Message's operator<<.  That fix
6773// doesn't require a helper function, but unfortunately doesn't
6774// compile with MSVC.
6775template <typename T>
6776inline void GTestStreamToHelper(std::ostream* os, const T& val) {
6777  *os << val;
6778}
6779
6780class ProtocolMessage;
6781namespace proto2 { class Message; }
6782
6783namespace testing {
6784
6785// Forward declarations.
6786
6787class AssertionResult;                 // Result of an assertion.
6788class Message;                         // Represents a failure message.
6789class Test;                            // Represents a test.
6790class TestInfo;                        // Information about a test.
6791class TestPartResult;                  // Result of a test part.
6792class UnitTest;                        // A collection of test cases.
6793
6794template <typename T>
6795::std::string PrintToString(const T& value);
6796
6797namespace internal {
6798
6799struct TraceInfo;                      // Information about a trace point.
6800class ScopedTrace;                     // Implements scoped trace.
6801class TestInfoImpl;                    // Opaque implementation of TestInfo
6802class UnitTestImpl;                    // Opaque implementation of UnitTest
6803
6804// How many times InitGoogleTest() has been called.
6805extern int g_init_gtest_count;
6806
6807// The text used in failure messages to indicate the start of the
6808// stack trace.
6809GTEST_API_ extern const char kStackTraceMarker[];
6810
6811// A secret type that Google Test users don't know about.  It has no
6812// definition on purpose.  Therefore it's impossible to create a
6813// Secret object, which is what we want.
6814class Secret;
6815
6816// Two overloaded helpers for checking at compile time whether an
6817// expression is a null pointer literal (i.e. NULL or any 0-valued
6818// compile-time integral constant).  Their return values have
6819// different sizes, so we can use sizeof() to test which version is
6820// picked by the compiler.  These helpers have no implementations, as
6821// we only need their signatures.
6822//
6823// Given IsNullLiteralHelper(x), the compiler will pick the first
6824// version if x can be implicitly converted to Secret*, and pick the
6825// second version otherwise.  Since Secret is a secret and incomplete
6826// type, the only expression a user can write that has type Secret* is
6827// a null pointer literal.  Therefore, we know that x is a null
6828// pointer literal if and only if the first version is picked by the
6829// compiler.
6830char IsNullLiteralHelper(Secret* p);
6831char (&IsNullLiteralHelper(...))[2];  // NOLINT
6832
6833// A compile-time bool constant that is true if and only if x is a
6834// null pointer literal (i.e. NULL or any 0-valued compile-time
6835// integral constant).
6836#ifdef GTEST_ELLIPSIS_NEEDS_POD_
6837// We lose support for NULL detection where the compiler doesn't like
6838// passing non-POD classes through ellipsis (...).
6839# define GTEST_IS_NULL_LITERAL_(x) false
6840#else
6841# define GTEST_IS_NULL_LITERAL_(x) \
6842    (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
6843#endif  // GTEST_ELLIPSIS_NEEDS_POD_
6844
6845// Appends the user-supplied message to the Google-Test-generated message.
6846GTEST_API_ String AppendUserMessage(const String& gtest_msg,
6847                                    const Message& user_msg);
6848
6849// A helper class for creating scoped traces in user programs.
6850class GTEST_API_ ScopedTrace {
6851 public:
6852  // The c'tor pushes the given source file location and message onto
6853  // a trace stack maintained by Google Test.
6854  ScopedTrace(const char* file, int line, const Message& message);
6855
6856  // The d'tor pops the info pushed by the c'tor.
6857  //
6858  // Note that the d'tor is not virtual in order to be efficient.
6859  // Don't inherit from ScopedTrace!
6860  ~ScopedTrace();
6861
6862 private:
6863  GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
6864} GTEST_ATTRIBUTE_UNUSED_;  // A ScopedTrace object does its job in its
6865                            // c'tor and d'tor.  Therefore it doesn't
6866                            // need to be used otherwise.
6867
6868// Converts a streamable value to a String.  A NULL pointer is
6869// converted to "(null)".  When the input value is a ::string,
6870// ::std::string, ::wstring, or ::std::wstring object, each NUL
6871// character in it is replaced with "\\0".
6872// Declared here but defined in gtest.h, so that it has access
6873// to the definition of the Message class, required by the ARM
6874// compiler.
6875template <typename T>
6876String StreamableToString(const T& streamable);
6877
6878// The Symbian compiler has a bug that prevents it from selecting the
6879// correct overload of FormatForComparisonFailureMessage (see below)
6880// unless we pass the first argument by reference.  If we do that,
6881// however, Visual Age C++ 10.1 generates a compiler error.  Therefore
6882// we only apply the work-around for Symbian.
6883#if defined(__SYMBIAN32__)
6884# define GTEST_CREF_WORKAROUND_ const&
6885#else
6886# define GTEST_CREF_WORKAROUND_
6887#endif
6888
6889// When this operand is a const char* or char*, if the other operand
6890// is a ::std::string or ::string, we print this operand as a C string
6891// rather than a pointer (we do the same for wide strings); otherwise
6892// we print it as a pointer to be safe.
6893
6894// This internal macro is used to avoid duplicated code.
6895#define GTEST_FORMAT_IMPL_(operand2_type, operand1_printer)\
6896inline String FormatForComparisonFailureMessage(\
6897    operand2_type::value_type* GTEST_CREF_WORKAROUND_ str, \
6898    const operand2_type& /*operand2*/) {\
6899  return operand1_printer(str);\
6900}\
6901inline String FormatForComparisonFailureMessage(\
6902    const operand2_type::value_type* GTEST_CREF_WORKAROUND_ str, \
6903    const operand2_type& /*operand2*/) {\
6904  return operand1_printer(str);\
6905}
6906
6907GTEST_FORMAT_IMPL_(::std::string, String::ShowCStringQuoted)
6908#if GTEST_HAS_STD_WSTRING
6909GTEST_FORMAT_IMPL_(::std::wstring, String::ShowWideCStringQuoted)
6910#endif  // GTEST_HAS_STD_WSTRING
6911
6912#if GTEST_HAS_GLOBAL_STRING
6913GTEST_FORMAT_IMPL_(::string, String::ShowCStringQuoted)
6914#endif  // GTEST_HAS_GLOBAL_STRING
6915#if GTEST_HAS_GLOBAL_WSTRING
6916GTEST_FORMAT_IMPL_(::wstring, String::ShowWideCStringQuoted)
6917#endif  // GTEST_HAS_GLOBAL_WSTRING
6918
6919#undef GTEST_FORMAT_IMPL_
6920
6921// The next four overloads handle the case where the operand being
6922// printed is a char/wchar_t pointer and the other operand is not a
6923// string/wstring object.  In such cases, we just print the operand as
6924// a pointer to be safe.
6925#define GTEST_FORMAT_CHAR_PTR_IMPL_(CharType)                       \
6926  template <typename T>                                             \
6927  String FormatForComparisonFailureMessage(CharType* GTEST_CREF_WORKAROUND_ p, \
6928                                           const T&) { \
6929    return PrintToString(static_cast<const void*>(p));              \
6930  }
6931
6932GTEST_FORMAT_CHAR_PTR_IMPL_(char)
6933GTEST_FORMAT_CHAR_PTR_IMPL_(const char)
6934GTEST_FORMAT_CHAR_PTR_IMPL_(wchar_t)
6935GTEST_FORMAT_CHAR_PTR_IMPL_(const wchar_t)
6936
6937#undef GTEST_FORMAT_CHAR_PTR_IMPL_
6938
6939// Constructs and returns the message for an equality assertion
6940// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
6941//
6942// The first four parameters are the expressions used in the assertion
6943// and their values, as strings.  For example, for ASSERT_EQ(foo, bar)
6944// where foo is 5 and bar is 6, we have:
6945//
6946//   expected_expression: "foo"
6947//   actual_expression:   "bar"
6948//   expected_value:      "5"
6949//   actual_value:        "6"
6950//
6951// The ignoring_case parameter is true iff the assertion is a
6952// *_STRCASEEQ*.  When it's true, the string " (ignoring case)" will
6953// be inserted into the message.
6954GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
6955                                     const char* actual_expression,
6956                                     const String& expected_value,
6957                                     const String& actual_value,
6958                                     bool ignoring_case);
6959
6960// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
6961GTEST_API_ String GetBoolAssertionFailureMessage(
6962    const AssertionResult& assertion_result,
6963    const char* expression_text,
6964    const char* actual_predicate_value,
6965    const char* expected_predicate_value);
6966
6967// This template class represents an IEEE floating-point number
6968// (either single-precision or double-precision, depending on the
6969// template parameters).
6970//
6971// The purpose of this class is to do more sophisticated number
6972// comparison.  (Due to round-off error, etc, it's very unlikely that
6973// two floating-points will be equal exactly.  Hence a naive
6974// comparison by the == operation often doesn't work.)
6975//
6976// Format of IEEE floating-point:
6977//
6978//   The most-significant bit being the leftmost, an IEEE
6979//   floating-point looks like
6980//
6981//     sign_bit exponent_bits fraction_bits
6982//
6983//   Here, sign_bit is a single bit that designates the sign of the
6984//   number.
6985//
6986//   For float, there are 8 exponent bits and 23 fraction bits.
6987//
6988//   For double, there are 11 exponent bits and 52 fraction bits.
6989//
6990//   More details can be found at
6991//   http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
6992//
6993// Template parameter:
6994//
6995//   RawType: the raw floating-point type (either float or double)
6996template <typename RawType>
6997class FloatingPoint {
6998 public:
6999  // Defines the unsigned integer type that has the same size as the
7000  // floating point number.
7001  typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;
7002
7003  // Constants.
7004
7005  // # of bits in a number.
7006  static const size_t kBitCount = 8*sizeof(RawType);
7007
7008  // # of fraction bits in a number.
7009  static const size_t kFractionBitCount =
7010    std::numeric_limits<RawType>::digits - 1;
7011
7012  // # of exponent bits in a number.
7013  static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
7014
7015  // The mask for the sign bit.
7016  static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
7017
7018  // The mask for the fraction bits.
7019  static const Bits kFractionBitMask =
7020    ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
7021
7022  // The mask for the exponent bits.
7023  static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
7024
7025  // How many ULP's (Units in the Last Place) we want to tolerate when
7026  // comparing two numbers.  The larger the value, the more error we
7027  // allow.  A 0 value means that two numbers must be exactly the same
7028  // to be considered equal.
7029  //
7030  // The maximum error of a single floating-point operation is 0.5
7031  // units in the last place.  On Intel CPU's, all floating-point
7032  // calculations are done with 80-bit precision, while double has 64
7033  // bits.  Therefore, 4 should be enough for ordinary use.
7034  //
7035  // See the following article for more details on ULP:
7036  // http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm.
7037  static const size_t kMaxUlps = 4;
7038
7039  // Constructs a FloatingPoint from a raw floating-point number.
7040  //
7041  // On an Intel CPU, passing a non-normalized NAN (Not a Number)
7042  // around may change its bits, although the new value is guaranteed
7043  // to be also a NAN.  Therefore, don't expect this constructor to
7044  // preserve the bits in x when x is a NAN.
7045  explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
7046
7047  // Static methods
7048
7049  // Reinterprets a bit pattern as a floating-point number.
7050  //
7051  // This function is needed to test the AlmostEquals() method.
7052  static RawType ReinterpretBits(const Bits bits) {
7053    FloatingPoint fp(0);
7054    fp.u_.bits_ = bits;
7055    return fp.u_.value_;
7056  }
7057
7058  // Returns the floating-point number that represent positive infinity.
7059  static RawType Infinity() {
7060    return ReinterpretBits(kExponentBitMask);
7061  }
7062
7063  // Non-static methods
7064
7065  // Returns the bits that represents this number.
7066  const Bits &bits() const { return u_.bits_; }
7067
7068  // Returns the exponent bits of this number.
7069  Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
7070
7071  // Returns the fraction bits of this number.
7072  Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
7073
7074  // Returns the sign bit of this number.
7075  Bits sign_bit() const { return kSignBitMask & u_.bits_; }
7076
7077  // Returns true iff this is NAN (not a number).
7078  bool is_nan() const {
7079    // It's a NAN if the exponent bits are all ones and the fraction
7080    // bits are not entirely zeros.
7081    return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
7082  }
7083
7084  // Returns true iff this number is at most kMaxUlps ULP's away from
7085  // rhs.  In particular, this function:
7086  //
7087  //   - returns false if either number is (or both are) NAN.
7088  //   - treats really large numbers as almost equal to infinity.
7089  //   - thinks +0.0 and -0.0 are 0 DLP's apart.
7090  bool AlmostEquals(const FloatingPoint& rhs) const {
7091    // The IEEE standard says that any comparison operation involving
7092    // a NAN must return false.
7093    if (is_nan() || rhs.is_nan()) return false;
7094
7095    return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
7096        <= kMaxUlps;
7097  }
7098
7099 private:
7100  // The data type used to store the actual floating-point number.
7101  union FloatingPointUnion {
7102    RawType value_;  // The raw floating-point number.
7103    Bits bits_;      // The bits that represent the number.
7104  };
7105
7106  // Converts an integer from the sign-and-magnitude representation to
7107  // the biased representation.  More precisely, let N be 2 to the
7108  // power of (kBitCount - 1), an integer x is represented by the
7109  // unsigned number x + N.
7110  //
7111  // For instance,
7112  //
7113  //   -N + 1 (the most negative number representable using
7114  //          sign-and-magnitude) is represented by 1;
7115  //   0      is represented by N; and
7116  //   N - 1  (the biggest number representable using
7117  //          sign-and-magnitude) is represented by 2N - 1.
7118  //
7119  // Read http://en.wikipedia.org/wiki/Signed_number_representations
7120  // for more details on signed number representations.
7121  static Bits SignAndMagnitudeToBiased(const Bits &sam) {
7122    if (kSignBitMask & sam) {
7123      // sam represents a negative number.
7124      return ~sam + 1;
7125    } else {
7126      // sam represents a positive number.
7127      return kSignBitMask | sam;
7128    }
7129  }
7130
7131  // Given two numbers in the sign-and-magnitude representation,
7132  // returns the distance between them as an unsigned number.
7133  static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
7134                                                     const Bits &sam2) {
7135    const Bits biased1 = SignAndMagnitudeToBiased(sam1);
7136    const Bits biased2 = SignAndMagnitudeToBiased(sam2);
7137    return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
7138  }
7139
7140  FloatingPointUnion u_;
7141};
7142
7143// Typedefs the instances of the FloatingPoint template class that we
7144// care to use.
7145typedef FloatingPoint<float> Float;
7146typedef FloatingPoint<double> Double;
7147
7148// In order to catch the mistake of putting tests that use different
7149// test fixture classes in the same test case, we need to assign
7150// unique IDs to fixture classes and compare them.  The TypeId type is
7151// used to hold such IDs.  The user should treat TypeId as an opaque
7152// type: the only operation allowed on TypeId values is to compare
7153// them for equality using the == operator.
7154typedef const void* TypeId;
7155
7156template <typename T>
7157class TypeIdHelper {
7158 public:
7159  // dummy_ must not have a const type.  Otherwise an overly eager
7160  // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
7161  // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
7162  static bool dummy_;
7163};
7164
7165template <typename T>
7166bool TypeIdHelper<T>::dummy_ = false;
7167
7168// GetTypeId<T>() returns the ID of type T.  Different values will be
7169// returned for different types.  Calling the function twice with the
7170// same type argument is guaranteed to return the same ID.
7171template <typename T>
7172TypeId GetTypeId() {
7173  // The compiler is required to allocate a different
7174  // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
7175  // the template.  Therefore, the address of dummy_ is guaranteed to
7176  // be unique.
7177  return &(TypeIdHelper<T>::dummy_);
7178}
7179
7180// Returns the type ID of ::testing::Test.  Always call this instead
7181// of GetTypeId< ::testing::Test>() to get the type ID of
7182// ::testing::Test, as the latter may give the wrong result due to a
7183// suspected linker bug when compiling Google Test as a Mac OS X
7184// framework.
7185GTEST_API_ TypeId GetTestTypeId();
7186
7187// Defines the abstract factory interface that creates instances
7188// of a Test object.
7189class TestFactoryBase {
7190 public:
7191  virtual ~TestFactoryBase() {}
7192
7193  // Creates a test instance to run. The instance is both created and destroyed
7194  // within TestInfoImpl::Run()
7195  virtual Test* CreateTest() = 0;
7196
7197 protected:
7198  TestFactoryBase() {}
7199
7200 private:
7201  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
7202};
7203
7204// This class provides implementation of TeastFactoryBase interface.
7205// It is used in TEST and TEST_F macros.
7206template <class TestClass>
7207class TestFactoryImpl : public TestFactoryBase {
7208 public:
7209  virtual Test* CreateTest() { return new TestClass; }
7210};
7211
7212#if GTEST_OS_WINDOWS
7213
7214// Predicate-formatters for implementing the HRESULT checking macros
7215// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
7216// We pass a long instead of HRESULT to avoid causing an
7217// include dependency for the HRESULT type.
7218GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
7219                                            long hr);  // NOLINT
7220GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
7221                                            long hr);  // NOLINT
7222
7223#endif  // GTEST_OS_WINDOWS
7224
7225// Types of SetUpTestCase() and TearDownTestCase() functions.
7226typedef void (*SetUpTestCaseFunc)();
7227typedef void (*TearDownTestCaseFunc)();
7228
7229// Creates a new TestInfo object and registers it with Google Test;
7230// returns the created object.
7231//
7232// Arguments:
7233//
7234//   test_case_name:   name of the test case
7235//   name:             name of the test
7236//   type_param        the name of the test's type parameter, or NULL if
7237//                     this is not  a typed or a type-parameterized test.
7238//   value_param       text representation of the test's value parameter,
7239//                     or NULL if this is not a type-parameterized test.
7240//   fixture_class_id: ID of the test fixture class
7241//   set_up_tc:        pointer to the function that sets up the test case
7242//   tear_down_tc:     pointer to the function that tears down the test case
7243//   factory:          pointer to the factory that creates a test object.
7244//                     The newly created TestInfo instance will assume
7245//                     ownership of the factory object.
7246GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
7247    const char* test_case_name, const char* name,
7248    const char* type_param,
7249    const char* value_param,
7250    TypeId fixture_class_id,
7251    SetUpTestCaseFunc set_up_tc,
7252    TearDownTestCaseFunc tear_down_tc,
7253    TestFactoryBase* factory);
7254
7255// If *pstr starts with the given prefix, modifies *pstr to be right
7256// past the prefix and returns true; otherwise leaves *pstr unchanged
7257// and returns false.  None of pstr, *pstr, and prefix can be NULL.
7258GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
7259
7260#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
7261
7262// State of the definition of a type-parameterized test case.
7263class GTEST_API_ TypedTestCasePState {
7264 public:
7265  TypedTestCasePState() : registered_(false) {}
7266
7267  // Adds the given test name to defined_test_names_ and return true
7268  // if the test case hasn't been registered; otherwise aborts the
7269  // program.
7270  bool AddTestName(const char* file, int line, const char* case_name,
7271                   const char* test_name) {
7272    if (registered_) {
7273      fprintf(stderr, "%s Test %s must be defined before "
7274              "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
7275              FormatFileLocation(file, line).c_str(), test_name, case_name);
7276      fflush(stderr);
7277      posix::Abort();
7278    }
7279    defined_test_names_.insert(test_name);
7280    return true;
7281  }
7282
7283  // Verifies that registered_tests match the test names in
7284  // defined_test_names_; returns registered_tests if successful, or
7285  // aborts the program otherwise.
7286  const char* VerifyRegisteredTestNames(
7287      const char* file, int line, const char* registered_tests);
7288
7289 private:
7290  bool registered_;
7291  ::std::set<const char*> defined_test_names_;
7292};
7293
7294// Skips to the first non-space char after the first comma in 'str';
7295// returns NULL if no comma is found in 'str'.
7296inline const char* SkipComma(const char* str) {
7297  const char* comma = strchr(str, ',');
7298  if (comma == NULL) {
7299    return NULL;
7300  }
7301  while (IsSpace(*(++comma))) {}
7302  return comma;
7303}
7304
7305// Returns the prefix of 'str' before the first comma in it; returns
7306// the entire string if it contains no comma.
7307inline String GetPrefixUntilComma(const char* str) {
7308  const char* comma = strchr(str, ',');
7309  return comma == NULL ? String(str) : String(str, comma - str);
7310}
7311
7312// TypeParameterizedTest<Fixture, TestSel, Types>::Register()
7313// registers a list of type-parameterized tests with Google Test.  The
7314// return value is insignificant - we just need to return something
7315// such that we can call this function in a namespace scope.
7316//
7317// Implementation note: The GTEST_TEMPLATE_ macro declares a template
7318// template parameter.  It's defined in gtest-type-util.h.
7319template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
7320class TypeParameterizedTest {
7321 public:
7322  // 'index' is the index of the test in the type list 'Types'
7323  // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,
7324  // Types).  Valid values for 'index' are [0, N - 1] where N is the
7325  // length of Types.
7326  static bool Register(const char* prefix, const char* case_name,
7327                       const char* test_names, int index) {
7328    typedef typename Types::Head Type;
7329    typedef Fixture<Type> FixtureClass;
7330    typedef typename GTEST_BIND_(TestSel, Type) TestClass;
7331
7332    // First, registers the first type-parameterized test in the type
7333    // list.
7334    MakeAndRegisterTestInfo(
7335        String::Format("%s%s%s/%d", prefix, prefix[0] == '\0' ? "" : "/",
7336                       case_name, index).c_str(),
7337        GetPrefixUntilComma(test_names).c_str(),
7338        GetTypeName<Type>().c_str(),
7339        NULL,  // No value parameter.
7340        GetTypeId<FixtureClass>(),
7341        TestClass::SetUpTestCase,
7342        TestClass::TearDownTestCase,
7343        new TestFactoryImpl<TestClass>);
7344
7345    // Next, recurses (at compile time) with the tail of the type list.
7346    return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>
7347        ::Register(prefix, case_name, test_names, index + 1);
7348  }
7349};
7350
7351// The base case for the compile time recursion.
7352template <GTEST_TEMPLATE_ Fixture, class TestSel>
7353class TypeParameterizedTest<Fixture, TestSel, Types0> {
7354 public:
7355  static bool Register(const char* /*prefix*/, const char* /*case_name*/,
7356                       const char* /*test_names*/, int /*index*/) {
7357    return true;
7358  }
7359};
7360
7361// TypeParameterizedTestCase<Fixture, Tests, Types>::Register()
7362// registers *all combinations* of 'Tests' and 'Types' with Google
7363// Test.  The return value is insignificant - we just need to return
7364// something such that we can call this function in a namespace scope.
7365template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
7366class TypeParameterizedTestCase {
7367 public:
7368  static bool Register(const char* prefix, const char* case_name,
7369                       const char* test_names) {
7370    typedef typename Tests::Head Head;
7371
7372    // First, register the first test in 'Test' for each type in 'Types'.
7373    TypeParameterizedTest<Fixture, Head, Types>::Register(
7374        prefix, case_name, test_names, 0);
7375
7376    // Next, recurses (at compile time) with the tail of the test list.
7377    return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>
7378        ::Register(prefix, case_name, SkipComma(test_names));
7379  }
7380};
7381
7382// The base case for the compile time recursion.
7383template <GTEST_TEMPLATE_ Fixture, typename Types>
7384class TypeParameterizedTestCase<Fixture, Templates0, Types> {
7385 public:
7386  static bool Register(const char* /*prefix*/, const char* /*case_name*/,
7387                       const char* /*test_names*/) {
7388    return true;
7389  }
7390};
7391
7392#endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
7393
7394// Returns the current OS stack trace as a String.
7395//
7396// The maximum number of stack frames to be included is specified by
7397// the gtest_stack_trace_depth flag.  The skip_count parameter
7398// specifies the number of top frames to be skipped, which doesn't
7399// count against the number of frames to be included.
7400//
7401// For example, if Foo() calls Bar(), which in turn calls
7402// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
7403// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
7404GTEST_API_ String GetCurrentOsStackTraceExceptTop(UnitTest* unit_test,
7405                                                  int skip_count);
7406
7407// Helpers for suppressing warnings on unreachable code or constant
7408// condition.
7409
7410// Always returns true.
7411GTEST_API_ bool AlwaysTrue();
7412
7413// Always returns false.
7414inline bool AlwaysFalse() { return !AlwaysTrue(); }
7415
7416// Helper for suppressing false warning from Clang on a const char*
7417// variable declared in a conditional expression always being NULL in
7418// the else branch.
7419struct GTEST_API_ ConstCharPtr {
7420  ConstCharPtr(const char* str) : value(str) {}
7421  operator bool() const { return true; }
7422  const char* value;
7423};
7424
7425// A simple Linear Congruential Generator for generating random
7426// numbers with a uniform distribution.  Unlike rand() and srand(), it
7427// doesn't use global state (and therefore can't interfere with user
7428// code).  Unlike rand_r(), it's portable.  An LCG isn't very random,
7429// but it's good enough for our purposes.
7430class GTEST_API_ Random {
7431 public:
7432  static const UInt32 kMaxRange = 1u << 31;
7433
7434  explicit Random(UInt32 seed) : state_(seed) {}
7435
7436  void Reseed(UInt32 seed) { state_ = seed; }
7437
7438  // Generates a random number from [0, range).  Crashes if 'range' is
7439  // 0 or greater than kMaxRange.
7440  UInt32 Generate(UInt32 range);
7441
7442 private:
7443  UInt32 state_;
7444  GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
7445};
7446
7447// Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a
7448// compiler error iff T1 and T2 are different types.
7449template <typename T1, typename T2>
7450struct CompileAssertTypesEqual;
7451
7452template <typename T>
7453struct CompileAssertTypesEqual<T, T> {
7454};
7455
7456// Removes the reference from a type if it is a reference type,
7457// otherwise leaves it unchanged.  This is the same as
7458// tr1::remove_reference, which is not widely available yet.
7459template <typename T>
7460struct RemoveReference { typedef T type; };  // NOLINT
7461template <typename T>
7462struct RemoveReference<T&> { typedef T type; };  // NOLINT
7463
7464// A handy wrapper around RemoveReference that works when the argument
7465// T depends on template parameters.
7466#define GTEST_REMOVE_REFERENCE_(T) \
7467    typename ::testing::internal::RemoveReference<T>::type
7468
7469// Removes const from a type if it is a const type, otherwise leaves
7470// it unchanged.  This is the same as tr1::remove_const, which is not
7471// widely available yet.
7472template <typename T>
7473struct RemoveConst { typedef T type; };  // NOLINT
7474template <typename T>
7475struct RemoveConst<const T> { typedef T type; };  // NOLINT
7476
7477// MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above
7478// definition to fail to remove the const in 'const int[3]' and 'const
7479// char[3][4]'.  The following specialization works around the bug.
7480// However, it causes trouble with GCC and thus needs to be
7481// conditionally compiled.
7482#if defined(_MSC_VER) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
7483template <typename T, size_t N>
7484struct RemoveConst<const T[N]> {
7485  typedef typename RemoveConst<T>::type type[N];
7486};
7487#endif
7488
7489// A handy wrapper around RemoveConst that works when the argument
7490// T depends on template parameters.
7491#define GTEST_REMOVE_CONST_(T) \
7492    typename ::testing::internal::RemoveConst<T>::type
7493
7494// Turns const U&, U&, const U, and U all into U.
7495#define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
7496    GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))
7497
7498// Adds reference to a type if it is not a reference type,
7499// otherwise leaves it unchanged.  This is the same as
7500// tr1::add_reference, which is not widely available yet.
7501template <typename T>
7502struct AddReference { typedef T& type; };  // NOLINT
7503template <typename T>
7504struct AddReference<T&> { typedef T& type; };  // NOLINT
7505
7506// A handy wrapper around AddReference that works when the argument T
7507// depends on template parameters.
7508#define GTEST_ADD_REFERENCE_(T) \
7509    typename ::testing::internal::AddReference<T>::type
7510
7511// Adds a reference to const on top of T as necessary.  For example,
7512// it transforms
7513//
7514//   char         ==> const char&
7515//   const char   ==> const char&
7516//   char&        ==> const char&
7517//   const char&  ==> const char&
7518//
7519// The argument T must depend on some template parameters.
7520#define GTEST_REFERENCE_TO_CONST_(T) \
7521    GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T))
7522
7523// ImplicitlyConvertible<From, To>::value is a compile-time bool
7524// constant that's true iff type From can be implicitly converted to
7525// type To.
7526template <typename From, typename To>
7527class ImplicitlyConvertible {
7528 private:
7529  // We need the following helper functions only for their types.
7530  // They have no implementations.
7531
7532  // MakeFrom() is an expression whose type is From.  We cannot simply
7533  // use From(), as the type From may not have a public default
7534  // constructor.
7535  static From MakeFrom();
7536
7537  // These two functions are overloaded.  Given an expression
7538  // Helper(x), the compiler will pick the first version if x can be
7539  // implicitly converted to type To; otherwise it will pick the
7540  // second version.
7541  //
7542  // The first version returns a value of size 1, and the second
7543  // version returns a value of size 2.  Therefore, by checking the
7544  // size of Helper(x), which can be done at compile time, we can tell
7545  // which version of Helper() is used, and hence whether x can be
7546  // implicitly converted to type To.
7547  static char Helper(To);
7548  static char (&Helper(...))[2];  // NOLINT
7549
7550  // We have to put the 'public' section after the 'private' section,
7551  // or MSVC refuses to compile the code.
7552 public:
7553  // MSVC warns about implicitly converting from double to int for
7554  // possible loss of data, so we need to temporarily disable the
7555  // warning.
7556#ifdef _MSC_VER
7557# pragma warning(push)          // Saves the current warning state.
7558# pragma warning(disable:4244)  // Temporarily disables warning 4244.
7559
7560  static const bool value =
7561      sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
7562# pragma warning(pop)           // Restores the warning state.
7563#elif defined(__BORLANDC__)
7564  // C++Builder cannot use member overload resolution during template
7565  // instantiation.  The simplest workaround is to use its C++0x type traits
7566  // functions (C++Builder 2009 and above only).
7567  static const bool value = __is_convertible(From, To);
7568#else
7569  static const bool value =
7570      sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
7571#endif  // _MSV_VER
7572};
7573template <typename From, typename To>
7574const bool ImplicitlyConvertible<From, To>::value;
7575
7576// IsAProtocolMessage<T>::value is a compile-time bool constant that's
7577// true iff T is type ProtocolMessage, proto2::Message, or a subclass
7578// of those.
7579template <typename T>
7580struct IsAProtocolMessage
7581    : public bool_constant<
7582  ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value ||
7583  ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> {
7584};
7585
7586// When the compiler sees expression IsContainerTest<C>(0), if C is an
7587// STL-style container class, the first overload of IsContainerTest
7588// will be viable (since both C::iterator* and C::const_iterator* are
7589// valid types and NULL can be implicitly converted to them).  It will
7590// be picked over the second overload as 'int' is a perfect match for
7591// the type of argument 0.  If C::iterator or C::const_iterator is not
7592// a valid type, the first overload is not viable, and the second
7593// overload will be picked.  Therefore, we can determine whether C is
7594// a container class by checking the type of IsContainerTest<C>(0).
7595// The value of the expression is insignificant.
7596//
7597// Note that we look for both C::iterator and C::const_iterator.  The
7598// reason is that C++ injects the name of a class as a member of the
7599// class itself (e.g. you can refer to class iterator as either
7600// 'iterator' or 'iterator::iterator').  If we look for C::iterator
7601// only, for example, we would mistakenly think that a class named
7602// iterator is an STL container.
7603//
7604// Also note that the simpler approach of overloading
7605// IsContainerTest(typename C::const_iterator*) and
7606// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
7607typedef int IsContainer;
7608template <class C>
7609IsContainer IsContainerTest(int /* dummy */,
7610                            typename C::iterator* /* it */ = NULL,
7611                            typename C::const_iterator* /* const_it */ = NULL) {
7612  return 0;
7613}
7614
7615typedef char IsNotContainer;
7616template <class C>
7617IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
7618
7619// EnableIf<condition>::type is void when 'Cond' is true, and
7620// undefined when 'Cond' is false.  To use SFINAE to make a function
7621// overload only apply when a particular expression is true, add
7622// "typename EnableIf<expression>::type* = 0" as the last parameter.
7623template<bool> struct EnableIf;
7624template<> struct EnableIf<true> { typedef void type; };  // NOLINT
7625
7626// Utilities for native arrays.
7627
7628// ArrayEq() compares two k-dimensional native arrays using the
7629// elements' operator==, where k can be any integer >= 0.  When k is
7630// 0, ArrayEq() degenerates into comparing a single pair of values.
7631
7632template <typename T, typename U>
7633bool ArrayEq(const T* lhs, size_t size, const U* rhs);
7634
7635// This generic version is used when k is 0.
7636template <typename T, typename U>
7637inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
7638
7639// This overload is used when k >= 1.
7640template <typename T, typename U, size_t N>
7641inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
7642  return internal::ArrayEq(lhs, N, rhs);
7643}
7644
7645// This helper reduces code bloat.  If we instead put its logic inside
7646// the previous ArrayEq() function, arrays with different sizes would
7647// lead to different copies of the template code.
7648template <typename T, typename U>
7649bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
7650  for (size_t i = 0; i != size; i++) {
7651    if (!internal::ArrayEq(lhs[i], rhs[i]))
7652      return false;
7653  }
7654  return true;
7655}
7656
7657// Finds the first element in the iterator range [begin, end) that
7658// equals elem.  Element may be a native array type itself.
7659template <typename Iter, typename Element>
7660Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
7661  for (Iter it = begin; it != end; ++it) {
7662    if (internal::ArrayEq(*it, elem))
7663      return it;
7664  }
7665  return end;
7666}
7667
7668// CopyArray() copies a k-dimensional native array using the elements'
7669// operator=, where k can be any integer >= 0.  When k is 0,
7670// CopyArray() degenerates into copying a single value.
7671
7672template <typename T, typename U>
7673void CopyArray(const T* from, size_t size, U* to);
7674
7675// This generic version is used when k is 0.
7676template <typename T, typename U>
7677inline void CopyArray(const T& from, U* to) { *to = from; }
7678
7679// This overload is used when k >= 1.
7680template <typename T, typename U, size_t N>
7681inline void CopyArray(const T(&from)[N], U(*to)[N]) {
7682  internal::CopyArray(from, N, *to);
7683}
7684
7685// This helper reduces code bloat.  If we instead put its logic inside
7686// the previous CopyArray() function, arrays with different sizes
7687// would lead to different copies of the template code.
7688template <typename T, typename U>
7689void CopyArray(const T* from, size_t size, U* to) {
7690  for (size_t i = 0; i != size; i++) {
7691    internal::CopyArray(from[i], to + i);
7692  }
7693}
7694
7695// The relation between an NativeArray object (see below) and the
7696// native array it represents.
7697enum RelationToSource {
7698  kReference,  // The NativeArray references the native array.
7699  kCopy        // The NativeArray makes a copy of the native array and
7700               // owns the copy.
7701};
7702
7703// Adapts a native array to a read-only STL-style container.  Instead
7704// of the complete STL container concept, this adaptor only implements
7705// members useful for Google Mock's container matchers.  New members
7706// should be added as needed.  To simplify the implementation, we only
7707// support Element being a raw type (i.e. having no top-level const or
7708// reference modifier).  It's the client's responsibility to satisfy
7709// this requirement.  Element can be an array type itself (hence
7710// multi-dimensional arrays are supported).
7711template <typename Element>
7712class NativeArray {
7713 public:
7714  // STL-style container typedefs.
7715  typedef Element value_type;
7716  typedef Element* iterator;
7717  typedef const Element* const_iterator;
7718
7719  // Constructs from a native array.
7720  NativeArray(const Element* array, size_t count, RelationToSource relation) {
7721    Init(array, count, relation);
7722  }
7723
7724  // Copy constructor.
7725  NativeArray(const NativeArray& rhs) {
7726    Init(rhs.array_, rhs.size_, rhs.relation_to_source_);
7727  }
7728
7729  ~NativeArray() {
7730    // Ensures that the user doesn't instantiate NativeArray with a
7731    // const or reference type.
7732    static_cast<void>(StaticAssertTypeEqHelper<Element,
7733        GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>());
7734    if (relation_to_source_ == kCopy)
7735      delete[] array_;
7736  }
7737
7738  // STL-style container methods.
7739  size_t size() const { return size_; }
7740  const_iterator begin() const { return array_; }
7741  const_iterator end() const { return array_ + size_; }
7742  bool operator==(const NativeArray& rhs) const {
7743    return size() == rhs.size() &&
7744        ArrayEq(begin(), size(), rhs.begin());
7745  }
7746
7747 private:
7748  // Initializes this object; makes a copy of the input array if
7749  // 'relation' is kCopy.
7750  void Init(const Element* array, size_t a_size, RelationToSource relation) {
7751    if (relation == kReference) {
7752      array_ = array;
7753    } else {
7754      Element* const copy = new Element[a_size];
7755      CopyArray(array, a_size, copy);
7756      array_ = copy;
7757    }
7758    size_ = a_size;
7759    relation_to_source_ = relation;
7760  }
7761
7762  const Element* array_;
7763  size_t size_;
7764  RelationToSource relation_to_source_;
7765
7766  GTEST_DISALLOW_ASSIGN_(NativeArray);
7767};
7768
7769}  // namespace internal
7770}  // namespace testing
7771
7772#define GTEST_MESSAGE_AT_(file, line, message, result_type) \
7773  ::testing::internal::AssertHelper(result_type, file, line, message) \
7774    = ::testing::Message()
7775
7776#define GTEST_MESSAGE_(message, result_type) \
7777  GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
7778
7779#define GTEST_FATAL_FAILURE_(message) \
7780  return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
7781
7782#define GTEST_NONFATAL_FAILURE_(message) \
7783  GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
7784
7785#define GTEST_SUCCESS_(message) \
7786  GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
7787
7788// Suppresses MSVC warnings 4072 (unreachable code) for the code following
7789// statement if it returns or throws (or doesn't return or throw in some
7790// situations).
7791#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
7792  if (::testing::internal::AlwaysTrue()) { statement; }
7793
7794#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
7795  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7796  if (::testing::internal::ConstCharPtr gtest_msg = "") { \
7797    bool gtest_caught_expected = false; \
7798    try { \
7799      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
7800    } \
7801    catch (expected_exception const&) { \
7802      gtest_caught_expected = true; \
7803    } \
7804    catch (...) { \
7805      gtest_msg.value = \
7806          "Expected: " #statement " throws an exception of type " \
7807          #expected_exception ".\n  Actual: it throws a different type."; \
7808      goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
7809    } \
7810    if (!gtest_caught_expected) { \
7811      gtest_msg.value = \
7812          "Expected: " #statement " throws an exception of type " \
7813          #expected_exception ".\n  Actual: it throws nothing."; \
7814      goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
7815    } \
7816  } else \
7817    GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
7818      fail(gtest_msg.value)
7819
7820#define GTEST_TEST_NO_THROW_(statement, fail) \
7821  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7822  if (::testing::internal::AlwaysTrue()) { \
7823    try { \
7824      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
7825    } \
7826    catch (...) { \
7827      goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
7828    } \
7829  } else \
7830    GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
7831      fail("Expected: " #statement " doesn't throw an exception.\n" \
7832           "  Actual: it throws.")
7833
7834#define GTEST_TEST_ANY_THROW_(statement, fail) \
7835  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7836  if (::testing::internal::AlwaysTrue()) { \
7837    bool gtest_caught_any = false; \
7838    try { \
7839      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
7840    } \
7841    catch (...) { \
7842      gtest_caught_any = true; \
7843    } \
7844    if (!gtest_caught_any) { \
7845      goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
7846    } \
7847  } else \
7848    GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
7849      fail("Expected: " #statement " throws an exception.\n" \
7850           "  Actual: it doesn't.")
7851
7852
7853// Implements Boolean test assertions such as EXPECT_TRUE. expression can be
7854// either a boolean expression or an AssertionResult. text is a textual
7855// represenation of expression as it was passed into the EXPECT_TRUE.
7856#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
7857  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7858  if (const ::testing::AssertionResult gtest_ar_ = \
7859      ::testing::AssertionResult(expression)) \
7860    ; \
7861  else \
7862    fail(::testing::internal::GetBoolAssertionFailureMessage(\
7863        gtest_ar_, text, #actual, #expected).c_str())
7864
7865#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
7866  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
7867  if (::testing::internal::AlwaysTrue()) { \
7868    ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
7869    GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
7870    if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
7871      goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
7872    } \
7873  } else \
7874    GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
7875      fail("Expected: " #statement " doesn't generate new fatal " \
7876           "failures in the current thread.\n" \
7877           "  Actual: it does.")
7878
7879// Expands to the name of the class that implements the given test.
7880#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
7881  test_case_name##_##test_name##_Test
7882
7883// Helper macro for defining tests.
7884#define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
7885class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
7886 public:\
7887  GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
7888 private:\
7889  virtual void TestBody();\
7890  static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
7891  GTEST_DISALLOW_COPY_AND_ASSIGN_(\
7892      GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
7893};\
7894\
7895::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
7896  ::test_info_ =\
7897    ::testing::internal::MakeAndRegisterTestInfo(\
7898        #test_case_name, #test_name, NULL, NULL, \
7899        (parent_id), \
7900        parent_class::SetUpTestCase, \
7901        parent_class::TearDownTestCase, \
7902        new ::testing::internal::TestFactoryImpl<\
7903            GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
7904void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
7905
7906#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
7907// Copyright 2005, Google Inc.
7908// All rights reserved.
7909//
7910// Redistribution and use in source and binary forms, with or without
7911// modification, are permitted provided that the following conditions are
7912// met:
7913//
7914//     * Redistributions of source code must retain the above copyright
7915// notice, this list of conditions and the following disclaimer.
7916//     * Redistributions in binary form must reproduce the above
7917// copyright notice, this list of conditions and the following disclaimer
7918// in the documentation and/or other materials provided with the
7919// distribution.
7920//     * Neither the name of Google Inc. nor the names of its
7921// contributors may be used to endorse or promote products derived from
7922// this software without specific prior written permission.
7923//
7924// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7925// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7926// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7927// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7928// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
7929// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
7930// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
7931// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
7932// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7933// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
7934// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7935//
7936// Author: wan@google.com (Zhanyong Wan)
7937//
7938// The Google C++ Testing Framework (Google Test)
7939//
7940// This header file defines the public API for death tests.  It is
7941// #included by gtest.h so a user doesn't need to include this
7942// directly.
7943
7944#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
7945#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
7946
7947// Copyright 2005, Google Inc.
7948// All rights reserved.
7949//
7950// Redistribution and use in source and binary forms, with or without
7951// modification, are permitted provided that the following conditions are
7952// met:
7953//
7954//     * Redistributions of source code must retain the above copyright
7955// notice, this list of conditions and the following disclaimer.
7956//     * Redistributions in binary form must reproduce the above
7957// copyright notice, this list of conditions and the following disclaimer
7958// in the documentation and/or other materials provided with the
7959// distribution.
7960//     * Neither the name of Google Inc. nor the names of its
7961// contributors may be used to endorse or promote products derived from
7962// this software without specific prior written permission.
7963//
7964// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7965// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7966// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7967// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7968// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
7969// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
7970// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
7971// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
7972// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7973// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
7974// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7975//
7976// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
7977//
7978// The Google C++ Testing Framework (Google Test)
7979//
7980// This header file defines internal utilities needed for implementing
7981// death tests.  They are subject to change without notice.
7982
7983#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
7984#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
7985
7986
7987#include <stdio.h>
7988
7989namespace testing {
7990namespace internal {
7991
7992GTEST_DECLARE_string_(internal_run_death_test);
7993
7994// Names of the flags (needed for parsing Google Test flags).
7995const char kDeathTestStyleFlag[] = "death_test_style";
7996const char kDeathTestUseFork[] = "death_test_use_fork";
7997const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
7998
7999#if GTEST_HAS_DEATH_TEST
8000
8001// DeathTest is a class that hides much of the complexity of the
8002// GTEST_DEATH_TEST_ macro.  It is abstract; its static Create method
8003// returns a concrete class that depends on the prevailing death test
8004// style, as defined by the --gtest_death_test_style and/or
8005// --gtest_internal_run_death_test flags.
8006
8007// In describing the results of death tests, these terms are used with
8008// the corresponding definitions:
8009//
8010// exit status:  The integer exit information in the format specified
8011//               by wait(2)
8012// exit code:    The integer code passed to exit(3), _exit(2), or
8013//               returned from main()
8014class GTEST_API_ DeathTest {
8015 public:
8016  // Create returns false if there was an error determining the
8017  // appropriate action to take for the current death test; for example,
8018  // if the gtest_death_test_style flag is set to an invalid value.
8019  // The LastMessage method will return a more detailed message in that
8020  // case.  Otherwise, the DeathTest pointer pointed to by the "test"
8021  // argument is set.  If the death test should be skipped, the pointer
8022  // is set to NULL; otherwise, it is set to the address of a new concrete
8023  // DeathTest object that controls the execution of the current test.
8024  static bool Create(const char* statement, const RE* regex,
8025                     const char* file, int line, DeathTest** test);
8026  DeathTest();
8027  virtual ~DeathTest() { }
8028
8029  // A helper class that aborts a death test when it's deleted.
8030  class ReturnSentinel {
8031   public:
8032    explicit ReturnSentinel(DeathTest* test) : test_(test) { }
8033    ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
8034   private:
8035    DeathTest* const test_;
8036    GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
8037  } GTEST_ATTRIBUTE_UNUSED_;
8038
8039  // An enumeration of possible roles that may be taken when a death
8040  // test is encountered.  EXECUTE means that the death test logic should
8041  // be executed immediately.  OVERSEE means that the program should prepare
8042  // the appropriate environment for a child process to execute the death
8043  // test, then wait for it to complete.
8044  enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
8045
8046  // An enumeration of the three reasons that a test might be aborted.
8047  enum AbortReason {
8048    TEST_ENCOUNTERED_RETURN_STATEMENT,
8049    TEST_THREW_EXCEPTION,
8050    TEST_DID_NOT_DIE
8051  };
8052
8053  // Assumes one of the above roles.
8054  virtual TestRole AssumeRole() = 0;
8055
8056  // Waits for the death test to finish and returns its status.
8057  virtual int Wait() = 0;
8058
8059  // Returns true if the death test passed; that is, the test process
8060  // exited during the test, its exit status matches a user-supplied
8061  // predicate, and its stderr output matches a user-supplied regular
8062  // expression.
8063  // The user-supplied predicate may be a macro expression rather
8064  // than a function pointer or functor, or else Wait and Passed could
8065  // be combined.
8066  virtual bool Passed(bool exit_status_ok) = 0;
8067
8068  // Signals that the death test did not die as expected.
8069  virtual void Abort(AbortReason reason) = 0;
8070
8071  // Returns a human-readable outcome message regarding the outcome of
8072  // the last death test.
8073  static const char* LastMessage();
8074
8075  static void set_last_death_test_message(const String& message);
8076
8077 private:
8078  // A string containing a description of the outcome of the last death test.
8079  static String last_death_test_message_;
8080
8081  GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
8082};
8083
8084// Factory interface for death tests.  May be mocked out for testing.
8085class DeathTestFactory {
8086 public:
8087  virtual ~DeathTestFactory() { }
8088  virtual bool Create(const char* statement, const RE* regex,
8089                      const char* file, int line, DeathTest** test) = 0;
8090};
8091
8092// A concrete DeathTestFactory implementation for normal use.
8093class DefaultDeathTestFactory : public DeathTestFactory {
8094 public:
8095  virtual bool Create(const char* statement, const RE* regex,
8096                      const char* file, int line, DeathTest** test);
8097};
8098
8099// Returns true if exit_status describes a process that was terminated
8100// by a signal, or exited normally with a nonzero exit code.
8101GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
8102
8103// Traps C++ exceptions escaping statement and reports them as test
8104// failures. Note that trapping SEH exceptions is not implemented here.
8105# if GTEST_HAS_EXCEPTIONS
8106#  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
8107  try { \
8108    GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8109  } catch (const ::std::exception& gtest_exception) { \
8110    fprintf(\
8111        stderr, \
8112        "\n%s: Caught std::exception-derived exception escaping the " \
8113        "death test statement. Exception message: %s\n", \
8114        ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
8115        gtest_exception.what()); \
8116    fflush(stderr); \
8117    death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
8118  } catch (...) { \
8119    death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
8120  }
8121
8122# else
8123#  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
8124  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
8125
8126# endif
8127
8128// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
8129// ASSERT_EXIT*, and EXPECT_EXIT*.
8130# define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
8131  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8132  if (::testing::internal::AlwaysTrue()) { \
8133    const ::testing::internal::RE& gtest_regex = (regex); \
8134    ::testing::internal::DeathTest* gtest_dt; \
8135    if (!::testing::internal::DeathTest::Create(#statement, &gtest_regex, \
8136        __FILE__, __LINE__, &gtest_dt)) { \
8137      goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
8138    } \
8139    if (gtest_dt != NULL) { \
8140      ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \
8141          gtest_dt_ptr(gtest_dt); \
8142      switch (gtest_dt->AssumeRole()) { \
8143        case ::testing::internal::DeathTest::OVERSEE_TEST: \
8144          if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
8145            goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
8146          } \
8147          break; \
8148        case ::testing::internal::DeathTest::EXECUTE_TEST: { \
8149          ::testing::internal::DeathTest::ReturnSentinel \
8150              gtest_sentinel(gtest_dt); \
8151          GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \
8152          gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
8153          break; \
8154        } \
8155        default: \
8156          break; \
8157      } \
8158    } \
8159  } else \
8160    GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \
8161      fail(::testing::internal::DeathTest::LastMessage())
8162// The symbol "fail" here expands to something into which a message
8163// can be streamed.
8164
8165// A class representing the parsed contents of the
8166// --gtest_internal_run_death_test flag, as it existed when
8167// RUN_ALL_TESTS was called.
8168class InternalRunDeathTestFlag {
8169 public:
8170  InternalRunDeathTestFlag(const String& a_file,
8171                           int a_line,
8172                           int an_index,
8173                           int a_write_fd)
8174      : file_(a_file), line_(a_line), index_(an_index),
8175        write_fd_(a_write_fd) {}
8176
8177  ~InternalRunDeathTestFlag() {
8178    if (write_fd_ >= 0)
8179      posix::Close(write_fd_);
8180  }
8181
8182  String file() const { return file_; }
8183  int line() const { return line_; }
8184  int index() const { return index_; }
8185  int write_fd() const { return write_fd_; }
8186
8187 private:
8188  String file_;
8189  int line_;
8190  int index_;
8191  int write_fd_;
8192
8193  GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
8194};
8195
8196// Returns a newly created InternalRunDeathTestFlag object with fields
8197// initialized from the GTEST_FLAG(internal_run_death_test) flag if
8198// the flag is specified; otherwise returns NULL.
8199InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
8200
8201#else  // GTEST_HAS_DEATH_TEST
8202
8203// This macro is used for implementing macros such as
8204// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
8205// death tests are not supported. Those macros must compile on such systems
8206// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
8207// systems that support death tests. This allows one to write such a macro
8208// on a system that does not support death tests and be sure that it will
8209// compile on a death-test supporting system.
8210//
8211// Parameters:
8212//   statement -  A statement that a macro such as EXPECT_DEATH would test
8213//                for program termination. This macro has to make sure this
8214//                statement is compiled but not executed, to ensure that
8215//                EXPECT_DEATH_IF_SUPPORTED compiles with a certain
8216//                parameter iff EXPECT_DEATH compiles with it.
8217//   regex     -  A regex that a macro such as EXPECT_DEATH would use to test
8218//                the output of statement.  This parameter has to be
8219//                compiled but not evaluated by this macro, to ensure that
8220//                this macro only accepts expressions that a macro such as
8221//                EXPECT_DEATH would accept.
8222//   terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
8223//                and a return statement for ASSERT_DEATH_IF_SUPPORTED.
8224//                This ensures that ASSERT_DEATH_IF_SUPPORTED will not
8225//                compile inside functions where ASSERT_DEATH doesn't
8226//                compile.
8227//
8228//  The branch that has an always false condition is used to ensure that
8229//  statement and regex are compiled (and thus syntactically correct) but
8230//  never executed. The unreachable code macro protects the terminator
8231//  statement from generating an 'unreachable code' warning in case
8232//  statement unconditionally returns or throws. The Message constructor at
8233//  the end allows the syntax of streaming additional messages into the
8234//  macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
8235# define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
8236    GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8237    if (::testing::internal::AlwaysTrue()) { \
8238      GTEST_LOG_(WARNING) \
8239          << "Death tests are not supported on this platform.\n" \
8240          << "Statement '" #statement "' cannot be verified."; \
8241    } else if (::testing::internal::AlwaysFalse()) { \
8242      ::testing::internal::RE::PartialMatch(".*", (regex)); \
8243      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8244      terminator; \
8245    } else \
8246      ::testing::Message()
8247
8248#endif  // GTEST_HAS_DEATH_TEST
8249
8250}  // namespace internal
8251}  // namespace testing
8252
8253#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
8254
8255namespace testing {
8256
8257// This flag controls the style of death tests.  Valid values are "threadsafe",
8258// meaning that the death test child process will re-execute the test binary
8259// from the start, running only a single death test, or "fast",
8260// meaning that the child process will execute the test logic immediately
8261// after forking.
8262GTEST_DECLARE_string_(death_test_style);
8263
8264#if GTEST_HAS_DEATH_TEST
8265
8266// The following macros are useful for writing death tests.
8267
8268// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
8269// executed:
8270//
8271//   1. It generates a warning if there is more than one active
8272//   thread.  This is because it's safe to fork() or clone() only
8273//   when there is a single thread.
8274//
8275//   2. The parent process clone()s a sub-process and runs the death
8276//   test in it; the sub-process exits with code 0 at the end of the
8277//   death test, if it hasn't exited already.
8278//
8279//   3. The parent process waits for the sub-process to terminate.
8280//
8281//   4. The parent process checks the exit code and error message of
8282//   the sub-process.
8283//
8284// Examples:
8285//
8286//   ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
8287//   for (int i = 0; i < 5; i++) {
8288//     EXPECT_DEATH(server.ProcessRequest(i),
8289//                  "Invalid request .* in ProcessRequest()")
8290//         << "Failed to die on request " << i);
8291//   }
8292//
8293//   ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
8294//
8295//   bool KilledBySIGHUP(int exit_code) {
8296//     return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
8297//   }
8298//
8299//   ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
8300//
8301// On the regular expressions used in death tests:
8302//
8303//   On POSIX-compliant systems (*nix), we use the <regex.h> library,
8304//   which uses the POSIX extended regex syntax.
8305//
8306//   On other platforms (e.g. Windows), we only support a simple regex
8307//   syntax implemented as part of Google Test.  This limited
8308//   implementation should be enough most of the time when writing
8309//   death tests; though it lacks many features you can find in PCRE
8310//   or POSIX extended regex syntax.  For example, we don't support
8311//   union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
8312//   repetition count ("x{5,7}"), among others.
8313//
8314//   Below is the syntax that we do support.  We chose it to be a
8315//   subset of both PCRE and POSIX extended regex, so it's easy to
8316//   learn wherever you come from.  In the following: 'A' denotes a
8317//   literal character, period (.), or a single \\ escape sequence;
8318//   'x' and 'y' denote regular expressions; 'm' and 'n' are for
8319//   natural numbers.
8320//
8321//     c     matches any literal character c
8322//     \\d   matches any decimal digit
8323//     \\D   matches any character that's not a decimal digit
8324//     \\f   matches \f
8325//     \\n   matches \n
8326//     \\r   matches \r
8327//     \\s   matches any ASCII whitespace, including \n
8328//     \\S   matches any character that's not a whitespace
8329//     \\t   matches \t
8330//     \\v   matches \v
8331//     \\w   matches any letter, _, or decimal digit
8332//     \\W   matches any character that \\w doesn't match
8333//     \\c   matches any literal character c, which must be a punctuation
8334//     .     matches any single character except \n
8335//     A?    matches 0 or 1 occurrences of A
8336//     A*    matches 0 or many occurrences of A
8337//     A+    matches 1 or many occurrences of A
8338//     ^     matches the beginning of a string (not that of each line)
8339//     $     matches the end of a string (not that of each line)
8340//     xy    matches x followed by y
8341//
8342//   If you accidentally use PCRE or POSIX extended regex features
8343//   not implemented by us, you will get a run-time failure.  In that
8344//   case, please try to rewrite your regular expression within the
8345//   above syntax.
8346//
8347//   This implementation is *not* meant to be as highly tuned or robust
8348//   as a compiled regex library, but should perform well enough for a
8349//   death test, which already incurs significant overhead by launching
8350//   a child process.
8351//
8352// Known caveats:
8353//
8354//   A "threadsafe" style death test obtains the path to the test
8355//   program from argv[0] and re-executes it in the sub-process.  For
8356//   simplicity, the current implementation doesn't search the PATH
8357//   when launching the sub-process.  This means that the user must
8358//   invoke the test program via a path that contains at least one
8359//   path separator (e.g. path/to/foo_test and
8360//   /absolute/path/to/bar_test are fine, but foo_test is not).  This
8361//   is rarely a problem as people usually don't put the test binary
8362//   directory in PATH.
8363//
8364// TODO(wan@google.com): make thread-safe death tests search the PATH.
8365
8366// Asserts that a given statement causes the program to exit, with an
8367// integer exit status that satisfies predicate, and emitting error output
8368// that matches regex.
8369# define ASSERT_EXIT(statement, predicate, regex) \
8370    GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
8371
8372// Like ASSERT_EXIT, but continues on to successive tests in the
8373// test case, if any:
8374# define EXPECT_EXIT(statement, predicate, regex) \
8375    GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
8376
8377// Asserts that a given statement causes the program to exit, either by
8378// explicitly exiting with a nonzero exit code or being killed by a
8379// signal, and emitting error output that matches regex.
8380# define ASSERT_DEATH(statement, regex) \
8381    ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
8382
8383// Like ASSERT_DEATH, but continues on to successive tests in the
8384// test case, if any:
8385# define EXPECT_DEATH(statement, regex) \
8386    EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
8387
8388// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
8389
8390// Tests that an exit code describes a normal exit with a given exit code.
8391class GTEST_API_ ExitedWithCode {
8392 public:
8393  explicit ExitedWithCode(int exit_code);
8394  bool operator()(int exit_status) const;
8395 private:
8396  // No implementation - assignment is unsupported.
8397  void operator=(const ExitedWithCode& other);
8398
8399  const int exit_code_;
8400};
8401
8402# if !GTEST_OS_WINDOWS
8403// Tests that an exit code describes an exit due to termination by a
8404// given signal.
8405class GTEST_API_ KilledBySignal {
8406 public:
8407  explicit KilledBySignal(int signum);
8408  bool operator()(int exit_status) const;
8409 private:
8410  const int signum_;
8411};
8412# endif  // !GTEST_OS_WINDOWS
8413
8414// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
8415// The death testing framework causes this to have interesting semantics,
8416// since the sideeffects of the call are only visible in opt mode, and not
8417// in debug mode.
8418//
8419// In practice, this can be used to test functions that utilize the
8420// LOG(DFATAL) macro using the following style:
8421//
8422// int DieInDebugOr12(int* sideeffect) {
8423//   if (sideeffect) {
8424//     *sideeffect = 12;
8425//   }
8426//   LOG(DFATAL) << "death";
8427//   return 12;
8428// }
8429//
8430// TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {
8431//   int sideeffect = 0;
8432//   // Only asserts in dbg.
8433//   EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
8434//
8435// #ifdef NDEBUG
8436//   // opt-mode has sideeffect visible.
8437//   EXPECT_EQ(12, sideeffect);
8438// #else
8439//   // dbg-mode no visible sideeffect.
8440//   EXPECT_EQ(0, sideeffect);
8441// #endif
8442// }
8443//
8444// This will assert that DieInDebugReturn12InOpt() crashes in debug
8445// mode, usually due to a DCHECK or LOG(DFATAL), but returns the
8446// appropriate fallback value (12 in this case) in opt mode. If you
8447// need to test that a function has appropriate side-effects in opt
8448// mode, include assertions against the side-effects.  A general
8449// pattern for this is:
8450//
8451// EXPECT_DEBUG_DEATH({
8452//   // Side-effects here will have an effect after this statement in
8453//   // opt mode, but none in debug mode.
8454//   EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
8455// }, "death");
8456//
8457# ifdef NDEBUG
8458
8459#  define EXPECT_DEBUG_DEATH(statement, regex) \
8460  do { statement; } while (::testing::internal::AlwaysFalse())
8461
8462#  define ASSERT_DEBUG_DEATH(statement, regex) \
8463  do { statement; } while (::testing::internal::AlwaysFalse())
8464
8465# else
8466
8467#  define EXPECT_DEBUG_DEATH(statement, regex) \
8468  EXPECT_DEATH(statement, regex)
8469
8470#  define ASSERT_DEBUG_DEATH(statement, regex) \
8471  ASSERT_DEATH(statement, regex)
8472
8473# endif  // NDEBUG for EXPECT_DEBUG_DEATH
8474#endif  // GTEST_HAS_DEATH_TEST
8475
8476// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
8477// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
8478// death tests are supported; otherwise they just issue a warning.  This is
8479// useful when you are combining death test assertions with normal test
8480// assertions in one test.
8481#if GTEST_HAS_DEATH_TEST
8482# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
8483    EXPECT_DEATH(statement, regex)
8484# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
8485    ASSERT_DEATH(statement, regex)
8486#else
8487# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
8488    GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
8489# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
8490    GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
8491#endif
8492
8493}  // namespace testing
8494
8495#endif  // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
8496// Copyright 2005, Google Inc.
8497// All rights reserved.
8498//
8499// Redistribution and use in source and binary forms, with or without
8500// modification, are permitted provided that the following conditions are
8501// met:
8502//
8503//     * Redistributions of source code must retain the above copyright
8504// notice, this list of conditions and the following disclaimer.
8505//     * Redistributions in binary form must reproduce the above
8506// copyright notice, this list of conditions and the following disclaimer
8507// in the documentation and/or other materials provided with the
8508// distribution.
8509//     * Neither the name of Google Inc. nor the names of its
8510// contributors may be used to endorse or promote products derived from
8511// this software without specific prior written permission.
8512//
8513// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8514// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8515// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8516// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8517// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8518// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8519// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8520// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8521// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8522// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
8523// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8524//
8525// Author: wan@google.com (Zhanyong Wan)
8526//
8527// The Google C++ Testing Framework (Google Test)
8528//
8529// This header file defines the Message class.
8530//
8531// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
8532// leave some internal implementation details in this header file.
8533// They are clearly marked by comments like this:
8534//
8535//   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
8536//
8537// Such code is NOT meant to be used by a user directly, and is subject
8538// to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user
8539// program!
8540
8541#ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
8542#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
8543
8544#include <limits>
8545
8546
8547namespace testing {
8548
8549// The Message class works like an ostream repeater.
8550//
8551// Typical usage:
8552//
8553//   1. You stream a bunch of values to a Message object.
8554//      It will remember the text in a stringstream.
8555//   2. Then you stream the Message object to an ostream.
8556//      This causes the text in the Message to be streamed
8557//      to the ostream.
8558//
8559// For example;
8560//
8561//   testing::Message foo;
8562//   foo << 1 << " != " << 2;
8563//   std::cout << foo;
8564//
8565// will print "1 != 2".
8566//
8567// Message is not intended to be inherited from.  In particular, its
8568// destructor is not virtual.
8569//
8570// Note that stringstream behaves differently in gcc and in MSVC.  You
8571// can stream a NULL char pointer to it in the former, but not in the
8572// latter (it causes an access violation if you do).  The Message
8573// class hides this difference by treating a NULL char pointer as
8574// "(null)".
8575class GTEST_API_ Message {
8576 private:
8577  // The type of basic IO manipulators (endl, ends, and flush) for
8578  // narrow streams.
8579  typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
8580
8581 public:
8582  // Constructs an empty Message.
8583  // We allocate the stringstream separately because otherwise each use of
8584  // ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's
8585  // stack frame leading to huge stack frames in some cases; gcc does not reuse
8586  // the stack space.
8587  Message() : ss_(new ::std::stringstream) {
8588    // By default, we want there to be enough precision when printing
8589    // a double to a Message.
8590    *ss_ << std::setprecision(std::numeric_limits<double>::digits10 + 2);
8591  }
8592
8593  // Copy constructor.
8594  Message(const Message& msg) : ss_(new ::std::stringstream) {  // NOLINT
8595    *ss_ << msg.GetString();
8596  }
8597
8598  // Constructs a Message from a C-string.
8599  explicit Message(const char* str) : ss_(new ::std::stringstream) {
8600    *ss_ << str;
8601  }
8602
8603#if GTEST_OS_SYMBIAN
8604  // Streams a value (either a pointer or not) to this object.
8605  template <typename T>
8606  inline Message& operator <<(const T& value) {
8607    StreamHelper(typename internal::is_pointer<T>::type(), value);
8608    return *this;
8609  }
8610#else
8611  // Streams a non-pointer value to this object.
8612  template <typename T>
8613  inline Message& operator <<(const T& val) {
8614    ::GTestStreamToHelper(ss_.get(), val);
8615    return *this;
8616  }
8617
8618  // Streams a pointer value to this object.
8619  //
8620  // This function is an overload of the previous one.  When you
8621  // stream a pointer to a Message, this definition will be used as it
8622  // is more specialized.  (The C++ Standard, section
8623  // [temp.func.order].)  If you stream a non-pointer, then the
8624  // previous definition will be used.
8625  //
8626  // The reason for this overload is that streaming a NULL pointer to
8627  // ostream is undefined behavior.  Depending on the compiler, you
8628  // may get "0", "(nil)", "(null)", or an access violation.  To
8629  // ensure consistent result across compilers, we always treat NULL
8630  // as "(null)".
8631  template <typename T>
8632  inline Message& operator <<(T* const& pointer) {  // NOLINT
8633    if (pointer == NULL) {
8634      *ss_ << "(null)";
8635    } else {
8636      ::GTestStreamToHelper(ss_.get(), pointer);
8637    }
8638    return *this;
8639  }
8640#endif  // GTEST_OS_SYMBIAN
8641
8642  // Since the basic IO manipulators are overloaded for both narrow
8643  // and wide streams, we have to provide this specialized definition
8644  // of operator <<, even though its body is the same as the
8645  // templatized version above.  Without this definition, streaming
8646  // endl or other basic IO manipulators to Message will confuse the
8647  // compiler.
8648  Message& operator <<(BasicNarrowIoManip val) {
8649    *ss_ << val;
8650    return *this;
8651  }
8652
8653  // Instead of 1/0, we want to see true/false for bool values.
8654  Message& operator <<(bool b) {
8655    return *this << (b ? "true" : "false");
8656  }
8657
8658  // These two overloads allow streaming a wide C string to a Message
8659  // using the UTF-8 encoding.
8660  Message& operator <<(const wchar_t* wide_c_str) {
8661    return *this << internal::String::ShowWideCString(wide_c_str);
8662  }
8663  Message& operator <<(wchar_t* wide_c_str) {
8664    return *this << internal::String::ShowWideCString(wide_c_str);
8665  }
8666
8667#if GTEST_HAS_STD_WSTRING
8668  // Converts the given wide string to a narrow string using the UTF-8
8669  // encoding, and streams the result to this Message object.
8670  Message& operator <<(const ::std::wstring& wstr);
8671#endif  // GTEST_HAS_STD_WSTRING
8672
8673#if GTEST_HAS_GLOBAL_WSTRING
8674  // Converts the given wide string to a narrow string using the UTF-8
8675  // encoding, and streams the result to this Message object.
8676  Message& operator <<(const ::wstring& wstr);
8677#endif  // GTEST_HAS_GLOBAL_WSTRING
8678
8679  // Gets the text streamed to this object so far as a String.
8680  // Each '\0' character in the buffer is replaced with "\\0".
8681  //
8682  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
8683  internal::String GetString() const {
8684    return internal::StringStreamToString(ss_.get());
8685  }
8686
8687 private:
8688
8689#if GTEST_OS_SYMBIAN
8690  // These are needed as the Nokia Symbian Compiler cannot decide between
8691  // const T& and const T* in a function template. The Nokia compiler _can_
8692  // decide between class template specializations for T and T*, so a
8693  // tr1::type_traits-like is_pointer works, and we can overload on that.
8694  template <typename T>
8695  inline void StreamHelper(internal::true_type /*dummy*/, T* pointer) {
8696    if (pointer == NULL) {
8697      *ss_ << "(null)";
8698    } else {
8699      ::GTestStreamToHelper(ss_.get(), pointer);
8700    }
8701  }
8702  template <typename T>
8703  inline void StreamHelper(internal::false_type /*dummy*/, const T& value) {
8704    ::GTestStreamToHelper(ss_.get(), value);
8705  }
8706#endif  // GTEST_OS_SYMBIAN
8707
8708  // We'll hold the text streamed to this object here.
8709  const internal::scoped_ptr< ::std::stringstream> ss_;
8710
8711  // We declare (but don't implement) this to prevent the compiler
8712  // from implementing the assignment operator.
8713  void operator=(const Message&);
8714};
8715
8716// Streams a Message to an ostream.
8717inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
8718  return os << sb.GetString();
8719}
8720
8721}  // namespace testing
8722
8723#endif  // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
8724// This file was GENERATED by command:
8725//     pump.py gtest-param-test.h.pump
8726// DO NOT EDIT BY HAND!!!
8727
8728// Copyright 2008, Google Inc.
8729// All rights reserved.
8730//
8731// Redistribution and use in source and binary forms, with or without
8732// modification, are permitted provided that the following conditions are
8733// met:
8734//
8735//     * Redistributions of source code must retain the above copyright
8736// notice, this list of conditions and the following disclaimer.
8737//     * Redistributions in binary form must reproduce the above
8738// copyright notice, this list of conditions and the following disclaimer
8739// in the documentation and/or other materials provided with the
8740// distribution.
8741//     * Neither the name of Google Inc. nor the names of its
8742// contributors may be used to endorse or promote products derived from
8743// this software without specific prior written permission.
8744//
8745// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8746// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8747// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8748// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8749// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8750// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8751// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8752// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8753// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8754// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
8755// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8756//
8757// Authors: vladl@google.com (Vlad Losev)
8758//
8759// Macros and functions for implementing parameterized tests
8760// in Google C++ Testing Framework (Google Test)
8761//
8762// This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
8763//
8764#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
8765#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
8766
8767
8768// Value-parameterized tests allow you to test your code with different
8769// parameters without writing multiple copies of the same test.
8770//
8771// Here is how you use value-parameterized tests:
8772
8773#if 0
8774
8775// To write value-parameterized tests, first you should define a fixture
8776// class. It is usually derived from testing::TestWithParam<T> (see below for
8777// another inheritance scheme that's sometimes useful in more complicated
8778// class hierarchies), where the type of your parameter values.
8779// TestWithParam<T> is itself derived from testing::Test. T can be any
8780// copyable type. If it's a raw pointer, you are responsible for managing the
8781// lifespan of the pointed values.
8782
8783class FooTest : public ::testing::TestWithParam<const char*> {
8784  // You can implement all the usual class fixture members here.
8785};
8786
8787// Then, use the TEST_P macro to define as many parameterized tests
8788// for this fixture as you want. The _P suffix is for "parameterized"
8789// or "pattern", whichever you prefer to think.
8790
8791TEST_P(FooTest, DoesBlah) {
8792  // Inside a test, access the test parameter with the GetParam() method
8793  // of the TestWithParam<T> class:
8794  EXPECT_TRUE(foo.Blah(GetParam()));
8795  ...
8796}
8797
8798TEST_P(FooTest, HasBlahBlah) {
8799  ...
8800}
8801
8802// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
8803// case with any set of parameters you want. Google Test defines a number
8804// of functions for generating test parameters. They return what we call
8805// (surprise!) parameter generators. Here is a  summary of them, which
8806// are all in the testing namespace:
8807//
8808//
8809//  Range(begin, end [, step]) - Yields values {begin, begin+step,
8810//                               begin+step+step, ...}. The values do not
8811//                               include end. step defaults to 1.
8812//  Values(v1, v2, ..., vN)    - Yields values {v1, v2, ..., vN}.
8813//  ValuesIn(container)        - Yields values from a C-style array, an STL
8814//  ValuesIn(begin,end)          container, or an iterator range [begin, end).
8815//  Bool()                     - Yields sequence {false, true}.
8816//  Combine(g1, g2, ..., gN)   - Yields all combinations (the Cartesian product
8817//                               for the math savvy) of the values generated
8818//                               by the N generators.
8819//
8820// For more details, see comments at the definitions of these functions below
8821// in this file.
8822//
8823// The following statement will instantiate tests from the FooTest test case
8824// each with parameter values "meeny", "miny", and "moe".
8825
8826INSTANTIATE_TEST_CASE_P(InstantiationName,
8827                        FooTest,
8828                        Values("meeny", "miny", "moe"));
8829
8830// To distinguish different instances of the pattern, (yes, you
8831// can instantiate it more then once) the first argument to the
8832// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
8833// actual test case name. Remember to pick unique prefixes for different
8834// instantiations. The tests from the instantiation above will have
8835// these names:
8836//
8837//    * InstantiationName/FooTest.DoesBlah/0 for "meeny"
8838//    * InstantiationName/FooTest.DoesBlah/1 for "miny"
8839//    * InstantiationName/FooTest.DoesBlah/2 for "moe"
8840//    * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
8841//    * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
8842//    * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
8843//
8844// You can use these names in --gtest_filter.
8845//
8846// This statement will instantiate all tests from FooTest again, each
8847// with parameter values "cat" and "dog":
8848
8849const char* pets[] = {"cat", "dog"};
8850INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
8851
8852// The tests from the instantiation above will have these names:
8853//
8854//    * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
8855//    * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
8856//    * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
8857//    * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
8858//
8859// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
8860// in the given test case, whether their definitions come before or
8861// AFTER the INSTANTIATE_TEST_CASE_P statement.
8862//
8863// Please also note that generator expressions (including parameters to the
8864// generators) are evaluated in InitGoogleTest(), after main() has started.
8865// This allows the user on one hand, to adjust generator parameters in order
8866// to dynamically determine a set of tests to run and on the other hand,
8867// give the user a chance to inspect the generated tests with Google Test
8868// reflection API before RUN_ALL_TESTS() is executed.
8869//
8870// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
8871// for more examples.
8872//
8873// In the future, we plan to publish the API for defining new parameter
8874// generators. But for now this interface remains part of the internal
8875// implementation and is subject to change.
8876//
8877//
8878// A parameterized test fixture must be derived from testing::Test and from
8879// testing::WithParamInterface<T>, where T is the type of the parameter
8880// values. Inheriting from TestWithParam<T> satisfies that requirement because
8881// TestWithParam<T> inherits from both Test and WithParamInterface. In more
8882// complicated hierarchies, however, it is occasionally useful to inherit
8883// separately from Test and WithParamInterface. For example:
8884
8885class BaseTest : public ::testing::Test {
8886  // You can inherit all the usual members for a non-parameterized test
8887  // fixture here.
8888};
8889
8890class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
8891  // The usual test fixture members go here too.
8892};
8893
8894TEST_F(BaseTest, HasFoo) {
8895  // This is an ordinary non-parameterized test.
8896}
8897
8898TEST_P(DerivedTest, DoesBlah) {
8899  // GetParam works just the same here as if you inherit from TestWithParam.
8900  EXPECT_TRUE(foo.Blah(GetParam()));
8901}
8902
8903#endif  // 0
8904
8905
8906#if !GTEST_OS_SYMBIAN
8907# include <utility>
8908#endif
8909
8910// scripts/fuse_gtest.py depends on gtest's own header being #included
8911// *unconditionally*.  Therefore these #includes cannot be moved
8912// inside #if GTEST_HAS_PARAM_TEST.
8913// Copyright 2008 Google Inc.
8914// All Rights Reserved.
8915//
8916// Redistribution and use in source and binary forms, with or without
8917// modification, are permitted provided that the following conditions are
8918// met:
8919//
8920//     * Redistributions of source code must retain the above copyright
8921// notice, this list of conditions and the following disclaimer.
8922//     * Redistributions in binary form must reproduce the above
8923// copyright notice, this list of conditions and the following disclaimer
8924// in the documentation and/or other materials provided with the
8925// distribution.
8926//     * Neither the name of Google Inc. nor the names of its
8927// contributors may be used to endorse or promote products derived from
8928// this software without specific prior written permission.
8929//
8930// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8931// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8932// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8933// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8934// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8935// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8936// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8937// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8938// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8939// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
8940// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8941//
8942// Author: vladl@google.com (Vlad Losev)
8943
8944// Type and function utilities for implementing parameterized tests.
8945
8946#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
8947#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
8948
8949#include <iterator>
8950#include <utility>
8951#include <vector>
8952
8953// scripts/fuse_gtest.py depends on gtest's own header being #included
8954// *unconditionally*.  Therefore these #includes cannot be moved
8955// inside #if GTEST_HAS_PARAM_TEST.
8956// Copyright 2003 Google Inc.
8957// All rights reserved.
8958//
8959// Redistribution and use in source and binary forms, with or without
8960// modification, are permitted provided that the following conditions are
8961// met:
8962//
8963//     * Redistributions of source code must retain the above copyright
8964// notice, this list of conditions and the following disclaimer.
8965//     * Redistributions in binary form must reproduce the above
8966// copyright notice, this list of conditions and the following disclaimer
8967// in the documentation and/or other materials provided with the
8968// distribution.
8969//     * Neither the name of Google Inc. nor the names of its
8970// contributors may be used to endorse or promote products derived from
8971// this software without specific prior written permission.
8972//
8973// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8974// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8975// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8976// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8977// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8978// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8979// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8980// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8981// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8982// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
8983// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8984//
8985// Authors: Dan Egnor (egnor@google.com)
8986//
8987// A "smart" pointer type with reference tracking.  Every pointer to a
8988// particular object is kept on a circular linked list.  When the last pointer
8989// to an object is destroyed or reassigned, the object is deleted.
8990//
8991// Used properly, this deletes the object when the last reference goes away.
8992// There are several caveats:
8993// - Like all reference counting schemes, cycles lead to leaks.
8994// - Each smart pointer is actually two pointers (8 bytes instead of 4).
8995// - Every time a pointer is assigned, the entire list of pointers to that
8996//   object is traversed.  This class is therefore NOT SUITABLE when there
8997//   will often be more than two or three pointers to a particular object.
8998// - References are only tracked as long as linked_ptr<> objects are copied.
8999//   If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS
9000//   will happen (double deletion).
9001//
9002// A good use of this class is storing object references in STL containers.
9003// You can safely put linked_ptr<> in a vector<>.
9004// Other uses may not be as good.
9005//
9006// Note: If you use an incomplete type with linked_ptr<>, the class
9007// *containing* linked_ptr<> must have a constructor and destructor (even
9008// if they do nothing!).
9009//
9010// Bill Gibbons suggested we use something like this.
9011//
9012// Thread Safety:
9013//   Unlike other linked_ptr implementations, in this implementation
9014//   a linked_ptr object is thread-safe in the sense that:
9015//     - it's safe to copy linked_ptr objects concurrently,
9016//     - it's safe to copy *from* a linked_ptr and read its underlying
9017//       raw pointer (e.g. via get()) concurrently, and
9018//     - it's safe to write to two linked_ptrs that point to the same
9019//       shared object concurrently.
9020// TODO(wan@google.com): rename this to safe_linked_ptr to avoid
9021// confusion with normal linked_ptr.
9022
9023#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
9024#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
9025
9026#include <stdlib.h>
9027#include <assert.h>
9028
9029
9030namespace testing {
9031namespace internal {
9032
9033// Protects copying of all linked_ptr objects.
9034GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);
9035
9036// This is used internally by all instances of linked_ptr<>.  It needs to be
9037// a non-template class because different types of linked_ptr<> can refer to
9038// the same object (linked_ptr<Superclass>(obj) vs linked_ptr<Subclass>(obj)).
9039// So, it needs to be possible for different types of linked_ptr to participate
9040// in the same circular linked list, so we need a single class type here.
9041//
9042// DO NOT USE THIS CLASS DIRECTLY YOURSELF.  Use linked_ptr<T>.
9043class linked_ptr_internal {
9044 public:
9045  // Create a new circle that includes only this instance.
9046  void join_new() {
9047    next_ = this;
9048  }
9049
9050  // Many linked_ptr operations may change p.link_ for some linked_ptr
9051  // variable p in the same circle as this object.  Therefore we need
9052  // to prevent two such operations from occurring concurrently.
9053  //
9054  // Note that different types of linked_ptr objects can coexist in a
9055  // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and
9056  // linked_ptr<Derived2>).  Therefore we must use a single mutex to
9057  // protect all linked_ptr objects.  This can create serious
9058  // contention in production code, but is acceptable in a testing
9059  // framework.
9060
9061  // Join an existing circle.
9062  // L < g_linked_ptr_mutex
9063  void join(linked_ptr_internal const* ptr) {
9064    MutexLock lock(&g_linked_ptr_mutex);
9065
9066    linked_ptr_internal const* p = ptr;
9067    while (p->next_ != ptr) p = p->next_;
9068    p->next_ = this;
9069    next_ = ptr;
9070  }
9071
9072  // Leave whatever circle we're part of.  Returns true if we were the
9073  // last member of the circle.  Once this is done, you can join() another.
9074  // L < g_linked_ptr_mutex
9075  bool depart() {
9076    MutexLock lock(&g_linked_ptr_mutex);
9077
9078    if (next_ == this) return true;
9079    linked_ptr_internal const* p = next_;
9080    while (p->next_ != this) p = p->next_;
9081    p->next_ = next_;
9082    return false;
9083  }
9084
9085 private:
9086  mutable linked_ptr_internal const* next_;
9087};
9088
9089template <typename T>
9090class linked_ptr {
9091 public:
9092  typedef T element_type;
9093
9094  // Take over ownership of a raw pointer.  This should happen as soon as
9095  // possible after the object is created.
9096  explicit linked_ptr(T* ptr = NULL) { capture(ptr); }
9097  ~linked_ptr() { depart(); }
9098
9099  // Copy an existing linked_ptr<>, adding ourselves to the list of references.
9100  template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); }
9101  linked_ptr(linked_ptr const& ptr) {  // NOLINT
9102    assert(&ptr != this);
9103    copy(&ptr);
9104  }
9105
9106  // Assignment releases the old value and acquires the new.
9107  template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) {
9108    depart();
9109    copy(&ptr);
9110    return *this;
9111  }
9112
9113  linked_ptr& operator=(linked_ptr const& ptr) {
9114    if (&ptr != this) {
9115      depart();
9116      copy(&ptr);
9117    }
9118    return *this;
9119  }
9120
9121  // Smart pointer members.
9122  void reset(T* ptr = NULL) {
9123    depart();
9124    capture(ptr);
9125  }
9126  T* get() const { return value_; }
9127  T* operator->() const { return value_; }
9128  T& operator*() const { return *value_; }
9129
9130  bool operator==(T* p) const { return value_ == p; }
9131  bool operator!=(T* p) const { return value_ != p; }
9132  template <typename U>
9133  bool operator==(linked_ptr<U> const& ptr) const {
9134    return value_ == ptr.get();
9135  }
9136  template <typename U>
9137  bool operator!=(linked_ptr<U> const& ptr) const {
9138    return value_ != ptr.get();
9139  }
9140
9141 private:
9142  template <typename U>
9143  friend class linked_ptr;
9144
9145  T* value_;
9146  linked_ptr_internal link_;
9147
9148  void depart() {
9149    if (link_.depart()) delete value_;
9150  }
9151
9152  void capture(T* ptr) {
9153    value_ = ptr;
9154    link_.join_new();
9155  }
9156
9157  template <typename U> void copy(linked_ptr<U> const* ptr) {
9158    value_ = ptr->get();
9159    if (value_)
9160      link_.join(&ptr->link_);
9161    else
9162      link_.join_new();
9163  }
9164};
9165
9166template<typename T> inline
9167bool operator==(T* ptr, const linked_ptr<T>& x) {
9168  return ptr == x.get();
9169}
9170
9171template<typename T> inline
9172bool operator!=(T* ptr, const linked_ptr<T>& x) {
9173  return ptr != x.get();
9174}
9175
9176// A function to convert T* into linked_ptr<T>
9177// Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation
9178// for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
9179template <typename T>
9180linked_ptr<T> make_linked_ptr(T* ptr) {
9181  return linked_ptr<T>(ptr);
9182}
9183
9184}  // namespace internal
9185}  // namespace testing
9186
9187#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
9188// Copyright 2007, Google Inc.
9189// All rights reserved.
9190//
9191// Redistribution and use in source and binary forms, with or without
9192// modification, are permitted provided that the following conditions are
9193// met:
9194//
9195//     * Redistributions of source code must retain the above copyright
9196// notice, this list of conditions and the following disclaimer.
9197//     * Redistributions in binary form must reproduce the above
9198// copyright notice, this list of conditions and the following disclaimer
9199// in the documentation and/or other materials provided with the
9200// distribution.
9201//     * Neither the name of Google Inc. nor the names of its
9202// contributors may be used to endorse or promote products derived from
9203// this software without specific prior written permission.
9204//
9205// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9206// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9207// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9208// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9209// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9210// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9211// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9212// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9213// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9214// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9215// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9216//
9217// Author: wan@google.com (Zhanyong Wan)
9218
9219// Google Test - The Google C++ Testing Framework
9220//
9221// This file implements a universal value printer that can print a
9222// value of any type T:
9223//
9224//   void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
9225//
9226// A user can teach this function how to print a class type T by
9227// defining either operator<<() or PrintTo() in the namespace that
9228// defines T.  More specifically, the FIRST defined function in the
9229// following list will be used (assuming T is defined in namespace
9230// foo):
9231//
9232//   1. foo::PrintTo(const T&, ostream*)
9233//   2. operator<<(ostream&, const T&) defined in either foo or the
9234//      global namespace.
9235//
9236// If none of the above is defined, it will print the debug string of
9237// the value if it is a protocol buffer, or print the raw bytes in the
9238// value otherwise.
9239//
9240// To aid debugging: when T is a reference type, the address of the
9241// value is also printed; when T is a (const) char pointer, both the
9242// pointer value and the NUL-terminated string it points to are
9243// printed.
9244//
9245// We also provide some convenient wrappers:
9246//
9247//   // Prints a value to a string.  For a (const or not) char
9248//   // pointer, the NUL-terminated string (but not the pointer) is
9249//   // printed.
9250//   std::string ::testing::PrintToString(const T& value);
9251//
9252//   // Prints a value tersely: for a reference type, the referenced
9253//   // value (but not the address) is printed; for a (const or not) char
9254//   // pointer, the NUL-terminated string (but not the pointer) is
9255//   // printed.
9256//   void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
9257//
9258//   // Prints value using the type inferred by the compiler.  The difference
9259//   // from UniversalTersePrint() is that this function prints both the
9260//   // pointer and the NUL-terminated string for a (const or not) char pointer.
9261//   void ::testing::internal::UniversalPrint(const T& value, ostream*);
9262//
9263//   // Prints the fields of a tuple tersely to a string vector, one
9264//   // element for each field. Tuple support must be enabled in
9265//   // gtest-port.h.
9266//   std::vector<string> UniversalTersePrintTupleFieldsToStrings(
9267//       const Tuple& value);
9268//
9269// Known limitation:
9270//
9271// The print primitives print the elements of an STL-style container
9272// using the compiler-inferred type of *iter where iter is a
9273// const_iterator of the container.  When const_iterator is an input
9274// iterator but not a forward iterator, this inferred type may not
9275// match value_type, and the print output may be incorrect.  In
9276// practice, this is rarely a problem as for most containers
9277// const_iterator is a forward iterator.  We'll fix this if there's an
9278// actual need for it.  Note that this fix cannot rely on value_type
9279// being defined as many user-defined container types don't have
9280// value_type.
9281
9282#ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
9283#define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
9284
9285#include <ostream>  // NOLINT
9286#include <sstream>
9287#include <string>
9288#include <utility>
9289#include <vector>
9290
9291namespace testing {
9292
9293// Definitions in the 'internal' and 'internal2' name spaces are
9294// subject to change without notice.  DO NOT USE THEM IN USER CODE!
9295namespace internal2 {
9296
9297// Prints the given number of bytes in the given object to the given
9298// ostream.
9299GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
9300                                     size_t count,
9301                                     ::std::ostream* os);
9302
9303// For selecting which printer to use when a given type has neither <<
9304// nor PrintTo().
9305enum TypeKind {
9306  kProtobuf,              // a protobuf type
9307  kConvertibleToInteger,  // a type implicitly convertible to BiggestInt
9308                          // (e.g. a named or unnamed enum type)
9309  kOtherType              // anything else
9310};
9311
9312// TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called
9313// by the universal printer to print a value of type T when neither
9314// operator<< nor PrintTo() is defined for T, where kTypeKind is the
9315// "kind" of T as defined by enum TypeKind.
9316template <typename T, TypeKind kTypeKind>
9317class TypeWithoutFormatter {
9318 public:
9319  // This default version is called when kTypeKind is kOtherType.
9320  static void PrintValue(const T& value, ::std::ostream* os) {
9321    PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value),
9322                         sizeof(value), os);
9323  }
9324};
9325
9326// We print a protobuf using its ShortDebugString() when the string
9327// doesn't exceed this many characters; otherwise we print it using
9328// DebugString() for better readability.
9329const size_t kProtobufOneLinerMaxLength = 50;
9330
9331template <typename T>
9332class TypeWithoutFormatter<T, kProtobuf> {
9333 public:
9334  static void PrintValue(const T& value, ::std::ostream* os) {
9335    const ::testing::internal::string short_str = value.ShortDebugString();
9336    const ::testing::internal::string pretty_str =
9337        short_str.length() <= kProtobufOneLinerMaxLength ?
9338        short_str : ("\n" + value.DebugString());
9339    *os << ("<" + pretty_str + ">");
9340  }
9341};
9342
9343template <typename T>
9344class TypeWithoutFormatter<T, kConvertibleToInteger> {
9345 public:
9346  // Since T has no << operator or PrintTo() but can be implicitly
9347  // converted to BiggestInt, we print it as a BiggestInt.
9348  //
9349  // Most likely T is an enum type (either named or unnamed), in which
9350  // case printing it as an integer is the desired behavior.  In case
9351  // T is not an enum, printing it as an integer is the best we can do
9352  // given that it has no user-defined printer.
9353  static void PrintValue(const T& value, ::std::ostream* os) {
9354    const internal::BiggestInt kBigInt = value;
9355    *os << kBigInt;
9356  }
9357};
9358
9359// Prints the given value to the given ostream.  If the value is a
9360// protocol message, its debug string is printed; if it's an enum or
9361// of a type implicitly convertible to BiggestInt, it's printed as an
9362// integer; otherwise the bytes in the value are printed.  This is
9363// what UniversalPrinter<T>::Print() does when it knows nothing about
9364// type T and T has neither << operator nor PrintTo().
9365//
9366// A user can override this behavior for a class type Foo by defining
9367// a << operator in the namespace where Foo is defined.
9368//
9369// We put this operator in namespace 'internal2' instead of 'internal'
9370// to simplify the implementation, as much code in 'internal' needs to
9371// use << in STL, which would conflict with our own << were it defined
9372// in 'internal'.
9373//
9374// Note that this operator<< takes a generic std::basic_ostream<Char,
9375// CharTraits> type instead of the more restricted std::ostream.  If
9376// we define it to take an std::ostream instead, we'll get an
9377// "ambiguous overloads" compiler error when trying to print a type
9378// Foo that supports streaming to std::basic_ostream<Char,
9379// CharTraits>, as the compiler cannot tell whether
9380// operator<<(std::ostream&, const T&) or
9381// operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more
9382// specific.
9383template <typename Char, typename CharTraits, typename T>
9384::std::basic_ostream<Char, CharTraits>& operator<<(
9385    ::std::basic_ostream<Char, CharTraits>& os, const T& x) {
9386  TypeWithoutFormatter<T,
9387      (internal::IsAProtocolMessage<T>::value ? kProtobuf :
9388       internal::ImplicitlyConvertible<const T&, internal::BiggestInt>::value ?
9389       kConvertibleToInteger : kOtherType)>::PrintValue(x, &os);
9390  return os;
9391}
9392
9393}  // namespace internal2
9394}  // namespace testing
9395
9396// This namespace MUST NOT BE NESTED IN ::testing, or the name look-up
9397// magic needed for implementing UniversalPrinter won't work.
9398namespace testing_internal {
9399
9400// Used to print a value that is not an STL-style container when the
9401// user doesn't define PrintTo() for it.
9402template <typename T>
9403void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
9404  // With the following statement, during unqualified name lookup,
9405  // testing::internal2::operator<< appears as if it was declared in
9406  // the nearest enclosing namespace that contains both
9407  // ::testing_internal and ::testing::internal2, i.e. the global
9408  // namespace.  For more details, refer to the C++ Standard section
9409  // 7.3.4-1 [namespace.udir].  This allows us to fall back onto
9410  // testing::internal2::operator<< in case T doesn't come with a <<
9411  // operator.
9412  //
9413  // We cannot write 'using ::testing::internal2::operator<<;', which
9414  // gcc 3.3 fails to compile due to a compiler bug.
9415  using namespace ::testing::internal2;  // NOLINT
9416
9417  // Assuming T is defined in namespace foo, in the next statement,
9418  // the compiler will consider all of:
9419  //
9420  //   1. foo::operator<< (thanks to Koenig look-up),
9421  //   2. ::operator<< (as the current namespace is enclosed in ::),
9422  //   3. testing::internal2::operator<< (thanks to the using statement above).
9423  //
9424  // The operator<< whose type matches T best will be picked.
9425  //
9426  // We deliberately allow #2 to be a candidate, as sometimes it's
9427  // impossible to define #1 (e.g. when foo is ::std, defining
9428  // anything in it is undefined behavior unless you are a compiler
9429  // vendor.).
9430  *os << value;
9431}
9432
9433}  // namespace testing_internal
9434
9435namespace testing {
9436namespace internal {
9437
9438// UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
9439// value to the given ostream.  The caller must ensure that
9440// 'ostream_ptr' is not NULL, or the behavior is undefined.
9441//
9442// We define UniversalPrinter as a class template (as opposed to a
9443// function template), as we need to partially specialize it for
9444// reference types, which cannot be done with function templates.
9445template <typename T>
9446class UniversalPrinter;
9447
9448template <typename T>
9449void UniversalPrint(const T& value, ::std::ostream* os);
9450
9451// Used to print an STL-style container when the user doesn't define
9452// a PrintTo() for it.
9453template <typename C>
9454void DefaultPrintTo(IsContainer /* dummy */,
9455                    false_type /* is not a pointer */,
9456                    const C& container, ::std::ostream* os) {
9457  const size_t kMaxCount = 32;  // The maximum number of elements to print.
9458  *os << '{';
9459  size_t count = 0;
9460  for (typename C::const_iterator it = container.begin();
9461       it != container.end(); ++it, ++count) {
9462    if (count > 0) {
9463      *os << ',';
9464      if (count == kMaxCount) {  // Enough has been printed.
9465        *os << " ...";
9466        break;
9467      }
9468    }
9469    *os << ' ';
9470    // We cannot call PrintTo(*it, os) here as PrintTo() doesn't
9471    // handle *it being a native array.
9472    internal::UniversalPrint(*it, os);
9473  }
9474
9475  if (count > 0) {
9476    *os << ' ';
9477  }
9478  *os << '}';
9479}
9480
9481// Used to print a pointer that is neither a char pointer nor a member
9482// pointer, when the user doesn't define PrintTo() for it.  (A member
9483// variable pointer or member function pointer doesn't really point to
9484// a location in the address space.  Their representation is
9485// implementation-defined.  Therefore they will be printed as raw
9486// bytes.)
9487template <typename T>
9488void DefaultPrintTo(IsNotContainer /* dummy */,
9489                    true_type /* is a pointer */,
9490                    T* p, ::std::ostream* os) {
9491  if (p == NULL) {
9492    *os << "NULL";
9493  } else {
9494    // C++ doesn't allow casting from a function pointer to any object
9495    // pointer.
9496    //
9497    // IsTrue() silences warnings: "Condition is always true",
9498    // "unreachable code".
9499    if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {
9500      // T is not a function type.  We just call << to print p,
9501      // relying on ADL to pick up user-defined << for their pointer
9502      // types, if any.
9503      *os << p;
9504    } else {
9505      // T is a function type, so '*os << p' doesn't do what we want
9506      // (it just prints p as bool).  We want to print p as a const
9507      // void*.  However, we cannot cast it to const void* directly,
9508      // even using reinterpret_cast, as earlier versions of gcc
9509      // (e.g. 3.4.5) cannot compile the cast when p is a function
9510      // pointer.  Casting to UInt64 first solves the problem.
9511      *os << reinterpret_cast<const void*>(
9512          reinterpret_cast<internal::UInt64>(p));
9513    }
9514  }
9515}
9516
9517// Used to print a non-container, non-pointer value when the user
9518// doesn't define PrintTo() for it.
9519template <typename T>
9520void DefaultPrintTo(IsNotContainer /* dummy */,
9521                    false_type /* is not a pointer */,
9522                    const T& value, ::std::ostream* os) {
9523  ::testing_internal::DefaultPrintNonContainerTo(value, os);
9524}
9525
9526// Prints the given value using the << operator if it has one;
9527// otherwise prints the bytes in it.  This is what
9528// UniversalPrinter<T>::Print() does when PrintTo() is not specialized
9529// or overloaded for type T.
9530//
9531// A user can override this behavior for a class type Foo by defining
9532// an overload of PrintTo() in the namespace where Foo is defined.  We
9533// give the user this option as sometimes defining a << operator for
9534// Foo is not desirable (e.g. the coding style may prevent doing it,
9535// or there is already a << operator but it doesn't do what the user
9536// wants).
9537template <typename T>
9538void PrintTo(const T& value, ::std::ostream* os) {
9539  // DefaultPrintTo() is overloaded.  The type of its first two
9540  // arguments determine which version will be picked.  If T is an
9541  // STL-style container, the version for container will be called; if
9542  // T is a pointer, the pointer version will be called; otherwise the
9543  // generic version will be called.
9544  //
9545  // Note that we check for container types here, prior to we check
9546  // for protocol message types in our operator<<.  The rationale is:
9547  //
9548  // For protocol messages, we want to give people a chance to
9549  // override Google Mock's format by defining a PrintTo() or
9550  // operator<<.  For STL containers, other formats can be
9551  // incompatible with Google Mock's format for the container
9552  // elements; therefore we check for container types here to ensure
9553  // that our format is used.
9554  //
9555  // The second argument of DefaultPrintTo() is needed to bypass a bug
9556  // in Symbian's C++ compiler that prevents it from picking the right
9557  // overload between:
9558  //
9559  //   PrintTo(const T& x, ...);
9560  //   PrintTo(T* x, ...);
9561  DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os);
9562}
9563
9564// The following list of PrintTo() overloads tells
9565// UniversalPrinter<T>::Print() how to print standard types (built-in
9566// types, strings, plain arrays, and pointers).
9567
9568// Overloads for various char types.
9569GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);
9570GTEST_API_ void PrintTo(signed char c, ::std::ostream* os);
9571inline void PrintTo(char c, ::std::ostream* os) {
9572  // When printing a plain char, we always treat it as unsigned.  This
9573  // way, the output won't be affected by whether the compiler thinks
9574  // char is signed or not.
9575  PrintTo(static_cast<unsigned char>(c), os);
9576}
9577
9578// Overloads for other simple built-in types.
9579inline void PrintTo(bool x, ::std::ostream* os) {
9580  *os << (x ? "true" : "false");
9581}
9582
9583// Overload for wchar_t type.
9584// Prints a wchar_t as a symbol if it is printable or as its internal
9585// code otherwise and also as its decimal code (except for L'\0').
9586// The L'\0' char is printed as "L'\\0'". The decimal code is printed
9587// as signed integer when wchar_t is implemented by the compiler
9588// as a signed type and is printed as an unsigned integer when wchar_t
9589// is implemented as an unsigned type.
9590GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
9591
9592// Overloads for C strings.
9593GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
9594inline void PrintTo(char* s, ::std::ostream* os) {
9595  PrintTo(ImplicitCast_<const char*>(s), os);
9596}
9597
9598// signed/unsigned char is often used for representing binary data, so
9599// we print pointers to it as void* to be safe.
9600inline void PrintTo(const signed char* s, ::std::ostream* os) {
9601  PrintTo(ImplicitCast_<const void*>(s), os);
9602}
9603inline void PrintTo(signed char* s, ::std::ostream* os) {
9604  PrintTo(ImplicitCast_<const void*>(s), os);
9605}
9606inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
9607  PrintTo(ImplicitCast_<const void*>(s), os);
9608}
9609inline void PrintTo(unsigned char* s, ::std::ostream* os) {
9610  PrintTo(ImplicitCast_<const void*>(s), os);
9611}
9612
9613// MSVC can be configured to define wchar_t as a typedef of unsigned
9614// short.  It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
9615// type.  When wchar_t is a typedef, defining an overload for const
9616// wchar_t* would cause unsigned short* be printed as a wide string,
9617// possibly causing invalid memory accesses.
9618#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
9619// Overloads for wide C strings
9620GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);
9621inline void PrintTo(wchar_t* s, ::std::ostream* os) {
9622  PrintTo(ImplicitCast_<const wchar_t*>(s), os);
9623}
9624#endif
9625
9626// Overload for C arrays.  Multi-dimensional arrays are printed
9627// properly.
9628
9629// Prints the given number of elements in an array, without printing
9630// the curly braces.
9631template <typename T>
9632void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
9633  UniversalPrint(a[0], os);
9634  for (size_t i = 1; i != count; i++) {
9635    *os << ", ";
9636    UniversalPrint(a[i], os);
9637  }
9638}
9639
9640// Overloads for ::string and ::std::string.
9641#if GTEST_HAS_GLOBAL_STRING
9642GTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os);
9643inline void PrintTo(const ::string& s, ::std::ostream* os) {
9644  PrintStringTo(s, os);
9645}
9646#endif  // GTEST_HAS_GLOBAL_STRING
9647
9648GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);
9649inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
9650  PrintStringTo(s, os);
9651}
9652
9653// Overloads for ::wstring and ::std::wstring.
9654#if GTEST_HAS_GLOBAL_WSTRING
9655GTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os);
9656inline void PrintTo(const ::wstring& s, ::std::ostream* os) {
9657  PrintWideStringTo(s, os);
9658}
9659#endif  // GTEST_HAS_GLOBAL_WSTRING
9660
9661#if GTEST_HAS_STD_WSTRING
9662GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
9663inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
9664  PrintWideStringTo(s, os);
9665}
9666#endif  // GTEST_HAS_STD_WSTRING
9667
9668#if GTEST_HAS_TR1_TUPLE
9669// Overload for ::std::tr1::tuple.  Needed for printing function arguments,
9670// which are packed as tuples.
9671
9672// Helper function for printing a tuple.  T must be instantiated with
9673// a tuple type.
9674template <typename T>
9675void PrintTupleTo(const T& t, ::std::ostream* os);
9676
9677// Overloaded PrintTo() for tuples of various arities.  We support
9678// tuples of up-to 10 fields.  The following implementation works
9679// regardless of whether tr1::tuple is implemented using the
9680// non-standard variadic template feature or not.
9681
9682inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) {
9683  PrintTupleTo(t, os);
9684}
9685
9686template <typename T1>
9687void PrintTo(const ::std::tr1::tuple<T1>& t, ::std::ostream* os) {
9688  PrintTupleTo(t, os);
9689}
9690
9691template <typename T1, typename T2>
9692void PrintTo(const ::std::tr1::tuple<T1, T2>& t, ::std::ostream* os) {
9693  PrintTupleTo(t, os);
9694}
9695
9696template <typename T1, typename T2, typename T3>
9697void PrintTo(const ::std::tr1::tuple<T1, T2, T3>& t, ::std::ostream* os) {
9698  PrintTupleTo(t, os);
9699}
9700
9701template <typename T1, typename T2, typename T3, typename T4>
9702void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4>& t, ::std::ostream* os) {
9703  PrintTupleTo(t, os);
9704}
9705
9706template <typename T1, typename T2, typename T3, typename T4, typename T5>
9707void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5>& t,
9708             ::std::ostream* os) {
9709  PrintTupleTo(t, os);
9710}
9711
9712template <typename T1, typename T2, typename T3, typename T4, typename T5,
9713          typename T6>
9714void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6>& t,
9715             ::std::ostream* os) {
9716  PrintTupleTo(t, os);
9717}
9718
9719template <typename T1, typename T2, typename T3, typename T4, typename T5,
9720          typename T6, typename T7>
9721void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7>& t,
9722             ::std::ostream* os) {
9723  PrintTupleTo(t, os);
9724}
9725
9726template <typename T1, typename T2, typename T3, typename T4, typename T5,
9727          typename T6, typename T7, typename T8>
9728void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8>& t,
9729             ::std::ostream* os) {
9730  PrintTupleTo(t, os);
9731}
9732
9733template <typename T1, typename T2, typename T3, typename T4, typename T5,
9734          typename T6, typename T7, typename T8, typename T9>
9735void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>& t,
9736             ::std::ostream* os) {
9737  PrintTupleTo(t, os);
9738}
9739
9740template <typename T1, typename T2, typename T3, typename T4, typename T5,
9741          typename T6, typename T7, typename T8, typename T9, typename T10>
9742void PrintTo(
9743    const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& t,
9744    ::std::ostream* os) {
9745  PrintTupleTo(t, os);
9746}
9747#endif  // GTEST_HAS_TR1_TUPLE
9748
9749// Overload for std::pair.
9750template <typename T1, typename T2>
9751void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
9752  *os << '(';
9753  // We cannot use UniversalPrint(value.first, os) here, as T1 may be
9754  // a reference type.  The same for printing value.second.
9755  UniversalPrinter<T1>::Print(value.first, os);
9756  *os << ", ";
9757  UniversalPrinter<T2>::Print(value.second, os);
9758  *os << ')';
9759}
9760
9761// Implements printing a non-reference type T by letting the compiler
9762// pick the right overload of PrintTo() for T.
9763template <typename T>
9764class UniversalPrinter {
9765 public:
9766  // MSVC warns about adding const to a function type, so we want to
9767  // disable the warning.
9768#ifdef _MSC_VER
9769# pragma warning(push)          // Saves the current warning state.
9770# pragma warning(disable:4180)  // Temporarily disables warning 4180.
9771#endif  // _MSC_VER
9772
9773  // Note: we deliberately don't call this PrintTo(), as that name
9774  // conflicts with ::testing::internal::PrintTo in the body of the
9775  // function.
9776  static void Print(const T& value, ::std::ostream* os) {
9777    // By default, ::testing::internal::PrintTo() is used for printing
9778    // the value.
9779    //
9780    // Thanks to Koenig look-up, if T is a class and has its own
9781    // PrintTo() function defined in its namespace, that function will
9782    // be visible here.  Since it is more specific than the generic ones
9783    // in ::testing::internal, it will be picked by the compiler in the
9784    // following statement - exactly what we want.
9785    PrintTo(value, os);
9786  }
9787
9788#ifdef _MSC_VER
9789# pragma warning(pop)           // Restores the warning state.
9790#endif  // _MSC_VER
9791};
9792
9793// UniversalPrintArray(begin, len, os) prints an array of 'len'
9794// elements, starting at address 'begin'.
9795template <typename T>
9796void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
9797  if (len == 0) {
9798    *os << "{}";
9799  } else {
9800    *os << "{ ";
9801    const size_t kThreshold = 18;
9802    const size_t kChunkSize = 8;
9803    // If the array has more than kThreshold elements, we'll have to
9804    // omit some details by printing only the first and the last
9805    // kChunkSize elements.
9806    // TODO(wan@google.com): let the user control the threshold using a flag.
9807    if (len <= kThreshold) {
9808      PrintRawArrayTo(begin, len, os);
9809    } else {
9810      PrintRawArrayTo(begin, kChunkSize, os);
9811      *os << ", ..., ";
9812      PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
9813    }
9814    *os << " }";
9815  }
9816}
9817// This overload prints a (const) char array compactly.
9818GTEST_API_ void UniversalPrintArray(const char* begin,
9819                                    size_t len,
9820                                    ::std::ostream* os);
9821
9822// Implements printing an array type T[N].
9823template <typename T, size_t N>
9824class UniversalPrinter<T[N]> {
9825 public:
9826  // Prints the given array, omitting some elements when there are too
9827  // many.
9828  static void Print(const T (&a)[N], ::std::ostream* os) {
9829    UniversalPrintArray(a, N, os);
9830  }
9831};
9832
9833// Implements printing a reference type T&.
9834template <typename T>
9835class UniversalPrinter<T&> {
9836 public:
9837  // MSVC warns about adding const to a function type, so we want to
9838  // disable the warning.
9839#ifdef _MSC_VER
9840# pragma warning(push)          // Saves the current warning state.
9841# pragma warning(disable:4180)  // Temporarily disables warning 4180.
9842#endif  // _MSC_VER
9843
9844  static void Print(const T& value, ::std::ostream* os) {
9845    // Prints the address of the value.  We use reinterpret_cast here
9846    // as static_cast doesn't compile when T is a function type.
9847    *os << "@" << reinterpret_cast<const void*>(&value) << " ";
9848
9849    // Then prints the value itself.
9850    UniversalPrint(value, os);
9851  }
9852
9853#ifdef _MSC_VER
9854# pragma warning(pop)           // Restores the warning state.
9855#endif  // _MSC_VER
9856};
9857
9858// Prints a value tersely: for a reference type, the referenced value
9859// (but not the address) is printed; for a (const) char pointer, the
9860// NUL-terminated string (but not the pointer) is printed.
9861template <typename T>
9862void UniversalTersePrint(const T& value, ::std::ostream* os) {
9863  UniversalPrint(value, os);
9864}
9865inline void UniversalTersePrint(const char* str, ::std::ostream* os) {
9866  if (str == NULL) {
9867    *os << "NULL";
9868  } else {
9869    UniversalPrint(string(str), os);
9870  }
9871}
9872inline void UniversalTersePrint(char* str, ::std::ostream* os) {
9873  UniversalTersePrint(static_cast<const char*>(str), os);
9874}
9875
9876// Prints a value using the type inferred by the compiler.  The
9877// difference between this and UniversalTersePrint() is that for a
9878// (const) char pointer, this prints both the pointer and the
9879// NUL-terminated string.
9880template <typename T>
9881void UniversalPrint(const T& value, ::std::ostream* os) {
9882  UniversalPrinter<T>::Print(value, os);
9883}
9884
9885#if GTEST_HAS_TR1_TUPLE
9886typedef ::std::vector<string> Strings;
9887
9888// This helper template allows PrintTo() for tuples and
9889// UniversalTersePrintTupleFieldsToStrings() to be defined by
9890// induction on the number of tuple fields.  The idea is that
9891// TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N
9892// fields in tuple t, and can be defined in terms of
9893// TuplePrefixPrinter<N - 1>.
9894
9895// The inductive case.
9896template <size_t N>
9897struct TuplePrefixPrinter {
9898  // Prints the first N fields of a tuple.
9899  template <typename Tuple>
9900  static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
9901    TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os);
9902    *os << ", ";
9903    UniversalPrinter<typename ::std::tr1::tuple_element<N - 1, Tuple>::type>
9904        ::Print(::std::tr1::get<N - 1>(t), os);
9905  }
9906
9907  // Tersely prints the first N fields of a tuple to a string vector,
9908  // one element for each field.
9909  template <typename Tuple>
9910  static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
9911    TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings);
9912    ::std::stringstream ss;
9913    UniversalTersePrint(::std::tr1::get<N - 1>(t), &ss);
9914    strings->push_back(ss.str());
9915  }
9916};
9917
9918// Base cases.
9919template <>
9920struct TuplePrefixPrinter<0> {
9921  template <typename Tuple>
9922  static void PrintPrefixTo(const Tuple&, ::std::ostream*) {}
9923
9924  template <typename Tuple>
9925  static void TersePrintPrefixToStrings(const Tuple&, Strings*) {}
9926};
9927// We have to specialize the entire TuplePrefixPrinter<> class
9928// template here, even though the definition of
9929// TersePrintPrefixToStrings() is the same as the generic version, as
9930// Embarcadero (formerly CodeGear, formerly Borland) C++ doesn't
9931// support specializing a method template of a class template.
9932template <>
9933struct TuplePrefixPrinter<1> {
9934  template <typename Tuple>
9935  static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
9936    UniversalPrinter<typename ::std::tr1::tuple_element<0, Tuple>::type>::
9937        Print(::std::tr1::get<0>(t), os);
9938  }
9939
9940  template <typename Tuple>
9941  static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
9942    ::std::stringstream ss;
9943    UniversalTersePrint(::std::tr1::get<0>(t), &ss);
9944    strings->push_back(ss.str());
9945  }
9946};
9947
9948// Helper function for printing a tuple.  T must be instantiated with
9949// a tuple type.
9950template <typename T>
9951void PrintTupleTo(const T& t, ::std::ostream* os) {
9952  *os << "(";
9953  TuplePrefixPrinter< ::std::tr1::tuple_size<T>::value>::
9954      PrintPrefixTo(t, os);
9955  *os << ")";
9956}
9957
9958// Prints the fields of a tuple tersely to a string vector, one
9959// element for each field.  See the comment before
9960// UniversalTersePrint() for how we define "tersely".
9961template <typename Tuple>
9962Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
9963  Strings result;
9964  TuplePrefixPrinter< ::std::tr1::tuple_size<Tuple>::value>::
9965      TersePrintPrefixToStrings(value, &result);
9966  return result;
9967}
9968#endif  // GTEST_HAS_TR1_TUPLE
9969
9970}  // namespace internal
9971
9972template <typename T>
9973::std::string PrintToString(const T& value) {
9974  ::std::stringstream ss;
9975  internal::UniversalTersePrint(value, &ss);
9976  return ss.str();
9977}
9978
9979}  // namespace testing
9980
9981#endif  // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
9982
9983#if GTEST_HAS_PARAM_TEST
9984
9985namespace testing {
9986namespace internal {
9987
9988// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
9989//
9990// Outputs a message explaining invalid registration of different
9991// fixture class for the same test case. This may happen when
9992// TEST_P macro is used to define two tests with the same name
9993// but in different namespaces.
9994GTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name,
9995                                          const char* file, int line);
9996
9997template <typename> class ParamGeneratorInterface;
9998template <typename> class ParamGenerator;
9999
10000// Interface for iterating over elements provided by an implementation
10001// of ParamGeneratorInterface<T>.
10002template <typename T>
10003class ParamIteratorInterface {
10004 public:
10005  virtual ~ParamIteratorInterface() {}
10006  // A pointer to the base generator instance.
10007  // Used only for the purposes of iterator comparison
10008  // to make sure that two iterators belong to the same generator.
10009  virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;
10010  // Advances iterator to point to the next element
10011  // provided by the generator. The caller is responsible
10012  // for not calling Advance() on an iterator equal to
10013  // BaseGenerator()->End().
10014  virtual void Advance() = 0;
10015  // Clones the iterator object. Used for implementing copy semantics
10016  // of ParamIterator<T>.
10017  virtual ParamIteratorInterface* Clone() const = 0;
10018  // Dereferences the current iterator and provides (read-only) access
10019  // to the pointed value. It is the caller's responsibility not to call
10020  // Current() on an iterator equal to BaseGenerator()->End().
10021  // Used for implementing ParamGenerator<T>::operator*().
10022  virtual const T* Current() const = 0;
10023  // Determines whether the given iterator and other point to the same
10024  // element in the sequence generated by the generator.
10025  // Used for implementing ParamGenerator<T>::operator==().
10026  virtual bool Equals(const ParamIteratorInterface& other) const = 0;
10027};
10028
10029// Class iterating over elements provided by an implementation of
10030// ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>
10031// and implements the const forward iterator concept.
10032template <typename T>
10033class ParamIterator {
10034 public:
10035  typedef T value_type;
10036  typedef const T& reference;
10037  typedef ptrdiff_t difference_type;
10038
10039  // ParamIterator assumes ownership of the impl_ pointer.
10040  ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
10041  ParamIterator& operator=(const ParamIterator& other) {
10042    if (this != &other)
10043      impl_.reset(other.impl_->Clone());
10044    return *this;
10045  }
10046
10047  const T& operator*() const { return *impl_->Current(); }
10048  const T* operator->() const { return impl_->Current(); }
10049  // Prefix version of operator++.
10050  ParamIterator& operator++() {
10051    impl_->Advance();
10052    return *this;
10053  }
10054  // Postfix version of operator++.
10055  ParamIterator operator++(int /*unused*/) {
10056    ParamIteratorInterface<T>* clone = impl_->Clone();
10057    impl_->Advance();
10058    return ParamIterator(clone);
10059  }
10060  bool operator==(const ParamIterator& other) const {
10061    return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
10062  }
10063  bool operator!=(const ParamIterator& other) const {
10064    return !(*this == other);
10065  }
10066
10067 private:
10068  friend class ParamGenerator<T>;
10069  explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
10070  scoped_ptr<ParamIteratorInterface<T> > impl_;
10071};
10072
10073// ParamGeneratorInterface<T> is the binary interface to access generators
10074// defined in other translation units.
10075template <typename T>
10076class ParamGeneratorInterface {
10077 public:
10078  typedef T ParamType;
10079
10080  virtual ~ParamGeneratorInterface() {}
10081
10082  // Generator interface definition
10083  virtual ParamIteratorInterface<T>* Begin() const = 0;
10084  virtual ParamIteratorInterface<T>* End() const = 0;
10085};
10086
10087// Wraps ParamGeneratorInterface<T> and provides general generator syntax
10088// compatible with the STL Container concept.
10089// This class implements copy initialization semantics and the contained
10090// ParamGeneratorInterface<T> instance is shared among all copies
10091// of the original object. This is possible because that instance is immutable.
10092template<typename T>
10093class ParamGenerator {
10094 public:
10095  typedef ParamIterator<T> iterator;
10096
10097  explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}
10098  ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}
10099
10100  ParamGenerator& operator=(const ParamGenerator& other) {
10101    impl_ = other.impl_;
10102    return *this;
10103  }
10104
10105  iterator begin() const { return iterator(impl_->Begin()); }
10106  iterator end() const { return iterator(impl_->End()); }
10107
10108 private:
10109  linked_ptr<const ParamGeneratorInterface<T> > impl_;
10110};
10111
10112// Generates values from a range of two comparable values. Can be used to
10113// generate sequences of user-defined types that implement operator+() and
10114// operator<().
10115// This class is used in the Range() function.
10116template <typename T, typename IncrementT>
10117class RangeGenerator : public ParamGeneratorInterface<T> {
10118 public:
10119  RangeGenerator(T begin, T end, IncrementT step)
10120      : begin_(begin), end_(end),
10121        step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
10122  virtual ~RangeGenerator() {}
10123
10124  virtual ParamIteratorInterface<T>* Begin() const {
10125    return new Iterator(this, begin_, 0, step_);
10126  }
10127  virtual ParamIteratorInterface<T>* End() const {
10128    return new Iterator(this, end_, end_index_, step_);
10129  }
10130
10131 private:
10132  class Iterator : public ParamIteratorInterface<T> {
10133   public:
10134    Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
10135             IncrementT step)
10136        : base_(base), value_(value), index_(index), step_(step) {}
10137    virtual ~Iterator() {}
10138
10139    virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
10140      return base_;
10141    }
10142    virtual void Advance() {
10143      value_ = value_ + step_;
10144      index_++;
10145    }
10146    virtual ParamIteratorInterface<T>* Clone() const {
10147      return new Iterator(*this);
10148    }
10149    virtual const T* Current() const { return &value_; }
10150    virtual bool Equals(const ParamIteratorInterface<T>& other) const {
10151      // Having the same base generator guarantees that the other
10152      // iterator is of the same type and we can downcast.
10153      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
10154          << "The program attempted to compare iterators "
10155          << "from different generators." << std::endl;
10156      const int other_index =
10157          CheckedDowncastToActualType<const Iterator>(&other)->index_;
10158      return index_ == other_index;
10159    }
10160
10161   private:
10162    Iterator(const Iterator& other)
10163        : ParamIteratorInterface<T>(),
10164          base_(other.base_), value_(other.value_), index_(other.index_),
10165          step_(other.step_) {}
10166
10167    // No implementation - assignment is unsupported.
10168    void operator=(const Iterator& other);
10169
10170    const ParamGeneratorInterface<T>* const base_;
10171    T value_;
10172    int index_;
10173    const IncrementT step_;
10174  };  // class RangeGenerator::Iterator
10175
10176  static int CalculateEndIndex(const T& begin,
10177                               const T& end,
10178                               const IncrementT& step) {
10179    int end_index = 0;
10180    for (T i = begin; i < end; i = i + step)
10181      end_index++;
10182    return end_index;
10183  }
10184
10185  // No implementation - assignment is unsupported.
10186  void operator=(const RangeGenerator& other);
10187
10188  const T begin_;
10189  const T end_;
10190  const IncrementT step_;
10191  // The index for the end() iterator. All the elements in the generated
10192  // sequence are indexed (0-based) to aid iterator comparison.
10193  const int end_index_;
10194};  // class RangeGenerator
10195
10196
10197// Generates values from a pair of STL-style iterators. Used in the
10198// ValuesIn() function. The elements are copied from the source range
10199// since the source can be located on the stack, and the generator
10200// is likely to persist beyond that stack frame.
10201template <typename T>
10202class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
10203 public:
10204  template <typename ForwardIterator>
10205  ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
10206      : container_(begin, end) {}
10207  virtual ~ValuesInIteratorRangeGenerator() {}
10208
10209  virtual ParamIteratorInterface<T>* Begin() const {
10210    return new Iterator(this, container_.begin());
10211  }
10212  virtual ParamIteratorInterface<T>* End() const {
10213    return new Iterator(this, container_.end());
10214  }
10215
10216 private:
10217  typedef typename ::std::vector<T> ContainerType;
10218
10219  class Iterator : public ParamIteratorInterface<T> {
10220   public:
10221    Iterator(const ParamGeneratorInterface<T>* base,
10222             typename ContainerType::const_iterator iterator)
10223        : base_(base), iterator_(iterator) {}
10224    virtual ~Iterator() {}
10225
10226    virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
10227      return base_;
10228    }
10229    virtual void Advance() {
10230      ++iterator_;
10231      value_.reset();
10232    }
10233    virtual ParamIteratorInterface<T>* Clone() const {
10234      return new Iterator(*this);
10235    }
10236    // We need to use cached value referenced by iterator_ because *iterator_
10237    // can return a temporary object (and of type other then T), so just
10238    // having "return &*iterator_;" doesn't work.
10239    // value_ is updated here and not in Advance() because Advance()
10240    // can advance iterator_ beyond the end of the range, and we cannot
10241    // detect that fact. The client code, on the other hand, is
10242    // responsible for not calling Current() on an out-of-range iterator.
10243    virtual const T* Current() const {
10244      if (value_.get() == NULL)
10245        value_.reset(new T(*iterator_));
10246      return value_.get();
10247    }
10248    virtual bool Equals(const ParamIteratorInterface<T>& other) const {
10249      // Having the same base generator guarantees that the other
10250      // iterator is of the same type and we can downcast.
10251      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
10252          << "The program attempted to compare iterators "
10253          << "from different generators." << std::endl;
10254      return iterator_ ==
10255          CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
10256    }
10257
10258   private:
10259    Iterator(const Iterator& other)
10260          // The explicit constructor call suppresses a false warning
10261          // emitted by gcc when supplied with the -Wextra option.
10262        : ParamIteratorInterface<T>(),
10263          base_(other.base_),
10264          iterator_(other.iterator_) {}
10265
10266    const ParamGeneratorInterface<T>* const base_;
10267    typename ContainerType::const_iterator iterator_;
10268    // A cached value of *iterator_. We keep it here to allow access by
10269    // pointer in the wrapping iterator's operator->().
10270    // value_ needs to be mutable to be accessed in Current().
10271    // Use of scoped_ptr helps manage cached value's lifetime,
10272    // which is bound by the lifespan of the iterator itself.
10273    mutable scoped_ptr<const T> value_;
10274  };  // class ValuesInIteratorRangeGenerator::Iterator
10275
10276  // No implementation - assignment is unsupported.
10277  void operator=(const ValuesInIteratorRangeGenerator& other);
10278
10279  const ContainerType container_;
10280};  // class ValuesInIteratorRangeGenerator
10281
10282// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10283//
10284// Stores a parameter value and later creates tests parameterized with that
10285// value.
10286template <class TestClass>
10287class ParameterizedTestFactory : public TestFactoryBase {
10288 public:
10289  typedef typename TestClass::ParamType ParamType;
10290  explicit ParameterizedTestFactory(ParamType parameter) :
10291      parameter_(parameter) {}
10292  virtual Test* CreateTest() {
10293    TestClass::SetParam(&parameter_);
10294    return new TestClass();
10295  }
10296
10297 private:
10298  const ParamType parameter_;
10299
10300  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
10301};
10302
10303// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10304//
10305// TestMetaFactoryBase is a base class for meta-factories that create
10306// test factories for passing into MakeAndRegisterTestInfo function.
10307template <class ParamType>
10308class TestMetaFactoryBase {
10309 public:
10310  virtual ~TestMetaFactoryBase() {}
10311
10312  virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
10313};
10314
10315// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10316//
10317// TestMetaFactory creates test factories for passing into
10318// MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives
10319// ownership of test factory pointer, same factory object cannot be passed
10320// into that method twice. But ParameterizedTestCaseInfo is going to call
10321// it for each Test/Parameter value combination. Thus it needs meta factory
10322// creator class.
10323template <class TestCase>
10324class TestMetaFactory
10325    : public TestMetaFactoryBase<typename TestCase::ParamType> {
10326 public:
10327  typedef typename TestCase::ParamType ParamType;
10328
10329  TestMetaFactory() {}
10330
10331  virtual TestFactoryBase* CreateTestFactory(ParamType parameter) {
10332    return new ParameterizedTestFactory<TestCase>(parameter);
10333  }
10334
10335 private:
10336  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
10337};
10338
10339// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10340//
10341// ParameterizedTestCaseInfoBase is a generic interface
10342// to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase
10343// accumulates test information provided by TEST_P macro invocations
10344// and generators provided by INSTANTIATE_TEST_CASE_P macro invocations
10345// and uses that information to register all resulting test instances
10346// in RegisterTests method. The ParameterizeTestCaseRegistry class holds
10347// a collection of pointers to the ParameterizedTestCaseInfo objects
10348// and calls RegisterTests() on each of them when asked.
10349class ParameterizedTestCaseInfoBase {
10350 public:
10351  virtual ~ParameterizedTestCaseInfoBase() {}
10352
10353  // Base part of test case name for display purposes.
10354  virtual const string& GetTestCaseName() const = 0;
10355  // Test case id to verify identity.
10356  virtual TypeId GetTestCaseTypeId() const = 0;
10357  // UnitTest class invokes this method to register tests in this
10358  // test case right before running them in RUN_ALL_TESTS macro.
10359  // This method should not be called more then once on any single
10360  // instance of a ParameterizedTestCaseInfoBase derived class.
10361  virtual void RegisterTests() = 0;
10362
10363 protected:
10364  ParameterizedTestCaseInfoBase() {}
10365
10366 private:
10367  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase);
10368};
10369
10370// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10371//
10372// ParameterizedTestCaseInfo accumulates tests obtained from TEST_P
10373// macro invocations for a particular test case and generators
10374// obtained from INSTANTIATE_TEST_CASE_P macro invocations for that
10375// test case. It registers tests with all values generated by all
10376// generators when asked.
10377template <class TestCase>
10378class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
10379 public:
10380  // ParamType and GeneratorCreationFunc are private types but are required
10381  // for declarations of public methods AddTestPattern() and
10382  // AddTestCaseInstantiation().
10383  typedef typename TestCase::ParamType ParamType;
10384  // A function that returns an instance of appropriate generator type.
10385  typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
10386
10387  explicit ParameterizedTestCaseInfo(const char* name)
10388      : test_case_name_(name) {}
10389
10390  // Test case base name for display purposes.
10391  virtual const string& GetTestCaseName() const { return test_case_name_; }
10392  // Test case id to verify identity.
10393  virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }
10394  // TEST_P macro uses AddTestPattern() to record information
10395  // about a single test in a LocalTestInfo structure.
10396  // test_case_name is the base name of the test case (without invocation
10397  // prefix). test_base_name is the name of an individual test without
10398  // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
10399  // test case base name and DoBar is test base name.
10400  void AddTestPattern(const char* test_case_name,
10401                      const char* test_base_name,
10402                      TestMetaFactoryBase<ParamType>* meta_factory) {
10403    tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name,
10404                                                       test_base_name,
10405                                                       meta_factory)));
10406  }
10407  // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information
10408  // about a generator.
10409  int AddTestCaseInstantiation(const string& instantiation_name,
10410                               GeneratorCreationFunc* func,
10411                               const char* /* file */,
10412                               int /* line */) {
10413    instantiations_.push_back(::std::make_pair(instantiation_name, func));
10414    return 0;  // Return value used only to run this method in namespace scope.
10415  }
10416  // UnitTest class invokes this method to register tests in this test case
10417  // test cases right before running tests in RUN_ALL_TESTS macro.
10418  // This method should not be called more then once on any single
10419  // instance of a ParameterizedTestCaseInfoBase derived class.
10420  // UnitTest has a guard to prevent from calling this method more then once.
10421  virtual void RegisterTests() {
10422    for (typename TestInfoContainer::iterator test_it = tests_.begin();
10423         test_it != tests_.end(); ++test_it) {
10424      linked_ptr<TestInfo> test_info = *test_it;
10425      for (typename InstantiationContainer::iterator gen_it =
10426               instantiations_.begin(); gen_it != instantiations_.end();
10427               ++gen_it) {
10428        const string& instantiation_name = gen_it->first;
10429        ParamGenerator<ParamType> generator((*gen_it->second)());
10430
10431        Message test_case_name_stream;
10432        if ( !instantiation_name.empty() )
10433          test_case_name_stream << instantiation_name << "/";
10434        test_case_name_stream << test_info->test_case_base_name;
10435
10436        int i = 0;
10437        for (typename ParamGenerator<ParamType>::iterator param_it =
10438                 generator.begin();
10439             param_it != generator.end(); ++param_it, ++i) {
10440          Message test_name_stream;
10441          test_name_stream << test_info->test_base_name << "/" << i;
10442          MakeAndRegisterTestInfo(
10443              test_case_name_stream.GetString().c_str(),
10444              test_name_stream.GetString().c_str(),
10445              NULL,  // No type parameter.
10446              PrintToString(*param_it).c_str(),
10447              GetTestCaseTypeId(),
10448              TestCase::SetUpTestCase,
10449              TestCase::TearDownTestCase,
10450              test_info->test_meta_factory->CreateTestFactory(*param_it));
10451        }  // for param_it
10452      }  // for gen_it
10453    }  // for test_it
10454  }  // RegisterTests
10455
10456 private:
10457  // LocalTestInfo structure keeps information about a single test registered
10458  // with TEST_P macro.
10459  struct TestInfo {
10460    TestInfo(const char* a_test_case_base_name,
10461             const char* a_test_base_name,
10462             TestMetaFactoryBase<ParamType>* a_test_meta_factory) :
10463        test_case_base_name(a_test_case_base_name),
10464        test_base_name(a_test_base_name),
10465        test_meta_factory(a_test_meta_factory) {}
10466
10467    const string test_case_base_name;
10468    const string test_base_name;
10469    const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
10470  };
10471  typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;
10472  // Keeps pairs of <Instantiation name, Sequence generator creation function>
10473  // received from INSTANTIATE_TEST_CASE_P macros.
10474  typedef ::std::vector<std::pair<string, GeneratorCreationFunc*> >
10475      InstantiationContainer;
10476
10477  const string test_case_name_;
10478  TestInfoContainer tests_;
10479  InstantiationContainer instantiations_;
10480
10481  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo);
10482};  // class ParameterizedTestCaseInfo
10483
10484// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
10485//
10486// ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase
10487// classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P
10488// macros use it to locate their corresponding ParameterizedTestCaseInfo
10489// descriptors.
10490class ParameterizedTestCaseRegistry {
10491 public:
10492  ParameterizedTestCaseRegistry() {}
10493  ~ParameterizedTestCaseRegistry() {
10494    for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
10495         it != test_case_infos_.end(); ++it) {
10496      delete *it;
10497    }
10498  }
10499
10500  // Looks up or creates and returns a structure containing information about
10501  // tests and instantiations of a particular test case.
10502  template <class TestCase>
10503  ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(
10504      const char* test_case_name,
10505      const char* file,
10506      int line) {
10507    ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL;
10508    for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
10509         it != test_case_infos_.end(); ++it) {
10510      if ((*it)->GetTestCaseName() == test_case_name) {
10511        if ((*it)->GetTestCaseTypeId() != GetTypeId<TestCase>()) {
10512          // Complain about incorrect usage of Google Test facilities
10513          // and terminate the program since we cannot guaranty correct
10514          // test case setup and tear-down in this case.
10515          ReportInvalidTestCaseType(test_case_name,  file, line);
10516          posix::Abort();
10517        } else {
10518          // At this point we are sure that the object we found is of the same
10519          // type we are looking for, so we downcast it to that type
10520          // without further checks.
10521          typed_test_info = CheckedDowncastToActualType<
10522              ParameterizedTestCaseInfo<TestCase> >(*it);
10523        }
10524        break;
10525      }
10526    }
10527    if (typed_test_info == NULL) {
10528      typed_test_info = new ParameterizedTestCaseInfo<TestCase>(test_case_name);
10529      test_case_infos_.push_back(typed_test_info);
10530    }
10531    return typed_test_info;
10532  }
10533  void RegisterTests() {
10534    for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
10535         it != test_case_infos_.end(); ++it) {
10536      (*it)->RegisterTests();
10537    }
10538  }
10539
10540 private:
10541  typedef ::std::vector<ParameterizedTestCaseInfoBase*> TestCaseInfoContainer;
10542
10543  TestCaseInfoContainer test_case_infos_;
10544
10545  GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry);
10546};
10547
10548}  // namespace internal
10549}  // namespace testing
10550
10551#endif  //  GTEST_HAS_PARAM_TEST
10552
10553#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
10554// This file was GENERATED by command:
10555//     pump.py gtest-param-util-generated.h.pump
10556// DO NOT EDIT BY HAND!!!
10557
10558// Copyright 2008 Google Inc.
10559// All Rights Reserved.
10560//
10561// Redistribution and use in source and binary forms, with or without
10562// modification, are permitted provided that the following conditions are
10563// met:
10564//
10565//     * Redistributions of source code must retain the above copyright
10566// notice, this list of conditions and the following disclaimer.
10567//     * Redistributions in binary form must reproduce the above
10568// copyright notice, this list of conditions and the following disclaimer
10569// in the documentation and/or other materials provided with the
10570// distribution.
10571//     * Neither the name of Google Inc. nor the names of its
10572// contributors may be used to endorse or promote products derived from
10573// this software without specific prior written permission.
10574//
10575// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
10576// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
10577// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
10578// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
10579// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10580// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10581// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10582// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
10583// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
10584// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
10585// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10586//
10587// Author: vladl@google.com (Vlad Losev)
10588
10589// Type and function utilities for implementing parameterized tests.
10590// This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
10591//
10592// Currently Google Test supports at most 50 arguments in Values,
10593// and at most 10 arguments in Combine. Please contact
10594// googletestframework@googlegroups.com if you need more.
10595// Please note that the number of arguments to Combine is limited
10596// by the maximum arity of the implementation of tr1::tuple which is
10597// currently set at 10.
10598
10599#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
10600#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
10601
10602// scripts/fuse_gtest.py depends on gtest's own header being #included
10603// *unconditionally*.  Therefore these #includes cannot be moved
10604// inside #if GTEST_HAS_PARAM_TEST.
10605
10606#if GTEST_HAS_PARAM_TEST
10607
10608namespace testing {
10609
10610// Forward declarations of ValuesIn(), which is implemented in
10611// include/gtest/gtest-param-test.h.
10612template <typename ForwardIterator>
10613internal::ParamGenerator<
10614  typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
10615ValuesIn(ForwardIterator begin, ForwardIterator end);
10616
10617template <typename T, size_t N>
10618internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
10619
10620template <class Container>
10621internal::ParamGenerator<typename Container::value_type> ValuesIn(
10622    const Container& container);
10623
10624namespace internal {
10625
10626// Used in the Values() function to provide polymorphic capabilities.
10627template <typename T1>
10628class ValueArray1 {
10629 public:
10630  explicit ValueArray1(T1 v1) : v1_(v1) {}
10631
10632  template <typename T>
10633  operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }
10634
10635 private:
10636  // No implementation - assignment is unsupported.
10637  void operator=(const ValueArray1& other);
10638
10639  const T1 v1_;
10640};
10641
10642template <typename T1, typename T2>
10643class ValueArray2 {
10644 public:
10645  ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {}
10646
10647  template <typename T>
10648  operator ParamGenerator<T>() const {
10649    const T array[] = {v1_, v2_};
10650    return ValuesIn(array);
10651  }
10652
10653 private:
10654  // No implementation - assignment is unsupported.
10655  void operator=(const ValueArray2& other);
10656
10657  const T1 v1_;
10658  const T2 v2_;
10659};
10660
10661template <typename T1, typename T2, typename T3>
10662class ValueArray3 {
10663 public:
10664  ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {}
10665
10666  template <typename T>
10667  operator ParamGenerator<T>() const {
10668    const T array[] = {v1_, v2_, v3_};
10669    return ValuesIn(array);
10670  }
10671
10672 private:
10673  // No implementation - assignment is unsupported.
10674  void operator=(const ValueArray3& other);
10675
10676  const T1 v1_;
10677  const T2 v2_;
10678  const T3 v3_;
10679};
10680
10681template <typename T1, typename T2, typename T3, typename T4>
10682class ValueArray4 {
10683 public:
10684  ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3),
10685      v4_(v4) {}
10686
10687  template <typename T>
10688  operator ParamGenerator<T>() const {
10689    const T array[] = {v1_, v2_, v3_, v4_};
10690    return ValuesIn(array);
10691  }
10692
10693 private:
10694  // No implementation - assignment is unsupported.
10695  void operator=(const ValueArray4& other);
10696
10697  const T1 v1_;
10698  const T2 v2_;
10699  const T3 v3_;
10700  const T4 v4_;
10701};
10702
10703template <typename T1, typename T2, typename T3, typename T4, typename T5>
10704class ValueArray5 {
10705 public:
10706  ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3),
10707      v4_(v4), v5_(v5) {}
10708
10709  template <typename T>
10710  operator ParamGenerator<T>() const {
10711    const T array[] = {v1_, v2_, v3_, v4_, v5_};
10712    return ValuesIn(array);
10713  }
10714
10715 private:
10716  // No implementation - assignment is unsupported.
10717  void operator=(const ValueArray5& other);
10718
10719  const T1 v1_;
10720  const T2 v2_;
10721  const T3 v3_;
10722  const T4 v4_;
10723  const T5 v5_;
10724};
10725
10726template <typename T1, typename T2, typename T3, typename T4, typename T5,
10727    typename T6>
10728class ValueArray6 {
10729 public:
10730  ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2),
10731      v3_(v3), v4_(v4), v5_(v5), v6_(v6) {}
10732
10733  template <typename T>
10734  operator ParamGenerator<T>() const {
10735    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_};
10736    return ValuesIn(array);
10737  }
10738
10739 private:
10740  // No implementation - assignment is unsupported.
10741  void operator=(const ValueArray6& other);
10742
10743  const T1 v1_;
10744  const T2 v2_;
10745  const T3 v3_;
10746  const T4 v4_;
10747  const T5 v5_;
10748  const T6 v6_;
10749};
10750
10751template <typename T1, typename T2, typename T3, typename T4, typename T5,
10752    typename T6, typename T7>
10753class ValueArray7 {
10754 public:
10755  ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1),
10756      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {}
10757
10758  template <typename T>
10759  operator ParamGenerator<T>() const {
10760    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_};
10761    return ValuesIn(array);
10762  }
10763
10764 private:
10765  // No implementation - assignment is unsupported.
10766  void operator=(const ValueArray7& other);
10767
10768  const T1 v1_;
10769  const T2 v2_;
10770  const T3 v3_;
10771  const T4 v4_;
10772  const T5 v5_;
10773  const T6 v6_;
10774  const T7 v7_;
10775};
10776
10777template <typename T1, typename T2, typename T3, typename T4, typename T5,
10778    typename T6, typename T7, typename T8>
10779class ValueArray8 {
10780 public:
10781  ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
10782      T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
10783      v8_(v8) {}
10784
10785  template <typename T>
10786  operator ParamGenerator<T>() const {
10787    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_};
10788    return ValuesIn(array);
10789  }
10790
10791 private:
10792  // No implementation - assignment is unsupported.
10793  void operator=(const ValueArray8& other);
10794
10795  const T1 v1_;
10796  const T2 v2_;
10797  const T3 v3_;
10798  const T4 v4_;
10799  const T5 v5_;
10800  const T6 v6_;
10801  const T7 v7_;
10802  const T8 v8_;
10803};
10804
10805template <typename T1, typename T2, typename T3, typename T4, typename T5,
10806    typename T6, typename T7, typename T8, typename T9>
10807class ValueArray9 {
10808 public:
10809  ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
10810      T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
10811      v8_(v8), v9_(v9) {}
10812
10813  template <typename T>
10814  operator ParamGenerator<T>() const {
10815    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_};
10816    return ValuesIn(array);
10817  }
10818
10819 private:
10820  // No implementation - assignment is unsupported.
10821  void operator=(const ValueArray9& other);
10822
10823  const T1 v1_;
10824  const T2 v2_;
10825  const T3 v3_;
10826  const T4 v4_;
10827  const T5 v5_;
10828  const T6 v6_;
10829  const T7 v7_;
10830  const T8 v8_;
10831  const T9 v9_;
10832};
10833
10834template <typename T1, typename T2, typename T3, typename T4, typename T5,
10835    typename T6, typename T7, typename T8, typename T9, typename T10>
10836class ValueArray10 {
10837 public:
10838  ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
10839      T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
10840      v8_(v8), v9_(v9), v10_(v10) {}
10841
10842  template <typename T>
10843  operator ParamGenerator<T>() const {
10844    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_};
10845    return ValuesIn(array);
10846  }
10847
10848 private:
10849  // No implementation - assignment is unsupported.
10850  void operator=(const ValueArray10& other);
10851
10852  const T1 v1_;
10853  const T2 v2_;
10854  const T3 v3_;
10855  const T4 v4_;
10856  const T5 v5_;
10857  const T6 v6_;
10858  const T7 v7_;
10859  const T8 v8_;
10860  const T9 v9_;
10861  const T10 v10_;
10862};
10863
10864template <typename T1, typename T2, typename T3, typename T4, typename T5,
10865    typename T6, typename T7, typename T8, typename T9, typename T10,
10866    typename T11>
10867class ValueArray11 {
10868 public:
10869  ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
10870      T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
10871      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {}
10872
10873  template <typename T>
10874  operator ParamGenerator<T>() const {
10875    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_};
10876    return ValuesIn(array);
10877  }
10878
10879 private:
10880  // No implementation - assignment is unsupported.
10881  void operator=(const ValueArray11& other);
10882
10883  const T1 v1_;
10884  const T2 v2_;
10885  const T3 v3_;
10886  const T4 v4_;
10887  const T5 v5_;
10888  const T6 v6_;
10889  const T7 v7_;
10890  const T8 v8_;
10891  const T9 v9_;
10892  const T10 v10_;
10893  const T11 v11_;
10894};
10895
10896template <typename T1, typename T2, typename T3, typename T4, typename T5,
10897    typename T6, typename T7, typename T8, typename T9, typename T10,
10898    typename T11, typename T12>
10899class ValueArray12 {
10900 public:
10901  ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
10902      T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
10903      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {}
10904
10905  template <typename T>
10906  operator ParamGenerator<T>() const {
10907    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
10908        v12_};
10909    return ValuesIn(array);
10910  }
10911
10912 private:
10913  // No implementation - assignment is unsupported.
10914  void operator=(const ValueArray12& other);
10915
10916  const T1 v1_;
10917  const T2 v2_;
10918  const T3 v3_;
10919  const T4 v4_;
10920  const T5 v5_;
10921  const T6 v6_;
10922  const T7 v7_;
10923  const T8 v8_;
10924  const T9 v9_;
10925  const T10 v10_;
10926  const T11 v11_;
10927  const T12 v12_;
10928};
10929
10930template <typename T1, typename T2, typename T3, typename T4, typename T5,
10931    typename T6, typename T7, typename T8, typename T9, typename T10,
10932    typename T11, typename T12, typename T13>
10933class ValueArray13 {
10934 public:
10935  ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
10936      T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
10937      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
10938      v12_(v12), v13_(v13) {}
10939
10940  template <typename T>
10941  operator ParamGenerator<T>() const {
10942    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
10943        v12_, v13_};
10944    return ValuesIn(array);
10945  }
10946
10947 private:
10948  // No implementation - assignment is unsupported.
10949  void operator=(const ValueArray13& other);
10950
10951  const T1 v1_;
10952  const T2 v2_;
10953  const T3 v3_;
10954  const T4 v4_;
10955  const T5 v5_;
10956  const T6 v6_;
10957  const T7 v7_;
10958  const T8 v8_;
10959  const T9 v9_;
10960  const T10 v10_;
10961  const T11 v11_;
10962  const T12 v12_;
10963  const T13 v13_;
10964};
10965
10966template <typename T1, typename T2, typename T3, typename T4, typename T5,
10967    typename T6, typename T7, typename T8, typename T9, typename T10,
10968    typename T11, typename T12, typename T13, typename T14>
10969class ValueArray14 {
10970 public:
10971  ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
10972      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3),
10973      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
10974      v11_(v11), v12_(v12), v13_(v13), v14_(v14) {}
10975
10976  template <typename T>
10977  operator ParamGenerator<T>() const {
10978    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
10979        v12_, v13_, v14_};
10980    return ValuesIn(array);
10981  }
10982
10983 private:
10984  // No implementation - assignment is unsupported.
10985  void operator=(const ValueArray14& other);
10986
10987  const T1 v1_;
10988  const T2 v2_;
10989  const T3 v3_;
10990  const T4 v4_;
10991  const T5 v5_;
10992  const T6 v6_;
10993  const T7 v7_;
10994  const T8 v8_;
10995  const T9 v9_;
10996  const T10 v10_;
10997  const T11 v11_;
10998  const T12 v12_;
10999  const T13 v13_;
11000  const T14 v14_;
11001};
11002
11003template <typename T1, typename T2, typename T3, typename T4, typename T5,
11004    typename T6, typename T7, typename T8, typename T9, typename T10,
11005    typename T11, typename T12, typename T13, typename T14, typename T15>
11006class ValueArray15 {
11007 public:
11008  ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11009      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2),
11010      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
11011      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {}
11012
11013  template <typename T>
11014  operator ParamGenerator<T>() const {
11015    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11016        v12_, v13_, v14_, v15_};
11017    return ValuesIn(array);
11018  }
11019
11020 private:
11021  // No implementation - assignment is unsupported.
11022  void operator=(const ValueArray15& other);
11023
11024  const T1 v1_;
11025  const T2 v2_;
11026  const T3 v3_;
11027  const T4 v4_;
11028  const T5 v5_;
11029  const T6 v6_;
11030  const T7 v7_;
11031  const T8 v8_;
11032  const T9 v9_;
11033  const T10 v10_;
11034  const T11 v11_;
11035  const T12 v12_;
11036  const T13 v13_;
11037  const T14 v14_;
11038  const T15 v15_;
11039};
11040
11041template <typename T1, typename T2, typename T3, typename T4, typename T5,
11042    typename T6, typename T7, typename T8, typename T9, typename T10,
11043    typename T11, typename T12, typename T13, typename T14, typename T15,
11044    typename T16>
11045class ValueArray16 {
11046 public:
11047  ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11048      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1),
11049      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
11050      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
11051      v16_(v16) {}
11052
11053  template <typename T>
11054  operator ParamGenerator<T>() const {
11055    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11056        v12_, v13_, v14_, v15_, v16_};
11057    return ValuesIn(array);
11058  }
11059
11060 private:
11061  // No implementation - assignment is unsupported.
11062  void operator=(const ValueArray16& other);
11063
11064  const T1 v1_;
11065  const T2 v2_;
11066  const T3 v3_;
11067  const T4 v4_;
11068  const T5 v5_;
11069  const T6 v6_;
11070  const T7 v7_;
11071  const T8 v8_;
11072  const T9 v9_;
11073  const T10 v10_;
11074  const T11 v11_;
11075  const T12 v12_;
11076  const T13 v13_;
11077  const T14 v14_;
11078  const T15 v15_;
11079  const T16 v16_;
11080};
11081
11082template <typename T1, typename T2, typename T3, typename T4, typename T5,
11083    typename T6, typename T7, typename T8, typename T9, typename T10,
11084    typename T11, typename T12, typename T13, typename T14, typename T15,
11085    typename T16, typename T17>
11086class ValueArray17 {
11087 public:
11088  ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11089      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
11090      T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
11091      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
11092      v15_(v15), v16_(v16), v17_(v17) {}
11093
11094  template <typename T>
11095  operator ParamGenerator<T>() const {
11096    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11097        v12_, v13_, v14_, v15_, v16_, v17_};
11098    return ValuesIn(array);
11099  }
11100
11101 private:
11102  // No implementation - assignment is unsupported.
11103  void operator=(const ValueArray17& other);
11104
11105  const T1 v1_;
11106  const T2 v2_;
11107  const T3 v3_;
11108  const T4 v4_;
11109  const T5 v5_;
11110  const T6 v6_;
11111  const T7 v7_;
11112  const T8 v8_;
11113  const T9 v9_;
11114  const T10 v10_;
11115  const T11 v11_;
11116  const T12 v12_;
11117  const T13 v13_;
11118  const T14 v14_;
11119  const T15 v15_;
11120  const T16 v16_;
11121  const T17 v17_;
11122};
11123
11124template <typename T1, typename T2, typename T3, typename T4, typename T5,
11125    typename T6, typename T7, typename T8, typename T9, typename T10,
11126    typename T11, typename T12, typename T13, typename T14, typename T15,
11127    typename T16, typename T17, typename T18>
11128class ValueArray18 {
11129 public:
11130  ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11131      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11132      T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
11133      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
11134      v15_(v15), v16_(v16), v17_(v17), v18_(v18) {}
11135
11136  template <typename T>
11137  operator ParamGenerator<T>() const {
11138    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11139        v12_, v13_, v14_, v15_, v16_, v17_, v18_};
11140    return ValuesIn(array);
11141  }
11142
11143 private:
11144  // No implementation - assignment is unsupported.
11145  void operator=(const ValueArray18& other);
11146
11147  const T1 v1_;
11148  const T2 v2_;
11149  const T3 v3_;
11150  const T4 v4_;
11151  const T5 v5_;
11152  const T6 v6_;
11153  const T7 v7_;
11154  const T8 v8_;
11155  const T9 v9_;
11156  const T10 v10_;
11157  const T11 v11_;
11158  const T12 v12_;
11159  const T13 v13_;
11160  const T14 v14_;
11161  const T15 v15_;
11162  const T16 v16_;
11163  const T17 v17_;
11164  const T18 v18_;
11165};
11166
11167template <typename T1, typename T2, typename T3, typename T4, typename T5,
11168    typename T6, typename T7, typename T8, typename T9, typename T10,
11169    typename T11, typename T12, typename T13, typename T14, typename T15,
11170    typename T16, typename T17, typename T18, typename T19>
11171class ValueArray19 {
11172 public:
11173  ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11174      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11175      T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
11176      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
11177      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {}
11178
11179  template <typename T>
11180  operator ParamGenerator<T>() const {
11181    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11182        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_};
11183    return ValuesIn(array);
11184  }
11185
11186 private:
11187  // No implementation - assignment is unsupported.
11188  void operator=(const ValueArray19& other);
11189
11190  const T1 v1_;
11191  const T2 v2_;
11192  const T3 v3_;
11193  const T4 v4_;
11194  const T5 v5_;
11195  const T6 v6_;
11196  const T7 v7_;
11197  const T8 v8_;
11198  const T9 v9_;
11199  const T10 v10_;
11200  const T11 v11_;
11201  const T12 v12_;
11202  const T13 v13_;
11203  const T14 v14_;
11204  const T15 v15_;
11205  const T16 v16_;
11206  const T17 v17_;
11207  const T18 v18_;
11208  const T19 v19_;
11209};
11210
11211template <typename T1, typename T2, typename T3, typename T4, typename T5,
11212    typename T6, typename T7, typename T8, typename T9, typename T10,
11213    typename T11, typename T12, typename T13, typename T14, typename T15,
11214    typename T16, typename T17, typename T18, typename T19, typename T20>
11215class ValueArray20 {
11216 public:
11217  ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11218      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11219      T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
11220      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
11221      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
11222      v19_(v19), v20_(v20) {}
11223
11224  template <typename T>
11225  operator ParamGenerator<T>() const {
11226    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11227        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_};
11228    return ValuesIn(array);
11229  }
11230
11231 private:
11232  // No implementation - assignment is unsupported.
11233  void operator=(const ValueArray20& other);
11234
11235  const T1 v1_;
11236  const T2 v2_;
11237  const T3 v3_;
11238  const T4 v4_;
11239  const T5 v5_;
11240  const T6 v6_;
11241  const T7 v7_;
11242  const T8 v8_;
11243  const T9 v9_;
11244  const T10 v10_;
11245  const T11 v11_;
11246  const T12 v12_;
11247  const T13 v13_;
11248  const T14 v14_;
11249  const T15 v15_;
11250  const T16 v16_;
11251  const T17 v17_;
11252  const T18 v18_;
11253  const T19 v19_;
11254  const T20 v20_;
11255};
11256
11257template <typename T1, typename T2, typename T3, typename T4, typename T5,
11258    typename T6, typename T7, typename T8, typename T9, typename T10,
11259    typename T11, typename T12, typename T13, typename T14, typename T15,
11260    typename T16, typename T17, typename T18, typename T19, typename T20,
11261    typename T21>
11262class ValueArray21 {
11263 public:
11264  ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11265      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11266      T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
11267      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
11268      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
11269      v18_(v18), v19_(v19), v20_(v20), v21_(v21) {}
11270
11271  template <typename T>
11272  operator ParamGenerator<T>() const {
11273    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11274        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_};
11275    return ValuesIn(array);
11276  }
11277
11278 private:
11279  // No implementation - assignment is unsupported.
11280  void operator=(const ValueArray21& other);
11281
11282  const T1 v1_;
11283  const T2 v2_;
11284  const T3 v3_;
11285  const T4 v4_;
11286  const T5 v5_;
11287  const T6 v6_;
11288  const T7 v7_;
11289  const T8 v8_;
11290  const T9 v9_;
11291  const T10 v10_;
11292  const T11 v11_;
11293  const T12 v12_;
11294  const T13 v13_;
11295  const T14 v14_;
11296  const T15 v15_;
11297  const T16 v16_;
11298  const T17 v17_;
11299  const T18 v18_;
11300  const T19 v19_;
11301  const T20 v20_;
11302  const T21 v21_;
11303};
11304
11305template <typename T1, typename T2, typename T3, typename T4, typename T5,
11306    typename T6, typename T7, typename T8, typename T9, typename T10,
11307    typename T11, typename T12, typename T13, typename T14, typename T15,
11308    typename T16, typename T17, typename T18, typename T19, typename T20,
11309    typename T21, typename T22>
11310class ValueArray22 {
11311 public:
11312  ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11313      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11314      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3),
11315      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
11316      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
11317      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {}
11318
11319  template <typename T>
11320  operator ParamGenerator<T>() const {
11321    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11322        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_};
11323    return ValuesIn(array);
11324  }
11325
11326 private:
11327  // No implementation - assignment is unsupported.
11328  void operator=(const ValueArray22& other);
11329
11330  const T1 v1_;
11331  const T2 v2_;
11332  const T3 v3_;
11333  const T4 v4_;
11334  const T5 v5_;
11335  const T6 v6_;
11336  const T7 v7_;
11337  const T8 v8_;
11338  const T9 v9_;
11339  const T10 v10_;
11340  const T11 v11_;
11341  const T12 v12_;
11342  const T13 v13_;
11343  const T14 v14_;
11344  const T15 v15_;
11345  const T16 v16_;
11346  const T17 v17_;
11347  const T18 v18_;
11348  const T19 v19_;
11349  const T20 v20_;
11350  const T21 v21_;
11351  const T22 v22_;
11352};
11353
11354template <typename T1, typename T2, typename T3, typename T4, typename T5,
11355    typename T6, typename T7, typename T8, typename T9, typename T10,
11356    typename T11, typename T12, typename T13, typename T14, typename T15,
11357    typename T16, typename T17, typename T18, typename T19, typename T20,
11358    typename T21, typename T22, typename T23>
11359class ValueArray23 {
11360 public:
11361  ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11362      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11363      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2),
11364      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
11365      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
11366      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
11367      v23_(v23) {}
11368
11369  template <typename T>
11370  operator ParamGenerator<T>() const {
11371    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11372        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_,
11373        v23_};
11374    return ValuesIn(array);
11375  }
11376
11377 private:
11378  // No implementation - assignment is unsupported.
11379  void operator=(const ValueArray23& other);
11380
11381  const T1 v1_;
11382  const T2 v2_;
11383  const T3 v3_;
11384  const T4 v4_;
11385  const T5 v5_;
11386  const T6 v6_;
11387  const T7 v7_;
11388  const T8 v8_;
11389  const T9 v9_;
11390  const T10 v10_;
11391  const T11 v11_;
11392  const T12 v12_;
11393  const T13 v13_;
11394  const T14 v14_;
11395  const T15 v15_;
11396  const T16 v16_;
11397  const T17 v17_;
11398  const T18 v18_;
11399  const T19 v19_;
11400  const T20 v20_;
11401  const T21 v21_;
11402  const T22 v22_;
11403  const T23 v23_;
11404};
11405
11406template <typename T1, typename T2, typename T3, typename T4, typename T5,
11407    typename T6, typename T7, typename T8, typename T9, typename T10,
11408    typename T11, typename T12, typename T13, typename T14, typename T15,
11409    typename T16, typename T17, typename T18, typename T19, typename T20,
11410    typename T21, typename T22, typename T23, typename T24>
11411class ValueArray24 {
11412 public:
11413  ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11414      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11415      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1),
11416      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
11417      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
11418      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
11419      v22_(v22), v23_(v23), v24_(v24) {}
11420
11421  template <typename T>
11422  operator ParamGenerator<T>() const {
11423    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11424        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
11425        v24_};
11426    return ValuesIn(array);
11427  }
11428
11429 private:
11430  // No implementation - assignment is unsupported.
11431  void operator=(const ValueArray24& other);
11432
11433  const T1 v1_;
11434  const T2 v2_;
11435  const T3 v3_;
11436  const T4 v4_;
11437  const T5 v5_;
11438  const T6 v6_;
11439  const T7 v7_;
11440  const T8 v8_;
11441  const T9 v9_;
11442  const T10 v10_;
11443  const T11 v11_;
11444  const T12 v12_;
11445  const T13 v13_;
11446  const T14 v14_;
11447  const T15 v15_;
11448  const T16 v16_;
11449  const T17 v17_;
11450  const T18 v18_;
11451  const T19 v19_;
11452  const T20 v20_;
11453  const T21 v21_;
11454  const T22 v22_;
11455  const T23 v23_;
11456  const T24 v24_;
11457};
11458
11459template <typename T1, typename T2, typename T3, typename T4, typename T5,
11460    typename T6, typename T7, typename T8, typename T9, typename T10,
11461    typename T11, typename T12, typename T13, typename T14, typename T15,
11462    typename T16, typename T17, typename T18, typename T19, typename T20,
11463    typename T21, typename T22, typename T23, typename T24, typename T25>
11464class ValueArray25 {
11465 public:
11466  ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11467      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11468      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
11469      T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
11470      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
11471      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
11472      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {}
11473
11474  template <typename T>
11475  operator ParamGenerator<T>() const {
11476    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11477        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
11478        v24_, v25_};
11479    return ValuesIn(array);
11480  }
11481
11482 private:
11483  // No implementation - assignment is unsupported.
11484  void operator=(const ValueArray25& other);
11485
11486  const T1 v1_;
11487  const T2 v2_;
11488  const T3 v3_;
11489  const T4 v4_;
11490  const T5 v5_;
11491  const T6 v6_;
11492  const T7 v7_;
11493  const T8 v8_;
11494  const T9 v9_;
11495  const T10 v10_;
11496  const T11 v11_;
11497  const T12 v12_;
11498  const T13 v13_;
11499  const T14 v14_;
11500  const T15 v15_;
11501  const T16 v16_;
11502  const T17 v17_;
11503  const T18 v18_;
11504  const T19 v19_;
11505  const T20 v20_;
11506  const T21 v21_;
11507  const T22 v22_;
11508  const T23 v23_;
11509  const T24 v24_;
11510  const T25 v25_;
11511};
11512
11513template <typename T1, typename T2, typename T3, typename T4, typename T5,
11514    typename T6, typename T7, typename T8, typename T9, typename T10,
11515    typename T11, typename T12, typename T13, typename T14, typename T15,
11516    typename T16, typename T17, typename T18, typename T19, typename T20,
11517    typename T21, typename T22, typename T23, typename T24, typename T25,
11518    typename T26>
11519class ValueArray26 {
11520 public:
11521  ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11522      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11523      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
11524      T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
11525      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
11526      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
11527      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {}
11528
11529  template <typename T>
11530  operator ParamGenerator<T>() const {
11531    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11532        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
11533        v24_, v25_, v26_};
11534    return ValuesIn(array);
11535  }
11536
11537 private:
11538  // No implementation - assignment is unsupported.
11539  void operator=(const ValueArray26& other);
11540
11541  const T1 v1_;
11542  const T2 v2_;
11543  const T3 v3_;
11544  const T4 v4_;
11545  const T5 v5_;
11546  const T6 v6_;
11547  const T7 v7_;
11548  const T8 v8_;
11549  const T9 v9_;
11550  const T10 v10_;
11551  const T11 v11_;
11552  const T12 v12_;
11553  const T13 v13_;
11554  const T14 v14_;
11555  const T15 v15_;
11556  const T16 v16_;
11557  const T17 v17_;
11558  const T18 v18_;
11559  const T19 v19_;
11560  const T20 v20_;
11561  const T21 v21_;
11562  const T22 v22_;
11563  const T23 v23_;
11564  const T24 v24_;
11565  const T25 v25_;
11566  const T26 v26_;
11567};
11568
11569template <typename T1, typename T2, typename T3, typename T4, typename T5,
11570    typename T6, typename T7, typename T8, typename T9, typename T10,
11571    typename T11, typename T12, typename T13, typename T14, typename T15,
11572    typename T16, typename T17, typename T18, typename T19, typename T20,
11573    typename T21, typename T22, typename T23, typename T24, typename T25,
11574    typename T26, typename T27>
11575class ValueArray27 {
11576 public:
11577  ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11578      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11579      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
11580      T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
11581      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
11582      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
11583      v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
11584      v26_(v26), v27_(v27) {}
11585
11586  template <typename T>
11587  operator ParamGenerator<T>() const {
11588    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11589        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
11590        v24_, v25_, v26_, v27_};
11591    return ValuesIn(array);
11592  }
11593
11594 private:
11595  // No implementation - assignment is unsupported.
11596  void operator=(const ValueArray27& other);
11597
11598  const T1 v1_;
11599  const T2 v2_;
11600  const T3 v3_;
11601  const T4 v4_;
11602  const T5 v5_;
11603  const T6 v6_;
11604  const T7 v7_;
11605  const T8 v8_;
11606  const T9 v9_;
11607  const T10 v10_;
11608  const T11 v11_;
11609  const T12 v12_;
11610  const T13 v13_;
11611  const T14 v14_;
11612  const T15 v15_;
11613  const T16 v16_;
11614  const T17 v17_;
11615  const T18 v18_;
11616  const T19 v19_;
11617  const T20 v20_;
11618  const T21 v21_;
11619  const T22 v22_;
11620  const T23 v23_;
11621  const T24 v24_;
11622  const T25 v25_;
11623  const T26 v26_;
11624  const T27 v27_;
11625};
11626
11627template <typename T1, typename T2, typename T3, typename T4, typename T5,
11628    typename T6, typename T7, typename T8, typename T9, typename T10,
11629    typename T11, typename T12, typename T13, typename T14, typename T15,
11630    typename T16, typename T17, typename T18, typename T19, typename T20,
11631    typename T21, typename T22, typename T23, typename T24, typename T25,
11632    typename T26, typename T27, typename T28>
11633class ValueArray28 {
11634 public:
11635  ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11636      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11637      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
11638      T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
11639      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
11640      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
11641      v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
11642      v25_(v25), v26_(v26), v27_(v27), v28_(v28) {}
11643
11644  template <typename T>
11645  operator ParamGenerator<T>() const {
11646    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11647        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
11648        v24_, v25_, v26_, v27_, v28_};
11649    return ValuesIn(array);
11650  }
11651
11652 private:
11653  // No implementation - assignment is unsupported.
11654  void operator=(const ValueArray28& other);
11655
11656  const T1 v1_;
11657  const T2 v2_;
11658  const T3 v3_;
11659  const T4 v4_;
11660  const T5 v5_;
11661  const T6 v6_;
11662  const T7 v7_;
11663  const T8 v8_;
11664  const T9 v9_;
11665  const T10 v10_;
11666  const T11 v11_;
11667  const T12 v12_;
11668  const T13 v13_;
11669  const T14 v14_;
11670  const T15 v15_;
11671  const T16 v16_;
11672  const T17 v17_;
11673  const T18 v18_;
11674  const T19 v19_;
11675  const T20 v20_;
11676  const T21 v21_;
11677  const T22 v22_;
11678  const T23 v23_;
11679  const T24 v24_;
11680  const T25 v25_;
11681  const T26 v26_;
11682  const T27 v27_;
11683  const T28 v28_;
11684};
11685
11686template <typename T1, typename T2, typename T3, typename T4, typename T5,
11687    typename T6, typename T7, typename T8, typename T9, typename T10,
11688    typename T11, typename T12, typename T13, typename T14, typename T15,
11689    typename T16, typename T17, typename T18, typename T19, typename T20,
11690    typename T21, typename T22, typename T23, typename T24, typename T25,
11691    typename T26, typename T27, typename T28, typename T29>
11692class ValueArray29 {
11693 public:
11694  ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11695      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11696      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
11697      T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
11698      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
11699      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
11700      v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
11701      v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {}
11702
11703  template <typename T>
11704  operator ParamGenerator<T>() const {
11705    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11706        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
11707        v24_, v25_, v26_, v27_, v28_, v29_};
11708    return ValuesIn(array);
11709  }
11710
11711 private:
11712  // No implementation - assignment is unsupported.
11713  void operator=(const ValueArray29& other);
11714
11715  const T1 v1_;
11716  const T2 v2_;
11717  const T3 v3_;
11718  const T4 v4_;
11719  const T5 v5_;
11720  const T6 v6_;
11721  const T7 v7_;
11722  const T8 v8_;
11723  const T9 v9_;
11724  const T10 v10_;
11725  const T11 v11_;
11726  const T12 v12_;
11727  const T13 v13_;
11728  const T14 v14_;
11729  const T15 v15_;
11730  const T16 v16_;
11731  const T17 v17_;
11732  const T18 v18_;
11733  const T19 v19_;
11734  const T20 v20_;
11735  const T21 v21_;
11736  const T22 v22_;
11737  const T23 v23_;
11738  const T24 v24_;
11739  const T25 v25_;
11740  const T26 v26_;
11741  const T27 v27_;
11742  const T28 v28_;
11743  const T29 v29_;
11744};
11745
11746template <typename T1, typename T2, typename T3, typename T4, typename T5,
11747    typename T6, typename T7, typename T8, typename T9, typename T10,
11748    typename T11, typename T12, typename T13, typename T14, typename T15,
11749    typename T16, typename T17, typename T18, typename T19, typename T20,
11750    typename T21, typename T22, typename T23, typename T24, typename T25,
11751    typename T26, typename T27, typename T28, typename T29, typename T30>
11752class ValueArray30 {
11753 public:
11754  ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11755      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11756      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
11757      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3),
11758      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
11759      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
11760      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
11761      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
11762      v29_(v29), v30_(v30) {}
11763
11764  template <typename T>
11765  operator ParamGenerator<T>() const {
11766    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11767        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
11768        v24_, v25_, v26_, v27_, v28_, v29_, v30_};
11769    return ValuesIn(array);
11770  }
11771
11772 private:
11773  // No implementation - assignment is unsupported.
11774  void operator=(const ValueArray30& other);
11775
11776  const T1 v1_;
11777  const T2 v2_;
11778  const T3 v3_;
11779  const T4 v4_;
11780  const T5 v5_;
11781  const T6 v6_;
11782  const T7 v7_;
11783  const T8 v8_;
11784  const T9 v9_;
11785  const T10 v10_;
11786  const T11 v11_;
11787  const T12 v12_;
11788  const T13 v13_;
11789  const T14 v14_;
11790  const T15 v15_;
11791  const T16 v16_;
11792  const T17 v17_;
11793  const T18 v18_;
11794  const T19 v19_;
11795  const T20 v20_;
11796  const T21 v21_;
11797  const T22 v22_;
11798  const T23 v23_;
11799  const T24 v24_;
11800  const T25 v25_;
11801  const T26 v26_;
11802  const T27 v27_;
11803  const T28 v28_;
11804  const T29 v29_;
11805  const T30 v30_;
11806};
11807
11808template <typename T1, typename T2, typename T3, typename T4, typename T5,
11809    typename T6, typename T7, typename T8, typename T9, typename T10,
11810    typename T11, typename T12, typename T13, typename T14, typename T15,
11811    typename T16, typename T17, typename T18, typename T19, typename T20,
11812    typename T21, typename T22, typename T23, typename T24, typename T25,
11813    typename T26, typename T27, typename T28, typename T29, typename T30,
11814    typename T31>
11815class ValueArray31 {
11816 public:
11817  ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11818      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11819      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
11820      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2),
11821      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
11822      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
11823      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
11824      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
11825      v29_(v29), v30_(v30), v31_(v31) {}
11826
11827  template <typename T>
11828  operator ParamGenerator<T>() const {
11829    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11830        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
11831        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_};
11832    return ValuesIn(array);
11833  }
11834
11835 private:
11836  // No implementation - assignment is unsupported.
11837  void operator=(const ValueArray31& other);
11838
11839  const T1 v1_;
11840  const T2 v2_;
11841  const T3 v3_;
11842  const T4 v4_;
11843  const T5 v5_;
11844  const T6 v6_;
11845  const T7 v7_;
11846  const T8 v8_;
11847  const T9 v9_;
11848  const T10 v10_;
11849  const T11 v11_;
11850  const T12 v12_;
11851  const T13 v13_;
11852  const T14 v14_;
11853  const T15 v15_;
11854  const T16 v16_;
11855  const T17 v17_;
11856  const T18 v18_;
11857  const T19 v19_;
11858  const T20 v20_;
11859  const T21 v21_;
11860  const T22 v22_;
11861  const T23 v23_;
11862  const T24 v24_;
11863  const T25 v25_;
11864  const T26 v26_;
11865  const T27 v27_;
11866  const T28 v28_;
11867  const T29 v29_;
11868  const T30 v30_;
11869  const T31 v31_;
11870};
11871
11872template <typename T1, typename T2, typename T3, typename T4, typename T5,
11873    typename T6, typename T7, typename T8, typename T9, typename T10,
11874    typename T11, typename T12, typename T13, typename T14, typename T15,
11875    typename T16, typename T17, typename T18, typename T19, typename T20,
11876    typename T21, typename T22, typename T23, typename T24, typename T25,
11877    typename T26, typename T27, typename T28, typename T29, typename T30,
11878    typename T31, typename T32>
11879class ValueArray32 {
11880 public:
11881  ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11882      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11883      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
11884      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1),
11885      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
11886      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
11887      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
11888      v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
11889      v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {}
11890
11891  template <typename T>
11892  operator ParamGenerator<T>() const {
11893    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11894        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
11895        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_};
11896    return ValuesIn(array);
11897  }
11898
11899 private:
11900  // No implementation - assignment is unsupported.
11901  void operator=(const ValueArray32& other);
11902
11903  const T1 v1_;
11904  const T2 v2_;
11905  const T3 v3_;
11906  const T4 v4_;
11907  const T5 v5_;
11908  const T6 v6_;
11909  const T7 v7_;
11910  const T8 v8_;
11911  const T9 v9_;
11912  const T10 v10_;
11913  const T11 v11_;
11914  const T12 v12_;
11915  const T13 v13_;
11916  const T14 v14_;
11917  const T15 v15_;
11918  const T16 v16_;
11919  const T17 v17_;
11920  const T18 v18_;
11921  const T19 v19_;
11922  const T20 v20_;
11923  const T21 v21_;
11924  const T22 v22_;
11925  const T23 v23_;
11926  const T24 v24_;
11927  const T25 v25_;
11928  const T26 v26_;
11929  const T27 v27_;
11930  const T28 v28_;
11931  const T29 v29_;
11932  const T30 v30_;
11933  const T31 v31_;
11934  const T32 v32_;
11935};
11936
11937template <typename T1, typename T2, typename T3, typename T4, typename T5,
11938    typename T6, typename T7, typename T8, typename T9, typename T10,
11939    typename T11, typename T12, typename T13, typename T14, typename T15,
11940    typename T16, typename T17, typename T18, typename T19, typename T20,
11941    typename T21, typename T22, typename T23, typename T24, typename T25,
11942    typename T26, typename T27, typename T28, typename T29, typename T30,
11943    typename T31, typename T32, typename T33>
11944class ValueArray33 {
11945 public:
11946  ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
11947      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
11948      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
11949      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
11950      T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
11951      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
11952      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
11953      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
11954      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
11955      v33_(v33) {}
11956
11957  template <typename T>
11958  operator ParamGenerator<T>() const {
11959    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
11960        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
11961        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_};
11962    return ValuesIn(array);
11963  }
11964
11965 private:
11966  // No implementation - assignment is unsupported.
11967  void operator=(const ValueArray33& other);
11968
11969  const T1 v1_;
11970  const T2 v2_;
11971  const T3 v3_;
11972  const T4 v4_;
11973  const T5 v5_;
11974  const T6 v6_;
11975  const T7 v7_;
11976  const T8 v8_;
11977  const T9 v9_;
11978  const T10 v10_;
11979  const T11 v11_;
11980  const T12 v12_;
11981  const T13 v13_;
11982  const T14 v14_;
11983  const T15 v15_;
11984  const T16 v16_;
11985  const T17 v17_;
11986  const T18 v18_;
11987  const T19 v19_;
11988  const T20 v20_;
11989  const T21 v21_;
11990  const T22 v22_;
11991  const T23 v23_;
11992  const T24 v24_;
11993  const T25 v25_;
11994  const T26 v26_;
11995  const T27 v27_;
11996  const T28 v28_;
11997  const T29 v29_;
11998  const T30 v30_;
11999  const T31 v31_;
12000  const T32 v32_;
12001  const T33 v33_;
12002};
12003
12004template <typename T1, typename T2, typename T3, typename T4, typename T5,
12005    typename T6, typename T7, typename T8, typename T9, typename T10,
12006    typename T11, typename T12, typename T13, typename T14, typename T15,
12007    typename T16, typename T17, typename T18, typename T19, typename T20,
12008    typename T21, typename T22, typename T23, typename T24, typename T25,
12009    typename T26, typename T27, typename T28, typename T29, typename T30,
12010    typename T31, typename T32, typename T33, typename T34>
12011class ValueArray34 {
12012 public:
12013  ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12014      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12015      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12016      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12017      T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12018      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12019      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
12020      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
12021      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
12022      v33_(v33), v34_(v34) {}
12023
12024  template <typename T>
12025  operator ParamGenerator<T>() const {
12026    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
12027        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
12028        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_};
12029    return ValuesIn(array);
12030  }
12031
12032 private:
12033  // No implementation - assignment is unsupported.
12034  void operator=(const ValueArray34& other);
12035
12036  const T1 v1_;
12037  const T2 v2_;
12038  const T3 v3_;
12039  const T4 v4_;
12040  const T5 v5_;
12041  const T6 v6_;
12042  const T7 v7_;
12043  const T8 v8_;
12044  const T9 v9_;
12045  const T10 v10_;
12046  const T11 v11_;
12047  const T12 v12_;
12048  const T13 v13_;
12049  const T14 v14_;
12050  const T15 v15_;
12051  const T16 v16_;
12052  const T17 v17_;
12053  const T18 v18_;
12054  const T19 v19_;
12055  const T20 v20_;
12056  const T21 v21_;
12057  const T22 v22_;
12058  const T23 v23_;
12059  const T24 v24_;
12060  const T25 v25_;
12061  const T26 v26_;
12062  const T27 v27_;
12063  const T28 v28_;
12064  const T29 v29_;
12065  const T30 v30_;
12066  const T31 v31_;
12067  const T32 v32_;
12068  const T33 v33_;
12069  const T34 v34_;
12070};
12071
12072template <typename T1, typename T2, typename T3, typename T4, typename T5,
12073    typename T6, typename T7, typename T8, typename T9, typename T10,
12074    typename T11, typename T12, typename T13, typename T14, typename T15,
12075    typename T16, typename T17, typename T18, typename T19, typename T20,
12076    typename T21, typename T22, typename T23, typename T24, typename T25,
12077    typename T26, typename T27, typename T28, typename T29, typename T30,
12078    typename T31, typename T32, typename T33, typename T34, typename T35>
12079class ValueArray35 {
12080 public:
12081  ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12082      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12083      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12084      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12085      T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
12086      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
12087      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
12088      v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
12089      v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
12090      v32_(v32), v33_(v33), v34_(v34), v35_(v35) {}
12091
12092  template <typename T>
12093  operator ParamGenerator<T>() const {
12094    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
12095        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
12096        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_,
12097        v35_};
12098    return ValuesIn(array);
12099  }
12100
12101 private:
12102  // No implementation - assignment is unsupported.
12103  void operator=(const ValueArray35& other);
12104
12105  const T1 v1_;
12106  const T2 v2_;
12107  const T3 v3_;
12108  const T4 v4_;
12109  const T5 v5_;
12110  const T6 v6_;
12111  const T7 v7_;
12112  const T8 v8_;
12113  const T9 v9_;
12114  const T10 v10_;
12115  const T11 v11_;
12116  const T12 v12_;
12117  const T13 v13_;
12118  const T14 v14_;
12119  const T15 v15_;
12120  const T16 v16_;
12121  const T17 v17_;
12122  const T18 v18_;
12123  const T19 v19_;
12124  const T20 v20_;
12125  const T21 v21_;
12126  const T22 v22_;
12127  const T23 v23_;
12128  const T24 v24_;
12129  const T25 v25_;
12130  const T26 v26_;
12131  const T27 v27_;
12132  const T28 v28_;
12133  const T29 v29_;
12134  const T30 v30_;
12135  const T31 v31_;
12136  const T32 v32_;
12137  const T33 v33_;
12138  const T34 v34_;
12139  const T35 v35_;
12140};
12141
12142template <typename T1, typename T2, typename T3, typename T4, typename T5,
12143    typename T6, typename T7, typename T8, typename T9, typename T10,
12144    typename T11, typename T12, typename T13, typename T14, typename T15,
12145    typename T16, typename T17, typename T18, typename T19, typename T20,
12146    typename T21, typename T22, typename T23, typename T24, typename T25,
12147    typename T26, typename T27, typename T28, typename T29, typename T30,
12148    typename T31, typename T32, typename T33, typename T34, typename T35,
12149    typename T36>
12150class ValueArray36 {
12151 public:
12152  ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12153      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12154      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12155      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12156      T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
12157      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
12158      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
12159      v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
12160      v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
12161      v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {}
12162
12163  template <typename T>
12164  operator ParamGenerator<T>() const {
12165    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
12166        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
12167        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
12168        v36_};
12169    return ValuesIn(array);
12170  }
12171
12172 private:
12173  // No implementation - assignment is unsupported.
12174  void operator=(const ValueArray36& other);
12175
12176  const T1 v1_;
12177  const T2 v2_;
12178  const T3 v3_;
12179  const T4 v4_;
12180  const T5 v5_;
12181  const T6 v6_;
12182  const T7 v7_;
12183  const T8 v8_;
12184  const T9 v9_;
12185  const T10 v10_;
12186  const T11 v11_;
12187  const T12 v12_;
12188  const T13 v13_;
12189  const T14 v14_;
12190  const T15 v15_;
12191  const T16 v16_;
12192  const T17 v17_;
12193  const T18 v18_;
12194  const T19 v19_;
12195  const T20 v20_;
12196  const T21 v21_;
12197  const T22 v22_;
12198  const T23 v23_;
12199  const T24 v24_;
12200  const T25 v25_;
12201  const T26 v26_;
12202  const T27 v27_;
12203  const T28 v28_;
12204  const T29 v29_;
12205  const T30 v30_;
12206  const T31 v31_;
12207  const T32 v32_;
12208  const T33 v33_;
12209  const T34 v34_;
12210  const T35 v35_;
12211  const T36 v36_;
12212};
12213
12214template <typename T1, typename T2, typename T3, typename T4, typename T5,
12215    typename T6, typename T7, typename T8, typename T9, typename T10,
12216    typename T11, typename T12, typename T13, typename T14, typename T15,
12217    typename T16, typename T17, typename T18, typename T19, typename T20,
12218    typename T21, typename T22, typename T23, typename T24, typename T25,
12219    typename T26, typename T27, typename T28, typename T29, typename T30,
12220    typename T31, typename T32, typename T33, typename T34, typename T35,
12221    typename T36, typename T37>
12222class ValueArray37 {
12223 public:
12224  ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12225      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12226      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12227      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12228      T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
12229      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
12230      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
12231      v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
12232      v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
12233      v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
12234      v36_(v36), v37_(v37) {}
12235
12236  template <typename T>
12237  operator ParamGenerator<T>() const {
12238    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
12239        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
12240        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
12241        v36_, v37_};
12242    return ValuesIn(array);
12243  }
12244
12245 private:
12246  // No implementation - assignment is unsupported.
12247  void operator=(const ValueArray37& other);
12248
12249  const T1 v1_;
12250  const T2 v2_;
12251  const T3 v3_;
12252  const T4 v4_;
12253  const T5 v5_;
12254  const T6 v6_;
12255  const T7 v7_;
12256  const T8 v8_;
12257  const T9 v9_;
12258  const T10 v10_;
12259  const T11 v11_;
12260  const T12 v12_;
12261  const T13 v13_;
12262  const T14 v14_;
12263  const T15 v15_;
12264  const T16 v16_;
12265  const T17 v17_;
12266  const T18 v18_;
12267  const T19 v19_;
12268  const T20 v20_;
12269  const T21 v21_;
12270  const T22 v22_;
12271  const T23 v23_;
12272  const T24 v24_;
12273  const T25 v25_;
12274  const T26 v26_;
12275  const T27 v27_;
12276  const T28 v28_;
12277  const T29 v29_;
12278  const T30 v30_;
12279  const T31 v31_;
12280  const T32 v32_;
12281  const T33 v33_;
12282  const T34 v34_;
12283  const T35 v35_;
12284  const T36 v36_;
12285  const T37 v37_;
12286};
12287
12288template <typename T1, typename T2, typename T3, typename T4, typename T5,
12289    typename T6, typename T7, typename T8, typename T9, typename T10,
12290    typename T11, typename T12, typename T13, typename T14, typename T15,
12291    typename T16, typename T17, typename T18, typename T19, typename T20,
12292    typename T21, typename T22, typename T23, typename T24, typename T25,
12293    typename T26, typename T27, typename T28, typename T29, typename T30,
12294    typename T31, typename T32, typename T33, typename T34, typename T35,
12295    typename T36, typename T37, typename T38>
12296class ValueArray38 {
12297 public:
12298  ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12299      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12300      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12301      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12302      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3),
12303      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12304      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
12305      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
12306      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
12307      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
12308      v35_(v35), v36_(v36), v37_(v37), v38_(v38) {}
12309
12310  template <typename T>
12311  operator ParamGenerator<T>() const {
12312    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
12313        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
12314        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
12315        v36_, v37_, v38_};
12316    return ValuesIn(array);
12317  }
12318
12319 private:
12320  // No implementation - assignment is unsupported.
12321  void operator=(const ValueArray38& other);
12322
12323  const T1 v1_;
12324  const T2 v2_;
12325  const T3 v3_;
12326  const T4 v4_;
12327  const T5 v5_;
12328  const T6 v6_;
12329  const T7 v7_;
12330  const T8 v8_;
12331  const T9 v9_;
12332  const T10 v10_;
12333  const T11 v11_;
12334  const T12 v12_;
12335  const T13 v13_;
12336  const T14 v14_;
12337  const T15 v15_;
12338  const T16 v16_;
12339  const T17 v17_;
12340  const T18 v18_;
12341  const T19 v19_;
12342  const T20 v20_;
12343  const T21 v21_;
12344  const T22 v22_;
12345  const T23 v23_;
12346  const T24 v24_;
12347  const T25 v25_;
12348  const T26 v26_;
12349  const T27 v27_;
12350  const T28 v28_;
12351  const T29 v29_;
12352  const T30 v30_;
12353  const T31 v31_;
12354  const T32 v32_;
12355  const T33 v33_;
12356  const T34 v34_;
12357  const T35 v35_;
12358  const T36 v36_;
12359  const T37 v37_;
12360  const T38 v38_;
12361};
12362
12363template <typename T1, typename T2, typename T3, typename T4, typename T5,
12364    typename T6, typename T7, typename T8, typename T9, typename T10,
12365    typename T11, typename T12, typename T13, typename T14, typename T15,
12366    typename T16, typename T17, typename T18, typename T19, typename T20,
12367    typename T21, typename T22, typename T23, typename T24, typename T25,
12368    typename T26, typename T27, typename T28, typename T29, typename T30,
12369    typename T31, typename T32, typename T33, typename T34, typename T35,
12370    typename T36, typename T37, typename T38, typename T39>
12371class ValueArray39 {
12372 public:
12373  ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12374      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12375      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12376      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12377      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2),
12378      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12379      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
12380      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
12381      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
12382      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
12383      v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {}
12384
12385  template <typename T>
12386  operator ParamGenerator<T>() const {
12387    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
12388        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
12389        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
12390        v36_, v37_, v38_, v39_};
12391    return ValuesIn(array);
12392  }
12393
12394 private:
12395  // No implementation - assignment is unsupported.
12396  void operator=(const ValueArray39& other);
12397
12398  const T1 v1_;
12399  const T2 v2_;
12400  const T3 v3_;
12401  const T4 v4_;
12402  const T5 v5_;
12403  const T6 v6_;
12404  const T7 v7_;
12405  const T8 v8_;
12406  const T9 v9_;
12407  const T10 v10_;
12408  const T11 v11_;
12409  const T12 v12_;
12410  const T13 v13_;
12411  const T14 v14_;
12412  const T15 v15_;
12413  const T16 v16_;
12414  const T17 v17_;
12415  const T18 v18_;
12416  const T19 v19_;
12417  const T20 v20_;
12418  const T21 v21_;
12419  const T22 v22_;
12420  const T23 v23_;
12421  const T24 v24_;
12422  const T25 v25_;
12423  const T26 v26_;
12424  const T27 v27_;
12425  const T28 v28_;
12426  const T29 v29_;
12427  const T30 v30_;
12428  const T31 v31_;
12429  const T32 v32_;
12430  const T33 v33_;
12431  const T34 v34_;
12432  const T35 v35_;
12433  const T36 v36_;
12434  const T37 v37_;
12435  const T38 v38_;
12436  const T39 v39_;
12437};
12438
12439template <typename T1, typename T2, typename T3, typename T4, typename T5,
12440    typename T6, typename T7, typename T8, typename T9, typename T10,
12441    typename T11, typename T12, typename T13, typename T14, typename T15,
12442    typename T16, typename T17, typename T18, typename T19, typename T20,
12443    typename T21, typename T22, typename T23, typename T24, typename T25,
12444    typename T26, typename T27, typename T28, typename T29, typename T30,
12445    typename T31, typename T32, typename T33, typename T34, typename T35,
12446    typename T36, typename T37, typename T38, typename T39, typename T40>
12447class ValueArray40 {
12448 public:
12449  ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12450      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12451      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12452      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12453      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1),
12454      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
12455      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
12456      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
12457      v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
12458      v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
12459      v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
12460      v40_(v40) {}
12461
12462  template <typename T>
12463  operator ParamGenerator<T>() const {
12464    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
12465        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
12466        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
12467        v36_, v37_, v38_, v39_, v40_};
12468    return ValuesIn(array);
12469  }
12470
12471 private:
12472  // No implementation - assignment is unsupported.
12473  void operator=(const ValueArray40& other);
12474
12475  const T1 v1_;
12476  const T2 v2_;
12477  const T3 v3_;
12478  const T4 v4_;
12479  const T5 v5_;
12480  const T6 v6_;
12481  const T7 v7_;
12482  const T8 v8_;
12483  const T9 v9_;
12484  const T10 v10_;
12485  const T11 v11_;
12486  const T12 v12_;
12487  const T13 v13_;
12488  const T14 v14_;
12489  const T15 v15_;
12490  const T16 v16_;
12491  const T17 v17_;
12492  const T18 v18_;
12493  const T19 v19_;
12494  const T20 v20_;
12495  const T21 v21_;
12496  const T22 v22_;
12497  const T23 v23_;
12498  const T24 v24_;
12499  const T25 v25_;
12500  const T26 v26_;
12501  const T27 v27_;
12502  const T28 v28_;
12503  const T29 v29_;
12504  const T30 v30_;
12505  const T31 v31_;
12506  const T32 v32_;
12507  const T33 v33_;
12508  const T34 v34_;
12509  const T35 v35_;
12510  const T36 v36_;
12511  const T37 v37_;
12512  const T38 v38_;
12513  const T39 v39_;
12514  const T40 v40_;
12515};
12516
12517template <typename T1, typename T2, typename T3, typename T4, typename T5,
12518    typename T6, typename T7, typename T8, typename T9, typename T10,
12519    typename T11, typename T12, typename T13, typename T14, typename T15,
12520    typename T16, typename T17, typename T18, typename T19, typename T20,
12521    typename T21, typename T22, typename T23, typename T24, typename T25,
12522    typename T26, typename T27, typename T28, typename T29, typename T30,
12523    typename T31, typename T32, typename T33, typename T34, typename T35,
12524    typename T36, typename T37, typename T38, typename T39, typename T40,
12525    typename T41>
12526class ValueArray41 {
12527 public:
12528  ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12529      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12530      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12531      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12532      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
12533      T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12534      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12535      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
12536      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
12537      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
12538      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
12539      v39_(v39), v40_(v40), v41_(v41) {}
12540
12541  template <typename T>
12542  operator ParamGenerator<T>() const {
12543    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
12544        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
12545        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
12546        v36_, v37_, v38_, v39_, v40_, v41_};
12547    return ValuesIn(array);
12548  }
12549
12550 private:
12551  // No implementation - assignment is unsupported.
12552  void operator=(const ValueArray41& other);
12553
12554  const T1 v1_;
12555  const T2 v2_;
12556  const T3 v3_;
12557  const T4 v4_;
12558  const T5 v5_;
12559  const T6 v6_;
12560  const T7 v7_;
12561  const T8 v8_;
12562  const T9 v9_;
12563  const T10 v10_;
12564  const T11 v11_;
12565  const T12 v12_;
12566  const T13 v13_;
12567  const T14 v14_;
12568  const T15 v15_;
12569  const T16 v16_;
12570  const T17 v17_;
12571  const T18 v18_;
12572  const T19 v19_;
12573  const T20 v20_;
12574  const T21 v21_;
12575  const T22 v22_;
12576  const T23 v23_;
12577  const T24 v24_;
12578  const T25 v25_;
12579  const T26 v26_;
12580  const T27 v27_;
12581  const T28 v28_;
12582  const T29 v29_;
12583  const T30 v30_;
12584  const T31 v31_;
12585  const T32 v32_;
12586  const T33 v33_;
12587  const T34 v34_;
12588  const T35 v35_;
12589  const T36 v36_;
12590  const T37 v37_;
12591  const T38 v38_;
12592  const T39 v39_;
12593  const T40 v40_;
12594  const T41 v41_;
12595};
12596
12597template <typename T1, typename T2, typename T3, typename T4, typename T5,
12598    typename T6, typename T7, typename T8, typename T9, typename T10,
12599    typename T11, typename T12, typename T13, typename T14, typename T15,
12600    typename T16, typename T17, typename T18, typename T19, typename T20,
12601    typename T21, typename T22, typename T23, typename T24, typename T25,
12602    typename T26, typename T27, typename T28, typename T29, typename T30,
12603    typename T31, typename T32, typename T33, typename T34, typename T35,
12604    typename T36, typename T37, typename T38, typename T39, typename T40,
12605    typename T41, typename T42>
12606class ValueArray42 {
12607 public:
12608  ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12609      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12610      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12611      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12612      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
12613      T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12614      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12615      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
12616      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
12617      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
12618      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
12619      v39_(v39), v40_(v40), v41_(v41), v42_(v42) {}
12620
12621  template <typename T>
12622  operator ParamGenerator<T>() const {
12623    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
12624        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
12625        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
12626        v36_, v37_, v38_, v39_, v40_, v41_, v42_};
12627    return ValuesIn(array);
12628  }
12629
12630 private:
12631  // No implementation - assignment is unsupported.
12632  void operator=(const ValueArray42& other);
12633
12634  const T1 v1_;
12635  const T2 v2_;
12636  const T3 v3_;
12637  const T4 v4_;
12638  const T5 v5_;
12639  const T6 v6_;
12640  const T7 v7_;
12641  const T8 v8_;
12642  const T9 v9_;
12643  const T10 v10_;
12644  const T11 v11_;
12645  const T12 v12_;
12646  const T13 v13_;
12647  const T14 v14_;
12648  const T15 v15_;
12649  const T16 v16_;
12650  const T17 v17_;
12651  const T18 v18_;
12652  const T19 v19_;
12653  const T20 v20_;
12654  const T21 v21_;
12655  const T22 v22_;
12656  const T23 v23_;
12657  const T24 v24_;
12658  const T25 v25_;
12659  const T26 v26_;
12660  const T27 v27_;
12661  const T28 v28_;
12662  const T29 v29_;
12663  const T30 v30_;
12664  const T31 v31_;
12665  const T32 v32_;
12666  const T33 v33_;
12667  const T34 v34_;
12668  const T35 v35_;
12669  const T36 v36_;
12670  const T37 v37_;
12671  const T38 v38_;
12672  const T39 v39_;
12673  const T40 v40_;
12674  const T41 v41_;
12675  const T42 v42_;
12676};
12677
12678template <typename T1, typename T2, typename T3, typename T4, typename T5,
12679    typename T6, typename T7, typename T8, typename T9, typename T10,
12680    typename T11, typename T12, typename T13, typename T14, typename T15,
12681    typename T16, typename T17, typename T18, typename T19, typename T20,
12682    typename T21, typename T22, typename T23, typename T24, typename T25,
12683    typename T26, typename T27, typename T28, typename T29, typename T30,
12684    typename T31, typename T32, typename T33, typename T34, typename T35,
12685    typename T36, typename T37, typename T38, typename T39, typename T40,
12686    typename T41, typename T42, typename T43>
12687class ValueArray43 {
12688 public:
12689  ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12690      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12691      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12692      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12693      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
12694      T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
12695      v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
12696      v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
12697      v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
12698      v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
12699      v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37),
12700      v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {}
12701
12702  template <typename T>
12703  operator ParamGenerator<T>() const {
12704    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
12705        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
12706        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
12707        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_};
12708    return ValuesIn(array);
12709  }
12710
12711 private:
12712  // No implementation - assignment is unsupported.
12713  void operator=(const ValueArray43& other);
12714
12715  const T1 v1_;
12716  const T2 v2_;
12717  const T3 v3_;
12718  const T4 v4_;
12719  const T5 v5_;
12720  const T6 v6_;
12721  const T7 v7_;
12722  const T8 v8_;
12723  const T9 v9_;
12724  const T10 v10_;
12725  const T11 v11_;
12726  const T12 v12_;
12727  const T13 v13_;
12728  const T14 v14_;
12729  const T15 v15_;
12730  const T16 v16_;
12731  const T17 v17_;
12732  const T18 v18_;
12733  const T19 v19_;
12734  const T20 v20_;
12735  const T21 v21_;
12736  const T22 v22_;
12737  const T23 v23_;
12738  const T24 v24_;
12739  const T25 v25_;
12740  const T26 v26_;
12741  const T27 v27_;
12742  const T28 v28_;
12743  const T29 v29_;
12744  const T30 v30_;
12745  const T31 v31_;
12746  const T32 v32_;
12747  const T33 v33_;
12748  const T34 v34_;
12749  const T35 v35_;
12750  const T36 v36_;
12751  const T37 v37_;
12752  const T38 v38_;
12753  const T39 v39_;
12754  const T40 v40_;
12755  const T41 v41_;
12756  const T42 v42_;
12757  const T43 v43_;
12758};
12759
12760template <typename T1, typename T2, typename T3, typename T4, typename T5,
12761    typename T6, typename T7, typename T8, typename T9, typename T10,
12762    typename T11, typename T12, typename T13, typename T14, typename T15,
12763    typename T16, typename T17, typename T18, typename T19, typename T20,
12764    typename T21, typename T22, typename T23, typename T24, typename T25,
12765    typename T26, typename T27, typename T28, typename T29, typename T30,
12766    typename T31, typename T32, typename T33, typename T34, typename T35,
12767    typename T36, typename T37, typename T38, typename T39, typename T40,
12768    typename T41, typename T42, typename T43, typename T44>
12769class ValueArray44 {
12770 public:
12771  ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12772      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12773      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12774      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12775      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
12776      T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
12777      v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
12778      v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
12779      v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
12780      v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
12781      v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36),
12782      v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42),
12783      v43_(v43), v44_(v44) {}
12784
12785  template <typename T>
12786  operator ParamGenerator<T>() const {
12787    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
12788        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
12789        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
12790        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_};
12791    return ValuesIn(array);
12792  }
12793
12794 private:
12795  // No implementation - assignment is unsupported.
12796  void operator=(const ValueArray44& other);
12797
12798  const T1 v1_;
12799  const T2 v2_;
12800  const T3 v3_;
12801  const T4 v4_;
12802  const T5 v5_;
12803  const T6 v6_;
12804  const T7 v7_;
12805  const T8 v8_;
12806  const T9 v9_;
12807  const T10 v10_;
12808  const T11 v11_;
12809  const T12 v12_;
12810  const T13 v13_;
12811  const T14 v14_;
12812  const T15 v15_;
12813  const T16 v16_;
12814  const T17 v17_;
12815  const T18 v18_;
12816  const T19 v19_;
12817  const T20 v20_;
12818  const T21 v21_;
12819  const T22 v22_;
12820  const T23 v23_;
12821  const T24 v24_;
12822  const T25 v25_;
12823  const T26 v26_;
12824  const T27 v27_;
12825  const T28 v28_;
12826  const T29 v29_;
12827  const T30 v30_;
12828  const T31 v31_;
12829  const T32 v32_;
12830  const T33 v33_;
12831  const T34 v34_;
12832  const T35 v35_;
12833  const T36 v36_;
12834  const T37 v37_;
12835  const T38 v38_;
12836  const T39 v39_;
12837  const T40 v40_;
12838  const T41 v41_;
12839  const T42 v42_;
12840  const T43 v43_;
12841  const T44 v44_;
12842};
12843
12844template <typename T1, typename T2, typename T3, typename T4, typename T5,
12845    typename T6, typename T7, typename T8, typename T9, typename T10,
12846    typename T11, typename T12, typename T13, typename T14, typename T15,
12847    typename T16, typename T17, typename T18, typename T19, typename T20,
12848    typename T21, typename T22, typename T23, typename T24, typename T25,
12849    typename T26, typename T27, typename T28, typename T29, typename T30,
12850    typename T31, typename T32, typename T33, typename T34, typename T35,
12851    typename T36, typename T37, typename T38, typename T39, typename T40,
12852    typename T41, typename T42, typename T43, typename T44, typename T45>
12853class ValueArray45 {
12854 public:
12855  ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12856      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12857      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12858      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12859      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
12860      T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
12861      v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
12862      v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
12863      v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
12864      v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
12865      v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
12866      v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41),
12867      v42_(v42), v43_(v43), v44_(v44), v45_(v45) {}
12868
12869  template <typename T>
12870  operator ParamGenerator<T>() const {
12871    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
12872        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
12873        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
12874        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_};
12875    return ValuesIn(array);
12876  }
12877
12878 private:
12879  // No implementation - assignment is unsupported.
12880  void operator=(const ValueArray45& other);
12881
12882  const T1 v1_;
12883  const T2 v2_;
12884  const T3 v3_;
12885  const T4 v4_;
12886  const T5 v5_;
12887  const T6 v6_;
12888  const T7 v7_;
12889  const T8 v8_;
12890  const T9 v9_;
12891  const T10 v10_;
12892  const T11 v11_;
12893  const T12 v12_;
12894  const T13 v13_;
12895  const T14 v14_;
12896  const T15 v15_;
12897  const T16 v16_;
12898  const T17 v17_;
12899  const T18 v18_;
12900  const T19 v19_;
12901  const T20 v20_;
12902  const T21 v21_;
12903  const T22 v22_;
12904  const T23 v23_;
12905  const T24 v24_;
12906  const T25 v25_;
12907  const T26 v26_;
12908  const T27 v27_;
12909  const T28 v28_;
12910  const T29 v29_;
12911  const T30 v30_;
12912  const T31 v31_;
12913  const T32 v32_;
12914  const T33 v33_;
12915  const T34 v34_;
12916  const T35 v35_;
12917  const T36 v36_;
12918  const T37 v37_;
12919  const T38 v38_;
12920  const T39 v39_;
12921  const T40 v40_;
12922  const T41 v41_;
12923  const T42 v42_;
12924  const T43 v43_;
12925  const T44 v44_;
12926  const T45 v45_;
12927};
12928
12929template <typename T1, typename T2, typename T3, typename T4, typename T5,
12930    typename T6, typename T7, typename T8, typename T9, typename T10,
12931    typename T11, typename T12, typename T13, typename T14, typename T15,
12932    typename T16, typename T17, typename T18, typename T19, typename T20,
12933    typename T21, typename T22, typename T23, typename T24, typename T25,
12934    typename T26, typename T27, typename T28, typename T29, typename T30,
12935    typename T31, typename T32, typename T33, typename T34, typename T35,
12936    typename T36, typename T37, typename T38, typename T39, typename T40,
12937    typename T41, typename T42, typename T43, typename T44, typename T45,
12938    typename T46>
12939class ValueArray46 {
12940 public:
12941  ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12942      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12943      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12944      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
12945      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
12946      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3),
12947      v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12948      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
12949      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
12950      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
12951      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
12952      v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
12953      v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {}
12954
12955  template <typename T>
12956  operator ParamGenerator<T>() const {
12957    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
12958        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
12959        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
12960        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_};
12961    return ValuesIn(array);
12962  }
12963
12964 private:
12965  // No implementation - assignment is unsupported.
12966  void operator=(const ValueArray46& other);
12967
12968  const T1 v1_;
12969  const T2 v2_;
12970  const T3 v3_;
12971  const T4 v4_;
12972  const T5 v5_;
12973  const T6 v6_;
12974  const T7 v7_;
12975  const T8 v8_;
12976  const T9 v9_;
12977  const T10 v10_;
12978  const T11 v11_;
12979  const T12 v12_;
12980  const T13 v13_;
12981  const T14 v14_;
12982  const T15 v15_;
12983  const T16 v16_;
12984  const T17 v17_;
12985  const T18 v18_;
12986  const T19 v19_;
12987  const T20 v20_;
12988  const T21 v21_;
12989  const T22 v22_;
12990  const T23 v23_;
12991  const T24 v24_;
12992  const T25 v25_;
12993  const T26 v26_;
12994  const T27 v27_;
12995  const T28 v28_;
12996  const T29 v29_;
12997  const T30 v30_;
12998  const T31 v31_;
12999  const T32 v32_;
13000  const T33 v33_;
13001  const T34 v34_;
13002  const T35 v35_;
13003  const T36 v36_;
13004  const T37 v37_;
13005  const T38 v38_;
13006  const T39 v39_;
13007  const T40 v40_;
13008  const T41 v41_;
13009  const T42 v42_;
13010  const T43 v43_;
13011  const T44 v44_;
13012  const T45 v45_;
13013  const T46 v46_;
13014};
13015
13016template <typename T1, typename T2, typename T3, typename T4, typename T5,
13017    typename T6, typename T7, typename T8, typename T9, typename T10,
13018    typename T11, typename T12, typename T13, typename T14, typename T15,
13019    typename T16, typename T17, typename T18, typename T19, typename T20,
13020    typename T21, typename T22, typename T23, typename T24, typename T25,
13021    typename T26, typename T27, typename T28, typename T29, typename T30,
13022    typename T31, typename T32, typename T33, typename T34, typename T35,
13023    typename T36, typename T37, typename T38, typename T39, typename T40,
13024    typename T41, typename T42, typename T43, typename T44, typename T45,
13025    typename T46, typename T47>
13026class ValueArray47 {
13027 public:
13028  ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13029      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13030      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13031      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13032      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
13033      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2),
13034      v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
13035      v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
13036      v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
13037      v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
13038      v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
13039      v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
13040      v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46),
13041      v47_(v47) {}
13042
13043  template <typename T>
13044  operator ParamGenerator<T>() const {
13045    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
13046        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
13047        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
13048        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_,
13049        v47_};
13050    return ValuesIn(array);
13051  }
13052
13053 private:
13054  // No implementation - assignment is unsupported.
13055  void operator=(const ValueArray47& other);
13056
13057  const T1 v1_;
13058  const T2 v2_;
13059  const T3 v3_;
13060  const T4 v4_;
13061  const T5 v5_;
13062  const T6 v6_;
13063  const T7 v7_;
13064  const T8 v8_;
13065  const T9 v9_;
13066  const T10 v10_;
13067  const T11 v11_;
13068  const T12 v12_;
13069  const T13 v13_;
13070  const T14 v14_;
13071  const T15 v15_;
13072  const T16 v16_;
13073  const T17 v17_;
13074  const T18 v18_;
13075  const T19 v19_;
13076  const T20 v20_;
13077  const T21 v21_;
13078  const T22 v22_;
13079  const T23 v23_;
13080  const T24 v24_;
13081  const T25 v25_;
13082  const T26 v26_;
13083  const T27 v27_;
13084  const T28 v28_;
13085  const T29 v29_;
13086  const T30 v30_;
13087  const T31 v31_;
13088  const T32 v32_;
13089  const T33 v33_;
13090  const T34 v34_;
13091  const T35 v35_;
13092  const T36 v36_;
13093  const T37 v37_;
13094  const T38 v38_;
13095  const T39 v39_;
13096  const T40 v40_;
13097  const T41 v41_;
13098  const T42 v42_;
13099  const T43 v43_;
13100  const T44 v44_;
13101  const T45 v45_;
13102  const T46 v46_;
13103  const T47 v47_;
13104};
13105
13106template <typename T1, typename T2, typename T3, typename T4, typename T5,
13107    typename T6, typename T7, typename T8, typename T9, typename T10,
13108    typename T11, typename T12, typename T13, typename T14, typename T15,
13109    typename T16, typename T17, typename T18, typename T19, typename T20,
13110    typename T21, typename T22, typename T23, typename T24, typename T25,
13111    typename T26, typename T27, typename T28, typename T29, typename T30,
13112    typename T31, typename T32, typename T33, typename T34, typename T35,
13113    typename T36, typename T37, typename T38, typename T39, typename T40,
13114    typename T41, typename T42, typename T43, typename T44, typename T45,
13115    typename T46, typename T47, typename T48>
13116class ValueArray48 {
13117 public:
13118  ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13119      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13120      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13121      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13122      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
13123      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1),
13124      v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
13125      v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
13126      v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
13127      v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
13128      v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
13129      v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
13130      v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45),
13131      v46_(v46), v47_(v47), v48_(v48) {}
13132
13133  template <typename T>
13134  operator ParamGenerator<T>() const {
13135    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
13136        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
13137        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
13138        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
13139        v48_};
13140    return ValuesIn(array);
13141  }
13142
13143 private:
13144  // No implementation - assignment is unsupported.
13145  void operator=(const ValueArray48& other);
13146
13147  const T1 v1_;
13148  const T2 v2_;
13149  const T3 v3_;
13150  const T4 v4_;
13151  const T5 v5_;
13152  const T6 v6_;
13153  const T7 v7_;
13154  const T8 v8_;
13155  const T9 v9_;
13156  const T10 v10_;
13157  const T11 v11_;
13158  const T12 v12_;
13159  const T13 v13_;
13160  const T14 v14_;
13161  const T15 v15_;
13162  const T16 v16_;
13163  const T17 v17_;
13164  const T18 v18_;
13165  const T19 v19_;
13166  const T20 v20_;
13167  const T21 v21_;
13168  const T22 v22_;
13169  const T23 v23_;
13170  const T24 v24_;
13171  const T25 v25_;
13172  const T26 v26_;
13173  const T27 v27_;
13174  const T28 v28_;
13175  const T29 v29_;
13176  const T30 v30_;
13177  const T31 v31_;
13178  const T32 v32_;
13179  const T33 v33_;
13180  const T34 v34_;
13181  const T35 v35_;
13182  const T36 v36_;
13183  const T37 v37_;
13184  const T38 v38_;
13185  const T39 v39_;
13186  const T40 v40_;
13187  const T41 v41_;
13188  const T42 v42_;
13189  const T43 v43_;
13190  const T44 v44_;
13191  const T45 v45_;
13192  const T46 v46_;
13193  const T47 v47_;
13194  const T48 v48_;
13195};
13196
13197template <typename T1, typename T2, typename T3, typename T4, typename T5,
13198    typename T6, typename T7, typename T8, typename T9, typename T10,
13199    typename T11, typename T12, typename T13, typename T14, typename T15,
13200    typename T16, typename T17, typename T18, typename T19, typename T20,
13201    typename T21, typename T22, typename T23, typename T24, typename T25,
13202    typename T26, typename T27, typename T28, typename T29, typename T30,
13203    typename T31, typename T32, typename T33, typename T34, typename T35,
13204    typename T36, typename T37, typename T38, typename T39, typename T40,
13205    typename T41, typename T42, typename T43, typename T44, typename T45,
13206    typename T46, typename T47, typename T48, typename T49>
13207class ValueArray49 {
13208 public:
13209  ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13210      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13211      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13212      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13213      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
13214      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48,
13215      T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
13216      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
13217      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
13218      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
13219      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
13220      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
13221      v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
13222      v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {}
13223
13224  template <typename T>
13225  operator ParamGenerator<T>() const {
13226    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
13227        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
13228        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
13229        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
13230        v48_, v49_};
13231    return ValuesIn(array);
13232  }
13233
13234 private:
13235  // No implementation - assignment is unsupported.
13236  void operator=(const ValueArray49& other);
13237
13238  const T1 v1_;
13239  const T2 v2_;
13240  const T3 v3_;
13241  const T4 v4_;
13242  const T5 v5_;
13243  const T6 v6_;
13244  const T7 v7_;
13245  const T8 v8_;
13246  const T9 v9_;
13247  const T10 v10_;
13248  const T11 v11_;
13249  const T12 v12_;
13250  const T13 v13_;
13251  const T14 v14_;
13252  const T15 v15_;
13253  const T16 v16_;
13254  const T17 v17_;
13255  const T18 v18_;
13256  const T19 v19_;
13257  const T20 v20_;
13258  const T21 v21_;
13259  const T22 v22_;
13260  const T23 v23_;
13261  const T24 v24_;
13262  const T25 v25_;
13263  const T26 v26_;
13264  const T27 v27_;
13265  const T28 v28_;
13266  const T29 v29_;
13267  const T30 v30_;
13268  const T31 v31_;
13269  const T32 v32_;
13270  const T33 v33_;
13271  const T34 v34_;
13272  const T35 v35_;
13273  const T36 v36_;
13274  const T37 v37_;
13275  const T38 v38_;
13276  const T39 v39_;
13277  const T40 v40_;
13278  const T41 v41_;
13279  const T42 v42_;
13280  const T43 v43_;
13281  const T44 v44_;
13282  const T45 v45_;
13283  const T46 v46_;
13284  const T47 v47_;
13285  const T48 v48_;
13286  const T49 v49_;
13287};
13288
13289template <typename T1, typename T2, typename T3, typename T4, typename T5,
13290    typename T6, typename T7, typename T8, typename T9, typename T10,
13291    typename T11, typename T12, typename T13, typename T14, typename T15,
13292    typename T16, typename T17, typename T18, typename T19, typename T20,
13293    typename T21, typename T22, typename T23, typename T24, typename T25,
13294    typename T26, typename T27, typename T28, typename T29, typename T30,
13295    typename T31, typename T32, typename T33, typename T34, typename T35,
13296    typename T36, typename T37, typename T38, typename T39, typename T40,
13297    typename T41, typename T42, typename T43, typename T44, typename T45,
13298    typename T46, typename T47, typename T48, typename T49, typename T50>
13299class ValueArray50 {
13300 public:
13301  ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13302      T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13303      T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13304      T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13305      T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
13306      T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49,
13307      T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
13308      v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
13309      v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
13310      v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
13311      v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
13312      v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
13313      v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
13314      v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {}
13315
13316  template <typename T>
13317  operator ParamGenerator<T>() const {
13318    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
13319        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
13320        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
13321        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
13322        v48_, v49_, v50_};
13323    return ValuesIn(array);
13324  }
13325
13326 private:
13327  // No implementation - assignment is unsupported.
13328  void operator=(const ValueArray50& other);
13329
13330  const T1 v1_;
13331  const T2 v2_;
13332  const T3 v3_;
13333  const T4 v4_;
13334  const T5 v5_;
13335  const T6 v6_;
13336  const T7 v7_;
13337  const T8 v8_;
13338  const T9 v9_;
13339  const T10 v10_;
13340  const T11 v11_;
13341  const T12 v12_;
13342  const T13 v13_;
13343  const T14 v14_;
13344  const T15 v15_;
13345  const T16 v16_;
13346  const T17 v17_;
13347  const T18 v18_;
13348  const T19 v19_;
13349  const T20 v20_;
13350  const T21 v21_;
13351  const T22 v22_;
13352  const T23 v23_;
13353  const T24 v24_;
13354  const T25 v25_;
13355  const T26 v26_;
13356  const T27 v27_;
13357  const T28 v28_;
13358  const T29 v29_;
13359  const T30 v30_;
13360  const T31 v31_;
13361  const T32 v32_;
13362  const T33 v33_;
13363  const T34 v34_;
13364  const T35 v35_;
13365  const T36 v36_;
13366  const T37 v37_;
13367  const T38 v38_;
13368  const T39 v39_;
13369  const T40 v40_;
13370  const T41 v41_;
13371  const T42 v42_;
13372  const T43 v43_;
13373  const T44 v44_;
13374  const T45 v45_;
13375  const T46 v46_;
13376  const T47 v47_;
13377  const T48 v48_;
13378  const T49 v49_;
13379  const T50 v50_;
13380};
13381
13382# if GTEST_HAS_COMBINE
13383// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
13384//
13385// Generates values from the Cartesian product of values produced
13386// by the argument generators.
13387//
13388template <typename T1, typename T2>
13389class CartesianProductGenerator2
13390    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2> > {
13391 public:
13392  typedef ::std::tr1::tuple<T1, T2> ParamType;
13393
13394  CartesianProductGenerator2(const ParamGenerator<T1>& g1,
13395      const ParamGenerator<T2>& g2)
13396      : g1_(g1), g2_(g2) {}
13397  virtual ~CartesianProductGenerator2() {}
13398
13399  virtual ParamIteratorInterface<ParamType>* Begin() const {
13400    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin());
13401  }
13402  virtual ParamIteratorInterface<ParamType>* End() const {
13403    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end());
13404  }
13405
13406 private:
13407  class Iterator : public ParamIteratorInterface<ParamType> {
13408   public:
13409    Iterator(const ParamGeneratorInterface<ParamType>* base,
13410      const ParamGenerator<T1>& g1,
13411      const typename ParamGenerator<T1>::iterator& current1,
13412      const ParamGenerator<T2>& g2,
13413      const typename ParamGenerator<T2>::iterator& current2)
13414        : base_(base),
13415          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
13416          begin2_(g2.begin()), end2_(g2.end()), current2_(current2)    {
13417      ComputeCurrentValue();
13418    }
13419    virtual ~Iterator() {}
13420
13421    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
13422      return base_;
13423    }
13424    // Advance should not be called on beyond-of-range iterators
13425    // so no component iterators must be beyond end of range, either.
13426    virtual void Advance() {
13427      assert(!AtEnd());
13428      ++current2_;
13429      if (current2_ == end2_) {
13430        current2_ = begin2_;
13431        ++current1_;
13432      }
13433      ComputeCurrentValue();
13434    }
13435    virtual ParamIteratorInterface<ParamType>* Clone() const {
13436      return new Iterator(*this);
13437    }
13438    virtual const ParamType* Current() const { return &current_value_; }
13439    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
13440      // Having the same base generator guarantees that the other
13441      // iterator is of the same type and we can downcast.
13442      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
13443          << "The program attempted to compare iterators "
13444          << "from different generators." << std::endl;
13445      const Iterator* typed_other =
13446          CheckedDowncastToActualType<const Iterator>(&other);
13447      // We must report iterators equal if they both point beyond their
13448      // respective ranges. That can happen in a variety of fashions,
13449      // so we have to consult AtEnd().
13450      return (AtEnd() && typed_other->AtEnd()) ||
13451         (
13452          current1_ == typed_other->current1_ &&
13453          current2_ == typed_other->current2_);
13454    }
13455
13456   private:
13457    Iterator(const Iterator& other)
13458        : base_(other.base_),
13459        begin1_(other.begin1_),
13460        end1_(other.end1_),
13461        current1_(other.current1_),
13462        begin2_(other.begin2_),
13463        end2_(other.end2_),
13464        current2_(other.current2_) {
13465      ComputeCurrentValue();
13466    }
13467
13468    void ComputeCurrentValue() {
13469      if (!AtEnd())
13470        current_value_ = ParamType(*current1_, *current2_);
13471    }
13472    bool AtEnd() const {
13473      // We must report iterator past the end of the range when either of the
13474      // component iterators has reached the end of its range.
13475      return
13476          current1_ == end1_ ||
13477          current2_ == end2_;
13478    }
13479
13480    // No implementation - assignment is unsupported.
13481    void operator=(const Iterator& other);
13482
13483    const ParamGeneratorInterface<ParamType>* const base_;
13484    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
13485    // current[i]_ is the actual traversing iterator.
13486    const typename ParamGenerator<T1>::iterator begin1_;
13487    const typename ParamGenerator<T1>::iterator end1_;
13488    typename ParamGenerator<T1>::iterator current1_;
13489    const typename ParamGenerator<T2>::iterator begin2_;
13490    const typename ParamGenerator<T2>::iterator end2_;
13491    typename ParamGenerator<T2>::iterator current2_;
13492    ParamType current_value_;
13493  };  // class CartesianProductGenerator2::Iterator
13494
13495  // No implementation - assignment is unsupported.
13496  void operator=(const CartesianProductGenerator2& other);
13497
13498  const ParamGenerator<T1> g1_;
13499  const ParamGenerator<T2> g2_;
13500};  // class CartesianProductGenerator2
13501
13502
13503template <typename T1, typename T2, typename T3>
13504class CartesianProductGenerator3
13505    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3> > {
13506 public:
13507  typedef ::std::tr1::tuple<T1, T2, T3> ParamType;
13508
13509  CartesianProductGenerator3(const ParamGenerator<T1>& g1,
13510      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)
13511      : g1_(g1), g2_(g2), g3_(g3) {}
13512  virtual ~CartesianProductGenerator3() {}
13513
13514  virtual ParamIteratorInterface<ParamType>* Begin() const {
13515    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
13516        g3_.begin());
13517  }
13518  virtual ParamIteratorInterface<ParamType>* End() const {
13519    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end());
13520  }
13521
13522 private:
13523  class Iterator : public ParamIteratorInterface<ParamType> {
13524   public:
13525    Iterator(const ParamGeneratorInterface<ParamType>* base,
13526      const ParamGenerator<T1>& g1,
13527      const typename ParamGenerator<T1>::iterator& current1,
13528      const ParamGenerator<T2>& g2,
13529      const typename ParamGenerator<T2>::iterator& current2,
13530      const ParamGenerator<T3>& g3,
13531      const typename ParamGenerator<T3>::iterator& current3)
13532        : base_(base),
13533          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
13534          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
13535          begin3_(g3.begin()), end3_(g3.end()), current3_(current3)    {
13536      ComputeCurrentValue();
13537    }
13538    virtual ~Iterator() {}
13539
13540    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
13541      return base_;
13542    }
13543    // Advance should not be called on beyond-of-range iterators
13544    // so no component iterators must be beyond end of range, either.
13545    virtual void Advance() {
13546      assert(!AtEnd());
13547      ++current3_;
13548      if (current3_ == end3_) {
13549        current3_ = begin3_;
13550        ++current2_;
13551      }
13552      if (current2_ == end2_) {
13553        current2_ = begin2_;
13554        ++current1_;
13555      }
13556      ComputeCurrentValue();
13557    }
13558    virtual ParamIteratorInterface<ParamType>* Clone() const {
13559      return new Iterator(*this);
13560    }
13561    virtual const ParamType* Current() const { return &current_value_; }
13562    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
13563      // Having the same base generator guarantees that the other
13564      // iterator is of the same type and we can downcast.
13565      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
13566          << "The program attempted to compare iterators "
13567          << "from different generators." << std::endl;
13568      const Iterator* typed_other =
13569          CheckedDowncastToActualType<const Iterator>(&other);
13570      // We must report iterators equal if they both point beyond their
13571      // respective ranges. That can happen in a variety of fashions,
13572      // so we have to consult AtEnd().
13573      return (AtEnd() && typed_other->AtEnd()) ||
13574         (
13575          current1_ == typed_other->current1_ &&
13576          current2_ == typed_other->current2_ &&
13577          current3_ == typed_other->current3_);
13578    }
13579
13580   private:
13581    Iterator(const Iterator& other)
13582        : base_(other.base_),
13583        begin1_(other.begin1_),
13584        end1_(other.end1_),
13585        current1_(other.current1_),
13586        begin2_(other.begin2_),
13587        end2_(other.end2_),
13588        current2_(other.current2_),
13589        begin3_(other.begin3_),
13590        end3_(other.end3_),
13591        current3_(other.current3_) {
13592      ComputeCurrentValue();
13593    }
13594
13595    void ComputeCurrentValue() {
13596      if (!AtEnd())
13597        current_value_ = ParamType(*current1_, *current2_, *current3_);
13598    }
13599    bool AtEnd() const {
13600      // We must report iterator past the end of the range when either of the
13601      // component iterators has reached the end of its range.
13602      return
13603          current1_ == end1_ ||
13604          current2_ == end2_ ||
13605          current3_ == end3_;
13606    }
13607
13608    // No implementation - assignment is unsupported.
13609    void operator=(const Iterator& other);
13610
13611    const ParamGeneratorInterface<ParamType>* const base_;
13612    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
13613    // current[i]_ is the actual traversing iterator.
13614    const typename ParamGenerator<T1>::iterator begin1_;
13615    const typename ParamGenerator<T1>::iterator end1_;
13616    typename ParamGenerator<T1>::iterator current1_;
13617    const typename ParamGenerator<T2>::iterator begin2_;
13618    const typename ParamGenerator<T2>::iterator end2_;
13619    typename ParamGenerator<T2>::iterator current2_;
13620    const typename ParamGenerator<T3>::iterator begin3_;
13621    const typename ParamGenerator<T3>::iterator end3_;
13622    typename ParamGenerator<T3>::iterator current3_;
13623    ParamType current_value_;
13624  };  // class CartesianProductGenerator3::Iterator
13625
13626  // No implementation - assignment is unsupported.
13627  void operator=(const CartesianProductGenerator3& other);
13628
13629  const ParamGenerator<T1> g1_;
13630  const ParamGenerator<T2> g2_;
13631  const ParamGenerator<T3> g3_;
13632};  // class CartesianProductGenerator3
13633
13634
13635template <typename T1, typename T2, typename T3, typename T4>
13636class CartesianProductGenerator4
13637    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4> > {
13638 public:
13639  typedef ::std::tr1::tuple<T1, T2, T3, T4> ParamType;
13640
13641  CartesianProductGenerator4(const ParamGenerator<T1>& g1,
13642      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
13643      const ParamGenerator<T4>& g4)
13644      : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
13645  virtual ~CartesianProductGenerator4() {}
13646
13647  virtual ParamIteratorInterface<ParamType>* Begin() const {
13648    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
13649        g3_.begin(), g4_, g4_.begin());
13650  }
13651  virtual ParamIteratorInterface<ParamType>* End() const {
13652    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
13653        g4_, g4_.end());
13654  }
13655
13656 private:
13657  class Iterator : public ParamIteratorInterface<ParamType> {
13658   public:
13659    Iterator(const ParamGeneratorInterface<ParamType>* base,
13660      const ParamGenerator<T1>& g1,
13661      const typename ParamGenerator<T1>::iterator& current1,
13662      const ParamGenerator<T2>& g2,
13663      const typename ParamGenerator<T2>::iterator& current2,
13664      const ParamGenerator<T3>& g3,
13665      const typename ParamGenerator<T3>::iterator& current3,
13666      const ParamGenerator<T4>& g4,
13667      const typename ParamGenerator<T4>::iterator& current4)
13668        : base_(base),
13669          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
13670          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
13671          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
13672          begin4_(g4.begin()), end4_(g4.end()), current4_(current4)    {
13673      ComputeCurrentValue();
13674    }
13675    virtual ~Iterator() {}
13676
13677    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
13678      return base_;
13679    }
13680    // Advance should not be called on beyond-of-range iterators
13681    // so no component iterators must be beyond end of range, either.
13682    virtual void Advance() {
13683      assert(!AtEnd());
13684      ++current4_;
13685      if (current4_ == end4_) {
13686        current4_ = begin4_;
13687        ++current3_;
13688      }
13689      if (current3_ == end3_) {
13690        current3_ = begin3_;
13691        ++current2_;
13692      }
13693      if (current2_ == end2_) {
13694        current2_ = begin2_;
13695        ++current1_;
13696      }
13697      ComputeCurrentValue();
13698    }
13699    virtual ParamIteratorInterface<ParamType>* Clone() const {
13700      return new Iterator(*this);
13701    }
13702    virtual const ParamType* Current() const { return &current_value_; }
13703    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
13704      // Having the same base generator guarantees that the other
13705      // iterator is of the same type and we can downcast.
13706      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
13707          << "The program attempted to compare iterators "
13708          << "from different generators." << std::endl;
13709      const Iterator* typed_other =
13710          CheckedDowncastToActualType<const Iterator>(&other);
13711      // We must report iterators equal if they both point beyond their
13712      // respective ranges. That can happen in a variety of fashions,
13713      // so we have to consult AtEnd().
13714      return (AtEnd() && typed_other->AtEnd()) ||
13715         (
13716          current1_ == typed_other->current1_ &&
13717          current2_ == typed_other->current2_ &&
13718          current3_ == typed_other->current3_ &&
13719          current4_ == typed_other->current4_);
13720    }
13721
13722   private:
13723    Iterator(const Iterator& other)
13724        : base_(other.base_),
13725        begin1_(other.begin1_),
13726        end1_(other.end1_),
13727        current1_(other.current1_),
13728        begin2_(other.begin2_),
13729        end2_(other.end2_),
13730        current2_(other.current2_),
13731        begin3_(other.begin3_),
13732        end3_(other.end3_),
13733        current3_(other.current3_),
13734        begin4_(other.begin4_),
13735        end4_(other.end4_),
13736        current4_(other.current4_) {
13737      ComputeCurrentValue();
13738    }
13739
13740    void ComputeCurrentValue() {
13741      if (!AtEnd())
13742        current_value_ = ParamType(*current1_, *current2_, *current3_,
13743            *current4_);
13744    }
13745    bool AtEnd() const {
13746      // We must report iterator past the end of the range when either of the
13747      // component iterators has reached the end of its range.
13748      return
13749          current1_ == end1_ ||
13750          current2_ == end2_ ||
13751          current3_ == end3_ ||
13752          current4_ == end4_;
13753    }
13754
13755    // No implementation - assignment is unsupported.
13756    void operator=(const Iterator& other);
13757
13758    const ParamGeneratorInterface<ParamType>* const base_;
13759    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
13760    // current[i]_ is the actual traversing iterator.
13761    const typename ParamGenerator<T1>::iterator begin1_;
13762    const typename ParamGenerator<T1>::iterator end1_;
13763    typename ParamGenerator<T1>::iterator current1_;
13764    const typename ParamGenerator<T2>::iterator begin2_;
13765    const typename ParamGenerator<T2>::iterator end2_;
13766    typename ParamGenerator<T2>::iterator current2_;
13767    const typename ParamGenerator<T3>::iterator begin3_;
13768    const typename ParamGenerator<T3>::iterator end3_;
13769    typename ParamGenerator<T3>::iterator current3_;
13770    const typename ParamGenerator<T4>::iterator begin4_;
13771    const typename ParamGenerator<T4>::iterator end4_;
13772    typename ParamGenerator<T4>::iterator current4_;
13773    ParamType current_value_;
13774  };  // class CartesianProductGenerator4::Iterator
13775
13776  // No implementation - assignment is unsupported.
13777  void operator=(const CartesianProductGenerator4& other);
13778
13779  const ParamGenerator<T1> g1_;
13780  const ParamGenerator<T2> g2_;
13781  const ParamGenerator<T3> g3_;
13782  const ParamGenerator<T4> g4_;
13783};  // class CartesianProductGenerator4
13784
13785
13786template <typename T1, typename T2, typename T3, typename T4, typename T5>
13787class CartesianProductGenerator5
13788    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5> > {
13789 public:
13790  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5> ParamType;
13791
13792  CartesianProductGenerator5(const ParamGenerator<T1>& g1,
13793      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
13794      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5)
13795      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
13796  virtual ~CartesianProductGenerator5() {}
13797
13798  virtual ParamIteratorInterface<ParamType>* Begin() const {
13799    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
13800        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin());
13801  }
13802  virtual ParamIteratorInterface<ParamType>* End() const {
13803    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
13804        g4_, g4_.end(), g5_, g5_.end());
13805  }
13806
13807 private:
13808  class Iterator : public ParamIteratorInterface<ParamType> {
13809   public:
13810    Iterator(const ParamGeneratorInterface<ParamType>* base,
13811      const ParamGenerator<T1>& g1,
13812      const typename ParamGenerator<T1>::iterator& current1,
13813      const ParamGenerator<T2>& g2,
13814      const typename ParamGenerator<T2>::iterator& current2,
13815      const ParamGenerator<T3>& g3,
13816      const typename ParamGenerator<T3>::iterator& current3,
13817      const ParamGenerator<T4>& g4,
13818      const typename ParamGenerator<T4>::iterator& current4,
13819      const ParamGenerator<T5>& g5,
13820      const typename ParamGenerator<T5>::iterator& current5)
13821        : base_(base),
13822          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
13823          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
13824          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
13825          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
13826          begin5_(g5.begin()), end5_(g5.end()), current5_(current5)    {
13827      ComputeCurrentValue();
13828    }
13829    virtual ~Iterator() {}
13830
13831    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
13832      return base_;
13833    }
13834    // Advance should not be called on beyond-of-range iterators
13835    // so no component iterators must be beyond end of range, either.
13836    virtual void Advance() {
13837      assert(!AtEnd());
13838      ++current5_;
13839      if (current5_ == end5_) {
13840        current5_ = begin5_;
13841        ++current4_;
13842      }
13843      if (current4_ == end4_) {
13844        current4_ = begin4_;
13845        ++current3_;
13846      }
13847      if (current3_ == end3_) {
13848        current3_ = begin3_;
13849        ++current2_;
13850      }
13851      if (current2_ == end2_) {
13852        current2_ = begin2_;
13853        ++current1_;
13854      }
13855      ComputeCurrentValue();
13856    }
13857    virtual ParamIteratorInterface<ParamType>* Clone() const {
13858      return new Iterator(*this);
13859    }
13860    virtual const ParamType* Current() const { return &current_value_; }
13861    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
13862      // Having the same base generator guarantees that the other
13863      // iterator is of the same type and we can downcast.
13864      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
13865          << "The program attempted to compare iterators "
13866          << "from different generators." << std::endl;
13867      const Iterator* typed_other =
13868          CheckedDowncastToActualType<const Iterator>(&other);
13869      // We must report iterators equal if they both point beyond their
13870      // respective ranges. That can happen in a variety of fashions,
13871      // so we have to consult AtEnd().
13872      return (AtEnd() && typed_other->AtEnd()) ||
13873         (
13874          current1_ == typed_other->current1_ &&
13875          current2_ == typed_other->current2_ &&
13876          current3_ == typed_other->current3_ &&
13877          current4_ == typed_other->current4_ &&
13878          current5_ == typed_other->current5_);
13879    }
13880
13881   private:
13882    Iterator(const Iterator& other)
13883        : base_(other.base_),
13884        begin1_(other.begin1_),
13885        end1_(other.end1_),
13886        current1_(other.current1_),
13887        begin2_(other.begin2_),
13888        end2_(other.end2_),
13889        current2_(other.current2_),
13890        begin3_(other.begin3_),
13891        end3_(other.end3_),
13892        current3_(other.current3_),
13893        begin4_(other.begin4_),
13894        end4_(other.end4_),
13895        current4_(other.current4_),
13896        begin5_(other.begin5_),
13897        end5_(other.end5_),
13898        current5_(other.current5_) {
13899      ComputeCurrentValue();
13900    }
13901
13902    void ComputeCurrentValue() {
13903      if (!AtEnd())
13904        current_value_ = ParamType(*current1_, *current2_, *current3_,
13905            *current4_, *current5_);
13906    }
13907    bool AtEnd() const {
13908      // We must report iterator past the end of the range when either of the
13909      // component iterators has reached the end of its range.
13910      return
13911          current1_ == end1_ ||
13912          current2_ == end2_ ||
13913          current3_ == end3_ ||
13914          current4_ == end4_ ||
13915          current5_ == end5_;
13916    }
13917
13918    // No implementation - assignment is unsupported.
13919    void operator=(const Iterator& other);
13920
13921    const ParamGeneratorInterface<ParamType>* const base_;
13922    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
13923    // current[i]_ is the actual traversing iterator.
13924    const typename ParamGenerator<T1>::iterator begin1_;
13925    const typename ParamGenerator<T1>::iterator end1_;
13926    typename ParamGenerator<T1>::iterator current1_;
13927    const typename ParamGenerator<T2>::iterator begin2_;
13928    const typename ParamGenerator<T2>::iterator end2_;
13929    typename ParamGenerator<T2>::iterator current2_;
13930    const typename ParamGenerator<T3>::iterator begin3_;
13931    const typename ParamGenerator<T3>::iterator end3_;
13932    typename ParamGenerator<T3>::iterator current3_;
13933    const typename ParamGenerator<T4>::iterator begin4_;
13934    const typename ParamGenerator<T4>::iterator end4_;
13935    typename ParamGenerator<T4>::iterator current4_;
13936    const typename ParamGenerator<T5>::iterator begin5_;
13937    const typename ParamGenerator<T5>::iterator end5_;
13938    typename ParamGenerator<T5>::iterator current5_;
13939    ParamType current_value_;
13940  };  // class CartesianProductGenerator5::Iterator
13941
13942  // No implementation - assignment is unsupported.
13943  void operator=(const CartesianProductGenerator5& other);
13944
13945  const ParamGenerator<T1> g1_;
13946  const ParamGenerator<T2> g2_;
13947  const ParamGenerator<T3> g3_;
13948  const ParamGenerator<T4> g4_;
13949  const ParamGenerator<T5> g5_;
13950};  // class CartesianProductGenerator5
13951
13952
13953template <typename T1, typename T2, typename T3, typename T4, typename T5,
13954    typename T6>
13955class CartesianProductGenerator6
13956    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
13957        T6> > {
13958 public:
13959  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> ParamType;
13960
13961  CartesianProductGenerator6(const ParamGenerator<T1>& g1,
13962      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
13963      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
13964      const ParamGenerator<T6>& g6)
13965      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
13966  virtual ~CartesianProductGenerator6() {}
13967
13968  virtual ParamIteratorInterface<ParamType>* Begin() const {
13969    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
13970        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin());
13971  }
13972  virtual ParamIteratorInterface<ParamType>* End() const {
13973    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
13974        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end());
13975  }
13976
13977 private:
13978  class Iterator : public ParamIteratorInterface<ParamType> {
13979   public:
13980    Iterator(const ParamGeneratorInterface<ParamType>* base,
13981      const ParamGenerator<T1>& g1,
13982      const typename ParamGenerator<T1>::iterator& current1,
13983      const ParamGenerator<T2>& g2,
13984      const typename ParamGenerator<T2>::iterator& current2,
13985      const ParamGenerator<T3>& g3,
13986      const typename ParamGenerator<T3>::iterator& current3,
13987      const ParamGenerator<T4>& g4,
13988      const typename ParamGenerator<T4>::iterator& current4,
13989      const ParamGenerator<T5>& g5,
13990      const typename ParamGenerator<T5>::iterator& current5,
13991      const ParamGenerator<T6>& g6,
13992      const typename ParamGenerator<T6>::iterator& current6)
13993        : base_(base),
13994          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
13995          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
13996          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
13997          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
13998          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
13999          begin6_(g6.begin()), end6_(g6.end()), current6_(current6)    {
14000      ComputeCurrentValue();
14001    }
14002    virtual ~Iterator() {}
14003
14004    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
14005      return base_;
14006    }
14007    // Advance should not be called on beyond-of-range iterators
14008    // so no component iterators must be beyond end of range, either.
14009    virtual void Advance() {
14010      assert(!AtEnd());
14011      ++current6_;
14012      if (current6_ == end6_) {
14013        current6_ = begin6_;
14014        ++current5_;
14015      }
14016      if (current5_ == end5_) {
14017        current5_ = begin5_;
14018        ++current4_;
14019      }
14020      if (current4_ == end4_) {
14021        current4_ = begin4_;
14022        ++current3_;
14023      }
14024      if (current3_ == end3_) {
14025        current3_ = begin3_;
14026        ++current2_;
14027      }
14028      if (current2_ == end2_) {
14029        current2_ = begin2_;
14030        ++current1_;
14031      }
14032      ComputeCurrentValue();
14033    }
14034    virtual ParamIteratorInterface<ParamType>* Clone() const {
14035      return new Iterator(*this);
14036    }
14037    virtual const ParamType* Current() const { return &current_value_; }
14038    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
14039      // Having the same base generator guarantees that the other
14040      // iterator is of the same type and we can downcast.
14041      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
14042          << "The program attempted to compare iterators "
14043          << "from different generators." << std::endl;
14044      const Iterator* typed_other =
14045          CheckedDowncastToActualType<const Iterator>(&other);
14046      // We must report iterators equal if they both point beyond their
14047      // respective ranges. That can happen in a variety of fashions,
14048      // so we have to consult AtEnd().
14049      return (AtEnd() && typed_other->AtEnd()) ||
14050         (
14051          current1_ == typed_other->current1_ &&
14052          current2_ == typed_other->current2_ &&
14053          current3_ == typed_other->current3_ &&
14054          current4_ == typed_other->current4_ &&
14055          current5_ == typed_other->current5_ &&
14056          current6_ == typed_other->current6_);
14057    }
14058
14059   private:
14060    Iterator(const Iterator& other)
14061        : base_(other.base_),
14062        begin1_(other.begin1_),
14063        end1_(other.end1_),
14064        current1_(other.current1_),
14065        begin2_(other.begin2_),
14066        end2_(other.end2_),
14067        current2_(other.current2_),
14068        begin3_(other.begin3_),
14069        end3_(other.end3_),
14070        current3_(other.current3_),
14071        begin4_(other.begin4_),
14072        end4_(other.end4_),
14073        current4_(other.current4_),
14074        begin5_(other.begin5_),
14075        end5_(other.end5_),
14076        current5_(other.current5_),
14077        begin6_(other.begin6_),
14078        end6_(other.end6_),
14079        current6_(other.current6_) {
14080      ComputeCurrentValue();
14081    }
14082
14083    void ComputeCurrentValue() {
14084      if (!AtEnd())
14085        current_value_ = ParamType(*current1_, *current2_, *current3_,
14086            *current4_, *current5_, *current6_);
14087    }
14088    bool AtEnd() const {
14089      // We must report iterator past the end of the range when either of the
14090      // component iterators has reached the end of its range.
14091      return
14092          current1_ == end1_ ||
14093          current2_ == end2_ ||
14094          current3_ == end3_ ||
14095          current4_ == end4_ ||
14096          current5_ == end5_ ||
14097          current6_ == end6_;
14098    }
14099
14100    // No implementation - assignment is unsupported.
14101    void operator=(const Iterator& other);
14102
14103    const ParamGeneratorInterface<ParamType>* const base_;
14104    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
14105    // current[i]_ is the actual traversing iterator.
14106    const typename ParamGenerator<T1>::iterator begin1_;
14107    const typename ParamGenerator<T1>::iterator end1_;
14108    typename ParamGenerator<T1>::iterator current1_;
14109    const typename ParamGenerator<T2>::iterator begin2_;
14110    const typename ParamGenerator<T2>::iterator end2_;
14111    typename ParamGenerator<T2>::iterator current2_;
14112    const typename ParamGenerator<T3>::iterator begin3_;
14113    const typename ParamGenerator<T3>::iterator end3_;
14114    typename ParamGenerator<T3>::iterator current3_;
14115    const typename ParamGenerator<T4>::iterator begin4_;
14116    const typename ParamGenerator<T4>::iterator end4_;
14117    typename ParamGenerator<T4>::iterator current4_;
14118    const typename ParamGenerator<T5>::iterator begin5_;
14119    const typename ParamGenerator<T5>::iterator end5_;
14120    typename ParamGenerator<T5>::iterator current5_;
14121    const typename ParamGenerator<T6>::iterator begin6_;
14122    const typename ParamGenerator<T6>::iterator end6_;
14123    typename ParamGenerator<T6>::iterator current6_;
14124    ParamType current_value_;
14125  };  // class CartesianProductGenerator6::Iterator
14126
14127  // No implementation - assignment is unsupported.
14128  void operator=(const CartesianProductGenerator6& other);
14129
14130  const ParamGenerator<T1> g1_;
14131  const ParamGenerator<T2> g2_;
14132  const ParamGenerator<T3> g3_;
14133  const ParamGenerator<T4> g4_;
14134  const ParamGenerator<T5> g5_;
14135  const ParamGenerator<T6> g6_;
14136};  // class CartesianProductGenerator6
14137
14138
14139template <typename T1, typename T2, typename T3, typename T4, typename T5,
14140    typename T6, typename T7>
14141class CartesianProductGenerator7
14142    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
14143        T7> > {
14144 public:
14145  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;
14146
14147  CartesianProductGenerator7(const ParamGenerator<T1>& g1,
14148      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
14149      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
14150      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7)
14151      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
14152  virtual ~CartesianProductGenerator7() {}
14153
14154  virtual ParamIteratorInterface<ParamType>* Begin() const {
14155    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
14156        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
14157        g7_.begin());
14158  }
14159  virtual ParamIteratorInterface<ParamType>* End() const {
14160    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
14161        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end());
14162  }
14163
14164 private:
14165  class Iterator : public ParamIteratorInterface<ParamType> {
14166   public:
14167    Iterator(const ParamGeneratorInterface<ParamType>* base,
14168      const ParamGenerator<T1>& g1,
14169      const typename ParamGenerator<T1>::iterator& current1,
14170      const ParamGenerator<T2>& g2,
14171      const typename ParamGenerator<T2>::iterator& current2,
14172      const ParamGenerator<T3>& g3,
14173      const typename ParamGenerator<T3>::iterator& current3,
14174      const ParamGenerator<T4>& g4,
14175      const typename ParamGenerator<T4>::iterator& current4,
14176      const ParamGenerator<T5>& g5,
14177      const typename ParamGenerator<T5>::iterator& current5,
14178      const ParamGenerator<T6>& g6,
14179      const typename ParamGenerator<T6>::iterator& current6,
14180      const ParamGenerator<T7>& g7,
14181      const typename ParamGenerator<T7>::iterator& current7)
14182        : base_(base),
14183          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
14184          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
14185          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
14186          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
14187          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
14188          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
14189          begin7_(g7.begin()), end7_(g7.end()), current7_(current7)    {
14190      ComputeCurrentValue();
14191    }
14192    virtual ~Iterator() {}
14193
14194    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
14195      return base_;
14196    }
14197    // Advance should not be called on beyond-of-range iterators
14198    // so no component iterators must be beyond end of range, either.
14199    virtual void Advance() {
14200      assert(!AtEnd());
14201      ++current7_;
14202      if (current7_ == end7_) {
14203        current7_ = begin7_;
14204        ++current6_;
14205      }
14206      if (current6_ == end6_) {
14207        current6_ = begin6_;
14208        ++current5_;
14209      }
14210      if (current5_ == end5_) {
14211        current5_ = begin5_;
14212        ++current4_;
14213      }
14214      if (current4_ == end4_) {
14215        current4_ = begin4_;
14216        ++current3_;
14217      }
14218      if (current3_ == end3_) {
14219        current3_ = begin3_;
14220        ++current2_;
14221      }
14222      if (current2_ == end2_) {
14223        current2_ = begin2_;
14224        ++current1_;
14225      }
14226      ComputeCurrentValue();
14227    }
14228    virtual ParamIteratorInterface<ParamType>* Clone() const {
14229      return new Iterator(*this);
14230    }
14231    virtual const ParamType* Current() const { return &current_value_; }
14232    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
14233      // Having the same base generator guarantees that the other
14234      // iterator is of the same type and we can downcast.
14235      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
14236          << "The program attempted to compare iterators "
14237          << "from different generators." << std::endl;
14238      const Iterator* typed_other =
14239          CheckedDowncastToActualType<const Iterator>(&other);
14240      // We must report iterators equal if they both point beyond their
14241      // respective ranges. That can happen in a variety of fashions,
14242      // so we have to consult AtEnd().
14243      return (AtEnd() && typed_other->AtEnd()) ||
14244         (
14245          current1_ == typed_other->current1_ &&
14246          current2_ == typed_other->current2_ &&
14247          current3_ == typed_other->current3_ &&
14248          current4_ == typed_other->current4_ &&
14249          current5_ == typed_other->current5_ &&
14250          current6_ == typed_other->current6_ &&
14251          current7_ == typed_other->current7_);
14252    }
14253
14254   private:
14255    Iterator(const Iterator& other)
14256        : base_(other.base_),
14257        begin1_(other.begin1_),
14258        end1_(other.end1_),
14259        current1_(other.current1_),
14260        begin2_(other.begin2_),
14261        end2_(other.end2_),
14262        current2_(other.current2_),
14263        begin3_(other.begin3_),
14264        end3_(other.end3_),
14265        current3_(other.current3_),
14266        begin4_(other.begin4_),
14267        end4_(other.end4_),
14268        current4_(other.current4_),
14269        begin5_(other.begin5_),
14270        end5_(other.end5_),
14271        current5_(other.current5_),
14272        begin6_(other.begin6_),
14273        end6_(other.end6_),
14274        current6_(other.current6_),
14275        begin7_(other.begin7_),
14276        end7_(other.end7_),
14277        current7_(other.current7_) {
14278      ComputeCurrentValue();
14279    }
14280
14281    void ComputeCurrentValue() {
14282      if (!AtEnd())
14283        current_value_ = ParamType(*current1_, *current2_, *current3_,
14284            *current4_, *current5_, *current6_, *current7_);
14285    }
14286    bool AtEnd() const {
14287      // We must report iterator past the end of the range when either of the
14288      // component iterators has reached the end of its range.
14289      return
14290          current1_ == end1_ ||
14291          current2_ == end2_ ||
14292          current3_ == end3_ ||
14293          current4_ == end4_ ||
14294          current5_ == end5_ ||
14295          current6_ == end6_ ||
14296          current7_ == end7_;
14297    }
14298
14299    // No implementation - assignment is unsupported.
14300    void operator=(const Iterator& other);
14301
14302    const ParamGeneratorInterface<ParamType>* const base_;
14303    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
14304    // current[i]_ is the actual traversing iterator.
14305    const typename ParamGenerator<T1>::iterator begin1_;
14306    const typename ParamGenerator<T1>::iterator end1_;
14307    typename ParamGenerator<T1>::iterator current1_;
14308    const typename ParamGenerator<T2>::iterator begin2_;
14309    const typename ParamGenerator<T2>::iterator end2_;
14310    typename ParamGenerator<T2>::iterator current2_;
14311    const typename ParamGenerator<T3>::iterator begin3_;
14312    const typename ParamGenerator<T3>::iterator end3_;
14313    typename ParamGenerator<T3>::iterator current3_;
14314    const typename ParamGenerator<T4>::iterator begin4_;
14315    const typename ParamGenerator<T4>::iterator end4_;
14316    typename ParamGenerator<T4>::iterator current4_;
14317    const typename ParamGenerator<T5>::iterator begin5_;
14318    const typename ParamGenerator<T5>::iterator end5_;
14319    typename ParamGenerator<T5>::iterator current5_;
14320    const typename ParamGenerator<T6>::iterator begin6_;
14321    const typename ParamGenerator<T6>::iterator end6_;
14322    typename ParamGenerator<T6>::iterator current6_;
14323    const typename ParamGenerator<T7>::iterator begin7_;
14324    const typename ParamGenerator<T7>::iterator end7_;
14325    typename ParamGenerator<T7>::iterator current7_;
14326    ParamType current_value_;
14327  };  // class CartesianProductGenerator7::Iterator
14328
14329  // No implementation - assignment is unsupported.
14330  void operator=(const CartesianProductGenerator7& other);
14331
14332  const ParamGenerator<T1> g1_;
14333  const ParamGenerator<T2> g2_;
14334  const ParamGenerator<T3> g3_;
14335  const ParamGenerator<T4> g4_;
14336  const ParamGenerator<T5> g5_;
14337  const ParamGenerator<T6> g6_;
14338  const ParamGenerator<T7> g7_;
14339};  // class CartesianProductGenerator7
14340
14341
14342template <typename T1, typename T2, typename T3, typename T4, typename T5,
14343    typename T6, typename T7, typename T8>
14344class CartesianProductGenerator8
14345    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
14346        T7, T8> > {
14347 public:
14348  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;
14349
14350  CartesianProductGenerator8(const ParamGenerator<T1>& g1,
14351      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
14352      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
14353      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
14354      const ParamGenerator<T8>& g8)
14355      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
14356          g8_(g8) {}
14357  virtual ~CartesianProductGenerator8() {}
14358
14359  virtual ParamIteratorInterface<ParamType>* Begin() const {
14360    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
14361        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
14362        g7_.begin(), g8_, g8_.begin());
14363  }
14364  virtual ParamIteratorInterface<ParamType>* End() const {
14365    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
14366        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
14367        g8_.end());
14368  }
14369
14370 private:
14371  class Iterator : public ParamIteratorInterface<ParamType> {
14372   public:
14373    Iterator(const ParamGeneratorInterface<ParamType>* base,
14374      const ParamGenerator<T1>& g1,
14375      const typename ParamGenerator<T1>::iterator& current1,
14376      const ParamGenerator<T2>& g2,
14377      const typename ParamGenerator<T2>::iterator& current2,
14378      const ParamGenerator<T3>& g3,
14379      const typename ParamGenerator<T3>::iterator& current3,
14380      const ParamGenerator<T4>& g4,
14381      const typename ParamGenerator<T4>::iterator& current4,
14382      const ParamGenerator<T5>& g5,
14383      const typename ParamGenerator<T5>::iterator& current5,
14384      const ParamGenerator<T6>& g6,
14385      const typename ParamGenerator<T6>::iterator& current6,
14386      const ParamGenerator<T7>& g7,
14387      const typename ParamGenerator<T7>::iterator& current7,
14388      const ParamGenerator<T8>& g8,
14389      const typename ParamGenerator<T8>::iterator& current8)
14390        : base_(base),
14391          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
14392          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
14393          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
14394          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
14395          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
14396          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
14397          begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
14398          begin8_(g8.begin()), end8_(g8.end()), current8_(current8)    {
14399      ComputeCurrentValue();
14400    }
14401    virtual ~Iterator() {}
14402
14403    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
14404      return base_;
14405    }
14406    // Advance should not be called on beyond-of-range iterators
14407    // so no component iterators must be beyond end of range, either.
14408    virtual void Advance() {
14409      assert(!AtEnd());
14410      ++current8_;
14411      if (current8_ == end8_) {
14412        current8_ = begin8_;
14413        ++current7_;
14414      }
14415      if (current7_ == end7_) {
14416        current7_ = begin7_;
14417        ++current6_;
14418      }
14419      if (current6_ == end6_) {
14420        current6_ = begin6_;
14421        ++current5_;
14422      }
14423      if (current5_ == end5_) {
14424        current5_ = begin5_;
14425        ++current4_;
14426      }
14427      if (current4_ == end4_) {
14428        current4_ = begin4_;
14429        ++current3_;
14430      }
14431      if (current3_ == end3_) {
14432        current3_ = begin3_;
14433        ++current2_;
14434      }
14435      if (current2_ == end2_) {
14436        current2_ = begin2_;
14437        ++current1_;
14438      }
14439      ComputeCurrentValue();
14440    }
14441    virtual ParamIteratorInterface<ParamType>* Clone() const {
14442      return new Iterator(*this);
14443    }
14444    virtual const ParamType* Current() const { return &current_value_; }
14445    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
14446      // Having the same base generator guarantees that the other
14447      // iterator is of the same type and we can downcast.
14448      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
14449          << "The program attempted to compare iterators "
14450          << "from different generators." << std::endl;
14451      const Iterator* typed_other =
14452          CheckedDowncastToActualType<const Iterator>(&other);
14453      // We must report iterators equal if they both point beyond their
14454      // respective ranges. That can happen in a variety of fashions,
14455      // so we have to consult AtEnd().
14456      return (AtEnd() && typed_other->AtEnd()) ||
14457         (
14458          current1_ == typed_other->current1_ &&
14459          current2_ == typed_other->current2_ &&
14460          current3_ == typed_other->current3_ &&
14461          current4_ == typed_other->current4_ &&
14462          current5_ == typed_other->current5_ &&
14463          current6_ == typed_other->current6_ &&
14464          current7_ == typed_other->current7_ &&
14465          current8_ == typed_other->current8_);
14466    }
14467
14468   private:
14469    Iterator(const Iterator& other)
14470        : base_(other.base_),
14471        begin1_(other.begin1_),
14472        end1_(other.end1_),
14473        current1_(other.current1_),
14474        begin2_(other.begin2_),
14475        end2_(other.end2_),
14476        current2_(other.current2_),
14477        begin3_(other.begin3_),
14478        end3_(other.end3_),
14479        current3_(other.current3_),
14480        begin4_(other.begin4_),
14481        end4_(other.end4_),
14482        current4_(other.current4_),
14483        begin5_(other.begin5_),
14484        end5_(other.end5_),
14485        current5_(other.current5_),
14486        begin6_(other.begin6_),
14487        end6_(other.end6_),
14488        current6_(other.current6_),
14489        begin7_(other.begin7_),
14490        end7_(other.end7_),
14491        current7_(other.current7_),
14492        begin8_(other.begin8_),
14493        end8_(other.end8_),
14494        current8_(other.current8_) {
14495      ComputeCurrentValue();
14496    }
14497
14498    void ComputeCurrentValue() {
14499      if (!AtEnd())
14500        current_value_ = ParamType(*current1_, *current2_, *current3_,
14501            *current4_, *current5_, *current6_, *current7_, *current8_);
14502    }
14503    bool AtEnd() const {
14504      // We must report iterator past the end of the range when either of the
14505      // component iterators has reached the end of its range.
14506      return
14507          current1_ == end1_ ||
14508          current2_ == end2_ ||
14509          current3_ == end3_ ||
14510          current4_ == end4_ ||
14511          current5_ == end5_ ||
14512          current6_ == end6_ ||
14513          current7_ == end7_ ||
14514          current8_ == end8_;
14515    }
14516
14517    // No implementation - assignment is unsupported.
14518    void operator=(const Iterator& other);
14519
14520    const ParamGeneratorInterface<ParamType>* const base_;
14521    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
14522    // current[i]_ is the actual traversing iterator.
14523    const typename ParamGenerator<T1>::iterator begin1_;
14524    const typename ParamGenerator<T1>::iterator end1_;
14525    typename ParamGenerator<T1>::iterator current1_;
14526    const typename ParamGenerator<T2>::iterator begin2_;
14527    const typename ParamGenerator<T2>::iterator end2_;
14528    typename ParamGenerator<T2>::iterator current2_;
14529    const typename ParamGenerator<T3>::iterator begin3_;
14530    const typename ParamGenerator<T3>::iterator end3_;
14531    typename ParamGenerator<T3>::iterator current3_;
14532    const typename ParamGenerator<T4>::iterator begin4_;
14533    const typename ParamGenerator<T4>::iterator end4_;
14534    typename ParamGenerator<T4>::iterator current4_;
14535    const typename ParamGenerator<T5>::iterator begin5_;
14536    const typename ParamGenerator<T5>::iterator end5_;
14537    typename ParamGenerator<T5>::iterator current5_;
14538    const typename ParamGenerator<T6>::iterator begin6_;
14539    const typename ParamGenerator<T6>::iterator end6_;
14540    typename ParamGenerator<T6>::iterator current6_;
14541    const typename ParamGenerator<T7>::iterator begin7_;
14542    const typename ParamGenerator<T7>::iterator end7_;
14543    typename ParamGenerator<T7>::iterator current7_;
14544    const typename ParamGenerator<T8>::iterator begin8_;
14545    const typename ParamGenerator<T8>::iterator end8_;
14546    typename ParamGenerator<T8>::iterator current8_;
14547    ParamType current_value_;
14548  };  // class CartesianProductGenerator8::Iterator
14549
14550  // No implementation - assignment is unsupported.
14551  void operator=(const CartesianProductGenerator8& other);
14552
14553  const ParamGenerator<T1> g1_;
14554  const ParamGenerator<T2> g2_;
14555  const ParamGenerator<T3> g3_;
14556  const ParamGenerator<T4> g4_;
14557  const ParamGenerator<T5> g5_;
14558  const ParamGenerator<T6> g6_;
14559  const ParamGenerator<T7> g7_;
14560  const ParamGenerator<T8> g8_;
14561};  // class CartesianProductGenerator8
14562
14563
14564template <typename T1, typename T2, typename T3, typename T4, typename T5,
14565    typename T6, typename T7, typename T8, typename T9>
14566class CartesianProductGenerator9
14567    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
14568        T7, T8, T9> > {
14569 public:
14570  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;
14571
14572  CartesianProductGenerator9(const ParamGenerator<T1>& g1,
14573      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
14574      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
14575      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
14576      const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9)
14577      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
14578          g9_(g9) {}
14579  virtual ~CartesianProductGenerator9() {}
14580
14581  virtual ParamIteratorInterface<ParamType>* Begin() const {
14582    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
14583        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
14584        g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin());
14585  }
14586  virtual ParamIteratorInterface<ParamType>* End() const {
14587    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
14588        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
14589        g8_.end(), g9_, g9_.end());
14590  }
14591
14592 private:
14593  class Iterator : public ParamIteratorInterface<ParamType> {
14594   public:
14595    Iterator(const ParamGeneratorInterface<ParamType>* base,
14596      const ParamGenerator<T1>& g1,
14597      const typename ParamGenerator<T1>::iterator& current1,
14598      const ParamGenerator<T2>& g2,
14599      const typename ParamGenerator<T2>::iterator& current2,
14600      const ParamGenerator<T3>& g3,
14601      const typename ParamGenerator<T3>::iterator& current3,
14602      const ParamGenerator<T4>& g4,
14603      const typename ParamGenerator<T4>::iterator& current4,
14604      const ParamGenerator<T5>& g5,
14605      const typename ParamGenerator<T5>::iterator& current5,
14606      const ParamGenerator<T6>& g6,
14607      const typename ParamGenerator<T6>::iterator& current6,
14608      const ParamGenerator<T7>& g7,
14609      const typename ParamGenerator<T7>::iterator& current7,
14610      const ParamGenerator<T8>& g8,
14611      const typename ParamGenerator<T8>::iterator& current8,
14612      const ParamGenerator<T9>& g9,
14613      const typename ParamGenerator<T9>::iterator& current9)
14614        : base_(base),
14615          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
14616          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
14617          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
14618          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
14619          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
14620          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
14621          begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
14622          begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
14623          begin9_(g9.begin()), end9_(g9.end()), current9_(current9)    {
14624      ComputeCurrentValue();
14625    }
14626    virtual ~Iterator() {}
14627
14628    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
14629      return base_;
14630    }
14631    // Advance should not be called on beyond-of-range iterators
14632    // so no component iterators must be beyond end of range, either.
14633    virtual void Advance() {
14634      assert(!AtEnd());
14635      ++current9_;
14636      if (current9_ == end9_) {
14637        current9_ = begin9_;
14638        ++current8_;
14639      }
14640      if (current8_ == end8_) {
14641        current8_ = begin8_;
14642        ++current7_;
14643      }
14644      if (current7_ == end7_) {
14645        current7_ = begin7_;
14646        ++current6_;
14647      }
14648      if (current6_ == end6_) {
14649        current6_ = begin6_;
14650        ++current5_;
14651      }
14652      if (current5_ == end5_) {
14653        current5_ = begin5_;
14654        ++current4_;
14655      }
14656      if (current4_ == end4_) {
14657        current4_ = begin4_;
14658        ++current3_;
14659      }
14660      if (current3_ == end3_) {
14661        current3_ = begin3_;
14662        ++current2_;
14663      }
14664      if (current2_ == end2_) {
14665        current2_ = begin2_;
14666        ++current1_;
14667      }
14668      ComputeCurrentValue();
14669    }
14670    virtual ParamIteratorInterface<ParamType>* Clone() const {
14671      return new Iterator(*this);
14672    }
14673    virtual const ParamType* Current() const { return &current_value_; }
14674    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
14675      // Having the same base generator guarantees that the other
14676      // iterator is of the same type and we can downcast.
14677      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
14678          << "The program attempted to compare iterators "
14679          << "from different generators." << std::endl;
14680      const Iterator* typed_other =
14681          CheckedDowncastToActualType<const Iterator>(&other);
14682      // We must report iterators equal if they both point beyond their
14683      // respective ranges. That can happen in a variety of fashions,
14684      // so we have to consult AtEnd().
14685      return (AtEnd() && typed_other->AtEnd()) ||
14686         (
14687          current1_ == typed_other->current1_ &&
14688          current2_ == typed_other->current2_ &&
14689          current3_ == typed_other->current3_ &&
14690          current4_ == typed_other->current4_ &&
14691          current5_ == typed_other->current5_ &&
14692          current6_ == typed_other->current6_ &&
14693          current7_ == typed_other->current7_ &&
14694          current8_ == typed_other->current8_ &&
14695          current9_ == typed_other->current9_);
14696    }
14697
14698   private:
14699    Iterator(const Iterator& other)
14700        : base_(other.base_),
14701        begin1_(other.begin1_),
14702        end1_(other.end1_),
14703        current1_(other.current1_),
14704        begin2_(other.begin2_),
14705        end2_(other.end2_),
14706        current2_(other.current2_),
14707        begin3_(other.begin3_),
14708        end3_(other.end3_),
14709        current3_(other.current3_),
14710        begin4_(other.begin4_),
14711        end4_(other.end4_),
14712        current4_(other.current4_),
14713        begin5_(other.begin5_),
14714        end5_(other.end5_),
14715        current5_(other.current5_),
14716        begin6_(other.begin6_),
14717        end6_(other.end6_),
14718        current6_(other.current6_),
14719        begin7_(other.begin7_),
14720        end7_(other.end7_),
14721        current7_(other.current7_),
14722        begin8_(other.begin8_),
14723        end8_(other.end8_),
14724        current8_(other.current8_),
14725        begin9_(other.begin9_),
14726        end9_(other.end9_),
14727        current9_(other.current9_) {
14728      ComputeCurrentValue();
14729    }
14730
14731    void ComputeCurrentValue() {
14732      if (!AtEnd())
14733        current_value_ = ParamType(*current1_, *current2_, *current3_,
14734            *current4_, *current5_, *current6_, *current7_, *current8_,
14735            *current9_);
14736    }
14737    bool AtEnd() const {
14738      // We must report iterator past the end of the range when either of the
14739      // component iterators has reached the end of its range.
14740      return
14741          current1_ == end1_ ||
14742          current2_ == end2_ ||
14743          current3_ == end3_ ||
14744          current4_ == end4_ ||
14745          current5_ == end5_ ||
14746          current6_ == end6_ ||
14747          current7_ == end7_ ||
14748          current8_ == end8_ ||
14749          current9_ == end9_;
14750    }
14751
14752    // No implementation - assignment is unsupported.
14753    void operator=(const Iterator& other);
14754
14755    const ParamGeneratorInterface<ParamType>* const base_;
14756    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
14757    // current[i]_ is the actual traversing iterator.
14758    const typename ParamGenerator<T1>::iterator begin1_;
14759    const typename ParamGenerator<T1>::iterator end1_;
14760    typename ParamGenerator<T1>::iterator current1_;
14761    const typename ParamGenerator<T2>::iterator begin2_;
14762    const typename ParamGenerator<T2>::iterator end2_;
14763    typename ParamGenerator<T2>::iterator current2_;
14764    const typename ParamGenerator<T3>::iterator begin3_;
14765    const typename ParamGenerator<T3>::iterator end3_;
14766    typename ParamGenerator<T3>::iterator current3_;
14767    const typename ParamGenerator<T4>::iterator begin4_;
14768    const typename ParamGenerator<T4>::iterator end4_;
14769    typename ParamGenerator<T4>::iterator current4_;
14770    const typename ParamGenerator<T5>::iterator begin5_;
14771    const typename ParamGenerator<T5>::iterator end5_;
14772    typename ParamGenerator<T5>::iterator current5_;
14773    const typename ParamGenerator<T6>::iterator begin6_;
14774    const typename ParamGenerator<T6>::iterator end6_;
14775    typename ParamGenerator<T6>::iterator current6_;
14776    const typename ParamGenerator<T7>::iterator begin7_;
14777    const typename ParamGenerator<T7>::iterator end7_;
14778    typename ParamGenerator<T7>::iterator current7_;
14779    const typename ParamGenerator<T8>::iterator begin8_;
14780    const typename ParamGenerator<T8>::iterator end8_;
14781    typename ParamGenerator<T8>::iterator current8_;
14782    const typename ParamGenerator<T9>::iterator begin9_;
14783    const typename ParamGenerator<T9>::iterator end9_;
14784    typename ParamGenerator<T9>::iterator current9_;
14785    ParamType current_value_;
14786  };  // class CartesianProductGenerator9::Iterator
14787
14788  // No implementation - assignment is unsupported.
14789  void operator=(const CartesianProductGenerator9& other);
14790
14791  const ParamGenerator<T1> g1_;
14792  const ParamGenerator<T2> g2_;
14793  const ParamGenerator<T3> g3_;
14794  const ParamGenerator<T4> g4_;
14795  const ParamGenerator<T5> g5_;
14796  const ParamGenerator<T6> g6_;
14797  const ParamGenerator<T7> g7_;
14798  const ParamGenerator<T8> g8_;
14799  const ParamGenerator<T9> g9_;
14800};  // class CartesianProductGenerator9
14801
14802
14803template <typename T1, typename T2, typename T3, typename T4, typename T5,
14804    typename T6, typename T7, typename T8, typename T9, typename T10>
14805class CartesianProductGenerator10
14806    : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
14807        T7, T8, T9, T10> > {
14808 public:
14809  typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;
14810
14811  CartesianProductGenerator10(const ParamGenerator<T1>& g1,
14812      const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
14813      const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
14814      const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
14815      const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9,
14816      const ParamGenerator<T10>& g10)
14817      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
14818          g9_(g9), g10_(g10) {}
14819  virtual ~CartesianProductGenerator10() {}
14820
14821  virtual ParamIteratorInterface<ParamType>* Begin() const {
14822    return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
14823        g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
14824        g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin());
14825  }
14826  virtual ParamIteratorInterface<ParamType>* End() const {
14827    return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
14828        g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
14829        g8_.end(), g9_, g9_.end(), g10_, g10_.end());
14830  }
14831
14832 private:
14833  class Iterator : public ParamIteratorInterface<ParamType> {
14834   public:
14835    Iterator(const ParamGeneratorInterface<ParamType>* base,
14836      const ParamGenerator<T1>& g1,
14837      const typename ParamGenerator<T1>::iterator& current1,
14838      const ParamGenerator<T2>& g2,
14839      const typename ParamGenerator<T2>::iterator& current2,
14840      const ParamGenerator<T3>& g3,
14841      const typename ParamGenerator<T3>::iterator& current3,
14842      const ParamGenerator<T4>& g4,
14843      const typename ParamGenerator<T4>::iterator& current4,
14844      const ParamGenerator<T5>& g5,
14845      const typename ParamGenerator<T5>::iterator& current5,
14846      const ParamGenerator<T6>& g6,
14847      const typename ParamGenerator<T6>::iterator& current6,
14848      const ParamGenerator<T7>& g7,
14849      const typename ParamGenerator<T7>::iterator& current7,
14850      const ParamGenerator<T8>& g8,
14851      const typename ParamGenerator<T8>::iterator& current8,
14852      const ParamGenerator<T9>& g9,
14853      const typename ParamGenerator<T9>::iterator& current9,
14854      const ParamGenerator<T10>& g10,
14855      const typename ParamGenerator<T10>::iterator& current10)
14856        : base_(base),
14857          begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
14858          begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
14859          begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
14860          begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
14861          begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
14862          begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
14863          begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
14864          begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
14865          begin9_(g9.begin()), end9_(g9.end()), current9_(current9),
14866          begin10_(g10.begin()), end10_(g10.end()), current10_(current10)    {
14867      ComputeCurrentValue();
14868    }
14869    virtual ~Iterator() {}
14870
14871    virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
14872      return base_;
14873    }
14874    // Advance should not be called on beyond-of-range iterators
14875    // so no component iterators must be beyond end of range, either.
14876    virtual void Advance() {
14877      assert(!AtEnd());
14878      ++current10_;
14879      if (current10_ == end10_) {
14880        current10_ = begin10_;
14881        ++current9_;
14882      }
14883      if (current9_ == end9_) {
14884        current9_ = begin9_;
14885        ++current8_;
14886      }
14887      if (current8_ == end8_) {
14888        current8_ = begin8_;
14889        ++current7_;
14890      }
14891      if (current7_ == end7_) {
14892        current7_ = begin7_;
14893        ++current6_;
14894      }
14895      if (current6_ == end6_) {
14896        current6_ = begin6_;
14897        ++current5_;
14898      }
14899      if (current5_ == end5_) {
14900        current5_ = begin5_;
14901        ++current4_;
14902      }
14903      if (current4_ == end4_) {
14904        current4_ = begin4_;
14905        ++current3_;
14906      }
14907      if (current3_ == end3_) {
14908        current3_ = begin3_;
14909        ++current2_;
14910      }
14911      if (current2_ == end2_) {
14912        current2_ = begin2_;
14913        ++current1_;
14914      }
14915      ComputeCurrentValue();
14916    }
14917    virtual ParamIteratorInterface<ParamType>* Clone() const {
14918      return new Iterator(*this);
14919    }
14920    virtual const ParamType* Current() const { return &current_value_; }
14921    virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
14922      // Having the same base generator guarantees that the other
14923      // iterator is of the same type and we can downcast.
14924      GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
14925          << "The program attempted to compare iterators "
14926          << "from different generators." << std::endl;
14927      const Iterator* typed_other =
14928          CheckedDowncastToActualType<const Iterator>(&other);
14929      // We must report iterators equal if they both point beyond their
14930      // respective ranges. That can happen in a variety of fashions,
14931      // so we have to consult AtEnd().
14932      return (AtEnd() && typed_other->AtEnd()) ||
14933         (
14934          current1_ == typed_other->current1_ &&
14935          current2_ == typed_other->current2_ &&
14936          current3_ == typed_other->current3_ &&
14937          current4_ == typed_other->current4_ &&
14938          current5_ == typed_other->current5_ &&
14939          current6_ == typed_other->current6_ &&
14940          current7_ == typed_other->current7_ &&
14941          current8_ == typed_other->current8_ &&
14942          current9_ == typed_other->current9_ &&
14943          current10_ == typed_other->current10_);
14944    }
14945
14946   private:
14947    Iterator(const Iterator& other)
14948        : base_(other.base_),
14949        begin1_(other.begin1_),
14950        end1_(other.end1_),
14951        current1_(other.current1_),
14952        begin2_(other.begin2_),
14953        end2_(other.end2_),
14954        current2_(other.current2_),
14955        begin3_(other.begin3_),
14956        end3_(other.end3_),
14957        current3_(other.current3_),
14958        begin4_(other.begin4_),
14959        end4_(other.end4_),
14960        current4_(other.current4_),
14961        begin5_(other.begin5_),
14962        end5_(other.end5_),
14963        current5_(other.current5_),
14964        begin6_(other.begin6_),
14965        end6_(other.end6_),
14966        current6_(other.current6_),
14967        begin7_(other.begin7_),
14968        end7_(other.end7_),
14969        current7_(other.current7_),
14970        begin8_(other.begin8_),
14971        end8_(other.end8_),
14972        current8_(other.current8_),
14973        begin9_(other.begin9_),
14974        end9_(other.end9_),
14975        current9_(other.current9_),
14976        begin10_(other.begin10_),
14977        end10_(other.end10_),
14978        current10_(other.current10_) {
14979      ComputeCurrentValue();
14980    }
14981
14982    void ComputeCurrentValue() {
14983      if (!AtEnd())
14984        current_value_ = ParamType(*current1_, *current2_, *current3_,
14985            *current4_, *current5_, *current6_, *current7_, *current8_,
14986            *current9_, *current10_);
14987    }
14988    bool AtEnd() const {
14989      // We must report iterator past the end of the range when either of the
14990      // component iterators has reached the end of its range.
14991      return
14992          current1_ == end1_ ||
14993          current2_ == end2_ ||
14994          current3_ == end3_ ||
14995          current4_ == end4_ ||
14996          current5_ == end5_ ||
14997          current6_ == end6_ ||
14998          current7_ == end7_ ||
14999          current8_ == end8_ ||
15000          current9_ == end9_ ||
15001          current10_ == end10_;
15002    }
15003
15004    // No implementation - assignment is unsupported.
15005    void operator=(const Iterator& other);
15006
15007    const ParamGeneratorInterface<ParamType>* const base_;
15008    // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15009    // current[i]_ is the actual traversing iterator.
15010    const typename ParamGenerator<T1>::iterator begin1_;
15011    const typename ParamGenerator<T1>::iterator end1_;
15012    typename ParamGenerator<T1>::iterator current1_;
15013    const typename ParamGenerator<T2>::iterator begin2_;
15014    const typename ParamGenerator<T2>::iterator end2_;
15015    typename ParamGenerator<T2>::iterator current2_;
15016    const typename ParamGenerator<T3>::iterator begin3_;
15017    const typename ParamGenerator<T3>::iterator end3_;
15018    typename ParamGenerator<T3>::iterator current3_;
15019    const typename ParamGenerator<T4>::iterator begin4_;
15020    const typename ParamGenerator<T4>::iterator end4_;
15021    typename ParamGenerator<T4>::iterator current4_;
15022    const typename ParamGenerator<T5>::iterator begin5_;
15023    const typename ParamGenerator<T5>::iterator end5_;
15024    typename ParamGenerator<T5>::iterator current5_;
15025    const typename ParamGenerator<T6>::iterator begin6_;
15026    const typename ParamGenerator<T6>::iterator end6_;
15027    typename ParamGenerator<T6>::iterator current6_;
15028    const typename ParamGenerator<T7>::iterator begin7_;
15029    const typename ParamGenerator<T7>::iterator end7_;
15030    typename ParamGenerator<T7>::iterator current7_;
15031    const typename ParamGenerator<T8>::iterator begin8_;
15032    const typename ParamGenerator<T8>::iterator end8_;
15033    typename ParamGenerator<T8>::iterator current8_;
15034    const typename ParamGenerator<T9>::iterator begin9_;
15035    const typename ParamGenerator<T9>::iterator end9_;
15036    typename ParamGenerator<T9>::iterator current9_;
15037    const typename ParamGenerator<T10>::iterator begin10_;
15038    const typename ParamGenerator<T10>::iterator end10_;
15039    typename ParamGenerator<T10>::iterator current10_;
15040    ParamType current_value_;
15041  };  // class CartesianProductGenerator10::Iterator
15042
15043  // No implementation - assignment is unsupported.
15044  void operator=(const CartesianProductGenerator10& other);
15045
15046  const ParamGenerator<T1> g1_;
15047  const ParamGenerator<T2> g2_;
15048  const ParamGenerator<T3> g3_;
15049  const ParamGenerator<T4> g4_;
15050  const ParamGenerator<T5> g5_;
15051  const ParamGenerator<T6> g6_;
15052  const ParamGenerator<T7> g7_;
15053  const ParamGenerator<T8> g8_;
15054  const ParamGenerator<T9> g9_;
15055  const ParamGenerator<T10> g10_;
15056};  // class CartesianProductGenerator10
15057
15058
15059// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
15060//
15061// Helper classes providing Combine() with polymorphic features. They allow
15062// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
15063// convertible to U.
15064//
15065template <class Generator1, class Generator2>
15066class CartesianProductHolder2 {
15067 public:
15068CartesianProductHolder2(const Generator1& g1, const Generator2& g2)
15069      : g1_(g1), g2_(g2) {}
15070  template <typename T1, typename T2>
15071  operator ParamGenerator< ::std::tr1::tuple<T1, T2> >() const {
15072    return ParamGenerator< ::std::tr1::tuple<T1, T2> >(
15073        new CartesianProductGenerator2<T1, T2>(
15074        static_cast<ParamGenerator<T1> >(g1_),
15075        static_cast<ParamGenerator<T2> >(g2_)));
15076  }
15077
15078 private:
15079  // No implementation - assignment is unsupported.
15080  void operator=(const CartesianProductHolder2& other);
15081
15082  const Generator1 g1_;
15083  const Generator2 g2_;
15084};  // class CartesianProductHolder2
15085
15086template <class Generator1, class Generator2, class Generator3>
15087class CartesianProductHolder3 {
15088 public:
15089CartesianProductHolder3(const Generator1& g1, const Generator2& g2,
15090    const Generator3& g3)
15091      : g1_(g1), g2_(g2), g3_(g3) {}
15092  template <typename T1, typename T2, typename T3>
15093  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >() const {
15094    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >(
15095        new CartesianProductGenerator3<T1, T2, T3>(
15096        static_cast<ParamGenerator<T1> >(g1_),
15097        static_cast<ParamGenerator<T2> >(g2_),
15098        static_cast<ParamGenerator<T3> >(g3_)));
15099  }
15100
15101 private:
15102  // No implementation - assignment is unsupported.
15103  void operator=(const CartesianProductHolder3& other);
15104
15105  const Generator1 g1_;
15106  const Generator2 g2_;
15107  const Generator3 g3_;
15108};  // class CartesianProductHolder3
15109
15110template <class Generator1, class Generator2, class Generator3,
15111    class Generator4>
15112class CartesianProductHolder4 {
15113 public:
15114CartesianProductHolder4(const Generator1& g1, const Generator2& g2,
15115    const Generator3& g3, const Generator4& g4)
15116      : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
15117  template <typename T1, typename T2, typename T3, typename T4>
15118  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >() const {
15119    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >(
15120        new CartesianProductGenerator4<T1, T2, T3, T4>(
15121        static_cast<ParamGenerator<T1> >(g1_),
15122        static_cast<ParamGenerator<T2> >(g2_),
15123        static_cast<ParamGenerator<T3> >(g3_),
15124        static_cast<ParamGenerator<T4> >(g4_)));
15125  }
15126
15127 private:
15128  // No implementation - assignment is unsupported.
15129  void operator=(const CartesianProductHolder4& other);
15130
15131  const Generator1 g1_;
15132  const Generator2 g2_;
15133  const Generator3 g3_;
15134  const Generator4 g4_;
15135};  // class CartesianProductHolder4
15136
15137template <class Generator1, class Generator2, class Generator3,
15138    class Generator4, class Generator5>
15139class CartesianProductHolder5 {
15140 public:
15141CartesianProductHolder5(const Generator1& g1, const Generator2& g2,
15142    const Generator3& g3, const Generator4& g4, const Generator5& g5)
15143      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
15144  template <typename T1, typename T2, typename T3, typename T4, typename T5>
15145  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >() const {
15146    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >(
15147        new CartesianProductGenerator5<T1, T2, T3, T4, T5>(
15148        static_cast<ParamGenerator<T1> >(g1_),
15149        static_cast<ParamGenerator<T2> >(g2_),
15150        static_cast<ParamGenerator<T3> >(g3_),
15151        static_cast<ParamGenerator<T4> >(g4_),
15152        static_cast<ParamGenerator<T5> >(g5_)));
15153  }
15154
15155 private:
15156  // No implementation - assignment is unsupported.
15157  void operator=(const CartesianProductHolder5& other);
15158
15159  const Generator1 g1_;
15160  const Generator2 g2_;
15161  const Generator3 g3_;
15162  const Generator4 g4_;
15163  const Generator5 g5_;
15164};  // class CartesianProductHolder5
15165
15166template <class Generator1, class Generator2, class Generator3,
15167    class Generator4, class Generator5, class Generator6>
15168class CartesianProductHolder6 {
15169 public:
15170CartesianProductHolder6(const Generator1& g1, const Generator2& g2,
15171    const Generator3& g3, const Generator4& g4, const Generator5& g5,
15172    const Generator6& g6)
15173      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
15174  template <typename T1, typename T2, typename T3, typename T4, typename T5,
15175      typename T6>
15176  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >() const {
15177    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >(
15178        new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>(
15179        static_cast<ParamGenerator<T1> >(g1_),
15180        static_cast<ParamGenerator<T2> >(g2_),
15181        static_cast<ParamGenerator<T3> >(g3_),
15182        static_cast<ParamGenerator<T4> >(g4_),
15183        static_cast<ParamGenerator<T5> >(g5_),
15184        static_cast<ParamGenerator<T6> >(g6_)));
15185  }
15186
15187 private:
15188  // No implementation - assignment is unsupported.
15189  void operator=(const CartesianProductHolder6& other);
15190
15191  const Generator1 g1_;
15192  const Generator2 g2_;
15193  const Generator3 g3_;
15194  const Generator4 g4_;
15195  const Generator5 g5_;
15196  const Generator6 g6_;
15197};  // class CartesianProductHolder6
15198
15199template <class Generator1, class Generator2, class Generator3,
15200    class Generator4, class Generator5, class Generator6, class Generator7>
15201class CartesianProductHolder7 {
15202 public:
15203CartesianProductHolder7(const Generator1& g1, const Generator2& g2,
15204    const Generator3& g3, const Generator4& g4, const Generator5& g5,
15205    const Generator6& g6, const Generator7& g7)
15206      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
15207  template <typename T1, typename T2, typename T3, typename T4, typename T5,
15208      typename T6, typename T7>
15209  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
15210      T7> >() const {
15211    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> >(
15212        new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>(
15213        static_cast<ParamGenerator<T1> >(g1_),
15214        static_cast<ParamGenerator<T2> >(g2_),
15215        static_cast<ParamGenerator<T3> >(g3_),
15216        static_cast<ParamGenerator<T4> >(g4_),
15217        static_cast<ParamGenerator<T5> >(g5_),
15218        static_cast<ParamGenerator<T6> >(g6_),
15219        static_cast<ParamGenerator<T7> >(g7_)));
15220  }
15221
15222 private:
15223  // No implementation - assignment is unsupported.
15224  void operator=(const CartesianProductHolder7& other);
15225
15226  const Generator1 g1_;
15227  const Generator2 g2_;
15228  const Generator3 g3_;
15229  const Generator4 g4_;
15230  const Generator5 g5_;
15231  const Generator6 g6_;
15232  const Generator7 g7_;
15233};  // class CartesianProductHolder7
15234
15235template <class Generator1, class Generator2, class Generator3,
15236    class Generator4, class Generator5, class Generator6, class Generator7,
15237    class Generator8>
15238class CartesianProductHolder8 {
15239 public:
15240CartesianProductHolder8(const Generator1& g1, const Generator2& g2,
15241    const Generator3& g3, const Generator4& g4, const Generator5& g5,
15242    const Generator6& g6, const Generator7& g7, const Generator8& g8)
15243      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
15244          g8_(g8) {}
15245  template <typename T1, typename T2, typename T3, typename T4, typename T5,
15246      typename T6, typename T7, typename T8>
15247  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7,
15248      T8> >() const {
15249    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(
15250        new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>(
15251        static_cast<ParamGenerator<T1> >(g1_),
15252        static_cast<ParamGenerator<T2> >(g2_),
15253        static_cast<ParamGenerator<T3> >(g3_),
15254        static_cast<ParamGenerator<T4> >(g4_),
15255        static_cast<ParamGenerator<T5> >(g5_),
15256        static_cast<ParamGenerator<T6> >(g6_),
15257        static_cast<ParamGenerator<T7> >(g7_),
15258        static_cast<ParamGenerator<T8> >(g8_)));
15259  }
15260
15261 private:
15262  // No implementation - assignment is unsupported.
15263  void operator=(const CartesianProductHolder8& other);
15264
15265  const Generator1 g1_;
15266  const Generator2 g2_;
15267  const Generator3 g3_;
15268  const Generator4 g4_;
15269  const Generator5 g5_;
15270  const Generator6 g6_;
15271  const Generator7 g7_;
15272  const Generator8 g8_;
15273};  // class CartesianProductHolder8
15274
15275template <class Generator1, class Generator2, class Generator3,
15276    class Generator4, class Generator5, class Generator6, class Generator7,
15277    class Generator8, class Generator9>
15278class CartesianProductHolder9 {
15279 public:
15280CartesianProductHolder9(const Generator1& g1, const Generator2& g2,
15281    const Generator3& g3, const Generator4& g4, const Generator5& g5,
15282    const Generator6& g6, const Generator7& g7, const Generator8& g8,
15283    const Generator9& g9)
15284      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
15285          g9_(g9) {}
15286  template <typename T1, typename T2, typename T3, typename T4, typename T5,
15287      typename T6, typename T7, typename T8, typename T9>
15288  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
15289      T9> >() const {
15290    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
15291        T9> >(
15292        new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
15293        static_cast<ParamGenerator<T1> >(g1_),
15294        static_cast<ParamGenerator<T2> >(g2_),
15295        static_cast<ParamGenerator<T3> >(g3_),
15296        static_cast<ParamGenerator<T4> >(g4_),
15297        static_cast<ParamGenerator<T5> >(g5_),
15298        static_cast<ParamGenerator<T6> >(g6_),
15299        static_cast<ParamGenerator<T7> >(g7_),
15300        static_cast<ParamGenerator<T8> >(g8_),
15301        static_cast<ParamGenerator<T9> >(g9_)));
15302  }
15303
15304 private:
15305  // No implementation - assignment is unsupported.
15306  void operator=(const CartesianProductHolder9& other);
15307
15308  const Generator1 g1_;
15309  const Generator2 g2_;
15310  const Generator3 g3_;
15311  const Generator4 g4_;
15312  const Generator5 g5_;
15313  const Generator6 g6_;
15314  const Generator7 g7_;
15315  const Generator8 g8_;
15316  const Generator9 g9_;
15317};  // class CartesianProductHolder9
15318
15319template <class Generator1, class Generator2, class Generator3,
15320    class Generator4, class Generator5, class Generator6, class Generator7,
15321    class Generator8, class Generator9, class Generator10>
15322class CartesianProductHolder10 {
15323 public:
15324CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
15325    const Generator3& g3, const Generator4& g4, const Generator5& g5,
15326    const Generator6& g6, const Generator7& g7, const Generator8& g8,
15327    const Generator9& g9, const Generator10& g10)
15328      : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
15329          g9_(g9), g10_(g10) {}
15330  template <typename T1, typename T2, typename T3, typename T4, typename T5,
15331      typename T6, typename T7, typename T8, typename T9, typename T10>
15332  operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
15333      T9, T10> >() const {
15334    return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
15335        T9, T10> >(
15336        new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
15337            T10>(
15338        static_cast<ParamGenerator<T1> >(g1_),
15339        static_cast<ParamGenerator<T2> >(g2_),
15340        static_cast<ParamGenerator<T3> >(g3_),
15341        static_cast<ParamGenerator<T4> >(g4_),
15342        static_cast<ParamGenerator<T5> >(g5_),
15343        static_cast<ParamGenerator<T6> >(g6_),
15344        static_cast<ParamGenerator<T7> >(g7_),
15345        static_cast<ParamGenerator<T8> >(g8_),
15346        static_cast<ParamGenerator<T9> >(g9_),
15347        static_cast<ParamGenerator<T10> >(g10_)));
15348  }
15349
15350 private:
15351  // No implementation - assignment is unsupported.
15352  void operator=(const CartesianProductHolder10& other);
15353
15354  const Generator1 g1_;
15355  const Generator2 g2_;
15356  const Generator3 g3_;
15357  const Generator4 g4_;
15358  const Generator5 g5_;
15359  const Generator6 g6_;
15360  const Generator7 g7_;
15361  const Generator8 g8_;
15362  const Generator9 g9_;
15363  const Generator10 g10_;
15364};  // class CartesianProductHolder10
15365
15366# endif  // GTEST_HAS_COMBINE
15367
15368}  // namespace internal
15369}  // namespace testing
15370
15371#endif  //  GTEST_HAS_PARAM_TEST
15372
15373#endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
15374
15375#if GTEST_HAS_PARAM_TEST
15376
15377namespace testing {
15378
15379// Functions producing parameter generators.
15380//
15381// Google Test uses these generators to produce parameters for value-
15382// parameterized tests. When a parameterized test case is instantiated
15383// with a particular generator, Google Test creates and runs tests
15384// for each element in the sequence produced by the generator.
15385//
15386// In the following sample, tests from test case FooTest are instantiated
15387// each three times with parameter values 3, 5, and 8:
15388//
15389// class FooTest : public TestWithParam<int> { ... };
15390//
15391// TEST_P(FooTest, TestThis) {
15392// }
15393// TEST_P(FooTest, TestThat) {
15394// }
15395// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
15396//
15397
15398// Range() returns generators providing sequences of values in a range.
15399//
15400// Synopsis:
15401// Range(start, end)
15402//   - returns a generator producing a sequence of values {start, start+1,
15403//     start+2, ..., }.
15404// Range(start, end, step)
15405//   - returns a generator producing a sequence of values {start, start+step,
15406//     start+step+step, ..., }.
15407// Notes:
15408//   * The generated sequences never include end. For example, Range(1, 5)
15409//     returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
15410//     returns a generator producing {1, 3, 5, 7}.
15411//   * start and end must have the same type. That type may be any integral or
15412//     floating-point type or a user defined type satisfying these conditions:
15413//     * It must be assignable (have operator=() defined).
15414//     * It must have operator+() (operator+(int-compatible type) for
15415//       two-operand version).
15416//     * It must have operator<() defined.
15417//     Elements in the resulting sequences will also have that type.
15418//   * Condition start < end must be satisfied in order for resulting sequences
15419//     to contain any elements.
15420//
15421template <typename T, typename IncrementT>
15422internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
15423  return internal::ParamGenerator<T>(
15424      new internal::RangeGenerator<T, IncrementT>(start, end, step));
15425}
15426
15427template <typename T>
15428internal::ParamGenerator<T> Range(T start, T end) {
15429  return Range(start, end, 1);
15430}
15431
15432// ValuesIn() function allows generation of tests with parameters coming from
15433// a container.
15434//
15435// Synopsis:
15436// ValuesIn(const T (&array)[N])
15437//   - returns a generator producing sequences with elements from
15438//     a C-style array.
15439// ValuesIn(const Container& container)
15440//   - returns a generator producing sequences with elements from
15441//     an STL-style container.
15442// ValuesIn(Iterator begin, Iterator end)
15443//   - returns a generator producing sequences with elements from
15444//     a range [begin, end) defined by a pair of STL-style iterators. These
15445//     iterators can also be plain C pointers.
15446//
15447// Please note that ValuesIn copies the values from the containers
15448// passed in and keeps them to generate tests in RUN_ALL_TESTS().
15449//
15450// Examples:
15451//
15452// This instantiates tests from test case StringTest
15453// each with C-string values of "foo", "bar", and "baz":
15454//
15455// const char* strings[] = {"foo", "bar", "baz"};
15456// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
15457//
15458// This instantiates tests from test case StlStringTest
15459// each with STL strings with values "a" and "b":
15460//
15461// ::std::vector< ::std::string> GetParameterStrings() {
15462//   ::std::vector< ::std::string> v;
15463//   v.push_back("a");
15464//   v.push_back("b");
15465//   return v;
15466// }
15467//
15468// INSTANTIATE_TEST_CASE_P(CharSequence,
15469//                         StlStringTest,
15470//                         ValuesIn(GetParameterStrings()));
15471//
15472//
15473// This will also instantiate tests from CharTest
15474// each with parameter values 'a' and 'b':
15475//
15476// ::std::list<char> GetParameterChars() {
15477//   ::std::list<char> list;
15478//   list.push_back('a');
15479//   list.push_back('b');
15480//   return list;
15481// }
15482// ::std::list<char> l = GetParameterChars();
15483// INSTANTIATE_TEST_CASE_P(CharSequence2,
15484//                         CharTest,
15485//                         ValuesIn(l.begin(), l.end()));
15486//
15487template <typename ForwardIterator>
15488internal::ParamGenerator<
15489  typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
15490ValuesIn(ForwardIterator begin, ForwardIterator end) {
15491  typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
15492      ::value_type ParamType;
15493  return internal::ParamGenerator<ParamType>(
15494      new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
15495}
15496
15497template <typename T, size_t N>
15498internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
15499  return ValuesIn(array, array + N);
15500}
15501
15502template <class Container>
15503internal::ParamGenerator<typename Container::value_type> ValuesIn(
15504    const Container& container) {
15505  return ValuesIn(container.begin(), container.end());
15506}
15507
15508// Values() allows generating tests from explicitly specified list of
15509// parameters.
15510//
15511// Synopsis:
15512// Values(T v1, T v2, ..., T vN)
15513//   - returns a generator producing sequences with elements v1, v2, ..., vN.
15514//
15515// For example, this instantiates tests from test case BarTest each
15516// with values "one", "two", and "three":
15517//
15518// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
15519//
15520// This instantiates tests from test case BazTest each with values 1, 2, 3.5.
15521// The exact type of values will depend on the type of parameter in BazTest.
15522//
15523// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
15524//
15525// Currently, Values() supports from 1 to 50 parameters.
15526//
15527template <typename T1>
15528internal::ValueArray1<T1> Values(T1 v1) {
15529  return internal::ValueArray1<T1>(v1);
15530}
15531
15532template <typename T1, typename T2>
15533internal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) {
15534  return internal::ValueArray2<T1, T2>(v1, v2);
15535}
15536
15537template <typename T1, typename T2, typename T3>
15538internal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) {
15539  return internal::ValueArray3<T1, T2, T3>(v1, v2, v3);
15540}
15541
15542template <typename T1, typename T2, typename T3, typename T4>
15543internal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) {
15544  return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4);
15545}
15546
15547template <typename T1, typename T2, typename T3, typename T4, typename T5>
15548internal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4,
15549    T5 v5) {
15550  return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);
15551}
15552
15553template <typename T1, typename T2, typename T3, typename T4, typename T5,
15554    typename T6>
15555internal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3,
15556    T4 v4, T5 v5, T6 v6) {
15557  return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6);
15558}
15559
15560template <typename T1, typename T2, typename T3, typename T4, typename T5,
15561    typename T6, typename T7>
15562internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3,
15563    T4 v4, T5 v5, T6 v6, T7 v7) {
15564  return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5,
15565      v6, v7);
15566}
15567
15568template <typename T1, typename T2, typename T3, typename T4, typename T5,
15569    typename T6, typename T7, typename T8>
15570internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2,
15571    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {
15572  return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4,
15573      v5, v6, v7, v8);
15574}
15575
15576template <typename T1, typename T2, typename T3, typename T4, typename T5,
15577    typename T6, typename T7, typename T8, typename T9>
15578internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2,
15579    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {
15580  return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3,
15581      v4, v5, v6, v7, v8, v9);
15582}
15583
15584template <typename T1, typename T2, typename T3, typename T4, typename T5,
15585    typename T6, typename T7, typename T8, typename T9, typename T10>
15586internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1,
15587    T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) {
15588  return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1,
15589      v2, v3, v4, v5, v6, v7, v8, v9, v10);
15590}
15591
15592template <typename T1, typename T2, typename T3, typename T4, typename T5,
15593    typename T6, typename T7, typename T8, typename T9, typename T10,
15594    typename T11>
15595internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
15596    T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
15597    T10 v10, T11 v11) {
15598  return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
15599      T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
15600}
15601
15602template <typename T1, typename T2, typename T3, typename T4, typename T5,
15603    typename T6, typename T7, typename T8, typename T9, typename T10,
15604    typename T11, typename T12>
15605internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15606    T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
15607    T10 v10, T11 v11, T12 v12) {
15608  return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15609      T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);
15610}
15611
15612template <typename T1, typename T2, typename T3, typename T4, typename T5,
15613    typename T6, typename T7, typename T8, typename T9, typename T10,
15614    typename T11, typename T12, typename T13>
15615internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
15616    T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
15617    T10 v10, T11 v11, T12 v12, T13 v13) {
15618  return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15619      T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);
15620}
15621
15622template <typename T1, typename T2, typename T3, typename T4, typename T5,
15623    typename T6, typename T7, typename T8, typename T9, typename T10,
15624    typename T11, typename T12, typename T13, typename T14>
15625internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15626    T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
15627    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) {
15628  return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15629      T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
15630      v14);
15631}
15632
15633template <typename T1, typename T2, typename T3, typename T4, typename T5,
15634    typename T6, typename T7, typename T8, typename T9, typename T10,
15635    typename T11, typename T12, typename T13, typename T14, typename T15>
15636internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15637    T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
15638    T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) {
15639  return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15640      T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
15641      v13, v14, v15);
15642}
15643
15644template <typename T1, typename T2, typename T3, typename T4, typename T5,
15645    typename T6, typename T7, typename T8, typename T9, typename T10,
15646    typename T11, typename T12, typename T13, typename T14, typename T15,
15647    typename T16>
15648internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15649    T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
15650    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
15651    T16 v16) {
15652  return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15653      T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
15654      v12, v13, v14, v15, v16);
15655}
15656
15657template <typename T1, typename T2, typename T3, typename T4, typename T5,
15658    typename T6, typename T7, typename T8, typename T9, typename T10,
15659    typename T11, typename T12, typename T13, typename T14, typename T15,
15660    typename T16, typename T17>
15661internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15662    T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
15663    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
15664    T16 v16, T17 v17) {
15665  return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15666      T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
15667      v11, v12, v13, v14, v15, v16, v17);
15668}
15669
15670template <typename T1, typename T2, typename T3, typename T4, typename T5,
15671    typename T6, typename T7, typename T8, typename T9, typename T10,
15672    typename T11, typename T12, typename T13, typename T14, typename T15,
15673    typename T16, typename T17, typename T18>
15674internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15675    T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
15676    T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
15677    T16 v16, T17 v17, T18 v18) {
15678  return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15679      T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
15680      v10, v11, v12, v13, v14, v15, v16, v17, v18);
15681}
15682
15683template <typename T1, typename T2, typename T3, typename T4, typename T5,
15684    typename T6, typename T7, typename T8, typename T9, typename T10,
15685    typename T11, typename T12, typename T13, typename T14, typename T15,
15686    typename T16, typename T17, typename T18, typename T19>
15687internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15688    T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
15689    T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
15690    T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) {
15691  return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15692      T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8,
15693      v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
15694}
15695
15696template <typename T1, typename T2, typename T3, typename T4, typename T5,
15697    typename T6, typename T7, typename T8, typename T9, typename T10,
15698    typename T11, typename T12, typename T13, typename T14, typename T15,
15699    typename T16, typename T17, typename T18, typename T19, typename T20>
15700internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15701    T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4,
15702    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
15703    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) {
15704  return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15705      T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7,
15706      v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20);
15707}
15708
15709template <typename T1, typename T2, typename T3, typename T4, typename T5,
15710    typename T6, typename T7, typename T8, typename T9, typename T10,
15711    typename T11, typename T12, typename T13, typename T14, typename T15,
15712    typename T16, typename T17, typename T18, typename T19, typename T20,
15713    typename T21>
15714internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15715    T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4,
15716    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
15717    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) {
15718  return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15719      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6,
15720      v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21);
15721}
15722
15723template <typename T1, typename T2, typename T3, typename T4, typename T5,
15724    typename T6, typename T7, typename T8, typename T9, typename T10,
15725    typename T11, typename T12, typename T13, typename T14, typename T15,
15726    typename T16, typename T17, typename T18, typename T19, typename T20,
15727    typename T21, typename T22>
15728internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15729    T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3,
15730    T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
15731    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
15732    T21 v21, T22 v22) {
15733  return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15734      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4,
15735      v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
15736      v20, v21, v22);
15737}
15738
15739template <typename T1, typename T2, typename T3, typename T4, typename T5,
15740    typename T6, typename T7, typename T8, typename T9, typename T10,
15741    typename T11, typename T12, typename T13, typename T14, typename T15,
15742    typename T16, typename T17, typename T18, typename T19, typename T20,
15743    typename T21, typename T22, typename T23>
15744internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15745    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2,
15746    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
15747    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
15748    T21 v21, T22 v22, T23 v23) {
15749  return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15750      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3,
15751      v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
15752      v20, v21, v22, v23);
15753}
15754
15755template <typename T1, typename T2, typename T3, typename T4, typename T5,
15756    typename T6, typename T7, typename T8, typename T9, typename T10,
15757    typename T11, typename T12, typename T13, typename T14, typename T15,
15758    typename T16, typename T17, typename T18, typename T19, typename T20,
15759    typename T21, typename T22, typename T23, typename T24>
15760internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15761    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2,
15762    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
15763    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
15764    T21 v21, T22 v22, T23 v23, T24 v24) {
15765  return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15766      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2,
15767      v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
15768      v19, v20, v21, v22, v23, v24);
15769}
15770
15771template <typename T1, typename T2, typename T3, typename T4, typename T5,
15772    typename T6, typename T7, typename T8, typename T9, typename T10,
15773    typename T11, typename T12, typename T13, typename T14, typename T15,
15774    typename T16, typename T17, typename T18, typename T19, typename T20,
15775    typename T21, typename T22, typename T23, typename T24, typename T25>
15776internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15777    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1,
15778    T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
15779    T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
15780    T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) {
15781  return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15782      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1,
15783      v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
15784      v18, v19, v20, v21, v22, v23, v24, v25);
15785}
15786
15787template <typename T1, typename T2, typename T3, typename T4, typename T5,
15788    typename T6, typename T7, typename T8, typename T9, typename T10,
15789    typename T11, typename T12, typename T13, typename T14, typename T15,
15790    typename T16, typename T17, typename T18, typename T19, typename T20,
15791    typename T21, typename T22, typename T23, typename T24, typename T25,
15792    typename T26>
15793internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15794    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
15795    T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
15796    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
15797    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
15798    T26 v26) {
15799  return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15800      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
15801      T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
15802      v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26);
15803}
15804
15805template <typename T1, typename T2, typename T3, typename T4, typename T5,
15806    typename T6, typename T7, typename T8, typename T9, typename T10,
15807    typename T11, typename T12, typename T13, typename T14, typename T15,
15808    typename T16, typename T17, typename T18, typename T19, typename T20,
15809    typename T21, typename T22, typename T23, typename T24, typename T25,
15810    typename T26, typename T27>
15811internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15812    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
15813    T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
15814    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
15815    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
15816    T26 v26, T27 v27) {
15817  return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15818      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
15819      T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
15820      v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);
15821}
15822
15823template <typename T1, typename T2, typename T3, typename T4, typename T5,
15824    typename T6, typename T7, typename T8, typename T9, typename T10,
15825    typename T11, typename T12, typename T13, typename T14, typename T15,
15826    typename T16, typename T17, typename T18, typename T19, typename T20,
15827    typename T21, typename T22, typename T23, typename T24, typename T25,
15828    typename T26, typename T27, typename T28>
15829internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15830    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
15831    T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
15832    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
15833    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
15834    T26 v26, T27 v27, T28 v28) {
15835  return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15836      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
15837      T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
15838      v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
15839      v28);
15840}
15841
15842template <typename T1, typename T2, typename T3, typename T4, typename T5,
15843    typename T6, typename T7, typename T8, typename T9, typename T10,
15844    typename T11, typename T12, typename T13, typename T14, typename T15,
15845    typename T16, typename T17, typename T18, typename T19, typename T20,
15846    typename T21, typename T22, typename T23, typename T24, typename T25,
15847    typename T26, typename T27, typename T28, typename T29>
15848internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15849    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
15850    T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
15851    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
15852    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
15853    T26 v26, T27 v27, T28 v28, T29 v29) {
15854  return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15855      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
15856      T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
15857      v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
15858      v27, v28, v29);
15859}
15860
15861template <typename T1, typename T2, typename T3, typename T4, typename T5,
15862    typename T6, typename T7, typename T8, typename T9, typename T10,
15863    typename T11, typename T12, typename T13, typename T14, typename T15,
15864    typename T16, typename T17, typename T18, typename T19, typename T20,
15865    typename T21, typename T22, typename T23, typename T24, typename T25,
15866    typename T26, typename T27, typename T28, typename T29, typename T30>
15867internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15868    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
15869    T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
15870    T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
15871    T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
15872    T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) {
15873  return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15874      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
15875      T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
15876      v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
15877      v26, v27, v28, v29, v30);
15878}
15879
15880template <typename T1, typename T2, typename T3, typename T4, typename T5,
15881    typename T6, typename T7, typename T8, typename T9, typename T10,
15882    typename T11, typename T12, typename T13, typename T14, typename T15,
15883    typename T16, typename T17, typename T18, typename T19, typename T20,
15884    typename T21, typename T22, typename T23, typename T24, typename T25,
15885    typename T26, typename T27, typename T28, typename T29, typename T30,
15886    typename T31>
15887internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15888    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
15889    T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
15890    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
15891    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
15892    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) {
15893  return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15894      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
15895      T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
15896      v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
15897      v25, v26, v27, v28, v29, v30, v31);
15898}
15899
15900template <typename T1, typename T2, typename T3, typename T4, typename T5,
15901    typename T6, typename T7, typename T8, typename T9, typename T10,
15902    typename T11, typename T12, typename T13, typename T14, typename T15,
15903    typename T16, typename T17, typename T18, typename T19, typename T20,
15904    typename T21, typename T22, typename T23, typename T24, typename T25,
15905    typename T26, typename T27, typename T28, typename T29, typename T30,
15906    typename T31, typename T32>
15907internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15908    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
15909    T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
15910    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
15911    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
15912    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
15913    T32 v32) {
15914  return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15915      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
15916      T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
15917      v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
15918      v24, v25, v26, v27, v28, v29, v30, v31, v32);
15919}
15920
15921template <typename T1, typename T2, typename T3, typename T4, typename T5,
15922    typename T6, typename T7, typename T8, typename T9, typename T10,
15923    typename T11, typename T12, typename T13, typename T14, typename T15,
15924    typename T16, typename T17, typename T18, typename T19, typename T20,
15925    typename T21, typename T22, typename T23, typename T24, typename T25,
15926    typename T26, typename T27, typename T28, typename T29, typename T30,
15927    typename T31, typename T32, typename T33>
15928internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15929    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
15930    T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
15931    T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
15932    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
15933    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
15934    T32 v32, T33 v33) {
15935  return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15936      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
15937      T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8,
15938      v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
15939      v24, v25, v26, v27, v28, v29, v30, v31, v32, v33);
15940}
15941
15942template <typename T1, typename T2, typename T3, typename T4, typename T5,
15943    typename T6, typename T7, typename T8, typename T9, typename T10,
15944    typename T11, typename T12, typename T13, typename T14, typename T15,
15945    typename T16, typename T17, typename T18, typename T19, typename T20,
15946    typename T21, typename T22, typename T23, typename T24, typename T25,
15947    typename T26, typename T27, typename T28, typename T29, typename T30,
15948    typename T31, typename T32, typename T33, typename T34>
15949internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15950    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
15951    T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
15952    T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
15953    T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
15954    T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
15955    T31 v31, T32 v32, T33 v33, T34 v34) {
15956  return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15957      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
15958      T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7,
15959      v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
15960      v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34);
15961}
15962
15963template <typename T1, typename T2, typename T3, typename T4, typename T5,
15964    typename T6, typename T7, typename T8, typename T9, typename T10,
15965    typename T11, typename T12, typename T13, typename T14, typename T15,
15966    typename T16, typename T17, typename T18, typename T19, typename T20,
15967    typename T21, typename T22, typename T23, typename T24, typename T25,
15968    typename T26, typename T27, typename T28, typename T29, typename T30,
15969    typename T31, typename T32, typename T33, typename T34, typename T35>
15970internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15971    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
15972    T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4,
15973    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
15974    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
15975    T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
15976    T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) {
15977  return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
15978      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
15979      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6,
15980      v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
15981      v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35);
15982}
15983
15984template <typename T1, typename T2, typename T3, typename T4, typename T5,
15985    typename T6, typename T7, typename T8, typename T9, typename T10,
15986    typename T11, typename T12, typename T13, typename T14, typename T15,
15987    typename T16, typename T17, typename T18, typename T19, typename T20,
15988    typename T21, typename T22, typename T23, typename T24, typename T25,
15989    typename T26, typename T27, typename T28, typename T29, typename T30,
15990    typename T31, typename T32, typename T33, typename T34, typename T35,
15991    typename T36>
15992internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
15993    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
15994    T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4,
15995    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
15996    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
15997    T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
15998    T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) {
15999  return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16000      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16001      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4,
16002      v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
16003      v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
16004      v34, v35, v36);
16005}
16006
16007template <typename T1, typename T2, typename T3, typename T4, typename T5,
16008    typename T6, typename T7, typename T8, typename T9, typename T10,
16009    typename T11, typename T12, typename T13, typename T14, typename T15,
16010    typename T16, typename T17, typename T18, typename T19, typename T20,
16011    typename T21, typename T22, typename T23, typename T24, typename T25,
16012    typename T26, typename T27, typename T28, typename T29, typename T30,
16013    typename T31, typename T32, typename T33, typename T34, typename T35,
16014    typename T36, typename T37>
16015internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16016    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16017    T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3,
16018    T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
16019    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
16020    T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
16021    T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
16022    T37 v37) {
16023  return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16024      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16025      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3,
16026      v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
16027      v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
16028      v34, v35, v36, v37);
16029}
16030
16031template <typename T1, typename T2, typename T3, typename T4, typename T5,
16032    typename T6, typename T7, typename T8, typename T9, typename T10,
16033    typename T11, typename T12, typename T13, typename T14, typename T15,
16034    typename T16, typename T17, typename T18, typename T19, typename T20,
16035    typename T21, typename T22, typename T23, typename T24, typename T25,
16036    typename T26, typename T27, typename T28, typename T29, typename T30,
16037    typename T31, typename T32, typename T33, typename T34, typename T35,
16038    typename T36, typename T37, typename T38>
16039internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16040    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16041    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2,
16042    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
16043    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
16044    T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
16045    T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
16046    T37 v37, T38 v38) {
16047  return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16048      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16049      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2,
16050      v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
16051      v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32,
16052      v33, v34, v35, v36, v37, v38);
16053}
16054
16055template <typename T1, typename T2, typename T3, typename T4, typename T5,
16056    typename T6, typename T7, typename T8, typename T9, typename T10,
16057    typename T11, typename T12, typename T13, typename T14, typename T15,
16058    typename T16, typename T17, typename T18, typename T19, typename T20,
16059    typename T21, typename T22, typename T23, typename T24, typename T25,
16060    typename T26, typename T27, typename T28, typename T29, typename T30,
16061    typename T31, typename T32, typename T33, typename T34, typename T35,
16062    typename T36, typename T37, typename T38, typename T39>
16063internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16064    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16065    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2,
16066    T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
16067    T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
16068    T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
16069    T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
16070    T37 v37, T38 v38, T39 v39) {
16071  return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16072      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16073      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1,
16074      v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
16075      v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,
16076      v32, v33, v34, v35, v36, v37, v38, v39);
16077}
16078
16079template <typename T1, typename T2, typename T3, typename T4, typename T5,
16080    typename T6, typename T7, typename T8, typename T9, typename T10,
16081    typename T11, typename T12, typename T13, typename T14, typename T15,
16082    typename T16, typename T17, typename T18, typename T19, typename T20,
16083    typename T21, typename T22, typename T23, typename T24, typename T25,
16084    typename T26, typename T27, typename T28, typename T29, typename T30,
16085    typename T31, typename T32, typename T33, typename T34, typename T35,
16086    typename T36, typename T37, typename T38, typename T39, typename T40>
16087internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16088    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16089    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1,
16090    T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
16091    T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
16092    T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27,
16093    T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35,
16094    T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) {
16095  return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16096      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16097      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16098      T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
16099      v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29,
16100      v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40);
16101}
16102
16103template <typename T1, typename T2, typename T3, typename T4, typename T5,
16104    typename T6, typename T7, typename T8, typename T9, typename T10,
16105    typename T11, typename T12, typename T13, typename T14, typename T15,
16106    typename T16, typename T17, typename T18, typename T19, typename T20,
16107    typename T21, typename T22, typename T23, typename T24, typename T25,
16108    typename T26, typename T27, typename T28, typename T29, typename T30,
16109    typename T31, typename T32, typename T33, typename T34, typename T35,
16110    typename T36, typename T37, typename T38, typename T39, typename T40,
16111    typename T41>
16112internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16113    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16114    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
16115    T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16116    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
16117    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
16118    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
16119    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) {
16120  return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16121      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16122      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16123      T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
16124      v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28,
16125      v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41);
16126}
16127
16128template <typename T1, typename T2, typename T3, typename T4, typename T5,
16129    typename T6, typename T7, typename T8, typename T9, typename T10,
16130    typename T11, typename T12, typename T13, typename T14, typename T15,
16131    typename T16, typename T17, typename T18, typename T19, typename T20,
16132    typename T21, typename T22, typename T23, typename T24, typename T25,
16133    typename T26, typename T27, typename T28, typename T29, typename T30,
16134    typename T31, typename T32, typename T33, typename T34, typename T35,
16135    typename T36, typename T37, typename T38, typename T39, typename T40,
16136    typename T41, typename T42>
16137internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16138    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16139    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
16140    T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16141    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
16142    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
16143    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
16144    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
16145    T42 v42) {
16146  return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16147      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16148      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16149      T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
16150      v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
16151      v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41,
16152      v42);
16153}
16154
16155template <typename T1, typename T2, typename T3, typename T4, typename T5,
16156    typename T6, typename T7, typename T8, typename T9, typename T10,
16157    typename T11, typename T12, typename T13, typename T14, typename T15,
16158    typename T16, typename T17, typename T18, typename T19, typename T20,
16159    typename T21, typename T22, typename T23, typename T24, typename T25,
16160    typename T26, typename T27, typename T28, typename T29, typename T30,
16161    typename T31, typename T32, typename T33, typename T34, typename T35,
16162    typename T36, typename T37, typename T38, typename T39, typename T40,
16163    typename T41, typename T42, typename T43>
16164internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16165    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16166    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
16167    T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16168    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
16169    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
16170    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
16171    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
16172    T42 v42, T43 v43) {
16173  return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16174      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16175      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16176      T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
16177      v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
16178      v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40,
16179      v41, v42, v43);
16180}
16181
16182template <typename T1, typename T2, typename T3, typename T4, typename T5,
16183    typename T6, typename T7, typename T8, typename T9, typename T10,
16184    typename T11, typename T12, typename T13, typename T14, typename T15,
16185    typename T16, typename T17, typename T18, typename T19, typename T20,
16186    typename T21, typename T22, typename T23, typename T24, typename T25,
16187    typename T26, typename T27, typename T28, typename T29, typename T30,
16188    typename T31, typename T32, typename T33, typename T34, typename T35,
16189    typename T36, typename T37, typename T38, typename T39, typename T40,
16190    typename T41, typename T42, typename T43, typename T44>
16191internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16192    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16193    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16194    T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
16195    T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
16196    T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
16197    T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
16198    T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
16199    T42 v42, T43 v43, T44 v44) {
16200  return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16201      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16202      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16203      T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
16204      v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
16205      v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39,
16206      v40, v41, v42, v43, v44);
16207}
16208
16209template <typename T1, typename T2, typename T3, typename T4, typename T5,
16210    typename T6, typename T7, typename T8, typename T9, typename T10,
16211    typename T11, typename T12, typename T13, typename T14, typename T15,
16212    typename T16, typename T17, typename T18, typename T19, typename T20,
16213    typename T21, typename T22, typename T23, typename T24, typename T25,
16214    typename T26, typename T27, typename T28, typename T29, typename T30,
16215    typename T31, typename T32, typename T33, typename T34, typename T35,
16216    typename T36, typename T37, typename T38, typename T39, typename T40,
16217    typename T41, typename T42, typename T43, typename T44, typename T45>
16218internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16219    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16220    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16221    T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
16222    T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
16223    T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
16224    T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
16225    T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
16226    T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) {
16227  return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16228      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16229      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16230      T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
16231      v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
16232      v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38,
16233      v39, v40, v41, v42, v43, v44, v45);
16234}
16235
16236template <typename T1, typename T2, typename T3, typename T4, typename T5,
16237    typename T6, typename T7, typename T8, typename T9, typename T10,
16238    typename T11, typename T12, typename T13, typename T14, typename T15,
16239    typename T16, typename T17, typename T18, typename T19, typename T20,
16240    typename T21, typename T22, typename T23, typename T24, typename T25,
16241    typename T26, typename T27, typename T28, typename T29, typename T30,
16242    typename T31, typename T32, typename T33, typename T34, typename T35,
16243    typename T36, typename T37, typename T38, typename T39, typename T40,
16244    typename T41, typename T42, typename T43, typename T44, typename T45,
16245    typename T46>
16246internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16247    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16248    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16249    T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
16250    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
16251    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
16252    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
16253    T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
16254    T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) {
16255  return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16256      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16257      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16258      T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
16259      v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
16260      v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
16261      v38, v39, v40, v41, v42, v43, v44, v45, v46);
16262}
16263
16264template <typename T1, typename T2, typename T3, typename T4, typename T5,
16265    typename T6, typename T7, typename T8, typename T9, typename T10,
16266    typename T11, typename T12, typename T13, typename T14, typename T15,
16267    typename T16, typename T17, typename T18, typename T19, typename T20,
16268    typename T21, typename T22, typename T23, typename T24, typename T25,
16269    typename T26, typename T27, typename T28, typename T29, typename T30,
16270    typename T31, typename T32, typename T33, typename T34, typename T35,
16271    typename T36, typename T37, typename T38, typename T39, typename T40,
16272    typename T41, typename T42, typename T43, typename T44, typename T45,
16273    typename T46, typename T47>
16274internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16275    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16276    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16277    T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
16278    T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
16279    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
16280    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
16281    T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
16282    T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) {
16283  return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16284      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16285      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16286      T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8,
16287      v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
16288      v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
16289      v38, v39, v40, v41, v42, v43, v44, v45, v46, v47);
16290}
16291
16292template <typename T1, typename T2, typename T3, typename T4, typename T5,
16293    typename T6, typename T7, typename T8, typename T9, typename T10,
16294    typename T11, typename T12, typename T13, typename T14, typename T15,
16295    typename T16, typename T17, typename T18, typename T19, typename T20,
16296    typename T21, typename T22, typename T23, typename T24, typename T25,
16297    typename T26, typename T27, typename T28, typename T29, typename T30,
16298    typename T31, typename T32, typename T33, typename T34, typename T35,
16299    typename T36, typename T37, typename T38, typename T39, typename T40,
16300    typename T41, typename T42, typename T43, typename T44, typename T45,
16301    typename T46, typename T47, typename T48>
16302internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16303    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16304    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16305    T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
16306    T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
16307    T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
16308    T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
16309    T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
16310    T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47,
16311    T48 v48) {
16312  return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16313      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16314      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16315      T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7,
16316      v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
16317      v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36,
16318      v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48);
16319}
16320
16321template <typename T1, typename T2, typename T3, typename T4, typename T5,
16322    typename T6, typename T7, typename T8, typename T9, typename T10,
16323    typename T11, typename T12, typename T13, typename T14, typename T15,
16324    typename T16, typename T17, typename T18, typename T19, typename T20,
16325    typename T21, typename T22, typename T23, typename T24, typename T25,
16326    typename T26, typename T27, typename T28, typename T29, typename T30,
16327    typename T31, typename T32, typename T33, typename T34, typename T35,
16328    typename T36, typename T37, typename T38, typename T39, typename T40,
16329    typename T41, typename T42, typename T43, typename T44, typename T45,
16330    typename T46, typename T47, typename T48, typename T49>
16331internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16332    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16333    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16334    T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
16335    T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
16336    T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
16337    T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
16338    T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38,
16339    T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46,
16340    T47 v47, T48 v48, T49 v49) {
16341  return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16342      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16343      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16344      T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6,
16345      v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
16346      v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35,
16347      v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49);
16348}
16349
16350template <typename T1, typename T2, typename T3, typename T4, typename T5,
16351    typename T6, typename T7, typename T8, typename T9, typename T10,
16352    typename T11, typename T12, typename T13, typename T14, typename T15,
16353    typename T16, typename T17, typename T18, typename T19, typename T20,
16354    typename T21, typename T22, typename T23, typename T24, typename T25,
16355    typename T26, typename T27, typename T28, typename T29, typename T30,
16356    typename T31, typename T32, typename T33, typename T34, typename T35,
16357    typename T36, typename T37, typename T38, typename T39, typename T40,
16358    typename T41, typename T42, typename T43, typename T44, typename T45,
16359    typename T46, typename T47, typename T48, typename T49, typename T50>
16360internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
16361    T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
16362    T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
16363    T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4,
16364    T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
16365    T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
16366    T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
16367    T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37,
16368    T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45,
16369    T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) {
16370  return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
16371      T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
16372      T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
16373      T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4,
16374      v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
16375      v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
16376      v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,
16377      v48, v49, v50);
16378}
16379
16380// Bool() allows generating tests with parameters in a set of (false, true).
16381//
16382// Synopsis:
16383// Bool()
16384//   - returns a generator producing sequences with elements {false, true}.
16385//
16386// It is useful when testing code that depends on Boolean flags. Combinations
16387// of multiple flags can be tested when several Bool()'s are combined using
16388// Combine() function.
16389//
16390// In the following example all tests in the test case FlagDependentTest
16391// will be instantiated twice with parameters false and true.
16392//
16393// class FlagDependentTest : public testing::TestWithParam<bool> {
16394//   virtual void SetUp() {
16395//     external_flag = GetParam();
16396//   }
16397// }
16398// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
16399//
16400inline internal::ParamGenerator<bool> Bool() {
16401  return Values(false, true);
16402}
16403
16404# if GTEST_HAS_COMBINE
16405// Combine() allows the user to combine two or more sequences to produce
16406// values of a Cartesian product of those sequences' elements.
16407//
16408// Synopsis:
16409// Combine(gen1, gen2, ..., genN)
16410//   - returns a generator producing sequences with elements coming from
16411//     the Cartesian product of elements from the sequences generated by
16412//     gen1, gen2, ..., genN. The sequence elements will have a type of
16413//     tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
16414//     of elements from sequences produces by gen1, gen2, ..., genN.
16415//
16416// Combine can have up to 10 arguments. This number is currently limited
16417// by the maximum number of elements in the tuple implementation used by Google
16418// Test.
16419//
16420// Example:
16421//
16422// This will instantiate tests in test case AnimalTest each one with
16423// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
16424// tuple("dog", BLACK), and tuple("dog", WHITE):
16425//
16426// enum Color { BLACK, GRAY, WHITE };
16427// class AnimalTest
16428//     : public testing::TestWithParam<tuple<const char*, Color> > {...};
16429//
16430// TEST_P(AnimalTest, AnimalLooksNice) {...}
16431//
16432// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
16433//                         Combine(Values("cat", "dog"),
16434//                                 Values(BLACK, WHITE)));
16435//
16436// This will instantiate tests in FlagDependentTest with all variations of two
16437// Boolean flags:
16438//
16439// class FlagDependentTest
16440//     : public testing::TestWithParam<tuple(bool, bool)> > {
16441//   virtual void SetUp() {
16442//     // Assigns external_flag_1 and external_flag_2 values from the tuple.
16443//     tie(external_flag_1, external_flag_2) = GetParam();
16444//   }
16445// };
16446//
16447// TEST_P(FlagDependentTest, TestFeature1) {
16448//   // Test your code using external_flag_1 and external_flag_2 here.
16449// }
16450// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
16451//                         Combine(Bool(), Bool()));
16452//
16453template <typename Generator1, typename Generator2>
16454internal::CartesianProductHolder2<Generator1, Generator2> Combine(
16455    const Generator1& g1, const Generator2& g2) {
16456  return internal::CartesianProductHolder2<Generator1, Generator2>(
16457      g1, g2);
16458}
16459
16460template <typename Generator1, typename Generator2, typename Generator3>
16461internal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine(
16462    const Generator1& g1, const Generator2& g2, const Generator3& g3) {
16463  return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
16464      g1, g2, g3);
16465}
16466
16467template <typename Generator1, typename Generator2, typename Generator3,
16468    typename Generator4>
16469internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
16470    Generator4> Combine(
16471    const Generator1& g1, const Generator2& g2, const Generator3& g3,
16472        const Generator4& g4) {
16473  return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
16474      Generator4>(
16475      g1, g2, g3, g4);
16476}
16477
16478template <typename Generator1, typename Generator2, typename Generator3,
16479    typename Generator4, typename Generator5>
16480internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
16481    Generator4, Generator5> Combine(
16482    const Generator1& g1, const Generator2& g2, const Generator3& g3,
16483        const Generator4& g4, const Generator5& g5) {
16484  return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
16485      Generator4, Generator5>(
16486      g1, g2, g3, g4, g5);
16487}
16488
16489template <typename Generator1, typename Generator2, typename Generator3,
16490    typename Generator4, typename Generator5, typename Generator6>
16491internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
16492    Generator4, Generator5, Generator6> Combine(
16493    const Generator1& g1, const Generator2& g2, const Generator3& g3,
16494        const Generator4& g4, const Generator5& g5, const Generator6& g6) {
16495  return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
16496      Generator4, Generator5, Generator6>(
16497      g1, g2, g3, g4, g5, g6);
16498}
16499
16500template <typename Generator1, typename Generator2, typename Generator3,
16501    typename Generator4, typename Generator5, typename Generator6,
16502    typename Generator7>
16503internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
16504    Generator4, Generator5, Generator6, Generator7> Combine(
16505    const Generator1& g1, const Generator2& g2, const Generator3& g3,
16506        const Generator4& g4, const Generator5& g5, const Generator6& g6,
16507        const Generator7& g7) {
16508  return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
16509      Generator4, Generator5, Generator6, Generator7>(
16510      g1, g2, g3, g4, g5, g6, g7);
16511}
16512
16513template <typename Generator1, typename Generator2, typename Generator3,
16514    typename Generator4, typename Generator5, typename Generator6,
16515    typename Generator7, typename Generator8>
16516internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
16517    Generator4, Generator5, Generator6, Generator7, Generator8> Combine(
16518    const Generator1& g1, const Generator2& g2, const Generator3& g3,
16519        const Generator4& g4, const Generator5& g5, const Generator6& g6,
16520        const Generator7& g7, const Generator8& g8) {
16521  return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
16522      Generator4, Generator5, Generator6, Generator7, Generator8>(
16523      g1, g2, g3, g4, g5, g6, g7, g8);
16524}
16525
16526template <typename Generator1, typename Generator2, typename Generator3,
16527    typename Generator4, typename Generator5, typename Generator6,
16528    typename Generator7, typename Generator8, typename Generator9>
16529internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
16530    Generator4, Generator5, Generator6, Generator7, Generator8,
16531    Generator9> Combine(
16532    const Generator1& g1, const Generator2& g2, const Generator3& g3,
16533        const Generator4& g4, const Generator5& g5, const Generator6& g6,
16534        const Generator7& g7, const Generator8& g8, const Generator9& g9) {
16535  return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
16536      Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(
16537      g1, g2, g3, g4, g5, g6, g7, g8, g9);
16538}
16539
16540template <typename Generator1, typename Generator2, typename Generator3,
16541    typename Generator4, typename Generator5, typename Generator6,
16542    typename Generator7, typename Generator8, typename Generator9,
16543    typename Generator10>
16544internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
16545    Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
16546    Generator10> Combine(
16547    const Generator1& g1, const Generator2& g2, const Generator3& g3,
16548        const Generator4& g4, const Generator5& g5, const Generator6& g6,
16549        const Generator7& g7, const Generator8& g8, const Generator9& g9,
16550        const Generator10& g10) {
16551  return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
16552      Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
16553      Generator10>(
16554      g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
16555}
16556# endif  // GTEST_HAS_COMBINE
16557
16558
16559
16560# define TEST_P(test_case_name, test_name) \
16561  class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
16562      : public test_case_name { \
16563   public: \
16564    GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
16565    virtual void TestBody(); \
16566   private: \
16567    static int AddToRegistry() { \
16568      ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
16569          GetTestCasePatternHolder<test_case_name>(\
16570              #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
16571                  #test_case_name, \
16572                  #test_name, \
16573                  new ::testing::internal::TestMetaFactory< \
16574                      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
16575      return 0; \
16576    } \
16577    static int gtest_registering_dummy_; \
16578    GTEST_DISALLOW_COPY_AND_ASSIGN_(\
16579        GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
16580  }; \
16581  int GTEST_TEST_CLASS_NAME_(test_case_name, \
16582                             test_name)::gtest_registering_dummy_ = \
16583      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
16584  void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
16585
16586# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
16587  ::testing::internal::ParamGenerator<test_case_name::ParamType> \
16588      gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
16589  int gtest_##prefix##test_case_name##_dummy_ = \
16590      ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
16591          GetTestCasePatternHolder<test_case_name>(\
16592              #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\
16593                  #prefix, \
16594                  &gtest_##prefix##test_case_name##_EvalGenerator_, \
16595                  __FILE__, __LINE__)
16596
16597}  // namespace testing
16598
16599#endif  // GTEST_HAS_PARAM_TEST
16600
16601#endif  // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
16602// Copyright 2006, Google Inc.
16603// All rights reserved.
16604//
16605// Redistribution and use in source and binary forms, with or without
16606// modification, are permitted provided that the following conditions are
16607// met:
16608//
16609//     * Redistributions of source code must retain the above copyright
16610// notice, this list of conditions and the following disclaimer.
16611//     * Redistributions in binary form must reproduce the above
16612// copyright notice, this list of conditions and the following disclaimer
16613// in the documentation and/or other materials provided with the
16614// distribution.
16615//     * Neither the name of Google Inc. nor the names of its
16616// contributors may be used to endorse or promote products derived from
16617// this software without specific prior written permission.
16618//
16619// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16620// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16621// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16622// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16623// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16624// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16625// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
16626// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
16627// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
16628// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
16629// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16630//
16631// Author: wan@google.com (Zhanyong Wan)
16632//
16633// Google C++ Testing Framework definitions useful in production code.
16634
16635#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
16636#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
16637
16638// When you need to test the private or protected members of a class,
16639// use the FRIEND_TEST macro to declare your tests as friends of the
16640// class.  For example:
16641//
16642// class MyClass {
16643//  private:
16644//   void MyMethod();
16645//   FRIEND_TEST(MyClassTest, MyMethod);
16646// };
16647//
16648// class MyClassTest : public testing::Test {
16649//   // ...
16650// };
16651//
16652// TEST_F(MyClassTest, MyMethod) {
16653//   // Can call MyClass::MyMethod() here.
16654// }
16655
16656#define FRIEND_TEST(test_case_name, test_name)\
16657friend class test_case_name##_##test_name##_Test
16658
16659#endif  // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
16660// Copyright 2008, Google Inc.
16661// All rights reserved.
16662//
16663// Redistribution and use in source and binary forms, with or without
16664// modification, are permitted provided that the following conditions are
16665// met:
16666//
16667//     * Redistributions of source code must retain the above copyright
16668// notice, this list of conditions and the following disclaimer.
16669//     * Redistributions in binary form must reproduce the above
16670// copyright notice, this list of conditions and the following disclaimer
16671// in the documentation and/or other materials provided with the
16672// distribution.
16673//     * Neither the name of Google Inc. nor the names of its
16674// contributors may be used to endorse or promote products derived from
16675// this software without specific prior written permission.
16676//
16677// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16678// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16679// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16680// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16681// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16682// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16683// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
16684// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
16685// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
16686// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
16687// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16688//
16689// Author: mheule@google.com (Markus Heule)
16690//
16691
16692#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
16693#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
16694
16695#include <iosfwd>
16696#include <vector>
16697
16698namespace testing {
16699
16700// A copyable object representing the result of a test part (i.e. an
16701// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
16702//
16703// Don't inherit from TestPartResult as its destructor is not virtual.
16704class GTEST_API_ TestPartResult {
16705 public:
16706  // The possible outcomes of a test part (i.e. an assertion or an
16707  // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
16708  enum Type {
16709    kSuccess,          // Succeeded.
16710    kNonFatalFailure,  // Failed but the test can continue.
16711    kFatalFailure      // Failed and the test should be terminated.
16712  };
16713
16714  // C'tor.  TestPartResult does NOT have a default constructor.
16715  // Always use this constructor (with parameters) to create a
16716  // TestPartResult object.
16717  TestPartResult(Type a_type,
16718                 const char* a_file_name,
16719                 int a_line_number,
16720                 const char* a_message)
16721      : type_(a_type),
16722        file_name_(a_file_name),
16723        line_number_(a_line_number),
16724        summary_(ExtractSummary(a_message)),
16725        message_(a_message) {
16726  }
16727
16728  // Gets the outcome of the test part.
16729  Type type() const { return type_; }
16730
16731  // Gets the name of the source file where the test part took place, or
16732  // NULL if it's unknown.
16733  const char* file_name() const { return file_name_.c_str(); }
16734
16735  // Gets the line in the source file where the test part took place,
16736  // or -1 if it's unknown.
16737  int line_number() const { return line_number_; }
16738
16739  // Gets the summary of the failure message.
16740  const char* summary() const { return summary_.c_str(); }
16741
16742  // Gets the message associated with the test part.
16743  const char* message() const { return message_.c_str(); }
16744
16745  // Returns true iff the test part passed.
16746  bool passed() const { return type_ == kSuccess; }
16747
16748  // Returns true iff the test part failed.
16749  bool failed() const { return type_ != kSuccess; }
16750
16751  // Returns true iff the test part non-fatally failed.
16752  bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
16753
16754  // Returns true iff the test part fatally failed.
16755  bool fatally_failed() const { return type_ == kFatalFailure; }
16756 private:
16757  Type type_;
16758
16759  // Gets the summary of the failure message by omitting the stack
16760  // trace in it.
16761  static internal::String ExtractSummary(const char* message);
16762
16763  // The name of the source file where the test part took place, or
16764  // NULL if the source file is unknown.
16765  internal::String file_name_;
16766  // The line in the source file where the test part took place, or -1
16767  // if the line number is unknown.
16768  int line_number_;
16769  internal::String summary_;  // The test failure summary.
16770  internal::String message_;  // The test failure message.
16771};
16772
16773// Prints a TestPartResult object.
16774std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
16775
16776// An array of TestPartResult objects.
16777//
16778// Don't inherit from TestPartResultArray as its destructor is not
16779// virtual.
16780class GTEST_API_ TestPartResultArray {
16781 public:
16782  TestPartResultArray() {}
16783
16784  // Appends the given TestPartResult to the array.
16785  void Append(const TestPartResult& result);
16786
16787  // Returns the TestPartResult at the given index (0-based).
16788  const TestPartResult& GetTestPartResult(int index) const;
16789
16790  // Returns the number of TestPartResult objects in the array.
16791  int size() const;
16792
16793 private:
16794  std::vector<TestPartResult> array_;
16795
16796  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
16797};
16798
16799// This interface knows how to report a test part result.
16800class TestPartResultReporterInterface {
16801 public:
16802  virtual ~TestPartResultReporterInterface() {}
16803
16804  virtual void ReportTestPartResult(const TestPartResult& result) = 0;
16805};
16806
16807namespace internal {
16808
16809// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
16810// statement generates new fatal failures. To do so it registers itself as the
16811// current test part result reporter. Besides checking if fatal failures were
16812// reported, it only delegates the reporting to the former result reporter.
16813// The original result reporter is restored in the destructor.
16814// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
16815class GTEST_API_ HasNewFatalFailureHelper
16816    : public TestPartResultReporterInterface {
16817 public:
16818  HasNewFatalFailureHelper();
16819  virtual ~HasNewFatalFailureHelper();
16820  virtual void ReportTestPartResult(const TestPartResult& result);
16821  bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
16822 private:
16823  bool has_new_fatal_failure_;
16824  TestPartResultReporterInterface* original_reporter_;
16825
16826  GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
16827};
16828
16829}  // namespace internal
16830
16831}  // namespace testing
16832
16833#endif  // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
16834// Copyright 2008 Google Inc.
16835// All Rights Reserved.
16836//
16837// Redistribution and use in source and binary forms, with or without
16838// modification, are permitted provided that the following conditions are
16839// met:
16840//
16841//     * Redistributions of source code must retain the above copyright
16842// notice, this list of conditions and the following disclaimer.
16843//     * Redistributions in binary form must reproduce the above
16844// copyright notice, this list of conditions and the following disclaimer
16845// in the documentation and/or other materials provided with the
16846// distribution.
16847//     * Neither the name of Google Inc. nor the names of its
16848// contributors may be used to endorse or promote products derived from
16849// this software without specific prior written permission.
16850//
16851// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16852// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16853// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16854// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16855// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16856// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16857// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
16858// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
16859// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
16860// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
16861// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16862//
16863// Author: wan@google.com (Zhanyong Wan)
16864
16865#ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
16866#define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
16867
16868// This header implements typed tests and type-parameterized tests.
16869
16870// Typed (aka type-driven) tests repeat the same test for types in a
16871// list.  You must know which types you want to test with when writing
16872// typed tests. Here's how you do it:
16873
16874#if 0
16875
16876// First, define a fixture class template.  It should be parameterized
16877// by a type.  Remember to derive it from testing::Test.
16878template <typename T>
16879class FooTest : public testing::Test {
16880 public:
16881  ...
16882  typedef std::list<T> List;
16883  static T shared_;
16884  T value_;
16885};
16886
16887// Next, associate a list of types with the test case, which will be
16888// repeated for each type in the list.  The typedef is necessary for
16889// the macro to parse correctly.
16890typedef testing::Types<char, int, unsigned int> MyTypes;
16891TYPED_TEST_CASE(FooTest, MyTypes);
16892
16893// If the type list contains only one type, you can write that type
16894// directly without Types<...>:
16895//   TYPED_TEST_CASE(FooTest, int);
16896
16897// Then, use TYPED_TEST() instead of TEST_F() to define as many typed
16898// tests for this test case as you want.
16899TYPED_TEST(FooTest, DoesBlah) {
16900  // Inside a test, refer to TypeParam to get the type parameter.
16901  // Since we are inside a derived class template, C++ requires use to
16902  // visit the members of FooTest via 'this'.
16903  TypeParam n = this->value_;
16904
16905  // To visit static members of the fixture, add the TestFixture::
16906  // prefix.
16907  n += TestFixture::shared_;
16908
16909  // To refer to typedefs in the fixture, add the "typename
16910  // TestFixture::" prefix.
16911  typename TestFixture::List values;
16912  values.push_back(n);
16913  ...
16914}
16915
16916TYPED_TEST(FooTest, HasPropertyA) { ... }
16917
16918#endif  // 0
16919
16920// Type-parameterized tests are abstract test patterns parameterized
16921// by a type.  Compared with typed tests, type-parameterized tests
16922// allow you to define the test pattern without knowing what the type
16923// parameters are.  The defined pattern can be instantiated with
16924// different types any number of times, in any number of translation
16925// units.
16926//
16927// If you are designing an interface or concept, you can define a
16928// suite of type-parameterized tests to verify properties that any
16929// valid implementation of the interface/concept should have.  Then,
16930// each implementation can easily instantiate the test suite to verify
16931// that it conforms to the requirements, without having to write
16932// similar tests repeatedly.  Here's an example:
16933
16934#if 0
16935
16936// First, define a fixture class template.  It should be parameterized
16937// by a type.  Remember to derive it from testing::Test.
16938template <typename T>
16939class FooTest : public testing::Test {
16940  ...
16941};
16942
16943// Next, declare that you will define a type-parameterized test case
16944// (the _P suffix is for "parameterized" or "pattern", whichever you
16945// prefer):
16946TYPED_TEST_CASE_P(FooTest);
16947
16948// Then, use TYPED_TEST_P() to define as many type-parameterized tests
16949// for this type-parameterized test case as you want.
16950TYPED_TEST_P(FooTest, DoesBlah) {
16951  // Inside a test, refer to TypeParam to get the type parameter.
16952  TypeParam n = 0;
16953  ...
16954}
16955
16956TYPED_TEST_P(FooTest, HasPropertyA) { ... }
16957
16958// Now the tricky part: you need to register all test patterns before
16959// you can instantiate them.  The first argument of the macro is the
16960// test case name; the rest are the names of the tests in this test
16961// case.
16962REGISTER_TYPED_TEST_CASE_P(FooTest,
16963                           DoesBlah, HasPropertyA);
16964
16965// Finally, you are free to instantiate the pattern with the types you
16966// want.  If you put the above code in a header file, you can #include
16967// it in multiple C++ source files and instantiate it multiple times.
16968//
16969// To distinguish different instances of the pattern, the first
16970// argument to the INSTANTIATE_* macro is a prefix that will be added
16971// to the actual test case name.  Remember to pick unique prefixes for
16972// different instances.
16973typedef testing::Types<char, int, unsigned int> MyTypes;
16974INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
16975
16976// If the type list contains only one type, you can write that type
16977// directly without Types<...>:
16978//   INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
16979
16980#endif  // 0
16981
16982
16983// Implements typed tests.
16984
16985#if GTEST_HAS_TYPED_TEST
16986
16987// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
16988//
16989// Expands to the name of the typedef for the type parameters of the
16990// given test case.
16991# define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
16992
16993// The 'Types' template argument below must have spaces around it
16994// since some compilers may choke on '>>' when passing a template
16995// instance (e.g. Types<int>)
16996# define TYPED_TEST_CASE(CaseName, Types) \
16997  typedef ::testing::internal::TypeList< Types >::type \
16998      GTEST_TYPE_PARAMS_(CaseName)
16999
17000# define TYPED_TEST(CaseName, TestName) \
17001  template <typename gtest_TypeParam_> \
17002  class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
17003      : public CaseName<gtest_TypeParam_> { \
17004   private: \
17005    typedef CaseName<gtest_TypeParam_> TestFixture; \
17006    typedef gtest_TypeParam_ TypeParam; \
17007    virtual void TestBody(); \
17008  }; \
17009  bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \
17010      ::testing::internal::TypeParameterizedTest< \
17011          CaseName, \
17012          ::testing::internal::TemplateSel< \
17013              GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \
17014          GTEST_TYPE_PARAMS_(CaseName)>::Register(\
17015              "", #CaseName, #TestName, 0); \
17016  template <typename gtest_TypeParam_> \
17017  void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()
17018
17019#endif  // GTEST_HAS_TYPED_TEST
17020
17021// Implements type-parameterized tests.
17022
17023#if GTEST_HAS_TYPED_TEST_P
17024
17025// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
17026//
17027// Expands to the namespace name that the type-parameterized tests for
17028// the given type-parameterized test case are defined in.  The exact
17029// name of the namespace is subject to change without notice.
17030# define GTEST_CASE_NAMESPACE_(TestCaseName) \
17031  gtest_case_##TestCaseName##_
17032
17033// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
17034//
17035// Expands to the name of the variable used to remember the names of
17036// the defined tests in the given test case.
17037# define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
17038  gtest_typed_test_case_p_state_##TestCaseName##_
17039
17040// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
17041//
17042// Expands to the name of the variable used to remember the names of
17043// the registered tests in the given test case.
17044# define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
17045  gtest_registered_test_names_##TestCaseName##_
17046
17047// The variables defined in the type-parameterized test macros are
17048// static as typically these macros are used in a .h file that can be
17049// #included in multiple translation units linked together.
17050# define TYPED_TEST_CASE_P(CaseName) \
17051  static ::testing::internal::TypedTestCasePState \
17052      GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
17053
17054# define TYPED_TEST_P(CaseName, TestName) \
17055  namespace GTEST_CASE_NAMESPACE_(CaseName) { \
17056  template <typename gtest_TypeParam_> \
17057  class TestName : public CaseName<gtest_TypeParam_> { \
17058   private: \
17059    typedef CaseName<gtest_TypeParam_> TestFixture; \
17060    typedef gtest_TypeParam_ TypeParam; \
17061    virtual void TestBody(); \
17062  }; \
17063  static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
17064      GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\
17065          __FILE__, __LINE__, #CaseName, #TestName); \
17066  } \
17067  template <typename gtest_TypeParam_> \
17068  void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
17069
17070# define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
17071  namespace GTEST_CASE_NAMESPACE_(CaseName) { \
17072  typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
17073  } \
17074  static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \
17075      GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
17076          __FILE__, __LINE__, #__VA_ARGS__)
17077
17078// The 'Types' template argument below must have spaces around it
17079// since some compilers may choke on '>>' when passing a template
17080// instance (e.g. Types<int>)
17081# define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
17082  bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
17083      ::testing::internal::TypeParameterizedTestCase<CaseName, \
17084          GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
17085          ::testing::internal::TypeList< Types >::type>::Register(\
17086              #Prefix, #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))
17087
17088#endif  // GTEST_HAS_TYPED_TEST_P
17089
17090#endif  // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
17091
17092// Depending on the platform, different string classes are available.
17093// On Linux, in addition to ::std::string, Google also makes use of
17094// class ::string, which has the same interface as ::std::string, but
17095// has a different implementation.
17096//
17097// The user can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
17098// ::string is available AND is a distinct type to ::std::string, or
17099// define it to 0 to indicate otherwise.
17100//
17101// If the user's ::std::string and ::string are the same class due to
17102// aliasing, he should define GTEST_HAS_GLOBAL_STRING to 0.
17103//
17104// If the user doesn't define GTEST_HAS_GLOBAL_STRING, it is defined
17105// heuristically.
17106
17107namespace testing {
17108
17109// Declares the flags.
17110
17111// This flag temporary enables the disabled tests.
17112GTEST_DECLARE_bool_(also_run_disabled_tests);
17113
17114// This flag brings the debugger on an assertion failure.
17115GTEST_DECLARE_bool_(break_on_failure);
17116
17117// This flag controls whether Google Test catches all test-thrown exceptions
17118// and logs them as failures.
17119GTEST_DECLARE_bool_(catch_exceptions);
17120
17121// This flag enables using colors in terminal output. Available values are
17122// "yes" to enable colors, "no" (disable colors), or "auto" (the default)
17123// to let Google Test decide.
17124GTEST_DECLARE_string_(color);
17125
17126// This flag sets up the filter to select by name using a glob pattern
17127// the tests to run. If the filter is not given all tests are executed.
17128GTEST_DECLARE_string_(filter);
17129
17130// This flag causes the Google Test to list tests. None of the tests listed
17131// are actually run if the flag is provided.
17132GTEST_DECLARE_bool_(list_tests);
17133
17134// This flag controls whether Google Test emits a detailed XML report to a file
17135// in addition to its normal textual output.
17136GTEST_DECLARE_string_(output);
17137
17138// This flags control whether Google Test prints the elapsed time for each
17139// test.
17140GTEST_DECLARE_bool_(print_time);
17141
17142// This flag specifies the random number seed.
17143GTEST_DECLARE_int32_(random_seed);
17144
17145// This flag sets how many times the tests are repeated. The default value
17146// is 1. If the value is -1 the tests are repeating forever.
17147GTEST_DECLARE_int32_(repeat);
17148
17149// This flag controls whether Google Test includes Google Test internal
17150// stack frames in failure stack traces.
17151GTEST_DECLARE_bool_(show_internal_stack_frames);
17152
17153// When this flag is specified, tests' order is randomized on every iteration.
17154GTEST_DECLARE_bool_(shuffle);
17155
17156// This flag specifies the maximum number of stack frames to be
17157// printed in a failure message.
17158GTEST_DECLARE_int32_(stack_trace_depth);
17159
17160// When this flag is specified, a failed assertion will throw an
17161// exception if exceptions are enabled, or exit the program with a
17162// non-zero code otherwise.
17163GTEST_DECLARE_bool_(throw_on_failure);
17164
17165// When this flag is set with a "host:port" string, on supported
17166// platforms test results are streamed to the specified port on
17167// the specified host machine.
17168GTEST_DECLARE_string_(stream_result_to);
17169
17170// The upper limit for valid stack trace depths.
17171const int kMaxStackTraceDepth = 100;
17172
17173namespace internal {
17174
17175class AssertHelper;
17176class DefaultGlobalTestPartResultReporter;
17177class ExecDeathTest;
17178class NoExecDeathTest;
17179class FinalSuccessChecker;
17180class GTestFlagSaver;
17181class TestResultAccessor;
17182class TestEventListenersAccessor;
17183class TestEventRepeater;
17184class WindowsDeathTest;
17185class UnitTestImpl* GetUnitTestImpl();
17186void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
17187                                    const String& message);
17188
17189// Converts a streamable value to a String.  A NULL pointer is
17190// converted to "(null)".  When the input value is a ::string,
17191// ::std::string, ::wstring, or ::std::wstring object, each NUL
17192// character in it is replaced with "\\0".
17193// Declared in gtest-internal.h but defined here, so that it has access
17194// to the definition of the Message class, required by the ARM
17195// compiler.
17196template <typename T>
17197String StreamableToString(const T& streamable) {
17198  return (Message() << streamable).GetString();
17199}
17200
17201}  // namespace internal
17202
17203// The friend relationship of some of these classes is cyclic.
17204// If we don't forward declare them the compiler might confuse the classes
17205// in friendship clauses with same named classes on the scope.
17206class Test;
17207class TestCase;
17208class TestInfo;
17209class UnitTest;
17210
17211// A class for indicating whether an assertion was successful.  When
17212// the assertion wasn't successful, the AssertionResult object
17213// remembers a non-empty message that describes how it failed.
17214//
17215// To create an instance of this class, use one of the factory functions
17216// (AssertionSuccess() and AssertionFailure()).
17217//
17218// This class is useful for two purposes:
17219//   1. Defining predicate functions to be used with Boolean test assertions
17220//      EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
17221//   2. Defining predicate-format functions to be
17222//      used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
17223//
17224// For example, if you define IsEven predicate:
17225//
17226//   testing::AssertionResult IsEven(int n) {
17227//     if ((n % 2) == 0)
17228//       return testing::AssertionSuccess();
17229//     else
17230//       return testing::AssertionFailure() << n << " is odd";
17231//   }
17232//
17233// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
17234// will print the message
17235//
17236//   Value of: IsEven(Fib(5))
17237//     Actual: false (5 is odd)
17238//   Expected: true
17239//
17240// instead of a more opaque
17241//
17242//   Value of: IsEven(Fib(5))
17243//     Actual: false
17244//   Expected: true
17245//
17246// in case IsEven is a simple Boolean predicate.
17247//
17248// If you expect your predicate to be reused and want to support informative
17249// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
17250// about half as often as positive ones in our tests), supply messages for
17251// both success and failure cases:
17252//
17253//   testing::AssertionResult IsEven(int n) {
17254//     if ((n % 2) == 0)
17255//       return testing::AssertionSuccess() << n << " is even";
17256//     else
17257//       return testing::AssertionFailure() << n << " is odd";
17258//   }
17259//
17260// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
17261//
17262//   Value of: IsEven(Fib(6))
17263//     Actual: true (8 is even)
17264//   Expected: false
17265//
17266// NB: Predicates that support negative Boolean assertions have reduced
17267// performance in positive ones so be careful not to use them in tests
17268// that have lots (tens of thousands) of positive Boolean assertions.
17269//
17270// To use this class with EXPECT_PRED_FORMAT assertions such as:
17271//
17272//   // Verifies that Foo() returns an even number.
17273//   EXPECT_PRED_FORMAT1(IsEven, Foo());
17274//
17275// you need to define:
17276//
17277//   testing::AssertionResult IsEven(const char* expr, int n) {
17278//     if ((n % 2) == 0)
17279//       return testing::AssertionSuccess();
17280//     else
17281//       return testing::AssertionFailure()
17282//         << "Expected: " << expr << " is even\n  Actual: it's " << n;
17283//   }
17284//
17285// If Foo() returns 5, you will see the following message:
17286//
17287//   Expected: Foo() is even
17288//     Actual: it's 5
17289//
17290class GTEST_API_ AssertionResult {
17291 public:
17292  // Copy constructor.
17293  // Used in EXPECT_TRUE/FALSE(assertion_result).
17294  AssertionResult(const AssertionResult& other);
17295  // Used in the EXPECT_TRUE/FALSE(bool_expression).
17296  explicit AssertionResult(bool success) : success_(success) {}
17297
17298  // Returns true iff the assertion succeeded.
17299  operator bool() const { return success_; }  // NOLINT
17300
17301  // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
17302  AssertionResult operator!() const;
17303
17304  // Returns the text streamed into this AssertionResult. Test assertions
17305  // use it when they fail (i.e., the predicate's outcome doesn't match the
17306  // assertion's expectation). When nothing has been streamed into the
17307  // object, returns an empty string.
17308  const char* message() const {
17309    return message_.get() != NULL ?  message_->c_str() : "";
17310  }
17311  // TODO(vladl@google.com): Remove this after making sure no clients use it.
17312  // Deprecated; please use message() instead.
17313  const char* failure_message() const { return message(); }
17314
17315  // Streams a custom failure message into this object.
17316  template <typename T> AssertionResult& operator<<(const T& value) {
17317    AppendMessage(Message() << value);
17318    return *this;
17319  }
17320
17321  // Allows streaming basic output manipulators such as endl or flush into
17322  // this object.
17323  AssertionResult& operator<<(
17324      ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
17325    AppendMessage(Message() << basic_manipulator);
17326    return *this;
17327  }
17328
17329 private:
17330  // Appends the contents of message to message_.
17331  void AppendMessage(const Message& a_message) {
17332    if (message_.get() == NULL)
17333      message_.reset(new ::std::string);
17334    message_->append(a_message.GetString().c_str());
17335  }
17336
17337  // Stores result of the assertion predicate.
17338  bool success_;
17339  // Stores the message describing the condition in case the expectation
17340  // construct is not satisfied with the predicate's outcome.
17341  // Referenced via a pointer to avoid taking too much stack frame space
17342  // with test assertions.
17343  internal::scoped_ptr< ::std::string> message_;
17344
17345  GTEST_DISALLOW_ASSIGN_(AssertionResult);
17346};
17347
17348// Makes a successful assertion result.
17349GTEST_API_ AssertionResult AssertionSuccess();
17350
17351// Makes a failed assertion result.
17352GTEST_API_ AssertionResult AssertionFailure();
17353
17354// Makes a failed assertion result with the given failure message.
17355// Deprecated; use AssertionFailure() << msg.
17356GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
17357
17358// The abstract class that all tests inherit from.
17359//
17360// In Google Test, a unit test program contains one or many TestCases, and
17361// each TestCase contains one or many Tests.
17362//
17363// When you define a test using the TEST macro, you don't need to
17364// explicitly derive from Test - the TEST macro automatically does
17365// this for you.
17366//
17367// The only time you derive from Test is when defining a test fixture
17368// to be used a TEST_F.  For example:
17369//
17370//   class FooTest : public testing::Test {
17371//    protected:
17372//     virtual void SetUp() { ... }
17373//     virtual void TearDown() { ... }
17374//     ...
17375//   };
17376//
17377//   TEST_F(FooTest, Bar) { ... }
17378//   TEST_F(FooTest, Baz) { ... }
17379//
17380// Test is not copyable.
17381class GTEST_API_ Test {
17382 public:
17383  friend class TestInfo;
17384
17385  // Defines types for pointers to functions that set up and tear down
17386  // a test case.
17387  typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc;
17388  typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc;
17389
17390  // The d'tor is virtual as we intend to inherit from Test.
17391  virtual ~Test();
17392
17393  // Sets up the stuff shared by all tests in this test case.
17394  //
17395  // Google Test will call Foo::SetUpTestCase() before running the first
17396  // test in test case Foo.  Hence a sub-class can define its own
17397  // SetUpTestCase() method to shadow the one defined in the super
17398  // class.
17399  static void SetUpTestCase() {}
17400
17401  // Tears down the stuff shared by all tests in this test case.
17402  //
17403  // Google Test will call Foo::TearDownTestCase() after running the last
17404  // test in test case Foo.  Hence a sub-class can define its own
17405  // TearDownTestCase() method to shadow the one defined in the super
17406  // class.
17407  static void TearDownTestCase() {}
17408
17409  // Returns true iff the current test has a fatal failure.
17410  static bool HasFatalFailure();
17411
17412  // Returns true iff the current test has a non-fatal failure.
17413  static bool HasNonfatalFailure();
17414
17415  // Returns true iff the current test has a (either fatal or
17416  // non-fatal) failure.
17417  static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
17418
17419  // Logs a property for the current test.  Only the last value for a given
17420  // key is remembered.
17421  // These are public static so they can be called from utility functions
17422  // that are not members of the test fixture.
17423  // The arguments are const char* instead strings, as Google Test is used
17424  // on platforms where string doesn't compile.
17425  //
17426  // Note that a driving consideration for these RecordProperty methods
17427  // was to produce xml output suited to the Greenspan charting utility,
17428  // which at present will only chart values that fit in a 32-bit int. It
17429  // is the user's responsibility to restrict their values to 32-bit ints
17430  // if they intend them to be used with Greenspan.
17431  static void RecordProperty(const char* key, const char* value);
17432  static void RecordProperty(const char* key, int value);
17433
17434 protected:
17435  // Creates a Test object.
17436  Test();
17437
17438  // Sets up the test fixture.
17439  virtual void SetUp();
17440
17441  // Tears down the test fixture.
17442  virtual void TearDown();
17443
17444 private:
17445  // Returns true iff the current test has the same fixture class as
17446  // the first test in the current test case.
17447  static bool HasSameFixtureClass();
17448
17449  // Runs the test after the test fixture has been set up.
17450  //
17451  // A sub-class must implement this to define the test logic.
17452  //
17453  // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
17454  // Instead, use the TEST or TEST_F macro.
17455  virtual void TestBody() = 0;
17456
17457  // Sets up, executes, and tears down the test.
17458  void Run();
17459
17460  // Deletes self.  We deliberately pick an unusual name for this
17461  // internal method to avoid clashing with names used in user TESTs.
17462  void DeleteSelf_() { delete this; }
17463
17464  // Uses a GTestFlagSaver to save and restore all Google Test flags.
17465  const internal::GTestFlagSaver* const gtest_flag_saver_;
17466
17467  // Often a user mis-spells SetUp() as Setup() and spends a long time
17468  // wondering why it is never called by Google Test.  The declaration of
17469  // the following method is solely for catching such an error at
17470  // compile time:
17471  //
17472  //   - The return type is deliberately chosen to be not void, so it
17473  //   will be a conflict if a user declares void Setup() in his test
17474  //   fixture.
17475  //
17476  //   - This method is private, so it will be another compiler error
17477  //   if a user calls it from his test fixture.
17478  //
17479  // DO NOT OVERRIDE THIS FUNCTION.
17480  //
17481  // If you see an error about overriding the following function or
17482  // about it being private, you have mis-spelled SetUp() as Setup().
17483  struct Setup_should_be_spelled_SetUp {};
17484  virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
17485
17486  // We disallow copying Tests.
17487  GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
17488};
17489
17490typedef internal::TimeInMillis TimeInMillis;
17491
17492// A copyable object representing a user specified test property which can be
17493// output as a key/value string pair.
17494//
17495// Don't inherit from TestProperty as its destructor is not virtual.
17496class TestProperty {
17497 public:
17498  // C'tor.  TestProperty does NOT have a default constructor.
17499  // Always use this constructor (with parameters) to create a
17500  // TestProperty object.
17501  TestProperty(const char* a_key, const char* a_value) :
17502    key_(a_key), value_(a_value) {
17503  }
17504
17505  // Gets the user supplied key.
17506  const char* key() const {
17507    return key_.c_str();
17508  }
17509
17510  // Gets the user supplied value.
17511  const char* value() const {
17512    return value_.c_str();
17513  }
17514
17515  // Sets a new value, overriding the one supplied in the constructor.
17516  void SetValue(const char* new_value) {
17517    value_ = new_value;
17518  }
17519
17520 private:
17521  // The key supplied by the user.
17522  internal::String key_;
17523  // The value supplied by the user.
17524  internal::String value_;
17525};
17526
17527// The result of a single Test.  This includes a list of
17528// TestPartResults, a list of TestProperties, a count of how many
17529// death tests there are in the Test, and how much time it took to run
17530// the Test.
17531//
17532// TestResult is not copyable.
17533class GTEST_API_ TestResult {
17534 public:
17535  // Creates an empty TestResult.
17536  TestResult();
17537
17538  // D'tor.  Do not inherit from TestResult.
17539  ~TestResult();
17540
17541  // Gets the number of all test parts.  This is the sum of the number
17542  // of successful test parts and the number of failed test parts.
17543  int total_part_count() const;
17544
17545  // Returns the number of the test properties.
17546  int test_property_count() const;
17547
17548  // Returns true iff the test passed (i.e. no test part failed).
17549  bool Passed() const { return !Failed(); }
17550
17551  // Returns true iff the test failed.
17552  bool Failed() const;
17553
17554  // Returns true iff the test fatally failed.
17555  bool HasFatalFailure() const;
17556
17557  // Returns true iff the test has a non-fatal failure.
17558  bool HasNonfatalFailure() const;
17559
17560  // Returns the elapsed time, in milliseconds.
17561  TimeInMillis elapsed_time() const { return elapsed_time_; }
17562
17563  // Returns the i-th test part result among all the results. i can range
17564  // from 0 to test_property_count() - 1. If i is not in that range, aborts
17565  // the program.
17566  const TestPartResult& GetTestPartResult(int i) const;
17567
17568  // Returns the i-th test property. i can range from 0 to
17569  // test_property_count() - 1. If i is not in that range, aborts the
17570  // program.
17571  const TestProperty& GetTestProperty(int i) const;
17572
17573 private:
17574  friend class TestInfo;
17575  friend class UnitTest;
17576  friend class internal::DefaultGlobalTestPartResultReporter;
17577  friend class internal::ExecDeathTest;
17578  friend class internal::TestResultAccessor;
17579  friend class internal::UnitTestImpl;
17580  friend class internal::WindowsDeathTest;
17581
17582  // Gets the vector of TestPartResults.
17583  const std::vector<TestPartResult>& test_part_results() const {
17584    return test_part_results_;
17585  }
17586
17587  // Gets the vector of TestProperties.
17588  const std::vector<TestProperty>& test_properties() const {
17589    return test_properties_;
17590  }
17591
17592  // Sets the elapsed time.
17593  void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
17594
17595  // Adds a test property to the list. The property is validated and may add
17596  // a non-fatal failure if invalid (e.g., if it conflicts with reserved
17597  // key names). If a property is already recorded for the same key, the
17598  // value will be updated, rather than storing multiple values for the same
17599  // key.
17600  void RecordProperty(const TestProperty& test_property);
17601
17602  // Adds a failure if the key is a reserved attribute of Google Test
17603  // testcase tags.  Returns true if the property is valid.
17604  // TODO(russr): Validate attribute names are legal and human readable.
17605  static bool ValidateTestProperty(const TestProperty& test_property);
17606
17607  // Adds a test part result to the list.
17608  void AddTestPartResult(const TestPartResult& test_part_result);
17609
17610  // Returns the death test count.
17611  int death_test_count() const { return death_test_count_; }
17612
17613  // Increments the death test count, returning the new count.
17614  int increment_death_test_count() { return ++death_test_count_; }
17615
17616  // Clears the test part results.
17617  void ClearTestPartResults();
17618
17619  // Clears the object.
17620  void Clear();
17621
17622  // Protects mutable state of the property vector and of owned
17623  // properties, whose values may be updated.
17624  internal::Mutex test_properites_mutex_;
17625
17626  // The vector of TestPartResults
17627  std::vector<TestPartResult> test_part_results_;
17628  // The vector of TestProperties
17629  std::vector<TestProperty> test_properties_;
17630  // Running count of death tests.
17631  int death_test_count_;
17632  // The elapsed time, in milliseconds.
17633  TimeInMillis elapsed_time_;
17634
17635  // We disallow copying TestResult.
17636  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
17637};  // class TestResult
17638
17639// A TestInfo object stores the following information about a test:
17640//
17641//   Test case name
17642//   Test name
17643//   Whether the test should be run
17644//   A function pointer that creates the test object when invoked
17645//   Test result
17646//
17647// The constructor of TestInfo registers itself with the UnitTest
17648// singleton such that the RUN_ALL_TESTS() macro knows which tests to
17649// run.
17650class GTEST_API_ TestInfo {
17651 public:
17652  // Destructs a TestInfo object.  This function is not virtual, so
17653  // don't inherit from TestInfo.
17654  ~TestInfo();
17655
17656  // Returns the test case name.
17657  const char* test_case_name() const { return test_case_name_.c_str(); }
17658
17659  // Returns the test name.
17660  const char* name() const { return name_.c_str(); }
17661
17662  // Returns the name of the parameter type, or NULL if this is not a typed
17663  // or a type-parameterized test.
17664  const char* type_param() const {
17665    if (type_param_.get() != NULL)
17666      return type_param_->c_str();
17667    return NULL;
17668  }
17669
17670  // Returns the text representation of the value parameter, or NULL if this
17671  // is not a value-parameterized test.
17672  const char* value_param() const {
17673    if (value_param_.get() != NULL)
17674      return value_param_->c_str();
17675    return NULL;
17676  }
17677
17678  // Returns true if this test should run, that is if the test is not disabled
17679  // (or it is disabled but the also_run_disabled_tests flag has been specified)
17680  // and its full name matches the user-specified filter.
17681  //
17682  // Google Test allows the user to filter the tests by their full names.
17683  // The full name of a test Bar in test case Foo is defined as
17684  // "Foo.Bar".  Only the tests that match the filter will run.
17685  //
17686  // A filter is a colon-separated list of glob (not regex) patterns,
17687  // optionally followed by a '-' and a colon-separated list of
17688  // negative patterns (tests to exclude).  A test is run if it
17689  // matches one of the positive patterns and does not match any of
17690  // the negative patterns.
17691  //
17692  // For example, *A*:Foo.* is a filter that matches any string that
17693  // contains the character 'A' or starts with "Foo.".
17694  bool should_run() const { return should_run_; }
17695
17696  // Returns the result of the test.
17697  const TestResult* result() const { return &result_; }
17698
17699 private:
17700
17701#if GTEST_HAS_DEATH_TEST
17702  friend class internal::DefaultDeathTestFactory;
17703#endif  // GTEST_HAS_DEATH_TEST
17704  friend class Test;
17705  friend class TestCase;
17706  friend class internal::UnitTestImpl;
17707  friend TestInfo* internal::MakeAndRegisterTestInfo(
17708      const char* test_case_name, const char* name,
17709      const char* type_param,
17710      const char* value_param,
17711      internal::TypeId fixture_class_id,
17712      Test::SetUpTestCaseFunc set_up_tc,
17713      Test::TearDownTestCaseFunc tear_down_tc,
17714      internal::TestFactoryBase* factory);
17715
17716  // Constructs a TestInfo object. The newly constructed instance assumes
17717  // ownership of the factory object.
17718  TestInfo(const char* test_case_name, const char* name,
17719           const char* a_type_param,
17720           const char* a_value_param,
17721           internal::TypeId fixture_class_id,
17722           internal::TestFactoryBase* factory);
17723
17724  // Increments the number of death tests encountered in this test so
17725  // far.
17726  int increment_death_test_count() {
17727    return result_.increment_death_test_count();
17728  }
17729
17730  // Creates the test object, runs it, records its result, and then
17731  // deletes it.
17732  void Run();
17733
17734  static void ClearTestResult(TestInfo* test_info) {
17735    test_info->result_.Clear();
17736  }
17737
17738  // These fields are immutable properties of the test.
17739  const std::string test_case_name_;     // Test case name
17740  const std::string name_;               // Test name
17741  // Name of the parameter type, or NULL if this is not a typed or a
17742  // type-parameterized test.
17743  const internal::scoped_ptr<const ::std::string> type_param_;
17744  // Text representation of the value parameter, or NULL if this is not a
17745  // value-parameterized test.
17746  const internal::scoped_ptr<const ::std::string> value_param_;
17747  const internal::TypeId fixture_class_id_;   // ID of the test fixture class
17748  bool should_run_;                 // True iff this test should run
17749  bool is_disabled_;                // True iff this test is disabled
17750  bool matches_filter_;             // True if this test matches the
17751                                    // user-specified filter.
17752  internal::TestFactoryBase* const factory_;  // The factory that creates
17753                                              // the test object
17754
17755  // This field is mutable and needs to be reset before running the
17756  // test for the second time.
17757  TestResult result_;
17758
17759  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
17760};
17761
17762// A test case, which consists of a vector of TestInfos.
17763//
17764// TestCase is not copyable.
17765class GTEST_API_ TestCase {
17766 public:
17767  // Creates a TestCase with the given name.
17768  //
17769  // TestCase does NOT have a default constructor.  Always use this
17770  // constructor to create a TestCase object.
17771  //
17772  // Arguments:
17773  //
17774  //   name:         name of the test case
17775  //   a_type_param: the name of the test's type parameter, or NULL if
17776  //                 this is not a type-parameterized test.
17777  //   set_up_tc:    pointer to the function that sets up the test case
17778  //   tear_down_tc: pointer to the function that tears down the test case
17779  TestCase(const char* name, const char* a_type_param,
17780           Test::SetUpTestCaseFunc set_up_tc,
17781           Test::TearDownTestCaseFunc tear_down_tc);
17782
17783  // Destructor of TestCase.
17784  virtual ~TestCase();
17785
17786  // Gets the name of the TestCase.
17787  const char* name() const { return name_.c_str(); }
17788
17789  // Returns the name of the parameter type, or NULL if this is not a
17790  // type-parameterized test case.
17791  const char* type_param() const {
17792    if (type_param_.get() != NULL)
17793      return type_param_->c_str();
17794    return NULL;
17795  }
17796
17797  // Returns true if any test in this test case should run.
17798  bool should_run() const { return should_run_; }
17799
17800  // Gets the number of successful tests in this test case.
17801  int successful_test_count() const;
17802
17803  // Gets the number of failed tests in this test case.
17804  int failed_test_count() const;
17805
17806  // Gets the number of disabled tests in this test case.
17807  int disabled_test_count() const;
17808
17809  // Get the number of tests in this test case that should run.
17810  int test_to_run_count() const;
17811
17812  // Gets the number of all tests in this test case.
17813  int total_test_count() const;
17814
17815  // Returns true iff the test case passed.
17816  bool Passed() const { return !Failed(); }
17817
17818  // Returns true iff the test case failed.
17819  bool Failed() const { return failed_test_count() > 0; }
17820
17821  // Returns the elapsed time, in milliseconds.
17822  TimeInMillis elapsed_time() const { return elapsed_time_; }
17823
17824  // Returns the i-th test among all the tests. i can range from 0 to
17825  // total_test_count() - 1. If i is not in that range, returns NULL.
17826  const TestInfo* GetTestInfo(int i) const;
17827
17828 private:
17829  friend class Test;
17830  friend class internal::UnitTestImpl;
17831
17832  // Gets the (mutable) vector of TestInfos in this TestCase.
17833  std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
17834
17835  // Gets the (immutable) vector of TestInfos in this TestCase.
17836  const std::vector<TestInfo*>& test_info_list() const {
17837    return test_info_list_;
17838  }
17839
17840  // Returns the i-th test among all the tests. i can range from 0 to
17841  // total_test_count() - 1. If i is not in that range, returns NULL.
17842  TestInfo* GetMutableTestInfo(int i);
17843
17844  // Sets the should_run member.
17845  void set_should_run(bool should) { should_run_ = should; }
17846
17847  // Adds a TestInfo to this test case.  Will delete the TestInfo upon
17848  // destruction of the TestCase object.
17849  void AddTestInfo(TestInfo * test_info);
17850
17851  // Clears the results of all tests in this test case.
17852  void ClearResult();
17853
17854  // Clears the results of all tests in the given test case.
17855  static void ClearTestCaseResult(TestCase* test_case) {
17856    test_case->ClearResult();
17857  }
17858
17859  // Runs every test in this TestCase.
17860  void Run();
17861
17862  // Runs SetUpTestCase() for this TestCase.  This wrapper is needed
17863  // for catching exceptions thrown from SetUpTestCase().
17864  void RunSetUpTestCase() { (*set_up_tc_)(); }
17865
17866  // Runs TearDownTestCase() for this TestCase.  This wrapper is
17867  // needed for catching exceptions thrown from TearDownTestCase().
17868  void RunTearDownTestCase() { (*tear_down_tc_)(); }
17869
17870  // Returns true iff test passed.
17871  static bool TestPassed(const TestInfo* test_info) {
17872    return test_info->should_run() && test_info->result()->Passed();
17873  }
17874
17875  // Returns true iff test failed.
17876  static bool TestFailed(const TestInfo* test_info) {
17877    return test_info->should_run() && test_info->result()->Failed();
17878  }
17879
17880  // Returns true iff test is disabled.
17881  static bool TestDisabled(const TestInfo* test_info) {
17882    return test_info->is_disabled_;
17883  }
17884
17885  // Returns true if the given test should run.
17886  static bool ShouldRunTest(const TestInfo* test_info) {
17887    return test_info->should_run();
17888  }
17889
17890  // Shuffles the tests in this test case.
17891  void ShuffleTests(internal::Random* random);
17892
17893  // Restores the test order to before the first shuffle.
17894  void UnshuffleTests();
17895
17896  // Name of the test case.
17897  internal::String name_;
17898  // Name of the parameter type, or NULL if this is not a typed or a
17899  // type-parameterized test.
17900  const internal::scoped_ptr<const ::std::string> type_param_;
17901  // The vector of TestInfos in their original order.  It owns the
17902  // elements in the vector.
17903  std::vector<TestInfo*> test_info_list_;
17904  // Provides a level of indirection for the test list to allow easy
17905  // shuffling and restoring the test order.  The i-th element in this
17906  // vector is the index of the i-th test in the shuffled test list.
17907  std::vector<int> test_indices_;
17908  // Pointer to the function that sets up the test case.
17909  Test::SetUpTestCaseFunc set_up_tc_;
17910  // Pointer to the function that tears down the test case.
17911  Test::TearDownTestCaseFunc tear_down_tc_;
17912  // True iff any test in this test case should run.
17913  bool should_run_;
17914  // Elapsed time, in milliseconds.
17915  TimeInMillis elapsed_time_;
17916
17917  // We disallow copying TestCases.
17918  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
17919};
17920
17921// An Environment object is capable of setting up and tearing down an
17922// environment.  The user should subclass this to define his own
17923// environment(s).
17924//
17925// An Environment object does the set-up and tear-down in virtual
17926// methods SetUp() and TearDown() instead of the constructor and the
17927// destructor, as:
17928//
17929//   1. You cannot safely throw from a destructor.  This is a problem
17930//      as in some cases Google Test is used where exceptions are enabled, and
17931//      we may want to implement ASSERT_* using exceptions where they are
17932//      available.
17933//   2. You cannot use ASSERT_* directly in a constructor or
17934//      destructor.
17935class Environment {
17936 public:
17937  // The d'tor is virtual as we need to subclass Environment.
17938  virtual ~Environment() {}
17939
17940  // Override this to define how to set up the environment.
17941  virtual void SetUp() {}
17942
17943  // Override this to define how to tear down the environment.
17944  virtual void TearDown() {}
17945 private:
17946  // If you see an error about overriding the following function or
17947  // about it being private, you have mis-spelled SetUp() as Setup().
17948  struct Setup_should_be_spelled_SetUp {};
17949  virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
17950};
17951
17952// The interface for tracing execution of tests. The methods are organized in
17953// the order the corresponding events are fired.
17954class TestEventListener {
17955 public:
17956  virtual ~TestEventListener() {}
17957
17958  // Fired before any test activity starts.
17959  virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
17960
17961  // Fired before each iteration of tests starts.  There may be more than
17962  // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
17963  // index, starting from 0.
17964  virtual void OnTestIterationStart(const UnitTest& unit_test,
17965                                    int iteration) = 0;
17966
17967  // Fired before environment set-up for each iteration of tests starts.
17968  virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
17969
17970  // Fired after environment set-up for each iteration of tests ends.
17971  virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
17972
17973  // Fired before the test case starts.
17974  virtual void OnTestCaseStart(const TestCase& test_case) = 0;
17975
17976  // Fired before the test starts.
17977  virtual void OnTestStart(const TestInfo& test_info) = 0;
17978
17979  // Fired after a failed assertion or a SUCCEED() invocation.
17980  virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
17981
17982  // Fired after the test ends.
17983  virtual void OnTestEnd(const TestInfo& test_info) = 0;
17984
17985  // Fired after the test case ends.
17986  virtual void OnTestCaseEnd(const TestCase& test_case) = 0;
17987
17988  // Fired before environment tear-down for each iteration of tests starts.
17989  virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
17990
17991  // Fired after environment tear-down for each iteration of tests ends.
17992  virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
17993
17994  // Fired after each iteration of tests finishes.
17995  virtual void OnTestIterationEnd(const UnitTest& unit_test,
17996                                  int iteration) = 0;
17997
17998  // Fired after all test activities have ended.
17999  virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
18000};
18001
18002// The convenience class for users who need to override just one or two
18003// methods and are not concerned that a possible change to a signature of
18004// the methods they override will not be caught during the build.  For
18005// comments about each method please see the definition of TestEventListener
18006// above.
18007class EmptyTestEventListener : public TestEventListener {
18008 public:
18009  virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
18010  virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
18011                                    int /*iteration*/) {}
18012  virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {}
18013  virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
18014  virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
18015  virtual void OnTestStart(const TestInfo& /*test_info*/) {}
18016  virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {}
18017  virtual void OnTestEnd(const TestInfo& /*test_info*/) {}
18018  virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
18019  virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {}
18020  virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
18021  virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
18022                                  int /*iteration*/) {}
18023  virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
18024};
18025
18026// TestEventListeners lets users add listeners to track events in Google Test.
18027class GTEST_API_ TestEventListeners {
18028 public:
18029  TestEventListeners();
18030  ~TestEventListeners();
18031
18032  // Appends an event listener to the end of the list. Google Test assumes
18033  // the ownership of the listener (i.e. it will delete the listener when
18034  // the test program finishes).
18035  void Append(TestEventListener* listener);
18036
18037  // Removes the given event listener from the list and returns it.  It then
18038  // becomes the caller's responsibility to delete the listener. Returns
18039  // NULL if the listener is not found in the list.
18040  TestEventListener* Release(TestEventListener* listener);
18041
18042  // Returns the standard listener responsible for the default console
18043  // output.  Can be removed from the listeners list to shut down default
18044  // console output.  Note that removing this object from the listener list
18045  // with Release transfers its ownership to the caller and makes this
18046  // function return NULL the next time.
18047  TestEventListener* default_result_printer() const {
18048    return default_result_printer_;
18049  }
18050
18051  // Returns the standard listener responsible for the default XML output
18052  // controlled by the --gtest_output=xml flag.  Can be removed from the
18053  // listeners list by users who want to shut down the default XML output
18054  // controlled by this flag and substitute it with custom one.  Note that
18055  // removing this object from the listener list with Release transfers its
18056  // ownership to the caller and makes this function return NULL the next
18057  // time.
18058  TestEventListener* default_xml_generator() const {
18059    return default_xml_generator_;
18060  }
18061
18062 private:
18063  friend class TestCase;
18064  friend class TestInfo;
18065  friend class internal::DefaultGlobalTestPartResultReporter;
18066  friend class internal::NoExecDeathTest;
18067  friend class internal::TestEventListenersAccessor;
18068  friend class internal::UnitTestImpl;
18069
18070  // Returns repeater that broadcasts the TestEventListener events to all
18071  // subscribers.
18072  TestEventListener* repeater();
18073
18074  // Sets the default_result_printer attribute to the provided listener.
18075  // The listener is also added to the listener list and previous
18076  // default_result_printer is removed from it and deleted. The listener can
18077  // also be NULL in which case it will not be added to the list. Does
18078  // nothing if the previous and the current listener objects are the same.
18079  void SetDefaultResultPrinter(TestEventListener* listener);
18080
18081  // Sets the default_xml_generator attribute to the provided listener.  The
18082  // listener is also added to the listener list and previous
18083  // default_xml_generator is removed from it and deleted. The listener can
18084  // also be NULL in which case it will not be added to the list. Does
18085  // nothing if the previous and the current listener objects are the same.
18086  void SetDefaultXmlGenerator(TestEventListener* listener);
18087
18088  // Controls whether events will be forwarded by the repeater to the
18089  // listeners in the list.
18090  bool EventForwardingEnabled() const;
18091  void SuppressEventForwarding();
18092
18093  // The actual list of listeners.
18094  internal::TestEventRepeater* repeater_;
18095  // Listener responsible for the standard result output.
18096  TestEventListener* default_result_printer_;
18097  // Listener responsible for the creation of the XML output file.
18098  TestEventListener* default_xml_generator_;
18099
18100  // We disallow copying TestEventListeners.
18101  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
18102};
18103
18104// A UnitTest consists of a vector of TestCases.
18105//
18106// This is a singleton class.  The only instance of UnitTest is
18107// created when UnitTest::GetInstance() is first called.  This
18108// instance is never deleted.
18109//
18110// UnitTest is not copyable.
18111//
18112// This class is thread-safe as long as the methods are called
18113// according to their specification.
18114class GTEST_API_ UnitTest {
18115 public:
18116  // Gets the singleton UnitTest object.  The first time this method
18117  // is called, a UnitTest object is constructed and returned.
18118  // Consecutive calls will return the same object.
18119  static UnitTest* GetInstance();
18120
18121  // Runs all tests in this UnitTest object and prints the result.
18122  // Returns 0 if successful, or 1 otherwise.
18123  //
18124  // This method can only be called from the main thread.
18125  //
18126  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18127  int Run() GTEST_MUST_USE_RESULT_;
18128
18129  // Returns the working directory when the first TEST() or TEST_F()
18130  // was executed.  The UnitTest object owns the string.
18131  const char* original_working_dir() const;
18132
18133  // Returns the TestCase object for the test that's currently running,
18134  // or NULL if no test is running.
18135  const TestCase* current_test_case() const;
18136
18137  // Returns the TestInfo object for the test that's currently running,
18138  // or NULL if no test is running.
18139  const TestInfo* current_test_info() const;
18140
18141  // Returns the random seed used at the start of the current test run.
18142  int random_seed() const;
18143
18144#if GTEST_HAS_PARAM_TEST
18145  // Returns the ParameterizedTestCaseRegistry object used to keep track of
18146  // value-parameterized tests and instantiate and register them.
18147  //
18148  // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18149  internal::ParameterizedTestCaseRegistry& parameterized_test_registry();
18150#endif  // GTEST_HAS_PARAM_TEST
18151
18152  // Gets the number of successful test cases.
18153  int successful_test_case_count() const;
18154
18155  // Gets the number of failed test cases.
18156  int failed_test_case_count() const;
18157
18158  // Gets the number of all test cases.
18159  int total_test_case_count() const;
18160
18161  // Gets the number of all test cases that contain at least one test
18162  // that should run.
18163  int test_case_to_run_count() const;
18164
18165  // Gets the number of successful tests.
18166  int successful_test_count() const;
18167
18168  // Gets the number of failed tests.
18169  int failed_test_count() const;
18170
18171  // Gets the number of disabled tests.
18172  int disabled_test_count() const;
18173
18174  // Gets the number of all tests.
18175  int total_test_count() const;
18176
18177  // Gets the number of tests that should run.
18178  int test_to_run_count() const;
18179
18180  // Gets the elapsed time, in milliseconds.
18181  TimeInMillis elapsed_time() const;
18182
18183  // Returns true iff the unit test passed (i.e. all test cases passed).
18184  bool Passed() const;
18185
18186  // Returns true iff the unit test failed (i.e. some test case failed
18187  // or something outside of all tests failed).
18188  bool Failed() const;
18189
18190  // Gets the i-th test case among all the test cases. i can range from 0 to
18191  // total_test_case_count() - 1. If i is not in that range, returns NULL.
18192  const TestCase* GetTestCase(int i) const;
18193
18194  // Returns the list of event listeners that can be used to track events
18195  // inside Google Test.
18196  TestEventListeners& listeners();
18197
18198 private:
18199  // Registers and returns a global test environment.  When a test
18200  // program is run, all global test environments will be set-up in
18201  // the order they were registered.  After all tests in the program
18202  // have finished, all global test environments will be torn-down in
18203  // the *reverse* order they were registered.
18204  //
18205  // The UnitTest object takes ownership of the given environment.
18206  //
18207  // This method can only be called from the main thread.
18208  Environment* AddEnvironment(Environment* env);
18209
18210  // Adds a TestPartResult to the current TestResult object.  All
18211  // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
18212  // eventually call this to report their results.  The user code
18213  // should use the assertion macros instead of calling this directly.
18214  void AddTestPartResult(TestPartResult::Type result_type,
18215                         const char* file_name,
18216                         int line_number,
18217                         const internal::String& message,
18218                         const internal::String& os_stack_trace);
18219
18220  // Adds a TestProperty to the current TestResult object. If the result already
18221  // contains a property with the same key, the value will be updated.
18222  void RecordPropertyForCurrentTest(const char* key, const char* value);
18223
18224  // Gets the i-th test case among all the test cases. i can range from 0 to
18225  // total_test_case_count() - 1. If i is not in that range, returns NULL.
18226  TestCase* GetMutableTestCase(int i);
18227
18228  // Accessors for the implementation object.
18229  internal::UnitTestImpl* impl() { return impl_; }
18230  const internal::UnitTestImpl* impl() const { return impl_; }
18231
18232  // These classes and funcions are friends as they need to access private
18233  // members of UnitTest.
18234  friend class Test;
18235  friend class internal::AssertHelper;
18236  friend class internal::ScopedTrace;
18237  friend Environment* AddGlobalTestEnvironment(Environment* env);
18238  friend internal::UnitTestImpl* internal::GetUnitTestImpl();
18239  friend void internal::ReportFailureInUnknownLocation(
18240      TestPartResult::Type result_type,
18241      const internal::String& message);
18242
18243  // Creates an empty UnitTest.
18244  UnitTest();
18245
18246  // D'tor
18247  virtual ~UnitTest();
18248
18249  // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
18250  // Google Test trace stack.
18251  void PushGTestTrace(const internal::TraceInfo& trace);
18252
18253  // Pops a trace from the per-thread Google Test trace stack.
18254  void PopGTestTrace();
18255
18256  // Protects mutable state in *impl_.  This is mutable as some const
18257  // methods need to lock it too.
18258  mutable internal::Mutex mutex_;
18259
18260  // Opaque implementation object.  This field is never changed once
18261  // the object is constructed.  We don't mark it as const here, as
18262  // doing so will cause a warning in the constructor of UnitTest.
18263  // Mutable state in *impl_ is protected by mutex_.
18264  internal::UnitTestImpl* impl_;
18265
18266  // We disallow copying UnitTest.
18267  GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
18268};
18269
18270// A convenient wrapper for adding an environment for the test
18271// program.
18272//
18273// You should call this before RUN_ALL_TESTS() is called, probably in
18274// main().  If you use gtest_main, you need to call this before main()
18275// starts for it to take effect.  For example, you can define a global
18276// variable like this:
18277//
18278//   testing::Environment* const foo_env =
18279//       testing::AddGlobalTestEnvironment(new FooEnvironment);
18280//
18281// However, we strongly recommend you to write your own main() and
18282// call AddGlobalTestEnvironment() there, as relying on initialization
18283// of global variables makes the code harder to read and may cause
18284// problems when you register multiple environments from different
18285// translation units and the environments have dependencies among them
18286// (remember that the compiler doesn't guarantee the order in which
18287// global variables from different translation units are initialized).
18288inline Environment* AddGlobalTestEnvironment(Environment* env) {
18289  return UnitTest::GetInstance()->AddEnvironment(env);
18290}
18291
18292// Initializes Google Test.  This must be called before calling
18293// RUN_ALL_TESTS().  In particular, it parses a command line for the
18294// flags that Google Test recognizes.  Whenever a Google Test flag is
18295// seen, it is removed from argv, and *argc is decremented.
18296//
18297// No value is returned.  Instead, the Google Test flag variables are
18298// updated.
18299//
18300// Calling the function for the second time has no user-visible effect.
18301GTEST_API_ void InitGoogleTest(int* argc, char** argv);
18302
18303// This overloaded version can be used in Windows programs compiled in
18304// UNICODE mode.
18305GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
18306
18307namespace internal {
18308
18309// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
18310// operand to be used in a failure message.  The type (but not value)
18311// of the other operand may affect the format.  This allows us to
18312// print a char* as a raw pointer when it is compared against another
18313// char*, and print it as a C string when it is compared against an
18314// std::string object, for example.
18315//
18316// The default implementation ignores the type of the other operand.
18317// Some specialized versions are used to handle formatting wide or
18318// narrow C strings.
18319//
18320// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18321template <typename T1, typename T2>
18322String FormatForComparisonFailureMessage(const T1& value,
18323                                         const T2& /* other_operand */) {
18324  // C++Builder compiles this incorrectly if the namespace isn't explicitly
18325  // given.
18326  return ::testing::PrintToString(value);
18327}
18328
18329// The helper function for {ASSERT|EXPECT}_EQ.
18330template <typename T1, typename T2>
18331AssertionResult CmpHelperEQ(const char* expected_expression,
18332                            const char* actual_expression,
18333                            const T1& expected,
18334                            const T2& actual) {
18335#ifdef _MSC_VER
18336# pragma warning(push)          // Saves the current warning state.
18337# pragma warning(disable:4389)  // Temporarily disables warning on
18338                               // signed/unsigned mismatch.
18339#endif
18340
18341  if (expected == actual) {
18342    return AssertionSuccess();
18343  }
18344
18345#ifdef _MSC_VER
18346# pragma warning(pop)          // Restores the warning state.
18347#endif
18348
18349  return EqFailure(expected_expression,
18350                   actual_expression,
18351                   FormatForComparisonFailureMessage(expected, actual),
18352                   FormatForComparisonFailureMessage(actual, expected),
18353                   false);
18354}
18355
18356// With this overloaded version, we allow anonymous enums to be used
18357// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
18358// can be implicitly cast to BiggestInt.
18359GTEST_API_ AssertionResult CmpHelperEQ(const char* expected_expression,
18360                                       const char* actual_expression,
18361                                       BiggestInt expected,
18362                                       BiggestInt actual);
18363
18364// The helper class for {ASSERT|EXPECT}_EQ.  The template argument
18365// lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
18366// is a null pointer literal.  The following default implementation is
18367// for lhs_is_null_literal being false.
18368template <bool lhs_is_null_literal>
18369class EqHelper {
18370 public:
18371  // This templatized version is for the general case.
18372  template <typename T1, typename T2>
18373  static AssertionResult Compare(const char* expected_expression,
18374                                 const char* actual_expression,
18375                                 const T1& expected,
18376                                 const T2& actual) {
18377    return CmpHelperEQ(expected_expression, actual_expression, expected,
18378                       actual);
18379  }
18380
18381  // With this overloaded version, we allow anonymous enums to be used
18382  // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
18383  // enums can be implicitly cast to BiggestInt.
18384  //
18385  // Even though its body looks the same as the above version, we
18386  // cannot merge the two, as it will make anonymous enums unhappy.
18387  static AssertionResult Compare(const char* expected_expression,
18388                                 const char* actual_expression,
18389                                 BiggestInt expected,
18390                                 BiggestInt actual) {
18391    return CmpHelperEQ(expected_expression, actual_expression, expected,
18392                       actual);
18393  }
18394};
18395
18396// This specialization is used when the first argument to ASSERT_EQ()
18397// is a null pointer literal, like NULL, false, or 0.
18398template <>
18399class EqHelper<true> {
18400 public:
18401  // We define two overloaded versions of Compare().  The first
18402  // version will be picked when the second argument to ASSERT_EQ() is
18403  // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or
18404  // EXPECT_EQ(false, a_bool).
18405  template <typename T1, typename T2>
18406  static AssertionResult Compare(
18407      const char* expected_expression,
18408      const char* actual_expression,
18409      const T1& expected,
18410      const T2& actual,
18411      // The following line prevents this overload from being considered if T2
18412      // is not a pointer type.  We need this because ASSERT_EQ(NULL, my_ptr)
18413      // expands to Compare("", "", NULL, my_ptr), which requires a conversion
18414      // to match the Secret* in the other overload, which would otherwise make
18415      // this template match better.
18416      typename EnableIf<!is_pointer<T2>::value>::type* = 0) {
18417    return CmpHelperEQ(expected_expression, actual_expression, expected,
18418                       actual);
18419  }
18420
18421  // This version will be picked when the second argument to ASSERT_EQ() is a
18422  // pointer, e.g. ASSERT_EQ(NULL, a_pointer).
18423  template <typename T>
18424  static AssertionResult Compare(
18425      const char* expected_expression,
18426      const char* actual_expression,
18427      // We used to have a second template parameter instead of Secret*.  That
18428      // template parameter would deduce to 'long', making this a better match
18429      // than the first overload even without the first overload's EnableIf.
18430      // Unfortunately, gcc with -Wconversion-null warns when "passing NULL to
18431      // non-pointer argument" (even a deduced integral argument), so the old
18432      // implementation caused warnings in user code.
18433      Secret* /* expected (NULL) */,
18434      T* actual) {
18435    // We already know that 'expected' is a null pointer.
18436    return CmpHelperEQ(expected_expression, actual_expression,
18437                       static_cast<T*>(NULL), actual);
18438  }
18439};
18440
18441// A macro for implementing the helper functions needed to implement
18442// ASSERT_?? and EXPECT_??.  It is here just to avoid copy-and-paste
18443// of similar code.
18444//
18445// For each templatized helper function, we also define an overloaded
18446// version for BiggestInt in order to reduce code bloat and allow
18447// anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
18448// with gcc 4.
18449//
18450// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18451#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
18452template <typename T1, typename T2>\
18453AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
18454                                   const T1& val1, const T2& val2) {\
18455  if (val1 op val2) {\
18456    return AssertionSuccess();\
18457  } else {\
18458    return AssertionFailure() \
18459        << "Expected: (" << expr1 << ") " #op " (" << expr2\
18460        << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
18461        << " vs " << FormatForComparisonFailureMessage(val2, val1);\
18462  }\
18463}\
18464GTEST_API_ AssertionResult CmpHelper##op_name(\
18465    const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
18466
18467// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18468
18469// Implements the helper function for {ASSERT|EXPECT}_NE
18470GTEST_IMPL_CMP_HELPER_(NE, !=);
18471// Implements the helper function for {ASSERT|EXPECT}_LE
18472GTEST_IMPL_CMP_HELPER_(LE, <=);
18473// Implements the helper function for {ASSERT|EXPECT}_LT
18474GTEST_IMPL_CMP_HELPER_(LT, < );
18475// Implements the helper function for {ASSERT|EXPECT}_GE
18476GTEST_IMPL_CMP_HELPER_(GE, >=);
18477// Implements the helper function for {ASSERT|EXPECT}_GT
18478GTEST_IMPL_CMP_HELPER_(GT, > );
18479
18480#undef GTEST_IMPL_CMP_HELPER_
18481
18482// The helper function for {ASSERT|EXPECT}_STREQ.
18483//
18484// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18485GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
18486                                          const char* actual_expression,
18487                                          const char* expected,
18488                                          const char* actual);
18489
18490// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
18491//
18492// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18493GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
18494                                              const char* actual_expression,
18495                                              const char* expected,
18496                                              const char* actual);
18497
18498// The helper function for {ASSERT|EXPECT}_STRNE.
18499//
18500// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18501GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
18502                                          const char* s2_expression,
18503                                          const char* s1,
18504                                          const char* s2);
18505
18506// The helper function for {ASSERT|EXPECT}_STRCASENE.
18507//
18508// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18509GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
18510                                              const char* s2_expression,
18511                                              const char* s1,
18512                                              const char* s2);
18513
18514
18515// Helper function for *_STREQ on wide strings.
18516//
18517// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18518GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
18519                                          const char* actual_expression,
18520                                          const wchar_t* expected,
18521                                          const wchar_t* actual);
18522
18523// Helper function for *_STRNE on wide strings.
18524//
18525// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18526GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
18527                                          const char* s2_expression,
18528                                          const wchar_t* s1,
18529                                          const wchar_t* s2);
18530
18531}  // namespace internal
18532
18533// IsSubstring() and IsNotSubstring() are intended to be used as the
18534// first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
18535// themselves.  They check whether needle is a substring of haystack
18536// (NULL is considered a substring of itself only), and return an
18537// appropriate error message when they fail.
18538//
18539// The {needle,haystack}_expr arguments are the stringified
18540// expressions that generated the two real arguments.
18541GTEST_API_ AssertionResult IsSubstring(
18542    const char* needle_expr, const char* haystack_expr,
18543    const char* needle, const char* haystack);
18544GTEST_API_ AssertionResult IsSubstring(
18545    const char* needle_expr, const char* haystack_expr,
18546    const wchar_t* needle, const wchar_t* haystack);
18547GTEST_API_ AssertionResult IsNotSubstring(
18548    const char* needle_expr, const char* haystack_expr,
18549    const char* needle, const char* haystack);
18550GTEST_API_ AssertionResult IsNotSubstring(
18551    const char* needle_expr, const char* haystack_expr,
18552    const wchar_t* needle, const wchar_t* haystack);
18553GTEST_API_ AssertionResult IsSubstring(
18554    const char* needle_expr, const char* haystack_expr,
18555    const ::std::string& needle, const ::std::string& haystack);
18556GTEST_API_ AssertionResult IsNotSubstring(
18557    const char* needle_expr, const char* haystack_expr,
18558    const ::std::string& needle, const ::std::string& haystack);
18559
18560#if GTEST_HAS_STD_WSTRING
18561GTEST_API_ AssertionResult IsSubstring(
18562    const char* needle_expr, const char* haystack_expr,
18563    const ::std::wstring& needle, const ::std::wstring& haystack);
18564GTEST_API_ AssertionResult IsNotSubstring(
18565    const char* needle_expr, const char* haystack_expr,
18566    const ::std::wstring& needle, const ::std::wstring& haystack);
18567#endif  // GTEST_HAS_STD_WSTRING
18568
18569namespace internal {
18570
18571// Helper template function for comparing floating-points.
18572//
18573// Template parameter:
18574//
18575//   RawType: the raw floating-point type (either float or double)
18576//
18577// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18578template <typename RawType>
18579AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
18580                                         const char* actual_expression,
18581                                         RawType expected,
18582                                         RawType actual) {
18583  const FloatingPoint<RawType> lhs(expected), rhs(actual);
18584
18585  if (lhs.AlmostEquals(rhs)) {
18586    return AssertionSuccess();
18587  }
18588
18589  ::std::stringstream expected_ss;
18590  expected_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
18591              << expected;
18592
18593  ::std::stringstream actual_ss;
18594  actual_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
18595            << actual;
18596
18597  return EqFailure(expected_expression,
18598                   actual_expression,
18599                   StringStreamToString(&expected_ss),
18600                   StringStreamToString(&actual_ss),
18601                   false);
18602}
18603
18604// Helper function for implementing ASSERT_NEAR.
18605//
18606// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18607GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
18608                                                const char* expr2,
18609                                                const char* abs_error_expr,
18610                                                double val1,
18611                                                double val2,
18612                                                double abs_error);
18613
18614// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
18615// A class that enables one to stream messages to assertion macros
18616class GTEST_API_ AssertHelper {
18617 public:
18618  // Constructor.
18619  AssertHelper(TestPartResult::Type type,
18620               const char* file,
18621               int line,
18622               const char* message);
18623  ~AssertHelper();
18624
18625  // Message assignment is a semantic trick to enable assertion
18626  // streaming; see the GTEST_MESSAGE_ macro below.
18627  void operator=(const Message& message) const;
18628
18629 private:
18630  // We put our data in a struct so that the size of the AssertHelper class can
18631  // be as small as possible.  This is important because gcc is incapable of
18632  // re-using stack space even for temporary variables, so every EXPECT_EQ
18633  // reserves stack space for another AssertHelper.
18634  struct AssertHelperData {
18635    AssertHelperData(TestPartResult::Type t,
18636                     const char* srcfile,
18637                     int line_num,
18638                     const char* msg)
18639        : type(t), file(srcfile), line(line_num), message(msg) { }
18640
18641    TestPartResult::Type const type;
18642    const char*        const file;
18643    int                const line;
18644    String             const message;
18645
18646   private:
18647    GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
18648  };
18649
18650  AssertHelperData* const data_;
18651
18652  GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
18653};
18654
18655}  // namespace internal
18656
18657#if GTEST_HAS_PARAM_TEST
18658// The pure interface class that all value-parameterized tests inherit from.
18659// A value-parameterized class must inherit from both ::testing::Test and
18660// ::testing::WithParamInterface. In most cases that just means inheriting
18661// from ::testing::TestWithParam, but more complicated test hierarchies
18662// may need to inherit from Test and WithParamInterface at different levels.
18663//
18664// This interface has support for accessing the test parameter value via
18665// the GetParam() method.
18666//
18667// Use it with one of the parameter generator defining functions, like Range(),
18668// Values(), ValuesIn(), Bool(), and Combine().
18669//
18670// class FooTest : public ::testing::TestWithParam<int> {
18671//  protected:
18672//   FooTest() {
18673//     // Can use GetParam() here.
18674//   }
18675//   virtual ~FooTest() {
18676//     // Can use GetParam() here.
18677//   }
18678//   virtual void SetUp() {
18679//     // Can use GetParam() here.
18680//   }
18681//   virtual void TearDown {
18682//     // Can use GetParam() here.
18683//   }
18684// };
18685// TEST_P(FooTest, DoesBar) {
18686//   // Can use GetParam() method here.
18687//   Foo foo;
18688//   ASSERT_TRUE(foo.DoesBar(GetParam()));
18689// }
18690// INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
18691
18692template <typename T>
18693class WithParamInterface {
18694 public:
18695  typedef T ParamType;
18696  virtual ~WithParamInterface() {}
18697
18698  // The current parameter value. Is also available in the test fixture's
18699  // constructor. This member function is non-static, even though it only
18700  // references static data, to reduce the opportunity for incorrect uses
18701  // like writing 'WithParamInterface<bool>::GetParam()' for a test that
18702  // uses a fixture whose parameter type is int.
18703  const ParamType& GetParam() const { return *parameter_; }
18704
18705 private:
18706  // Sets parameter value. The caller is responsible for making sure the value
18707  // remains alive and unchanged throughout the current test.
18708  static void SetParam(const ParamType* parameter) {
18709    parameter_ = parameter;
18710  }
18711
18712  // Static value used for accessing parameter during a test lifetime.
18713  static const ParamType* parameter_;
18714
18715  // TestClass must be a subclass of WithParamInterface<T> and Test.
18716  template <class TestClass> friend class internal::ParameterizedTestFactory;
18717};
18718
18719template <typename T>
18720const T* WithParamInterface<T>::parameter_ = NULL;
18721
18722// Most value-parameterized classes can ignore the existence of
18723// WithParamInterface, and can just inherit from ::testing::TestWithParam.
18724
18725template <typename T>
18726class TestWithParam : public Test, public WithParamInterface<T> {
18727};
18728
18729#endif  // GTEST_HAS_PARAM_TEST
18730
18731// Macros for indicating success/failure in test code.
18732
18733// ADD_FAILURE unconditionally adds a failure to the current test.
18734// SUCCEED generates a success - it doesn't automatically make the
18735// current test successful, as a test is only successful when it has
18736// no failure.
18737//
18738// EXPECT_* verifies that a certain condition is satisfied.  If not,
18739// it behaves like ADD_FAILURE.  In particular:
18740//
18741//   EXPECT_TRUE  verifies that a Boolean condition is true.
18742//   EXPECT_FALSE verifies that a Boolean condition is false.
18743//
18744// FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
18745// that they will also abort the current function on failure.  People
18746// usually want the fail-fast behavior of FAIL and ASSERT_*, but those
18747// writing data-driven tests often find themselves using ADD_FAILURE
18748// and EXPECT_* more.
18749//
18750// Examples:
18751//
18752//   EXPECT_TRUE(server.StatusIsOK());
18753//   ASSERT_FALSE(server.HasPendingRequest(port))
18754//       << "There are still pending requests " << "on port " << port;
18755
18756// Generates a nonfatal failure with a generic message.
18757#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
18758
18759// Generates a nonfatal failure at the given source file location with
18760// a generic message.
18761#define ADD_FAILURE_AT(file, line) \
18762  GTEST_MESSAGE_AT_(file, line, "Failed", \
18763                    ::testing::TestPartResult::kNonFatalFailure)
18764
18765// Generates a fatal failure with a generic message.
18766#define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
18767
18768// Define this macro to 1 to omit the definition of FAIL(), which is a
18769// generic name and clashes with some other libraries.
18770#if !GTEST_DONT_DEFINE_FAIL
18771# define FAIL() GTEST_FAIL()
18772#endif
18773
18774// Generates a success with a generic message.
18775#define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
18776
18777// Define this macro to 1 to omit the definition of SUCCEED(), which
18778// is a generic name and clashes with some other libraries.
18779#if !GTEST_DONT_DEFINE_SUCCEED
18780# define SUCCEED() GTEST_SUCCEED()
18781#endif
18782
18783// Macros for testing exceptions.
18784//
18785//    * {ASSERT|EXPECT}_THROW(statement, expected_exception):
18786//         Tests that the statement throws the expected exception.
18787//    * {ASSERT|EXPECT}_NO_THROW(statement):
18788//         Tests that the statement doesn't throw any exception.
18789//    * {ASSERT|EXPECT}_ANY_THROW(statement):
18790//         Tests that the statement throws an exception.
18791
18792#define EXPECT_THROW(statement, expected_exception) \
18793  GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
18794#define EXPECT_NO_THROW(statement) \
18795  GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
18796#define EXPECT_ANY_THROW(statement) \
18797  GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
18798#define ASSERT_THROW(statement, expected_exception) \
18799  GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
18800#define ASSERT_NO_THROW(statement) \
18801  GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
18802#define ASSERT_ANY_THROW(statement) \
18803  GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
18804
18805// Boolean assertions. Condition can be either a Boolean expression or an
18806// AssertionResult. For more information on how to use AssertionResult with
18807// these macros see comments on that class.
18808#define EXPECT_TRUE(condition) \
18809  GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
18810                      GTEST_NONFATAL_FAILURE_)
18811#define EXPECT_FALSE(condition) \
18812  GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
18813                      GTEST_NONFATAL_FAILURE_)
18814#define ASSERT_TRUE(condition) \
18815  GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
18816                      GTEST_FATAL_FAILURE_)
18817#define ASSERT_FALSE(condition) \
18818  GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
18819                      GTEST_FATAL_FAILURE_)
18820
18821// Includes the auto-generated header that implements a family of
18822// generic predicate assertion macros.
18823// Copyright 2006, Google Inc.
18824// All rights reserved.
18825//
18826// Redistribution and use in source and binary forms, with or without
18827// modification, are permitted provided that the following conditions are
18828// met:
18829//
18830//     * Redistributions of source code must retain the above copyright
18831// notice, this list of conditions and the following disclaimer.
18832//     * Redistributions in binary form must reproduce the above
18833// copyright notice, this list of conditions and the following disclaimer
18834// in the documentation and/or other materials provided with the
18835// distribution.
18836//     * Neither the name of Google Inc. nor the names of its
18837// contributors may be used to endorse or promote products derived from
18838// this software without specific prior written permission.
18839//
18840// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18841// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18842// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18843// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18844// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18845// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18846// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18847// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
18848// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18849// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
18850// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18851
18852// This file is AUTOMATICALLY GENERATED on 09/24/2010 by command
18853// 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!
18854//
18855// Implements a family of generic predicate assertion macros.
18856
18857#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
18858#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
18859
18860// Makes sure this header is not included before gtest.h.
18861#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
18862# error Do not include gtest_pred_impl.h directly.  Include gtest.h instead.
18863#endif  // GTEST_INCLUDE_GTEST_GTEST_H_
18864
18865// This header implements a family of generic predicate assertion
18866// macros:
18867//
18868//   ASSERT_PRED_FORMAT1(pred_format, v1)
18869//   ASSERT_PRED_FORMAT2(pred_format, v1, v2)
18870//   ...
18871//
18872// where pred_format is a function or functor that takes n (in the
18873// case of ASSERT_PRED_FORMATn) values and their source expression
18874// text, and returns a testing::AssertionResult.  See the definition
18875// of ASSERT_EQ in gtest.h for an example.
18876//
18877// If you don't care about formatting, you can use the more
18878// restrictive version:
18879//
18880//   ASSERT_PRED1(pred, v1)
18881//   ASSERT_PRED2(pred, v1, v2)
18882//   ...
18883//
18884// where pred is an n-ary function or functor that returns bool,
18885// and the values v1, v2, ..., must support the << operator for
18886// streaming to std::ostream.
18887//
18888// We also define the EXPECT_* variations.
18889//
18890// For now we only support predicates whose arity is at most 5.
18891// Please email googletestframework@googlegroups.com if you need
18892// support for higher arities.
18893
18894// GTEST_ASSERT_ is the basic statement to which all of the assertions
18895// in this file reduce.  Don't use this in your code.
18896
18897#define GTEST_ASSERT_(expression, on_failure) \
18898  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
18899  if (const ::testing::AssertionResult gtest_ar = (expression)) \
18900    ; \
18901  else \
18902    on_failure(gtest_ar.failure_message())
18903
18904
18905// Helper function for implementing {EXPECT|ASSERT}_PRED1.  Don't use
18906// this in your code.
18907template <typename Pred,
18908          typename T1>
18909AssertionResult AssertPred1Helper(const char* pred_text,
18910                                  const char* e1,
18911                                  Pred pred,
18912                                  const T1& v1) {
18913  if (pred(v1)) return AssertionSuccess();
18914
18915  return AssertionFailure() << pred_text << "("
18916                            << e1 << ") evaluates to false, where"
18917                            << "\n" << e1 << " evaluates to " << v1;
18918}
18919
18920// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
18921// Don't use this in your code.
18922#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
18923  GTEST_ASSERT_(pred_format(#v1, v1),\
18924                on_failure)
18925
18926// Internal macro for implementing {EXPECT|ASSERT}_PRED1.  Don't use
18927// this in your code.
18928#define GTEST_PRED1_(pred, v1, on_failure)\
18929  GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
18930                                             #v1, \
18931                                             pred, \
18932                                             v1), on_failure)
18933
18934// Unary predicate assertion macros.
18935#define EXPECT_PRED_FORMAT1(pred_format, v1) \
18936  GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
18937#define EXPECT_PRED1(pred, v1) \
18938  GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
18939#define ASSERT_PRED_FORMAT1(pred_format, v1) \
18940  GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
18941#define ASSERT_PRED1(pred, v1) \
18942  GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
18943
18944
18945
18946// Helper function for implementing {EXPECT|ASSERT}_PRED2.  Don't use
18947// this in your code.
18948template <typename Pred,
18949          typename T1,
18950          typename T2>
18951AssertionResult AssertPred2Helper(const char* pred_text,
18952                                  const char* e1,
18953                                  const char* e2,
18954                                  Pred pred,
18955                                  const T1& v1,
18956                                  const T2& v2) {
18957  if (pred(v1, v2)) return AssertionSuccess();
18958
18959  return AssertionFailure() << pred_text << "("
18960                            << e1 << ", "
18961                            << e2 << ") evaluates to false, where"
18962                            << "\n" << e1 << " evaluates to " << v1
18963                            << "\n" << e2 << " evaluates to " << v2;
18964}
18965
18966// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
18967// Don't use this in your code.
18968#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
18969  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2),\
18970                on_failure)
18971
18972// Internal macro for implementing {EXPECT|ASSERT}_PRED2.  Don't use
18973// this in your code.
18974#define GTEST_PRED2_(pred, v1, v2, on_failure)\
18975  GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
18976                                             #v1, \
18977                                             #v2, \
18978                                             pred, \
18979                                             v1, \
18980                                             v2), on_failure)
18981
18982// Binary predicate assertion macros.
18983#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
18984  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
18985#define EXPECT_PRED2(pred, v1, v2) \
18986  GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
18987#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
18988  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
18989#define ASSERT_PRED2(pred, v1, v2) \
18990  GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
18991
18992
18993
18994// Helper function for implementing {EXPECT|ASSERT}_PRED3.  Don't use
18995// this in your code.
18996template <typename Pred,
18997          typename T1,
18998          typename T2,
18999          typename T3>
19000AssertionResult AssertPred3Helper(const char* pred_text,
19001                                  const char* e1,
19002                                  const char* e2,
19003                                  const char* e3,
19004                                  Pred pred,
19005                                  const T1& v1,
19006                                  const T2& v2,
19007                                  const T3& v3) {
19008  if (pred(v1, v2, v3)) return AssertionSuccess();
19009
19010  return AssertionFailure() << pred_text << "("
19011                            << e1 << ", "
19012                            << e2 << ", "
19013                            << e3 << ") evaluates to false, where"
19014                            << "\n" << e1 << " evaluates to " << v1
19015                            << "\n" << e2 << " evaluates to " << v2
19016                            << "\n" << e3 << " evaluates to " << v3;
19017}
19018
19019// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
19020// Don't use this in your code.
19021#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
19022  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3),\
19023                on_failure)
19024
19025// Internal macro for implementing {EXPECT|ASSERT}_PRED3.  Don't use
19026// this in your code.
19027#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
19028  GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
19029                                             #v1, \
19030                                             #v2, \
19031                                             #v3, \
19032                                             pred, \
19033                                             v1, \
19034                                             v2, \
19035                                             v3), on_failure)
19036
19037// Ternary predicate assertion macros.
19038#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
19039  GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
19040#define EXPECT_PRED3(pred, v1, v2, v3) \
19041  GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
19042#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
19043  GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
19044#define ASSERT_PRED3(pred, v1, v2, v3) \
19045  GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
19046
19047
19048
19049// Helper function for implementing {EXPECT|ASSERT}_PRED4.  Don't use
19050// this in your code.
19051template <typename Pred,
19052          typename T1,
19053          typename T2,
19054          typename T3,
19055          typename T4>
19056AssertionResult AssertPred4Helper(const char* pred_text,
19057                                  const char* e1,
19058                                  const char* e2,
19059                                  const char* e3,
19060                                  const char* e4,
19061                                  Pred pred,
19062                                  const T1& v1,
19063                                  const T2& v2,
19064                                  const T3& v3,
19065                                  const T4& v4) {
19066  if (pred(v1, v2, v3, v4)) return AssertionSuccess();
19067
19068  return AssertionFailure() << pred_text << "("
19069                            << e1 << ", "
19070                            << e2 << ", "
19071                            << e3 << ", "
19072                            << e4 << ") evaluates to false, where"
19073                            << "\n" << e1 << " evaluates to " << v1
19074                            << "\n" << e2 << " evaluates to " << v2
19075                            << "\n" << e3 << " evaluates to " << v3
19076                            << "\n" << e4 << " evaluates to " << v4;
19077}
19078
19079// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
19080// Don't use this in your code.
19081#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
19082  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4),\
19083                on_failure)
19084
19085// Internal macro for implementing {EXPECT|ASSERT}_PRED4.  Don't use
19086// this in your code.
19087#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
19088  GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
19089                                             #v1, \
19090                                             #v2, \
19091                                             #v3, \
19092                                             #v4, \
19093                                             pred, \
19094                                             v1, \
19095                                             v2, \
19096                                             v3, \
19097                                             v4), on_failure)
19098
19099// 4-ary predicate assertion macros.
19100#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
19101  GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
19102#define EXPECT_PRED4(pred, v1, v2, v3, v4) \
19103  GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
19104#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
19105  GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
19106#define ASSERT_PRED4(pred, v1, v2, v3, v4) \
19107  GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
19108
19109
19110
19111// Helper function for implementing {EXPECT|ASSERT}_PRED5.  Don't use
19112// this in your code.
19113template <typename Pred,
19114          typename T1,
19115          typename T2,
19116          typename T3,
19117          typename T4,
19118          typename T5>
19119AssertionResult AssertPred5Helper(const char* pred_text,
19120                                  const char* e1,
19121                                  const char* e2,
19122                                  const char* e3,
19123                                  const char* e4,
19124                                  const char* e5,
19125                                  Pred pred,
19126                                  const T1& v1,
19127                                  const T2& v2,
19128                                  const T3& v3,
19129                                  const T4& v4,
19130                                  const T5& v5) {
19131  if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
19132
19133  return AssertionFailure() << pred_text << "("
19134                            << e1 << ", "
19135                            << e2 << ", "
19136                            << e3 << ", "
19137                            << e4 << ", "
19138                            << e5 << ") evaluates to false, where"
19139                            << "\n" << e1 << " evaluates to " << v1
19140                            << "\n" << e2 << " evaluates to " << v2
19141                            << "\n" << e3 << " evaluates to " << v3
19142                            << "\n" << e4 << " evaluates to " << v4
19143                            << "\n" << e5 << " evaluates to " << v5;
19144}
19145
19146// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
19147// Don't use this in your code.
19148#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
19149  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5),\
19150                on_failure)
19151
19152// Internal macro for implementing {EXPECT|ASSERT}_PRED5.  Don't use
19153// this in your code.
19154#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
19155  GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
19156                                             #v1, \
19157                                             #v2, \
19158                                             #v3, \
19159                                             #v4, \
19160                                             #v5, \
19161                                             pred, \
19162                                             v1, \
19163                                             v2, \
19164                                             v3, \
19165                                             v4, \
19166                                             v5), on_failure)
19167
19168// 5-ary predicate assertion macros.
19169#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
19170  GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
19171#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
19172  GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
19173#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
19174  GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
19175#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
19176  GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
19177
19178
19179
19180#endif  // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
19181
19182// Macros for testing equalities and inequalities.
19183//
19184//    * {ASSERT|EXPECT}_EQ(expected, actual): Tests that expected == actual
19185//    * {ASSERT|EXPECT}_NE(v1, v2):           Tests that v1 != v2
19186//    * {ASSERT|EXPECT}_LT(v1, v2):           Tests that v1 < v2
19187//    * {ASSERT|EXPECT}_LE(v1, v2):           Tests that v1 <= v2
19188//    * {ASSERT|EXPECT}_GT(v1, v2):           Tests that v1 > v2
19189//    * {ASSERT|EXPECT}_GE(v1, v2):           Tests that v1 >= v2
19190//
19191// When they are not, Google Test prints both the tested expressions and
19192// their actual values.  The values must be compatible built-in types,
19193// or you will get a compiler error.  By "compatible" we mean that the
19194// values can be compared by the respective operator.
19195//
19196// Note:
19197//
19198//   1. It is possible to make a user-defined type work with
19199//   {ASSERT|EXPECT}_??(), but that requires overloading the
19200//   comparison operators and is thus discouraged by the Google C++
19201//   Usage Guide.  Therefore, you are advised to use the
19202//   {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
19203//   equal.
19204//
19205//   2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
19206//   pointers (in particular, C strings).  Therefore, if you use it
19207//   with two C strings, you are testing how their locations in memory
19208//   are related, not how their content is related.  To compare two C
19209//   strings by content, use {ASSERT|EXPECT}_STR*().
19210//
19211//   3. {ASSERT|EXPECT}_EQ(expected, actual) is preferred to
19212//   {ASSERT|EXPECT}_TRUE(expected == actual), as the former tells you
19213//   what the actual value is when it fails, and similarly for the
19214//   other comparisons.
19215//
19216//   4. Do not depend on the order in which {ASSERT|EXPECT}_??()
19217//   evaluate their arguments, which is undefined.
19218//
19219//   5. These macros evaluate their arguments exactly once.
19220//
19221// Examples:
19222//
19223//   EXPECT_NE(5, Foo());
19224//   EXPECT_EQ(NULL, a_pointer);
19225//   ASSERT_LT(i, array_size);
19226//   ASSERT_GT(records.size(), 0) << "There is no record left.";
19227
19228#define EXPECT_EQ(expected, actual) \
19229  EXPECT_PRED_FORMAT2(::testing::internal:: \
19230                      EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
19231                      expected, actual)
19232#define EXPECT_NE(expected, actual) \
19233  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)
19234#define EXPECT_LE(val1, val2) \
19235  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
19236#define EXPECT_LT(val1, val2) \
19237  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
19238#define EXPECT_GE(val1, val2) \
19239  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
19240#define EXPECT_GT(val1, val2) \
19241  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
19242
19243#define GTEST_ASSERT_EQ(expected, actual) \
19244  ASSERT_PRED_FORMAT2(::testing::internal:: \
19245                      EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
19246                      expected, actual)
19247#define GTEST_ASSERT_NE(val1, val2) \
19248  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
19249#define GTEST_ASSERT_LE(val1, val2) \
19250  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
19251#define GTEST_ASSERT_LT(val1, val2) \
19252  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
19253#define GTEST_ASSERT_GE(val1, val2) \
19254  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
19255#define GTEST_ASSERT_GT(val1, val2) \
19256  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
19257
19258// Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
19259// ASSERT_XY(), which clashes with some users' own code.
19260
19261#if !GTEST_DONT_DEFINE_ASSERT_EQ
19262# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
19263#endif
19264
19265#if !GTEST_DONT_DEFINE_ASSERT_NE
19266# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
19267#endif
19268
19269#if !GTEST_DONT_DEFINE_ASSERT_LE
19270# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
19271#endif
19272
19273#if !GTEST_DONT_DEFINE_ASSERT_LT
19274# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
19275#endif
19276
19277#if !GTEST_DONT_DEFINE_ASSERT_GE
19278# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
19279#endif
19280
19281#if !GTEST_DONT_DEFINE_ASSERT_GT
19282# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
19283#endif
19284
19285// C String Comparisons.  All tests treat NULL and any non-NULL string
19286// as different.  Two NULLs are equal.
19287//
19288//    * {ASSERT|EXPECT}_STREQ(s1, s2):     Tests that s1 == s2
19289//    * {ASSERT|EXPECT}_STRNE(s1, s2):     Tests that s1 != s2
19290//    * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
19291//    * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
19292//
19293// For wide or narrow string objects, you can use the
19294// {ASSERT|EXPECT}_??() macros.
19295//
19296// Don't depend on the order in which the arguments are evaluated,
19297// which is undefined.
19298//
19299// These macros evaluate their arguments exactly once.
19300
19301#define EXPECT_STREQ(expected, actual) \
19302  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
19303#define EXPECT_STRNE(s1, s2) \
19304  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
19305#define EXPECT_STRCASEEQ(expected, actual) \
19306  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
19307#define EXPECT_STRCASENE(s1, s2)\
19308  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
19309
19310#define ASSERT_STREQ(expected, actual) \
19311  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
19312#define ASSERT_STRNE(s1, s2) \
19313  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
19314#define ASSERT_STRCASEEQ(expected, actual) \
19315  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
19316#define ASSERT_STRCASENE(s1, s2)\
19317  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
19318
19319// Macros for comparing floating-point numbers.
19320//
19321//    * {ASSERT|EXPECT}_FLOAT_EQ(expected, actual):
19322//         Tests that two float values are almost equal.
19323//    * {ASSERT|EXPECT}_DOUBLE_EQ(expected, actual):
19324//         Tests that two double values are almost equal.
19325//    * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
19326//         Tests that v1 and v2 are within the given distance to each other.
19327//
19328// Google Test uses ULP-based comparison to automatically pick a default
19329// error bound that is appropriate for the operands.  See the
19330// FloatingPoint template class in gtest-internal.h if you are
19331// interested in the implementation details.
19332
19333#define EXPECT_FLOAT_EQ(expected, actual)\
19334  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
19335                      expected, actual)
19336
19337#define EXPECT_DOUBLE_EQ(expected, actual)\
19338  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
19339                      expected, actual)
19340
19341#define ASSERT_FLOAT_EQ(expected, actual)\
19342  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
19343                      expected, actual)
19344
19345#define ASSERT_DOUBLE_EQ(expected, actual)\
19346  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
19347                      expected, actual)
19348
19349#define EXPECT_NEAR(val1, val2, abs_error)\
19350  EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
19351                      val1, val2, abs_error)
19352
19353#define ASSERT_NEAR(val1, val2, abs_error)\
19354  ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
19355                      val1, val2, abs_error)
19356
19357// These predicate format functions work on floating-point values, and
19358// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
19359//
19360//   EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
19361
19362// Asserts that val1 is less than, or almost equal to, val2.  Fails
19363// otherwise.  In particular, it fails if either val1 or val2 is NaN.
19364GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
19365                                   float val1, float val2);
19366GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
19367                                    double val1, double val2);
19368
19369
19370#if GTEST_OS_WINDOWS
19371
19372// Macros that test for HRESULT failure and success, these are only useful
19373// on Windows, and rely on Windows SDK macros and APIs to compile.
19374//
19375//    * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
19376//
19377// When expr unexpectedly fails or succeeds, Google Test prints the
19378// expected result and the actual result with both a human-readable
19379// string representation of the error, if available, as well as the
19380// hex result code.
19381# define EXPECT_HRESULT_SUCCEEDED(expr) \
19382    EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
19383
19384# define ASSERT_HRESULT_SUCCEEDED(expr) \
19385    ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
19386
19387# define EXPECT_HRESULT_FAILED(expr) \
19388    EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
19389
19390# define ASSERT_HRESULT_FAILED(expr) \
19391    ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
19392
19393#endif  // GTEST_OS_WINDOWS
19394
19395// Macros that execute statement and check that it doesn't generate new fatal
19396// failures in the current thread.
19397//
19398//   * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
19399//
19400// Examples:
19401//
19402//   EXPECT_NO_FATAL_FAILURE(Process());
19403//   ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
19404//
19405#define ASSERT_NO_FATAL_FAILURE(statement) \
19406    GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
19407#define EXPECT_NO_FATAL_FAILURE(statement) \
19408    GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
19409
19410// Causes a trace (including the source file path, the current line
19411// number, and the given message) to be included in every test failure
19412// message generated by code in the current scope.  The effect is
19413// undone when the control leaves the current scope.
19414//
19415// The message argument can be anything streamable to std::ostream.
19416//
19417// In the implementation, we include the current line number as part
19418// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
19419// to appear in the same block - as long as they are on different
19420// lines.
19421#define SCOPED_TRACE(message) \
19422  ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
19423    __FILE__, __LINE__, ::testing::Message() << (message))
19424
19425// Compile-time assertion for type equality.
19426// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
19427// the same type.  The value it returns is not interesting.
19428//
19429// Instead of making StaticAssertTypeEq a class template, we make it a
19430// function template that invokes a helper class template.  This
19431// prevents a user from misusing StaticAssertTypeEq<T1, T2> by
19432// defining objects of that type.
19433//
19434// CAVEAT:
19435//
19436// When used inside a method of a class template,
19437// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
19438// instantiated.  For example, given:
19439//
19440//   template <typename T> class Foo {
19441//    public:
19442//     void Bar() { testing::StaticAssertTypeEq<int, T>(); }
19443//   };
19444//
19445// the code:
19446//
19447//   void Test1() { Foo<bool> foo; }
19448//
19449// will NOT generate a compiler error, as Foo<bool>::Bar() is never
19450// actually instantiated.  Instead, you need:
19451//
19452//   void Test2() { Foo<bool> foo; foo.Bar(); }
19453//
19454// to cause a compiler error.
19455template <typename T1, typename T2>
19456bool StaticAssertTypeEq() {
19457  (void)internal::StaticAssertTypeEqHelper<T1, T2>();
19458  return true;
19459}
19460
19461// Defines a test.
19462//
19463// The first parameter is the name of the test case, and the second
19464// parameter is the name of the test within the test case.
19465//
19466// The convention is to end the test case name with "Test".  For
19467// example, a test case for the Foo class can be named FooTest.
19468//
19469// The user should put his test code between braces after using this
19470// macro.  Example:
19471//
19472//   TEST(FooTest, InitializesCorrectly) {
19473//     Foo foo;
19474//     EXPECT_TRUE(foo.StatusIsOK());
19475//   }
19476
19477// Note that we call GetTestTypeId() instead of GetTypeId<
19478// ::testing::Test>() here to get the type ID of testing::Test.  This
19479// is to work around a suspected linker bug when using Google Test as
19480// a framework on Mac OS X.  The bug causes GetTypeId<
19481// ::testing::Test>() to return different values depending on whether
19482// the call is from the Google Test framework itself or from user test
19483// code.  GetTestTypeId() is guaranteed to always return the same
19484// value, as it always calls GetTypeId<>() from the Google Test
19485// framework.
19486#define GTEST_TEST(test_case_name, test_name)\
19487  GTEST_TEST_(test_case_name, test_name, \
19488              ::testing::Test, ::testing::internal::GetTestTypeId())
19489
19490// Define this macro to 1 to omit the definition of TEST(), which
19491// is a generic name and clashes with some other libraries.
19492#if !GTEST_DONT_DEFINE_TEST
19493# define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
19494#endif
19495
19496// Defines a test that uses a test fixture.
19497//
19498// The first parameter is the name of the test fixture class, which
19499// also doubles as the test case name.  The second parameter is the
19500// name of the test within the test case.
19501//
19502// A test fixture class must be declared earlier.  The user should put
19503// his test code between braces after using this macro.  Example:
19504//
19505//   class FooTest : public testing::Test {
19506//    protected:
19507//     virtual void SetUp() { b_.AddElement(3); }
19508//
19509//     Foo a_;
19510//     Foo b_;
19511//   };
19512//
19513//   TEST_F(FooTest, InitializesCorrectly) {
19514//     EXPECT_TRUE(a_.StatusIsOK());
19515//   }
19516//
19517//   TEST_F(FooTest, ReturnsElementCountCorrectly) {
19518//     EXPECT_EQ(0, a_.size());
19519//     EXPECT_EQ(1, b_.size());
19520//   }
19521
19522#define TEST_F(test_fixture, test_name)\
19523  GTEST_TEST_(test_fixture, test_name, test_fixture, \
19524              ::testing::internal::GetTypeId<test_fixture>())
19525
19526// Use this macro in main() to run all tests.  It returns 0 if all
19527// tests are successful, or 1 otherwise.
19528//
19529// RUN_ALL_TESTS() should be invoked after the command line has been
19530// parsed by InitGoogleTest().
19531
19532#define RUN_ALL_TESTS()\
19533  (::testing::UnitTest::GetInstance()->Run())
19534
19535}  // namespace testing
19536
19537#endif  // GTEST_INCLUDE_GTEST_GTEST_H_
19538