Imported Upstream version ceres 1.13.0
[platform/upstream/ceres-solver.git] / internal / ceres / gtest / gtest.h
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 <ostream>
56 #include <vector>
57
58 // Copyright 2005, Google Inc.
59 // All rights reserved.
60 //
61 // Redistribution and use in source and binary forms, with or without
62 // modification, are permitted provided that the following conditions are
63 // met:
64 //
65 //     * Redistributions of source code must retain the above copyright
66 // notice, this list of conditions and the following disclaimer.
67 //     * Redistributions in binary form must reproduce the above
68 // copyright notice, this list of conditions and the following disclaimer
69 // in the documentation and/or other materials provided with the
70 // distribution.
71 //     * Neither the name of Google Inc. nor the names of its
72 // contributors may be used to endorse or promote products derived from
73 // this software without specific prior written permission.
74 //
75 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
76 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
77 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
78 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
79 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
80 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
81 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
82 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
83 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
84 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
85 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
86 //
87 // Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
88 //
89 // The Google C++ Testing Framework (Google Test)
90 //
91 // This header file declares functions and macros used internally by
92 // Google Test.  They are subject to change without notice.
93
94 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
95 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
96
97 // Copyright 2005, Google Inc.
98 // All rights reserved.
99 //
100 // Redistribution and use in source and binary forms, with or without
101 // modification, are permitted provided that the following conditions are
102 // met:
103 //
104 //     * Redistributions of source code must retain the above copyright
105 // notice, this list of conditions and the following disclaimer.
106 //     * Redistributions in binary form must reproduce the above
107 // copyright notice, this list of conditions and the following disclaimer
108 // in the documentation and/or other materials provided with the
109 // distribution.
110 //     * Neither the name of Google Inc. nor the names of its
111 // contributors may be used to endorse or promote products derived from
112 // this software without specific prior written permission.
113 //
114 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
115 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
116 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
117 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
118 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
119 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
120 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
121 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
122 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
123 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
124 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
125 //
126 // Authors: wan@google.com (Zhanyong Wan)
127 //
128 // Low-level types and utilities for porting Google Test to various
129 // platforms.  All macros ending with _ and symbols defined in an
130 // internal namespace are subject to change without notice.  Code
131 // outside Google Test MUST NOT USE THEM DIRECTLY.  Macros that don't
132 // end with _ are part of Google Test's public API and can be used by
133 // code outside Google Test.
134 //
135 // This file is fundamental to Google Test.  All other Google Test source
136 // files are expected to #include this.  Therefore, it cannot #include
137 // any other Google Test header.
138
139 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
140 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
141
142 // Environment-describing macros
143 // -----------------------------
144 //
145 // Google Test can be used in many different environments.  Macros in
146 // this section tell Google Test what kind of environment it is being
147 // used in, such that Google Test can provide environment-specific
148 // features and implementations.
149 //
150 // Google Test tries to automatically detect the properties of its
151 // environment, so users usually don't need to worry about these
152 // macros.  However, the automatic detection is not perfect.
153 // Sometimes it's necessary for a user to define some of the following
154 // macros in the build script to override Google Test's decisions.
155 //
156 // If the user doesn't define a macro in the list, Google Test will
157 // provide a default definition.  After this header is #included, all
158 // macros in this list will be defined to either 1 or 0.
159 //
160 // Notes to maintainers:
161 //   - Each macro here is a user-tweakable knob; do not grow the list
162 //     lightly.
163 //   - Use #if to key off these macros.  Don't use #ifdef or "#if
164 //     defined(...)", which will not work as these macros are ALWAYS
165 //     defined.
166 //
167 //   GTEST_HAS_CLONE          - Define it to 1/0 to indicate that clone(2)
168 //                              is/isn't available.
169 //   GTEST_HAS_EXCEPTIONS     - Define it to 1/0 to indicate that exceptions
170 //                              are enabled.
171 //   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string
172 //                              is/isn't available (some systems define
173 //                              ::string, which is different to std::string).
174 //   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
175 //                              is/isn't available (some systems define
176 //                              ::wstring, which is different to std::wstring).
177 //   GTEST_HAS_POSIX_RE       - Define it to 1/0 to indicate that POSIX regular
178 //                              expressions are/aren't available.
179 //   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h>
180 //                              is/isn't available.
181 //   GTEST_HAS_RTTI           - Define it to 1/0 to indicate that RTTI is/isn't
182 //                              enabled.
183 //   GTEST_HAS_STD_WSTRING    - Define it to 1/0 to indicate that
184 //                              std::wstring does/doesn't work (Google Test can
185 //                              be used where std::wstring is unavailable).
186 //   GTEST_HAS_TR1_TUPLE      - Define it to 1/0 to indicate tr1::tuple
187 //                              is/isn't available.
188 //   GTEST_HAS_SEH            - Define it to 1/0 to indicate whether the
189 //                              compiler supports Microsoft's "Structured
190 //                              Exception Handling".
191 //   GTEST_HAS_STREAM_REDIRECTION
192 //                            - Define it to 1/0 to indicate whether the
193 //                              platform supports I/O stream redirection using
194 //                              dup() and dup2().
195 //   GTEST_USE_OWN_TR1_TUPLE  - Define it to 1/0 to indicate whether Google
196 //                              Test's own tr1 tuple implementation should be
197 //                              used.  Unused when the user sets
198 //                              GTEST_HAS_TR1_TUPLE to 0.
199 //   GTEST_LANG_CXX11         - Define it to 1/0 to indicate that Google Test
200 //                              is building in C++11/C++98 mode.
201 //   GTEST_LINKED_AS_SHARED_LIBRARY
202 //                            - Define to 1 when compiling tests that use
203 //                              Google Test as a shared library (known as
204 //                              DLL on Windows).
205 //   GTEST_CREATE_SHARED_LIBRARY
206 //                            - Define to 1 when compiling Google Test itself
207 //                              as a shared library.
208
209 // Platform-indicating macros
210 // --------------------------
211 //
212 // Macros indicating the platform on which Google Test is being used
213 // (a macro is defined to 1 if compiled on the given platform;
214 // otherwise UNDEFINED -- it's never defined to 0.).  Google Test
215 // defines these macros automatically.  Code outside Google Test MUST
216 // NOT define them.
217 //
218 //   GTEST_OS_AIX      - IBM AIX
219 //   GTEST_OS_CYGWIN   - Cygwin
220 //   GTEST_OS_FREEBSD  - FreeBSD
221 //   GTEST_OS_HPUX     - HP-UX
222 //   GTEST_OS_LINUX    - Linux
223 //     GTEST_OS_LINUX_ANDROID - Google Android
224 //   GTEST_OS_MAC      - Mac OS X
225 //     GTEST_OS_IOS    - iOS
226 //   GTEST_OS_NACL     - Google Native Client (NaCl)
227 //   GTEST_OS_OPENBSD  - OpenBSD
228 //   GTEST_OS_QNX      - QNX
229 //   GTEST_OS_SOLARIS  - Sun Solaris
230 //   GTEST_OS_SYMBIAN  - Symbian
231 //   GTEST_OS_WINDOWS  - Windows (Desktop, MinGW, or Mobile)
232 //     GTEST_OS_WINDOWS_DESKTOP  - Windows Desktop
233 //     GTEST_OS_WINDOWS_MINGW    - MinGW
234 //     GTEST_OS_WINDOWS_MOBILE   - Windows Mobile
235 //     GTEST_OS_WINDOWS_PHONE    - Windows Phone
236 //     GTEST_OS_WINDOWS_RT       - Windows Store App/WinRT
237 //   GTEST_OS_ZOS      - z/OS
238 //
239 // Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
240 // most stable support.  Since core members of the Google Test project
241 // don't have access to other platforms, support for them may be less
242 // stable.  If you notice any problems on your platform, please notify
243 // googletestframework@googlegroups.com (patches for fixing them are
244 // even more welcome!).
245 //
246 // It is possible that none of the GTEST_OS_* macros are defined.
247
248 // Feature-indicating macros
249 // -------------------------
250 //
251 // Macros indicating which Google Test features are available (a macro
252 // is defined to 1 if the corresponding feature is supported;
253 // otherwise UNDEFINED -- it's never defined to 0.).  Google Test
254 // defines these macros automatically.  Code outside Google Test MUST
255 // NOT define them.
256 //
257 // These macros are public so that portable tests can be written.
258 // Such tests typically surround code using a feature with an #if
259 // which controls that code.  For example:
260 //
261 // #if GTEST_HAS_DEATH_TEST
262 //   EXPECT_DEATH(DoSomethingDeadly());
263 // #endif
264 //
265 //   GTEST_HAS_COMBINE      - the Combine() function (for value-parameterized
266 //                            tests)
267 //   GTEST_HAS_DEATH_TEST   - death tests
268 //   GTEST_HAS_PARAM_TEST   - value-parameterized tests
269 //   GTEST_HAS_TYPED_TEST   - typed tests
270 //   GTEST_HAS_TYPED_TEST_P - type-parameterized tests
271 //   GTEST_IS_THREADSAFE    - Google Test is thread-safe.
272 //   GTEST_USES_POSIX_RE    - enhanced POSIX regex is used. Do not confuse with
273 //                            GTEST_HAS_POSIX_RE (see above) which users can
274 //                            define themselves.
275 //   GTEST_USES_SIMPLE_RE   - our own simple regex is used;
276 //                            the above two are mutually exclusive.
277 //   GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
278
279 // Misc public macros
280 // ------------------
281 //
282 //   GTEST_FLAG(flag_name)  - references the variable corresponding to
283 //                            the given Google Test flag.
284
285 // Internal utilities
286 // ------------------
287 //
288 // The following macros and utilities are for Google Test's INTERNAL
289 // use only.  Code outside Google Test MUST NOT USE THEM DIRECTLY.
290 //
291 // Macros for basic C++ coding:
292 //   GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
293 //   GTEST_ATTRIBUTE_UNUSED_  - declares that a class' instances or a
294 //                              variable don't have to be used.
295 //   GTEST_DISALLOW_ASSIGN_   - disables operator=.
296 //   GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
297 //   GTEST_MUST_USE_RESULT_   - declares that a function's result must be used.
298 //   GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is
299 //                                        suppressed (constant conditional).
300 //   GTEST_INTENTIONAL_CONST_COND_POP_  - finish code section where MSVC C4127
301 //                                        is suppressed.
302 //
303 // C++11 feature wrappers:
304 //
305 //   testing::internal::move  - portability wrapper for std::move.
306 //
307 // Synchronization:
308 //   Mutex, MutexLock, ThreadLocal, GetThreadCount()
309 //                            - synchronization primitives.
310 //
311 // Template meta programming:
312 //   is_pointer     - as in TR1; needed on Symbian and IBM XL C/C++ only.
313 //   IteratorTraits - partial implementation of std::iterator_traits, which
314 //                    is not available in libCstd when compiled with Sun C++.
315 //
316 // Smart pointers:
317 //   scoped_ptr     - as in TR2.
318 //
319 // Regular expressions:
320 //   RE             - a simple regular expression class using the POSIX
321 //                    Extended Regular Expression syntax on UNIX-like
322 //                    platforms, or a reduced regular exception syntax on
323 //                    other platforms, including Windows.
324 //
325 // Logging:
326 //   GTEST_LOG_()   - logs messages at the specified severity level.
327 //   LogToStderr()  - directs all log messages to stderr.
328 //   FlushInfoLog() - flushes informational log messages.
329 //
330 // Stdout and stderr capturing:
331 //   CaptureStdout()     - starts capturing stdout.
332 //   GetCapturedStdout() - stops capturing stdout and returns the captured
333 //                         string.
334 //   CaptureStderr()     - starts capturing stderr.
335 //   GetCapturedStderr() - stops capturing stderr and returns the captured
336 //                         string.
337 //
338 // Integer types:
339 //   TypeWithSize   - maps an integer to a int type.
340 //   Int32, UInt32, Int64, UInt64, TimeInMillis
341 //                  - integers of known sizes.
342 //   BiggestInt     - the biggest signed integer type.
343 //
344 // Command-line utilities:
345 //   GTEST_DECLARE_*()  - declares a flag.
346 //   GTEST_DEFINE_*()   - defines a flag.
347 //   GetInjectableArgvs() - returns the command line as a vector of strings.
348 //
349 // Environment variable utilities:
350 //   GetEnv()             - gets the value of an environment variable.
351 //   BoolFromGTestEnv()   - parses a bool environment variable.
352 //   Int32FromGTestEnv()  - parses an Int32 environment variable.
353 //   StringFromGTestEnv() - parses a string environment variable.
354
355 #include <ctype.h>   // for isspace, etc
356 #include <stddef.h>  // for ptrdiff_t
357 #include <stdlib.h>
358 #include <stdio.h>
359 #include <string.h>
360 #ifndef _WIN32_WCE
361 # include <sys/types.h>
362 # include <sys/stat.h>
363 #endif  // !_WIN32_WCE
364
365 #if defined __APPLE__
366 # include <AvailabilityMacros.h>
367 # include <TargetConditionals.h>
368 #endif
369
370 #include <algorithm>  // NOLINT
371 #include <iostream>  // NOLINT
372 #include <sstream>  // NOLINT
373 #include <string>  // NOLINT
374 #include <utility>
375 #include <vector>  // NOLINT
376
377 // Copyright 2015, Google Inc.
378 // All rights reserved.
379 //
380 // Redistribution and use in source and binary forms, with or without
381 // modification, are permitted provided that the following conditions are
382 // met:
383 //
384 //     * Redistributions of source code must retain the above copyright
385 // notice, this list of conditions and the following disclaimer.
386 //     * Redistributions in binary form must reproduce the above
387 // copyright notice, this list of conditions and the following disclaimer
388 // in the documentation and/or other materials provided with the
389 // distribution.
390 //     * Neither the name of Google Inc. nor the names of its
391 // contributors may be used to endorse or promote products derived from
392 // this software without specific prior written permission.
393 //
394 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
395 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
396 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
397 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
398 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
399 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
400 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
401 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
402 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
403 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
404 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
405 //
406 // The Google C++ Testing Framework (Google Test)
407 //
408 // This header file defines the GTEST_OS_* macro.
409 // It is separate from gtest-port.h so that custom/gtest-port.h can include it.
410
411 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
412 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
413
414 // Determines the platform on which Google Test is compiled.
415 #ifdef __CYGWIN__
416 # define GTEST_OS_CYGWIN 1
417 #elif defined __SYMBIAN32__
418 # define GTEST_OS_SYMBIAN 1
419 #elif defined _WIN32
420 # define GTEST_OS_WINDOWS 1
421 # ifdef _WIN32_WCE
422 #  define GTEST_OS_WINDOWS_MOBILE 1
423 # elif defined(__MINGW__) || defined(__MINGW32__)
424 #  define GTEST_OS_WINDOWS_MINGW 1
425 # elif defined(WINAPI_FAMILY)
426 #  include <winapifamily.h>
427 #  if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
428 #   define GTEST_OS_WINDOWS_DESKTOP 1
429 #  elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
430 #   define GTEST_OS_WINDOWS_PHONE 1
431 #  elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
432 #   define GTEST_OS_WINDOWS_RT 1
433 #  else
434     // WINAPI_FAMILY defined but no known partition matched.
435     // Default to desktop.
436 #   define GTEST_OS_WINDOWS_DESKTOP 1
437 #  endif
438 # else
439 #  define GTEST_OS_WINDOWS_DESKTOP 1
440 # endif  // _WIN32_WCE
441 #elif defined __APPLE__
442 # define GTEST_OS_MAC 1
443 # if TARGET_OS_IPHONE
444 #  define GTEST_OS_IOS 1
445 # endif
446 #elif defined __FreeBSD__
447 # define GTEST_OS_FREEBSD 1
448 #elif defined __linux__
449 # define GTEST_OS_LINUX 1
450 # if defined __ANDROID__
451 #  define GTEST_OS_LINUX_ANDROID 1
452 # endif
453 #elif defined __MVS__
454 # define GTEST_OS_ZOS 1
455 #elif defined(__sun) && defined(__SVR4)
456 # define GTEST_OS_SOLARIS 1
457 #elif defined(_AIX)
458 # define GTEST_OS_AIX 1
459 #elif defined(__hpux)
460 # define GTEST_OS_HPUX 1
461 #elif defined __native_client__
462 # define GTEST_OS_NACL 1
463 #elif defined __OpenBSD__
464 # define GTEST_OS_OPENBSD 1
465 #elif defined __QNX__
466 # define GTEST_OS_QNX 1
467 #endif  // __CYGWIN__
468
469 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
470 // Copyright 2015, Google Inc.
471 // All rights reserved.
472 //
473 // Redistribution and use in source and binary forms, with or without
474 // modification, are permitted provided that the following conditions are
475 // met:
476 //
477 //     * Redistributions of source code must retain the above copyright
478 // notice, this list of conditions and the following disclaimer.
479 //     * Redistributions in binary form must reproduce the above
480 // copyright notice, this list of conditions and the following disclaimer
481 // in the documentation and/or other materials provided with the
482 // distribution.
483 //     * Neither the name of Google Inc. nor the names of its
484 // contributors may be used to endorse or promote products derived from
485 // this software without specific prior written permission.
486 //
487 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
488 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
489 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
490 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
491 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
492 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
493 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
494 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
495 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
496 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
497 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
498 //
499 // Injection point for custom user configurations.
500 // The following macros can be defined:
501 //
502 //   Flag related macros:
503 //     GTEST_FLAG(flag_name)
504 //     GTEST_USE_OWN_FLAGFILE_FLAG_  - Define to 0 when the system provides its
505 //                                     own flagfile flag parsing.
506 //     GTEST_DECLARE_bool_(name)
507 //     GTEST_DECLARE_int32_(name)
508 //     GTEST_DECLARE_string_(name)
509 //     GTEST_DEFINE_bool_(name, default_val, doc)
510 //     GTEST_DEFINE_int32_(name, default_val, doc)
511 //     GTEST_DEFINE_string_(name, default_val, doc)
512 //
513 //   Test filtering:
514 //     GTEST_TEST_FILTER_ENV_VAR_ - The name of an environment variable that
515 //                                  will be used if --GTEST_FLAG(test_filter)
516 //                                  is not provided.
517 //
518 //   Logging:
519 //     GTEST_LOG_(severity)
520 //     GTEST_CHECK_(condition)
521 //     Functions LogToStderr() and FlushInfoLog() have to be provided too.
522 //
523 //   Threading:
524 //     GTEST_HAS_NOTIFICATION_ - Enabled if Notification is already provided.
525 //     GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Enabled if Mutex and ThreadLocal are
526 //                                         already provided.
527 //     Must also provide GTEST_DECLARE_STATIC_MUTEX_(mutex) and
528 //     GTEST_DEFINE_STATIC_MUTEX_(mutex)
529 //
530 //     GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
531 //     GTEST_LOCK_EXCLUDED_(locks)
532 //
533 // ** Custom implementation starts here **
534
535 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
536 #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
537
538 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
539
540 #if !defined(GTEST_DEV_EMAIL_)
541 # define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
542 # define GTEST_FLAG_PREFIX_ "gtest_"
543 # define GTEST_FLAG_PREFIX_DASH_ "gtest-"
544 # define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
545 # define GTEST_NAME_ "Google Test"
546 # define GTEST_PROJECT_URL_ "https://github.com/google/googletest/"
547 #endif  // !defined(GTEST_DEV_EMAIL_)
548
549 #if !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
550 # define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest"
551 #endif  // !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
552
553 // Determines the version of gcc that is used to compile this.
554 #ifdef __GNUC__
555 // 40302 means version 4.3.2.
556 # define GTEST_GCC_VER_ \
557     (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
558 #endif  // __GNUC__
559
560 // Macros for disabling Microsoft Visual C++ warnings.
561 //
562 //   GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385)
563 //   /* code that triggers warnings C4800 and C4385 */
564 //   GTEST_DISABLE_MSC_WARNINGS_POP_()
565 #if _MSC_VER >= 1500
566 # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \
567     __pragma(warning(push))                        \
568     __pragma(warning(disable: warnings))
569 # define GTEST_DISABLE_MSC_WARNINGS_POP_()          \
570     __pragma(warning(pop))
571 #else
572 // Older versions of MSVC don't have __pragma.
573 # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
574 # define GTEST_DISABLE_MSC_WARNINGS_POP_()
575 #endif
576
577 #ifndef GTEST_LANG_CXX11
578 // gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
579 // -std={c,gnu}++{0x,11} is passed.  The C++11 standard specifies a
580 // value for __cplusplus, and recent versions of clang, gcc, and
581 // probably other compilers set that too in C++11 mode.
582 # if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
583 // Compiling in at least C++11 mode.
584 #  define GTEST_LANG_CXX11 1
585 # else
586 #  define GTEST_LANG_CXX11 0
587 # endif
588 #endif
589
590 // Distinct from C++11 language support, some environments don't provide
591 // proper C++11 library support. Notably, it's possible to build in
592 // C++11 mode when targeting Mac OS X 10.6, which has an old libstdc++
593 // with no C++11 support.
594 //
595 // libstdc++ has sufficient C++11 support as of GCC 4.6.0, __GLIBCXX__
596 // 20110325, but maintenance releases in the 4.4 and 4.5 series followed
597 // this date, so check for those versions by their date stamps.
598 // https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning
599 #if GTEST_LANG_CXX11 && \
600     (!defined(__GLIBCXX__) || ( \
601         __GLIBCXX__ >= 20110325ul &&  /* GCC >= 4.6.0 */ \
602         /* Blacklist of patch releases of older branches: */ \
603         __GLIBCXX__ != 20110416ul &&  /* GCC 4.4.6 */ \
604         __GLIBCXX__ != 20120313ul &&  /* GCC 4.4.7 */ \
605         __GLIBCXX__ != 20110428ul &&  /* GCC 4.5.3 */ \
606         __GLIBCXX__ != 20120702ul))   /* GCC 4.5.4 */
607 # define GTEST_STDLIB_CXX11 1
608 #endif
609
610 // Only use C++11 library features if the library provides them.
611 #if GTEST_STDLIB_CXX11
612 # define GTEST_HAS_STD_BEGIN_AND_END_ 1
613 # define GTEST_HAS_STD_FORWARD_LIST_ 1
614 # define GTEST_HAS_STD_FUNCTION_ 1
615 # define GTEST_HAS_STD_INITIALIZER_LIST_ 1
616 # define GTEST_HAS_STD_MOVE_ 1
617 # define GTEST_HAS_STD_SHARED_PTR_ 1
618 # define GTEST_HAS_STD_TYPE_TRAITS_ 1
619 # define GTEST_HAS_STD_UNIQUE_PTR_ 1
620 #endif
621
622 // C++11 specifies that <tuple> provides std::tuple.
623 // Some platforms still might not have it, however.
624 #if GTEST_LANG_CXX11
625 # define GTEST_HAS_STD_TUPLE_ 1
626 # if defined(__clang__)
627 // Inspired by http://clang.llvm.org/docs/LanguageExtensions.html#__has_include
628 #  if defined(__has_include) && !__has_include(<tuple>)
629 #   undef GTEST_HAS_STD_TUPLE_
630 #  endif
631 # elif defined(_MSC_VER)
632 // Inspired by boost/config/stdlib/dinkumware.hpp
633 #  if defined(_CPPLIB_VER) && _CPPLIB_VER < 520
634 #   undef GTEST_HAS_STD_TUPLE_
635 #  endif
636 # elif defined(__GLIBCXX__)
637 // Inspired by boost/config/stdlib/libstdcpp3.hpp,
638 // http://gcc.gnu.org/gcc-4.2/changes.html and
639 // http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt01ch01.html#manual.intro.status.standard.200x
640 #  if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
641 #   undef GTEST_HAS_STD_TUPLE_
642 #  endif
643 # endif
644 #endif
645
646 // Brings in definitions for functions used in the testing::internal::posix
647 // namespace (read, write, close, chdir, isatty, stat). We do not currently
648 // use them on Windows Mobile.
649 #if GTEST_OS_WINDOWS
650 # if !GTEST_OS_WINDOWS_MOBILE
651 #  include <direct.h>
652 #  include <io.h>
653 # endif
654 // In order to avoid having to include <windows.h>, use forward declaration
655 #if GTEST_OS_WINDOWS_MINGW && !defined(__MINGW64_VERSION_MAJOR)
656 // MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two
657 // separate (equivalent) structs, instead of using typedef
658 typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION;
659 #else
660 // Assume CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
661 // This assumption is verified by
662 // WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
663 typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
664 #endif
665 #else
666 // This assumes that non-Windows OSes provide unistd.h. For OSes where this
667 // is not the case, we need to include headers that provide the functions
668 // mentioned above.
669 # include <unistd.h>
670 # include <strings.h>
671 #endif  // GTEST_OS_WINDOWS
672
673 #if GTEST_OS_LINUX_ANDROID
674 // Used to define __ANDROID_API__ matching the target NDK API level.
675 #  include <android/api-level.h>  // NOLINT
676 #endif
677
678 // Defines this to true iff Google Test can use POSIX regular expressions.
679 #ifndef GTEST_HAS_POSIX_RE
680 # if GTEST_OS_LINUX_ANDROID
681 // On Android, <regex.h> is only available starting with Gingerbread.
682 #  define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
683 # else
684 #  define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
685 # endif
686 #endif
687
688 #if GTEST_USES_PCRE
689 // The appropriate headers have already been included.
690
691 #elif GTEST_HAS_POSIX_RE
692
693 // On some platforms, <regex.h> needs someone to define size_t, and
694 // won't compile otherwise.  We can #include it here as we already
695 // included <stdlib.h>, which is guaranteed to define size_t through
696 // <stddef.h>.
697 # include <regex.h>  // NOLINT
698
699 # define GTEST_USES_POSIX_RE 1
700
701 #elif GTEST_OS_WINDOWS
702
703 // <regex.h> is not available on Windows.  Use our own simple regex
704 // implementation instead.
705 # define GTEST_USES_SIMPLE_RE 1
706
707 #else
708
709 // <regex.h> may not be available on this platform.  Use our own
710 // simple regex implementation instead.
711 # define GTEST_USES_SIMPLE_RE 1
712
713 #endif  // GTEST_USES_PCRE
714
715 #ifndef GTEST_HAS_EXCEPTIONS
716 // The user didn't tell us whether exceptions are enabled, so we need
717 // to figure it out.
718 # if defined(_MSC_VER) || defined(__BORLANDC__)
719 // MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
720 // macro to enable exceptions, so we'll do the same.
721 // Assumes that exceptions are enabled by default.
722 #  ifndef _HAS_EXCEPTIONS
723 #   define _HAS_EXCEPTIONS 1
724 #  endif  // _HAS_EXCEPTIONS
725 #  define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
726 # elif defined(__clang__)
727 // clang defines __EXCEPTIONS iff exceptions are enabled before clang 220714,
728 // but iff cleanups are enabled after that. In Obj-C++ files, there can be
729 // cleanups for ObjC exceptions which also need cleanups, even if C++ exceptions
730 // are disabled. clang has __has_feature(cxx_exceptions) which checks for C++
731 // exceptions starting at clang r206352, but which checked for cleanups prior to
732 // that. To reliably check for C++ exception availability with clang, check for
733 // __EXCEPTIONS && __has_feature(cxx_exceptions).
734 #  define GTEST_HAS_EXCEPTIONS (__EXCEPTIONS && __has_feature(cxx_exceptions))
735 # elif defined(__GNUC__) && __EXCEPTIONS
736 // gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
737 #  define GTEST_HAS_EXCEPTIONS 1
738 # elif defined(__SUNPRO_CC)
739 // Sun Pro CC supports exceptions.  However, there is no compile-time way of
740 // detecting whether they are enabled or not.  Therefore, we assume that
741 // they are enabled unless the user tells us otherwise.
742 #  define GTEST_HAS_EXCEPTIONS 1
743 # elif defined(__IBMCPP__) && __EXCEPTIONS
744 // xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
745 #  define GTEST_HAS_EXCEPTIONS 1
746 # elif defined(__HP_aCC)
747 // Exception handling is in effect by default in HP aCC compiler. It has to
748 // be turned of by +noeh compiler option if desired.
749 #  define GTEST_HAS_EXCEPTIONS 1
750 # else
751 // For other compilers, we assume exceptions are disabled to be
752 // conservative.
753 #  define GTEST_HAS_EXCEPTIONS 0
754 # endif  // defined(_MSC_VER) || defined(__BORLANDC__)
755 #endif  // GTEST_HAS_EXCEPTIONS
756
757 #if !defined(GTEST_HAS_STD_STRING)
758 // Even though we don't use this macro any longer, we keep it in case
759 // some clients still depend on it.
760 # define GTEST_HAS_STD_STRING 1
761 #elif !GTEST_HAS_STD_STRING
762 // The user told us that ::std::string isn't available.
763 # error "Google Test cannot be used where ::std::string isn't available."
764 #endif  // !defined(GTEST_HAS_STD_STRING)
765
766 #ifndef GTEST_HAS_GLOBAL_STRING
767 // The user didn't tell us whether ::string is available, so we need
768 // to figure it out.
769
770 # define GTEST_HAS_GLOBAL_STRING 0
771
772 #endif  // GTEST_HAS_GLOBAL_STRING
773
774 #ifndef GTEST_HAS_STD_WSTRING
775 // The user didn't tell us whether ::std::wstring is available, so we need
776 // to figure it out.
777 // TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
778 //   is available.
779
780 // Cygwin 1.7 and below doesn't support ::std::wstring.
781 // Solaris' libc++ doesn't support it either.  Android has
782 // no support for it at least as recent as Froyo (2.2).
783 # define GTEST_HAS_STD_WSTRING \
784     (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
785
786 #endif  // GTEST_HAS_STD_WSTRING
787
788 #ifndef GTEST_HAS_GLOBAL_WSTRING
789 // The user didn't tell us whether ::wstring is available, so we need
790 // to figure it out.
791 # define GTEST_HAS_GLOBAL_WSTRING \
792     (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
793 #endif  // GTEST_HAS_GLOBAL_WSTRING
794
795 // Determines whether RTTI is available.
796 #ifndef GTEST_HAS_RTTI
797 // The user didn't tell us whether RTTI is enabled, so we need to
798 // figure it out.
799
800 # ifdef _MSC_VER
801
802 #  ifdef _CPPRTTI  // MSVC defines this macro iff RTTI is enabled.
803 #   define GTEST_HAS_RTTI 1
804 #  else
805 #   define GTEST_HAS_RTTI 0
806 #  endif
807
808 // Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
809 # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
810
811 #  ifdef __GXX_RTTI
812 // When building against STLport with the Android NDK and with
813 // -frtti -fno-exceptions, the build fails at link time with undefined
814 // references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
815 // so disable RTTI when detected.
816 #   if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
817        !defined(__EXCEPTIONS)
818 #    define GTEST_HAS_RTTI 0
819 #   else
820 #    define GTEST_HAS_RTTI 1
821 #   endif  // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
822 #  else
823 #   define GTEST_HAS_RTTI 0
824 #  endif  // __GXX_RTTI
825
826 // Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
827 // using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
828 // first version with C++ support.
829 # elif defined(__clang__)
830
831 #  define GTEST_HAS_RTTI __has_feature(cxx_rtti)
832
833 // Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
834 // both the typeid and dynamic_cast features are present.
835 # elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
836
837 #  ifdef __RTTI_ALL__
838 #   define GTEST_HAS_RTTI 1
839 #  else
840 #   define GTEST_HAS_RTTI 0
841 #  endif
842
843 # else
844
845 // For all other compilers, we assume RTTI is enabled.
846 #  define GTEST_HAS_RTTI 1
847
848 # endif  // _MSC_VER
849
850 #endif  // GTEST_HAS_RTTI
851
852 // It's this header's responsibility to #include <typeinfo> when RTTI
853 // is enabled.
854 #if GTEST_HAS_RTTI
855 # include <typeinfo>
856 #endif
857
858 // Determines whether Google Test can use the pthreads library.
859 #ifndef GTEST_HAS_PTHREAD
860 // The user didn't tell us explicitly, so we make reasonable assumptions about
861 // which platforms have pthreads support.
862 //
863 // To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
864 // to your compiler flags.
865 # define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \
866     || GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NACL)
867 #endif  // GTEST_HAS_PTHREAD
868
869 #if GTEST_HAS_PTHREAD
870 // gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
871 // true.
872 # include <pthread.h>  // NOLINT
873
874 // For timespec and nanosleep, used below.
875 # include <time.h>  // NOLINT
876 #endif
877
878 // Determines if hash_map/hash_set are available.
879 // Only used for testing against those containers.
880 #if !defined(GTEST_HAS_HASH_MAP_)
881 # if _MSC_VER
882 #  define GTEST_HAS_HASH_MAP_ 1  // Indicates that hash_map is available.
883 #  define GTEST_HAS_HASH_SET_ 1  // Indicates that hash_set is available.
884 # endif  // _MSC_VER
885 #endif  // !defined(GTEST_HAS_HASH_MAP_)
886
887 // Determines whether Google Test can use tr1/tuple.  You can define
888 // this macro to 0 to prevent Google Test from using tuple (any
889 // feature depending on tuple with be disabled in this mode).
890 #ifndef GTEST_HAS_TR1_TUPLE
891 # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)
892 // STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>.
893 #  define GTEST_HAS_TR1_TUPLE 0
894 # else
895 // The user didn't tell us not to do it, so we assume it's OK.
896 #  define GTEST_HAS_TR1_TUPLE 1
897 # endif
898 #endif  // GTEST_HAS_TR1_TUPLE
899
900 // Determines whether Google Test's own tr1 tuple implementation
901 // should be used.
902 #ifndef GTEST_USE_OWN_TR1_TUPLE
903 // The user didn't tell us, so we need to figure it out.
904
905 // We use our own TR1 tuple if we aren't sure the user has an
906 // implementation of it already.  At this time, libstdc++ 4.0.0+ and
907 // MSVC 2010 are the only mainstream standard libraries that come
908 // with a TR1 tuple implementation.  NVIDIA's CUDA NVCC compiler
909 // pretends to be GCC by defining __GNUC__ and friends, but cannot
910 // compile GCC's tuple implementation.  MSVC 2008 (9.0) provides TR1
911 // tuple in a 323 MB Feature Pack download, which we cannot assume the
912 // user has.  QNX's QCC compiler is a modified GCC but it doesn't
913 // support TR1 tuple.  libc++ only provides std::tuple, in C++11 mode,
914 // and it can be used with some compilers that define __GNUC__.
915 # if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
916       && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
917 #  define GTEST_ENV_HAS_TR1_TUPLE_ 1
918 # endif
919
920 // C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used
921 // in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6
922 // can build with clang but need to use gcc4.2's libstdc++).
923 # if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
924 #  define GTEST_ENV_HAS_STD_TUPLE_ 1
925 # endif
926
927 # if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_
928 #  define GTEST_USE_OWN_TR1_TUPLE 0
929 # else
930 #  define GTEST_USE_OWN_TR1_TUPLE 1
931 # endif
932
933 #endif  // GTEST_USE_OWN_TR1_TUPLE
934
935 // To avoid conditional compilation everywhere, we make it
936 // gtest-port.h's responsibility to #include the header implementing
937 // tuple.
938 #if GTEST_HAS_STD_TUPLE_
939 # include <tuple>  // IWYU pragma: export
940 # define GTEST_TUPLE_NAMESPACE_ ::std
941 #endif  // GTEST_HAS_STD_TUPLE_
942
943 // We include tr1::tuple even if std::tuple is available to define printers for
944 // them.
945 #if GTEST_HAS_TR1_TUPLE
946 # ifndef GTEST_TUPLE_NAMESPACE_
947 #  define GTEST_TUPLE_NAMESPACE_ ::std::tr1
948 # endif  // GTEST_TUPLE_NAMESPACE_
949
950 # if GTEST_USE_OWN_TR1_TUPLE
951 // This file was GENERATED by command:
952 //     pump.py gtest-tuple.h.pump
953 // DO NOT EDIT BY HAND!!!
954
955 // Copyright 2009 Google Inc.
956 // All Rights Reserved.
957 //
958 // Redistribution and use in source and binary forms, with or without
959 // modification, are permitted provided that the following conditions are
960 // met:
961 //
962 //     * Redistributions of source code must retain the above copyright
963 // notice, this list of conditions and the following disclaimer.
964 //     * Redistributions in binary form must reproduce the above
965 // copyright notice, this list of conditions and the following disclaimer
966 // in the documentation and/or other materials provided with the
967 // distribution.
968 //     * Neither the name of Google Inc. nor the names of its
969 // contributors may be used to endorse or promote products derived from
970 // this software without specific prior written permission.
971 //
972 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
973 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
974 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
975 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
976 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
977 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
978 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
979 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
980 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
981 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
982 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
983 //
984 // Author: wan@google.com (Zhanyong Wan)
985
986 // Implements a subset of TR1 tuple needed by Google Test and Google Mock.
987
988 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
989 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
990
991 #include <utility>  // For ::std::pair.
992
993 // The compiler used in Symbian has a bug that prevents us from declaring the
994 // tuple template as a friend (it complains that tuple is redefined).  This
995 // hack bypasses the bug by declaring the members that should otherwise be
996 // private as public.
997 // Sun Studio versions < 12 also have the above bug.
998 #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
999 # define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
1000 #else
1001 # define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
1002     template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
1003    private:
1004 #endif
1005
1006 // Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that conflict
1007 // with our own definitions. Therefore using our own tuple does not work on
1008 // those compilers.
1009 #if defined(_MSC_VER) && _MSC_VER >= 1600  /* 1600 is Visual Studio 2010 */
1010 # error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \
1011 GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers."
1012 #endif
1013
1014 // GTEST_n_TUPLE_(T) is the type of an n-tuple.
1015 #define GTEST_0_TUPLE_(T) tuple<>
1016 #define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
1017     void, void, void>
1018 #define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
1019     void, void, void>
1020 #define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
1021     void, void, void>
1022 #define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
1023     void, void, void>
1024 #define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
1025     void, void, void>
1026 #define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
1027     void, void, void>
1028 #define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
1029     void, void, void>
1030 #define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
1031     T##7, void, void>
1032 #define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
1033     T##7, T##8, void>
1034 #define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
1035     T##7, T##8, T##9>
1036
1037 // GTEST_n_TYPENAMES_(T) declares a list of n typenames.
1038 #define GTEST_0_TYPENAMES_(T)
1039 #define GTEST_1_TYPENAMES_(T) typename T##0
1040 #define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
1041 #define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
1042 #define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1043     typename T##3
1044 #define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1045     typename T##3, typename T##4
1046 #define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1047     typename T##3, typename T##4, typename T##5
1048 #define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1049     typename T##3, typename T##4, typename T##5, typename T##6
1050 #define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1051     typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
1052 #define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1053     typename T##3, typename T##4, typename T##5, typename T##6, \
1054     typename T##7, typename T##8
1055 #define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
1056     typename T##3, typename T##4, typename T##5, typename T##6, \
1057     typename T##7, typename T##8, typename T##9
1058
1059 // In theory, defining stuff in the ::std namespace is undefined
1060 // behavior.  We can do this as we are playing the role of a standard
1061 // library vendor.
1062 namespace std {
1063 namespace tr1 {
1064
1065 template <typename T0 = void, typename T1 = void, typename T2 = void,
1066     typename T3 = void, typename T4 = void, typename T5 = void,
1067     typename T6 = void, typename T7 = void, typename T8 = void,
1068     typename T9 = void>
1069 class tuple;
1070
1071 // Anything in namespace gtest_internal is Google Test's INTERNAL
1072 // IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
1073 namespace gtest_internal {
1074
1075 // ByRef<T>::type is T if T is a reference; otherwise it's const T&.
1076 template <typename T>
1077 struct ByRef { typedef const T& type; };  // NOLINT
1078 template <typename T>
1079 struct ByRef<T&> { typedef T& type; };  // NOLINT
1080
1081 // A handy wrapper for ByRef.
1082 #define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
1083
1084 // AddRef<T>::type is T if T is a reference; otherwise it's T&.  This
1085 // is the same as tr1::add_reference<T>::type.
1086 template <typename T>
1087 struct AddRef { typedef T& type; };  // NOLINT
1088 template <typename T>
1089 struct AddRef<T&> { typedef T& type; };  // NOLINT
1090
1091 // A handy wrapper for AddRef.
1092 #define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
1093
1094 // A helper for implementing get<k>().
1095 template <int k> class Get;
1096
1097 // A helper for implementing tuple_element<k, T>.  kIndexValid is true
1098 // iff k < the number of fields in tuple type T.
1099 template <bool kIndexValid, int kIndex, class Tuple>
1100 struct TupleElement;
1101
1102 template <GTEST_10_TYPENAMES_(T)>
1103 struct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {
1104   typedef T0 type;
1105 };
1106
1107 template <GTEST_10_TYPENAMES_(T)>
1108 struct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {
1109   typedef T1 type;
1110 };
1111
1112 template <GTEST_10_TYPENAMES_(T)>
1113 struct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {
1114   typedef T2 type;
1115 };
1116
1117 template <GTEST_10_TYPENAMES_(T)>
1118 struct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {
1119   typedef T3 type;
1120 };
1121
1122 template <GTEST_10_TYPENAMES_(T)>
1123 struct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {
1124   typedef T4 type;
1125 };
1126
1127 template <GTEST_10_TYPENAMES_(T)>
1128 struct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {
1129   typedef T5 type;
1130 };
1131
1132 template <GTEST_10_TYPENAMES_(T)>
1133 struct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {
1134   typedef T6 type;
1135 };
1136
1137 template <GTEST_10_TYPENAMES_(T)>
1138 struct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {
1139   typedef T7 type;
1140 };
1141
1142 template <GTEST_10_TYPENAMES_(T)>
1143 struct TupleElement<true, 8, GTEST_10_TUPLE_(T) > {
1144   typedef T8 type;
1145 };
1146
1147 template <GTEST_10_TYPENAMES_(T)>
1148 struct TupleElement<true, 9, GTEST_10_TUPLE_(T) > {
1149   typedef T9 type;
1150 };
1151
1152 }  // namespace gtest_internal
1153
1154 template <>
1155 class tuple<> {
1156  public:
1157   tuple() {}
1158   tuple(const tuple& /* t */)  {}
1159   tuple& operator=(const tuple& /* t */) { return *this; }
1160 };
1161
1162 template <GTEST_1_TYPENAMES_(T)>
1163 class GTEST_1_TUPLE_(T) {
1164  public:
1165   template <int k> friend class gtest_internal::Get;
1166
1167   tuple() : f0_() {}
1168
1169   explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
1170
1171   tuple(const tuple& t) : f0_(t.f0_) {}
1172
1173   template <GTEST_1_TYPENAMES_(U)>
1174   tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
1175
1176   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1177
1178   template <GTEST_1_TYPENAMES_(U)>
1179   tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
1180     return CopyFrom(t);
1181   }
1182
1183   GTEST_DECLARE_TUPLE_AS_FRIEND_
1184
1185   template <GTEST_1_TYPENAMES_(U)>
1186   tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
1187     f0_ = t.f0_;
1188     return *this;
1189   }
1190
1191   T0 f0_;
1192 };
1193
1194 template <GTEST_2_TYPENAMES_(T)>
1195 class GTEST_2_TUPLE_(T) {
1196  public:
1197   template <int k> friend class gtest_internal::Get;
1198
1199   tuple() : f0_(), f1_() {}
1200
1201   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
1202       f1_(f1) {}
1203
1204   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
1205
1206   template <GTEST_2_TYPENAMES_(U)>
1207   tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
1208   template <typename U0, typename U1>
1209   tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
1210
1211   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1212
1213   template <GTEST_2_TYPENAMES_(U)>
1214   tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
1215     return CopyFrom(t);
1216   }
1217   template <typename U0, typename U1>
1218   tuple& operator=(const ::std::pair<U0, U1>& p) {
1219     f0_ = p.first;
1220     f1_ = p.second;
1221     return *this;
1222   }
1223
1224   GTEST_DECLARE_TUPLE_AS_FRIEND_
1225
1226   template <GTEST_2_TYPENAMES_(U)>
1227   tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
1228     f0_ = t.f0_;
1229     f1_ = t.f1_;
1230     return *this;
1231   }
1232
1233   T0 f0_;
1234   T1 f1_;
1235 };
1236
1237 template <GTEST_3_TYPENAMES_(T)>
1238 class GTEST_3_TUPLE_(T) {
1239  public:
1240   template <int k> friend class gtest_internal::Get;
1241
1242   tuple() : f0_(), f1_(), f2_() {}
1243
1244   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1245       GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
1246
1247   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
1248
1249   template <GTEST_3_TYPENAMES_(U)>
1250   tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
1251
1252   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1253
1254   template <GTEST_3_TYPENAMES_(U)>
1255   tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
1256     return CopyFrom(t);
1257   }
1258
1259   GTEST_DECLARE_TUPLE_AS_FRIEND_
1260
1261   template <GTEST_3_TYPENAMES_(U)>
1262   tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
1263     f0_ = t.f0_;
1264     f1_ = t.f1_;
1265     f2_ = t.f2_;
1266     return *this;
1267   }
1268
1269   T0 f0_;
1270   T1 f1_;
1271   T2 f2_;
1272 };
1273
1274 template <GTEST_4_TYPENAMES_(T)>
1275 class GTEST_4_TUPLE_(T) {
1276  public:
1277   template <int k> friend class gtest_internal::Get;
1278
1279   tuple() : f0_(), f1_(), f2_(), f3_() {}
1280
1281   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1282       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
1283       f3_(f3) {}
1284
1285   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
1286
1287   template <GTEST_4_TYPENAMES_(U)>
1288   tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1289       f3_(t.f3_) {}
1290
1291   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1292
1293   template <GTEST_4_TYPENAMES_(U)>
1294   tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
1295     return CopyFrom(t);
1296   }
1297
1298   GTEST_DECLARE_TUPLE_AS_FRIEND_
1299
1300   template <GTEST_4_TYPENAMES_(U)>
1301   tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
1302     f0_ = t.f0_;
1303     f1_ = t.f1_;
1304     f2_ = t.f2_;
1305     f3_ = t.f3_;
1306     return *this;
1307   }
1308
1309   T0 f0_;
1310   T1 f1_;
1311   T2 f2_;
1312   T3 f3_;
1313 };
1314
1315 template <GTEST_5_TYPENAMES_(T)>
1316 class GTEST_5_TUPLE_(T) {
1317  public:
1318   template <int k> friend class gtest_internal::Get;
1319
1320   tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
1321
1322   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1323       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
1324       GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
1325
1326   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1327       f4_(t.f4_) {}
1328
1329   template <GTEST_5_TYPENAMES_(U)>
1330   tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1331       f3_(t.f3_), f4_(t.f4_) {}
1332
1333   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1334
1335   template <GTEST_5_TYPENAMES_(U)>
1336   tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
1337     return CopyFrom(t);
1338   }
1339
1340   GTEST_DECLARE_TUPLE_AS_FRIEND_
1341
1342   template <GTEST_5_TYPENAMES_(U)>
1343   tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
1344     f0_ = t.f0_;
1345     f1_ = t.f1_;
1346     f2_ = t.f2_;
1347     f3_ = t.f3_;
1348     f4_ = t.f4_;
1349     return *this;
1350   }
1351
1352   T0 f0_;
1353   T1 f1_;
1354   T2 f2_;
1355   T3 f3_;
1356   T4 f4_;
1357 };
1358
1359 template <GTEST_6_TYPENAMES_(T)>
1360 class GTEST_6_TUPLE_(T) {
1361  public:
1362   template <int k> friend class gtest_internal::Get;
1363
1364   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
1365
1366   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1367       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1368       GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
1369       f5_(f5) {}
1370
1371   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1372       f4_(t.f4_), f5_(t.f5_) {}
1373
1374   template <GTEST_6_TYPENAMES_(U)>
1375   tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1376       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
1377
1378   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1379
1380   template <GTEST_6_TYPENAMES_(U)>
1381   tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
1382     return CopyFrom(t);
1383   }
1384
1385   GTEST_DECLARE_TUPLE_AS_FRIEND_
1386
1387   template <GTEST_6_TYPENAMES_(U)>
1388   tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
1389     f0_ = t.f0_;
1390     f1_ = t.f1_;
1391     f2_ = t.f2_;
1392     f3_ = t.f3_;
1393     f4_ = t.f4_;
1394     f5_ = t.f5_;
1395     return *this;
1396   }
1397
1398   T0 f0_;
1399   T1 f1_;
1400   T2 f2_;
1401   T3 f3_;
1402   T4 f4_;
1403   T5 f5_;
1404 };
1405
1406 template <GTEST_7_TYPENAMES_(T)>
1407 class GTEST_7_TUPLE_(T) {
1408  public:
1409   template <int k> friend class gtest_internal::Get;
1410
1411   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
1412
1413   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1414       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1415       GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
1416       f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
1417
1418   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1419       f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
1420
1421   template <GTEST_7_TYPENAMES_(U)>
1422   tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1423       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
1424
1425   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1426
1427   template <GTEST_7_TYPENAMES_(U)>
1428   tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
1429     return CopyFrom(t);
1430   }
1431
1432   GTEST_DECLARE_TUPLE_AS_FRIEND_
1433
1434   template <GTEST_7_TYPENAMES_(U)>
1435   tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
1436     f0_ = t.f0_;
1437     f1_ = t.f1_;
1438     f2_ = t.f2_;
1439     f3_ = t.f3_;
1440     f4_ = t.f4_;
1441     f5_ = t.f5_;
1442     f6_ = t.f6_;
1443     return *this;
1444   }
1445
1446   T0 f0_;
1447   T1 f1_;
1448   T2 f2_;
1449   T3 f3_;
1450   T4 f4_;
1451   T5 f5_;
1452   T6 f6_;
1453 };
1454
1455 template <GTEST_8_TYPENAMES_(T)>
1456 class GTEST_8_TUPLE_(T) {
1457  public:
1458   template <int k> friend class gtest_internal::Get;
1459
1460   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
1461
1462   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1463       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1464       GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
1465       GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
1466       f5_(f5), f6_(f6), f7_(f7) {}
1467
1468   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1469       f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
1470
1471   template <GTEST_8_TYPENAMES_(U)>
1472   tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1473       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
1474
1475   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1476
1477   template <GTEST_8_TYPENAMES_(U)>
1478   tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
1479     return CopyFrom(t);
1480   }
1481
1482   GTEST_DECLARE_TUPLE_AS_FRIEND_
1483
1484   template <GTEST_8_TYPENAMES_(U)>
1485   tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
1486     f0_ = t.f0_;
1487     f1_ = t.f1_;
1488     f2_ = t.f2_;
1489     f3_ = t.f3_;
1490     f4_ = t.f4_;
1491     f5_ = t.f5_;
1492     f6_ = t.f6_;
1493     f7_ = t.f7_;
1494     return *this;
1495   }
1496
1497   T0 f0_;
1498   T1 f1_;
1499   T2 f2_;
1500   T3 f3_;
1501   T4 f4_;
1502   T5 f5_;
1503   T6 f6_;
1504   T7 f7_;
1505 };
1506
1507 template <GTEST_9_TYPENAMES_(T)>
1508 class GTEST_9_TUPLE_(T) {
1509  public:
1510   template <int k> friend class gtest_internal::Get;
1511
1512   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
1513
1514   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1515       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1516       GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
1517       GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
1518       f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
1519
1520   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1521       f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
1522
1523   template <GTEST_9_TYPENAMES_(U)>
1524   tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1525       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
1526
1527   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1528
1529   template <GTEST_9_TYPENAMES_(U)>
1530   tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
1531     return CopyFrom(t);
1532   }
1533
1534   GTEST_DECLARE_TUPLE_AS_FRIEND_
1535
1536   template <GTEST_9_TYPENAMES_(U)>
1537   tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
1538     f0_ = t.f0_;
1539     f1_ = t.f1_;
1540     f2_ = t.f2_;
1541     f3_ = t.f3_;
1542     f4_ = t.f4_;
1543     f5_ = t.f5_;
1544     f6_ = t.f6_;
1545     f7_ = t.f7_;
1546     f8_ = t.f8_;
1547     return *this;
1548   }
1549
1550   T0 f0_;
1551   T1 f1_;
1552   T2 f2_;
1553   T3 f3_;
1554   T4 f4_;
1555   T5 f5_;
1556   T6 f6_;
1557   T7 f7_;
1558   T8 f8_;
1559 };
1560
1561 template <GTEST_10_TYPENAMES_(T)>
1562 class tuple {
1563  public:
1564   template <int k> friend class gtest_internal::Get;
1565
1566   tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
1567       f9_() {}
1568
1569   explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
1570       GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
1571       GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
1572       GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
1573       f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
1574
1575   tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
1576       f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
1577
1578   template <GTEST_10_TYPENAMES_(U)>
1579   tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
1580       f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
1581       f9_(t.f9_) {}
1582
1583   tuple& operator=(const tuple& t) { return CopyFrom(t); }
1584
1585   template <GTEST_10_TYPENAMES_(U)>
1586   tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
1587     return CopyFrom(t);
1588   }
1589
1590   GTEST_DECLARE_TUPLE_AS_FRIEND_
1591
1592   template <GTEST_10_TYPENAMES_(U)>
1593   tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
1594     f0_ = t.f0_;
1595     f1_ = t.f1_;
1596     f2_ = t.f2_;
1597     f3_ = t.f3_;
1598     f4_ = t.f4_;
1599     f5_ = t.f5_;
1600     f6_ = t.f6_;
1601     f7_ = t.f7_;
1602     f8_ = t.f8_;
1603     f9_ = t.f9_;
1604     return *this;
1605   }
1606
1607   T0 f0_;
1608   T1 f1_;
1609   T2 f2_;
1610   T3 f3_;
1611   T4 f4_;
1612   T5 f5_;
1613   T6 f6_;
1614   T7 f7_;
1615   T8 f8_;
1616   T9 f9_;
1617 };
1618
1619 // 6.1.3.2 Tuple creation functions.
1620
1621 // Known limitations: we don't support passing an
1622 // std::tr1::reference_wrapper<T> to make_tuple().  And we don't
1623 // implement tie().
1624
1625 inline tuple<> make_tuple() { return tuple<>(); }
1626
1627 template <GTEST_1_TYPENAMES_(T)>
1628 inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
1629   return GTEST_1_TUPLE_(T)(f0);
1630 }
1631
1632 template <GTEST_2_TYPENAMES_(T)>
1633 inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
1634   return GTEST_2_TUPLE_(T)(f0, f1);
1635 }
1636
1637 template <GTEST_3_TYPENAMES_(T)>
1638 inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
1639   return GTEST_3_TUPLE_(T)(f0, f1, f2);
1640 }
1641
1642 template <GTEST_4_TYPENAMES_(T)>
1643 inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1644     const T3& f3) {
1645   return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
1646 }
1647
1648 template <GTEST_5_TYPENAMES_(T)>
1649 inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1650     const T3& f3, const T4& f4) {
1651   return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
1652 }
1653
1654 template <GTEST_6_TYPENAMES_(T)>
1655 inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1656     const T3& f3, const T4& f4, const T5& f5) {
1657   return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
1658 }
1659
1660 template <GTEST_7_TYPENAMES_(T)>
1661 inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1662     const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
1663   return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
1664 }
1665
1666 template <GTEST_8_TYPENAMES_(T)>
1667 inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1668     const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
1669   return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
1670 }
1671
1672 template <GTEST_9_TYPENAMES_(T)>
1673 inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1674     const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
1675     const T8& f8) {
1676   return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
1677 }
1678
1679 template <GTEST_10_TYPENAMES_(T)>
1680 inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
1681     const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
1682     const T8& f8, const T9& f9) {
1683   return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
1684 }
1685
1686 // 6.1.3.3 Tuple helper classes.
1687
1688 template <typename Tuple> struct tuple_size;
1689
1690 template <GTEST_0_TYPENAMES_(T)>
1691 struct tuple_size<GTEST_0_TUPLE_(T) > {
1692   static const int value = 0;
1693 };
1694
1695 template <GTEST_1_TYPENAMES_(T)>
1696 struct tuple_size<GTEST_1_TUPLE_(T) > {
1697   static const int value = 1;
1698 };
1699
1700 template <GTEST_2_TYPENAMES_(T)>
1701 struct tuple_size<GTEST_2_TUPLE_(T) > {
1702   static const int value = 2;
1703 };
1704
1705 template <GTEST_3_TYPENAMES_(T)>
1706 struct tuple_size<GTEST_3_TUPLE_(T) > {
1707   static const int value = 3;
1708 };
1709
1710 template <GTEST_4_TYPENAMES_(T)>
1711 struct tuple_size<GTEST_4_TUPLE_(T) > {
1712   static const int value = 4;
1713 };
1714
1715 template <GTEST_5_TYPENAMES_(T)>
1716 struct tuple_size<GTEST_5_TUPLE_(T) > {
1717   static const int value = 5;
1718 };
1719
1720 template <GTEST_6_TYPENAMES_(T)>
1721 struct tuple_size<GTEST_6_TUPLE_(T) > {
1722   static const int value = 6;
1723 };
1724
1725 template <GTEST_7_TYPENAMES_(T)>
1726 struct tuple_size<GTEST_7_TUPLE_(T) > {
1727   static const int value = 7;
1728 };
1729
1730 template <GTEST_8_TYPENAMES_(T)>
1731 struct tuple_size<GTEST_8_TUPLE_(T) > {
1732   static const int value = 8;
1733 };
1734
1735 template <GTEST_9_TYPENAMES_(T)>
1736 struct tuple_size<GTEST_9_TUPLE_(T) > {
1737   static const int value = 9;
1738 };
1739
1740 template <GTEST_10_TYPENAMES_(T)>
1741 struct tuple_size<GTEST_10_TUPLE_(T) > {
1742   static const int value = 10;
1743 };
1744
1745 template <int k, class Tuple>
1746 struct tuple_element {
1747   typedef typename gtest_internal::TupleElement<
1748       k < (tuple_size<Tuple>::value), k, Tuple>::type type;
1749 };
1750
1751 #define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
1752
1753 // 6.1.3.4 Element access.
1754
1755 namespace gtest_internal {
1756
1757 template <>
1758 class Get<0> {
1759  public:
1760   template <class Tuple>
1761   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
1762   Field(Tuple& t) { return t.f0_; }  // NOLINT
1763
1764   template <class Tuple>
1765   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
1766   ConstField(const Tuple& t) { return t.f0_; }
1767 };
1768
1769 template <>
1770 class Get<1> {
1771  public:
1772   template <class Tuple>
1773   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
1774   Field(Tuple& t) { return t.f1_; }  // NOLINT
1775
1776   template <class Tuple>
1777   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
1778   ConstField(const Tuple& t) { return t.f1_; }
1779 };
1780
1781 template <>
1782 class Get<2> {
1783  public:
1784   template <class Tuple>
1785   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
1786   Field(Tuple& t) { return t.f2_; }  // NOLINT
1787
1788   template <class Tuple>
1789   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
1790   ConstField(const Tuple& t) { return t.f2_; }
1791 };
1792
1793 template <>
1794 class Get<3> {
1795  public:
1796   template <class Tuple>
1797   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
1798   Field(Tuple& t) { return t.f3_; }  // NOLINT
1799
1800   template <class Tuple>
1801   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
1802   ConstField(const Tuple& t) { return t.f3_; }
1803 };
1804
1805 template <>
1806 class Get<4> {
1807  public:
1808   template <class Tuple>
1809   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
1810   Field(Tuple& t) { return t.f4_; }  // NOLINT
1811
1812   template <class Tuple>
1813   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
1814   ConstField(const Tuple& t) { return t.f4_; }
1815 };
1816
1817 template <>
1818 class Get<5> {
1819  public:
1820   template <class Tuple>
1821   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
1822   Field(Tuple& t) { return t.f5_; }  // NOLINT
1823
1824   template <class Tuple>
1825   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
1826   ConstField(const Tuple& t) { return t.f5_; }
1827 };
1828
1829 template <>
1830 class Get<6> {
1831  public:
1832   template <class Tuple>
1833   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
1834   Field(Tuple& t) { return t.f6_; }  // NOLINT
1835
1836   template <class Tuple>
1837   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
1838   ConstField(const Tuple& t) { return t.f6_; }
1839 };
1840
1841 template <>
1842 class Get<7> {
1843  public:
1844   template <class Tuple>
1845   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
1846   Field(Tuple& t) { return t.f7_; }  // NOLINT
1847
1848   template <class Tuple>
1849   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
1850   ConstField(const Tuple& t) { return t.f7_; }
1851 };
1852
1853 template <>
1854 class Get<8> {
1855  public:
1856   template <class Tuple>
1857   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
1858   Field(Tuple& t) { return t.f8_; }  // NOLINT
1859
1860   template <class Tuple>
1861   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
1862   ConstField(const Tuple& t) { return t.f8_; }
1863 };
1864
1865 template <>
1866 class Get<9> {
1867  public:
1868   template <class Tuple>
1869   static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
1870   Field(Tuple& t) { return t.f9_; }  // NOLINT
1871
1872   template <class Tuple>
1873   static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
1874   ConstField(const Tuple& t) { return t.f9_; }
1875 };
1876
1877 }  // namespace gtest_internal
1878
1879 template <int k, GTEST_10_TYPENAMES_(T)>
1880 GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
1881 get(GTEST_10_TUPLE_(T)& t) {
1882   return gtest_internal::Get<k>::Field(t);
1883 }
1884
1885 template <int k, GTEST_10_TYPENAMES_(T)>
1886 GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k,  GTEST_10_TUPLE_(T)))
1887 get(const GTEST_10_TUPLE_(T)& t) {
1888   return gtest_internal::Get<k>::ConstField(t);
1889 }
1890
1891 // 6.1.3.5 Relational operators
1892
1893 // We only implement == and !=, as we don't have a need for the rest yet.
1894
1895 namespace gtest_internal {
1896
1897 // SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
1898 // first k fields of t1 equals the first k fields of t2.
1899 // SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
1900 // k1 != k2.
1901 template <int kSize1, int kSize2>
1902 struct SameSizeTuplePrefixComparator;
1903
1904 template <>
1905 struct SameSizeTuplePrefixComparator<0, 0> {
1906   template <class Tuple1, class Tuple2>
1907   static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
1908     return true;
1909   }
1910 };
1911
1912 template <int k>
1913 struct SameSizeTuplePrefixComparator<k, k> {
1914   template <class Tuple1, class Tuple2>
1915   static bool Eq(const Tuple1& t1, const Tuple2& t2) {
1916     return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
1917         ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
1918   }
1919 };
1920
1921 }  // namespace gtest_internal
1922
1923 template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
1924 inline bool operator==(const GTEST_10_TUPLE_(T)& t,
1925                        const GTEST_10_TUPLE_(U)& u) {
1926   return gtest_internal::SameSizeTuplePrefixComparator<
1927       tuple_size<GTEST_10_TUPLE_(T) >::value,
1928       tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u);
1929 }
1930
1931 template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
1932 inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
1933                        const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
1934
1935 // 6.1.4 Pairs.
1936 // Unimplemented.
1937
1938 }  // namespace tr1
1939 }  // namespace std
1940
1941 #undef GTEST_0_TUPLE_
1942 #undef GTEST_1_TUPLE_
1943 #undef GTEST_2_TUPLE_
1944 #undef GTEST_3_TUPLE_
1945 #undef GTEST_4_TUPLE_
1946 #undef GTEST_5_TUPLE_
1947 #undef GTEST_6_TUPLE_
1948 #undef GTEST_7_TUPLE_
1949 #undef GTEST_8_TUPLE_
1950 #undef GTEST_9_TUPLE_
1951 #undef GTEST_10_TUPLE_
1952
1953 #undef GTEST_0_TYPENAMES_
1954 #undef GTEST_1_TYPENAMES_
1955 #undef GTEST_2_TYPENAMES_
1956 #undef GTEST_3_TYPENAMES_
1957 #undef GTEST_4_TYPENAMES_
1958 #undef GTEST_5_TYPENAMES_
1959 #undef GTEST_6_TYPENAMES_
1960 #undef GTEST_7_TYPENAMES_
1961 #undef GTEST_8_TYPENAMES_
1962 #undef GTEST_9_TYPENAMES_
1963 #undef GTEST_10_TYPENAMES_
1964
1965 #undef GTEST_DECLARE_TUPLE_AS_FRIEND_
1966 #undef GTEST_BY_REF_
1967 #undef GTEST_ADD_REF_
1968 #undef GTEST_TUPLE_ELEMENT_
1969
1970 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
1971 # elif GTEST_ENV_HAS_STD_TUPLE_
1972 #  include <tuple>
1973 // C++11 puts its tuple into the ::std namespace rather than
1974 // ::std::tr1.  gtest expects tuple to live in ::std::tr1, so put it there.
1975 // This causes undefined behavior, but supported compilers react in
1976 // the way we intend.
1977 namespace std {
1978 namespace tr1 {
1979 using ::std::get;
1980 using ::std::make_tuple;
1981 using ::std::tuple;
1982 using ::std::tuple_element;
1983 using ::std::tuple_size;
1984 }
1985 }
1986
1987 # elif GTEST_OS_SYMBIAN
1988
1989 // On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
1990 // use STLport's tuple implementation, which unfortunately doesn't
1991 // work as the copy of STLport distributed with Symbian is incomplete.
1992 // By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
1993 // use its own tuple implementation.
1994 #  ifdef BOOST_HAS_TR1_TUPLE
1995 #   undef BOOST_HAS_TR1_TUPLE
1996 #  endif  // BOOST_HAS_TR1_TUPLE
1997
1998 // This prevents <boost/tr1/detail/config.hpp>, which defines
1999 // BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
2000 #  define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
2001 #  include <tuple>  // IWYU pragma: export  // NOLINT
2002
2003 # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
2004 // GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header.  This does
2005 // not conform to the TR1 spec, which requires the header to be <tuple>.
2006
2007 #  if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
2008 // Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
2009 // which is #included by <tr1/tuple>, to not compile when RTTI is
2010 // disabled.  _TR1_FUNCTIONAL is the header guard for
2011 // <tr1/functional>.  Hence the following #define is a hack to prevent
2012 // <tr1/functional> from being included.
2013 #   define _TR1_FUNCTIONAL 1
2014 #   include <tr1/tuple>
2015 #   undef _TR1_FUNCTIONAL  // Allows the user to #include
2016                         // <tr1/functional> if he chooses to.
2017 #  else
2018 #   include <tr1/tuple>  // NOLINT
2019 #  endif  // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
2020
2021 # else
2022 // If the compiler is not GCC 4.0+, we assume the user is using a
2023 // spec-conforming TR1 implementation.
2024 #  include <tuple>  // IWYU pragma: export  // NOLINT
2025 # endif  // GTEST_USE_OWN_TR1_TUPLE
2026
2027 #endif  // GTEST_HAS_TR1_TUPLE
2028
2029 // Determines whether clone(2) is supported.
2030 // Usually it will only be available on Linux, excluding
2031 // Linux on the Itanium architecture.
2032 // Also see http://linux.die.net/man/2/clone.
2033 #ifndef GTEST_HAS_CLONE
2034 // The user didn't tell us, so we need to figure it out.
2035
2036 # if GTEST_OS_LINUX && !defined(__ia64__)
2037 #  if GTEST_OS_LINUX_ANDROID
2038 // On Android, clone() became available at different API levels for each 32-bit
2039 // architecture.
2040 #    if defined(__LP64__) || \
2041         (defined(__arm__) && __ANDROID_API__ >= 9) || \
2042         (defined(__mips__) && __ANDROID_API__ >= 12) || \
2043         (defined(__i386__) && __ANDROID_API__ >= 17)
2044 #     define GTEST_HAS_CLONE 1
2045 #    else
2046 #     define GTEST_HAS_CLONE 0
2047 #    endif
2048 #  else
2049 #   define GTEST_HAS_CLONE 1
2050 #  endif
2051 # else
2052 #  define GTEST_HAS_CLONE 0
2053 # endif  // GTEST_OS_LINUX && !defined(__ia64__)
2054
2055 #endif  // GTEST_HAS_CLONE
2056
2057 // Determines whether to support stream redirection. This is used to test
2058 // output correctness and to implement death tests.
2059 #ifndef GTEST_HAS_STREAM_REDIRECTION
2060 // By default, we assume that stream redirection is supported on all
2061 // platforms except known mobile ones.
2062 # if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || \
2063     GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
2064 #  define GTEST_HAS_STREAM_REDIRECTION 0
2065 # else
2066 #  define GTEST_HAS_STREAM_REDIRECTION 1
2067 # endif  // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
2068 #endif  // GTEST_HAS_STREAM_REDIRECTION
2069
2070 // Determines whether to support death tests.
2071 // Google Test does not support death tests for VC 7.1 and earlier as
2072 // abort() in a VC 7.1 application compiled as GUI in debug config
2073 // pops up a dialog window that cannot be suppressed programmatically.
2074 #if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
2075      (GTEST_OS_MAC && !GTEST_OS_IOS) || \
2076      (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
2077      GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
2078      GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD)
2079 # define GTEST_HAS_DEATH_TEST 1
2080 #endif
2081
2082 // We don't support MSVC 7.1 with exceptions disabled now.  Therefore
2083 // all the compilers we care about are adequate for supporting
2084 // value-parameterized tests.
2085 #define GTEST_HAS_PARAM_TEST 1
2086
2087 // Determines whether to support type-driven tests.
2088
2089 // Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
2090 // Sun Pro CC, IBM Visual Age, and HP aCC support.
2091 #if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \
2092     defined(__IBMCPP__) || defined(__HP_aCC)
2093 # define GTEST_HAS_TYPED_TEST 1
2094 # define GTEST_HAS_TYPED_TEST_P 1
2095 #endif
2096
2097 // Determines whether to support Combine(). This only makes sense when
2098 // value-parameterized tests are enabled.  The implementation doesn't
2099 // work on Sun Studio since it doesn't understand templated conversion
2100 // operators.
2101 #if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
2102 # define GTEST_HAS_COMBINE 1
2103 #endif
2104
2105 // Determines whether the system compiler uses UTF-16 for encoding wide strings.
2106 #define GTEST_WIDE_STRING_USES_UTF16_ \
2107     (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX)
2108
2109 // Determines whether test results can be streamed to a socket.
2110 #if GTEST_OS_LINUX
2111 # define GTEST_CAN_STREAM_RESULTS_ 1
2112 #endif
2113
2114 // Defines some utility macros.
2115
2116 // The GNU compiler emits a warning if nested "if" statements are followed by
2117 // an "else" statement and braces are not used to explicitly disambiguate the
2118 // "else" binding.  This leads to problems with code like:
2119 //
2120 //   if (gate)
2121 //     ASSERT_*(condition) << "Some message";
2122 //
2123 // The "switch (0) case 0:" idiom is used to suppress this.
2124 #ifdef __INTEL_COMPILER
2125 # define GTEST_AMBIGUOUS_ELSE_BLOCKER_
2126 #else
2127 # define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default:  // NOLINT
2128 #endif
2129
2130 // Use this annotation at the end of a struct/class definition to
2131 // prevent the compiler from optimizing away instances that are never
2132 // used.  This is useful when all interesting logic happens inside the
2133 // c'tor and / or d'tor.  Example:
2134 //
2135 //   struct Foo {
2136 //     Foo() { ... }
2137 //   } GTEST_ATTRIBUTE_UNUSED_;
2138 //
2139 // Also use it after a variable or parameter declaration to tell the
2140 // compiler the variable/parameter does not have to be used.
2141 #if defined(__GNUC__) && !defined(COMPILER_ICC)
2142 # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
2143 #elif defined(__clang__)
2144 # if __has_attribute(unused)
2145 #  define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
2146 # endif
2147 #endif
2148 #ifndef GTEST_ATTRIBUTE_UNUSED_
2149 # define GTEST_ATTRIBUTE_UNUSED_
2150 #endif
2151
2152 // A macro to disallow operator=
2153 // This should be used in the private: declarations for a class.
2154 #define GTEST_DISALLOW_ASSIGN_(type)\
2155   void operator=(type const &)
2156
2157 // A macro to disallow copy constructor and operator=
2158 // This should be used in the private: declarations for a class.
2159 #define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
2160   type(type const &);\
2161   GTEST_DISALLOW_ASSIGN_(type)
2162
2163 // Tell the compiler to warn about unused return values for functions declared
2164 // with this macro.  The macro should be used on function declarations
2165 // following the argument list:
2166 //
2167 //   Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
2168 #if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
2169 # define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
2170 #else
2171 # define GTEST_MUST_USE_RESULT_
2172 #endif  // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
2173
2174 // MS C++ compiler emits warning when a conditional expression is compile time
2175 // constant. In some contexts this warning is false positive and needs to be
2176 // suppressed. Use the following two macros in such cases:
2177 //
2178 // GTEST_INTENTIONAL_CONST_COND_PUSH_()
2179 // while (true) {
2180 // GTEST_INTENTIONAL_CONST_COND_POP_()
2181 // }
2182 # define GTEST_INTENTIONAL_CONST_COND_PUSH_() \
2183     GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127)
2184 # define GTEST_INTENTIONAL_CONST_COND_POP_() \
2185     GTEST_DISABLE_MSC_WARNINGS_POP_()
2186
2187 // Determine whether the compiler supports Microsoft's Structured Exception
2188 // Handling.  This is supported by several Windows compilers but generally
2189 // does not exist on any other system.
2190 #ifndef GTEST_HAS_SEH
2191 // The user didn't tell us, so we need to figure it out.
2192
2193 # if defined(_MSC_VER) || defined(__BORLANDC__)
2194 // These two compilers are known to support SEH.
2195 #  define GTEST_HAS_SEH 1
2196 # else
2197 // Assume no SEH.
2198 #  define GTEST_HAS_SEH 0
2199 # endif
2200
2201 #define GTEST_IS_THREADSAFE \
2202     (GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ \
2203      || (GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT) \
2204      || GTEST_HAS_PTHREAD)
2205
2206 #endif  // GTEST_HAS_SEH
2207
2208 #ifdef _MSC_VER
2209 # if GTEST_LINKED_AS_SHARED_LIBRARY
2210 #  define GTEST_API_ __declspec(dllimport)
2211 # elif GTEST_CREATE_SHARED_LIBRARY
2212 #  define GTEST_API_ __declspec(dllexport)
2213 # endif
2214 #elif __GNUC__ >= 4 || defined(__clang__)
2215 # define GTEST_API_ __attribute__((visibility ("default")))
2216 #endif // _MSC_VER
2217
2218 #ifndef GTEST_API_
2219 # define GTEST_API_
2220 #endif
2221
2222 #ifdef __GNUC__
2223 // Ask the compiler to never inline a given function.
2224 # define GTEST_NO_INLINE_ __attribute__((noinline))
2225 #else
2226 # define GTEST_NO_INLINE_
2227 #endif
2228
2229 // _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
2230 #if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)
2231 # define GTEST_HAS_CXXABI_H_ 1
2232 #else
2233 # define GTEST_HAS_CXXABI_H_ 0
2234 #endif
2235
2236 // A function level attribute to disable checking for use of uninitialized
2237 // memory when built with MemorySanitizer.
2238 #if defined(__clang__)
2239 # if __has_feature(memory_sanitizer)
2240 #  define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ \
2241        __attribute__((no_sanitize_memory))
2242 # else
2243 #  define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
2244 # endif  // __has_feature(memory_sanitizer)
2245 #else
2246 # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
2247 #endif  // __clang__
2248
2249 // A function level attribute to disable AddressSanitizer instrumentation.
2250 #if defined(__clang__)
2251 # if __has_feature(address_sanitizer)
2252 #  define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \
2253        __attribute__((no_sanitize_address))
2254 # else
2255 #  define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
2256 # endif  // __has_feature(address_sanitizer)
2257 #else
2258 # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
2259 #endif  // __clang__
2260
2261 // A function level attribute to disable ThreadSanitizer instrumentation.
2262 #if defined(__clang__)
2263 # if __has_feature(thread_sanitizer)
2264 #  define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ \
2265        __attribute__((no_sanitize_thread))
2266 # else
2267 #  define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
2268 # endif  // __has_feature(thread_sanitizer)
2269 #else
2270 # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
2271 #endif  // __clang__
2272
2273 namespace testing {
2274
2275 class Message;
2276
2277 #if defined(GTEST_TUPLE_NAMESPACE_)
2278 // Import tuple and friends into the ::testing namespace.
2279 // It is part of our interface, having them in ::testing allows us to change
2280 // their types as needed.
2281 using GTEST_TUPLE_NAMESPACE_::get;
2282 using GTEST_TUPLE_NAMESPACE_::make_tuple;
2283 using GTEST_TUPLE_NAMESPACE_::tuple;
2284 using GTEST_TUPLE_NAMESPACE_::tuple_size;
2285 using GTEST_TUPLE_NAMESPACE_::tuple_element;
2286 #endif  // defined(GTEST_TUPLE_NAMESPACE_)
2287
2288 namespace internal {
2289
2290 // A secret type that Google Test users don't know about.  It has no
2291 // definition on purpose.  Therefore it's impossible to create a
2292 // Secret object, which is what we want.
2293 class Secret;
2294
2295 // The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time
2296 // expression is true. For example, you could use it to verify the
2297 // size of a static array:
2298 //
2299 //   GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES,
2300 //                         names_incorrect_size);
2301 //
2302 // or to make sure a struct is smaller than a certain size:
2303 //
2304 //   GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large);
2305 //
2306 // The second argument to the macro is the name of the variable. If
2307 // the expression is false, most compilers will issue a warning/error
2308 // containing the name of the variable.
2309
2310 #if GTEST_LANG_CXX11
2311 # define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg)
2312 #else  // !GTEST_LANG_CXX11
2313 template <bool>
2314   struct CompileAssert {
2315 };
2316
2317 # define GTEST_COMPILE_ASSERT_(expr, msg) \
2318   typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
2319       msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
2320 #endif  // !GTEST_LANG_CXX11
2321
2322 // Implementation details of GTEST_COMPILE_ASSERT_:
2323 //
2324 // (In C++11, we simply use static_assert instead of the following)
2325 //
2326 // - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
2327 //   elements (and thus is invalid) when the expression is false.
2328 //
2329 // - The simpler definition
2330 //
2331 //    #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]
2332 //
2333 //   does not work, as gcc supports variable-length arrays whose sizes
2334 //   are determined at run-time (this is gcc's extension and not part
2335 //   of the C++ standard).  As a result, gcc fails to reject the
2336 //   following code with the simple definition:
2337 //
2338 //     int foo;
2339 //     GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is
2340 //                                      // not a compile-time constant.
2341 //
2342 // - By using the type CompileAssert<(bool(expr))>, we ensures that
2343 //   expr is a compile-time constant.  (Template arguments must be
2344 //   determined at compile-time.)
2345 //
2346 // - The outter parentheses in CompileAssert<(bool(expr))> are necessary
2347 //   to work around a bug in gcc 3.4.4 and 4.0.1.  If we had written
2348 //
2349 //     CompileAssert<bool(expr)>
2350 //
2351 //   instead, these compilers will refuse to compile
2352 //
2353 //     GTEST_COMPILE_ASSERT_(5 > 0, some_message);
2354 //
2355 //   (They seem to think the ">" in "5 > 0" marks the end of the
2356 //   template argument list.)
2357 //
2358 // - The array size is (bool(expr) ? 1 : -1), instead of simply
2359 //
2360 //     ((expr) ? 1 : -1).
2361 //
2362 //   This is to avoid running into a bug in MS VC 7.1, which
2363 //   causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
2364
2365 // StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.
2366 //
2367 // This template is declared, but intentionally undefined.
2368 template <typename T1, typename T2>
2369 struct StaticAssertTypeEqHelper;
2370
2371 template <typename T>
2372 struct StaticAssertTypeEqHelper<T, T> {
2373   enum { value = true };
2374 };
2375
2376 // Evaluates to the number of elements in 'array'.
2377 #define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0]))
2378
2379 #if GTEST_HAS_GLOBAL_STRING
2380 typedef ::string string;
2381 #else
2382 typedef ::std::string string;
2383 #endif  // GTEST_HAS_GLOBAL_STRING
2384
2385 #if GTEST_HAS_GLOBAL_WSTRING
2386 typedef ::wstring wstring;
2387 #elif GTEST_HAS_STD_WSTRING
2388 typedef ::std::wstring wstring;
2389 #endif  // GTEST_HAS_GLOBAL_WSTRING
2390
2391 // A helper for suppressing warnings on constant condition.  It just
2392 // returns 'condition'.
2393 GTEST_API_ bool IsTrue(bool condition);
2394
2395 // Defines scoped_ptr.
2396
2397 // This implementation of scoped_ptr is PARTIAL - it only contains
2398 // enough stuff to satisfy Google Test's need.
2399 template <typename T>
2400 class scoped_ptr {
2401  public:
2402   typedef T element_type;
2403
2404   explicit scoped_ptr(T* p = NULL) : ptr_(p) {}
2405   ~scoped_ptr() { reset(); }
2406
2407   T& operator*() const { return *ptr_; }
2408   T* operator->() const { return ptr_; }
2409   T* get() const { return ptr_; }
2410
2411   T* release() {
2412     T* const ptr = ptr_;
2413     ptr_ = NULL;
2414     return ptr;
2415   }
2416
2417   void reset(T* p = NULL) {
2418     if (p != ptr_) {
2419       if (IsTrue(sizeof(T) > 0)) {  // Makes sure T is a complete type.
2420         delete ptr_;
2421       }
2422       ptr_ = p;
2423     }
2424   }
2425
2426   friend void swap(scoped_ptr& a, scoped_ptr& b) {
2427     using std::swap;
2428     swap(a.ptr_, b.ptr_);
2429   }
2430
2431  private:
2432   T* ptr_;
2433
2434   GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
2435 };
2436
2437 // Defines RE.
2438
2439 // A simple C++ wrapper for <regex.h>.  It uses the POSIX Extended
2440 // Regular Expression syntax.
2441 class GTEST_API_ RE {
2442  public:
2443   // A copy constructor is required by the Standard to initialize object
2444   // references from r-values.
2445   RE(const RE& other) { Init(other.pattern()); }
2446
2447   // Constructs an RE from a string.
2448   RE(const ::std::string& regex) { Init(regex.c_str()); }  // NOLINT
2449
2450 #if GTEST_HAS_GLOBAL_STRING
2451
2452   RE(const ::string& regex) { Init(regex.c_str()); }  // NOLINT
2453
2454 #endif  // GTEST_HAS_GLOBAL_STRING
2455
2456   RE(const char* regex) { Init(regex); }  // NOLINT
2457   ~RE();
2458
2459   // Returns the string representation of the regex.
2460   const char* pattern() const { return pattern_; }
2461
2462   // FullMatch(str, re) returns true iff regular expression re matches
2463   // the entire str.
2464   // PartialMatch(str, re) returns true iff regular expression re
2465   // matches a substring of str (including str itself).
2466   //
2467   // TODO(wan@google.com): make FullMatch() and PartialMatch() work
2468   // when str contains NUL characters.
2469   static bool FullMatch(const ::std::string& str, const RE& re) {
2470     return FullMatch(str.c_str(), re);
2471   }
2472   static bool PartialMatch(const ::std::string& str, const RE& re) {
2473     return PartialMatch(str.c_str(), re);
2474   }
2475
2476 #if GTEST_HAS_GLOBAL_STRING
2477
2478   static bool FullMatch(const ::string& str, const RE& re) {
2479     return FullMatch(str.c_str(), re);
2480   }
2481   static bool PartialMatch(const ::string& str, const RE& re) {
2482     return PartialMatch(str.c_str(), re);
2483   }
2484
2485 #endif  // GTEST_HAS_GLOBAL_STRING
2486
2487   static bool FullMatch(const char* str, const RE& re);
2488   static bool PartialMatch(const char* str, const RE& re);
2489
2490  private:
2491   void Init(const char* regex);
2492
2493   // We use a const char* instead of an std::string, as Google Test used to be
2494   // used where std::string is not available.  TODO(wan@google.com): change to
2495   // std::string.
2496   const char* pattern_;
2497   bool is_valid_;
2498
2499 #if GTEST_USES_POSIX_RE
2500
2501   regex_t full_regex_;     // For FullMatch().
2502   regex_t partial_regex_;  // For PartialMatch().
2503
2504 #else  // GTEST_USES_SIMPLE_RE
2505
2506   const char* full_pattern_;  // For FullMatch();
2507
2508 #endif
2509
2510   GTEST_DISALLOW_ASSIGN_(RE);
2511 };
2512
2513 // Formats a source file path and a line number as they would appear
2514 // in an error message from the compiler used to compile this code.
2515 GTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
2516
2517 // Formats a file location for compiler-independent XML output.
2518 // Although this function is not platform dependent, we put it next to
2519 // FormatFileLocation in order to contrast the two functions.
2520 GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,
2521                                                                int line);
2522
2523 // Defines logging utilities:
2524 //   GTEST_LOG_(severity) - logs messages at the specified severity level. The
2525 //                          message itself is streamed into the macro.
2526 //   LogToStderr()  - directs all log messages to stderr.
2527 //   FlushInfoLog() - flushes informational log messages.
2528
2529 enum GTestLogSeverity {
2530   GTEST_INFO,
2531   GTEST_WARNING,
2532   GTEST_ERROR,
2533   GTEST_FATAL
2534 };
2535
2536 // Formats log entry severity, provides a stream object for streaming the
2537 // log message, and terminates the message with a newline when going out of
2538 // scope.
2539 class GTEST_API_ GTestLog {
2540  public:
2541   GTestLog(GTestLogSeverity severity, const char* file, int line);
2542
2543   // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
2544   ~GTestLog();
2545
2546   ::std::ostream& GetStream() { return ::std::cerr; }
2547
2548  private:
2549   const GTestLogSeverity severity_;
2550
2551   GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
2552 };
2553
2554 #if !defined(GTEST_LOG_)
2555
2556 # define GTEST_LOG_(severity) \
2557     ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
2558                                   __FILE__, __LINE__).GetStream()
2559
2560 inline void LogToStderr() {}
2561 inline void FlushInfoLog() { fflush(NULL); }
2562
2563 #endif  // !defined(GTEST_LOG_)
2564
2565 #if !defined(GTEST_CHECK_)
2566 // INTERNAL IMPLEMENTATION - DO NOT USE.
2567 //
2568 // GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
2569 // is not satisfied.
2570 //  Synopsys:
2571 //    GTEST_CHECK_(boolean_condition);
2572 //     or
2573 //    GTEST_CHECK_(boolean_condition) << "Additional message";
2574 //
2575 //    This checks the condition and if the condition is not satisfied
2576 //    it prints message about the condition violation, including the
2577 //    condition itself, plus additional message streamed into it, if any,
2578 //    and then it aborts the program. It aborts the program irrespective of
2579 //    whether it is built in the debug mode or not.
2580 # define GTEST_CHECK_(condition) \
2581     GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
2582     if (::testing::internal::IsTrue(condition)) \
2583       ; \
2584     else \
2585       GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
2586 #endif  // !defined(GTEST_CHECK_)
2587
2588 // An all-mode assert to verify that the given POSIX-style function
2589 // call returns 0 (indicating success).  Known limitation: this
2590 // doesn't expand to a balanced 'if' statement, so enclose the macro
2591 // in {} if you need to use it as the only statement in an 'if'
2592 // branch.
2593 #define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
2594   if (const int gtest_error = (posix_call)) \
2595     GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
2596                       << gtest_error
2597
2598 #if GTEST_HAS_STD_MOVE_
2599 using std::move;
2600 #else  // GTEST_HAS_STD_MOVE_
2601 template <typename T>
2602 const T& move(const T& t) {
2603   return t;
2604 }
2605 #endif  // GTEST_HAS_STD_MOVE_
2606
2607 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
2608 //
2609 // Use ImplicitCast_ as a safe version of static_cast for upcasting in
2610 // the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a
2611 // const Foo*).  When you use ImplicitCast_, the compiler checks that
2612 // the cast is safe.  Such explicit ImplicitCast_s are necessary in
2613 // surprisingly many situations where C++ demands an exact type match
2614 // instead of an argument type convertable to a target type.
2615 //
2616 // The syntax for using ImplicitCast_ is the same as for static_cast:
2617 //
2618 //   ImplicitCast_<ToType>(expr)
2619 //
2620 // ImplicitCast_ would have been part of the C++ standard library,
2621 // but the proposal was submitted too late.  It will probably make
2622 // its way into the language in the future.
2623 //
2624 // This relatively ugly name is intentional. It prevents clashes with
2625 // similar functions users may have (e.g., implicit_cast). The internal
2626 // namespace alone is not enough because the function can be found by ADL.
2627 template<typename To>
2628 inline To ImplicitCast_(To x) { return x; }
2629
2630 // When you upcast (that is, cast a pointer from type Foo to type
2631 // SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts
2632 // always succeed.  When you downcast (that is, cast a pointer from
2633 // type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
2634 // how do you know the pointer is really of type SubclassOfFoo?  It
2635 // could be a bare Foo, or of type DifferentSubclassOfFoo.  Thus,
2636 // when you downcast, you should use this macro.  In debug mode, we
2637 // use dynamic_cast<> to double-check the downcast is legal (we die
2638 // if it's not).  In normal mode, we do the efficient static_cast<>
2639 // instead.  Thus, it's important to test in debug mode to make sure
2640 // the cast is legal!
2641 //    This is the only place in the code we should use dynamic_cast<>.
2642 // In particular, you SHOULDN'T be using dynamic_cast<> in order to
2643 // do RTTI (eg code like this:
2644 //    if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
2645 //    if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
2646 // You should design the code some other way not to need this.
2647 //
2648 // This relatively ugly name is intentional. It prevents clashes with
2649 // similar functions users may have (e.g., down_cast). The internal
2650 // namespace alone is not enough because the function can be found by ADL.
2651 template<typename To, typename From>  // use like this: DownCast_<T*>(foo);
2652 inline To DownCast_(From* f) {  // so we only accept pointers
2653   // Ensures that To is a sub-type of From *.  This test is here only
2654   // for compile-time type checking, and has no overhead in an
2655   // optimized build at run-time, as it will be optimized away
2656   // completely.
2657   GTEST_INTENTIONAL_CONST_COND_PUSH_()
2658   if (false) {
2659   GTEST_INTENTIONAL_CONST_COND_POP_()
2660     const To to = NULL;
2661     ::testing::internal::ImplicitCast_<From*>(to);
2662   }
2663
2664 #if GTEST_HAS_RTTI
2665   // RTTI: debug mode only!
2666   GTEST_CHECK_(f == NULL || dynamic_cast<To>(f) != NULL);
2667 #endif
2668   return static_cast<To>(f);
2669 }
2670
2671 // Downcasts the pointer of type Base to Derived.
2672 // Derived must be a subclass of Base. The parameter MUST
2673 // point to a class of type Derived, not any subclass of it.
2674 // When RTTI is available, the function performs a runtime
2675 // check to enforce this.
2676 template <class Derived, class Base>
2677 Derived* CheckedDowncastToActualType(Base* base) {
2678 #if GTEST_HAS_RTTI
2679   GTEST_CHECK_(typeid(*base) == typeid(Derived));
2680 #endif
2681
2682 #if GTEST_HAS_DOWNCAST_
2683   return ::down_cast<Derived*>(base);
2684 #elif GTEST_HAS_RTTI
2685   return dynamic_cast<Derived*>(base);  // NOLINT
2686 #else
2687   return static_cast<Derived*>(base);  // Poor man's downcast.
2688 #endif
2689 }
2690
2691 #if GTEST_HAS_STREAM_REDIRECTION
2692
2693 // Defines the stderr capturer:
2694 //   CaptureStdout     - starts capturing stdout.
2695 //   GetCapturedStdout - stops capturing stdout and returns the captured string.
2696 //   CaptureStderr     - starts capturing stderr.
2697 //   GetCapturedStderr - stops capturing stderr and returns the captured string.
2698 //
2699 GTEST_API_ void CaptureStdout();
2700 GTEST_API_ std::string GetCapturedStdout();
2701 GTEST_API_ void CaptureStderr();
2702 GTEST_API_ std::string GetCapturedStderr();
2703
2704 #endif  // GTEST_HAS_STREAM_REDIRECTION
2705
2706 // Returns a path to temporary directory.
2707 GTEST_API_ std::string TempDir();
2708
2709 // Returns the size (in bytes) of a file.
2710 GTEST_API_ size_t GetFileSize(FILE* file);
2711
2712 // Reads the entire content of a file as a string.
2713 GTEST_API_ std::string ReadEntireFile(FILE* file);
2714
2715 // All command line arguments.
2716 GTEST_API_ const ::std::vector<testing::internal::string>& GetArgvs();
2717
2718 #if GTEST_HAS_DEATH_TEST
2719
2720 const ::std::vector<testing::internal::string>& GetInjectableArgvs();
2721 void SetInjectableArgvs(const ::std::vector<testing::internal::string>*
2722                              new_argvs);
2723
2724
2725 #endif  // GTEST_HAS_DEATH_TEST
2726
2727 // Defines synchronization primitives.
2728 #if GTEST_IS_THREADSAFE
2729 # if GTEST_HAS_PTHREAD
2730 // Sleeps for (roughly) n milliseconds.  This function is only for testing
2731 // Google Test's own constructs.  Don't use it in user tests, either
2732 // directly or indirectly.
2733 inline void SleepMilliseconds(int n) {
2734   const timespec time = {
2735     0,                  // 0 seconds.
2736     n * 1000L * 1000L,  // And n ms.
2737   };
2738   nanosleep(&time, NULL);
2739 }
2740 # endif  // GTEST_HAS_PTHREAD
2741
2742 # if GTEST_HAS_NOTIFICATION_
2743 // Notification has already been imported into the namespace.
2744 // Nothing to do here.
2745
2746 # elif GTEST_HAS_PTHREAD
2747 // Allows a controller thread to pause execution of newly created
2748 // threads until notified.  Instances of this class must be created
2749 // and destroyed in the controller thread.
2750 //
2751 // This class is only for testing Google Test's own constructs. Do not
2752 // use it in user tests, either directly or indirectly.
2753 class Notification {
2754  public:
2755   Notification() : notified_(false) {
2756     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
2757   }
2758   ~Notification() {
2759     pthread_mutex_destroy(&mutex_);
2760   }
2761
2762   // Notifies all threads created with this notification to start. Must
2763   // be called from the controller thread.
2764   void Notify() {
2765     pthread_mutex_lock(&mutex_);
2766     notified_ = true;
2767     pthread_mutex_unlock(&mutex_);
2768   }
2769
2770   // Blocks until the controller thread notifies. Must be called from a test
2771   // thread.
2772   void WaitForNotification() {
2773     for (;;) {
2774       pthread_mutex_lock(&mutex_);
2775       const bool notified = notified_;
2776       pthread_mutex_unlock(&mutex_);
2777       if (notified)
2778         break;
2779       SleepMilliseconds(10);
2780     }
2781   }
2782
2783  private:
2784   pthread_mutex_t mutex_;
2785   bool notified_;
2786
2787   GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
2788 };
2789
2790 # elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
2791
2792 GTEST_API_ void SleepMilliseconds(int n);
2793
2794 // Provides leak-safe Windows kernel handle ownership.
2795 // Used in death tests and in threading support.
2796 class GTEST_API_ AutoHandle {
2797  public:
2798   // Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to
2799   // avoid including <windows.h> in this header file. Including <windows.h> is
2800   // undesirable because it defines a lot of symbols and macros that tend to
2801   // conflict with client code. This assumption is verified by
2802   // WindowsTypesTest.HANDLEIsVoidStar.
2803   typedef void* Handle;
2804   AutoHandle();
2805   explicit AutoHandle(Handle handle);
2806
2807   ~AutoHandle();
2808
2809   Handle Get() const;
2810   void Reset();
2811   void Reset(Handle handle);
2812
2813  private:
2814   // Returns true iff the handle is a valid handle object that can be closed.
2815   bool IsCloseable() const;
2816
2817   Handle handle_;
2818
2819   GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
2820 };
2821
2822 // Allows a controller thread to pause execution of newly created
2823 // threads until notified.  Instances of this class must be created
2824 // and destroyed in the controller thread.
2825 //
2826 // This class is only for testing Google Test's own constructs. Do not
2827 // use it in user tests, either directly or indirectly.
2828 class GTEST_API_ Notification {
2829  public:
2830   Notification();
2831   void Notify();
2832   void WaitForNotification();
2833
2834  private:
2835   AutoHandle event_;
2836
2837   GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
2838 };
2839 # endif  // GTEST_HAS_NOTIFICATION_
2840
2841 // On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD
2842 // defined, but we don't want to use MinGW's pthreads implementation, which
2843 // has conformance problems with some versions of the POSIX standard.
2844 # if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW
2845
2846 // As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
2847 // Consequently, it cannot select a correct instantiation of ThreadWithParam
2848 // in order to call its Run(). Introducing ThreadWithParamBase as a
2849 // non-templated base class for ThreadWithParam allows us to bypass this
2850 // problem.
2851 class ThreadWithParamBase {
2852  public:
2853   virtual ~ThreadWithParamBase() {}
2854   virtual void Run() = 0;
2855 };
2856
2857 // pthread_create() accepts a pointer to a function type with the C linkage.
2858 // According to the Standard (7.5/1), function types with different linkages
2859 // are different even if they are otherwise identical.  Some compilers (for
2860 // example, SunStudio) treat them as different types.  Since class methods
2861 // cannot be defined with C-linkage we need to define a free C-function to
2862 // pass into pthread_create().
2863 extern "C" inline void* ThreadFuncWithCLinkage(void* thread) {
2864   static_cast<ThreadWithParamBase*>(thread)->Run();
2865   return NULL;
2866 }
2867
2868 // Helper class for testing Google Test's multi-threading constructs.
2869 // To use it, write:
2870 //
2871 //   void ThreadFunc(int param) { /* Do things with param */ }
2872 //   Notification thread_can_start;
2873 //   ...
2874 //   // The thread_can_start parameter is optional; you can supply NULL.
2875 //   ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);
2876 //   thread_can_start.Notify();
2877 //
2878 // These classes are only for testing Google Test's own constructs. Do
2879 // not use them in user tests, either directly or indirectly.
2880 template <typename T>
2881 class ThreadWithParam : public ThreadWithParamBase {
2882  public:
2883   typedef void UserThreadFunc(T);
2884
2885   ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
2886       : func_(func),
2887         param_(param),
2888         thread_can_start_(thread_can_start),
2889         finished_(false) {
2890     ThreadWithParamBase* const base = this;
2891     // The thread can be created only after all fields except thread_
2892     // have been initialized.
2893     GTEST_CHECK_POSIX_SUCCESS_(
2894         pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base));
2895   }
2896   ~ThreadWithParam() { Join(); }
2897
2898   void Join() {
2899     if (!finished_) {
2900       GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0));
2901       finished_ = true;
2902     }
2903   }
2904
2905   virtual void Run() {
2906     if (thread_can_start_ != NULL)
2907       thread_can_start_->WaitForNotification();
2908     func_(param_);
2909   }
2910
2911  private:
2912   UserThreadFunc* const func_;  // User-supplied thread function.
2913   const T param_;  // User-supplied parameter to the thread function.
2914   // When non-NULL, used to block execution until the controller thread
2915   // notifies.
2916   Notification* const thread_can_start_;
2917   bool finished_;  // true iff we know that the thread function has finished.
2918   pthread_t thread_;  // The native thread object.
2919
2920   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
2921 };
2922 # endif  // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD ||
2923          // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
2924
2925 # if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
2926 // Mutex and ThreadLocal have already been imported into the namespace.
2927 // Nothing to do here.
2928
2929 # elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
2930
2931 // Mutex implements mutex on Windows platforms.  It is used in conjunction
2932 // with class MutexLock:
2933 //
2934 //   Mutex mutex;
2935 //   ...
2936 //   MutexLock lock(&mutex);  // Acquires the mutex and releases it at the
2937 //                            // end of the current scope.
2938 //
2939 // A static Mutex *must* be defined or declared using one of the following
2940 // macros:
2941 //   GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);
2942 //   GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
2943 //
2944 // (A non-static Mutex is defined/declared in the usual way).
2945 class GTEST_API_ Mutex {
2946  public:
2947   enum MutexType { kStatic = 0, kDynamic = 1 };
2948   // We rely on kStaticMutex being 0 as it is to what the linker initializes
2949   // type_ in static mutexes.  critical_section_ will be initialized lazily
2950   // in ThreadSafeLazyInit().
2951   enum StaticConstructorSelector { kStaticMutex = 0 };
2952
2953   // This constructor intentionally does nothing.  It relies on type_ being
2954   // statically initialized to 0 (effectively setting it to kStatic) and on
2955   // ThreadSafeLazyInit() to lazily initialize the rest of the members.
2956   explicit Mutex(StaticConstructorSelector /*dummy*/) {}
2957
2958   Mutex();
2959   ~Mutex();
2960
2961   void Lock();
2962
2963   void Unlock();
2964
2965   // Does nothing if the current thread holds the mutex. Otherwise, crashes
2966   // with high probability.
2967   void AssertHeld();
2968
2969  private:
2970   // Initializes owner_thread_id_ and critical_section_ in static mutexes.
2971   void ThreadSafeLazyInit();
2972
2973   // Per http://blogs.msdn.com/b/oldnewthing/archive/2004/02/23/78395.aspx,
2974   // we assume that 0 is an invalid value for thread IDs.
2975   unsigned int owner_thread_id_;
2976
2977   // For static mutexes, we rely on these members being initialized to zeros
2978   // by the linker.
2979   MutexType type_;
2980   long critical_section_init_phase_;  // NOLINT
2981   GTEST_CRITICAL_SECTION* critical_section_;
2982
2983   GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
2984 };
2985
2986 # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
2987     extern ::testing::internal::Mutex mutex
2988
2989 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
2990     ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex)
2991
2992 // We cannot name this class MutexLock because the ctor declaration would
2993 // conflict with a macro named MutexLock, which is defined on some
2994 // platforms. That macro is used as a defensive measure to prevent against
2995 // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
2996 // "MutexLock l(&mu)".  Hence the typedef trick below.
2997 class GTestMutexLock {
2998  public:
2999   explicit GTestMutexLock(Mutex* mutex)
3000       : mutex_(mutex) { mutex_->Lock(); }
3001
3002   ~GTestMutexLock() { mutex_->Unlock(); }
3003
3004  private:
3005   Mutex* const mutex_;
3006
3007   GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
3008 };
3009
3010 typedef GTestMutexLock MutexLock;
3011
3012 // Base class for ValueHolder<T>.  Allows a caller to hold and delete a value
3013 // without knowing its type.
3014 class ThreadLocalValueHolderBase {
3015  public:
3016   virtual ~ThreadLocalValueHolderBase() {}
3017 };
3018
3019 // Provides a way for a thread to send notifications to a ThreadLocal
3020 // regardless of its parameter type.
3021 class ThreadLocalBase {
3022  public:
3023   // Creates a new ValueHolder<T> object holding a default value passed to
3024   // this ThreadLocal<T>'s constructor and returns it.  It is the caller's
3025   // responsibility not to call this when the ThreadLocal<T> instance already
3026   // has a value on the current thread.
3027   virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0;
3028
3029  protected:
3030   ThreadLocalBase() {}
3031   virtual ~ThreadLocalBase() {}
3032
3033  private:
3034   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocalBase);
3035 };
3036
3037 // Maps a thread to a set of ThreadLocals that have values instantiated on that
3038 // thread and notifies them when the thread exits.  A ThreadLocal instance is
3039 // expected to persist until all threads it has values on have terminated.
3040 class GTEST_API_ ThreadLocalRegistry {
3041  public:
3042   // Registers thread_local_instance as having value on the current thread.
3043   // Returns a value that can be used to identify the thread from other threads.
3044   static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
3045       const ThreadLocalBase* thread_local_instance);
3046
3047   // Invoked when a ThreadLocal instance is destroyed.
3048   static void OnThreadLocalDestroyed(
3049       const ThreadLocalBase* thread_local_instance);
3050 };
3051
3052 class GTEST_API_ ThreadWithParamBase {
3053  public:
3054   void Join();
3055
3056  protected:
3057   class Runnable {
3058    public:
3059     virtual ~Runnable() {}
3060     virtual void Run() = 0;
3061   };
3062
3063   ThreadWithParamBase(Runnable *runnable, Notification* thread_can_start);
3064   virtual ~ThreadWithParamBase();
3065
3066  private:
3067   AutoHandle thread_;
3068 };
3069
3070 // Helper class for testing Google Test's multi-threading constructs.
3071 template <typename T>
3072 class ThreadWithParam : public ThreadWithParamBase {
3073  public:
3074   typedef void UserThreadFunc(T);
3075
3076   ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
3077       : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {
3078   }
3079   virtual ~ThreadWithParam() {}
3080
3081  private:
3082   class RunnableImpl : public Runnable {
3083    public:
3084     RunnableImpl(UserThreadFunc* func, T param)
3085         : func_(func),
3086           param_(param) {
3087     }
3088     virtual ~RunnableImpl() {}
3089     virtual void Run() {
3090       func_(param_);
3091     }
3092
3093    private:
3094     UserThreadFunc* const func_;
3095     const T param_;
3096
3097     GTEST_DISALLOW_COPY_AND_ASSIGN_(RunnableImpl);
3098   };
3099
3100   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
3101 };
3102
3103 // Implements thread-local storage on Windows systems.
3104 //
3105 //   // Thread 1
3106 //   ThreadLocal<int> tl(100);  // 100 is the default value for each thread.
3107 //
3108 //   // Thread 2
3109 //   tl.set(150);  // Changes the value for thread 2 only.
3110 //   EXPECT_EQ(150, tl.get());
3111 //
3112 //   // Thread 1
3113 //   EXPECT_EQ(100, tl.get());  // In thread 1, tl has the original value.
3114 //   tl.set(200);
3115 //   EXPECT_EQ(200, tl.get());
3116 //
3117 // The template type argument T must have a public copy constructor.
3118 // In addition, the default ThreadLocal constructor requires T to have
3119 // a public default constructor.
3120 //
3121 // The users of a TheadLocal instance have to make sure that all but one
3122 // threads (including the main one) using that instance have exited before
3123 // destroying it. Otherwise, the per-thread objects managed for them by the
3124 // ThreadLocal instance are not guaranteed to be destroyed on all platforms.
3125 //
3126 // Google Test only uses global ThreadLocal objects.  That means they
3127 // will die after main() has returned.  Therefore, no per-thread
3128 // object managed by Google Test will be leaked as long as all threads
3129 // using Google Test have exited when main() returns.
3130 template <typename T>
3131 class ThreadLocal : public ThreadLocalBase {
3132  public:
3133   ThreadLocal() : default_factory_(new DefaultValueHolderFactory()) {}
3134   explicit ThreadLocal(const T& value)
3135       : default_factory_(new InstanceValueHolderFactory(value)) {}
3136
3137   ~ThreadLocal() { ThreadLocalRegistry::OnThreadLocalDestroyed(this); }
3138
3139   T* pointer() { return GetOrCreateValue(); }
3140   const T* pointer() const { return GetOrCreateValue(); }
3141   const T& get() const { return *pointer(); }
3142   void set(const T& value) { *pointer() = value; }
3143
3144  private:
3145   // Holds a value of T.  Can be deleted via its base class without the caller
3146   // knowing the type of T.
3147   class ValueHolder : public ThreadLocalValueHolderBase {
3148    public:
3149     ValueHolder() : value_() {}
3150     explicit ValueHolder(const T& value) : value_(value) {}
3151
3152     T* pointer() { return &value_; }
3153
3154    private:
3155     T value_;
3156     GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
3157   };
3158
3159
3160   T* GetOrCreateValue() const {
3161     return static_cast<ValueHolder*>(
3162         ThreadLocalRegistry::GetValueOnCurrentThread(this))->pointer();
3163   }
3164
3165   virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const {
3166     return default_factory_->MakeNewHolder();
3167   }
3168
3169   class ValueHolderFactory {
3170    public:
3171     ValueHolderFactory() {}
3172     virtual ~ValueHolderFactory() {}
3173     virtual ValueHolder* MakeNewHolder() const = 0;
3174
3175    private:
3176     GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
3177   };
3178
3179   class DefaultValueHolderFactory : public ValueHolderFactory {
3180    public:
3181     DefaultValueHolderFactory() {}
3182     virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); }
3183
3184    private:
3185     GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
3186   };
3187
3188   class InstanceValueHolderFactory : public ValueHolderFactory {
3189    public:
3190     explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
3191     virtual ValueHolder* MakeNewHolder() const {
3192       return new ValueHolder(value_);
3193     }
3194
3195    private:
3196     const T value_;  // The value for each thread.
3197
3198     GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
3199   };
3200
3201   scoped_ptr<ValueHolderFactory> default_factory_;
3202
3203   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
3204 };
3205
3206 # elif GTEST_HAS_PTHREAD
3207
3208 // MutexBase and Mutex implement mutex on pthreads-based platforms.
3209 class MutexBase {
3210  public:
3211   // Acquires this mutex.
3212   void Lock() {
3213     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
3214     owner_ = pthread_self();
3215     has_owner_ = true;
3216   }
3217
3218   // Releases this mutex.
3219   void Unlock() {
3220     // Since the lock is being released the owner_ field should no longer be
3221     // considered valid. We don't protect writing to has_owner_ here, as it's
3222     // the caller's responsibility to ensure that the current thread holds the
3223     // mutex when this is called.
3224     has_owner_ = false;
3225     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
3226   }
3227
3228   // Does nothing if the current thread holds the mutex. Otherwise, crashes
3229   // with high probability.
3230   void AssertHeld() const {
3231     GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
3232         << "The current thread is not holding the mutex @" << this;
3233   }
3234
3235   // A static mutex may be used before main() is entered.  It may even
3236   // be used before the dynamic initialization stage.  Therefore we
3237   // must be able to initialize a static mutex object at link time.
3238   // This means MutexBase has to be a POD and its member variables
3239   // have to be public.
3240  public:
3241   pthread_mutex_t mutex_;  // The underlying pthread mutex.
3242   // has_owner_ indicates whether the owner_ field below contains a valid thread
3243   // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All
3244   // accesses to the owner_ field should be protected by a check of this field.
3245   // An alternative might be to memset() owner_ to all zeros, but there's no
3246   // guarantee that a zero'd pthread_t is necessarily invalid or even different
3247   // from pthread_self().
3248   bool has_owner_;
3249   pthread_t owner_;  // The thread holding the mutex.
3250 };
3251
3252 // Forward-declares a static mutex.
3253 #  define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
3254      extern ::testing::internal::MutexBase mutex
3255
3256 // Defines and statically (i.e. at link time) initializes a static mutex.
3257 #  define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
3258      ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false, pthread_t() }
3259
3260 // The Mutex class can only be used for mutexes created at runtime. It
3261 // shares its API with MutexBase otherwise.
3262 class Mutex : public MutexBase {
3263  public:
3264   Mutex() {
3265     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
3266     has_owner_ = false;
3267   }
3268   ~Mutex() {
3269     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
3270   }
3271
3272  private:
3273   GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
3274 };
3275
3276 // We cannot name this class MutexLock because the ctor declaration would
3277 // conflict with a macro named MutexLock, which is defined on some
3278 // platforms. That macro is used as a defensive measure to prevent against
3279 // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
3280 // "MutexLock l(&mu)".  Hence the typedef trick below.
3281 class GTestMutexLock {
3282  public:
3283   explicit GTestMutexLock(MutexBase* mutex)
3284       : mutex_(mutex) { mutex_->Lock(); }
3285
3286   ~GTestMutexLock() { mutex_->Unlock(); }
3287
3288  private:
3289   MutexBase* const mutex_;
3290
3291   GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
3292 };
3293
3294 typedef GTestMutexLock MutexLock;
3295
3296 // Helpers for ThreadLocal.
3297
3298 // pthread_key_create() requires DeleteThreadLocalValue() to have
3299 // C-linkage.  Therefore it cannot be templatized to access
3300 // ThreadLocal<T>.  Hence the need for class
3301 // ThreadLocalValueHolderBase.
3302 class ThreadLocalValueHolderBase {
3303  public:
3304   virtual ~ThreadLocalValueHolderBase() {}
3305 };
3306
3307 // Called by pthread to delete thread-local data stored by
3308 // pthread_setspecific().
3309 extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
3310   delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
3311 }
3312
3313 // Implements thread-local storage on pthreads-based systems.
3314 template <typename T>
3315 class ThreadLocal {
3316  public:
3317   ThreadLocal()
3318       : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {}
3319   explicit ThreadLocal(const T& value)
3320       : key_(CreateKey()),
3321         default_factory_(new InstanceValueHolderFactory(value)) {}
3322
3323   ~ThreadLocal() {
3324     // Destroys the managed object for the current thread, if any.
3325     DeleteThreadLocalValue(pthread_getspecific(key_));
3326
3327     // Releases resources associated with the key.  This will *not*
3328     // delete managed objects for other threads.
3329     GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));
3330   }
3331
3332   T* pointer() { return GetOrCreateValue(); }
3333   const T* pointer() const { return GetOrCreateValue(); }
3334   const T& get() const { return *pointer(); }
3335   void set(const T& value) { *pointer() = value; }
3336
3337  private:
3338   // Holds a value of type T.
3339   class ValueHolder : public ThreadLocalValueHolderBase {
3340    public:
3341     ValueHolder() : value_() {}
3342     explicit ValueHolder(const T& value) : value_(value) {}
3343
3344     T* pointer() { return &value_; }
3345
3346    private:
3347     T value_;
3348     GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
3349   };
3350
3351   static pthread_key_t CreateKey() {
3352     pthread_key_t key;
3353     // When a thread exits, DeleteThreadLocalValue() will be called on
3354     // the object managed for that thread.
3355     GTEST_CHECK_POSIX_SUCCESS_(
3356         pthread_key_create(&key, &DeleteThreadLocalValue));
3357     return key;
3358   }
3359
3360   T* GetOrCreateValue() const {
3361     ThreadLocalValueHolderBase* const holder =
3362         static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));
3363     if (holder != NULL) {
3364       return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
3365     }
3366
3367     ValueHolder* const new_holder = default_factory_->MakeNewHolder();
3368     ThreadLocalValueHolderBase* const holder_base = new_holder;
3369     GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
3370     return new_holder->pointer();
3371   }
3372
3373   class ValueHolderFactory {
3374    public:
3375     ValueHolderFactory() {}
3376     virtual ~ValueHolderFactory() {}
3377     virtual ValueHolder* MakeNewHolder() const = 0;
3378
3379    private:
3380     GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
3381   };
3382
3383   class DefaultValueHolderFactory : public ValueHolderFactory {
3384    public:
3385     DefaultValueHolderFactory() {}
3386     virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); }
3387
3388    private:
3389     GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
3390   };
3391
3392   class InstanceValueHolderFactory : public ValueHolderFactory {
3393    public:
3394     explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
3395     virtual ValueHolder* MakeNewHolder() const {
3396       return new ValueHolder(value_);
3397     }
3398
3399    private:
3400     const T value_;  // The value for each thread.
3401
3402     GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
3403   };
3404
3405   // A key pthreads uses for looking up per-thread values.
3406   const pthread_key_t key_;
3407   scoped_ptr<ValueHolderFactory> default_factory_;
3408
3409   GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
3410 };
3411
3412 # endif  // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
3413
3414 #else  // GTEST_IS_THREADSAFE
3415
3416 // A dummy implementation of synchronization primitives (mutex, lock,
3417 // and thread-local variable).  Necessary for compiling Google Test where
3418 // mutex is not supported - using Google Test in multiple threads is not
3419 // supported on such platforms.
3420
3421 class Mutex {
3422  public:
3423   Mutex() {}
3424   void Lock() {}
3425   void Unlock() {}
3426   void AssertHeld() const {}
3427 };
3428
3429 # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
3430   extern ::testing::internal::Mutex mutex
3431
3432 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
3433
3434 // We cannot name this class MutexLock because the ctor declaration would
3435 // conflict with a macro named MutexLock, which is defined on some
3436 // platforms. That macro is used as a defensive measure to prevent against
3437 // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
3438 // "MutexLock l(&mu)".  Hence the typedef trick below.
3439 class GTestMutexLock {
3440  public:
3441   explicit GTestMutexLock(Mutex*) {}  // NOLINT
3442 };
3443
3444 typedef GTestMutexLock MutexLock;
3445
3446 template <typename T>
3447 class ThreadLocal {
3448  public:
3449   ThreadLocal() : value_() {}
3450   explicit ThreadLocal(const T& value) : value_(value) {}
3451   T* pointer() { return &value_; }
3452   const T* pointer() const { return &value_; }
3453   const T& get() const { return value_; }
3454   void set(const T& value) { value_ = value; }
3455  private:
3456   T value_;
3457 };
3458
3459 #endif  // GTEST_IS_THREADSAFE
3460
3461 // Returns the number of threads running in the process, or 0 to indicate that
3462 // we cannot detect it.
3463 GTEST_API_ size_t GetThreadCount();
3464
3465 // Passing non-POD classes through ellipsis (...) crashes the ARM
3466 // compiler and generates a warning in Sun Studio.  The Nokia Symbian
3467 // and the IBM XL C/C++ compiler try to instantiate a copy constructor
3468 // for objects passed through ellipsis (...), failing for uncopyable
3469 // objects.  We define this to ensure that only POD is passed through
3470 // ellipsis on these systems.
3471 #if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
3472 // We lose support for NULL detection where the compiler doesn't like
3473 // passing non-POD classes through ellipsis (...).
3474 # define GTEST_ELLIPSIS_NEEDS_POD_ 1
3475 #else
3476 # define GTEST_CAN_COMPARE_NULL 1
3477 #endif
3478
3479 // The Nokia Symbian and IBM XL C/C++ compilers cannot decide between
3480 // const T& and const T* in a function template.  These compilers
3481 // _can_ decide between class template specializations for T and T*,
3482 // so a tr1::type_traits-like is_pointer works.
3483 #if defined(__SYMBIAN32__) || defined(__IBMCPP__)
3484 # define GTEST_NEEDS_IS_POINTER_ 1
3485 #endif
3486
3487 template <bool bool_value>
3488 struct bool_constant {
3489   typedef bool_constant<bool_value> type;
3490   static const bool value = bool_value;
3491 };
3492 template <bool bool_value> const bool bool_constant<bool_value>::value;
3493
3494 typedef bool_constant<false> false_type;
3495 typedef bool_constant<true> true_type;
3496
3497 template <typename T>
3498 struct is_pointer : public false_type {};
3499
3500 template <typename T>
3501 struct is_pointer<T*> : public true_type {};
3502
3503 template <typename Iterator>
3504 struct IteratorTraits {
3505   typedef typename Iterator::value_type value_type;
3506 };
3507
3508 template <typename T>
3509 struct IteratorTraits<T*> {
3510   typedef T value_type;
3511 };
3512
3513 template <typename T>
3514 struct IteratorTraits<const T*> {
3515   typedef T value_type;
3516 };
3517
3518 #if GTEST_OS_WINDOWS
3519 # define GTEST_PATH_SEP_ "\\"
3520 # define GTEST_HAS_ALT_PATH_SEP_ 1
3521 // The biggest signed integer type the compiler supports.
3522 typedef __int64 BiggestInt;
3523 #else
3524 # define GTEST_PATH_SEP_ "/"
3525 # define GTEST_HAS_ALT_PATH_SEP_ 0
3526 typedef long long BiggestInt;  // NOLINT
3527 #endif  // GTEST_OS_WINDOWS
3528
3529 // Utilities for char.
3530
3531 // isspace(int ch) and friends accept an unsigned char or EOF.  char
3532 // may be signed, depending on the compiler (or compiler flags).
3533 // Therefore we need to cast a char to unsigned char before calling
3534 // isspace(), etc.
3535
3536 inline bool IsAlpha(char ch) {
3537   return isalpha(static_cast<unsigned char>(ch)) != 0;
3538 }
3539 inline bool IsAlNum(char ch) {
3540   return isalnum(static_cast<unsigned char>(ch)) != 0;
3541 }
3542 inline bool IsDigit(char ch) {
3543   return isdigit(static_cast<unsigned char>(ch)) != 0;
3544 }
3545 inline bool IsLower(char ch) {
3546   return islower(static_cast<unsigned char>(ch)) != 0;
3547 }
3548 inline bool IsSpace(char ch) {
3549   return isspace(static_cast<unsigned char>(ch)) != 0;
3550 }
3551 inline bool IsUpper(char ch) {
3552   return isupper(static_cast<unsigned char>(ch)) != 0;
3553 }
3554 inline bool IsXDigit(char ch) {
3555   return isxdigit(static_cast<unsigned char>(ch)) != 0;
3556 }
3557 inline bool IsXDigit(wchar_t ch) {
3558   const unsigned char low_byte = static_cast<unsigned char>(ch);
3559   return ch == low_byte && isxdigit(low_byte) != 0;
3560 }
3561
3562 inline char ToLower(char ch) {
3563   return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
3564 }
3565 inline char ToUpper(char ch) {
3566   return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
3567 }
3568
3569 inline std::string StripTrailingSpaces(std::string str) {
3570   std::string::iterator it = str.end();
3571   while (it != str.begin() && IsSpace(*--it))
3572     it = str.erase(it);
3573   return str;
3574 }
3575
3576 // The testing::internal::posix namespace holds wrappers for common
3577 // POSIX functions.  These wrappers hide the differences between
3578 // Windows/MSVC and POSIX systems.  Since some compilers define these
3579 // standard functions as macros, the wrapper cannot have the same name
3580 // as the wrapped function.
3581
3582 namespace posix {
3583
3584 // Functions with a different name on Windows.
3585
3586 #if GTEST_OS_WINDOWS
3587
3588 typedef struct _stat StatStruct;
3589
3590 # ifdef __BORLANDC__
3591 inline int IsATTY(int fd) { return isatty(fd); }
3592 inline int StrCaseCmp(const char* s1, const char* s2) {
3593   return stricmp(s1, s2);
3594 }
3595 inline char* StrDup(const char* src) { return strdup(src); }
3596 # else  // !__BORLANDC__
3597 #  if GTEST_OS_WINDOWS_MOBILE
3598 inline int IsATTY(int /* fd */) { return 0; }
3599 #  else
3600 inline int IsATTY(int fd) { return _isatty(fd); }
3601 #  endif  // GTEST_OS_WINDOWS_MOBILE
3602 inline int StrCaseCmp(const char* s1, const char* s2) {
3603   return _stricmp(s1, s2);
3604 }
3605 inline char* StrDup(const char* src) { return _strdup(src); }
3606 # endif  // __BORLANDC__
3607
3608 # if GTEST_OS_WINDOWS_MOBILE
3609 inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
3610 // Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
3611 // time and thus not defined there.
3612 # else
3613 inline int FileNo(FILE* file) { return _fileno(file); }
3614 inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
3615 inline int RmDir(const char* dir) { return _rmdir(dir); }
3616 inline bool IsDir(const StatStruct& st) {
3617   return (_S_IFDIR & st.st_mode) != 0;
3618 }
3619 # endif  // GTEST_OS_WINDOWS_MOBILE
3620
3621 #else
3622
3623 typedef struct stat StatStruct;
3624
3625 inline int FileNo(FILE* file) { return fileno(file); }
3626 inline int IsATTY(int fd) { return isatty(fd); }
3627 inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }
3628 inline int StrCaseCmp(const char* s1, const char* s2) {
3629   return strcasecmp(s1, s2);
3630 }
3631 inline char* StrDup(const char* src) { return strdup(src); }
3632 inline int RmDir(const char* dir) { return rmdir(dir); }
3633 inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
3634
3635 #endif  // GTEST_OS_WINDOWS
3636
3637 // Functions deprecated by MSVC 8.0.
3638
3639 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* deprecated function */)
3640
3641 inline const char* StrNCpy(char* dest, const char* src, size_t n) {
3642   return strncpy(dest, src, n);
3643 }
3644
3645 // ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
3646 // StrError() aren't needed on Windows CE at this time and thus not
3647 // defined there.
3648
3649 #if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
3650 inline int ChDir(const char* dir) { return chdir(dir); }
3651 #endif
3652 inline FILE* FOpen(const char* path, const char* mode) {
3653   return fopen(path, mode);
3654 }
3655 #if !GTEST_OS_WINDOWS_MOBILE
3656 inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
3657   return freopen(path, mode, stream);
3658 }
3659 inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
3660 #endif
3661 inline int FClose(FILE* fp) { return fclose(fp); }
3662 #if !GTEST_OS_WINDOWS_MOBILE
3663 inline int Read(int fd, void* buf, unsigned int count) {
3664   return static_cast<int>(read(fd, buf, count));
3665 }
3666 inline int Write(int fd, const void* buf, unsigned int count) {
3667   return static_cast<int>(write(fd, buf, count));
3668 }
3669 inline int Close(int fd) { return close(fd); }
3670 inline const char* StrError(int errnum) { return strerror(errnum); }
3671 #endif
3672 inline const char* GetEnv(const char* name) {
3673 #if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE | GTEST_OS_WINDOWS_RT
3674   // We are on Windows CE, which has no environment variables.
3675   static_cast<void>(name);  // To prevent 'unused argument' warning.
3676   return NULL;
3677 #elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
3678   // Environment variables which we programmatically clear will be set to the
3679   // empty string rather than unset (NULL).  Handle that case.
3680   const char* const env = getenv(name);
3681   return (env != NULL && env[0] != '\0') ? env : NULL;
3682 #else
3683   return getenv(name);
3684 #endif
3685 }
3686
3687 GTEST_DISABLE_MSC_WARNINGS_POP_()
3688
3689 #if GTEST_OS_WINDOWS_MOBILE
3690 // Windows CE has no C library. The abort() function is used in
3691 // several places in Google Test. This implementation provides a reasonable
3692 // imitation of standard behaviour.
3693 void Abort();
3694 #else
3695 inline void Abort() { abort(); }
3696 #endif  // GTEST_OS_WINDOWS_MOBILE
3697
3698 }  // namespace posix
3699
3700 // MSVC "deprecates" snprintf and issues warnings wherever it is used.  In
3701 // order to avoid these warnings, we need to use _snprintf or _snprintf_s on
3702 // MSVC-based platforms.  We map the GTEST_SNPRINTF_ macro to the appropriate
3703 // function in order to achieve that.  We use macro definition here because
3704 // snprintf is a variadic function.
3705 #if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
3706 // MSVC 2005 and above support variadic macros.
3707 # define GTEST_SNPRINTF_(buffer, size, format, ...) \
3708      _snprintf_s(buffer, size, size, format, __VA_ARGS__)
3709 #elif defined(_MSC_VER)
3710 // Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't
3711 // complain about _snprintf.
3712 # define GTEST_SNPRINTF_ _snprintf
3713 #else
3714 # define GTEST_SNPRINTF_ snprintf
3715 #endif
3716
3717 // The maximum number a BiggestInt can represent.  This definition
3718 // works no matter BiggestInt is represented in one's complement or
3719 // two's complement.
3720 //
3721 // We cannot rely on numeric_limits in STL, as __int64 and long long
3722 // are not part of standard C++ and numeric_limits doesn't need to be
3723 // defined for them.
3724 const BiggestInt kMaxBiggestInt =
3725     ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));
3726
3727 // This template class serves as a compile-time function from size to
3728 // type.  It maps a size in bytes to a primitive type with that
3729 // size. e.g.
3730 //
3731 //   TypeWithSize<4>::UInt
3732 //
3733 // is typedef-ed to be unsigned int (unsigned integer made up of 4
3734 // bytes).
3735 //
3736 // Such functionality should belong to STL, but I cannot find it
3737 // there.
3738 //
3739 // Google Test uses this class in the implementation of floating-point
3740 // comparison.
3741 //
3742 // For now it only handles UInt (unsigned int) as that's all Google Test
3743 // needs.  Other types can be easily added in the future if need
3744 // arises.
3745 template <size_t size>
3746 class TypeWithSize {
3747  public:
3748   // This prevents the user from using TypeWithSize<N> with incorrect
3749   // values of N.
3750   typedef void UInt;
3751 };
3752
3753 // The specialization for size 4.
3754 template <>
3755 class TypeWithSize<4> {
3756  public:
3757   // unsigned int has size 4 in both gcc and MSVC.
3758   //
3759   // As base/basictypes.h doesn't compile on Windows, we cannot use
3760   // uint32, uint64, and etc here.
3761   typedef int Int;
3762   typedef unsigned int UInt;
3763 };
3764
3765 // The specialization for size 8.
3766 template <>
3767 class TypeWithSize<8> {
3768  public:
3769 #if GTEST_OS_WINDOWS
3770   typedef __int64 Int;
3771   typedef unsigned __int64 UInt;
3772 #else
3773   typedef long long Int;  // NOLINT
3774   typedef unsigned long long UInt;  // NOLINT
3775 #endif  // GTEST_OS_WINDOWS
3776 };
3777
3778 // Integer types of known sizes.
3779 typedef TypeWithSize<4>::Int Int32;
3780 typedef TypeWithSize<4>::UInt UInt32;
3781 typedef TypeWithSize<8>::Int Int64;
3782 typedef TypeWithSize<8>::UInt UInt64;
3783 typedef TypeWithSize<8>::Int TimeInMillis;  // Represents time in milliseconds.
3784
3785 // Utilities for command line flags and environment variables.
3786
3787 // Macro for referencing flags.
3788 #if !defined(GTEST_FLAG)
3789 # define GTEST_FLAG(name) FLAGS_gtest_##name
3790 #endif  // !defined(GTEST_FLAG)
3791
3792 #if !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
3793 # define GTEST_USE_OWN_FLAGFILE_FLAG_ 1
3794 #endif  // !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
3795
3796 #if !defined(GTEST_DECLARE_bool_)
3797 # define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver
3798
3799 // Macros for declaring flags.
3800 # define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
3801 # define GTEST_DECLARE_int32_(name) \
3802     GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
3803 #define GTEST_DECLARE_string_(name) \
3804     GTEST_API_ extern ::std::string GTEST_FLAG(name)
3805
3806 // Macros for defining flags.
3807 #define GTEST_DEFINE_bool_(name, default_val, doc) \
3808     GTEST_API_ bool GTEST_FLAG(name) = (default_val)
3809 #define GTEST_DEFINE_int32_(name, default_val, doc) \
3810     GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
3811 #define GTEST_DEFINE_string_(name, default_val, doc) \
3812     GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
3813
3814 #endif  // !defined(GTEST_DECLARE_bool_)
3815
3816 // Thread annotations
3817 #if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
3818 # define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
3819 # define GTEST_LOCK_EXCLUDED_(locks)
3820 #endif  // !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
3821
3822 // Parses 'str' for a 32-bit signed integer.  If successful, writes the result
3823 // to *value and returns true; otherwise leaves *value unchanged and returns
3824 // false.
3825 // TODO(chandlerc): Find a better way to refactor flag and environment parsing
3826 // out of both gtest-port.cc and gtest.cc to avoid exporting this utility
3827 // function.
3828 bool ParseInt32(const Message& src_text, const char* str, Int32* value);
3829
3830 // Parses a bool/Int32/string from the environment variable
3831 // corresponding to the given Google Test flag.
3832 bool BoolFromGTestEnv(const char* flag, bool default_val);
3833 GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
3834 std::string StringFromGTestEnv(const char* flag, const char* default_val);
3835
3836 }  // namespace internal
3837 }  // namespace testing
3838
3839 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
3840
3841 #if GTEST_OS_LINUX
3842 # include <stdlib.h>
3843 # include <sys/types.h>
3844 # include <sys/wait.h>
3845 # include <unistd.h>
3846 #endif  // GTEST_OS_LINUX
3847
3848 #if GTEST_HAS_EXCEPTIONS
3849 # include <stdexcept>
3850 #endif
3851
3852 #include <ctype.h>
3853 #include <float.h>
3854 #include <string.h>
3855 #include <iomanip>
3856 #include <limits>
3857 #include <map>
3858 #include <set>
3859 #include <string>
3860 #include <vector>
3861
3862 // Copyright 2005, Google Inc.
3863 // All rights reserved.
3864 //
3865 // Redistribution and use in source and binary forms, with or without
3866 // modification, are permitted provided that the following conditions are
3867 // met:
3868 //
3869 //     * Redistributions of source code must retain the above copyright
3870 // notice, this list of conditions and the following disclaimer.
3871 //     * Redistributions in binary form must reproduce the above
3872 // copyright notice, this list of conditions and the following disclaimer
3873 // in the documentation and/or other materials provided with the
3874 // distribution.
3875 //     * Neither the name of Google Inc. nor the names of its
3876 // contributors may be used to endorse or promote products derived from
3877 // this software without specific prior written permission.
3878 //
3879 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3880 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3881 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3882 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3883 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3884 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3885 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3886 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3887 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3888 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3889 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3890 //
3891 // Author: wan@google.com (Zhanyong Wan)
3892 //
3893 // The Google C++ Testing Framework (Google Test)
3894 //
3895 // This header file defines the Message class.
3896 //
3897 // IMPORTANT NOTE: Due to limitation of the C++ language, we have to
3898 // leave some internal implementation details in this header file.
3899 // They are clearly marked by comments like this:
3900 //
3901 //   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
3902 //
3903 // Such code is NOT meant to be used by a user directly, and is subject
3904 // to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user
3905 // program!
3906
3907 #ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
3908 #define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
3909
3910 #include <limits>
3911
3912
3913 // Ensures that there is at least one operator<< in the global namespace.
3914 // See Message& operator<<(...) below for why.
3915 void operator<<(const testing::internal::Secret&, int);
3916
3917 namespace testing {
3918
3919 // The Message class works like an ostream repeater.
3920 //
3921 // Typical usage:
3922 //
3923 //   1. You stream a bunch of values to a Message object.
3924 //      It will remember the text in a stringstream.
3925 //   2. Then you stream the Message object to an ostream.
3926 //      This causes the text in the Message to be streamed
3927 //      to the ostream.
3928 //
3929 // For example;
3930 //
3931 //   testing::Message foo;
3932 //   foo << 1 << " != " << 2;
3933 //   std::cout << foo;
3934 //
3935 // will print "1 != 2".
3936 //
3937 // Message is not intended to be inherited from.  In particular, its
3938 // destructor is not virtual.
3939 //
3940 // Note that stringstream behaves differently in gcc and in MSVC.  You
3941 // can stream a NULL char pointer to it in the former, but not in the
3942 // latter (it causes an access violation if you do).  The Message
3943 // class hides this difference by treating a NULL char pointer as
3944 // "(null)".
3945 class GTEST_API_ Message {
3946  private:
3947   // The type of basic IO manipulators (endl, ends, and flush) for
3948   // narrow streams.
3949   typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
3950
3951  public:
3952   // Constructs an empty Message.
3953   Message();
3954
3955   // Copy constructor.
3956   Message(const Message& msg) : ss_(new ::std::stringstream) {  // NOLINT
3957     *ss_ << msg.GetString();
3958   }
3959
3960   // Constructs a Message from a C-string.
3961   explicit Message(const char* str) : ss_(new ::std::stringstream) {
3962     *ss_ << str;
3963   }
3964
3965 #if GTEST_OS_SYMBIAN
3966   // Streams a value (either a pointer or not) to this object.
3967   template <typename T>
3968   inline Message& operator <<(const T& value) {
3969     StreamHelper(typename internal::is_pointer<T>::type(), value);
3970     return *this;
3971   }
3972 #else
3973   // Streams a non-pointer value to this object.
3974   template <typename T>
3975   inline Message& operator <<(const T& val) {
3976     // Some libraries overload << for STL containers.  These
3977     // overloads are defined in the global namespace instead of ::std.
3978     //
3979     // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
3980     // overloads are visible in either the std namespace or the global
3981     // namespace, but not other namespaces, including the testing
3982     // namespace which Google Test's Message class is in.
3983     //
3984     // To allow STL containers (and other types that has a << operator
3985     // defined in the global namespace) to be used in Google Test
3986     // assertions, testing::Message must access the custom << operator
3987     // from the global namespace.  With this using declaration,
3988     // overloads of << defined in the global namespace and those
3989     // visible via Koenig lookup are both exposed in this function.
3990     using ::operator <<;
3991     *ss_ << val;
3992     return *this;
3993   }
3994
3995   // Streams a pointer value to this object.
3996   //
3997   // This function is an overload of the previous one.  When you
3998   // stream a pointer to a Message, this definition will be used as it
3999   // is more specialized.  (The C++ Standard, section
4000   // [temp.func.order].)  If you stream a non-pointer, then the
4001   // previous definition will be used.
4002   //
4003   // The reason for this overload is that streaming a NULL pointer to
4004   // ostream is undefined behavior.  Depending on the compiler, you
4005   // may get "0", "(nil)", "(null)", or an access violation.  To
4006   // ensure consistent result across compilers, we always treat NULL
4007   // as "(null)".
4008   template <typename T>
4009   inline Message& operator <<(T* const& pointer) {  // NOLINT
4010     if (pointer == NULL) {
4011       *ss_ << "(null)";
4012     } else {
4013       *ss_ << pointer;
4014     }
4015     return *this;
4016   }
4017 #endif  // GTEST_OS_SYMBIAN
4018
4019   // Since the basic IO manipulators are overloaded for both narrow
4020   // and wide streams, we have to provide this specialized definition
4021   // of operator <<, even though its body is the same as the
4022   // templatized version above.  Without this definition, streaming
4023   // endl or other basic IO manipulators to Message will confuse the
4024   // compiler.
4025   Message& operator <<(BasicNarrowIoManip val) {
4026     *ss_ << val;
4027     return *this;
4028   }
4029
4030   // Instead of 1/0, we want to see true/false for bool values.
4031   Message& operator <<(bool b) {
4032     return *this << (b ? "true" : "false");
4033   }
4034
4035   // These two overloads allow streaming a wide C string to a Message
4036   // using the UTF-8 encoding.
4037   Message& operator <<(const wchar_t* wide_c_str);
4038   Message& operator <<(wchar_t* wide_c_str);
4039
4040 #if GTEST_HAS_STD_WSTRING
4041   // Converts the given wide string to a narrow string using the UTF-8
4042   // encoding, and streams the result to this Message object.
4043   Message& operator <<(const ::std::wstring& wstr);
4044 #endif  // GTEST_HAS_STD_WSTRING
4045
4046 #if GTEST_HAS_GLOBAL_WSTRING
4047   // Converts the given wide string to a narrow string using the UTF-8
4048   // encoding, and streams the result to this Message object.
4049   Message& operator <<(const ::wstring& wstr);
4050 #endif  // GTEST_HAS_GLOBAL_WSTRING
4051
4052   // Gets the text streamed to this object so far as an std::string.
4053   // Each '\0' character in the buffer is replaced with "\\0".
4054   //
4055   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
4056   std::string GetString() const;
4057
4058  private:
4059
4060 #if GTEST_OS_SYMBIAN
4061   // These are needed as the Nokia Symbian Compiler cannot decide between
4062   // const T& and const T* in a function template. The Nokia compiler _can_
4063   // decide between class template specializations for T and T*, so a
4064   // tr1::type_traits-like is_pointer works, and we can overload on that.
4065   template <typename T>
4066   inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) {
4067     if (pointer == NULL) {
4068       *ss_ << "(null)";
4069     } else {
4070       *ss_ << pointer;
4071     }
4072   }
4073   template <typename T>
4074   inline void StreamHelper(internal::false_type /*is_pointer*/,
4075                            const T& value) {
4076     // See the comments in Message& operator <<(const T&) above for why
4077     // we need this using statement.
4078     using ::operator <<;
4079     *ss_ << value;
4080   }
4081 #endif  // GTEST_OS_SYMBIAN
4082
4083   // We'll hold the text streamed to this object here.
4084   const internal::scoped_ptr< ::std::stringstream> ss_;
4085
4086   // We declare (but don't implement) this to prevent the compiler
4087   // from implementing the assignment operator.
4088   void operator=(const Message&);
4089 };
4090
4091 // Streams a Message to an ostream.
4092 inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
4093   return os << sb.GetString();
4094 }
4095
4096 namespace internal {
4097
4098 // Converts a streamable value to an std::string.  A NULL pointer is
4099 // converted to "(null)".  When the input value is a ::string,
4100 // ::std::string, ::wstring, or ::std::wstring object, each NUL
4101 // character in it is replaced with "\\0".
4102 template <typename T>
4103 std::string StreamableToString(const T& streamable) {
4104   return (Message() << streamable).GetString();
4105 }
4106
4107 }  // namespace internal
4108 }  // namespace testing
4109
4110 #endif  // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
4111 // Copyright 2005, Google Inc.
4112 // All rights reserved.
4113 //
4114 // Redistribution and use in source and binary forms, with or without
4115 // modification, are permitted provided that the following conditions are
4116 // met:
4117 //
4118 //     * Redistributions of source code must retain the above copyright
4119 // notice, this list of conditions and the following disclaimer.
4120 //     * Redistributions in binary form must reproduce the above
4121 // copyright notice, this list of conditions and the following disclaimer
4122 // in the documentation and/or other materials provided with the
4123 // distribution.
4124 //     * Neither the name of Google Inc. nor the names of its
4125 // contributors may be used to endorse or promote products derived from
4126 // this software without specific prior written permission.
4127 //
4128 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4129 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4130 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4131 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4132 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4133 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4134 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4135 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4136 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4137 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4138 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4139 //
4140 // Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
4141 //
4142 // The Google C++ Testing Framework (Google Test)
4143 //
4144 // This header file declares the String class and functions used internally by
4145 // Google Test.  They are subject to change without notice. They should not used
4146 // by code external to Google Test.
4147 //
4148 // This header file is #included by <gtest/internal/gtest-internal.h>.
4149 // It should not be #included by other files.
4150
4151 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
4152 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
4153
4154 #ifdef __BORLANDC__
4155 // string.h is not guaranteed to provide strcpy on C++ Builder.
4156 # include <mem.h>
4157 #endif
4158
4159 #include <string.h>
4160 #include <string>
4161
4162
4163 namespace testing {
4164 namespace internal {
4165
4166 // String - an abstract class holding static string utilities.
4167 class GTEST_API_ String {
4168  public:
4169   // Static utility methods
4170
4171   // Clones a 0-terminated C string, allocating memory using new.  The
4172   // caller is responsible for deleting the return value using
4173   // delete[].  Returns the cloned string, or NULL if the input is
4174   // NULL.
4175   //
4176   // This is different from strdup() in string.h, which allocates
4177   // memory using malloc().
4178   static const char* CloneCString(const char* c_str);
4179
4180 #if GTEST_OS_WINDOWS_MOBILE
4181   // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
4182   // able to pass strings to Win32 APIs on CE we need to convert them
4183   // to 'Unicode', UTF-16.
4184
4185   // Creates a UTF-16 wide string from the given ANSI string, allocating
4186   // memory using new. The caller is responsible for deleting the return
4187   // value using delete[]. Returns the wide string, or NULL if the
4188   // input is NULL.
4189   //
4190   // The wide string is created using the ANSI codepage (CP_ACP) to
4191   // match the behaviour of the ANSI versions of Win32 calls and the
4192   // C runtime.
4193   static LPCWSTR AnsiToUtf16(const char* c_str);
4194
4195   // Creates an ANSI string from the given wide string, allocating
4196   // memory using new. The caller is responsible for deleting the return
4197   // value using delete[]. Returns the ANSI string, or NULL if the
4198   // input is NULL.
4199   //
4200   // The returned string is created using the ANSI codepage (CP_ACP) to
4201   // match the behaviour of the ANSI versions of Win32 calls and the
4202   // C runtime.
4203   static const char* Utf16ToAnsi(LPCWSTR utf16_str);
4204 #endif
4205
4206   // Compares two C strings.  Returns true iff they have the same content.
4207   //
4208   // Unlike strcmp(), this function can handle NULL argument(s).  A
4209   // NULL C string is considered different to any non-NULL C string,
4210   // including the empty string.
4211   static bool CStringEquals(const char* lhs, const char* rhs);
4212
4213   // Converts a wide C string to a String using the UTF-8 encoding.
4214   // NULL will be converted to "(null)".  If an error occurred during
4215   // the conversion, "(failed to convert from wide string)" is
4216   // returned.
4217   static std::string ShowWideCString(const wchar_t* wide_c_str);
4218
4219   // Compares two wide C strings.  Returns true iff they have the same
4220   // content.
4221   //
4222   // Unlike wcscmp(), this function can handle NULL argument(s).  A
4223   // NULL C string is considered different to any non-NULL C string,
4224   // including the empty string.
4225   static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
4226
4227   // Compares two C strings, ignoring case.  Returns true iff they
4228   // have the same content.
4229   //
4230   // Unlike strcasecmp(), this function can handle NULL argument(s).
4231   // A NULL C string is considered different to any non-NULL C string,
4232   // including the empty string.
4233   static bool CaseInsensitiveCStringEquals(const char* lhs,
4234                                            const char* rhs);
4235
4236   // Compares two wide C strings, ignoring case.  Returns true iff they
4237   // have the same content.
4238   //
4239   // Unlike wcscasecmp(), this function can handle NULL argument(s).
4240   // A NULL C string is considered different to any non-NULL wide C string,
4241   // including the empty string.
4242   // NB: The implementations on different platforms slightly differ.
4243   // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
4244   // environment variable. On GNU platform this method uses wcscasecmp
4245   // which compares according to LC_CTYPE category of the current locale.
4246   // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
4247   // current locale.
4248   static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
4249                                                const wchar_t* rhs);
4250
4251   // Returns true iff the given string ends with the given suffix, ignoring
4252   // case. Any string is considered to end with an empty suffix.
4253   static bool EndsWithCaseInsensitive(
4254       const std::string& str, const std::string& suffix);
4255
4256   // Formats an int value as "%02d".
4257   static std::string FormatIntWidth2(int value);  // "%02d" for width == 2
4258
4259   // Formats an int value as "%X".
4260   static std::string FormatHexInt(int value);
4261
4262   // Formats a byte as "%02X".
4263   static std::string FormatByte(unsigned char value);
4264
4265  private:
4266   String();  // Not meant to be instantiated.
4267 };  // class String
4268
4269 // Gets the content of the stringstream's buffer as an std::string.  Each '\0'
4270 // character in the buffer is replaced with "\\0".
4271 GTEST_API_ std::string StringStreamToString(::std::stringstream* stream);
4272
4273 }  // namespace internal
4274 }  // namespace testing
4275
4276 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
4277 // Copyright 2008, Google Inc.
4278 // All rights reserved.
4279 //
4280 // Redistribution and use in source and binary forms, with or without
4281 // modification, are permitted provided that the following conditions are
4282 // met:
4283 //
4284 //     * Redistributions of source code must retain the above copyright
4285 // notice, this list of conditions and the following disclaimer.
4286 //     * Redistributions in binary form must reproduce the above
4287 // copyright notice, this list of conditions and the following disclaimer
4288 // in the documentation and/or other materials provided with the
4289 // distribution.
4290 //     * Neither the name of Google Inc. nor the names of its
4291 // contributors may be used to endorse or promote products derived from
4292 // this software without specific prior written permission.
4293 //
4294 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4295 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4296 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4297 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4298 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4299 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4300 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4301 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4302 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4303 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4304 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4305 //
4306 // Author: keith.ray@gmail.com (Keith Ray)
4307 //
4308 // Google Test filepath utilities
4309 //
4310 // This header file declares classes and functions used internally by
4311 // Google Test.  They are subject to change without notice.
4312 //
4313 // This file is #included in <gtest/internal/gtest-internal.h>.
4314 // Do not include this header file separately!
4315
4316 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
4317 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
4318
4319
4320 namespace testing {
4321 namespace internal {
4322
4323 // FilePath - a class for file and directory pathname manipulation which
4324 // handles platform-specific conventions (like the pathname separator).
4325 // Used for helper functions for naming files in a directory for xml output.
4326 // Except for Set methods, all methods are const or static, which provides an
4327 // "immutable value object" -- useful for peace of mind.
4328 // A FilePath with a value ending in a path separator ("like/this/") represents
4329 // a directory, otherwise it is assumed to represent a file. In either case,
4330 // it may or may not represent an actual file or directory in the file system.
4331 // Names are NOT checked for syntax correctness -- no checking for illegal
4332 // characters, malformed paths, etc.
4333
4334 class GTEST_API_ FilePath {
4335  public:
4336   FilePath() : pathname_("") { }
4337   FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
4338
4339   explicit FilePath(const std::string& pathname) : pathname_(pathname) {
4340     Normalize();
4341   }
4342
4343   FilePath& operator=(const FilePath& rhs) {
4344     Set(rhs);
4345     return *this;
4346   }
4347
4348   void Set(const FilePath& rhs) {
4349     pathname_ = rhs.pathname_;
4350   }
4351
4352   const std::string& string() const { return pathname_; }
4353   const char* c_str() const { return pathname_.c_str(); }
4354
4355   // Returns the current working directory, or "" if unsuccessful.
4356   static FilePath GetCurrentDir();
4357
4358   // Given directory = "dir", base_name = "test", number = 0,
4359   // extension = "xml", returns "dir/test.xml". If number is greater
4360   // than zero (e.g., 12), returns "dir/test_12.xml".
4361   // On Windows platform, uses \ as the separator rather than /.
4362   static FilePath MakeFileName(const FilePath& directory,
4363                                const FilePath& base_name,
4364                                int number,
4365                                const char* extension);
4366
4367   // Given directory = "dir", relative_path = "test.xml",
4368   // returns "dir/test.xml".
4369   // On Windows, uses \ as the separator rather than /.
4370   static FilePath ConcatPaths(const FilePath& directory,
4371                               const FilePath& relative_path);
4372
4373   // Returns a pathname for a file that does not currently exist. The pathname
4374   // will be directory/base_name.extension or
4375   // directory/base_name_<number>.extension if directory/base_name.extension
4376   // already exists. The number will be incremented until a pathname is found
4377   // that does not already exist.
4378   // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
4379   // There could be a race condition if two or more processes are calling this
4380   // function at the same time -- they could both pick the same filename.
4381   static FilePath GenerateUniqueFileName(const FilePath& directory,
4382                                          const FilePath& base_name,
4383                                          const char* extension);
4384
4385   // Returns true iff the path is "".
4386   bool IsEmpty() const { return pathname_.empty(); }
4387
4388   // If input name has a trailing separator character, removes it and returns
4389   // the name, otherwise return the name string unmodified.
4390   // On Windows platform, uses \ as the separator, other platforms use /.
4391   FilePath RemoveTrailingPathSeparator() const;
4392
4393   // Returns a copy of the FilePath with the directory part removed.
4394   // Example: FilePath("path/to/file").RemoveDirectoryName() returns
4395   // FilePath("file"). If there is no directory part ("just_a_file"), it returns
4396   // the FilePath unmodified. If there is no file part ("just_a_dir/") it
4397   // returns an empty FilePath ("").
4398   // On Windows platform, '\' is the path separator, otherwise it is '/'.
4399   FilePath RemoveDirectoryName() const;
4400
4401   // RemoveFileName returns the directory path with the filename removed.
4402   // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
4403   // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
4404   // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
4405   // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
4406   // On Windows platform, '\' is the path separator, otherwise it is '/'.
4407   FilePath RemoveFileName() const;
4408
4409   // Returns a copy of the FilePath with the case-insensitive extension removed.
4410   // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
4411   // FilePath("dir/file"). If a case-insensitive extension is not
4412   // found, returns a copy of the original FilePath.
4413   FilePath RemoveExtension(const char* extension) const;
4414
4415   // Creates directories so that path exists. Returns true if successful or if
4416   // the directories already exist; returns false if unable to create
4417   // directories for any reason. Will also return false if the FilePath does
4418   // not represent a directory (that is, it doesn't end with a path separator).
4419   bool CreateDirectoriesRecursively() const;
4420
4421   // Create the directory so that path exists. Returns true if successful or
4422   // if the directory already exists; returns false if unable to create the
4423   // directory for any reason, including if the parent directory does not
4424   // exist. Not named "CreateDirectory" because that's a macro on Windows.
4425   bool CreateFolder() const;
4426
4427   // Returns true if FilePath describes something in the file-system,
4428   // either a file, directory, or whatever, and that something exists.
4429   bool FileOrDirectoryExists() const;
4430
4431   // Returns true if pathname describes a directory in the file-system
4432   // that exists.
4433   bool DirectoryExists() const;
4434
4435   // Returns true if FilePath ends with a path separator, which indicates that
4436   // it is intended to represent a directory. Returns false otherwise.
4437   // This does NOT check that a directory (or file) actually exists.
4438   bool IsDirectory() const;
4439
4440   // Returns true if pathname describes a root directory. (Windows has one
4441   // root directory per disk drive.)
4442   bool IsRootDirectory() const;
4443
4444   // Returns true if pathname describes an absolute path.
4445   bool IsAbsolutePath() const;
4446
4447  private:
4448   // Replaces multiple consecutive separators with a single separator.
4449   // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
4450   // redundancies that might be in a pathname involving "." or "..".
4451   //
4452   // A pathname with multiple consecutive separators may occur either through
4453   // user error or as a result of some scripts or APIs that generate a pathname
4454   // with a trailing separator. On other platforms the same API or script
4455   // may NOT generate a pathname with a trailing "/". Then elsewhere that
4456   // pathname may have another "/" and pathname components added to it,
4457   // without checking for the separator already being there.
4458   // The script language and operating system may allow paths like "foo//bar"
4459   // but some of the functions in FilePath will not handle that correctly. In
4460   // particular, RemoveTrailingPathSeparator() only removes one separator, and
4461   // it is called in CreateDirectoriesRecursively() assuming that it will change
4462   // a pathname from directory syntax (trailing separator) to filename syntax.
4463   //
4464   // On Windows this method also replaces the alternate path separator '/' with
4465   // the primary path separator '\\', so that for example "bar\\/\\foo" becomes
4466   // "bar\\foo".
4467
4468   void Normalize();
4469
4470   // Returns a pointer to the last occurence of a valid path separator in
4471   // the FilePath. On Windows, for example, both '/' and '\' are valid path
4472   // separators. Returns NULL if no path separator was found.
4473   const char* FindLastPathSeparator() const;
4474
4475   std::string pathname_;
4476 };  // class FilePath
4477
4478 }  // namespace internal
4479 }  // namespace testing
4480
4481 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
4482 // This file was GENERATED by command:
4483 //     pump.py gtest-type-util.h.pump
4484 // DO NOT EDIT BY HAND!!!
4485
4486 // Copyright 2008 Google Inc.
4487 // All Rights Reserved.
4488 //
4489 // Redistribution and use in source and binary forms, with or without
4490 // modification, are permitted provided that the following conditions are
4491 // met:
4492 //
4493 //     * Redistributions of source code must retain the above copyright
4494 // notice, this list of conditions and the following disclaimer.
4495 //     * Redistributions in binary form must reproduce the above
4496 // copyright notice, this list of conditions and the following disclaimer
4497 // in the documentation and/or other materials provided with the
4498 // distribution.
4499 //     * Neither the name of Google Inc. nor the names of its
4500 // contributors may be used to endorse or promote products derived from
4501 // this software without specific prior written permission.
4502 //
4503 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4504 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4505 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4506 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4507 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4508 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4509 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4510 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4511 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4512 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4513 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4514 //
4515 // Author: wan@google.com (Zhanyong Wan)
4516
4517 // Type utilities needed for implementing typed and type-parameterized
4518 // tests.  This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
4519 //
4520 // Currently we support at most 50 types in a list, and at most 50
4521 // type-parameterized tests in one type-parameterized test case.
4522 // Please contact googletestframework@googlegroups.com if you need
4523 // more.
4524
4525 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
4526 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
4527
4528
4529 // #ifdef __GNUC__ is too general here.  It is possible to use gcc without using
4530 // libstdc++ (which is where cxxabi.h comes from).
4531 # if GTEST_HAS_CXXABI_H_
4532 #  include <cxxabi.h>
4533 # elif defined(__HP_aCC)
4534 #  include <acxx_demangle.h>
4535 # endif  // GTEST_HASH_CXXABI_H_
4536
4537 namespace testing {
4538 namespace internal {
4539
4540 // GetTypeName<T>() returns a human-readable name of type T.
4541 // NB: This function is also used in Google Mock, so don't move it inside of
4542 // the typed-test-only section below.
4543 template <typename T>
4544 std::string GetTypeName() {
4545 # if GTEST_HAS_RTTI
4546
4547   const char* const name = typeid(T).name();
4548 #  if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
4549   int status = 0;
4550   // gcc's implementation of typeid(T).name() mangles the type name,
4551   // so we have to demangle it.
4552 #   if GTEST_HAS_CXXABI_H_
4553   using abi::__cxa_demangle;
4554 #   endif  // GTEST_HAS_CXXABI_H_
4555   char* const readable_name = __cxa_demangle(name, 0, 0, &status);
4556   const std::string name_str(status == 0 ? readable_name : name);
4557   free(readable_name);
4558   return name_str;
4559 #  else
4560   return name;
4561 #  endif  // GTEST_HAS_CXXABI_H_ || __HP_aCC
4562
4563 # else
4564
4565   return "<type>";
4566
4567 # endif  // GTEST_HAS_RTTI
4568 }
4569
4570 #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
4571
4572 // AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
4573 // type.  This can be used as a compile-time assertion to ensure that
4574 // two types are equal.
4575
4576 template <typename T1, typename T2>
4577 struct AssertTypeEq;
4578
4579 template <typename T>
4580 struct AssertTypeEq<T, T> {
4581   typedef bool type;
4582 };
4583
4584 // A unique type used as the default value for the arguments of class
4585 // template Types.  This allows us to simulate variadic templates
4586 // (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
4587 // support directly.
4588 struct None {};
4589
4590 // The following family of struct and struct templates are used to
4591 // represent type lists.  In particular, TypesN<T1, T2, ..., TN>
4592 // represents a type list with N types (T1, T2, ..., and TN) in it.
4593 // Except for Types0, every struct in the family has two member types:
4594 // Head for the first type in the list, and Tail for the rest of the
4595 // list.
4596
4597 // The empty type list.
4598 struct Types0 {};
4599
4600 // Type lists of length 1, 2, 3, and so on.
4601
4602 template <typename T1>
4603 struct Types1 {
4604   typedef T1 Head;
4605   typedef Types0 Tail;
4606 };
4607 template <typename T1, typename T2>
4608 struct Types2 {
4609   typedef T1 Head;
4610   typedef Types1<T2> Tail;
4611 };
4612
4613 template <typename T1, typename T2, typename T3>
4614 struct Types3 {
4615   typedef T1 Head;
4616   typedef Types2<T2, T3> Tail;
4617 };
4618
4619 template <typename T1, typename T2, typename T3, typename T4>
4620 struct Types4 {
4621   typedef T1 Head;
4622   typedef Types3<T2, T3, T4> Tail;
4623 };
4624
4625 template <typename T1, typename T2, typename T3, typename T4, typename T5>
4626 struct Types5 {
4627   typedef T1 Head;
4628   typedef Types4<T2, T3, T4, T5> Tail;
4629 };
4630
4631 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4632     typename T6>
4633 struct Types6 {
4634   typedef T1 Head;
4635   typedef Types5<T2, T3, T4, T5, T6> Tail;
4636 };
4637
4638 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4639     typename T6, typename T7>
4640 struct Types7 {
4641   typedef T1 Head;
4642   typedef Types6<T2, T3, T4, T5, T6, T7> Tail;
4643 };
4644
4645 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4646     typename T6, typename T7, typename T8>
4647 struct Types8 {
4648   typedef T1 Head;
4649   typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;
4650 };
4651
4652 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4653     typename T6, typename T7, typename T8, typename T9>
4654 struct Types9 {
4655   typedef T1 Head;
4656   typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
4657 };
4658
4659 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4660     typename T6, typename T7, typename T8, typename T9, typename T10>
4661 struct Types10 {
4662   typedef T1 Head;
4663   typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
4664 };
4665
4666 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4667     typename T6, typename T7, typename T8, typename T9, typename T10,
4668     typename T11>
4669 struct Types11 {
4670   typedef T1 Head;
4671   typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
4672 };
4673
4674 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4675     typename T6, typename T7, typename T8, typename T9, typename T10,
4676     typename T11, typename T12>
4677 struct Types12 {
4678   typedef T1 Head;
4679   typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
4680 };
4681
4682 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4683     typename T6, typename T7, typename T8, typename T9, typename T10,
4684     typename T11, typename T12, typename T13>
4685 struct Types13 {
4686   typedef T1 Head;
4687   typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
4688 };
4689
4690 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4691     typename T6, typename T7, typename T8, typename T9, typename T10,
4692     typename T11, typename T12, typename T13, typename T14>
4693 struct Types14 {
4694   typedef T1 Head;
4695   typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;
4696 };
4697
4698 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4699     typename T6, typename T7, typename T8, typename T9, typename T10,
4700     typename T11, typename T12, typename T13, typename T14, typename T15>
4701 struct Types15 {
4702   typedef T1 Head;
4703   typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
4704       T15> Tail;
4705 };
4706
4707 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4708     typename T6, typename T7, typename T8, typename T9, typename T10,
4709     typename T11, typename T12, typename T13, typename T14, typename T15,
4710     typename T16>
4711 struct Types16 {
4712   typedef T1 Head;
4713   typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4714       T16> Tail;
4715 };
4716
4717 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4718     typename T6, typename T7, typename T8, typename T9, typename T10,
4719     typename T11, typename T12, typename T13, typename T14, typename T15,
4720     typename T16, typename T17>
4721 struct Types17 {
4722   typedef T1 Head;
4723   typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4724       T16, T17> Tail;
4725 };
4726
4727 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4728     typename T6, typename T7, typename T8, typename T9, typename T10,
4729     typename T11, typename T12, typename T13, typename T14, typename T15,
4730     typename T16, typename T17, typename T18>
4731 struct Types18 {
4732   typedef T1 Head;
4733   typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4734       T16, T17, T18> Tail;
4735 };
4736
4737 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4738     typename T6, typename T7, typename T8, typename T9, typename T10,
4739     typename T11, typename T12, typename T13, typename T14, typename T15,
4740     typename T16, typename T17, typename T18, typename T19>
4741 struct Types19 {
4742   typedef T1 Head;
4743   typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4744       T16, T17, T18, T19> Tail;
4745 };
4746
4747 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4748     typename T6, typename T7, typename T8, typename T9, typename T10,
4749     typename T11, typename T12, typename T13, typename T14, typename T15,
4750     typename T16, typename T17, typename T18, typename T19, typename T20>
4751 struct Types20 {
4752   typedef T1 Head;
4753   typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4754       T16, T17, T18, T19, T20> Tail;
4755 };
4756
4757 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4758     typename T6, typename T7, typename T8, typename T9, typename T10,
4759     typename T11, typename T12, typename T13, typename T14, typename T15,
4760     typename T16, typename T17, typename T18, typename T19, typename T20,
4761     typename T21>
4762 struct Types21 {
4763   typedef T1 Head;
4764   typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4765       T16, T17, T18, T19, T20, T21> Tail;
4766 };
4767
4768 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4769     typename T6, typename T7, typename T8, typename T9, typename T10,
4770     typename T11, typename T12, typename T13, typename T14, typename T15,
4771     typename T16, typename T17, typename T18, typename T19, typename T20,
4772     typename T21, typename T22>
4773 struct Types22 {
4774   typedef T1 Head;
4775   typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4776       T16, T17, T18, T19, T20, T21, T22> Tail;
4777 };
4778
4779 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4780     typename T6, typename T7, typename T8, typename T9, typename T10,
4781     typename T11, typename T12, typename T13, typename T14, typename T15,
4782     typename T16, typename T17, typename T18, typename T19, typename T20,
4783     typename T21, typename T22, typename T23>
4784 struct Types23 {
4785   typedef T1 Head;
4786   typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4787       T16, T17, T18, T19, T20, T21, T22, T23> Tail;
4788 };
4789
4790 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4791     typename T6, typename T7, typename T8, typename T9, typename T10,
4792     typename T11, typename T12, typename T13, typename T14, typename T15,
4793     typename T16, typename T17, typename T18, typename T19, typename T20,
4794     typename T21, typename T22, typename T23, typename T24>
4795 struct Types24 {
4796   typedef T1 Head;
4797   typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4798       T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
4799 };
4800
4801 template <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 struct Types25 {
4807   typedef T1 Head;
4808   typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4809       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
4810 };
4811
4812 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4813     typename T6, typename T7, typename T8, typename T9, typename T10,
4814     typename T11, typename T12, typename T13, typename T14, typename T15,
4815     typename T16, typename T17, typename T18, typename T19, typename T20,
4816     typename T21, typename T22, typename T23, typename T24, typename T25,
4817     typename T26>
4818 struct Types26 {
4819   typedef T1 Head;
4820   typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4821       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
4822 };
4823
4824 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4825     typename T6, typename T7, typename T8, typename T9, typename T10,
4826     typename T11, typename T12, typename T13, typename T14, typename T15,
4827     typename T16, typename T17, typename T18, typename T19, typename T20,
4828     typename T21, typename T22, typename T23, typename T24, typename T25,
4829     typename T26, typename T27>
4830 struct Types27 {
4831   typedef T1 Head;
4832   typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4833       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
4834 };
4835
4836 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4837     typename T6, typename T7, typename T8, typename T9, typename T10,
4838     typename T11, typename T12, typename T13, typename T14, typename T15,
4839     typename T16, typename T17, typename T18, typename T19, typename T20,
4840     typename T21, typename T22, typename T23, typename T24, typename T25,
4841     typename T26, typename T27, typename T28>
4842 struct Types28 {
4843   typedef T1 Head;
4844   typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4845       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;
4846 };
4847
4848 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4849     typename T6, typename T7, typename T8, typename T9, typename T10,
4850     typename T11, typename T12, typename T13, typename T14, typename T15,
4851     typename T16, typename T17, typename T18, typename T19, typename T20,
4852     typename T21, typename T22, typename T23, typename T24, typename T25,
4853     typename T26, typename T27, typename T28, typename T29>
4854 struct Types29 {
4855   typedef T1 Head;
4856   typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4857       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
4858       T29> Tail;
4859 };
4860
4861 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4862     typename T6, typename T7, typename T8, typename T9, typename T10,
4863     typename T11, typename T12, typename T13, typename T14, typename T15,
4864     typename T16, typename T17, typename T18, typename T19, typename T20,
4865     typename T21, typename T22, typename T23, typename T24, typename T25,
4866     typename T26, typename T27, typename T28, typename T29, typename T30>
4867 struct Types30 {
4868   typedef T1 Head;
4869   typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4870       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4871       T30> Tail;
4872 };
4873
4874 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4875     typename T6, typename T7, typename T8, typename T9, typename T10,
4876     typename T11, typename T12, typename T13, typename T14, typename T15,
4877     typename T16, typename T17, typename T18, typename T19, typename T20,
4878     typename T21, typename T22, typename T23, typename T24, typename T25,
4879     typename T26, typename T27, typename T28, typename T29, typename T30,
4880     typename T31>
4881 struct Types31 {
4882   typedef T1 Head;
4883   typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4884       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4885       T30, T31> Tail;
4886 };
4887
4888 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4889     typename T6, typename T7, typename T8, typename T9, typename T10,
4890     typename T11, typename T12, typename T13, typename T14, typename T15,
4891     typename T16, typename T17, typename T18, typename T19, typename T20,
4892     typename T21, typename T22, typename T23, typename T24, typename T25,
4893     typename T26, typename T27, typename T28, typename T29, typename T30,
4894     typename T31, typename T32>
4895 struct Types32 {
4896   typedef T1 Head;
4897   typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4898       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4899       T30, T31, T32> Tail;
4900 };
4901
4902 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4903     typename T6, typename T7, typename T8, typename T9, typename T10,
4904     typename T11, typename T12, typename T13, typename T14, typename T15,
4905     typename T16, typename T17, typename T18, typename T19, typename T20,
4906     typename T21, typename T22, typename T23, typename T24, typename T25,
4907     typename T26, typename T27, typename T28, typename T29, typename T30,
4908     typename T31, typename T32, typename T33>
4909 struct Types33 {
4910   typedef T1 Head;
4911   typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4912       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4913       T30, T31, T32, T33> Tail;
4914 };
4915
4916 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4917     typename T6, typename T7, typename T8, typename T9, typename T10,
4918     typename T11, typename T12, typename T13, typename T14, typename T15,
4919     typename T16, typename T17, typename T18, typename T19, typename T20,
4920     typename T21, typename T22, typename T23, typename T24, typename T25,
4921     typename T26, typename T27, typename T28, typename T29, typename T30,
4922     typename T31, typename T32, typename T33, typename T34>
4923 struct Types34 {
4924   typedef T1 Head;
4925   typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4926       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4927       T30, T31, T32, T33, T34> Tail;
4928 };
4929
4930 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4931     typename T6, typename T7, typename T8, typename T9, typename T10,
4932     typename T11, typename T12, typename T13, typename T14, typename T15,
4933     typename T16, typename T17, typename T18, typename T19, typename T20,
4934     typename T21, typename T22, typename T23, typename T24, typename T25,
4935     typename T26, typename T27, typename T28, typename T29, typename T30,
4936     typename T31, typename T32, typename T33, typename T34, typename T35>
4937 struct Types35 {
4938   typedef T1 Head;
4939   typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4940       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4941       T30, T31, T32, T33, T34, T35> Tail;
4942 };
4943
4944 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4945     typename T6, typename T7, typename T8, typename T9, typename T10,
4946     typename T11, typename T12, typename T13, typename T14, typename T15,
4947     typename T16, typename T17, typename T18, typename T19, typename T20,
4948     typename T21, typename T22, typename T23, typename T24, typename T25,
4949     typename T26, typename T27, typename T28, typename T29, typename T30,
4950     typename T31, typename T32, typename T33, typename T34, typename T35,
4951     typename T36>
4952 struct Types36 {
4953   typedef T1 Head;
4954   typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4955       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4956       T30, T31, T32, T33, T34, T35, T36> Tail;
4957 };
4958
4959 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4960     typename T6, typename T7, typename T8, typename T9, typename T10,
4961     typename T11, typename T12, typename T13, typename T14, typename T15,
4962     typename T16, typename T17, typename T18, typename T19, typename T20,
4963     typename T21, typename T22, typename T23, typename T24, typename T25,
4964     typename T26, typename T27, typename T28, typename T29, typename T30,
4965     typename T31, typename T32, typename T33, typename T34, typename T35,
4966     typename T36, typename T37>
4967 struct Types37 {
4968   typedef T1 Head;
4969   typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4970       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4971       T30, T31, T32, T33, T34, T35, T36, T37> Tail;
4972 };
4973
4974 template <typename T1, typename T2, typename T3, typename T4, typename T5,
4975     typename T6, typename T7, typename T8, typename T9, typename T10,
4976     typename T11, typename T12, typename T13, typename T14, typename T15,
4977     typename T16, typename T17, typename T18, typename T19, typename T20,
4978     typename T21, typename T22, typename T23, typename T24, typename T25,
4979     typename T26, typename T27, typename T28, typename T29, typename T30,
4980     typename T31, typename T32, typename T33, typename T34, typename T35,
4981     typename T36, typename T37, typename T38>
4982 struct Types38 {
4983   typedef T1 Head;
4984   typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
4985       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
4986       T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
4987 };
4988
4989 template <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>
4997 struct Types39 {
4998   typedef T1 Head;
4999   typedef Types38<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,
5001       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
5002 };
5003
5004 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5005     typename T6, typename T7, typename T8, typename T9, typename T10,
5006     typename T11, typename T12, typename T13, typename T14, typename T15,
5007     typename T16, typename T17, typename T18, typename T19, typename T20,
5008     typename T21, typename T22, typename T23, typename T24, typename T25,
5009     typename T26, typename T27, typename T28, typename T29, typename T30,
5010     typename T31, typename T32, typename T33, typename T34, typename T35,
5011     typename T36, typename T37, typename T38, typename T39, typename T40>
5012 struct Types40 {
5013   typedef T1 Head;
5014   typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5015       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5016       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
5017 };
5018
5019 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5020     typename T6, typename T7, typename T8, typename T9, typename T10,
5021     typename T11, typename T12, typename T13, typename T14, typename T15,
5022     typename T16, typename T17, typename T18, typename T19, typename T20,
5023     typename T21, typename T22, typename T23, typename T24, typename T25,
5024     typename T26, typename T27, typename T28, typename T29, typename T30,
5025     typename T31, typename T32, typename T33, typename T34, typename T35,
5026     typename T36, typename T37, typename T38, typename T39, typename T40,
5027     typename T41>
5028 struct Types41 {
5029   typedef T1 Head;
5030   typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5031       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5032       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
5033 };
5034
5035 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5036     typename T6, typename T7, typename T8, typename T9, typename T10,
5037     typename T11, typename T12, typename T13, typename T14, typename T15,
5038     typename T16, typename T17, typename T18, typename T19, typename T20,
5039     typename T21, typename T22, typename T23, typename T24, typename T25,
5040     typename T26, typename T27, typename T28, typename T29, typename T30,
5041     typename T31, typename T32, typename T33, typename T34, typename T35,
5042     typename T36, typename T37, typename T38, typename T39, typename T40,
5043     typename T41, typename T42>
5044 struct Types42 {
5045   typedef T1 Head;
5046   typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5047       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5048       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;
5049 };
5050
5051 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5052     typename T6, typename T7, typename T8, typename T9, typename T10,
5053     typename T11, typename T12, typename T13, typename T14, typename T15,
5054     typename T16, typename T17, typename T18, typename T19, typename T20,
5055     typename T21, typename T22, typename T23, typename T24, typename T25,
5056     typename T26, typename T27, typename T28, typename T29, typename T30,
5057     typename T31, typename T32, typename T33, typename T34, typename T35,
5058     typename T36, typename T37, typename T38, typename T39, typename T40,
5059     typename T41, typename T42, typename T43>
5060 struct Types43 {
5061   typedef T1 Head;
5062   typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5063       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5064       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
5065       T43> Tail;
5066 };
5067
5068 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5069     typename T6, typename T7, typename T8, typename T9, typename T10,
5070     typename T11, typename T12, typename T13, typename T14, typename T15,
5071     typename T16, typename T17, typename T18, typename T19, typename T20,
5072     typename T21, typename T22, typename T23, typename T24, typename T25,
5073     typename T26, typename T27, typename T28, typename T29, typename T30,
5074     typename T31, typename T32, typename T33, typename T34, typename T35,
5075     typename T36, typename T37, typename T38, typename T39, typename T40,
5076     typename T41, typename T42, typename T43, typename T44>
5077 struct Types44 {
5078   typedef T1 Head;
5079   typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5080       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5081       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5082       T44> Tail;
5083 };
5084
5085 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5086     typename T6, typename T7, typename T8, typename T9, typename T10,
5087     typename T11, typename T12, typename T13, typename T14, typename T15,
5088     typename T16, typename T17, typename T18, typename T19, typename T20,
5089     typename T21, typename T22, typename T23, typename T24, typename T25,
5090     typename T26, typename T27, typename T28, typename T29, typename T30,
5091     typename T31, typename T32, typename T33, typename T34, typename T35,
5092     typename T36, typename T37, typename T38, typename T39, typename T40,
5093     typename T41, typename T42, typename T43, typename T44, typename T45>
5094 struct Types45 {
5095   typedef T1 Head;
5096   typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5097       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5098       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5099       T44, T45> Tail;
5100 };
5101
5102 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5103     typename T6, typename T7, typename T8, typename T9, typename T10,
5104     typename T11, typename T12, typename T13, typename T14, typename T15,
5105     typename T16, typename T17, typename T18, typename T19, typename T20,
5106     typename T21, typename T22, typename T23, typename T24, typename T25,
5107     typename T26, typename T27, typename T28, typename T29, typename T30,
5108     typename T31, typename T32, typename T33, typename T34, typename T35,
5109     typename T36, typename T37, typename T38, typename T39, typename T40,
5110     typename T41, typename T42, typename T43, typename T44, typename T45,
5111     typename T46>
5112 struct Types46 {
5113   typedef T1 Head;
5114   typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5115       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5116       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5117       T44, T45, T46> Tail;
5118 };
5119
5120 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5121     typename T6, typename T7, typename T8, typename T9, typename T10,
5122     typename T11, typename T12, typename T13, typename T14, typename T15,
5123     typename T16, typename T17, typename T18, typename T19, typename T20,
5124     typename T21, typename T22, typename T23, typename T24, typename T25,
5125     typename T26, typename T27, typename T28, typename T29, typename T30,
5126     typename T31, typename T32, typename T33, typename T34, typename T35,
5127     typename T36, typename T37, typename T38, typename T39, typename T40,
5128     typename T41, typename T42, typename T43, typename T44, typename T45,
5129     typename T46, typename T47>
5130 struct Types47 {
5131   typedef T1 Head;
5132   typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5133       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5134       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5135       T44, T45, T46, T47> Tail;
5136 };
5137
5138 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5139     typename T6, typename T7, typename T8, typename T9, typename T10,
5140     typename T11, typename T12, typename T13, typename T14, typename T15,
5141     typename T16, typename T17, typename T18, typename T19, typename T20,
5142     typename T21, typename T22, typename T23, typename T24, typename T25,
5143     typename T26, typename T27, typename T28, typename T29, typename T30,
5144     typename T31, typename T32, typename T33, typename T34, typename T35,
5145     typename T36, typename T37, typename T38, typename T39, typename T40,
5146     typename T41, typename T42, typename T43, typename T44, typename T45,
5147     typename T46, typename T47, typename T48>
5148 struct Types48 {
5149   typedef T1 Head;
5150   typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5151       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5152       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5153       T44, T45, T46, T47, T48> Tail;
5154 };
5155
5156 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5157     typename T6, typename T7, typename T8, typename T9, typename T10,
5158     typename T11, typename T12, typename T13, typename T14, typename T15,
5159     typename T16, typename T17, typename T18, typename T19, typename T20,
5160     typename T21, typename T22, typename T23, typename T24, typename T25,
5161     typename T26, typename T27, typename T28, typename T29, typename T30,
5162     typename T31, typename T32, typename T33, typename T34, typename T35,
5163     typename T36, typename T37, typename T38, typename T39, typename T40,
5164     typename T41, typename T42, typename T43, typename T44, typename T45,
5165     typename T46, typename T47, typename T48, typename T49>
5166 struct Types49 {
5167   typedef T1 Head;
5168   typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5169       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5170       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5171       T44, T45, T46, T47, T48, T49> Tail;
5172 };
5173
5174 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5175     typename T6, typename T7, typename T8, typename T9, typename T10,
5176     typename T11, typename T12, typename T13, typename T14, typename T15,
5177     typename T16, typename T17, typename T18, typename T19, typename T20,
5178     typename T21, typename T22, typename T23, typename T24, typename T25,
5179     typename T26, typename T27, typename T28, typename T29, typename T30,
5180     typename T31, typename T32, typename T33, typename T34, typename T35,
5181     typename T36, typename T37, typename T38, typename T39, typename T40,
5182     typename T41, typename T42, typename T43, typename T44, typename T45,
5183     typename T46, typename T47, typename T48, typename T49, typename T50>
5184 struct Types50 {
5185   typedef T1 Head;
5186   typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5187       T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5188       T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5189       T44, T45, T46, T47, T48, T49, T50> Tail;
5190 };
5191
5192
5193 }  // namespace internal
5194
5195 // We don't want to require the users to write TypesN<...> directly,
5196 // as that would require them to count the length.  Types<...> is much
5197 // easier to write, but generates horrible messages when there is a
5198 // compiler error, as gcc insists on printing out each template
5199 // argument, even if it has the default value (this means Types<int>
5200 // will appear as Types<int, None, None, ..., None> in the compiler
5201 // errors).
5202 //
5203 // Our solution is to combine the best part of the two approaches: a
5204 // user would write Types<T1, ..., TN>, and Google Test will translate
5205 // that to TypesN<T1, ..., TN> internally to make error messages
5206 // readable.  The translation is done by the 'type' member of the
5207 // Types template.
5208 template <typename T1 = internal::None, typename T2 = internal::None,
5209     typename T3 = internal::None, typename T4 = internal::None,
5210     typename T5 = internal::None, typename T6 = internal::None,
5211     typename T7 = internal::None, typename T8 = internal::None,
5212     typename T9 = internal::None, typename T10 = internal::None,
5213     typename T11 = internal::None, typename T12 = internal::None,
5214     typename T13 = internal::None, typename T14 = internal::None,
5215     typename T15 = internal::None, typename T16 = internal::None,
5216     typename T17 = internal::None, typename T18 = internal::None,
5217     typename T19 = internal::None, typename T20 = internal::None,
5218     typename T21 = internal::None, typename T22 = internal::None,
5219     typename T23 = internal::None, typename T24 = internal::None,
5220     typename T25 = internal::None, typename T26 = internal::None,
5221     typename T27 = internal::None, typename T28 = internal::None,
5222     typename T29 = internal::None, typename T30 = internal::None,
5223     typename T31 = internal::None, typename T32 = internal::None,
5224     typename T33 = internal::None, typename T34 = internal::None,
5225     typename T35 = internal::None, typename T36 = internal::None,
5226     typename T37 = internal::None, typename T38 = internal::None,
5227     typename T39 = internal::None, typename T40 = internal::None,
5228     typename T41 = internal::None, typename T42 = internal::None,
5229     typename T43 = internal::None, typename T44 = internal::None,
5230     typename T45 = internal::None, typename T46 = internal::None,
5231     typename T47 = internal::None, typename T48 = internal::None,
5232     typename T49 = internal::None, typename T50 = internal::None>
5233 struct Types {
5234   typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5235       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5236       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5237       T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
5238 };
5239
5240 template <>
5241 struct Types<internal::None, internal::None, internal::None, internal::None,
5242     internal::None, internal::None, internal::None, internal::None,
5243     internal::None, internal::None, internal::None, internal::None,
5244     internal::None, internal::None, internal::None, internal::None,
5245     internal::None, internal::None, internal::None, internal::None,
5246     internal::None, internal::None, internal::None, internal::None,
5247     internal::None, internal::None, internal::None, internal::None,
5248     internal::None, internal::None, internal::None, internal::None,
5249     internal::None, internal::None, internal::None, internal::None,
5250     internal::None, internal::None, internal::None, internal::None,
5251     internal::None, internal::None, internal::None, internal::None,
5252     internal::None, internal::None, internal::None, internal::None,
5253     internal::None, internal::None> {
5254   typedef internal::Types0 type;
5255 };
5256 template <typename T1>
5257 struct Types<T1, internal::None, internal::None, internal::None,
5258     internal::None, internal::None, internal::None, internal::None,
5259     internal::None, internal::None, internal::None, internal::None,
5260     internal::None, internal::None, internal::None, internal::None,
5261     internal::None, internal::None, internal::None, internal::None,
5262     internal::None, internal::None, internal::None, internal::None,
5263     internal::None, internal::None, internal::None, internal::None,
5264     internal::None, internal::None, internal::None, internal::None,
5265     internal::None, internal::None, internal::None, internal::None,
5266     internal::None, internal::None, internal::None, internal::None,
5267     internal::None, internal::None, internal::None, internal::None,
5268     internal::None, internal::None, internal::None, internal::None,
5269     internal::None, internal::None> {
5270   typedef internal::Types1<T1> type;
5271 };
5272 template <typename T1, typename T2>
5273 struct Types<T1, T2, internal::None, internal::None, internal::None,
5274     internal::None, internal::None, internal::None, internal::None,
5275     internal::None, internal::None, internal::None, internal::None,
5276     internal::None, internal::None, internal::None, internal::None,
5277     internal::None, internal::None, internal::None, internal::None,
5278     internal::None, internal::None, internal::None, internal::None,
5279     internal::None, internal::None, internal::None, internal::None,
5280     internal::None, internal::None, internal::None, internal::None,
5281     internal::None, internal::None, internal::None, internal::None,
5282     internal::None, internal::None, internal::None, internal::None,
5283     internal::None, internal::None, internal::None, internal::None,
5284     internal::None, internal::None, internal::None, internal::None,
5285     internal::None> {
5286   typedef internal::Types2<T1, T2> type;
5287 };
5288 template <typename T1, typename T2, typename T3>
5289 struct Types<T1, T2, T3, internal::None, internal::None, internal::None,
5290     internal::None, internal::None, internal::None, internal::None,
5291     internal::None, internal::None, internal::None, internal::None,
5292     internal::None, internal::None, internal::None, internal::None,
5293     internal::None, internal::None, internal::None, internal::None,
5294     internal::None, internal::None, internal::None, internal::None,
5295     internal::None, internal::None, internal::None, internal::None,
5296     internal::None, internal::None, internal::None, internal::None,
5297     internal::None, internal::None, internal::None, internal::None,
5298     internal::None, internal::None, internal::None, internal::None,
5299     internal::None, internal::None, internal::None, internal::None,
5300     internal::None, internal::None, internal::None, internal::None> {
5301   typedef internal::Types3<T1, T2, T3> type;
5302 };
5303 template <typename T1, typename T2, typename T3, typename T4>
5304 struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None,
5305     internal::None, internal::None, internal::None, internal::None,
5306     internal::None, internal::None, internal::None, internal::None,
5307     internal::None, internal::None, internal::None, internal::None,
5308     internal::None, internal::None, internal::None, internal::None,
5309     internal::None, internal::None, internal::None, internal::None,
5310     internal::None, internal::None, internal::None, internal::None,
5311     internal::None, internal::None, internal::None, internal::None,
5312     internal::None, internal::None, internal::None, internal::None,
5313     internal::None, internal::None, internal::None, internal::None,
5314     internal::None, internal::None, internal::None, internal::None,
5315     internal::None, internal::None, internal::None> {
5316   typedef internal::Types4<T1, T2, T3, T4> type;
5317 };
5318 template <typename T1, typename T2, typename T3, typename T4, typename T5>
5319 struct Types<T1, T2, T3, T4, T5, internal::None, internal::None,
5320     internal::None, internal::None, internal::None, internal::None,
5321     internal::None, internal::None, internal::None, internal::None,
5322     internal::None, internal::None, internal::None, internal::None,
5323     internal::None, internal::None, internal::None, internal::None,
5324     internal::None, internal::None, internal::None, internal::None,
5325     internal::None, internal::None, internal::None, internal::None,
5326     internal::None, internal::None, internal::None, internal::None,
5327     internal::None, internal::None, internal::None, internal::None,
5328     internal::None, internal::None, internal::None, internal::None,
5329     internal::None, internal::None, internal::None, internal::None,
5330     internal::None, internal::None, internal::None> {
5331   typedef internal::Types5<T1, T2, T3, T4, T5> type;
5332 };
5333 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5334     typename T6>
5335 struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None,
5336     internal::None, internal::None, internal::None, internal::None,
5337     internal::None, internal::None, internal::None, internal::None,
5338     internal::None, internal::None, internal::None, internal::None,
5339     internal::None, internal::None, internal::None, internal::None,
5340     internal::None, internal::None, internal::None, internal::None,
5341     internal::None, internal::None, internal::None, internal::None,
5342     internal::None, internal::None, internal::None, internal::None,
5343     internal::None, internal::None, internal::None, internal::None,
5344     internal::None, internal::None, internal::None, internal::None,
5345     internal::None, internal::None, internal::None, internal::None,
5346     internal::None, internal::None> {
5347   typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;
5348 };
5349 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5350     typename T6, typename T7>
5351 struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None,
5352     internal::None, internal::None, internal::None, internal::None,
5353     internal::None, internal::None, internal::None, internal::None,
5354     internal::None, internal::None, internal::None, internal::None,
5355     internal::None, internal::None, internal::None, internal::None,
5356     internal::None, internal::None, internal::None, internal::None,
5357     internal::None, internal::None, internal::None, internal::None,
5358     internal::None, internal::None, internal::None, internal::None,
5359     internal::None, internal::None, internal::None, internal::None,
5360     internal::None, internal::None, internal::None, internal::None,
5361     internal::None, internal::None, internal::None, internal::None,
5362     internal::None> {
5363   typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;
5364 };
5365 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5366     typename T6, typename T7, typename T8>
5367 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None,
5368     internal::None, internal::None, internal::None, internal::None,
5369     internal::None, internal::None, internal::None, internal::None,
5370     internal::None, internal::None, internal::None, internal::None,
5371     internal::None, internal::None, internal::None, internal::None,
5372     internal::None, internal::None, internal::None, internal::None,
5373     internal::None, internal::None, internal::None, internal::None,
5374     internal::None, internal::None, internal::None, internal::None,
5375     internal::None, internal::None, internal::None, internal::None,
5376     internal::None, internal::None, internal::None, internal::None,
5377     internal::None, internal::None, internal::None, internal::None> {
5378   typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;
5379 };
5380 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5381     typename T6, typename T7, typename T8, typename T9>
5382 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None,
5383     internal::None, internal::None, internal::None, internal::None,
5384     internal::None, internal::None, internal::None, internal::None,
5385     internal::None, internal::None, internal::None, internal::None,
5386     internal::None, internal::None, internal::None, internal::None,
5387     internal::None, internal::None, internal::None, internal::None,
5388     internal::None, internal::None, internal::None, internal::None,
5389     internal::None, internal::None, internal::None, internal::None,
5390     internal::None, internal::None, internal::None, internal::None,
5391     internal::None, internal::None, internal::None, internal::None,
5392     internal::None, internal::None, internal::None, internal::None> {
5393   typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
5394 };
5395 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5396     typename T6, typename T7, typename T8, typename T9, typename T10>
5397 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None,
5398     internal::None, internal::None, internal::None, internal::None,
5399     internal::None, internal::None, internal::None, internal::None,
5400     internal::None, internal::None, internal::None, internal::None,
5401     internal::None, internal::None, internal::None, internal::None,
5402     internal::None, internal::None, internal::None, internal::None,
5403     internal::None, internal::None, internal::None, internal::None,
5404     internal::None, internal::None, internal::None, internal::None,
5405     internal::None, internal::None, internal::None, internal::None,
5406     internal::None, internal::None, internal::None, internal::None,
5407     internal::None, internal::None, internal::None> {
5408   typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
5409 };
5410 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5411     typename T6, typename T7, typename T8, typename T9, typename T10,
5412     typename T11>
5413 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None,
5414     internal::None, internal::None, internal::None, internal::None,
5415     internal::None, internal::None, internal::None, internal::None,
5416     internal::None, internal::None, internal::None, internal::None,
5417     internal::None, internal::None, internal::None, internal::None,
5418     internal::None, internal::None, internal::None, internal::None,
5419     internal::None, internal::None, internal::None, internal::None,
5420     internal::None, internal::None, internal::None, internal::None,
5421     internal::None, internal::None, internal::None, internal::None,
5422     internal::None, internal::None, internal::None, internal::None,
5423     internal::None, internal::None> {
5424   typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
5425 };
5426 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5427     typename T6, typename T7, typename T8, typename T9, typename T10,
5428     typename T11, typename T12>
5429 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None,
5430     internal::None, internal::None, internal::None, internal::None,
5431     internal::None, internal::None, internal::None, internal::None,
5432     internal::None, internal::None, internal::None, internal::None,
5433     internal::None, internal::None, internal::None, internal::None,
5434     internal::None, internal::None, internal::None, internal::None,
5435     internal::None, internal::None, internal::None, internal::None,
5436     internal::None, internal::None, internal::None, internal::None,
5437     internal::None, internal::None, internal::None, internal::None,
5438     internal::None, internal::None, internal::None, internal::None,
5439     internal::None> {
5440   typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
5441       T12> type;
5442 };
5443 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5444     typename T6, typename T7, typename T8, typename T9, typename T10,
5445     typename T11, typename T12, typename T13>
5446 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
5447     internal::None, internal::None, internal::None, internal::None,
5448     internal::None, internal::None, internal::None, internal::None,
5449     internal::None, internal::None, internal::None, internal::None,
5450     internal::None, internal::None, internal::None, internal::None,
5451     internal::None, internal::None, internal::None, internal::None,
5452     internal::None, internal::None, internal::None, internal::None,
5453     internal::None, internal::None, internal::None, internal::None,
5454     internal::None, internal::None, internal::None, internal::None,
5455     internal::None, internal::None, internal::None, internal::None,
5456     internal::None> {
5457   typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5458       T13> type;
5459 };
5460 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5461     typename T6, typename T7, typename T8, typename T9, typename T10,
5462     typename T11, typename T12, typename T13, typename T14>
5463 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
5464     internal::None, internal::None, internal::None, internal::None,
5465     internal::None, internal::None, internal::None, internal::None,
5466     internal::None, internal::None, internal::None, internal::None,
5467     internal::None, internal::None, internal::None, internal::None,
5468     internal::None, internal::None, internal::None, internal::None,
5469     internal::None, internal::None, internal::None, internal::None,
5470     internal::None, internal::None, internal::None, internal::None,
5471     internal::None, internal::None, internal::None, internal::None,
5472     internal::None, internal::None, internal::None, internal::None> {
5473   typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5474       T13, T14> type;
5475 };
5476 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5477     typename T6, typename T7, typename T8, typename T9, typename T10,
5478     typename T11, typename T12, typename T13, typename T14, typename T15>
5479 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5480     internal::None, internal::None, internal::None, internal::None,
5481     internal::None, internal::None, internal::None, internal::None,
5482     internal::None, internal::None, internal::None, internal::None,
5483     internal::None, internal::None, internal::None, internal::None,
5484     internal::None, internal::None, internal::None, internal::None,
5485     internal::None, internal::None, internal::None, internal::None,
5486     internal::None, internal::None, internal::None, internal::None,
5487     internal::None, internal::None, internal::None, internal::None,
5488     internal::None, internal::None, internal::None> {
5489   typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5490       T13, T14, T15> type;
5491 };
5492 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5493     typename T6, typename T7, typename T8, typename T9, typename T10,
5494     typename T11, typename T12, typename T13, typename T14, typename T15,
5495     typename T16>
5496 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5497     T16, internal::None, internal::None, internal::None, internal::None,
5498     internal::None, internal::None, internal::None, internal::None,
5499     internal::None, internal::None, internal::None, internal::None,
5500     internal::None, internal::None, internal::None, internal::None,
5501     internal::None, internal::None, internal::None, internal::None,
5502     internal::None, internal::None, internal::None, internal::None,
5503     internal::None, internal::None, internal::None, internal::None,
5504     internal::None, internal::None, internal::None, internal::None,
5505     internal::None, internal::None> {
5506   typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5507       T13, T14, T15, T16> type;
5508 };
5509 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5510     typename T6, typename T7, typename T8, typename T9, typename T10,
5511     typename T11, typename T12, typename T13, typename T14, typename T15,
5512     typename T16, typename T17>
5513 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5514     T16, T17, internal::None, internal::None, internal::None, internal::None,
5515     internal::None, internal::None, internal::None, internal::None,
5516     internal::None, internal::None, internal::None, internal::None,
5517     internal::None, internal::None, internal::None, internal::None,
5518     internal::None, internal::None, internal::None, internal::None,
5519     internal::None, internal::None, internal::None, internal::None,
5520     internal::None, internal::None, internal::None, internal::None,
5521     internal::None, internal::None, internal::None, internal::None,
5522     internal::None> {
5523   typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5524       T13, T14, T15, T16, T17> type;
5525 };
5526 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5527     typename T6, typename T7, typename T8, typename T9, typename T10,
5528     typename T11, typename T12, typename T13, typename T14, typename T15,
5529     typename T16, typename T17, typename T18>
5530 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5531     T16, T17, T18, internal::None, internal::None, internal::None,
5532     internal::None, internal::None, internal::None, internal::None,
5533     internal::None, internal::None, internal::None, internal::None,
5534     internal::None, internal::None, internal::None, internal::None,
5535     internal::None, internal::None, internal::None, internal::None,
5536     internal::None, internal::None, internal::None, internal::None,
5537     internal::None, internal::None, internal::None, internal::None,
5538     internal::None, internal::None, internal::None, internal::None,
5539     internal::None> {
5540   typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5541       T13, T14, T15, T16, T17, T18> type;
5542 };
5543 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5544     typename T6, typename T7, typename T8, typename T9, typename T10,
5545     typename T11, typename T12, typename T13, typename T14, typename T15,
5546     typename T16, typename T17, typename T18, typename T19>
5547 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5548     T16, T17, T18, T19, internal::None, internal::None, internal::None,
5549     internal::None, internal::None, internal::None, internal::None,
5550     internal::None, internal::None, internal::None, internal::None,
5551     internal::None, internal::None, internal::None, internal::None,
5552     internal::None, internal::None, internal::None, internal::None,
5553     internal::None, internal::None, internal::None, internal::None,
5554     internal::None, internal::None, internal::None, internal::None,
5555     internal::None, internal::None, internal::None, internal::None> {
5556   typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5557       T13, T14, T15, T16, T17, T18, T19> type;
5558 };
5559 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5560     typename T6, typename T7, typename T8, typename T9, typename T10,
5561     typename T11, typename T12, typename T13, typename T14, typename T15,
5562     typename T16, typename T17, typename T18, typename T19, typename T20>
5563 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5564     T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,
5565     internal::None, internal::None, internal::None, internal::None,
5566     internal::None, internal::None, internal::None, internal::None,
5567     internal::None, internal::None, internal::None, internal::None,
5568     internal::None, internal::None, internal::None, internal::None,
5569     internal::None, internal::None, internal::None, internal::None,
5570     internal::None, internal::None, internal::None, internal::None,
5571     internal::None, internal::None, internal::None> {
5572   typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5573       T13, T14, T15, T16, T17, T18, T19, T20> type;
5574 };
5575 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5576     typename T6, typename T7, typename T8, typename T9, typename T10,
5577     typename T11, typename T12, typename T13, typename T14, typename T15,
5578     typename T16, typename T17, typename T18, typename T19, typename T20,
5579     typename T21>
5580 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5581     T16, T17, T18, T19, T20, T21, internal::None, internal::None,
5582     internal::None, internal::None, internal::None, internal::None,
5583     internal::None, internal::None, internal::None, internal::None,
5584     internal::None, internal::None, internal::None, internal::None,
5585     internal::None, internal::None, internal::None, internal::None,
5586     internal::None, internal::None, internal::None, internal::None,
5587     internal::None, internal::None, internal::None, internal::None,
5588     internal::None, internal::None, internal::None> {
5589   typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5590       T13, T14, T15, T16, T17, T18, T19, T20, T21> type;
5591 };
5592 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5593     typename T6, typename T7, typename T8, typename T9, typename T10,
5594     typename T11, typename T12, typename T13, typename T14, typename T15,
5595     typename T16, typename T17, typename T18, typename T19, typename T20,
5596     typename T21, typename T22>
5597 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5598     T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,
5599     internal::None, internal::None, internal::None, internal::None,
5600     internal::None, internal::None, internal::None, internal::None,
5601     internal::None, internal::None, internal::None, internal::None,
5602     internal::None, internal::None, internal::None, internal::None,
5603     internal::None, internal::None, internal::None, internal::None,
5604     internal::None, internal::None, internal::None, internal::None,
5605     internal::None, internal::None> {
5606   typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5607       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
5608 };
5609 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5610     typename T6, typename T7, typename T8, typename T9, typename T10,
5611     typename T11, typename T12, typename T13, typename T14, typename T15,
5612     typename T16, typename T17, typename T18, typename T19, typename T20,
5613     typename T21, typename T22, typename T23>
5614 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5615     T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,
5616     internal::None, internal::None, internal::None, internal::None,
5617     internal::None, internal::None, internal::None, internal::None,
5618     internal::None, internal::None, internal::None, internal::None,
5619     internal::None, internal::None, internal::None, internal::None,
5620     internal::None, internal::None, internal::None, internal::None,
5621     internal::None, internal::None, internal::None, internal::None,
5622     internal::None> {
5623   typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5624       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
5625 };
5626 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5627     typename T6, typename T7, typename T8, typename T9, typename T10,
5628     typename T11, typename T12, typename T13, typename T14, typename T15,
5629     typename T16, typename T17, typename T18, typename T19, typename T20,
5630     typename T21, typename T22, typename T23, typename T24>
5631 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5632     T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,
5633     internal::None, internal::None, internal::None, internal::None,
5634     internal::None, internal::None, internal::None, internal::None,
5635     internal::None, internal::None, internal::None, internal::None,
5636     internal::None, internal::None, internal::None, internal::None,
5637     internal::None, internal::None, internal::None, internal::None,
5638     internal::None, internal::None, internal::None, internal::None,
5639     internal::None> {
5640   typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5641       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
5642 };
5643 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5644     typename T6, typename T7, typename T8, typename T9, typename T10,
5645     typename T11, typename T12, typename T13, typename T14, typename T15,
5646     typename T16, typename T17, typename T18, typename T19, typename T20,
5647     typename T21, typename T22, typename T23, typename T24, typename T25>
5648 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5649     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,
5650     internal::None, internal::None, internal::None, internal::None,
5651     internal::None, internal::None, internal::None, internal::None,
5652     internal::None, internal::None, internal::None, internal::None,
5653     internal::None, internal::None, internal::None, internal::None,
5654     internal::None, internal::None, internal::None, internal::None,
5655     internal::None, internal::None, internal::None, internal::None> {
5656   typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5657       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
5658 };
5659 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5660     typename T6, typename T7, typename T8, typename T9, typename T10,
5661     typename T11, typename T12, typename T13, typename T14, typename T15,
5662     typename T16, typename T17, typename T18, typename T19, typename T20,
5663     typename T21, typename T22, typename T23, typename T24, typename T25,
5664     typename T26>
5665 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5666     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,
5667     internal::None, internal::None, internal::None, internal::None,
5668     internal::None, internal::None, internal::None, internal::None,
5669     internal::None, internal::None, internal::None, internal::None,
5670     internal::None, internal::None, internal::None, internal::None,
5671     internal::None, internal::None, internal::None, internal::None,
5672     internal::None, internal::None, internal::None> {
5673   typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5674       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
5675       T26> type;
5676 };
5677 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5678     typename T6, typename T7, typename T8, typename T9, typename T10,
5679     typename T11, typename T12, typename T13, typename T14, typename T15,
5680     typename T16, typename T17, typename T18, typename T19, typename T20,
5681     typename T21, typename T22, typename T23, typename T24, typename T25,
5682     typename T26, typename T27>
5683 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5684     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,
5685     internal::None, internal::None, internal::None, internal::None,
5686     internal::None, internal::None, internal::None, internal::None,
5687     internal::None, internal::None, internal::None, internal::None,
5688     internal::None, internal::None, internal::None, internal::None,
5689     internal::None, internal::None, internal::None, internal::None,
5690     internal::None, internal::None> {
5691   typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5692       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5693       T27> type;
5694 };
5695 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5696     typename T6, typename T7, typename T8, typename T9, typename T10,
5697     typename T11, typename T12, typename T13, typename T14, typename T15,
5698     typename T16, typename T17, typename T18, typename T19, typename T20,
5699     typename T21, typename T22, typename T23, typename T24, typename T25,
5700     typename T26, typename T27, typename T28>
5701 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5702     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
5703     internal::None, internal::None, internal::None, internal::None,
5704     internal::None, internal::None, internal::None, internal::None,
5705     internal::None, internal::None, internal::None, internal::None,
5706     internal::None, internal::None, internal::None, internal::None,
5707     internal::None, internal::None, internal::None, internal::None,
5708     internal::None, internal::None> {
5709   typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5710       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5711       T27, T28> type;
5712 };
5713 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5714     typename T6, typename T7, typename T8, typename T9, typename T10,
5715     typename T11, typename T12, typename T13, typename T14, typename T15,
5716     typename T16, typename T17, typename T18, typename T19, typename T20,
5717     typename T21, typename T22, typename T23, typename T24, typename T25,
5718     typename T26, typename T27, typename T28, typename T29>
5719 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5720     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
5721     internal::None, internal::None, internal::None, internal::None,
5722     internal::None, internal::None, internal::None, internal::None,
5723     internal::None, internal::None, internal::None, internal::None,
5724     internal::None, internal::None, internal::None, internal::None,
5725     internal::None, internal::None, internal::None, internal::None,
5726     internal::None> {
5727   typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5728       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5729       T27, T28, T29> type;
5730 };
5731 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5732     typename T6, typename T7, typename T8, typename T9, typename T10,
5733     typename T11, typename T12, typename T13, typename T14, typename T15,
5734     typename T16, typename T17, typename T18, typename T19, typename T20,
5735     typename T21, typename T22, typename T23, typename T24, typename T25,
5736     typename T26, typename T27, typename T28, typename T29, typename T30>
5737 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5738     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5739     internal::None, internal::None, internal::None, internal::None,
5740     internal::None, internal::None, internal::None, internal::None,
5741     internal::None, internal::None, internal::None, internal::None,
5742     internal::None, internal::None, internal::None, internal::None,
5743     internal::None, internal::None, internal::None, internal::None> {
5744   typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5745       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5746       T27, T28, T29, T30> type;
5747 };
5748 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5749     typename T6, typename T7, typename T8, typename T9, typename T10,
5750     typename T11, typename T12, typename T13, typename T14, typename T15,
5751     typename T16, typename T17, typename T18, typename T19, typename T20,
5752     typename T21, typename T22, typename T23, typename T24, typename T25,
5753     typename T26, typename T27, typename T28, typename T29, typename T30,
5754     typename T31>
5755 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5756     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5757     T31, internal::None, internal::None, internal::None, internal::None,
5758     internal::None, internal::None, internal::None, internal::None,
5759     internal::None, internal::None, internal::None, internal::None,
5760     internal::None, internal::None, internal::None, internal::None,
5761     internal::None, internal::None, internal::None> {
5762   typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5763       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5764       T27, T28, T29, T30, T31> type;
5765 };
5766 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5767     typename T6, typename T7, typename T8, typename T9, typename T10,
5768     typename T11, typename T12, typename T13, typename T14, typename T15,
5769     typename T16, typename T17, typename T18, typename T19, typename T20,
5770     typename T21, typename T22, typename T23, typename T24, typename T25,
5771     typename T26, typename T27, typename T28, typename T29, typename T30,
5772     typename T31, typename T32>
5773 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5774     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5775     T31, T32, internal::None, internal::None, internal::None, internal::None,
5776     internal::None, internal::None, internal::None, internal::None,
5777     internal::None, internal::None, internal::None, internal::None,
5778     internal::None, internal::None, internal::None, internal::None,
5779     internal::None, internal::None> {
5780   typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5781       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5782       T27, T28, T29, T30, T31, T32> type;
5783 };
5784 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5785     typename T6, typename T7, typename T8, typename T9, typename T10,
5786     typename T11, typename T12, typename T13, typename T14, typename T15,
5787     typename T16, typename T17, typename T18, typename T19, typename T20,
5788     typename T21, typename T22, typename T23, typename T24, typename T25,
5789     typename T26, typename T27, typename T28, typename T29, typename T30,
5790     typename T31, typename T32, typename T33>
5791 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5792     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5793     T31, T32, T33, internal::None, internal::None, internal::None,
5794     internal::None, internal::None, internal::None, internal::None,
5795     internal::None, internal::None, internal::None, internal::None,
5796     internal::None, internal::None, internal::None, internal::None,
5797     internal::None, internal::None> {
5798   typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5799       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5800       T27, T28, T29, T30, T31, T32, T33> type;
5801 };
5802 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5803     typename T6, typename T7, typename T8, typename T9, typename T10,
5804     typename T11, typename T12, typename T13, typename T14, typename T15,
5805     typename T16, typename T17, typename T18, typename T19, typename T20,
5806     typename T21, typename T22, typename T23, typename T24, typename T25,
5807     typename T26, typename T27, typename T28, typename T29, typename T30,
5808     typename T31, typename T32, typename T33, typename T34>
5809 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5810     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5811     T31, T32, T33, T34, internal::None, internal::None, internal::None,
5812     internal::None, internal::None, internal::None, internal::None,
5813     internal::None, internal::None, internal::None, internal::None,
5814     internal::None, internal::None, internal::None, internal::None,
5815     internal::None> {
5816   typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5817       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5818       T27, T28, T29, T30, T31, T32, T33, T34> type;
5819 };
5820 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5821     typename T6, typename T7, typename T8, typename T9, typename T10,
5822     typename T11, typename T12, typename T13, typename T14, typename T15,
5823     typename T16, typename T17, typename T18, typename T19, typename T20,
5824     typename T21, typename T22, typename T23, typename T24, typename T25,
5825     typename T26, typename T27, typename T28, typename T29, typename T30,
5826     typename T31, typename T32, typename T33, typename T34, typename T35>
5827 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5828     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5829     T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,
5830     internal::None, internal::None, internal::None, internal::None,
5831     internal::None, internal::None, internal::None, internal::None,
5832     internal::None, internal::None, internal::None, internal::None> {
5833   typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5834       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5835       T27, T28, T29, T30, T31, T32, T33, T34, T35> type;
5836 };
5837 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5838     typename T6, typename T7, typename T8, typename T9, typename T10,
5839     typename T11, typename T12, typename T13, typename T14, typename T15,
5840     typename T16, typename T17, typename T18, typename T19, typename T20,
5841     typename T21, typename T22, typename T23, typename T24, typename T25,
5842     typename T26, typename T27, typename T28, typename T29, typename T30,
5843     typename T31, typename T32, typename T33, typename T34, typename T35,
5844     typename T36>
5845 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5846     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5847     T31, T32, T33, T34, T35, T36, internal::None, internal::None,
5848     internal::None, internal::None, internal::None, internal::None,
5849     internal::None, internal::None, internal::None, internal::None,
5850     internal::None, internal::None, internal::None, internal::None> {
5851   typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5852       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5853       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
5854 };
5855 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5856     typename T6, typename T7, typename T8, typename T9, typename T10,
5857     typename T11, typename T12, typename T13, typename T14, typename T15,
5858     typename T16, typename T17, typename T18, typename T19, typename T20,
5859     typename T21, typename T22, typename T23, typename T24, typename T25,
5860     typename T26, typename T27, typename T28, typename T29, typename T30,
5861     typename T31, typename T32, typename T33, typename T34, typename T35,
5862     typename T36, typename T37>
5863 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5864     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5865     T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,
5866     internal::None, internal::None, internal::None, internal::None,
5867     internal::None, internal::None, internal::None, internal::None,
5868     internal::None, internal::None, internal::None> {
5869   typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5870       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5871       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
5872 };
5873 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5874     typename T6, typename T7, typename T8, typename T9, typename T10,
5875     typename T11, typename T12, typename T13, typename T14, typename T15,
5876     typename T16, typename T17, typename T18, typename T19, typename T20,
5877     typename T21, typename T22, typename T23, typename T24, typename T25,
5878     typename T26, typename T27, typename T28, typename T29, typename T30,
5879     typename T31, typename T32, typename T33, typename T34, typename T35,
5880     typename T36, typename T37, typename T38>
5881 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5882     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5883     T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,
5884     internal::None, internal::None, internal::None, internal::None,
5885     internal::None, internal::None, internal::None, internal::None,
5886     internal::None, internal::None> {
5887   typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5888       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5889       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
5890 };
5891 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5892     typename T6, typename T7, typename T8, typename T9, typename T10,
5893     typename T11, typename T12, typename T13, typename T14, typename T15,
5894     typename T16, typename T17, typename T18, typename T19, typename T20,
5895     typename T21, typename T22, typename T23, typename T24, typename T25,
5896     typename T26, typename T27, typename T28, typename T29, typename T30,
5897     typename T31, typename T32, typename T33, typename T34, typename T35,
5898     typename T36, typename T37, typename T38, typename T39>
5899 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5900     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5901     T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,
5902     internal::None, internal::None, internal::None, internal::None,
5903     internal::None, internal::None, internal::None, internal::None,
5904     internal::None, internal::None> {
5905   typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5906       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5907       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
5908 };
5909 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5910     typename T6, typename T7, typename T8, typename T9, typename T10,
5911     typename T11, typename T12, typename T13, typename T14, typename T15,
5912     typename T16, typename T17, typename T18, typename T19, typename T20,
5913     typename T21, typename T22, typename T23, typename T24, typename T25,
5914     typename T26, typename T27, typename T28, typename T29, typename T30,
5915     typename T31, typename T32, typename T33, typename T34, typename T35,
5916     typename T36, typename T37, typename T38, typename T39, typename T40>
5917 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5918     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5919     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,
5920     internal::None, internal::None, internal::None, internal::None,
5921     internal::None, internal::None, internal::None, internal::None,
5922     internal::None> {
5923   typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5924       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5925       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
5926       T40> type;
5927 };
5928 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5929     typename T6, typename T7, typename T8, typename T9, typename T10,
5930     typename T11, typename T12, typename T13, typename T14, typename T15,
5931     typename T16, typename T17, typename T18, typename T19, typename T20,
5932     typename T21, typename T22, typename T23, typename T24, typename T25,
5933     typename T26, typename T27, typename T28, typename T29, typename T30,
5934     typename T31, typename T32, typename T33, typename T34, typename T35,
5935     typename T36, typename T37, typename T38, typename T39, typename T40,
5936     typename T41>
5937 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5938     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5939     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,
5940     internal::None, internal::None, internal::None, internal::None,
5941     internal::None, internal::None, internal::None, internal::None> {
5942   typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5943       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5944       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5945       T41> type;
5946 };
5947 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5948     typename T6, typename T7, typename T8, typename T9, typename T10,
5949     typename T11, typename T12, typename T13, typename T14, typename T15,
5950     typename T16, typename T17, typename T18, typename T19, typename T20,
5951     typename T21, typename T22, typename T23, typename T24, typename T25,
5952     typename T26, typename T27, typename T28, typename T29, typename T30,
5953     typename T31, typename T32, typename T33, typename T34, typename T35,
5954     typename T36, typename T37, typename T38, typename T39, typename T40,
5955     typename T41, typename T42>
5956 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5957     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5958     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,
5959     internal::None, internal::None, internal::None, internal::None,
5960     internal::None, internal::None, internal::None> {
5961   typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5962       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5963       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5964       T41, T42> type;
5965 };
5966 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5967     typename T6, typename T7, typename T8, typename T9, typename T10,
5968     typename T11, typename T12, typename T13, typename T14, typename T15,
5969     typename T16, typename T17, typename T18, typename T19, typename T20,
5970     typename T21, typename T22, typename T23, typename T24, typename T25,
5971     typename T26, typename T27, typename T28, typename T29, typename T30,
5972     typename T31, typename T32, typename T33, typename T34, typename T35,
5973     typename T36, typename T37, typename T38, typename T39, typename T40,
5974     typename T41, typename T42, typename T43>
5975 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5976     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5977     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
5978     internal::None, internal::None, internal::None, internal::None,
5979     internal::None, internal::None, internal::None> {
5980   typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
5981       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
5982       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
5983       T41, T42, T43> type;
5984 };
5985 template <typename T1, typename T2, typename T3, typename T4, typename T5,
5986     typename T6, typename T7, typename T8, typename T9, typename T10,
5987     typename T11, typename T12, typename T13, typename T14, typename T15,
5988     typename T16, typename T17, typename T18, typename T19, typename T20,
5989     typename T21, typename T22, typename T23, typename T24, typename T25,
5990     typename T26, typename T27, typename T28, typename T29, typename T30,
5991     typename T31, typename T32, typename T33, typename T34, typename T35,
5992     typename T36, typename T37, typename T38, typename T39, typename T40,
5993     typename T41, typename T42, typename T43, typename T44>
5994 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
5995     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
5996     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
5997     internal::None, internal::None, internal::None, internal::None,
5998     internal::None, internal::None> {
5999   typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6000       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6001       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6002       T41, T42, T43, T44> type;
6003 };
6004 template <typename T1, typename T2, typename T3, typename T4, typename T5,
6005     typename T6, typename T7, typename T8, typename T9, typename T10,
6006     typename T11, typename T12, typename T13, typename T14, typename T15,
6007     typename T16, typename T17, typename T18, typename T19, typename T20,
6008     typename T21, typename T22, typename T23, typename T24, typename T25,
6009     typename T26, typename T27, typename T28, typename T29, typename T30,
6010     typename T31, typename T32, typename T33, typename T34, typename T35,
6011     typename T36, typename T37, typename T38, typename T39, typename T40,
6012     typename T41, typename T42, typename T43, typename T44, typename T45>
6013 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
6014     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
6015     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
6016     internal::None, internal::None, internal::None, internal::None,
6017     internal::None> {
6018   typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6019       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6020       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6021       T41, T42, T43, T44, T45> type;
6022 };
6023 template <typename T1, typename T2, typename T3, typename T4, typename T5,
6024     typename T6, typename T7, typename T8, typename T9, typename T10,
6025     typename T11, typename T12, typename T13, typename T14, typename T15,
6026     typename T16, typename T17, typename T18, typename T19, typename T20,
6027     typename T21, typename T22, typename T23, typename T24, typename T25,
6028     typename T26, typename T27, typename T28, typename T29, typename T30,
6029     typename T31, typename T32, typename T33, typename T34, typename T35,
6030     typename T36, typename T37, typename T38, typename T39, typename T40,
6031     typename T41, typename T42, typename T43, typename T44, typename T45,
6032     typename T46>
6033 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
6034     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
6035     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
6036     T46, internal::None, internal::None, internal::None, internal::None> {
6037   typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6038       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6039       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6040       T41, T42, T43, T44, T45, T46> type;
6041 };
6042 template <typename T1, typename T2, typename T3, typename T4, typename T5,
6043     typename T6, typename T7, typename T8, typename T9, typename T10,
6044     typename T11, typename T12, typename T13, typename T14, typename T15,
6045     typename T16, typename T17, typename T18, typename T19, typename T20,
6046     typename T21, typename T22, typename T23, typename T24, typename T25,
6047     typename T26, typename T27, typename T28, typename T29, typename T30,
6048     typename T31, typename T32, typename T33, typename T34, typename T35,
6049     typename T36, typename T37, typename T38, typename T39, typename T40,
6050     typename T41, typename T42, typename T43, typename T44, typename T45,
6051     typename T46, typename T47>
6052 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
6053     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
6054     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
6055     T46, T47, internal::None, internal::None, internal::None> {
6056   typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6057       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6058       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6059       T41, T42, T43, T44, T45, T46, T47> type;
6060 };
6061 template <typename T1, typename T2, typename T3, typename T4, typename T5,
6062     typename T6, typename T7, typename T8, typename T9, typename T10,
6063     typename T11, typename T12, typename T13, typename T14, typename T15,
6064     typename T16, typename T17, typename T18, typename T19, typename T20,
6065     typename T21, typename T22, typename T23, typename T24, typename T25,
6066     typename T26, typename T27, typename T28, typename T29, typename T30,
6067     typename T31, typename T32, typename T33, typename T34, typename T35,
6068     typename T36, typename T37, typename T38, typename T39, typename T40,
6069     typename T41, typename T42, typename T43, typename T44, typename T45,
6070     typename T46, typename T47, typename T48>
6071 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
6072     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
6073     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
6074     T46, T47, T48, internal::None, internal::None> {
6075   typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6076       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6077       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6078       T41, T42, T43, T44, T45, T46, T47, T48> type;
6079 };
6080 template <typename T1, typename T2, typename T3, typename T4, typename T5,
6081     typename T6, typename T7, typename T8, typename T9, typename T10,
6082     typename T11, typename T12, typename T13, typename T14, typename T15,
6083     typename T16, typename T17, typename T18, typename T19, typename T20,
6084     typename T21, typename T22, typename T23, typename T24, typename T25,
6085     typename T26, typename T27, typename T28, typename T29, typename T30,
6086     typename T31, typename T32, typename T33, typename T34, typename T35,
6087     typename T36, typename T37, typename T38, typename T39, typename T40,
6088     typename T41, typename T42, typename T43, typename T44, typename T45,
6089     typename T46, typename T47, typename T48, typename T49>
6090 struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
6091     T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
6092     T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
6093     T46, T47, T48, T49, internal::None> {
6094   typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
6095       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
6096       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
6097       T41, T42, T43, T44, T45, T46, T47, T48, T49> type;
6098 };
6099
6100 namespace internal {
6101
6102 # define GTEST_TEMPLATE_ template <typename T> class
6103
6104 // The template "selector" struct TemplateSel<Tmpl> is used to
6105 // represent Tmpl, which must be a class template with one type
6106 // parameter, as a type.  TemplateSel<Tmpl>::Bind<T>::type is defined
6107 // as the type Tmpl<T>.  This allows us to actually instantiate the
6108 // template "selected" by TemplateSel<Tmpl>.
6109 //
6110 // This trick is necessary for simulating typedef for class templates,
6111 // which C++ doesn't support directly.
6112 template <GTEST_TEMPLATE_ Tmpl>
6113 struct TemplateSel {
6114   template <typename T>
6115   struct Bind {
6116     typedef Tmpl<T> type;
6117   };
6118 };
6119
6120 # define GTEST_BIND_(TmplSel, T) \
6121   TmplSel::template Bind<T>::type
6122
6123 // A unique struct template used as the default value for the
6124 // arguments of class template Templates.  This allows us to simulate
6125 // variadic templates (e.g. Templates<int>, Templates<int, double>,
6126 // and etc), which C++ doesn't support directly.
6127 template <typename T>
6128 struct NoneT {};
6129
6130 // The following family of struct and struct templates are used to
6131 // represent template lists.  In particular, TemplatesN<T1, T2, ...,
6132 // TN> represents a list of N templates (T1, T2, ..., and TN).  Except
6133 // for Templates0, every struct in the family has two member types:
6134 // Head for the selector of the first template in the list, and Tail
6135 // for the rest of the list.
6136
6137 // The empty template list.
6138 struct Templates0 {};
6139
6140 // Template lists of length 1, 2, 3, and so on.
6141
6142 template <GTEST_TEMPLATE_ T1>
6143 struct Templates1 {
6144   typedef TemplateSel<T1> Head;
6145   typedef Templates0 Tail;
6146 };
6147 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
6148 struct Templates2 {
6149   typedef TemplateSel<T1> Head;
6150   typedef Templates1<T2> Tail;
6151 };
6152
6153 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
6154 struct Templates3 {
6155   typedef TemplateSel<T1> Head;
6156   typedef Templates2<T2, T3> Tail;
6157 };
6158
6159 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6160     GTEST_TEMPLATE_ T4>
6161 struct Templates4 {
6162   typedef TemplateSel<T1> Head;
6163   typedef Templates3<T2, T3, T4> Tail;
6164 };
6165
6166 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6167     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
6168 struct Templates5 {
6169   typedef TemplateSel<T1> Head;
6170   typedef Templates4<T2, T3, T4, T5> Tail;
6171 };
6172
6173 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6174     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
6175 struct Templates6 {
6176   typedef TemplateSel<T1> Head;
6177   typedef Templates5<T2, T3, T4, T5, T6> Tail;
6178 };
6179
6180 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6181     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6182     GTEST_TEMPLATE_ T7>
6183 struct Templates7 {
6184   typedef TemplateSel<T1> Head;
6185   typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;
6186 };
6187
6188 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6189     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6190     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
6191 struct Templates8 {
6192   typedef TemplateSel<T1> Head;
6193   typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;
6194 };
6195
6196 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6197     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6198     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
6199 struct Templates9 {
6200   typedef TemplateSel<T1> Head;
6201   typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
6202 };
6203
6204 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6205     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6206     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6207     GTEST_TEMPLATE_ T10>
6208 struct Templates10 {
6209   typedef TemplateSel<T1> Head;
6210   typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
6211 };
6212
6213 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6214     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6215     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6216     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
6217 struct Templates11 {
6218   typedef TemplateSel<T1> Head;
6219   typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
6220 };
6221
6222 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6223     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6224     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6225     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
6226 struct Templates12 {
6227   typedef TemplateSel<T1> Head;
6228   typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
6229 };
6230
6231 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6232     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6233     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6234     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6235     GTEST_TEMPLATE_ T13>
6236 struct Templates13 {
6237   typedef TemplateSel<T1> Head;
6238   typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
6239 };
6240
6241 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6242     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6243     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6244     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6245     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
6246 struct Templates14 {
6247   typedef TemplateSel<T1> Head;
6248   typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6249       T14> Tail;
6250 };
6251
6252 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6253     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6254     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6255     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6256     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
6257 struct Templates15 {
6258   typedef TemplateSel<T1> Head;
6259   typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6260       T15> Tail;
6261 };
6262
6263 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6264     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6265     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6266     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6267     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6268     GTEST_TEMPLATE_ T16>
6269 struct Templates16 {
6270   typedef TemplateSel<T1> Head;
6271   typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6272       T15, T16> Tail;
6273 };
6274
6275 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6276     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6277     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6278     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6279     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6280     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
6281 struct Templates17 {
6282   typedef TemplateSel<T1> Head;
6283   typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6284       T15, T16, T17> Tail;
6285 };
6286
6287 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6288     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6289     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6290     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6291     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6292     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
6293 struct Templates18 {
6294   typedef TemplateSel<T1> Head;
6295   typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6296       T15, T16, T17, T18> Tail;
6297 };
6298
6299 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6300     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6301     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6302     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6303     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6304     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6305     GTEST_TEMPLATE_ T19>
6306 struct Templates19 {
6307   typedef TemplateSel<T1> Head;
6308   typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6309       T15, T16, T17, T18, T19> Tail;
6310 };
6311
6312 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6313     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6314     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6315     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6316     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6317     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6318     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
6319 struct Templates20 {
6320   typedef TemplateSel<T1> Head;
6321   typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6322       T15, T16, T17, T18, T19, T20> Tail;
6323 };
6324
6325 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6326     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6327     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6328     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6329     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6330     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6331     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
6332 struct Templates21 {
6333   typedef TemplateSel<T1> Head;
6334   typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6335       T15, T16, T17, T18, T19, T20, T21> Tail;
6336 };
6337
6338 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6339     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6340     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6341     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6342     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6343     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6344     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6345     GTEST_TEMPLATE_ T22>
6346 struct Templates22 {
6347   typedef TemplateSel<T1> Head;
6348   typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6349       T15, T16, T17, T18, T19, T20, T21, T22> Tail;
6350 };
6351
6352 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6353     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6354     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6355     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6356     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6357     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6358     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6359     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
6360 struct Templates23 {
6361   typedef TemplateSel<T1> Head;
6362   typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6363       T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;
6364 };
6365
6366 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6367     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6368     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6369     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6370     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6371     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6372     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6373     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
6374 struct Templates24 {
6375   typedef TemplateSel<T1> Head;
6376   typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6377       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
6378 };
6379
6380 template <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>
6389 struct Templates25 {
6390   typedef TemplateSel<T1> Head;
6391   typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6392       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
6393 };
6394
6395 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6396     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6397     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6398     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6399     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6400     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6401     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6402     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6403     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
6404 struct Templates26 {
6405   typedef TemplateSel<T1> Head;
6406   typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6407       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
6408 };
6409
6410 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6411     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6412     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6413     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6414     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6415     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6416     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6417     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6418     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
6419 struct Templates27 {
6420   typedef TemplateSel<T1> Head;
6421   typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6422       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
6423 };
6424
6425 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6426     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6427     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6428     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6429     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6430     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6431     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6432     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6433     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6434     GTEST_TEMPLATE_ T28>
6435 struct Templates28 {
6436   typedef TemplateSel<T1> Head;
6437   typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6438       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6439       T28> Tail;
6440 };
6441
6442 template <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>
6452 struct Templates29 {
6453   typedef TemplateSel<T1> Head;
6454   typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6455       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6456       T29> Tail;
6457 };
6458
6459 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6460     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6461     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6462     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6463     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6464     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6465     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6466     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6467     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6468     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
6469 struct Templates30 {
6470   typedef TemplateSel<T1> Head;
6471   typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6472       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6473       T29, T30> Tail;
6474 };
6475
6476 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6477     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6478     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6479     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6480     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6481     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6482     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6483     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6484     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6485     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6486     GTEST_TEMPLATE_ T31>
6487 struct Templates31 {
6488   typedef TemplateSel<T1> Head;
6489   typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6490       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6491       T29, T30, T31> Tail;
6492 };
6493
6494 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6495     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6496     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6497     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6498     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6499     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6500     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6501     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6502     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6503     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6504     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
6505 struct Templates32 {
6506   typedef TemplateSel<T1> Head;
6507   typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6508       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6509       T29, T30, T31, T32> Tail;
6510 };
6511
6512 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6513     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6514     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6515     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6516     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6517     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6518     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6519     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6520     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6521     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6522     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
6523 struct Templates33 {
6524   typedef TemplateSel<T1> Head;
6525   typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6526       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6527       T29, T30, T31, T32, T33> Tail;
6528 };
6529
6530 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6531     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6532     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6533     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6534     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6535     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6536     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6537     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6538     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6539     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6540     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6541     GTEST_TEMPLATE_ T34>
6542 struct Templates34 {
6543   typedef TemplateSel<T1> Head;
6544   typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6545       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6546       T29, T30, T31, T32, T33, T34> Tail;
6547 };
6548
6549 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6550     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6551     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6552     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6553     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6554     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6555     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6556     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6557     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6558     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6559     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6560     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
6561 struct Templates35 {
6562   typedef TemplateSel<T1> Head;
6563   typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6564       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6565       T29, T30, T31, T32, T33, T34, T35> Tail;
6566 };
6567
6568 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6569     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6570     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6571     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6572     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6573     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6574     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6575     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6576     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6577     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6578     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6579     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
6580 struct Templates36 {
6581   typedef TemplateSel<T1> Head;
6582   typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6583       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6584       T29, T30, T31, T32, T33, T34, T35, T36> Tail;
6585 };
6586
6587 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6588     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6589     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6590     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6591     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6592     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6593     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6594     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6595     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6596     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6597     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6598     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6599     GTEST_TEMPLATE_ T37>
6600 struct Templates37 {
6601   typedef TemplateSel<T1> Head;
6602   typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6603       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6604       T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;
6605 };
6606
6607 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6608     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6609     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6610     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6611     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6612     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6613     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6614     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6615     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6616     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6617     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6618     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6619     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
6620 struct Templates38 {
6621   typedef TemplateSel<T1> Head;
6622   typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6623       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6624       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
6625 };
6626
6627 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6628     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6629     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6630     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6631     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6632     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6633     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6634     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6635     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6636     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6637     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6638     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6639     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
6640 struct Templates39 {
6641   typedef TemplateSel<T1> Head;
6642   typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6643       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6644       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
6645 };
6646
6647 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6648     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6649     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6650     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6651     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6652     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6653     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6654     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6655     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6656     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6657     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6658     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6659     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6660     GTEST_TEMPLATE_ T40>
6661 struct Templates40 {
6662   typedef TemplateSel<T1> Head;
6663   typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6664       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6665       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
6666 };
6667
6668 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6669     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6670     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6671     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6672     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6673     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6674     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6675     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6676     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6677     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6678     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6679     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6680     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6681     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
6682 struct Templates41 {
6683   typedef TemplateSel<T1> Head;
6684   typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6685       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6686       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
6687 };
6688
6689 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6690     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6691     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6692     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6693     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6694     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6695     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6696     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6697     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6698     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6699     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6700     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6701     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6702     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
6703 struct Templates42 {
6704   typedef TemplateSel<T1> Head;
6705   typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6706       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6707       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6708       T42> Tail;
6709 };
6710
6711 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6712     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6713     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6714     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6715     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6716     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6717     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6718     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6719     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6720     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6721     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6722     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6723     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6724     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6725     GTEST_TEMPLATE_ T43>
6726 struct Templates43 {
6727   typedef TemplateSel<T1> Head;
6728   typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6729       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6730       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6731       T43> Tail;
6732 };
6733
6734 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6735     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6736     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6737     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6738     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6739     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6740     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6741     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6742     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6743     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6744     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6745     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6746     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6747     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6748     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
6749 struct Templates44 {
6750   typedef TemplateSel<T1> Head;
6751   typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6752       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6753       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6754       T43, T44> Tail;
6755 };
6756
6757 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6758     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6759     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6760     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6761     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6762     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6763     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6764     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6765     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6766     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6767     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6768     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6769     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6770     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6771     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
6772 struct Templates45 {
6773   typedef TemplateSel<T1> Head;
6774   typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6775       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6776       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6777       T43, T44, T45> Tail;
6778 };
6779
6780 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6781     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6782     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6783     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6784     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6785     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6786     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6787     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6788     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6789     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6790     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6791     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6792     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6793     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6794     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6795     GTEST_TEMPLATE_ T46>
6796 struct Templates46 {
6797   typedef TemplateSel<T1> Head;
6798   typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6799       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6800       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6801       T43, T44, T45, T46> Tail;
6802 };
6803
6804 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6805     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6806     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6807     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6808     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6809     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6810     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6811     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6812     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6813     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6814     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6815     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6816     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6817     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6818     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6819     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
6820 struct Templates47 {
6821   typedef TemplateSel<T1> Head;
6822   typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6823       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6824       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6825       T43, T44, T45, T46, T47> Tail;
6826 };
6827
6828 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6829     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6830     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6831     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6832     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6833     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6834     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6835     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6836     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6837     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6838     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6839     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6840     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6841     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6842     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6843     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
6844 struct Templates48 {
6845   typedef TemplateSel<T1> Head;
6846   typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6847       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6848       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6849       T43, T44, T45, T46, T47, T48> Tail;
6850 };
6851
6852 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6853     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6854     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6855     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6856     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6857     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6858     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6859     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6860     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6861     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6862     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6863     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6864     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6865     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6866     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6867     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
6868     GTEST_TEMPLATE_ T49>
6869 struct Templates49 {
6870   typedef TemplateSel<T1> Head;
6871   typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6872       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6873       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6874       T43, T44, T45, T46, T47, T48, T49> Tail;
6875 };
6876
6877 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6878     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
6879     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
6880     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
6881     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
6882     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
6883     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
6884     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
6885     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
6886     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
6887     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
6888     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
6889     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
6890     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
6891     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
6892     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
6893     GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>
6894 struct Templates50 {
6895   typedef TemplateSel<T1> Head;
6896   typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
6897       T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
6898       T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
6899       T43, T44, T45, T46, T47, T48, T49, T50> Tail;
6900 };
6901
6902
6903 // We don't want to require the users to write TemplatesN<...> directly,
6904 // as that would require them to count the length.  Templates<...> is much
6905 // easier to write, but generates horrible messages when there is a
6906 // compiler error, as gcc insists on printing out each template
6907 // argument, even if it has the default value (this means Templates<list>
6908 // will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
6909 // errors).
6910 //
6911 // Our solution is to combine the best part of the two approaches: a
6912 // user would write Templates<T1, ..., TN>, and Google Test will translate
6913 // that to TemplatesN<T1, ..., TN> internally to make error messages
6914 // readable.  The translation is done by the 'type' member of the
6915 // Templates template.
6916 template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,
6917     GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,
6918     GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,
6919     GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,
6920     GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,
6921     GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,
6922     GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,
6923     GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,
6924     GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,
6925     GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,
6926     GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,
6927     GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,
6928     GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,
6929     GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,
6930     GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,
6931     GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,
6932     GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,
6933     GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,
6934     GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,
6935     GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,
6936     GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,
6937     GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,
6938     GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,
6939     GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,
6940     GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>
6941 struct Templates {
6942   typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
6943       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
6944       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
6945       T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
6946 };
6947
6948 template <>
6949 struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6950     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6951     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6952     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6953     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6954     NoneT> {
6955   typedef Templates0 type;
6956 };
6957 template <GTEST_TEMPLATE_ T1>
6958 struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6959     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6960     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6961     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6962     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6963     NoneT> {
6964   typedef Templates1<T1> type;
6965 };
6966 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
6967 struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6968     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6969     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6970     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6971     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6972     NoneT> {
6973   typedef Templates2<T1, T2> type;
6974 };
6975 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
6976 struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6977     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6978     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6979     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6980     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6981   typedef Templates3<T1, T2, T3> type;
6982 };
6983 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6984     GTEST_TEMPLATE_ T4>
6985 struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6986     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6987     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6988     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6989     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6990   typedef Templates4<T1, T2, T3, T4> type;
6991 };
6992 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
6993     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
6994 struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6995     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6996     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6997     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
6998     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
6999   typedef Templates5<T1, T2, T3, T4, T5> type;
7000 };
7001 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7002     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
7003 struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,
7004     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7005     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7006     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7007     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7008   typedef Templates6<T1, T2, T3, T4, T5, T6> type;
7009 };
7010 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7011     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7012     GTEST_TEMPLATE_ T7>
7013 struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,
7014     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7015     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7016     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7017     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7018   typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;
7019 };
7020 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7021     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7022     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
7023 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT,
7024     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7025     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7026     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7027     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7028   typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;
7029 };
7030 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7031     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7032     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
7033 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT,
7034     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7035     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7036     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7037     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7038   typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
7039 };
7040 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7041     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7042     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7043     GTEST_TEMPLATE_ T10>
7044 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,
7045     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7046     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7047     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7048     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7049   typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
7050 };
7051 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7052     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7053     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7054     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
7055 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,
7056     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7057     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7058     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7059     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7060   typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
7061 };
7062 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7063     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7064     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7065     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
7066 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,
7067     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7068     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7069     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7070     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7071   typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;
7072 };
7073 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7074     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7075     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7076     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7077     GTEST_TEMPLATE_ T13>
7078 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,
7079     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7080     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7081     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7082     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7083   typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
7084       T13> type;
7085 };
7086 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7087     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7088     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7089     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7090     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
7091 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7092     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7093     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7094     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7095     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7096   typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7097       T14> type;
7098 };
7099 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7100     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7101     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7102     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7103     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
7104 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7105     T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7106     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7107     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7108     NoneT, NoneT, NoneT, NoneT, NoneT> {
7109   typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7110       T14, T15> type;
7111 };
7112 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7113     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7114     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7115     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7116     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7117     GTEST_TEMPLATE_ T16>
7118 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7119     T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7120     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7121     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7122     NoneT, NoneT, NoneT, NoneT, NoneT> {
7123   typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7124       T14, T15, T16> type;
7125 };
7126 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7127     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7128     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7129     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7130     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7131     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
7132 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7133     T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7134     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7135     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7136     NoneT, NoneT, NoneT, NoneT, NoneT> {
7137   typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7138       T14, T15, T16, T17> type;
7139 };
7140 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7141     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7142     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7143     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7144     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7145     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
7146 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7147     T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7148     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7149     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7150     NoneT, NoneT, NoneT, NoneT> {
7151   typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7152       T14, T15, T16, T17, T18> type;
7153 };
7154 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7155     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7156     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7157     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7158     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7159     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7160     GTEST_TEMPLATE_ T19>
7161 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7162     T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7163     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7164     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7165     NoneT, NoneT, NoneT, NoneT> {
7166   typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7167       T14, T15, T16, T17, T18, T19> type;
7168 };
7169 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7170     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7171     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7172     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7173     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7174     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7175     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
7176 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7177     T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7178     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7179     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7180     NoneT, NoneT, NoneT, NoneT> {
7181   typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7182       T14, T15, T16, T17, T18, T19, T20> type;
7183 };
7184 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7185     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7186     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7187     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7188     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7189     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7190     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
7191 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7192     T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT,
7193     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7194     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7195     NoneT, NoneT, NoneT, NoneT> {
7196   typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7197       T14, T15, T16, T17, T18, T19, T20, T21> type;
7198 };
7199 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7200     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7201     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7202     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7203     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7204     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7205     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7206     GTEST_TEMPLATE_ T22>
7207 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7208     T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,
7209     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7210     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7211     NoneT, NoneT, NoneT> {
7212   typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7213       T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
7214 };
7215 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7216     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7217     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7218     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7219     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7220     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7221     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7222     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
7223 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7224     T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,
7225     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7226     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7227     NoneT, NoneT, NoneT> {
7228   typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7229       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
7230 };
7231 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7232     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7233     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7234     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7235     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7236     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7237     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7238     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
7239 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7240     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,
7241     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7242     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7243     NoneT, NoneT, NoneT> {
7244   typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7245       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
7246 };
7247 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7248     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7249     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7250     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7251     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7252     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7253     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7254     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7255     GTEST_TEMPLATE_ T25>
7256 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7257     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,
7258     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7259     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7260     NoneT, NoneT> {
7261   typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7262       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
7263 };
7264 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7265     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7266     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7267     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7268     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7269     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7270     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7271     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7272     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
7273 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7274     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,
7275     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7276     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7277     NoneT, NoneT> {
7278   typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7279       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;
7280 };
7281 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7282     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7283     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7284     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7285     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7286     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7287     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7288     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7289     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
7290 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7291     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,
7292     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7293     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7294     NoneT, NoneT> {
7295   typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7296       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
7297       T27> type;
7298 };
7299 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7300     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7301     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7302     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7303     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7304     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7305     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7306     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7307     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7308     GTEST_TEMPLATE_ T28>
7309 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7310     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
7311     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7312     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7313     NoneT, NoneT> {
7314   typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7315       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7316       T28> type;
7317 };
7318 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7319     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7320     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7321     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7322     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7323     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7324     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7325     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7326     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7327     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
7328 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7329     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7330     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7331     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7332     NoneT> {
7333   typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7334       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7335       T28, T29> type;
7336 };
7337 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7338     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7339     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7340     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7341     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7342     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7343     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7344     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7345     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7346     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
7347 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7348     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7349     T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7350     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7351   typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7352       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7353       T28, T29, T30> type;
7354 };
7355 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7356     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7357     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7358     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7359     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7360     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7361     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7362     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7363     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7364     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7365     GTEST_TEMPLATE_ T31>
7366 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7367     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7368     T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7369     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7370   typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7371       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7372       T28, T29, T30, T31> type;
7373 };
7374 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7375     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7376     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7377     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7378     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7379     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7380     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7381     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7382     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7383     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7384     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
7385 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7386     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7387     T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7388     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7389   typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7390       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7391       T28, T29, T30, T31, T32> type;
7392 };
7393 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7394     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7395     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7396     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7397     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7398     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7399     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7400     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7401     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7402     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7403     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
7404 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7405     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7406     T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7407     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7408   typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7409       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7410       T28, T29, T30, T31, T32, T33> type;
7411 };
7412 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7413     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7414     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7415     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7416     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7417     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7418     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7419     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7420     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7421     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7422     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7423     GTEST_TEMPLATE_ T34>
7424 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7425     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7426     T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7427     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7428   typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7429       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7430       T28, T29, T30, T31, T32, T33, T34> type;
7431 };
7432 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7433     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7434     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7435     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7436     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7437     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7438     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7439     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7440     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7441     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7442     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7443     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
7444 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7445     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7446     T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
7447     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7448   typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7449       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7450       T28, T29, T30, T31, T32, T33, T34, T35> type;
7451 };
7452 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7453     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7454     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7455     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7456     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7457     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7458     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7459     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7460     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7461     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7462     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7463     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
7464 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7465     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7466     T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,
7467     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7468   typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7469       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7470       T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
7471 };
7472 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7473     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7474     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7475     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7476     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7477     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7478     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7479     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7480     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7481     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7482     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7483     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7484     GTEST_TEMPLATE_ T37>
7485 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7486     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7487     T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,
7488     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7489   typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7490       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7491       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
7492 };
7493 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7494     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7495     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7496     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7497     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7498     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7499     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7500     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7501     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7502     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7503     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7504     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7505     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
7506 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7507     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7508     T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,
7509     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7510   typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7511       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7512       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
7513 };
7514 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7515     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7516     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7517     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7518     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7519     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7520     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7521     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7522     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7523     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7524     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7525     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7526     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
7527 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7528     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7529     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,
7530     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7531   typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7532       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7533       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
7534 };
7535 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7536     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7537     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7538     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7539     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7540     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7541     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7542     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7543     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7544     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7545     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7546     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7547     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7548     GTEST_TEMPLATE_ T40>
7549 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7550     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7551     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,
7552     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7553   typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7554       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7555       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;
7556 };
7557 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7558     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7559     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7560     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7561     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7562     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7563     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7564     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7565     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7566     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7567     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7568     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7569     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7570     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
7571 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7572     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7573     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,
7574     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7575   typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7576       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7577       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
7578       T41> type;
7579 };
7580 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7581     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7582     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7583     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7584     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7585     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7586     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7587     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7588     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7589     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7590     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7591     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7592     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7593     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
7594 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7595     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7596     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,
7597     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7598   typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7599       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7600       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7601       T42> type;
7602 };
7603 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7604     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7605     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7606     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7607     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7608     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7609     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7610     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7611     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7612     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7613     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7614     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7615     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7616     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7617     GTEST_TEMPLATE_ T43>
7618 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7619     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7620     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
7621     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7622   typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7623       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7624       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7625       T42, T43> type;
7626 };
7627 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7628     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7629     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7630     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7631     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7632     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7633     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7634     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7635     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7636     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7637     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7638     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7639     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7640     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7641     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
7642 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7643     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7644     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7645     NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
7646   typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7647       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7648       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7649       T42, T43, T44> type;
7650 };
7651 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7652     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7653     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7654     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7655     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7656     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7657     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7658     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7659     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7660     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7661     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7662     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7663     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7664     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7665     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
7666 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7667     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7668     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7669     T45, NoneT, NoneT, NoneT, NoneT, NoneT> {
7670   typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7671       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7672       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7673       T42, T43, T44, T45> type;
7674 };
7675 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7676     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7677     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7678     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7679     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7680     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7681     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7682     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7683     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7684     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7685     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7686     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7687     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7688     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7689     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
7690     GTEST_TEMPLATE_ T46>
7691 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7692     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7693     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7694     T45, T46, NoneT, NoneT, NoneT, NoneT> {
7695   typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7696       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7697       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7698       T42, T43, T44, T45, T46> type;
7699 };
7700 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7701     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7702     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7703     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7704     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7705     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7706     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7707     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7708     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7709     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7710     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7711     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7712     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7713     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7714     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
7715     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
7716 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7717     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7718     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7719     T45, T46, T47, NoneT, NoneT, NoneT> {
7720   typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7721       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7722       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7723       T42, T43, T44, T45, T46, T47> type;
7724 };
7725 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7726     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7727     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7728     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7729     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7730     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7731     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7732     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7733     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7734     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7735     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7736     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7737     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7738     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7739     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
7740     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
7741 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7742     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7743     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7744     T45, T46, T47, T48, NoneT, NoneT> {
7745   typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7746       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7747       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7748       T42, T43, T44, T45, T46, T47, T48> type;
7749 };
7750 template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
7751     GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
7752     GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
7753     GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
7754     GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
7755     GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
7756     GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
7757     GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
7758     GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
7759     GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
7760     GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
7761     GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
7762     GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
7763     GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
7764     GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
7765     GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
7766     GTEST_TEMPLATE_ T49>
7767 struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
7768     T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
7769     T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
7770     T45, T46, T47, T48, T49, NoneT> {
7771   typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7772       T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
7773       T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
7774       T42, T43, T44, T45, T46, T47, T48, T49> type;
7775 };
7776
7777 // The TypeList template makes it possible to use either a single type
7778 // or a Types<...> list in TYPED_TEST_CASE() and
7779 // INSTANTIATE_TYPED_TEST_CASE_P().
7780
7781 template <typename T>
7782 struct TypeList {
7783   typedef Types1<T> type;
7784 };
7785
7786 template <typename T1, typename T2, typename T3, typename T4, typename T5,
7787     typename T6, typename T7, typename T8, typename T9, typename T10,
7788     typename T11, typename T12, typename T13, typename T14, typename T15,
7789     typename T16, typename T17, typename T18, typename T19, typename T20,
7790     typename T21, typename T22, typename T23, typename T24, typename T25,
7791     typename T26, typename T27, typename T28, typename T29, typename T30,
7792     typename T31, typename T32, typename T33, typename T34, typename T35,
7793     typename T36, typename T37, typename T38, typename T39, typename T40,
7794     typename T41, typename T42, typename T43, typename T44, typename T45,
7795     typename T46, typename T47, typename T48, typename T49, typename T50>
7796 struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
7797     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
7798     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
7799     T44, T45, T46, T47, T48, T49, T50> > {
7800   typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
7801       T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
7802       T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
7803       T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;
7804 };
7805
7806 #endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
7807
7808 }  // namespace internal
7809 }  // namespace testing
7810
7811 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
7812
7813 // Due to C++ preprocessor weirdness, we need double indirection to
7814 // concatenate two tokens when one of them is __LINE__.  Writing
7815 //
7816 //   foo ## __LINE__
7817 //
7818 // will result in the token foo__LINE__, instead of foo followed by
7819 // the current line number.  For more details, see
7820 // http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
7821 #define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
7822 #define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
7823
7824 class ProtocolMessage;
7825 namespace proto2 { class Message; }
7826
7827 namespace testing {
7828
7829 // Forward declarations.
7830
7831 class AssertionResult;                 // Result of an assertion.
7832 class Message;                         // Represents a failure message.
7833 class Test;                            // Represents a test.
7834 class TestInfo;                        // Information about a test.
7835 class TestPartResult;                  // Result of a test part.
7836 class UnitTest;                        // A collection of test cases.
7837
7838 template <typename T>
7839 ::std::string PrintToString(const T& value);
7840
7841 namespace internal {
7842
7843 struct TraceInfo;                      // Information about a trace point.
7844 class ScopedTrace;                     // Implements scoped trace.
7845 class TestInfoImpl;                    // Opaque implementation of TestInfo
7846 class UnitTestImpl;                    // Opaque implementation of UnitTest
7847
7848 // The text used in failure messages to indicate the start of the
7849 // stack trace.
7850 GTEST_API_ extern const char kStackTraceMarker[];
7851
7852 // Two overloaded helpers for checking at compile time whether an
7853 // expression is a null pointer literal (i.e. NULL or any 0-valued
7854 // compile-time integral constant).  Their return values have
7855 // different sizes, so we can use sizeof() to test which version is
7856 // picked by the compiler.  These helpers have no implementations, as
7857 // we only need their signatures.
7858 //
7859 // Given IsNullLiteralHelper(x), the compiler will pick the first
7860 // version if x can be implicitly converted to Secret*, and pick the
7861 // second version otherwise.  Since Secret is a secret and incomplete
7862 // type, the only expression a user can write that has type Secret* is
7863 // a null pointer literal.  Therefore, we know that x is a null
7864 // pointer literal if and only if the first version is picked by the
7865 // compiler.
7866 char IsNullLiteralHelper(Secret* p);
7867 char (&IsNullLiteralHelper(...))[2];  // NOLINT
7868
7869 // A compile-time bool constant that is true if and only if x is a
7870 // null pointer literal (i.e. NULL or any 0-valued compile-time
7871 // integral constant).
7872 #ifdef GTEST_ELLIPSIS_NEEDS_POD_
7873 // We lose support for NULL detection where the compiler doesn't like
7874 // passing non-POD classes through ellipsis (...).
7875 # define GTEST_IS_NULL_LITERAL_(x) false
7876 #else
7877 # define GTEST_IS_NULL_LITERAL_(x) \
7878     (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
7879 #endif  // GTEST_ELLIPSIS_NEEDS_POD_
7880
7881 // Appends the user-supplied message to the Google-Test-generated message.
7882 GTEST_API_ std::string AppendUserMessage(
7883     const std::string& gtest_msg, const Message& user_msg);
7884
7885 #if GTEST_HAS_EXCEPTIONS
7886
7887 // This exception is thrown by (and only by) a failed Google Test
7888 // assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
7889 // are enabled).  We derive it from std::runtime_error, which is for
7890 // errors presumably detectable only at run time.  Since
7891 // std::runtime_error inherits from std::exception, many testing
7892 // frameworks know how to extract and print the message inside it.
7893 class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
7894  public:
7895   explicit GoogleTestFailureException(const TestPartResult& failure);
7896 };
7897
7898 #endif  // GTEST_HAS_EXCEPTIONS
7899
7900 // A helper class for creating scoped traces in user programs.
7901 class GTEST_API_ ScopedTrace {
7902  public:
7903   // The c'tor pushes the given source file location and message onto
7904   // a trace stack maintained by Google Test.
7905   ScopedTrace(const char* file, int line, const Message& message);
7906
7907   // The d'tor pops the info pushed by the c'tor.
7908   //
7909   // Note that the d'tor is not virtual in order to be efficient.
7910   // Don't inherit from ScopedTrace!
7911   ~ScopedTrace();
7912
7913  private:
7914   GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
7915 } GTEST_ATTRIBUTE_UNUSED_;  // A ScopedTrace object does its job in its
7916                             // c'tor and d'tor.  Therefore it doesn't
7917                             // need to be used otherwise.
7918
7919 namespace edit_distance {
7920 // Returns the optimal edits to go from 'left' to 'right'.
7921 // All edits cost the same, with replace having lower priority than
7922 // add/remove.
7923 // Simple implementation of the Wagner–Fischer algorithm.
7924 // See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm
7925 enum EditType { kMatch, kAdd, kRemove, kReplace };
7926 GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
7927     const std::vector<size_t>& left, const std::vector<size_t>& right);
7928
7929 // Same as above, but the input is represented as strings.
7930 GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
7931     const std::vector<std::string>& left,
7932     const std::vector<std::string>& right);
7933
7934 // Create a diff of the input strings in Unified diff format.
7935 GTEST_API_ std::string CreateUnifiedDiff(const std::vector<std::string>& left,
7936                                          const std::vector<std::string>& right,
7937                                          size_t context = 2);
7938
7939 }  // namespace edit_distance
7940
7941 // Calculate the diff between 'left' and 'right' and return it in unified diff
7942 // format.
7943 // If not null, stores in 'total_line_count' the total number of lines found
7944 // in left + right.
7945 GTEST_API_ std::string DiffStrings(const std::string& left,
7946                                    const std::string& right,
7947                                    size_t* total_line_count);
7948
7949 // Constructs and returns the message for an equality assertion
7950 // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
7951 //
7952 // The first four parameters are the expressions used in the assertion
7953 // and their values, as strings.  For example, for ASSERT_EQ(foo, bar)
7954 // where foo is 5 and bar is 6, we have:
7955 //
7956 //   expected_expression: "foo"
7957 //   actual_expression:   "bar"
7958 //   expected_value:      "5"
7959 //   actual_value:        "6"
7960 //
7961 // The ignoring_case parameter is true iff the assertion is a
7962 // *_STRCASEEQ*.  When it's true, the string " (ignoring case)" will
7963 // be inserted into the message.
7964 GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
7965                                      const char* actual_expression,
7966                                      const std::string& expected_value,
7967                                      const std::string& actual_value,
7968                                      bool ignoring_case);
7969
7970 // Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
7971 GTEST_API_ std::string GetBoolAssertionFailureMessage(
7972     const AssertionResult& assertion_result,
7973     const char* expression_text,
7974     const char* actual_predicate_value,
7975     const char* expected_predicate_value);
7976
7977 // This template class represents an IEEE floating-point number
7978 // (either single-precision or double-precision, depending on the
7979 // template parameters).
7980 //
7981 // The purpose of this class is to do more sophisticated number
7982 // comparison.  (Due to round-off error, etc, it's very unlikely that
7983 // two floating-points will be equal exactly.  Hence a naive
7984 // comparison by the == operation often doesn't work.)
7985 //
7986 // Format of IEEE floating-point:
7987 //
7988 //   The most-significant bit being the leftmost, an IEEE
7989 //   floating-point looks like
7990 //
7991 //     sign_bit exponent_bits fraction_bits
7992 //
7993 //   Here, sign_bit is a single bit that designates the sign of the
7994 //   number.
7995 //
7996 //   For float, there are 8 exponent bits and 23 fraction bits.
7997 //
7998 //   For double, there are 11 exponent bits and 52 fraction bits.
7999 //
8000 //   More details can be found at
8001 //   http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
8002 //
8003 // Template parameter:
8004 //
8005 //   RawType: the raw floating-point type (either float or double)
8006 template <typename RawType>
8007 class FloatingPoint {
8008  public:
8009   // Defines the unsigned integer type that has the same size as the
8010   // floating point number.
8011   typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;
8012
8013   // Constants.
8014
8015   // # of bits in a number.
8016   static const size_t kBitCount = 8*sizeof(RawType);
8017
8018   // # of fraction bits in a number.
8019   static const size_t kFractionBitCount =
8020     std::numeric_limits<RawType>::digits - 1;
8021
8022   // # of exponent bits in a number.
8023   static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
8024
8025   // The mask for the sign bit.
8026   static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
8027
8028   // The mask for the fraction bits.
8029   static const Bits kFractionBitMask =
8030     ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
8031
8032   // The mask for the exponent bits.
8033   static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
8034
8035   // How many ULP's (Units in the Last Place) we want to tolerate when
8036   // comparing two numbers.  The larger the value, the more error we
8037   // allow.  A 0 value means that two numbers must be exactly the same
8038   // to be considered equal.
8039   //
8040   // The maximum error of a single floating-point operation is 0.5
8041   // units in the last place.  On Intel CPU's, all floating-point
8042   // calculations are done with 80-bit precision, while double has 64
8043   // bits.  Therefore, 4 should be enough for ordinary use.
8044   //
8045   // See the following article for more details on ULP:
8046   // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
8047   static const size_t kMaxUlps = 4;
8048
8049   // Constructs a FloatingPoint from a raw floating-point number.
8050   //
8051   // On an Intel CPU, passing a non-normalized NAN (Not a Number)
8052   // around may change its bits, although the new value is guaranteed
8053   // to be also a NAN.  Therefore, don't expect this constructor to
8054   // preserve the bits in x when x is a NAN.
8055   explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
8056
8057   // Static methods
8058
8059   // Reinterprets a bit pattern as a floating-point number.
8060   //
8061   // This function is needed to test the AlmostEquals() method.
8062   static RawType ReinterpretBits(const Bits bits) {
8063     FloatingPoint fp(0);
8064     fp.u_.bits_ = bits;
8065     return fp.u_.value_;
8066   }
8067
8068   // Returns the floating-point number that represent positive infinity.
8069   static RawType Infinity() {
8070     return ReinterpretBits(kExponentBitMask);
8071   }
8072
8073   // Returns the maximum representable finite floating-point number.
8074   static RawType Max();
8075
8076   // Non-static methods
8077
8078   // Returns the bits that represents this number.
8079   const Bits &bits() const { return u_.bits_; }
8080
8081   // Returns the exponent bits of this number.
8082   Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
8083
8084   // Returns the fraction bits of this number.
8085   Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
8086
8087   // Returns the sign bit of this number.
8088   Bits sign_bit() const { return kSignBitMask & u_.bits_; }
8089
8090   // Returns true iff this is NAN (not a number).
8091   bool is_nan() const {
8092     // It's a NAN if the exponent bits are all ones and the fraction
8093     // bits are not entirely zeros.
8094     return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
8095   }
8096
8097   // Returns true iff this number is at most kMaxUlps ULP's away from
8098   // rhs.  In particular, this function:
8099   //
8100   //   - returns false if either number is (or both are) NAN.
8101   //   - treats really large numbers as almost equal to infinity.
8102   //   - thinks +0.0 and -0.0 are 0 DLP's apart.
8103   bool AlmostEquals(const FloatingPoint& rhs) const {
8104     // The IEEE standard says that any comparison operation involving
8105     // a NAN must return false.
8106     if (is_nan() || rhs.is_nan()) return false;
8107
8108     return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
8109         <= kMaxUlps;
8110   }
8111
8112  private:
8113   // The data type used to store the actual floating-point number.
8114   union FloatingPointUnion {
8115     RawType value_;  // The raw floating-point number.
8116     Bits bits_;      // The bits that represent the number.
8117   };
8118
8119   // Converts an integer from the sign-and-magnitude representation to
8120   // the biased representation.  More precisely, let N be 2 to the
8121   // power of (kBitCount - 1), an integer x is represented by the
8122   // unsigned number x + N.
8123   //
8124   // For instance,
8125   //
8126   //   -N + 1 (the most negative number representable using
8127   //          sign-and-magnitude) is represented by 1;
8128   //   0      is represented by N; and
8129   //   N - 1  (the biggest number representable using
8130   //          sign-and-magnitude) is represented by 2N - 1.
8131   //
8132   // Read http://en.wikipedia.org/wiki/Signed_number_representations
8133   // for more details on signed number representations.
8134   static Bits SignAndMagnitudeToBiased(const Bits &sam) {
8135     if (kSignBitMask & sam) {
8136       // sam represents a negative number.
8137       return ~sam + 1;
8138     } else {
8139       // sam represents a positive number.
8140       return kSignBitMask | sam;
8141     }
8142   }
8143
8144   // Given two numbers in the sign-and-magnitude representation,
8145   // returns the distance between them as an unsigned number.
8146   static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
8147                                                      const Bits &sam2) {
8148     const Bits biased1 = SignAndMagnitudeToBiased(sam1);
8149     const Bits biased2 = SignAndMagnitudeToBiased(sam2);
8150     return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
8151   }
8152
8153   FloatingPointUnion u_;
8154 };
8155
8156 // We cannot use std::numeric_limits<T>::max() as it clashes with the max()
8157 // macro defined by <windows.h>.
8158 template <>
8159 inline float FloatingPoint<float>::Max() { return FLT_MAX; }
8160 template <>
8161 inline double FloatingPoint<double>::Max() { return DBL_MAX; }
8162
8163 // Typedefs the instances of the FloatingPoint template class that we
8164 // care to use.
8165 typedef FloatingPoint<float> Float;
8166 typedef FloatingPoint<double> Double;
8167
8168 // In order to catch the mistake of putting tests that use different
8169 // test fixture classes in the same test case, we need to assign
8170 // unique IDs to fixture classes and compare them.  The TypeId type is
8171 // used to hold such IDs.  The user should treat TypeId as an opaque
8172 // type: the only operation allowed on TypeId values is to compare
8173 // them for equality using the == operator.
8174 typedef const void* TypeId;
8175
8176 template <typename T>
8177 class TypeIdHelper {
8178  public:
8179   // dummy_ must not have a const type.  Otherwise an overly eager
8180   // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
8181   // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
8182   static bool dummy_;
8183 };
8184
8185 template <typename T>
8186 bool TypeIdHelper<T>::dummy_ = false;
8187
8188 // GetTypeId<T>() returns the ID of type T.  Different values will be
8189 // returned for different types.  Calling the function twice with the
8190 // same type argument is guaranteed to return the same ID.
8191 template <typename T>
8192 TypeId GetTypeId() {
8193   // The compiler is required to allocate a different
8194   // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
8195   // the template.  Therefore, the address of dummy_ is guaranteed to
8196   // be unique.
8197   return &(TypeIdHelper<T>::dummy_);
8198 }
8199
8200 // Returns the type ID of ::testing::Test.  Always call this instead
8201 // of GetTypeId< ::testing::Test>() to get the type ID of
8202 // ::testing::Test, as the latter may give the wrong result due to a
8203 // suspected linker bug when compiling Google Test as a Mac OS X
8204 // framework.
8205 GTEST_API_ TypeId GetTestTypeId();
8206
8207 // Defines the abstract factory interface that creates instances
8208 // of a Test object.
8209 class TestFactoryBase {
8210  public:
8211   virtual ~TestFactoryBase() {}
8212
8213   // Creates a test instance to run. The instance is both created and destroyed
8214   // within TestInfoImpl::Run()
8215   virtual Test* CreateTest() = 0;
8216
8217  protected:
8218   TestFactoryBase() {}
8219
8220  private:
8221   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
8222 };
8223
8224 // This class provides implementation of TeastFactoryBase interface.
8225 // It is used in TEST and TEST_F macros.
8226 template <class TestClass>
8227 class TestFactoryImpl : public TestFactoryBase {
8228  public:
8229   virtual Test* CreateTest() { return new TestClass; }
8230 };
8231
8232 #if GTEST_OS_WINDOWS
8233
8234 // Predicate-formatters for implementing the HRESULT checking macros
8235 // {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
8236 // We pass a long instead of HRESULT to avoid causing an
8237 // include dependency for the HRESULT type.
8238 GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
8239                                             long hr);  // NOLINT
8240 GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
8241                                             long hr);  // NOLINT
8242
8243 #endif  // GTEST_OS_WINDOWS
8244
8245 // Types of SetUpTestCase() and TearDownTestCase() functions.
8246 typedef void (*SetUpTestCaseFunc)();
8247 typedef void (*TearDownTestCaseFunc)();
8248
8249 struct CodeLocation {
8250   CodeLocation(const string& a_file, int a_line) : file(a_file), line(a_line) {}
8251
8252   string file;
8253   int line;
8254 };
8255
8256 // Creates a new TestInfo object and registers it with Google Test;
8257 // returns the created object.
8258 //
8259 // Arguments:
8260 //
8261 //   test_case_name:   name of the test case
8262 //   name:             name of the test
8263 //   type_param        the name of the test's type parameter, or NULL if
8264 //                     this is not a typed or a type-parameterized test.
8265 //   value_param       text representation of the test's value parameter,
8266 //                     or NULL if this is not a type-parameterized test.
8267 //   code_location:    code location where the test is defined
8268 //   fixture_class_id: ID of the test fixture class
8269 //   set_up_tc:        pointer to the function that sets up the test case
8270 //   tear_down_tc:     pointer to the function that tears down the test case
8271 //   factory:          pointer to the factory that creates a test object.
8272 //                     The newly created TestInfo instance will assume
8273 //                     ownership of the factory object.
8274 GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
8275     const char* test_case_name,
8276     const char* name,
8277     const char* type_param,
8278     const char* value_param,
8279     CodeLocation code_location,
8280     TypeId fixture_class_id,
8281     SetUpTestCaseFunc set_up_tc,
8282     TearDownTestCaseFunc tear_down_tc,
8283     TestFactoryBase* factory);
8284
8285 // If *pstr starts with the given prefix, modifies *pstr to be right
8286 // past the prefix and returns true; otherwise leaves *pstr unchanged
8287 // and returns false.  None of pstr, *pstr, and prefix can be NULL.
8288 GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
8289
8290 #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
8291
8292 // State of the definition of a type-parameterized test case.
8293 class GTEST_API_ TypedTestCasePState {
8294  public:
8295   TypedTestCasePState() : registered_(false) {}
8296
8297   // Adds the given test name to defined_test_names_ and return true
8298   // if the test case hasn't been registered; otherwise aborts the
8299   // program.
8300   bool AddTestName(const char* file, int line, const char* case_name,
8301                    const char* test_name) {
8302     if (registered_) {
8303       fprintf(stderr, "%s Test %s must be defined before "
8304               "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
8305               FormatFileLocation(file, line).c_str(), test_name, case_name);
8306       fflush(stderr);
8307       posix::Abort();
8308     }
8309     registered_tests_.insert(
8310         ::std::make_pair(test_name, CodeLocation(file, line)));
8311     return true;
8312   }
8313
8314   bool TestExists(const std::string& test_name) const {
8315     return registered_tests_.count(test_name) > 0;
8316   }
8317
8318   const CodeLocation& GetCodeLocation(const std::string& test_name) const {
8319     RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name);
8320     GTEST_CHECK_(it != registered_tests_.end());
8321     return it->second;
8322   }
8323
8324   // Verifies that registered_tests match the test names in
8325   // defined_test_names_; returns registered_tests if successful, or
8326   // aborts the program otherwise.
8327   const char* VerifyRegisteredTestNames(
8328       const char* file, int line, const char* registered_tests);
8329
8330  private:
8331   typedef ::std::map<std::string, CodeLocation> RegisteredTestsMap;
8332
8333   bool registered_;
8334   RegisteredTestsMap registered_tests_;
8335 };
8336
8337 // Skips to the first non-space char after the first comma in 'str';
8338 // returns NULL if no comma is found in 'str'.
8339 inline const char* SkipComma(const char* str) {
8340   const char* comma = strchr(str, ',');
8341   if (comma == NULL) {
8342     return NULL;
8343   }
8344   while (IsSpace(*(++comma))) {}
8345   return comma;
8346 }
8347
8348 // Returns the prefix of 'str' before the first comma in it; returns
8349 // the entire string if it contains no comma.
8350 inline std::string GetPrefixUntilComma(const char* str) {
8351   const char* comma = strchr(str, ',');
8352   return comma == NULL ? str : std::string(str, comma);
8353 }
8354
8355 // Splits a given string on a given delimiter, populating a given
8356 // vector with the fields.
8357 void SplitString(const ::std::string& str, char delimiter,
8358                  ::std::vector< ::std::string>* dest);
8359
8360 // TypeParameterizedTest<Fixture, TestSel, Types>::Register()
8361 // registers a list of type-parameterized tests with Google Test.  The
8362 // return value is insignificant - we just need to return something
8363 // such that we can call this function in a namespace scope.
8364 //
8365 // Implementation note: The GTEST_TEMPLATE_ macro declares a template
8366 // template parameter.  It's defined in gtest-type-util.h.
8367 template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
8368 class TypeParameterizedTest {
8369  public:
8370   // 'index' is the index of the test in the type list 'Types'
8371   // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,
8372   // Types).  Valid values for 'index' are [0, N - 1] where N is the
8373   // length of Types.
8374   static bool Register(const char* prefix,
8375                        CodeLocation code_location,
8376                        const char* case_name, const char* test_names,
8377                        int index) {
8378     typedef typename Types::Head Type;
8379     typedef Fixture<Type> FixtureClass;
8380     typedef typename GTEST_BIND_(TestSel, Type) TestClass;
8381
8382     // First, registers the first type-parameterized test in the type
8383     // list.
8384     MakeAndRegisterTestInfo(
8385         (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/"
8386          + StreamableToString(index)).c_str(),
8387         StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(),
8388         GetTypeName<Type>().c_str(),
8389         NULL,  // No value parameter.
8390         code_location,
8391         GetTypeId<FixtureClass>(),
8392         TestClass::SetUpTestCase,
8393         TestClass::TearDownTestCase,
8394         new TestFactoryImpl<TestClass>);
8395
8396     // Next, recurses (at compile time) with the tail of the type list.
8397     return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>
8398         ::Register(prefix, code_location, case_name, test_names, index + 1);
8399   }
8400 };
8401
8402 // The base case for the compile time recursion.
8403 template <GTEST_TEMPLATE_ Fixture, class TestSel>
8404 class TypeParameterizedTest<Fixture, TestSel, Types0> {
8405  public:
8406   static bool Register(const char* /*prefix*/, CodeLocation,
8407                        const char* /*case_name*/, const char* /*test_names*/,
8408                        int /*index*/) {
8409     return true;
8410   }
8411 };
8412
8413 // TypeParameterizedTestCase<Fixture, Tests, Types>::Register()
8414 // registers *all combinations* of 'Tests' and 'Types' with Google
8415 // Test.  The return value is insignificant - we just need to return
8416 // something such that we can call this function in a namespace scope.
8417 template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
8418 class TypeParameterizedTestCase {
8419  public:
8420   static bool Register(const char* prefix, CodeLocation code_location,
8421                        const TypedTestCasePState* state,
8422                        const char* case_name, const char* test_names) {
8423     std::string test_name = StripTrailingSpaces(
8424         GetPrefixUntilComma(test_names));
8425     if (!state->TestExists(test_name)) {
8426       fprintf(stderr, "Failed to get code location for test %s.%s at %s.",
8427               case_name, test_name.c_str(),
8428               FormatFileLocation(code_location.file.c_str(),
8429                                  code_location.line).c_str());
8430       fflush(stderr);
8431       posix::Abort();
8432     }
8433     const CodeLocation& test_location = state->GetCodeLocation(test_name);
8434
8435     typedef typename Tests::Head Head;
8436
8437     // First, register the first test in 'Test' for each type in 'Types'.
8438     TypeParameterizedTest<Fixture, Head, Types>::Register(
8439         prefix, test_location, case_name, test_names, 0);
8440
8441     // Next, recurses (at compile time) with the tail of the test list.
8442     return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>
8443         ::Register(prefix, code_location, state,
8444                    case_name, SkipComma(test_names));
8445   }
8446 };
8447
8448 // The base case for the compile time recursion.
8449 template <GTEST_TEMPLATE_ Fixture, typename Types>
8450 class TypeParameterizedTestCase<Fixture, Templates0, Types> {
8451  public:
8452   static bool Register(const char* /*prefix*/, CodeLocation,
8453                        const TypedTestCasePState* /*state*/,
8454                        const char* /*case_name*/, const char* /*test_names*/) {
8455     return true;
8456   }
8457 };
8458
8459 #endif  // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
8460
8461 // Returns the current OS stack trace as an std::string.
8462 //
8463 // The maximum number of stack frames to be included is specified by
8464 // the gtest_stack_trace_depth flag.  The skip_count parameter
8465 // specifies the number of top frames to be skipped, which doesn't
8466 // count against the number of frames to be included.
8467 //
8468 // For example, if Foo() calls Bar(), which in turn calls
8469 // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
8470 // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
8471 GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(
8472     UnitTest* unit_test, int skip_count);
8473
8474 // Helpers for suppressing warnings on unreachable code or constant
8475 // condition.
8476
8477 // Always returns true.
8478 GTEST_API_ bool AlwaysTrue();
8479
8480 // Always returns false.
8481 inline bool AlwaysFalse() { return !AlwaysTrue(); }
8482
8483 // Helper for suppressing false warning from Clang on a const char*
8484 // variable declared in a conditional expression always being NULL in
8485 // the else branch.
8486 struct GTEST_API_ ConstCharPtr {
8487   ConstCharPtr(const char* str) : value(str) {}
8488   operator bool() const { return true; }
8489   const char* value;
8490 };
8491
8492 // A simple Linear Congruential Generator for generating random
8493 // numbers with a uniform distribution.  Unlike rand() and srand(), it
8494 // doesn't use global state (and therefore can't interfere with user
8495 // code).  Unlike rand_r(), it's portable.  An LCG isn't very random,
8496 // but it's good enough for our purposes.
8497 class GTEST_API_ Random {
8498  public:
8499   static const UInt32 kMaxRange = 1u << 31;
8500
8501   explicit Random(UInt32 seed) : state_(seed) {}
8502
8503   void Reseed(UInt32 seed) { state_ = seed; }
8504
8505   // Generates a random number from [0, range).  Crashes if 'range' is
8506   // 0 or greater than kMaxRange.
8507   UInt32 Generate(UInt32 range);
8508
8509  private:
8510   UInt32 state_;
8511   GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
8512 };
8513
8514 // Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a
8515 // compiler error iff T1 and T2 are different types.
8516 template <typename T1, typename T2>
8517 struct CompileAssertTypesEqual;
8518
8519 template <typename T>
8520 struct CompileAssertTypesEqual<T, T> {
8521 };
8522
8523 // Removes the reference from a type if it is a reference type,
8524 // otherwise leaves it unchanged.  This is the same as
8525 // tr1::remove_reference, which is not widely available yet.
8526 template <typename T>
8527 struct RemoveReference { typedef T type; };  // NOLINT
8528 template <typename T>
8529 struct RemoveReference<T&> { typedef T type; };  // NOLINT
8530
8531 // A handy wrapper around RemoveReference that works when the argument
8532 // T depends on template parameters.
8533 #define GTEST_REMOVE_REFERENCE_(T) \
8534     typename ::testing::internal::RemoveReference<T>::type
8535
8536 // Removes const from a type if it is a const type, otherwise leaves
8537 // it unchanged.  This is the same as tr1::remove_const, which is not
8538 // widely available yet.
8539 template <typename T>
8540 struct RemoveConst { typedef T type; };  // NOLINT
8541 template <typename T>
8542 struct RemoveConst<const T> { typedef T type; };  // NOLINT
8543
8544 // MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above
8545 // definition to fail to remove the const in 'const int[3]' and 'const
8546 // char[3][4]'.  The following specialization works around the bug.
8547 template <typename T, size_t N>
8548 struct RemoveConst<const T[N]> {
8549   typedef typename RemoveConst<T>::type type[N];
8550 };
8551
8552 #if defined(_MSC_VER) && _MSC_VER < 1400
8553 // This is the only specialization that allows VC++ 7.1 to remove const in
8554 // 'const int[3] and 'const int[3][4]'.  However, it causes trouble with GCC
8555 // and thus needs to be conditionally compiled.
8556 template <typename T, size_t N>
8557 struct RemoveConst<T[N]> {
8558   typedef typename RemoveConst<T>::type type[N];
8559 };
8560 #endif
8561
8562 // A handy wrapper around RemoveConst that works when the argument
8563 // T depends on template parameters.
8564 #define GTEST_REMOVE_CONST_(T) \
8565     typename ::testing::internal::RemoveConst<T>::type
8566
8567 // Turns const U&, U&, const U, and U all into U.
8568 #define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
8569     GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))
8570
8571 // Adds reference to a type if it is not a reference type,
8572 // otherwise leaves it unchanged.  This is the same as
8573 // tr1::add_reference, which is not widely available yet.
8574 template <typename T>
8575 struct AddReference { typedef T& type; };  // NOLINT
8576 template <typename T>
8577 struct AddReference<T&> { typedef T& type; };  // NOLINT
8578
8579 // A handy wrapper around AddReference that works when the argument T
8580 // depends on template parameters.
8581 #define GTEST_ADD_REFERENCE_(T) \
8582     typename ::testing::internal::AddReference<T>::type
8583
8584 // Adds a reference to const on top of T as necessary.  For example,
8585 // it transforms
8586 //
8587 //   char         ==> const char&
8588 //   const char   ==> const char&
8589 //   char&        ==> const char&
8590 //   const char&  ==> const char&
8591 //
8592 // The argument T must depend on some template parameters.
8593 #define GTEST_REFERENCE_TO_CONST_(T) \
8594     GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T))
8595
8596 // ImplicitlyConvertible<From, To>::value is a compile-time bool
8597 // constant that's true iff type From can be implicitly converted to
8598 // type To.
8599 template <typename From, typename To>
8600 class ImplicitlyConvertible {
8601  private:
8602   // We need the following helper functions only for their types.
8603   // They have no implementations.
8604
8605   // MakeFrom() is an expression whose type is From.  We cannot simply
8606   // use From(), as the type From may not have a public default
8607   // constructor.
8608   static typename AddReference<From>::type MakeFrom();
8609
8610   // These two functions are overloaded.  Given an expression
8611   // Helper(x), the compiler will pick the first version if x can be
8612   // implicitly converted to type To; otherwise it will pick the
8613   // second version.
8614   //
8615   // The first version returns a value of size 1, and the second
8616   // version returns a value of size 2.  Therefore, by checking the
8617   // size of Helper(x), which can be done at compile time, we can tell
8618   // which version of Helper() is used, and hence whether x can be
8619   // implicitly converted to type To.
8620   static char Helper(To);
8621   static char (&Helper(...))[2];  // NOLINT
8622
8623   // We have to put the 'public' section after the 'private' section,
8624   // or MSVC refuses to compile the code.
8625  public:
8626 #if defined(__BORLANDC__)
8627   // C++Builder cannot use member overload resolution during template
8628   // instantiation.  The simplest workaround is to use its C++0x type traits
8629   // functions (C++Builder 2009 and above only).
8630   static const bool value = __is_convertible(From, To);
8631 #else
8632   // MSVC warns about implicitly converting from double to int for
8633   // possible loss of data, so we need to temporarily disable the
8634   // warning.
8635   GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244)
8636   static const bool value =
8637       sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
8638   GTEST_DISABLE_MSC_WARNINGS_POP_()
8639 #endif  // __BORLANDC__
8640 };
8641 template <typename From, typename To>
8642 const bool ImplicitlyConvertible<From, To>::value;
8643
8644 // IsAProtocolMessage<T>::value is a compile-time bool constant that's
8645 // true iff T is type ProtocolMessage, proto2::Message, or a subclass
8646 // of those.
8647 template <typename T>
8648 struct IsAProtocolMessage
8649     : public bool_constant<
8650   ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value ||
8651   ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> {
8652 };
8653
8654 // When the compiler sees expression IsContainerTest<C>(0), if C is an
8655 // STL-style container class, the first overload of IsContainerTest
8656 // will be viable (since both C::iterator* and C::const_iterator* are
8657 // valid types and NULL can be implicitly converted to them).  It will
8658 // be picked over the second overload as 'int' is a perfect match for
8659 // the type of argument 0.  If C::iterator or C::const_iterator is not
8660 // a valid type, the first overload is not viable, and the second
8661 // overload will be picked.  Therefore, we can determine whether C is
8662 // a container class by checking the type of IsContainerTest<C>(0).
8663 // The value of the expression is insignificant.
8664 //
8665 // Note that we look for both C::iterator and C::const_iterator.  The
8666 // reason is that C++ injects the name of a class as a member of the
8667 // class itself (e.g. you can refer to class iterator as either
8668 // 'iterator' or 'iterator::iterator').  If we look for C::iterator
8669 // only, for example, we would mistakenly think that a class named
8670 // iterator is an STL container.
8671 //
8672 // Also note that the simpler approach of overloading
8673 // IsContainerTest(typename C::const_iterator*) and
8674 // IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
8675 typedef int IsContainer;
8676 template <class C>
8677 IsContainer IsContainerTest(int /* dummy */,
8678                             typename C::iterator* /* it */ = NULL,
8679                             typename C::const_iterator* /* const_it */ = NULL) {
8680   return 0;
8681 }
8682
8683 typedef char IsNotContainer;
8684 template <class C>
8685 IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
8686
8687 // EnableIf<condition>::type is void when 'Cond' is true, and
8688 // undefined when 'Cond' is false.  To use SFINAE to make a function
8689 // overload only apply when a particular expression is true, add
8690 // "typename EnableIf<expression>::type* = 0" as the last parameter.
8691 template<bool> struct EnableIf;
8692 template<> struct EnableIf<true> { typedef void type; };  // NOLINT
8693
8694 // Utilities for native arrays.
8695
8696 // ArrayEq() compares two k-dimensional native arrays using the
8697 // elements' operator==, where k can be any integer >= 0.  When k is
8698 // 0, ArrayEq() degenerates into comparing a single pair of values.
8699
8700 template <typename T, typename U>
8701 bool ArrayEq(const T* lhs, size_t size, const U* rhs);
8702
8703 // This generic version is used when k is 0.
8704 template <typename T, typename U>
8705 inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
8706
8707 // This overload is used when k >= 1.
8708 template <typename T, typename U, size_t N>
8709 inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
8710   return internal::ArrayEq(lhs, N, rhs);
8711 }
8712
8713 // This helper reduces code bloat.  If we instead put its logic inside
8714 // the previous ArrayEq() function, arrays with different sizes would
8715 // lead to different copies of the template code.
8716 template <typename T, typename U>
8717 bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
8718   for (size_t i = 0; i != size; i++) {
8719     if (!internal::ArrayEq(lhs[i], rhs[i]))
8720       return false;
8721   }
8722   return true;
8723 }
8724
8725 // Finds the first element in the iterator range [begin, end) that
8726 // equals elem.  Element may be a native array type itself.
8727 template <typename Iter, typename Element>
8728 Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
8729   for (Iter it = begin; it != end; ++it) {
8730     if (internal::ArrayEq(*it, elem))
8731       return it;
8732   }
8733   return end;
8734 }
8735
8736 // CopyArray() copies a k-dimensional native array using the elements'
8737 // operator=, where k can be any integer >= 0.  When k is 0,
8738 // CopyArray() degenerates into copying a single value.
8739
8740 template <typename T, typename U>
8741 void CopyArray(const T* from, size_t size, U* to);
8742
8743 // This generic version is used when k is 0.
8744 template <typename T, typename U>
8745 inline void CopyArray(const T& from, U* to) { *to = from; }
8746
8747 // This overload is used when k >= 1.
8748 template <typename T, typename U, size_t N>
8749 inline void CopyArray(const T(&from)[N], U(*to)[N]) {
8750   internal::CopyArray(from, N, *to);
8751 }
8752
8753 // This helper reduces code bloat.  If we instead put its logic inside
8754 // the previous CopyArray() function, arrays with different sizes
8755 // would lead to different copies of the template code.
8756 template <typename T, typename U>
8757 void CopyArray(const T* from, size_t size, U* to) {
8758   for (size_t i = 0; i != size; i++) {
8759     internal::CopyArray(from[i], to + i);
8760   }
8761 }
8762
8763 // The relation between an NativeArray object (see below) and the
8764 // native array it represents.
8765 // We use 2 different structs to allow non-copyable types to be used, as long
8766 // as RelationToSourceReference() is passed.
8767 struct RelationToSourceReference {};
8768 struct RelationToSourceCopy {};
8769
8770 // Adapts a native array to a read-only STL-style container.  Instead
8771 // of the complete STL container concept, this adaptor only implements
8772 // members useful for Google Mock's container matchers.  New members
8773 // should be added as needed.  To simplify the implementation, we only
8774 // support Element being a raw type (i.e. having no top-level const or
8775 // reference modifier).  It's the client's responsibility to satisfy
8776 // this requirement.  Element can be an array type itself (hence
8777 // multi-dimensional arrays are supported).
8778 template <typename Element>
8779 class NativeArray {
8780  public:
8781   // STL-style container typedefs.
8782   typedef Element value_type;
8783   typedef Element* iterator;
8784   typedef const Element* const_iterator;
8785
8786   // Constructs from a native array. References the source.
8787   NativeArray(const Element* array, size_t count, RelationToSourceReference) {
8788     InitRef(array, count);
8789   }
8790
8791   // Constructs from a native array. Copies the source.
8792   NativeArray(const Element* array, size_t count, RelationToSourceCopy) {
8793     InitCopy(array, count);
8794   }
8795
8796   // Copy constructor.
8797   NativeArray(const NativeArray& rhs) {
8798     (this->*rhs.clone_)(rhs.array_, rhs.size_);
8799   }
8800
8801   ~NativeArray() {
8802     if (clone_ != &NativeArray::InitRef)
8803       delete[] array_;
8804   }
8805
8806   // STL-style container methods.
8807   size_t size() const { return size_; }
8808   const_iterator begin() const { return array_; }
8809   const_iterator end() const { return array_ + size_; }
8810   bool operator==(const NativeArray& rhs) const {
8811     return size() == rhs.size() &&
8812         ArrayEq(begin(), size(), rhs.begin());
8813   }
8814
8815  private:
8816   enum {
8817     kCheckTypeIsNotConstOrAReference = StaticAssertTypeEqHelper<
8818         Element, GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>::value,
8819   };
8820
8821   // Initializes this object with a copy of the input.
8822   void InitCopy(const Element* array, size_t a_size) {
8823     Element* const copy = new Element[a_size];
8824     CopyArray(array, a_size, copy);
8825     array_ = copy;
8826     size_ = a_size;
8827     clone_ = &NativeArray::InitCopy;
8828   }
8829
8830   // Initializes this object with a reference of the input.
8831   void InitRef(const Element* array, size_t a_size) {
8832     array_ = array;
8833     size_ = a_size;
8834     clone_ = &NativeArray::InitRef;
8835   }
8836
8837   const Element* array_;
8838   size_t size_;
8839   void (NativeArray::*clone_)(const Element*, size_t);
8840
8841   GTEST_DISALLOW_ASSIGN_(NativeArray);
8842 };
8843
8844 }  // namespace internal
8845 }  // namespace testing
8846
8847 #define GTEST_MESSAGE_AT_(file, line, message, result_type) \
8848   ::testing::internal::AssertHelper(result_type, file, line, message) \
8849     = ::testing::Message()
8850
8851 #define GTEST_MESSAGE_(message, result_type) \
8852   GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
8853
8854 #define GTEST_FATAL_FAILURE_(message) \
8855   return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
8856
8857 #define GTEST_NONFATAL_FAILURE_(message) \
8858   GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
8859
8860 #define GTEST_SUCCESS_(message) \
8861   GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
8862
8863 // Suppresses MSVC warnings 4072 (unreachable code) for the code following
8864 // statement if it returns or throws (or doesn't return or throw in some
8865 // situations).
8866 #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
8867   if (::testing::internal::AlwaysTrue()) { statement; }
8868
8869 #define GTEST_TEST_THROW_(statement, expected_exception, fail) \
8870   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8871   if (::testing::internal::ConstCharPtr gtest_msg = "") { \
8872     bool gtest_caught_expected = false; \
8873     try { \
8874       GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8875     } \
8876     catch (expected_exception const&) { \
8877       gtest_caught_expected = true; \
8878     } \
8879     catch (...) { \
8880       gtest_msg.value = \
8881           "Expected: " #statement " throws an exception of type " \
8882           #expected_exception ".\n  Actual: it throws a different type."; \
8883       goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
8884     } \
8885     if (!gtest_caught_expected) { \
8886       gtest_msg.value = \
8887           "Expected: " #statement " throws an exception of type " \
8888           #expected_exception ".\n  Actual: it throws nothing."; \
8889       goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
8890     } \
8891   } else \
8892     GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
8893       fail(gtest_msg.value)
8894
8895 #define GTEST_TEST_NO_THROW_(statement, fail) \
8896   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8897   if (::testing::internal::AlwaysTrue()) { \
8898     try { \
8899       GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8900     } \
8901     catch (...) { \
8902       goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
8903     } \
8904   } else \
8905     GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
8906       fail("Expected: " #statement " doesn't throw an exception.\n" \
8907            "  Actual: it throws.")
8908
8909 #define GTEST_TEST_ANY_THROW_(statement, fail) \
8910   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8911   if (::testing::internal::AlwaysTrue()) { \
8912     bool gtest_caught_any = false; \
8913     try { \
8914       GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8915     } \
8916     catch (...) { \
8917       gtest_caught_any = true; \
8918     } \
8919     if (!gtest_caught_any) { \
8920       goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
8921     } \
8922   } else \
8923     GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
8924       fail("Expected: " #statement " throws an exception.\n" \
8925            "  Actual: it doesn't.")
8926
8927
8928 // Implements Boolean test assertions such as EXPECT_TRUE. expression can be
8929 // either a boolean expression or an AssertionResult. text is a textual
8930 // represenation of expression as it was passed into the EXPECT_TRUE.
8931 #define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
8932   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8933   if (const ::testing::AssertionResult gtest_ar_ = \
8934       ::testing::AssertionResult(expression)) \
8935     ; \
8936   else \
8937     fail(::testing::internal::GetBoolAssertionFailureMessage(\
8938         gtest_ar_, text, #actual, #expected).c_str())
8939
8940 #define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
8941   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
8942   if (::testing::internal::AlwaysTrue()) { \
8943     ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
8944     GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
8945     if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
8946       goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
8947     } \
8948   } else \
8949     GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
8950       fail("Expected: " #statement " doesn't generate new fatal " \
8951            "failures in the current thread.\n" \
8952            "  Actual: it does.")
8953
8954 // Expands to the name of the class that implements the given test.
8955 #define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
8956   test_case_name##_##test_name##_Test
8957
8958 // Helper macro for defining tests.
8959 #define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
8960 class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
8961  public:\
8962   GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
8963  private:\
8964   virtual void TestBody();\
8965   static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
8966   GTEST_DISALLOW_COPY_AND_ASSIGN_(\
8967       GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
8968 };\
8969 \
8970 ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
8971   ::test_info_ =\
8972     ::testing::internal::MakeAndRegisterTestInfo(\
8973         #test_case_name, #test_name, NULL, NULL, \
8974         ::testing::internal::CodeLocation(__FILE__, __LINE__), \
8975         (parent_id), \
8976         parent_class::SetUpTestCase, \
8977         parent_class::TearDownTestCase, \
8978         new ::testing::internal::TestFactoryImpl<\
8979             GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
8980 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
8981
8982 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
8983
8984 // Copyright 2005, Google Inc.
8985 // All rights reserved.
8986 //
8987 // Redistribution and use in source and binary forms, with or without
8988 // modification, are permitted provided that the following conditions are
8989 // met:
8990 //
8991 //     * Redistributions of source code must retain the above copyright
8992 // notice, this list of conditions and the following disclaimer.
8993 //     * Redistributions in binary form must reproduce the above
8994 // copyright notice, this list of conditions and the following disclaimer
8995 // in the documentation and/or other materials provided with the
8996 // distribution.
8997 //     * Neither the name of Google Inc. nor the names of its
8998 // contributors may be used to endorse or promote products derived from
8999 // this software without specific prior written permission.
9000 //
9001 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9002 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9003 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9004 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9005 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9006 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9007 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9008 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9009 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9010 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9011 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9012 //
9013 // Author: wan@google.com (Zhanyong Wan)
9014 //
9015 // The Google C++ Testing Framework (Google Test)
9016 //
9017 // This header file defines the public API for death tests.  It is
9018 // #included by gtest.h so a user doesn't need to include this
9019 // directly.
9020
9021 #ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
9022 #define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
9023
9024 // Copyright 2005, Google Inc.
9025 // All rights reserved.
9026 //
9027 // Redistribution and use in source and binary forms, with or without
9028 // modification, are permitted provided that the following conditions are
9029 // met:
9030 //
9031 //     * Redistributions of source code must retain the above copyright
9032 // notice, this list of conditions and the following disclaimer.
9033 //     * Redistributions in binary form must reproduce the above
9034 // copyright notice, this list of conditions and the following disclaimer
9035 // in the documentation and/or other materials provided with the
9036 // distribution.
9037 //     * Neither the name of Google Inc. nor the names of its
9038 // contributors may be used to endorse or promote products derived from
9039 // this software without specific prior written permission.
9040 //
9041 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9042 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9043 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9044 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9045 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9046 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9047 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9048 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9049 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9050 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9051 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9052 //
9053 // Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
9054 //
9055 // The Google C++ Testing Framework (Google Test)
9056 //
9057 // This header file defines internal utilities needed for implementing
9058 // death tests.  They are subject to change without notice.
9059
9060 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
9061 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
9062
9063
9064 #include <stdio.h>
9065
9066 namespace testing {
9067 namespace internal {
9068
9069 GTEST_DECLARE_string_(internal_run_death_test);
9070
9071 // Names of the flags (needed for parsing Google Test flags).
9072 const char kDeathTestStyleFlag[] = "death_test_style";
9073 const char kDeathTestUseFork[] = "death_test_use_fork";
9074 const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
9075
9076 #if GTEST_HAS_DEATH_TEST
9077
9078 // DeathTest is a class that hides much of the complexity of the
9079 // GTEST_DEATH_TEST_ macro.  It is abstract; its static Create method
9080 // returns a concrete class that depends on the prevailing death test
9081 // style, as defined by the --gtest_death_test_style and/or
9082 // --gtest_internal_run_death_test flags.
9083
9084 // In describing the results of death tests, these terms are used with
9085 // the corresponding definitions:
9086 //
9087 // exit status:  The integer exit information in the format specified
9088 //               by wait(2)
9089 // exit code:    The integer code passed to exit(3), _exit(2), or
9090 //               returned from main()
9091 class GTEST_API_ DeathTest {
9092  public:
9093   // Create returns false if there was an error determining the
9094   // appropriate action to take for the current death test; for example,
9095   // if the gtest_death_test_style flag is set to an invalid value.
9096   // The LastMessage method will return a more detailed message in that
9097   // case.  Otherwise, the DeathTest pointer pointed to by the "test"
9098   // argument is set.  If the death test should be skipped, the pointer
9099   // is set to NULL; otherwise, it is set to the address of a new concrete
9100   // DeathTest object that controls the execution of the current test.
9101   static bool Create(const char* statement, const RE* regex,
9102                      const char* file, int line, DeathTest** test);
9103   DeathTest();
9104   virtual ~DeathTest() { }
9105
9106   // A helper class that aborts a death test when it's deleted.
9107   class ReturnSentinel {
9108    public:
9109     explicit ReturnSentinel(DeathTest* test) : test_(test) { }
9110     ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
9111    private:
9112     DeathTest* const test_;
9113     GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
9114   } GTEST_ATTRIBUTE_UNUSED_;
9115
9116   // An enumeration of possible roles that may be taken when a death
9117   // test is encountered.  EXECUTE means that the death test logic should
9118   // be executed immediately.  OVERSEE means that the program should prepare
9119   // the appropriate environment for a child process to execute the death
9120   // test, then wait for it to complete.
9121   enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
9122
9123   // An enumeration of the three reasons that a test might be aborted.
9124   enum AbortReason {
9125     TEST_ENCOUNTERED_RETURN_STATEMENT,
9126     TEST_THREW_EXCEPTION,
9127     TEST_DID_NOT_DIE
9128   };
9129
9130   // Assumes one of the above roles.
9131   virtual TestRole AssumeRole() = 0;
9132
9133   // Waits for the death test to finish and returns its status.
9134   virtual int Wait() = 0;
9135
9136   // Returns true if the death test passed; that is, the test process
9137   // exited during the test, its exit status matches a user-supplied
9138   // predicate, and its stderr output matches a user-supplied regular
9139   // expression.
9140   // The user-supplied predicate may be a macro expression rather
9141   // than a function pointer or functor, or else Wait and Passed could
9142   // be combined.
9143   virtual bool Passed(bool exit_status_ok) = 0;
9144
9145   // Signals that the death test did not die as expected.
9146   virtual void Abort(AbortReason reason) = 0;
9147
9148   // Returns a human-readable outcome message regarding the outcome of
9149   // the last death test.
9150   static const char* LastMessage();
9151
9152   static void set_last_death_test_message(const std::string& message);
9153
9154  private:
9155   // A string containing a description of the outcome of the last death test.
9156   static std::string last_death_test_message_;
9157
9158   GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
9159 };
9160
9161 // Factory interface for death tests.  May be mocked out for testing.
9162 class DeathTestFactory {
9163  public:
9164   virtual ~DeathTestFactory() { }
9165   virtual bool Create(const char* statement, const RE* regex,
9166                       const char* file, int line, DeathTest** test) = 0;
9167 };
9168
9169 // A concrete DeathTestFactory implementation for normal use.
9170 class DefaultDeathTestFactory : public DeathTestFactory {
9171  public:
9172   virtual bool Create(const char* statement, const RE* regex,
9173                       const char* file, int line, DeathTest** test);
9174 };
9175
9176 // Returns true if exit_status describes a process that was terminated
9177 // by a signal, or exited normally with a nonzero exit code.
9178 GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
9179
9180 // Traps C++ exceptions escaping statement and reports them as test
9181 // failures. Note that trapping SEH exceptions is not implemented here.
9182 # if GTEST_HAS_EXCEPTIONS
9183 #  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
9184   try { \
9185     GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
9186   } catch (const ::std::exception& gtest_exception) { \
9187     fprintf(\
9188         stderr, \
9189         "\n%s: Caught std::exception-derived exception escaping the " \
9190         "death test statement. Exception message: %s\n", \
9191         ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
9192         gtest_exception.what()); \
9193     fflush(stderr); \
9194     death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
9195   } catch (...) { \
9196     death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
9197   }
9198
9199 # else
9200 #  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
9201   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
9202
9203 # endif
9204
9205 // This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
9206 // ASSERT_EXIT*, and EXPECT_EXIT*.
9207 # define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
9208   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
9209   if (::testing::internal::AlwaysTrue()) { \
9210     const ::testing::internal::RE& gtest_regex = (regex); \
9211     ::testing::internal::DeathTest* gtest_dt; \
9212     if (!::testing::internal::DeathTest::Create(#statement, &gtest_regex, \
9213         __FILE__, __LINE__, &gtest_dt)) { \
9214       goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
9215     } \
9216     if (gtest_dt != NULL) { \
9217       ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \
9218           gtest_dt_ptr(gtest_dt); \
9219       switch (gtest_dt->AssumeRole()) { \
9220         case ::testing::internal::DeathTest::OVERSEE_TEST: \
9221           if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
9222             goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
9223           } \
9224           break; \
9225         case ::testing::internal::DeathTest::EXECUTE_TEST: { \
9226           ::testing::internal::DeathTest::ReturnSentinel \
9227               gtest_sentinel(gtest_dt); \
9228           GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \
9229           gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
9230           break; \
9231         } \
9232         default: \
9233           break; \
9234       } \
9235     } \
9236   } else \
9237     GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \
9238       fail(::testing::internal::DeathTest::LastMessage())
9239 // The symbol "fail" here expands to something into which a message
9240 // can be streamed.
9241
9242 // This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
9243 // NDEBUG mode. In this case we need the statements to be executed, the regex is
9244 // ignored, and the macro must accept a streamed message even though the message
9245 // is never printed.
9246 # define GTEST_EXECUTE_STATEMENT_(statement, regex) \
9247   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
9248   if (::testing::internal::AlwaysTrue()) { \
9249      GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
9250   } else \
9251     ::testing::Message()
9252
9253 // A class representing the parsed contents of the
9254 // --gtest_internal_run_death_test flag, as it existed when
9255 // RUN_ALL_TESTS was called.
9256 class InternalRunDeathTestFlag {
9257  public:
9258   InternalRunDeathTestFlag(const std::string& a_file,
9259                            int a_line,
9260                            int an_index,
9261                            int a_write_fd)
9262       : file_(a_file), line_(a_line), index_(an_index),
9263         write_fd_(a_write_fd) {}
9264
9265   ~InternalRunDeathTestFlag() {
9266     if (write_fd_ >= 0)
9267       posix::Close(write_fd_);
9268   }
9269
9270   const std::string& file() const { return file_; }
9271   int line() const { return line_; }
9272   int index() const { return index_; }
9273   int write_fd() const { return write_fd_; }
9274
9275  private:
9276   std::string file_;
9277   int line_;
9278   int index_;
9279   int write_fd_;
9280
9281   GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
9282 };
9283
9284 // Returns a newly created InternalRunDeathTestFlag object with fields
9285 // initialized from the GTEST_FLAG(internal_run_death_test) flag if
9286 // the flag is specified; otherwise returns NULL.
9287 InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
9288
9289 #else  // GTEST_HAS_DEATH_TEST
9290
9291 // This macro is used for implementing macros such as
9292 // EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
9293 // death tests are not supported. Those macros must compile on such systems
9294 // iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
9295 // systems that support death tests. This allows one to write such a macro
9296 // on a system that does not support death tests and be sure that it will
9297 // compile on a death-test supporting system.
9298 //
9299 // Parameters:
9300 //   statement -  A statement that a macro such as EXPECT_DEATH would test
9301 //                for program termination. This macro has to make sure this
9302 //                statement is compiled but not executed, to ensure that
9303 //                EXPECT_DEATH_IF_SUPPORTED compiles with a certain
9304 //                parameter iff EXPECT_DEATH compiles with it.
9305 //   regex     -  A regex that a macro such as EXPECT_DEATH would use to test
9306 //                the output of statement.  This parameter has to be
9307 //                compiled but not evaluated by this macro, to ensure that
9308 //                this macro only accepts expressions that a macro such as
9309 //                EXPECT_DEATH would accept.
9310 //   terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
9311 //                and a return statement for ASSERT_DEATH_IF_SUPPORTED.
9312 //                This ensures that ASSERT_DEATH_IF_SUPPORTED will not
9313 //                compile inside functions where ASSERT_DEATH doesn't
9314 //                compile.
9315 //
9316 //  The branch that has an always false condition is used to ensure that
9317 //  statement and regex are compiled (and thus syntactically correct) but
9318 //  never executed. The unreachable code macro protects the terminator
9319 //  statement from generating an 'unreachable code' warning in case
9320 //  statement unconditionally returns or throws. The Message constructor at
9321 //  the end allows the syntax of streaming additional messages into the
9322 //  macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
9323 # define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
9324     GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
9325     if (::testing::internal::AlwaysTrue()) { \
9326       GTEST_LOG_(WARNING) \
9327           << "Death tests are not supported on this platform.\n" \
9328           << "Statement '" #statement "' cannot be verified."; \
9329     } else if (::testing::internal::AlwaysFalse()) { \
9330       ::testing::internal::RE::PartialMatch(".*", (regex)); \
9331       GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
9332       terminator; \
9333     } else \
9334       ::testing::Message()
9335
9336 #endif  // GTEST_HAS_DEATH_TEST
9337
9338 }  // namespace internal
9339 }  // namespace testing
9340
9341 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
9342
9343 namespace testing {
9344
9345 // This flag controls the style of death tests.  Valid values are "threadsafe",
9346 // meaning that the death test child process will re-execute the test binary
9347 // from the start, running only a single death test, or "fast",
9348 // meaning that the child process will execute the test logic immediately
9349 // after forking.
9350 GTEST_DECLARE_string_(death_test_style);
9351
9352 #if GTEST_HAS_DEATH_TEST
9353
9354 namespace internal {
9355
9356 // Returns a Boolean value indicating whether the caller is currently
9357 // executing in the context of the death test child process.  Tools such as
9358 // Valgrind heap checkers may need this to modify their behavior in death
9359 // tests.  IMPORTANT: This is an internal utility.  Using it may break the
9360 // implementation of death tests.  User code MUST NOT use it.
9361 GTEST_API_ bool InDeathTestChild();
9362
9363 }  // namespace internal
9364
9365 // The following macros are useful for writing death tests.
9366
9367 // Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
9368 // executed:
9369 //
9370 //   1. It generates a warning if there is more than one active
9371 //   thread.  This is because it's safe to fork() or clone() only
9372 //   when there is a single thread.
9373 //
9374 //   2. The parent process clone()s a sub-process and runs the death
9375 //   test in it; the sub-process exits with code 0 at the end of the
9376 //   death test, if it hasn't exited already.
9377 //
9378 //   3. The parent process waits for the sub-process to terminate.
9379 //
9380 //   4. The parent process checks the exit code and error message of
9381 //   the sub-process.
9382 //
9383 // Examples:
9384 //
9385 //   ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
9386 //   for (int i = 0; i < 5; i++) {
9387 //     EXPECT_DEATH(server.ProcessRequest(i),
9388 //                  "Invalid request .* in ProcessRequest()")
9389 //                  << "Failed to die on request " << i;
9390 //   }
9391 //
9392 //   ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
9393 //
9394 //   bool KilledBySIGHUP(int exit_code) {
9395 //     return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
9396 //   }
9397 //
9398 //   ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
9399 //
9400 // On the regular expressions used in death tests:
9401 //
9402 //   On POSIX-compliant systems (*nix), we use the <regex.h> library,
9403 //   which uses the POSIX extended regex syntax.
9404 //
9405 //   On other platforms (e.g. Windows), we only support a simple regex
9406 //   syntax implemented as part of Google Test.  This limited
9407 //   implementation should be enough most of the time when writing
9408 //   death tests; though it lacks many features you can find in PCRE
9409 //   or POSIX extended regex syntax.  For example, we don't support
9410 //   union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
9411 //   repetition count ("x{5,7}"), among others.
9412 //
9413 //   Below is the syntax that we do support.  We chose it to be a
9414 //   subset of both PCRE and POSIX extended regex, so it's easy to
9415 //   learn wherever you come from.  In the following: 'A' denotes a
9416 //   literal character, period (.), or a single \\ escape sequence;
9417 //   'x' and 'y' denote regular expressions; 'm' and 'n' are for
9418 //   natural numbers.
9419 //
9420 //     c     matches any literal character c
9421 //     \\d   matches any decimal digit
9422 //     \\D   matches any character that's not a decimal digit
9423 //     \\f   matches \f
9424 //     \\n   matches \n
9425 //     \\r   matches \r
9426 //     \\s   matches any ASCII whitespace, including \n
9427 //     \\S   matches any character that's not a whitespace
9428 //     \\t   matches \t
9429 //     \\v   matches \v
9430 //     \\w   matches any letter, _, or decimal digit
9431 //     \\W   matches any character that \\w doesn't match
9432 //     \\c   matches any literal character c, which must be a punctuation
9433 //     .     matches any single character except \n
9434 //     A?    matches 0 or 1 occurrences of A
9435 //     A*    matches 0 or many occurrences of A
9436 //     A+    matches 1 or many occurrences of A
9437 //     ^     matches the beginning of a string (not that of each line)
9438 //     $     matches the end of a string (not that of each line)
9439 //     xy    matches x followed by y
9440 //
9441 //   If you accidentally use PCRE or POSIX extended regex features
9442 //   not implemented by us, you will get a run-time failure.  In that
9443 //   case, please try to rewrite your regular expression within the
9444 //   above syntax.
9445 //
9446 //   This implementation is *not* meant to be as highly tuned or robust
9447 //   as a compiled regex library, but should perform well enough for a
9448 //   death test, which already incurs significant overhead by launching
9449 //   a child process.
9450 //
9451 // Known caveats:
9452 //
9453 //   A "threadsafe" style death test obtains the path to the test
9454 //   program from argv[0] and re-executes it in the sub-process.  For
9455 //   simplicity, the current implementation doesn't search the PATH
9456 //   when launching the sub-process.  This means that the user must
9457 //   invoke the test program via a path that contains at least one
9458 //   path separator (e.g. path/to/foo_test and
9459 //   /absolute/path/to/bar_test are fine, but foo_test is not).  This
9460 //   is rarely a problem as people usually don't put the test binary
9461 //   directory in PATH.
9462 //
9463 // TODO(wan@google.com): make thread-safe death tests search the PATH.
9464
9465 // Asserts that a given statement causes the program to exit, with an
9466 // integer exit status that satisfies predicate, and emitting error output
9467 // that matches regex.
9468 # define ASSERT_EXIT(statement, predicate, regex) \
9469     GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
9470
9471 // Like ASSERT_EXIT, but continues on to successive tests in the
9472 // test case, if any:
9473 # define EXPECT_EXIT(statement, predicate, regex) \
9474     GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
9475
9476 // Asserts that a given statement causes the program to exit, either by
9477 // explicitly exiting with a nonzero exit code or being killed by a
9478 // signal, and emitting error output that matches regex.
9479 # define ASSERT_DEATH(statement, regex) \
9480     ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
9481
9482 // Like ASSERT_DEATH, but continues on to successive tests in the
9483 // test case, if any:
9484 # define EXPECT_DEATH(statement, regex) \
9485     EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
9486
9487 // Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
9488
9489 // Tests that an exit code describes a normal exit with a given exit code.
9490 class GTEST_API_ ExitedWithCode {
9491  public:
9492   explicit ExitedWithCode(int exit_code);
9493   bool operator()(int exit_status) const;
9494  private:
9495   // No implementation - assignment is unsupported.
9496   void operator=(const ExitedWithCode& other);
9497
9498   const int exit_code_;
9499 };
9500
9501 # if !GTEST_OS_WINDOWS
9502 // Tests that an exit code describes an exit due to termination by a
9503 // given signal.
9504 class GTEST_API_ KilledBySignal {
9505  public:
9506   explicit KilledBySignal(int signum);
9507   bool operator()(int exit_status) const;
9508  private:
9509   const int signum_;
9510 };
9511 # endif  // !GTEST_OS_WINDOWS
9512
9513 // EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
9514 // The death testing framework causes this to have interesting semantics,
9515 // since the sideeffects of the call are only visible in opt mode, and not
9516 // in debug mode.
9517 //
9518 // In practice, this can be used to test functions that utilize the
9519 // LOG(DFATAL) macro using the following style:
9520 //
9521 // int DieInDebugOr12(int* sideeffect) {
9522 //   if (sideeffect) {
9523 //     *sideeffect = 12;
9524 //   }
9525 //   LOG(DFATAL) << "death";
9526 //   return 12;
9527 // }
9528 //
9529 // TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {
9530 //   int sideeffect = 0;
9531 //   // Only asserts in dbg.
9532 //   EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
9533 //
9534 // #ifdef NDEBUG
9535 //   // opt-mode has sideeffect visible.
9536 //   EXPECT_EQ(12, sideeffect);
9537 // #else
9538 //   // dbg-mode no visible sideeffect.
9539 //   EXPECT_EQ(0, sideeffect);
9540 // #endif
9541 // }
9542 //
9543 // This will assert that DieInDebugReturn12InOpt() crashes in debug
9544 // mode, usually due to a DCHECK or LOG(DFATAL), but returns the
9545 // appropriate fallback value (12 in this case) in opt mode. If you
9546 // need to test that a function has appropriate side-effects in opt
9547 // mode, include assertions against the side-effects.  A general
9548 // pattern for this is:
9549 //
9550 // EXPECT_DEBUG_DEATH({
9551 //   // Side-effects here will have an effect after this statement in
9552 //   // opt mode, but none in debug mode.
9553 //   EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
9554 // }, "death");
9555 //
9556 # ifdef NDEBUG
9557
9558 #  define EXPECT_DEBUG_DEATH(statement, regex) \
9559   GTEST_EXECUTE_STATEMENT_(statement, regex)
9560
9561 #  define ASSERT_DEBUG_DEATH(statement, regex) \
9562   GTEST_EXECUTE_STATEMENT_(statement, regex)
9563
9564 # else
9565
9566 #  define EXPECT_DEBUG_DEATH(statement, regex) \
9567   EXPECT_DEATH(statement, regex)
9568
9569 #  define ASSERT_DEBUG_DEATH(statement, regex) \
9570   ASSERT_DEATH(statement, regex)
9571
9572 # endif  // NDEBUG for EXPECT_DEBUG_DEATH
9573 #endif  // GTEST_HAS_DEATH_TEST
9574
9575 // EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
9576 // ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
9577 // death tests are supported; otherwise they just issue a warning.  This is
9578 // useful when you are combining death test assertions with normal test
9579 // assertions in one test.
9580 #if GTEST_HAS_DEATH_TEST
9581 # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
9582     EXPECT_DEATH(statement, regex)
9583 # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
9584     ASSERT_DEATH(statement, regex)
9585 #else
9586 # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
9587     GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
9588 # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
9589     GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
9590 #endif
9591
9592 }  // namespace testing
9593
9594 #endif  // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
9595 // This file was GENERATED by command:
9596 //     pump.py gtest-param-test.h.pump
9597 // DO NOT EDIT BY HAND!!!
9598
9599 // Copyright 2008, Google Inc.
9600 // All rights reserved.
9601 //
9602 // Redistribution and use in source and binary forms, with or without
9603 // modification, are permitted provided that the following conditions are
9604 // met:
9605 //
9606 //     * Redistributions of source code must retain the above copyright
9607 // notice, this list of conditions and the following disclaimer.
9608 //     * Redistributions in binary form must reproduce the above
9609 // copyright notice, this list of conditions and the following disclaimer
9610 // in the documentation and/or other materials provided with the
9611 // distribution.
9612 //     * Neither the name of Google Inc. nor the names of its
9613 // contributors may be used to endorse or promote products derived from
9614 // this software without specific prior written permission.
9615 //
9616 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9617 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9618 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9619 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9620 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9621 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9622 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9623 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9624 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9625 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9626 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9627 //
9628 // Authors: vladl@google.com (Vlad Losev)
9629 //
9630 // Macros and functions for implementing parameterized tests
9631 // in Google C++ Testing Framework (Google Test)
9632 //
9633 // This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
9634 //
9635 #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
9636 #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
9637
9638
9639 // Value-parameterized tests allow you to test your code with different
9640 // parameters without writing multiple copies of the same test.
9641 //
9642 // Here is how you use value-parameterized tests:
9643
9644 #if 0
9645
9646 // To write value-parameterized tests, first you should define a fixture
9647 // class. It is usually derived from testing::TestWithParam<T> (see below for
9648 // another inheritance scheme that's sometimes useful in more complicated
9649 // class hierarchies), where the type of your parameter values.
9650 // TestWithParam<T> is itself derived from testing::Test. T can be any
9651 // copyable type. If it's a raw pointer, you are responsible for managing the
9652 // lifespan of the pointed values.
9653
9654 class FooTest : public ::testing::TestWithParam<const char*> {
9655   // You can implement all the usual class fixture members here.
9656 };
9657
9658 // Then, use the TEST_P macro to define as many parameterized tests
9659 // for this fixture as you want. The _P suffix is for "parameterized"
9660 // or "pattern", whichever you prefer to think.
9661
9662 TEST_P(FooTest, DoesBlah) {
9663   // Inside a test, access the test parameter with the GetParam() method
9664   // of the TestWithParam<T> class:
9665   EXPECT_TRUE(foo.Blah(GetParam()));
9666   ...
9667 }
9668
9669 TEST_P(FooTest, HasBlahBlah) {
9670   ...
9671 }
9672
9673 // Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
9674 // case with any set of parameters you want. Google Test defines a number
9675 // of functions for generating test parameters. They return what we call
9676 // (surprise!) parameter generators. Here is a  summary of them, which
9677 // are all in the testing namespace:
9678 //
9679 //
9680 //  Range(begin, end [, step]) - Yields values {begin, begin+step,
9681 //                               begin+step+step, ...}. The values do not
9682 //                               include end. step defaults to 1.
9683 //  Values(v1, v2, ..., vN)    - Yields values {v1, v2, ..., vN}.
9684 //  ValuesIn(container)        - Yields values from a C-style array, an STL
9685 //  ValuesIn(begin,end)          container, or an iterator range [begin, end).
9686 //  Bool()                     - Yields sequence {false, true}.
9687 //  Combine(g1, g2, ..., gN)   - Yields all combinations (the Cartesian product
9688 //                               for the math savvy) of the values generated
9689 //                               by the N generators.
9690 //
9691 // For more details, see comments at the definitions of these functions below
9692 // in this file.
9693 //
9694 // The following statement will instantiate tests from the FooTest test case
9695 // each with parameter values "meeny", "miny", and "moe".
9696
9697 INSTANTIATE_TEST_CASE_P(InstantiationName,
9698                         FooTest,
9699                         Values("meeny", "miny", "moe"));
9700
9701 // To distinguish different instances of the pattern, (yes, you
9702 // can instantiate it more then once) the first argument to the
9703 // INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
9704 // actual test case name. Remember to pick unique prefixes for different
9705 // instantiations. The tests from the instantiation above will have
9706 // these names:
9707 //
9708 //    * InstantiationName/FooTest.DoesBlah/0 for "meeny"
9709 //    * InstantiationName/FooTest.DoesBlah/1 for "miny"
9710 //    * InstantiationName/FooTest.DoesBlah/2 for "moe"
9711 //    * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
9712 //    * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
9713 //    * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
9714 //
9715 // You can use these names in --gtest_filter.
9716 //
9717 // This statement will instantiate all tests from FooTest again, each
9718 // with parameter values "cat" and "dog":
9719
9720 const char* pets[] = {"cat", "dog"};
9721 INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
9722
9723 // The tests from the instantiation above will have these names:
9724 //
9725 //    * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
9726 //    * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
9727 //    * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
9728 //    * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
9729 //
9730 // Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
9731 // in the given test case, whether their definitions come before or
9732 // AFTER the INSTANTIATE_TEST_CASE_P statement.
9733 //
9734 // Please also note that generator expressions (including parameters to the
9735 // generators) are evaluated in InitGoogleTest(), after main() has started.
9736 // This allows the user on one hand, to adjust generator parameters in order
9737 // to dynamically determine a set of tests to run and on the other hand,
9738 // give the user a chance to inspect the generated tests with Google Test
9739 // reflection API before RUN_ALL_TESTS() is executed.
9740 //
9741 // You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
9742 // for more examples.
9743 //
9744 // In the future, we plan to publish the API for defining new parameter
9745 // generators. But for now this interface remains part of the internal
9746 // implementation and is subject to change.
9747 //
9748 //
9749 // A parameterized test fixture must be derived from testing::Test and from
9750 // testing::WithParamInterface<T>, where T is the type of the parameter
9751 // values. Inheriting from TestWithParam<T> satisfies that requirement because
9752 // TestWithParam<T> inherits from both Test and WithParamInterface. In more
9753 // complicated hierarchies, however, it is occasionally useful to inherit
9754 // separately from Test and WithParamInterface. For example:
9755
9756 class BaseTest : public ::testing::Test {
9757   // You can inherit all the usual members for a non-parameterized test
9758   // fixture here.
9759 };
9760
9761 class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
9762   // The usual test fixture members go here too.
9763 };
9764
9765 TEST_F(BaseTest, HasFoo) {
9766   // This is an ordinary non-parameterized test.
9767 }
9768
9769 TEST_P(DerivedTest, DoesBlah) {
9770   // GetParam works just the same here as if you inherit from TestWithParam.
9771   EXPECT_TRUE(foo.Blah(GetParam()));
9772 }
9773
9774 #endif  // 0
9775
9776
9777 #if !GTEST_OS_SYMBIAN
9778 # include <utility>
9779 #endif
9780
9781 // scripts/fuse_gtest.py depends on gtest's own header being #included
9782 // *unconditionally*.  Therefore these #includes cannot be moved
9783 // inside #if GTEST_HAS_PARAM_TEST.
9784 // Copyright 2008 Google Inc.
9785 // All Rights Reserved.
9786 //
9787 // Redistribution and use in source and binary forms, with or without
9788 // modification, are permitted provided that the following conditions are
9789 // met:
9790 //
9791 //     * Redistributions of source code must retain the above copyright
9792 // notice, this list of conditions and the following disclaimer.
9793 //     * Redistributions in binary form must reproduce the above
9794 // copyright notice, this list of conditions and the following disclaimer
9795 // in the documentation and/or other materials provided with the
9796 // distribution.
9797 //     * Neither the name of Google Inc. nor the names of its
9798 // contributors may be used to endorse or promote products derived from
9799 // this software without specific prior written permission.
9800 //
9801 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9802 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9803 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9804 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9805 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9806 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9807 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9808 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9809 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9810 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9811 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9812 //
9813 // Author: vladl@google.com (Vlad Losev)
9814
9815 // Type and function utilities for implementing parameterized tests.
9816
9817 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
9818 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
9819
9820 #include <ctype.h>
9821
9822 #include <iterator>
9823 #include <set>
9824 #include <utility>
9825 #include <vector>
9826
9827 // scripts/fuse_gtest.py depends on gtest's own header being #included
9828 // *unconditionally*.  Therefore these #includes cannot be moved
9829 // inside #if GTEST_HAS_PARAM_TEST.
9830 // Copyright 2003 Google Inc.
9831 // All rights reserved.
9832 //
9833 // Redistribution and use in source and binary forms, with or without
9834 // modification, are permitted provided that the following conditions are
9835 // met:
9836 //
9837 //     * Redistributions of source code must retain the above copyright
9838 // notice, this list of conditions and the following disclaimer.
9839 //     * Redistributions in binary form must reproduce the above
9840 // copyright notice, this list of conditions and the following disclaimer
9841 // in the documentation and/or other materials provided with the
9842 // distribution.
9843 //     * Neither the name of Google Inc. nor the names of its
9844 // contributors may be used to endorse or promote products derived from
9845 // this software without specific prior written permission.
9846 //
9847 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9848 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9849 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9850 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9851 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9852 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9853 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9854 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9855 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9856 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9857 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9858 //
9859 // Authors: Dan Egnor (egnor@google.com)
9860 //
9861 // A "smart" pointer type with reference tracking.  Every pointer to a
9862 // particular object is kept on a circular linked list.  When the last pointer
9863 // to an object is destroyed or reassigned, the object is deleted.
9864 //
9865 // Used properly, this deletes the object when the last reference goes away.
9866 // There are several caveats:
9867 // - Like all reference counting schemes, cycles lead to leaks.
9868 // - Each smart pointer is actually two pointers (8 bytes instead of 4).
9869 // - Every time a pointer is assigned, the entire list of pointers to that
9870 //   object is traversed.  This class is therefore NOT SUITABLE when there
9871 //   will often be more than two or three pointers to a particular object.
9872 // - References are only tracked as long as linked_ptr<> objects are copied.
9873 //   If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS
9874 //   will happen (double deletion).
9875 //
9876 // A good use of this class is storing object references in STL containers.
9877 // You can safely put linked_ptr<> in a vector<>.
9878 // Other uses may not be as good.
9879 //
9880 // Note: If you use an incomplete type with linked_ptr<>, the class
9881 // *containing* linked_ptr<> must have a constructor and destructor (even
9882 // if they do nothing!).
9883 //
9884 // Bill Gibbons suggested we use something like this.
9885 //
9886 // Thread Safety:
9887 //   Unlike other linked_ptr implementations, in this implementation
9888 //   a linked_ptr object is thread-safe in the sense that:
9889 //     - it's safe to copy linked_ptr objects concurrently,
9890 //     - it's safe to copy *from* a linked_ptr and read its underlying
9891 //       raw pointer (e.g. via get()) concurrently, and
9892 //     - it's safe to write to two linked_ptrs that point to the same
9893 //       shared object concurrently.
9894 // TODO(wan@google.com): rename this to safe_linked_ptr to avoid
9895 // confusion with normal linked_ptr.
9896
9897 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
9898 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
9899
9900 #include <stdlib.h>
9901 #include <assert.h>
9902
9903
9904 namespace testing {
9905 namespace internal {
9906
9907 // Protects copying of all linked_ptr objects.
9908 GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);
9909
9910 // This is used internally by all instances of linked_ptr<>.  It needs to be
9911 // a non-template class because different types of linked_ptr<> can refer to
9912 // the same object (linked_ptr<Superclass>(obj) vs linked_ptr<Subclass>(obj)).
9913 // So, it needs to be possible for different types of linked_ptr to participate
9914 // in the same circular linked list, so we need a single class type here.
9915 //
9916 // DO NOT USE THIS CLASS DIRECTLY YOURSELF.  Use linked_ptr<T>.
9917 class linked_ptr_internal {
9918  public:
9919   // Create a new circle that includes only this instance.
9920   void join_new() {
9921     next_ = this;
9922   }
9923
9924   // Many linked_ptr operations may change p.link_ for some linked_ptr
9925   // variable p in the same circle as this object.  Therefore we need
9926   // to prevent two such operations from occurring concurrently.
9927   //
9928   // Note that different types of linked_ptr objects can coexist in a
9929   // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and
9930   // linked_ptr<Derived2>).  Therefore we must use a single mutex to
9931   // protect all linked_ptr objects.  This can create serious
9932   // contention in production code, but is acceptable in a testing
9933   // framework.
9934
9935   // Join an existing circle.
9936   void join(linked_ptr_internal const* ptr)
9937       GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
9938     MutexLock lock(&g_linked_ptr_mutex);
9939
9940     linked_ptr_internal const* p = ptr;
9941     while (p->next_ != ptr) {
9942       assert(p->next_ != this &&
9943              "Trying to join() a linked ring we are already in. "
9944              "Is GMock thread safety enabled?");
9945       p = p->next_;
9946     }
9947     p->next_ = this;
9948     next_ = ptr;
9949   }
9950
9951   // Leave whatever circle we're part of.  Returns true if we were the
9952   // last member of the circle.  Once this is done, you can join() another.
9953   bool depart()
9954       GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
9955     MutexLock lock(&g_linked_ptr_mutex);
9956
9957     if (next_ == this) return true;
9958     linked_ptr_internal const* p = next_;
9959     while (p->next_ != this) {
9960       assert(p->next_ != next_ &&
9961              "Trying to depart() a linked ring we are not in. "
9962              "Is GMock thread safety enabled?");
9963       p = p->next_;
9964     }
9965     p->next_ = next_;
9966     return false;
9967   }
9968
9969  private:
9970   mutable linked_ptr_internal const* next_;
9971 };
9972
9973 template <typename T>
9974 class linked_ptr {
9975  public:
9976   typedef T element_type;
9977
9978   // Take over ownership of a raw pointer.  This should happen as soon as
9979   // possible after the object is created.
9980   explicit linked_ptr(T* ptr = NULL) { capture(ptr); }
9981   ~linked_ptr() { depart(); }
9982
9983   // Copy an existing linked_ptr<>, adding ourselves to the list of references.
9984   template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); }
9985   linked_ptr(linked_ptr const& ptr) {  // NOLINT
9986     assert(&ptr != this);
9987     copy(&ptr);
9988   }
9989
9990   // Assignment releases the old value and acquires the new.
9991   template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) {
9992     depart();
9993     copy(&ptr);
9994     return *this;
9995   }
9996
9997   linked_ptr& operator=(linked_ptr const& ptr) {
9998     if (&ptr != this) {
9999       depart();
10000       copy(&ptr);
10001     }
10002     return *this;
10003   }
10004
10005   // Smart pointer members.
10006   void reset(T* ptr = NULL) {
10007     depart();
10008     capture(ptr);
10009   }
10010   T* get() const { return value_; }
10011   T* operator->() const { return value_; }
10012   T& operator*() const { return *value_; }
10013
10014   bool operator==(T* p) const { return value_ == p; }
10015   bool operator!=(T* p) const { return value_ != p; }
10016   template <typename U>
10017   bool operator==(linked_ptr<U> const& ptr) const {
10018     return value_ == ptr.get();
10019   }
10020   template <typename U>
10021   bool operator!=(linked_ptr<U> const& ptr) const {
10022     return value_ != ptr.get();
10023   }
10024
10025  private:
10026   template <typename U>
10027   friend class linked_ptr;
10028
10029   T* value_;
10030   linked_ptr_internal link_;
10031
10032   void depart() {
10033     if (link_.depart()) delete value_;
10034   }
10035
10036   void capture(T* ptr) {
10037     value_ = ptr;
10038     link_.join_new();
10039   }
10040
10041   template <typename U> void copy(linked_ptr<U> const* ptr) {
10042     value_ = ptr->get();
10043     if (value_)
10044       link_.join(&ptr->link_);
10045     else
10046       link_.join_new();
10047   }
10048 };
10049
10050 template<typename T> inline
10051 bool operator==(T* ptr, const linked_ptr<T>& x) {
10052   return ptr == x.get();
10053 }
10054
10055 template<typename T> inline
10056 bool operator!=(T* ptr, const linked_ptr<T>& x) {
10057   return ptr != x.get();
10058 }
10059
10060 // A function to convert T* into linked_ptr<T>
10061 // Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation
10062 // for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
10063 template <typename T>
10064 linked_ptr<T> make_linked_ptr(T* ptr) {
10065   return linked_ptr<T>(ptr);
10066 }
10067
10068 }  // namespace internal
10069 }  // namespace testing
10070
10071 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
10072 // Copyright 2007, Google Inc.
10073 // All rights reserved.
10074 //
10075 // Redistribution and use in source and binary forms, with or without
10076 // modification, are permitted provided that the following conditions are
10077 // met:
10078 //
10079 //     * Redistributions of source code must retain the above copyright
10080 // notice, this list of conditions and the following disclaimer.
10081 //     * Redistributions in binary form must reproduce the above
10082 // copyright notice, this list of conditions and the following disclaimer
10083 // in the documentation and/or other materials provided with the
10084 // distribution.
10085 //     * Neither the name of Google Inc. nor the names of its
10086 // contributors may be used to endorse or promote products derived from
10087 // this software without specific prior written permission.
10088 //
10089 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
10090 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
10091 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
10092 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
10093 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10094 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10095 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10096 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
10097 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
10098 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
10099 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10100 //
10101 // Author: wan@google.com (Zhanyong Wan)
10102
10103 // Google Test - The Google C++ Testing Framework
10104 //
10105 // This file implements a universal value printer that can print a
10106 // value of any type T:
10107 //
10108 //   void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
10109 //
10110 // A user can teach this function how to print a class type T by
10111 // defining either operator<<() or PrintTo() in the namespace that
10112 // defines T.  More specifically, the FIRST defined function in the
10113 // following list will be used (assuming T is defined in namespace
10114 // foo):
10115 //
10116 //   1. foo::PrintTo(const T&, ostream*)
10117 //   2. operator<<(ostream&, const T&) defined in either foo or the
10118 //      global namespace.
10119 //
10120 // If none of the above is defined, it will print the debug string of
10121 // the value if it is a protocol buffer, or print the raw bytes in the
10122 // value otherwise.
10123 //
10124 // To aid debugging: when T is a reference type, the address of the
10125 // value is also printed; when T is a (const) char pointer, both the
10126 // pointer value and the NUL-terminated string it points to are
10127 // printed.
10128 //
10129 // We also provide some convenient wrappers:
10130 //
10131 //   // Prints a value to a string.  For a (const or not) char
10132 //   // pointer, the NUL-terminated string (but not the pointer) is
10133 //   // printed.
10134 //   std::string ::testing::PrintToString(const T& value);
10135 //
10136 //   // Prints a value tersely: for a reference type, the referenced
10137 //   // value (but not the address) is printed; for a (const or not) char
10138 //   // pointer, the NUL-terminated string (but not the pointer) is
10139 //   // printed.
10140 //   void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
10141 //
10142 //   // Prints value using the type inferred by the compiler.  The difference
10143 //   // from UniversalTersePrint() is that this function prints both the
10144 //   // pointer and the NUL-terminated string for a (const or not) char pointer.
10145 //   void ::testing::internal::UniversalPrint(const T& value, ostream*);
10146 //
10147 //   // Prints the fields of a tuple tersely to a string vector, one
10148 //   // element for each field. Tuple support must be enabled in
10149 //   // gtest-port.h.
10150 //   std::vector<string> UniversalTersePrintTupleFieldsToStrings(
10151 //       const Tuple& value);
10152 //
10153 // Known limitation:
10154 //
10155 // The print primitives print the elements of an STL-style container
10156 // using the compiler-inferred type of *iter where iter is a
10157 // const_iterator of the container.  When const_iterator is an input
10158 // iterator but not a forward iterator, this inferred type may not
10159 // match value_type, and the print output may be incorrect.  In
10160 // practice, this is rarely a problem as for most containers
10161 // const_iterator is a forward iterator.  We'll fix this if there's an
10162 // actual need for it.  Note that this fix cannot rely on value_type
10163 // being defined as many user-defined container types don't have
10164 // value_type.
10165
10166 #ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
10167 #define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
10168
10169 #include <ostream>  // NOLINT
10170 #include <sstream>
10171 #include <string>
10172 #include <utility>
10173 #include <vector>
10174
10175 #if GTEST_HAS_STD_TUPLE_
10176 # include <tuple>
10177 #endif
10178
10179 namespace testing {
10180
10181 // Definitions in the 'internal' and 'internal2' name spaces are
10182 // subject to change without notice.  DO NOT USE THEM IN USER CODE!
10183 namespace internal2 {
10184
10185 // Prints the given number of bytes in the given object to the given
10186 // ostream.
10187 GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
10188                                      size_t count,
10189                                      ::std::ostream* os);
10190
10191 // For selecting which printer to use when a given type has neither <<
10192 // nor PrintTo().
10193 enum TypeKind {
10194   kProtobuf,              // a protobuf type
10195   kConvertibleToInteger,  // a type implicitly convertible to BiggestInt
10196                           // (e.g. a named or unnamed enum type)
10197   kOtherType              // anything else
10198 };
10199
10200 // TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called
10201 // by the universal printer to print a value of type T when neither
10202 // operator<< nor PrintTo() is defined for T, where kTypeKind is the
10203 // "kind" of T as defined by enum TypeKind.
10204 template <typename T, TypeKind kTypeKind>
10205 class TypeWithoutFormatter {
10206  public:
10207   // This default version is called when kTypeKind is kOtherType.
10208   static void PrintValue(const T& value, ::std::ostream* os) {
10209     PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value),
10210                          sizeof(value), os);
10211   }
10212 };
10213
10214 // We print a protobuf using its ShortDebugString() when the string
10215 // doesn't exceed this many characters; otherwise we print it using
10216 // DebugString() for better readability.
10217 const size_t kProtobufOneLinerMaxLength = 50;
10218
10219 template <typename T>
10220 class TypeWithoutFormatter<T, kProtobuf> {
10221  public:
10222   static void PrintValue(const T& value, ::std::ostream* os) {
10223     const ::testing::internal::string short_str = value.ShortDebugString();
10224     const ::testing::internal::string pretty_str =
10225         short_str.length() <= kProtobufOneLinerMaxLength ?
10226         short_str : ("\n" + value.DebugString());
10227     *os << ("<" + pretty_str + ">");
10228   }
10229 };
10230
10231 template <typename T>
10232 class TypeWithoutFormatter<T, kConvertibleToInteger> {
10233  public:
10234   // Since T has no << operator or PrintTo() but can be implicitly
10235   // converted to BiggestInt, we print it as a BiggestInt.
10236   //
10237   // Most likely T is an enum type (either named or unnamed), in which
10238   // case printing it as an integer is the desired behavior.  In case
10239   // T is not an enum, printing it as an integer is the best we can do
10240   // given that it has no user-defined printer.
10241   static void PrintValue(const T& value, ::std::ostream* os) {
10242     const internal::BiggestInt kBigInt = value;
10243     *os << kBigInt;
10244   }
10245 };
10246
10247 // Prints the given value to the given ostream.  If the value is a
10248 // protocol message, its debug string is printed; if it's an enum or
10249 // of a type implicitly convertible to BiggestInt, it's printed as an
10250 // integer; otherwise the bytes in the value are printed.  This is
10251 // what UniversalPrinter<T>::Print() does when it knows nothing about
10252 // type T and T has neither << operator nor PrintTo().
10253 //
10254 // A user can override this behavior for a class type Foo by defining
10255 // a << operator in the namespace where Foo is defined.
10256 //
10257 // We put this operator in namespace 'internal2' instead of 'internal'
10258 // to simplify the implementation, as much code in 'internal' needs to
10259 // use << in STL, which would conflict with our own << were it defined
10260 // in 'internal'.
10261 //
10262 // Note that this operator<< takes a generic std::basic_ostream<Char,
10263 // CharTraits> type instead of the more restricted std::ostream.  If
10264 // we define it to take an std::ostream instead, we'll get an
10265 // "ambiguous overloads" compiler error when trying to print a type
10266 // Foo that supports streaming to std::basic_ostream<Char,
10267 // CharTraits>, as the compiler cannot tell whether
10268 // operator<<(std::ostream&, const T&) or
10269 // operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more
10270 // specific.
10271 template <typename Char, typename CharTraits, typename T>
10272 ::std::basic_ostream<Char, CharTraits>& operator<<(
10273     ::std::basic_ostream<Char, CharTraits>& os, const T& x) {
10274   TypeWithoutFormatter<T,
10275       (internal::IsAProtocolMessage<T>::value ? kProtobuf :
10276        internal::ImplicitlyConvertible<const T&, internal::BiggestInt>::value ?
10277        kConvertibleToInteger : kOtherType)>::PrintValue(x, &os);
10278   return os;
10279 }
10280
10281 }  // namespace internal2
10282 }  // namespace testing
10283
10284 // This namespace MUST NOT BE NESTED IN ::testing, or the name look-up
10285 // magic needed for implementing UniversalPrinter won't work.
10286 namespace testing_internal {
10287
10288 // Used to print a value that is not an STL-style container when the
10289 // user doesn't define PrintTo() for it.
10290 template <typename T>
10291 void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
10292   // With the following statement, during unqualified name lookup,
10293   // testing::internal2::operator<< appears as if it was declared in
10294   // the nearest enclosing namespace that contains both
10295   // ::testing_internal and ::testing::internal2, i.e. the global
10296   // namespace.  For more details, refer to the C++ Standard section
10297   // 7.3.4-1 [namespace.udir].  This allows us to fall back onto
10298   // testing::internal2::operator<< in case T doesn't come with a <<
10299   // operator.
10300   //
10301   // We cannot write 'using ::testing::internal2::operator<<;', which
10302   // gcc 3.3 fails to compile due to a compiler bug.
10303   using namespace ::testing::internal2;  // NOLINT
10304
10305   // Assuming T is defined in namespace foo, in the next statement,
10306   // the compiler will consider all of:
10307   //
10308   //   1. foo::operator<< (thanks to Koenig look-up),
10309   //   2. ::operator<< (as the current namespace is enclosed in ::),
10310   //   3. testing::internal2::operator<< (thanks to the using statement above).
10311   //
10312   // The operator<< whose type matches T best will be picked.
10313   //
10314   // We deliberately allow #2 to be a candidate, as sometimes it's
10315   // impossible to define #1 (e.g. when foo is ::std, defining
10316   // anything in it is undefined behavior unless you are a compiler
10317   // vendor.).
10318   *os << value;
10319 }
10320
10321 }  // namespace testing_internal
10322
10323 namespace testing {
10324 namespace internal {
10325
10326 // FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
10327 // value of type ToPrint that is an operand of a comparison assertion
10328 // (e.g. ASSERT_EQ).  OtherOperand is the type of the other operand in
10329 // the comparison, and is used to help determine the best way to
10330 // format the value.  In particular, when the value is a C string
10331 // (char pointer) and the other operand is an STL string object, we
10332 // want to format the C string as a string, since we know it is
10333 // compared by value with the string object.  If the value is a char
10334 // pointer but the other operand is not an STL string object, we don't
10335 // know whether the pointer is supposed to point to a NUL-terminated
10336 // string, and thus want to print it as a pointer to be safe.
10337 //
10338 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
10339
10340 // The default case.
10341 template <typename ToPrint, typename OtherOperand>
10342 class FormatForComparison {
10343  public:
10344   static ::std::string Format(const ToPrint& value) {
10345     return ::testing::PrintToString(value);
10346   }
10347 };
10348
10349 // Array.
10350 template <typename ToPrint, size_t N, typename OtherOperand>
10351 class FormatForComparison<ToPrint[N], OtherOperand> {
10352  public:
10353   static ::std::string Format(const ToPrint* value) {
10354     return FormatForComparison<const ToPrint*, OtherOperand>::Format(value);
10355   }
10356 };
10357
10358 // By default, print C string as pointers to be safe, as we don't know
10359 // whether they actually point to a NUL-terminated string.
10360
10361 #define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType)                \
10362   template <typename OtherOperand>                                      \
10363   class FormatForComparison<CharType*, OtherOperand> {                  \
10364    public:                                                              \
10365     static ::std::string Format(CharType* value) {                      \
10366       return ::testing::PrintToString(static_cast<const void*>(value)); \
10367     }                                                                   \
10368   }
10369
10370 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
10371 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
10372 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
10373 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
10374
10375 #undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
10376
10377 // If a C string is compared with an STL string object, we know it's meant
10378 // to point to a NUL-terminated string, and thus can print it as a string.
10379
10380 #define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
10381   template <>                                                           \
10382   class FormatForComparison<CharType*, OtherStringType> {               \
10383    public:                                                              \
10384     static ::std::string Format(CharType* value) {                      \
10385       return ::testing::PrintToString(value);                           \
10386     }                                                                   \
10387   }
10388
10389 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
10390 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
10391
10392 #if GTEST_HAS_GLOBAL_STRING
10393 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string);
10394 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);
10395 #endif
10396
10397 #if GTEST_HAS_GLOBAL_WSTRING
10398 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring);
10399 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring);
10400 #endif
10401
10402 #if GTEST_HAS_STD_WSTRING
10403 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);
10404 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
10405 #endif
10406
10407 #undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
10408
10409 // Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
10410 // operand to be used in a failure message.  The type (but not value)
10411 // of the other operand may affect the format.  This allows us to
10412 // print a char* as a raw pointer when it is compared against another
10413 // char* or void*, and print it as a C string when it is compared
10414 // against an std::string object, for example.
10415 //
10416 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
10417 template <typename T1, typename T2>
10418 std::string FormatForComparisonFailureMessage(
10419     const T1& value, const T2& /* other_operand */) {
10420   return FormatForComparison<T1, T2>::Format(value);
10421 }
10422
10423 // UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
10424 // value to the given ostream.  The caller must ensure that
10425 // 'ostream_ptr' is not NULL, or the behavior is undefined.
10426 //
10427 // We define UniversalPrinter as a class template (as opposed to a
10428 // function template), as we need to partially specialize it for
10429 // reference types, which cannot be done with function templates.
10430 template <typename T>
10431 class UniversalPrinter;
10432
10433 template <typename T>
10434 void UniversalPrint(const T& value, ::std::ostream* os);
10435
10436 // Used to print an STL-style container when the user doesn't define
10437 // a PrintTo() for it.
10438 template <typename C>
10439 void DefaultPrintTo(IsContainer /* dummy */,
10440                     false_type /* is not a pointer */,
10441                     const C& container, ::std::ostream* os) {
10442   const size_t kMaxCount = 32;  // The maximum number of elements to print.
10443   *os << '{';
10444   size_t count = 0;
10445   for (typename C::const_iterator it = container.begin();
10446        it != container.end(); ++it, ++count) {
10447     if (count > 0) {
10448       *os << ',';
10449       if (count == kMaxCount) {  // Enough has been printed.
10450         *os << " ...";
10451         break;
10452       }
10453     }
10454     *os << ' ';
10455     // We cannot call PrintTo(*it, os) here as PrintTo() doesn't
10456     // handle *it being a native array.
10457     internal::UniversalPrint(*it, os);
10458   }
10459
10460   if (count > 0) {
10461     *os << ' ';
10462   }
10463   *os << '}';
10464 }
10465
10466 // Used to print a pointer that is neither a char pointer nor a member
10467 // pointer, when the user doesn't define PrintTo() for it.  (A member
10468 // variable pointer or member function pointer doesn't really point to
10469 // a location in the address space.  Their representation is
10470 // implementation-defined.  Therefore they will be printed as raw
10471 // bytes.)
10472 template <typename T>
10473 void DefaultPrintTo(IsNotContainer /* dummy */,
10474                     true_type /* is a pointer */,
10475                     T* p, ::std::ostream* os) {
10476   if (p == NULL) {
10477     *os << "NULL";
10478   } else {
10479     // C++ doesn't allow casting from a function pointer to any object
10480     // pointer.
10481     //
10482     // IsTrue() silences warnings: "Condition is always true",
10483     // "unreachable code".
10484     if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {
10485       // T is not a function type.  We just call << to print p,
10486       // relying on ADL to pick up user-defined << for their pointer
10487       // types, if any.
10488       *os << p;
10489     } else {
10490       // T is a function type, so '*os << p' doesn't do what we want
10491       // (it just prints p as bool).  We want to print p as a const
10492       // void*.  However, we cannot cast it to const void* directly,
10493       // even using reinterpret_cast, as earlier versions of gcc
10494       // (e.g. 3.4.5) cannot compile the cast when p is a function
10495       // pointer.  Casting to UInt64 first solves the problem.
10496       *os << reinterpret_cast<const void*>(
10497           reinterpret_cast<internal::UInt64>(p));
10498     }
10499   }
10500 }
10501
10502 // Used to print a non-container, non-pointer value when the user
10503 // doesn't define PrintTo() for it.
10504 template <typename T>
10505 void DefaultPrintTo(IsNotContainer /* dummy */,
10506                     false_type /* is not a pointer */,
10507                     const T& value, ::std::ostream* os) {
10508   ::testing_internal::DefaultPrintNonContainerTo(value, os);
10509 }
10510
10511 // Prints the given value using the << operator if it has one;
10512 // otherwise prints the bytes in it.  This is what
10513 // UniversalPrinter<T>::Print() does when PrintTo() is not specialized
10514 // or overloaded for type T.
10515 //
10516 // A user can override this behavior for a class type Foo by defining
10517 // an overload of PrintTo() in the namespace where Foo is defined.  We
10518 // give the user this option as sometimes defining a << operator for
10519 // Foo is not desirable (e.g. the coding style may prevent doing it,
10520 // or there is already a << operator but it doesn't do what the user
10521 // wants).
10522 template <typename T>
10523 void PrintTo(const T& value, ::std::ostream* os) {
10524   // DefaultPrintTo() is overloaded.  The type of its first two
10525   // arguments determine which version will be picked.  If T is an
10526   // STL-style container, the version for container will be called; if
10527   // T is a pointer, the pointer version will be called; otherwise the
10528   // generic version will be called.
10529   //
10530   // Note that we check for container types here, prior to we check
10531   // for protocol message types in our operator<<.  The rationale is:
10532   //
10533   // For protocol messages, we want to give people a chance to
10534   // override Google Mock's format by defining a PrintTo() or
10535   // operator<<.  For STL containers, other formats can be
10536   // incompatible with Google Mock's format for the container
10537   // elements; therefore we check for container types here to ensure
10538   // that our format is used.
10539   //
10540   // The second argument of DefaultPrintTo() is needed to bypass a bug
10541   // in Symbian's C++ compiler that prevents it from picking the right
10542   // overload between:
10543   //
10544   //   PrintTo(const T& x, ...);
10545   //   PrintTo(T* x, ...);
10546   DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os);
10547 }
10548
10549 // The following list of PrintTo() overloads tells
10550 // UniversalPrinter<T>::Print() how to print standard types (built-in
10551 // types, strings, plain arrays, and pointers).
10552
10553 // Overloads for various char types.
10554 GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);
10555 GTEST_API_ void PrintTo(signed char c, ::std::ostream* os);
10556 inline void PrintTo(char c, ::std::ostream* os) {
10557   // When printing a plain char, we always treat it as unsigned.  This
10558   // way, the output won't be affected by whether the compiler thinks
10559   // char is signed or not.
10560   PrintTo(static_cast<unsigned char>(c), os);
10561 }
10562
10563 // Overloads for other simple built-in types.
10564 inline void PrintTo(bool x, ::std::ostream* os) {
10565   *os << (x ? "true" : "false");
10566 }
10567
10568 // Overload for wchar_t type.
10569 // Prints a wchar_t as a symbol if it is printable or as its internal
10570 // code otherwise and also as its decimal code (except for L'\0').
10571 // The L'\0' char is printed as "L'\\0'". The decimal code is printed
10572 // as signed integer when wchar_t is implemented by the compiler
10573 // as a signed type and is printed as an unsigned integer when wchar_t
10574 // is implemented as an unsigned type.
10575 GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
10576
10577 // Overloads for C strings.
10578 GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
10579 inline void PrintTo(char* s, ::std::ostream* os) {
10580   PrintTo(ImplicitCast_<const char*>(s), os);
10581 }
10582
10583 // signed/unsigned char is often used for representing binary data, so
10584 // we print pointers to it as void* to be safe.
10585 inline void PrintTo(const signed char* s, ::std::ostream* os) {
10586   PrintTo(ImplicitCast_<const void*>(s), os);
10587 }
10588 inline void PrintTo(signed char* s, ::std::ostream* os) {
10589   PrintTo(ImplicitCast_<const void*>(s), os);
10590 }
10591 inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
10592   PrintTo(ImplicitCast_<const void*>(s), os);
10593 }
10594 inline void PrintTo(unsigned char* s, ::std::ostream* os) {
10595   PrintTo(ImplicitCast_<const void*>(s), os);
10596 }
10597
10598 // MSVC can be configured to define wchar_t as a typedef of unsigned
10599 // short.  It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
10600 // type.  When wchar_t is a typedef, defining an overload for const
10601 // wchar_t* would cause unsigned short* be printed as a wide string,
10602 // possibly causing invalid memory accesses.
10603 #if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
10604 // Overloads for wide C strings
10605 GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);
10606 inline void PrintTo(wchar_t* s, ::std::ostream* os) {
10607   PrintTo(ImplicitCast_<const wchar_t*>(s), os);
10608 }
10609 #endif
10610
10611 // Overload for C arrays.  Multi-dimensional arrays are printed
10612 // properly.
10613
10614 // Prints the given number of elements in an array, without printing
10615 // the curly braces.
10616 template <typename T>
10617 void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
10618   UniversalPrint(a[0], os);
10619   for (size_t i = 1; i != count; i++) {
10620     *os << ", ";
10621     UniversalPrint(a[i], os);
10622   }
10623 }
10624
10625 // Overloads for ::string and ::std::string.
10626 #if GTEST_HAS_GLOBAL_STRING
10627 GTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os);
10628 inline void PrintTo(const ::string& s, ::std::ostream* os) {
10629   PrintStringTo(s, os);
10630 }
10631 #endif  // GTEST_HAS_GLOBAL_STRING
10632
10633 GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);
10634 inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
10635   PrintStringTo(s, os);
10636 }
10637
10638 // Overloads for ::wstring and ::std::wstring.
10639 #if GTEST_HAS_GLOBAL_WSTRING
10640 GTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os);
10641 inline void PrintTo(const ::wstring& s, ::std::ostream* os) {
10642   PrintWideStringTo(s, os);
10643 }
10644 #endif  // GTEST_HAS_GLOBAL_WSTRING
10645
10646 #if GTEST_HAS_STD_WSTRING
10647 GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
10648 inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
10649   PrintWideStringTo(s, os);
10650 }
10651 #endif  // GTEST_HAS_STD_WSTRING
10652
10653 #if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
10654 // Helper function for printing a tuple.  T must be instantiated with
10655 // a tuple type.
10656 template <typename T>
10657 void PrintTupleTo(const T& t, ::std::ostream* os);
10658 #endif  // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
10659
10660 #if GTEST_HAS_TR1_TUPLE
10661 // Overload for ::std::tr1::tuple.  Needed for printing function arguments,
10662 // which are packed as tuples.
10663
10664 // Overloaded PrintTo() for tuples of various arities.  We support
10665 // tuples of up-to 10 fields.  The following implementation works
10666 // regardless of whether tr1::tuple is implemented using the
10667 // non-standard variadic template feature or not.
10668
10669 inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) {
10670   PrintTupleTo(t, os);
10671 }
10672
10673 template <typename T1>
10674 void PrintTo(const ::std::tr1::tuple<T1>& t, ::std::ostream* os) {
10675   PrintTupleTo(t, os);
10676 }
10677
10678 template <typename T1, typename T2>
10679 void PrintTo(const ::std::tr1::tuple<T1, T2>& t, ::std::ostream* os) {
10680   PrintTupleTo(t, os);
10681 }
10682
10683 template <typename T1, typename T2, typename T3>
10684 void PrintTo(const ::std::tr1::tuple<T1, T2, T3>& t, ::std::ostream* os) {
10685   PrintTupleTo(t, os);
10686 }
10687
10688 template <typename T1, typename T2, typename T3, typename T4>
10689 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4>& t, ::std::ostream* os) {
10690   PrintTupleTo(t, os);
10691 }
10692
10693 template <typename T1, typename T2, typename T3, typename T4, typename T5>
10694 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5>& t,
10695              ::std::ostream* os) {
10696   PrintTupleTo(t, os);
10697 }
10698
10699 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10700           typename T6>
10701 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6>& t,
10702              ::std::ostream* os) {
10703   PrintTupleTo(t, os);
10704 }
10705
10706 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10707           typename T6, typename T7>
10708 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7>& t,
10709              ::std::ostream* os) {
10710   PrintTupleTo(t, os);
10711 }
10712
10713 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10714           typename T6, typename T7, typename T8>
10715 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8>& t,
10716              ::std::ostream* os) {
10717   PrintTupleTo(t, os);
10718 }
10719
10720 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10721           typename T6, typename T7, typename T8, typename T9>
10722 void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>& t,
10723              ::std::ostream* os) {
10724   PrintTupleTo(t, os);
10725 }
10726
10727 template <typename T1, typename T2, typename T3, typename T4, typename T5,
10728           typename T6, typename T7, typename T8, typename T9, typename T10>
10729 void PrintTo(
10730     const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& t,
10731     ::std::ostream* os) {
10732   PrintTupleTo(t, os);
10733 }
10734 #endif  // GTEST_HAS_TR1_TUPLE
10735
10736 #if GTEST_HAS_STD_TUPLE_
10737 template <typename... Types>
10738 void PrintTo(const ::std::tuple<Types...>& t, ::std::ostream* os) {
10739   PrintTupleTo(t, os);
10740 }
10741 #endif  // GTEST_HAS_STD_TUPLE_
10742
10743 // Overload for std::pair.
10744 template <typename T1, typename T2>
10745 void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
10746   *os << '(';
10747   // We cannot use UniversalPrint(value.first, os) here, as T1 may be
10748   // a reference type.  The same for printing value.second.
10749   UniversalPrinter<T1>::Print(value.first, os);
10750   *os << ", ";
10751   UniversalPrinter<T2>::Print(value.second, os);
10752   *os << ')';
10753 }
10754
10755 // Implements printing a non-reference type T by letting the compiler
10756 // pick the right overload of PrintTo() for T.
10757 template <typename T>
10758 class UniversalPrinter {
10759  public:
10760   // MSVC warns about adding const to a function type, so we want to
10761   // disable the warning.
10762   GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180)
10763
10764   // Note: we deliberately don't call this PrintTo(), as that name
10765   // conflicts with ::testing::internal::PrintTo in the body of the
10766   // function.
10767   static void Print(const T& value, ::std::ostream* os) {
10768     // By default, ::testing::internal::PrintTo() is used for printing
10769     // the value.
10770     //
10771     // Thanks to Koenig look-up, if T is a class and has its own
10772     // PrintTo() function defined in its namespace, that function will
10773     // be visible here.  Since it is more specific than the generic ones
10774     // in ::testing::internal, it will be picked by the compiler in the
10775     // following statement - exactly what we want.
10776     PrintTo(value, os);
10777   }
10778
10779   GTEST_DISABLE_MSC_WARNINGS_POP_()
10780 };
10781
10782 // UniversalPrintArray(begin, len, os) prints an array of 'len'
10783 // elements, starting at address 'begin'.
10784 template <typename T>
10785 void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
10786   if (len == 0) {
10787     *os << "{}";
10788   } else {
10789     *os << "{ ";
10790     const size_t kThreshold = 18;
10791     const size_t kChunkSize = 8;
10792     // If the array has more than kThreshold elements, we'll have to
10793     // omit some details by printing only the first and the last
10794     // kChunkSize elements.
10795     // TODO(wan@google.com): let the user control the threshold using a flag.
10796     if (len <= kThreshold) {
10797       PrintRawArrayTo(begin, len, os);
10798     } else {
10799       PrintRawArrayTo(begin, kChunkSize, os);
10800       *os << ", ..., ";
10801       PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
10802     }
10803     *os << " }";
10804   }
10805 }
10806 // This overload prints a (const) char array compactly.
10807 GTEST_API_ void UniversalPrintArray(
10808     const char* begin, size_t len, ::std::ostream* os);
10809
10810 // This overload prints a (const) wchar_t array compactly.
10811 GTEST_API_ void UniversalPrintArray(
10812     const wchar_t* begin, size_t len, ::std::ostream* os);
10813
10814 // Implements printing an array type T[N].
10815 template <typename T, size_t N>
10816 class UniversalPrinter<T[N]> {
10817  public:
10818   // Prints the given array, omitting some elements when there are too
10819   // many.
10820   static void Print(const T (&a)[N], ::std::ostream* os) {
10821     UniversalPrintArray(a, N, os);
10822   }
10823 };
10824
10825 // Implements printing a reference type T&.
10826 template <typename T>
10827 class UniversalPrinter<T&> {
10828  public:
10829   // MSVC warns about adding const to a function type, so we want to
10830   // disable the warning.
10831   GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180)
10832
10833   static void Print(const T& value, ::std::ostream* os) {
10834     // Prints the address of the value.  We use reinterpret_cast here
10835     // as static_cast doesn't compile when T is a function type.
10836     *os << "@" << reinterpret_cast<const void*>(&value) << " ";
10837
10838     // Then prints the value itself.
10839     UniversalPrint(value, os);
10840   }
10841
10842   GTEST_DISABLE_MSC_WARNINGS_POP_()
10843 };
10844
10845 // Prints a value tersely: for a reference type, the referenced value
10846 // (but not the address) is printed; for a (const) char pointer, the
10847 // NUL-terminated string (but not the pointer) is printed.
10848
10849 template <typename T>
10850 class UniversalTersePrinter {
10851  public:
10852   static void Print(const T& value, ::std::ostream* os) {
10853     UniversalPrint(value, os);
10854   }
10855 };
10856 template <typename T>
10857 class UniversalTersePrinter<T&> {
10858  public:
10859   static void Print(const T& value, ::std::ostream* os) {
10860     UniversalPrint(value, os);
10861   }
10862 };
10863 template <typename T, size_t N>
10864 class UniversalTersePrinter<T[N]> {
10865  public:
10866   static void Print(const T (&value)[N], ::std::ostream* os) {
10867     UniversalPrinter<T[N]>::Print(value, os);
10868   }
10869 };
10870 template <>
10871 class UniversalTersePrinter<const char*> {
10872  public:
10873   static void Print(const char* str, ::std::ostream* os) {
10874     if (str == NULL) {
10875       *os << "NULL";
10876     } else {
10877       UniversalPrint(string(str), os);
10878     }
10879   }
10880 };
10881 template <>
10882 class UniversalTersePrinter<char*> {
10883  public:
10884   static void Print(char* str, ::std::ostream* os) {
10885     UniversalTersePrinter<const char*>::Print(str, os);
10886   }
10887 };
10888
10889 #if GTEST_HAS_STD_WSTRING
10890 template <>
10891 class UniversalTersePrinter<const wchar_t*> {
10892  public:
10893   static void Print(const wchar_t* str, ::std::ostream* os) {
10894     if (str == NULL) {
10895       *os << "NULL";
10896     } else {
10897       UniversalPrint(::std::wstring(str), os);
10898     }
10899   }
10900 };
10901 #endif
10902
10903 template <>
10904 class UniversalTersePrinter<wchar_t*> {
10905  public:
10906   static void Print(wchar_t* str, ::std::ostream* os) {
10907     UniversalTersePrinter<const wchar_t*>::Print(str, os);
10908   }
10909 };
10910
10911 template <typename T>
10912 void UniversalTersePrint(const T& value, ::std::ostream* os) {
10913   UniversalTersePrinter<T>::Print(value, os);
10914 }
10915
10916 // Prints a value using the type inferred by the compiler.  The
10917 // difference between this and UniversalTersePrint() is that for a
10918 // (const) char pointer, this prints both the pointer and the
10919 // NUL-terminated string.
10920 template <typename T>
10921 void UniversalPrint(const T& value, ::std::ostream* os) {
10922   // A workarond for the bug in VC++ 7.1 that prevents us from instantiating
10923   // UniversalPrinter with T directly.
10924   typedef T T1;
10925   UniversalPrinter<T1>::Print(value, os);
10926 }
10927
10928 typedef ::std::vector<string> Strings;
10929
10930 // TuplePolicy<TupleT> must provide:
10931 // - tuple_size
10932 //     size of tuple TupleT.
10933 // - get<size_t I>(const TupleT& t)
10934 //     static function extracting element I of tuple TupleT.
10935 // - tuple_element<size_t I>::type
10936 //     type of element I of tuple TupleT.
10937 template <typename TupleT>
10938 struct TuplePolicy;
10939
10940 #if GTEST_HAS_TR1_TUPLE
10941 template <typename TupleT>
10942 struct TuplePolicy {
10943   typedef TupleT Tuple;
10944   static const size_t tuple_size = ::std::tr1::tuple_size<Tuple>::value;
10945
10946   template <size_t I>
10947   struct tuple_element : ::std::tr1::tuple_element<I, Tuple> {};
10948
10949   template <size_t I>
10950   static typename AddReference<
10951       const typename ::std::tr1::tuple_element<I, Tuple>::type>::type get(
10952       const Tuple& tuple) {
10953     return ::std::tr1::get<I>(tuple);
10954   }
10955 };
10956 template <typename TupleT>
10957 const size_t TuplePolicy<TupleT>::tuple_size;
10958 #endif  // GTEST_HAS_TR1_TUPLE
10959
10960 #if GTEST_HAS_STD_TUPLE_
10961 template <typename... Types>
10962 struct TuplePolicy< ::std::tuple<Types...> > {
10963   typedef ::std::tuple<Types...> Tuple;
10964   static const size_t tuple_size = ::std::tuple_size<Tuple>::value;
10965
10966   template <size_t I>
10967   struct tuple_element : ::std::tuple_element<I, Tuple> {};
10968
10969   template <size_t I>
10970   static const typename ::std::tuple_element<I, Tuple>::type& get(
10971       const Tuple& tuple) {
10972     return ::std::get<I>(tuple);
10973   }
10974 };
10975 template <typename... Types>
10976 const size_t TuplePolicy< ::std::tuple<Types...> >::tuple_size;
10977 #endif  // GTEST_HAS_STD_TUPLE_
10978
10979 #if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
10980 // This helper template allows PrintTo() for tuples and
10981 // UniversalTersePrintTupleFieldsToStrings() to be defined by
10982 // induction on the number of tuple fields.  The idea is that
10983 // TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N
10984 // fields in tuple t, and can be defined in terms of
10985 // TuplePrefixPrinter<N - 1>.
10986 //
10987 // The inductive case.
10988 template <size_t N>
10989 struct TuplePrefixPrinter {
10990   // Prints the first N fields of a tuple.
10991   template <typename Tuple>
10992   static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
10993     TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os);
10994     GTEST_INTENTIONAL_CONST_COND_PUSH_()
10995     if (N > 1) {
10996     GTEST_INTENTIONAL_CONST_COND_POP_()
10997       *os << ", ";
10998     }
10999     UniversalPrinter<
11000         typename TuplePolicy<Tuple>::template tuple_element<N - 1>::type>
11001         ::Print(TuplePolicy<Tuple>::template get<N - 1>(t), os);
11002   }
11003
11004   // Tersely prints the first N fields of a tuple to a string vector,
11005   // one element for each field.
11006   template <typename Tuple>
11007   static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
11008     TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings);
11009     ::std::stringstream ss;
11010     UniversalTersePrint(TuplePolicy<Tuple>::template get<N - 1>(t), &ss);
11011     strings->push_back(ss.str());
11012   }
11013 };
11014
11015 // Base case.
11016 template <>
11017 struct TuplePrefixPrinter<0> {
11018   template <typename Tuple>
11019   static void PrintPrefixTo(const Tuple&, ::std::ostream*) {}
11020
11021   template <typename Tuple>
11022   static void TersePrintPrefixToStrings(const Tuple&, Strings*) {}
11023 };
11024
11025 // Helper function for printing a tuple.
11026 // Tuple must be either std::tr1::tuple or std::tuple type.
11027 template <typename Tuple>
11028 void PrintTupleTo(const Tuple& t, ::std::ostream* os) {
11029   *os << "(";
11030   TuplePrefixPrinter<TuplePolicy<Tuple>::tuple_size>::PrintPrefixTo(t, os);
11031   *os << ")";
11032 }
11033
11034 // Prints the fields of a tuple tersely to a string vector, one
11035 // element for each field.  See the comment before
11036 // UniversalTersePrint() for how we define "tersely".
11037 template <typename Tuple>
11038 Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
11039   Strings result;
11040   TuplePrefixPrinter<TuplePolicy<Tuple>::tuple_size>::
11041       TersePrintPrefixToStrings(value, &result);
11042   return result;
11043 }
11044 #endif  // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
11045
11046 }  // namespace internal
11047
11048 template <typename T>
11049 ::std::string PrintToString(const T& value) {
11050   ::std::stringstream ss;
11051   internal::UniversalTersePrinter<T>::Print(value, &ss);
11052   return ss.str();
11053 }
11054
11055 }  // namespace testing
11056
11057 // Include any custom printer added by the local installation.
11058 // We must include this header at the end to make sure it can use the
11059 // declarations from this file.
11060 // Copyright 2015, Google Inc.
11061 // All rights reserved.
11062 //
11063 // Redistribution and use in source and binary forms, with or without
11064 // modification, are permitted provided that the following conditions are
11065 // met:
11066 //
11067 //     * Redistributions of source code must retain the above copyright
11068 // notice, this list of conditions and the following disclaimer.
11069 //     * Redistributions in binary form must reproduce the above
11070 // copyright notice, this list of conditions and the following disclaimer
11071 // in the documentation and/or other materials provided with the
11072 // distribution.
11073 //     * Neither the name of Google Inc. nor the names of its
11074 // contributors may be used to endorse or promote products derived from
11075 // this software without specific prior written permission.
11076 //
11077 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
11078 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
11079 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
11080 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
11081 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
11082 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11083 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11084 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11085 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11086 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
11087 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11088 //
11089 // This file provides an injection point for custom printers in a local
11090 // installation of gTest.
11091 // It will be included from gtest-printers.h and the overrides in this file
11092 // will be visible to everyone.
11093 // See documentation at gtest/gtest-printers.h for details on how to define a
11094 // custom printer.
11095 //
11096 // ** Custom implementation starts here **
11097
11098 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
11099 #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
11100
11101 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
11102
11103 #endif  // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
11104
11105 #if GTEST_HAS_PARAM_TEST
11106
11107 namespace testing {
11108
11109 // Input to a parameterized test name generator, describing a test parameter.
11110 // Consists of the parameter value and the integer parameter index.
11111 template <class ParamType>
11112 struct TestParamInfo {
11113   TestParamInfo(const ParamType& a_param, size_t an_index) :
11114     param(a_param),
11115     index(an_index) {}
11116   ParamType param;
11117   size_t index;
11118 };
11119
11120 // A builtin parameterized test name generator which returns the result of
11121 // testing::PrintToString.
11122 struct PrintToStringParamName {
11123   template <class ParamType>
11124   std::string operator()(const TestParamInfo<ParamType>& info) const {
11125     return PrintToString(info.param);
11126   }
11127 };
11128
11129 namespace internal {
11130
11131 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11132 //
11133 // Outputs a message explaining invalid registration of different
11134 // fixture class for the same test case. This may happen when
11135 // TEST_P macro is used to define two tests with the same name
11136 // but in different namespaces.
11137 GTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name,
11138                                           CodeLocation code_location);
11139
11140 template <typename> class ParamGeneratorInterface;
11141 template <typename> class ParamGenerator;
11142
11143 // Interface for iterating over elements provided by an implementation
11144 // of ParamGeneratorInterface<T>.
11145 template <typename T>
11146 class ParamIteratorInterface {
11147  public:
11148   virtual ~ParamIteratorInterface() {}
11149   // A pointer to the base generator instance.
11150   // Used only for the purposes of iterator comparison
11151   // to make sure that two iterators belong to the same generator.
11152   virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;
11153   // Advances iterator to point to the next element
11154   // provided by the generator. The caller is responsible
11155   // for not calling Advance() on an iterator equal to
11156   // BaseGenerator()->End().
11157   virtual void Advance() = 0;
11158   // Clones the iterator object. Used for implementing copy semantics
11159   // of ParamIterator<T>.
11160   virtual ParamIteratorInterface* Clone() const = 0;
11161   // Dereferences the current iterator and provides (read-only) access
11162   // to the pointed value. It is the caller's responsibility not to call
11163   // Current() on an iterator equal to BaseGenerator()->End().
11164   // Used for implementing ParamGenerator<T>::operator*().
11165   virtual const T* Current() const = 0;
11166   // Determines whether the given iterator and other point to the same
11167   // element in the sequence generated by the generator.
11168   // Used for implementing ParamGenerator<T>::operator==().
11169   virtual bool Equals(const ParamIteratorInterface& other) const = 0;
11170 };
11171
11172 // Class iterating over elements provided by an implementation of
11173 // ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>
11174 // and implements the const forward iterator concept.
11175 template <typename T>
11176 class ParamIterator {
11177  public:
11178   typedef T value_type;
11179   typedef const T& reference;
11180   typedef ptrdiff_t difference_type;
11181
11182   // ParamIterator assumes ownership of the impl_ pointer.
11183   ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
11184   ParamIterator& operator=(const ParamIterator& other) {
11185     if (this != &other)
11186       impl_.reset(other.impl_->Clone());
11187     return *this;
11188   }
11189
11190   const T& operator*() const { return *impl_->Current(); }
11191   const T* operator->() const { return impl_->Current(); }
11192   // Prefix version of operator++.
11193   ParamIterator& operator++() {
11194     impl_->Advance();
11195     return *this;
11196   }
11197   // Postfix version of operator++.
11198   ParamIterator operator++(int /*unused*/) {
11199     ParamIteratorInterface<T>* clone = impl_->Clone();
11200     impl_->Advance();
11201     return ParamIterator(clone);
11202   }
11203   bool operator==(const ParamIterator& other) const {
11204     return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
11205   }
11206   bool operator!=(const ParamIterator& other) const {
11207     return !(*this == other);
11208   }
11209
11210  private:
11211   friend class ParamGenerator<T>;
11212   explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
11213   scoped_ptr<ParamIteratorInterface<T> > impl_;
11214 };
11215
11216 // ParamGeneratorInterface<T> is the binary interface to access generators
11217 // defined in other translation units.
11218 template <typename T>
11219 class ParamGeneratorInterface {
11220  public:
11221   typedef T ParamType;
11222
11223   virtual ~ParamGeneratorInterface() {}
11224
11225   // Generator interface definition
11226   virtual ParamIteratorInterface<T>* Begin() const = 0;
11227   virtual ParamIteratorInterface<T>* End() const = 0;
11228 };
11229
11230 // Wraps ParamGeneratorInterface<T> and provides general generator syntax
11231 // compatible with the STL Container concept.
11232 // This class implements copy initialization semantics and the contained
11233 // ParamGeneratorInterface<T> instance is shared among all copies
11234 // of the original object. This is possible because that instance is immutable.
11235 template<typename T>
11236 class ParamGenerator {
11237  public:
11238   typedef ParamIterator<T> iterator;
11239
11240   explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}
11241   ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}
11242
11243   ParamGenerator& operator=(const ParamGenerator& other) {
11244     impl_ = other.impl_;
11245     return *this;
11246   }
11247
11248   iterator begin() const { return iterator(impl_->Begin()); }
11249   iterator end() const { return iterator(impl_->End()); }
11250
11251  private:
11252   linked_ptr<const ParamGeneratorInterface<T> > impl_;
11253 };
11254
11255 // Generates values from a range of two comparable values. Can be used to
11256 // generate sequences of user-defined types that implement operator+() and
11257 // operator<().
11258 // This class is used in the Range() function.
11259 template <typename T, typename IncrementT>
11260 class RangeGenerator : public ParamGeneratorInterface<T> {
11261  public:
11262   RangeGenerator(T begin, T end, IncrementT step)
11263       : begin_(begin), end_(end),
11264         step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
11265   virtual ~RangeGenerator() {}
11266
11267   virtual ParamIteratorInterface<T>* Begin() const {
11268     return new Iterator(this, begin_, 0, step_);
11269   }
11270   virtual ParamIteratorInterface<T>* End() const {
11271     return new Iterator(this, end_, end_index_, step_);
11272   }
11273
11274  private:
11275   class Iterator : public ParamIteratorInterface<T> {
11276    public:
11277     Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
11278              IncrementT step)
11279         : base_(base), value_(value), index_(index), step_(step) {}
11280     virtual ~Iterator() {}
11281
11282     virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
11283       return base_;
11284     }
11285     virtual void Advance() {
11286       value_ = static_cast<T>(value_ + step_);
11287       index_++;
11288     }
11289     virtual ParamIteratorInterface<T>* Clone() const {
11290       return new Iterator(*this);
11291     }
11292     virtual const T* Current() const { return &value_; }
11293     virtual bool Equals(const ParamIteratorInterface<T>& other) const {
11294       // Having the same base generator guarantees that the other
11295       // iterator is of the same type and we can downcast.
11296       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
11297           << "The program attempted to compare iterators "
11298           << "from different generators." << std::endl;
11299       const int other_index =
11300           CheckedDowncastToActualType<const Iterator>(&other)->index_;
11301       return index_ == other_index;
11302     }
11303
11304    private:
11305     Iterator(const Iterator& other)
11306         : ParamIteratorInterface<T>(),
11307           base_(other.base_), value_(other.value_), index_(other.index_),
11308           step_(other.step_) {}
11309
11310     // No implementation - assignment is unsupported.
11311     void operator=(const Iterator& other);
11312
11313     const ParamGeneratorInterface<T>* const base_;
11314     T value_;
11315     int index_;
11316     const IncrementT step_;
11317   };  // class RangeGenerator::Iterator
11318
11319   static int CalculateEndIndex(const T& begin,
11320                                const T& end,
11321                                const IncrementT& step) {
11322     int end_index = 0;
11323     for (T i = begin; i < end; i = static_cast<T>(i + step))
11324       end_index++;
11325     return end_index;
11326   }
11327
11328   // No implementation - assignment is unsupported.
11329   void operator=(const RangeGenerator& other);
11330
11331   const T begin_;
11332   const T end_;
11333   const IncrementT step_;
11334   // The index for the end() iterator. All the elements in the generated
11335   // sequence are indexed (0-based) to aid iterator comparison.
11336   const int end_index_;
11337 };  // class RangeGenerator
11338
11339
11340 // Generates values from a pair of STL-style iterators. Used in the
11341 // ValuesIn() function. The elements are copied from the source range
11342 // since the source can be located on the stack, and the generator
11343 // is likely to persist beyond that stack frame.
11344 template <typename T>
11345 class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
11346  public:
11347   template <typename ForwardIterator>
11348   ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
11349       : container_(begin, end) {}
11350   virtual ~ValuesInIteratorRangeGenerator() {}
11351
11352   virtual ParamIteratorInterface<T>* Begin() const {
11353     return new Iterator(this, container_.begin());
11354   }
11355   virtual ParamIteratorInterface<T>* End() const {
11356     return new Iterator(this, container_.end());
11357   }
11358
11359  private:
11360   typedef typename ::std::vector<T> ContainerType;
11361
11362   class Iterator : public ParamIteratorInterface<T> {
11363    public:
11364     Iterator(const ParamGeneratorInterface<T>* base,
11365              typename ContainerType::const_iterator iterator)
11366         : base_(base), iterator_(iterator) {}
11367     virtual ~Iterator() {}
11368
11369     virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
11370       return base_;
11371     }
11372     virtual void Advance() {
11373       ++iterator_;
11374       value_.reset();
11375     }
11376     virtual ParamIteratorInterface<T>* Clone() const {
11377       return new Iterator(*this);
11378     }
11379     // We need to use cached value referenced by iterator_ because *iterator_
11380     // can return a temporary object (and of type other then T), so just
11381     // having "return &*iterator_;" doesn't work.
11382     // value_ is updated here and not in Advance() because Advance()
11383     // can advance iterator_ beyond the end of the range, and we cannot
11384     // detect that fact. The client code, on the other hand, is
11385     // responsible for not calling Current() on an out-of-range iterator.
11386     virtual const T* Current() const {
11387       if (value_.get() == NULL)
11388         value_.reset(new T(*iterator_));
11389       return value_.get();
11390     }
11391     virtual bool Equals(const ParamIteratorInterface<T>& other) const {
11392       // Having the same base generator guarantees that the other
11393       // iterator is of the same type and we can downcast.
11394       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
11395           << "The program attempted to compare iterators "
11396           << "from different generators." << std::endl;
11397       return iterator_ ==
11398           CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
11399     }
11400
11401    private:
11402     Iterator(const Iterator& other)
11403           // The explicit constructor call suppresses a false warning
11404           // emitted by gcc when supplied with the -Wextra option.
11405         : ParamIteratorInterface<T>(),
11406           base_(other.base_),
11407           iterator_(other.iterator_) {}
11408
11409     const ParamGeneratorInterface<T>* const base_;
11410     typename ContainerType::const_iterator iterator_;
11411     // A cached value of *iterator_. We keep it here to allow access by
11412     // pointer in the wrapping iterator's operator->().
11413     // value_ needs to be mutable to be accessed in Current().
11414     // Use of scoped_ptr helps manage cached value's lifetime,
11415     // which is bound by the lifespan of the iterator itself.
11416     mutable scoped_ptr<const T> value_;
11417   };  // class ValuesInIteratorRangeGenerator::Iterator
11418
11419   // No implementation - assignment is unsupported.
11420   void operator=(const ValuesInIteratorRangeGenerator& other);
11421
11422   const ContainerType container_;
11423 };  // class ValuesInIteratorRangeGenerator
11424
11425 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11426 //
11427 // Default parameterized test name generator, returns a string containing the
11428 // integer test parameter index.
11429 template <class ParamType>
11430 std::string DefaultParamName(const TestParamInfo<ParamType>& info) {
11431   Message name_stream;
11432   name_stream << info.index;
11433   return name_stream.GetString();
11434 }
11435
11436 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11437 //
11438 // Parameterized test name overload helpers, which help the
11439 // INSTANTIATE_TEST_CASE_P macro choose between the default parameterized
11440 // test name generator and user param name generator.
11441 template <class ParamType, class ParamNameGenFunctor>
11442 ParamNameGenFunctor GetParamNameGen(ParamNameGenFunctor func) {
11443   return func;
11444 }
11445
11446 template <class ParamType>
11447 struct ParamNameGenFunc {
11448   typedef std::string Type(const TestParamInfo<ParamType>&);
11449 };
11450
11451 template <class ParamType>
11452 typename ParamNameGenFunc<ParamType>::Type *GetParamNameGen() {
11453   return DefaultParamName;
11454 }
11455
11456 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11457 //
11458 // Stores a parameter value and later creates tests parameterized with that
11459 // value.
11460 template <class TestClass>
11461 class ParameterizedTestFactory : public TestFactoryBase {
11462  public:
11463   typedef typename TestClass::ParamType ParamType;
11464   explicit ParameterizedTestFactory(ParamType parameter) :
11465       parameter_(parameter) {}
11466   virtual Test* CreateTest() {
11467     TestClass::SetParam(&parameter_);
11468     return new TestClass();
11469   }
11470
11471  private:
11472   const ParamType parameter_;
11473
11474   GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
11475 };
11476
11477 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11478 //
11479 // TestMetaFactoryBase is a base class for meta-factories that create
11480 // test factories for passing into MakeAndRegisterTestInfo function.
11481 template <class ParamType>
11482 class TestMetaFactoryBase {
11483  public:
11484   virtual ~TestMetaFactoryBase() {}
11485
11486   virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
11487 };
11488
11489 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11490 //
11491 // TestMetaFactory creates test factories for passing into
11492 // MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives
11493 // ownership of test factory pointer, same factory object cannot be passed
11494 // into that method twice. But ParameterizedTestCaseInfo is going to call
11495 // it for each Test/Parameter value combination. Thus it needs meta factory
11496 // creator class.
11497 template <class TestCase>
11498 class TestMetaFactory
11499     : public TestMetaFactoryBase<typename TestCase::ParamType> {
11500  public:
11501   typedef typename TestCase::ParamType ParamType;
11502
11503   TestMetaFactory() {}
11504
11505   virtual TestFactoryBase* CreateTestFactory(ParamType parameter) {
11506     return new ParameterizedTestFactory<TestCase>(parameter);
11507   }
11508
11509  private:
11510   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
11511 };
11512
11513 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11514 //
11515 // ParameterizedTestCaseInfoBase is a generic interface
11516 // to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase
11517 // accumulates test information provided by TEST_P macro invocations
11518 // and generators provided by INSTANTIATE_TEST_CASE_P macro invocations
11519 // and uses that information to register all resulting test instances
11520 // in RegisterTests method. The ParameterizeTestCaseRegistry class holds
11521 // a collection of pointers to the ParameterizedTestCaseInfo objects
11522 // and calls RegisterTests() on each of them when asked.
11523 class ParameterizedTestCaseInfoBase {
11524  public:
11525   virtual ~ParameterizedTestCaseInfoBase() {}
11526
11527   // Base part of test case name for display purposes.
11528   virtual const string& GetTestCaseName() const = 0;
11529   // Test case id to verify identity.
11530   virtual TypeId GetTestCaseTypeId() const = 0;
11531   // UnitTest class invokes this method to register tests in this
11532   // test case right before running them in RUN_ALL_TESTS macro.
11533   // This method should not be called more then once on any single
11534   // instance of a ParameterizedTestCaseInfoBase derived class.
11535   virtual void RegisterTests() = 0;
11536
11537  protected:
11538   ParameterizedTestCaseInfoBase() {}
11539
11540  private:
11541   GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase);
11542 };
11543
11544 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11545 //
11546 // ParameterizedTestCaseInfo accumulates tests obtained from TEST_P
11547 // macro invocations for a particular test case and generators
11548 // obtained from INSTANTIATE_TEST_CASE_P macro invocations for that
11549 // test case. It registers tests with all values generated by all
11550 // generators when asked.
11551 template <class TestCase>
11552 class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
11553  public:
11554   // ParamType and GeneratorCreationFunc are private types but are required
11555   // for declarations of public methods AddTestPattern() and
11556   // AddTestCaseInstantiation().
11557   typedef typename TestCase::ParamType ParamType;
11558   // A function that returns an instance of appropriate generator type.
11559   typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
11560   typedef typename ParamNameGenFunc<ParamType>::Type ParamNameGeneratorFunc;
11561
11562   explicit ParameterizedTestCaseInfo(
11563       const char* name, CodeLocation code_location)
11564       : test_case_name_(name), code_location_(code_location) {}
11565
11566   // Test case base name for display purposes.
11567   virtual const string& GetTestCaseName() const { return test_case_name_; }
11568   // Test case id to verify identity.
11569   virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }
11570   // TEST_P macro uses AddTestPattern() to record information
11571   // about a single test in a LocalTestInfo structure.
11572   // test_case_name is the base name of the test case (without invocation
11573   // prefix). test_base_name is the name of an individual test without
11574   // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
11575   // test case base name and DoBar is test base name.
11576   void AddTestPattern(const char* test_case_name,
11577                       const char* test_base_name,
11578                       TestMetaFactoryBase<ParamType>* meta_factory) {
11579     tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name,
11580                                                        test_base_name,
11581                                                        meta_factory)));
11582   }
11583   // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information
11584   // about a generator.
11585   int AddTestCaseInstantiation(const string& instantiation_name,
11586                                GeneratorCreationFunc* func,
11587                                ParamNameGeneratorFunc* name_func,
11588                                const char* file,
11589                                int line) {
11590     instantiations_.push_back(
11591         InstantiationInfo(instantiation_name, func, name_func, file, line));
11592     return 0;  // Return value used only to run this method in namespace scope.
11593   }
11594   // UnitTest class invokes this method to register tests in this test case
11595   // test cases right before running tests in RUN_ALL_TESTS macro.
11596   // This method should not be called more then once on any single
11597   // instance of a ParameterizedTestCaseInfoBase derived class.
11598   // UnitTest has a guard to prevent from calling this method more then once.
11599   virtual void RegisterTests() {
11600     for (typename TestInfoContainer::iterator test_it = tests_.begin();
11601          test_it != tests_.end(); ++test_it) {
11602       linked_ptr<TestInfo> test_info = *test_it;
11603       for (typename InstantiationContainer::iterator gen_it =
11604                instantiations_.begin(); gen_it != instantiations_.end();
11605                ++gen_it) {
11606         const string& instantiation_name = gen_it->name;
11607         ParamGenerator<ParamType> generator((*gen_it->generator)());
11608         ParamNameGeneratorFunc* name_func = gen_it->name_func;
11609         const char* file = gen_it->file;
11610         int line = gen_it->line;
11611
11612         string test_case_name;
11613         if ( !instantiation_name.empty() )
11614           test_case_name = instantiation_name + "/";
11615         test_case_name += test_info->test_case_base_name;
11616
11617         size_t i = 0;
11618         std::set<std::string> test_param_names;
11619         for (typename ParamGenerator<ParamType>::iterator param_it =
11620                  generator.begin();
11621              param_it != generator.end(); ++param_it, ++i) {
11622           Message test_name_stream;
11623
11624           std::string param_name = name_func(
11625               TestParamInfo<ParamType>(*param_it, i));
11626
11627           GTEST_CHECK_(IsValidParamName(param_name))
11628               << "Parameterized test name '" << param_name
11629               << "' is invalid, in " << file
11630               << " line " << line << std::endl;
11631
11632           GTEST_CHECK_(test_param_names.count(param_name) == 0)
11633               << "Duplicate parameterized test name '" << param_name
11634               << "', in " << file << " line " << line << std::endl;
11635
11636           test_param_names.insert(param_name);
11637
11638           test_name_stream << test_info->test_base_name << "/" << param_name;
11639           MakeAndRegisterTestInfo(
11640               test_case_name.c_str(),
11641               test_name_stream.GetString().c_str(),
11642               NULL,  // No type parameter.
11643               PrintToString(*param_it).c_str(),
11644               code_location_,
11645               GetTestCaseTypeId(),
11646               TestCase::SetUpTestCase,
11647               TestCase::TearDownTestCase,
11648               test_info->test_meta_factory->CreateTestFactory(*param_it));
11649         }  // for param_it
11650       }  // for gen_it
11651     }  // for test_it
11652   }  // RegisterTests
11653
11654  private:
11655   // LocalTestInfo structure keeps information about a single test registered
11656   // with TEST_P macro.
11657   struct TestInfo {
11658     TestInfo(const char* a_test_case_base_name,
11659              const char* a_test_base_name,
11660              TestMetaFactoryBase<ParamType>* a_test_meta_factory) :
11661         test_case_base_name(a_test_case_base_name),
11662         test_base_name(a_test_base_name),
11663         test_meta_factory(a_test_meta_factory) {}
11664
11665     const string test_case_base_name;
11666     const string test_base_name;
11667     const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
11668   };
11669   typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;
11670   // Records data received from INSTANTIATE_TEST_CASE_P macros:
11671   //  <Instantiation name, Sequence generator creation function,
11672   //     Name generator function, Source file, Source line>
11673   struct InstantiationInfo {
11674       InstantiationInfo(const std::string &name_in,
11675                         GeneratorCreationFunc* generator_in,
11676                         ParamNameGeneratorFunc* name_func_in,
11677                         const char* file_in,
11678                         int line_in)
11679           : name(name_in),
11680             generator(generator_in),
11681             name_func(name_func_in),
11682             file(file_in),
11683             line(line_in) {}
11684
11685       std::string name;
11686       GeneratorCreationFunc* generator;
11687       ParamNameGeneratorFunc* name_func;
11688       const char* file;
11689       int line;
11690   };
11691   typedef ::std::vector<InstantiationInfo> InstantiationContainer;
11692
11693   static bool IsValidParamName(const std::string& name) {
11694     // Check for empty string
11695     if (name.empty())
11696       return false;
11697
11698     // Check for invalid characters
11699     for (std::string::size_type index = 0; index < name.size(); ++index) {
11700       if (!isalnum(name[index]) && name[index] != '_')
11701         return false;
11702     }
11703
11704     return true;
11705   }
11706
11707   const string test_case_name_;
11708   CodeLocation code_location_;
11709   TestInfoContainer tests_;
11710   InstantiationContainer instantiations_;
11711
11712   GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo);
11713 };  // class ParameterizedTestCaseInfo
11714
11715 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
11716 //
11717 // ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase
11718 // classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P
11719 // macros use it to locate their corresponding ParameterizedTestCaseInfo
11720 // descriptors.
11721 class ParameterizedTestCaseRegistry {
11722  public:
11723   ParameterizedTestCaseRegistry() {}
11724   ~ParameterizedTestCaseRegistry() {
11725     for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
11726          it != test_case_infos_.end(); ++it) {
11727       delete *it;
11728     }
11729   }
11730
11731   // Looks up or creates and returns a structure containing information about
11732   // tests and instantiations of a particular test case.
11733   template <class TestCase>
11734   ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(
11735       const char* test_case_name,
11736       CodeLocation code_location) {
11737     ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL;
11738     for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
11739          it != test_case_infos_.end(); ++it) {
11740       if ((*it)->GetTestCaseName() == test_case_name) {
11741         if ((*it)->GetTestCaseTypeId() != GetTypeId<TestCase>()) {
11742           // Complain about incorrect usage of Google Test facilities
11743           // and terminate the program since we cannot guaranty correct
11744           // test case setup and tear-down in this case.
11745           ReportInvalidTestCaseType(test_case_name, code_location);
11746           posix::Abort();
11747         } else {
11748           // At this point we are sure that the object we found is of the same
11749           // type we are looking for, so we downcast it to that type
11750           // without further checks.
11751           typed_test_info = CheckedDowncastToActualType<
11752               ParameterizedTestCaseInfo<TestCase> >(*it);
11753         }
11754         break;
11755       }
11756     }
11757     if (typed_test_info == NULL) {
11758       typed_test_info = new ParameterizedTestCaseInfo<TestCase>(
11759           test_case_name, code_location);
11760       test_case_infos_.push_back(typed_test_info);
11761     }
11762     return typed_test_info;
11763   }
11764   void RegisterTests() {
11765     for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
11766          it != test_case_infos_.end(); ++it) {
11767       (*it)->RegisterTests();
11768     }
11769   }
11770
11771  private:
11772   typedef ::std::vector<ParameterizedTestCaseInfoBase*> TestCaseInfoContainer;
11773
11774   TestCaseInfoContainer test_case_infos_;
11775
11776   GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry);
11777 };
11778
11779 }  // namespace internal
11780 }  // namespace testing
11781
11782 #endif  //  GTEST_HAS_PARAM_TEST
11783
11784 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
11785 // This file was GENERATED by command:
11786 //     pump.py gtest-param-util-generated.h.pump
11787 // DO NOT EDIT BY HAND!!!
11788
11789 // Copyright 2008 Google Inc.
11790 // All Rights Reserved.
11791 //
11792 // Redistribution and use in source and binary forms, with or without
11793 // modification, are permitted provided that the following conditions are
11794 // met:
11795 //
11796 //     * Redistributions of source code must retain the above copyright
11797 // notice, this list of conditions and the following disclaimer.
11798 //     * Redistributions in binary form must reproduce the above
11799 // copyright notice, this list of conditions and the following disclaimer
11800 // in the documentation and/or other materials provided with the
11801 // distribution.
11802 //     * Neither the name of Google Inc. nor the names of its
11803 // contributors may be used to endorse or promote products derived from
11804 // this software without specific prior written permission.
11805 //
11806 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
11807 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
11808 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
11809 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
11810 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
11811 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11812 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11813 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11814 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11815 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
11816 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11817 //
11818 // Author: vladl@google.com (Vlad Losev)
11819
11820 // Type and function utilities for implementing parameterized tests.
11821 // This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
11822 //
11823 // Currently Google Test supports at most 50 arguments in Values,
11824 // and at most 10 arguments in Combine. Please contact
11825 // googletestframework@googlegroups.com if you need more.
11826 // Please note that the number of arguments to Combine is limited
11827 // by the maximum arity of the implementation of tuple which is
11828 // currently set at 10.
11829
11830 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
11831 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
11832
11833 // scripts/fuse_gtest.py depends on gtest's own header being #included
11834 // *unconditionally*.  Therefore these #includes cannot be moved
11835 // inside #if GTEST_HAS_PARAM_TEST.
11836
11837 #if GTEST_HAS_PARAM_TEST
11838
11839 namespace testing {
11840
11841 // Forward declarations of ValuesIn(), which is implemented in
11842 // include/gtest/gtest-param-test.h.
11843 template <typename ForwardIterator>
11844 internal::ParamGenerator<
11845   typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
11846 ValuesIn(ForwardIterator begin, ForwardIterator end);
11847
11848 template <typename T, size_t N>
11849 internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
11850
11851 template <class Container>
11852 internal::ParamGenerator<typename Container::value_type> ValuesIn(
11853     const Container& container);
11854
11855 namespace internal {
11856
11857 // Used in the Values() function to provide polymorphic capabilities.
11858 template <typename T1>
11859 class ValueArray1 {
11860  public:
11861   explicit ValueArray1(T1 v1) : v1_(v1) {}
11862
11863   template <typename T>
11864   operator ParamGenerator<T>() const {
11865     const T array[] = {static_cast<T>(v1_)};
11866     return ValuesIn(array);
11867   }
11868
11869  private:
11870   // No implementation - assignment is unsupported.
11871   void operator=(const ValueArray1& other);
11872
11873   const T1 v1_;
11874 };
11875
11876 template <typename T1, typename T2>
11877 class ValueArray2 {
11878  public:
11879   ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {}
11880
11881   template <typename T>
11882   operator ParamGenerator<T>() const {
11883     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_)};
11884     return ValuesIn(array);
11885   }
11886
11887  private:
11888   // No implementation - assignment is unsupported.
11889   void operator=(const ValueArray2& other);
11890
11891   const T1 v1_;
11892   const T2 v2_;
11893 };
11894
11895 template <typename T1, typename T2, typename T3>
11896 class ValueArray3 {
11897  public:
11898   ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {}
11899
11900   template <typename T>
11901   operator ParamGenerator<T>() const {
11902     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11903         static_cast<T>(v3_)};
11904     return ValuesIn(array);
11905   }
11906
11907  private:
11908   // No implementation - assignment is unsupported.
11909   void operator=(const ValueArray3& other);
11910
11911   const T1 v1_;
11912   const T2 v2_;
11913   const T3 v3_;
11914 };
11915
11916 template <typename T1, typename T2, typename T3, typename T4>
11917 class ValueArray4 {
11918  public:
11919   ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3),
11920       v4_(v4) {}
11921
11922   template <typename T>
11923   operator ParamGenerator<T>() const {
11924     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11925         static_cast<T>(v3_), static_cast<T>(v4_)};
11926     return ValuesIn(array);
11927   }
11928
11929  private:
11930   // No implementation - assignment is unsupported.
11931   void operator=(const ValueArray4& other);
11932
11933   const T1 v1_;
11934   const T2 v2_;
11935   const T3 v3_;
11936   const T4 v4_;
11937 };
11938
11939 template <typename T1, typename T2, typename T3, typename T4, typename T5>
11940 class ValueArray5 {
11941  public:
11942   ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3),
11943       v4_(v4), v5_(v5) {}
11944
11945   template <typename T>
11946   operator ParamGenerator<T>() const {
11947     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11948         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_)};
11949     return ValuesIn(array);
11950   }
11951
11952  private:
11953   // No implementation - assignment is unsupported.
11954   void operator=(const ValueArray5& other);
11955
11956   const T1 v1_;
11957   const T2 v2_;
11958   const T3 v3_;
11959   const T4 v4_;
11960   const T5 v5_;
11961 };
11962
11963 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11964     typename T6>
11965 class ValueArray6 {
11966  public:
11967   ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2),
11968       v3_(v3), v4_(v4), v5_(v5), v6_(v6) {}
11969
11970   template <typename T>
11971   operator ParamGenerator<T>() const {
11972     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
11973         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
11974         static_cast<T>(v6_)};
11975     return ValuesIn(array);
11976   }
11977
11978  private:
11979   // No implementation - assignment is unsupported.
11980   void operator=(const ValueArray6& other);
11981
11982   const T1 v1_;
11983   const T2 v2_;
11984   const T3 v3_;
11985   const T4 v4_;
11986   const T5 v5_;
11987   const T6 v6_;
11988 };
11989
11990 template <typename T1, typename T2, typename T3, typename T4, typename T5,
11991     typename T6, typename T7>
11992 class ValueArray7 {
11993  public:
11994   ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1),
11995       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {}
11996
11997   template <typename T>
11998   operator ParamGenerator<T>() const {
11999     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12000         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12001         static_cast<T>(v6_), static_cast<T>(v7_)};
12002     return ValuesIn(array);
12003   }
12004
12005  private:
12006   // No implementation - assignment is unsupported.
12007   void operator=(const ValueArray7& other);
12008
12009   const T1 v1_;
12010   const T2 v2_;
12011   const T3 v3_;
12012   const T4 v4_;
12013   const T5 v5_;
12014   const T6 v6_;
12015   const T7 v7_;
12016 };
12017
12018 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12019     typename T6, typename T7, typename T8>
12020 class ValueArray8 {
12021  public:
12022   ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
12023       T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12024       v8_(v8) {}
12025
12026   template <typename T>
12027   operator ParamGenerator<T>() const {
12028     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12029         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12030         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_)};
12031     return ValuesIn(array);
12032   }
12033
12034  private:
12035   // No implementation - assignment is unsupported.
12036   void operator=(const ValueArray8& other);
12037
12038   const T1 v1_;
12039   const T2 v2_;
12040   const T3 v3_;
12041   const T4 v4_;
12042   const T5 v5_;
12043   const T6 v6_;
12044   const T7 v7_;
12045   const T8 v8_;
12046 };
12047
12048 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12049     typename T6, typename T7, typename T8, typename T9>
12050 class ValueArray9 {
12051  public:
12052   ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
12053       T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12054       v8_(v8), v9_(v9) {}
12055
12056   template <typename T>
12057   operator ParamGenerator<T>() const {
12058     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12059         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12060         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12061         static_cast<T>(v9_)};
12062     return ValuesIn(array);
12063   }
12064
12065  private:
12066   // No implementation - assignment is unsupported.
12067   void operator=(const ValueArray9& other);
12068
12069   const T1 v1_;
12070   const T2 v2_;
12071   const T3 v3_;
12072   const T4 v4_;
12073   const T5 v5_;
12074   const T6 v6_;
12075   const T7 v7_;
12076   const T8 v8_;
12077   const T9 v9_;
12078 };
12079
12080 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12081     typename T6, typename T7, typename T8, typename T9, typename T10>
12082 class ValueArray10 {
12083  public:
12084   ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12085       T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12086       v8_(v8), v9_(v9), v10_(v10) {}
12087
12088   template <typename T>
12089   operator ParamGenerator<T>() const {
12090     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12091         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12092         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12093         static_cast<T>(v9_), static_cast<T>(v10_)};
12094     return ValuesIn(array);
12095   }
12096
12097  private:
12098   // No implementation - assignment is unsupported.
12099   void operator=(const ValueArray10& other);
12100
12101   const T1 v1_;
12102   const T2 v2_;
12103   const T3 v3_;
12104   const T4 v4_;
12105   const T5 v5_;
12106   const T6 v6_;
12107   const T7 v7_;
12108   const T8 v8_;
12109   const T9 v9_;
12110   const T10 v10_;
12111 };
12112
12113 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12114     typename T6, typename T7, typename T8, typename T9, typename T10,
12115     typename T11>
12116 class ValueArray11 {
12117  public:
12118   ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12119       T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
12120       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {}
12121
12122   template <typename T>
12123   operator ParamGenerator<T>() const {
12124     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12125         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12126         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12127         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_)};
12128     return ValuesIn(array);
12129   }
12130
12131  private:
12132   // No implementation - assignment is unsupported.
12133   void operator=(const ValueArray11& other);
12134
12135   const T1 v1_;
12136   const T2 v2_;
12137   const T3 v3_;
12138   const T4 v4_;
12139   const T5 v5_;
12140   const T6 v6_;
12141   const T7 v7_;
12142   const T8 v8_;
12143   const T9 v9_;
12144   const T10 v10_;
12145   const T11 v11_;
12146 };
12147
12148 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12149     typename T6, typename T7, typename T8, typename T9, typename T10,
12150     typename T11, typename T12>
12151 class ValueArray12 {
12152  public:
12153   ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12154       T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
12155       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {}
12156
12157   template <typename T>
12158   operator ParamGenerator<T>() const {
12159     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12160         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12161         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12162         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12163         static_cast<T>(v12_)};
12164     return ValuesIn(array);
12165   }
12166
12167  private:
12168   // No implementation - assignment is unsupported.
12169   void operator=(const ValueArray12& other);
12170
12171   const T1 v1_;
12172   const T2 v2_;
12173   const T3 v3_;
12174   const T4 v4_;
12175   const T5 v5_;
12176   const T6 v6_;
12177   const T7 v7_;
12178   const T8 v8_;
12179   const T9 v9_;
12180   const T10 v10_;
12181   const T11 v11_;
12182   const T12 v12_;
12183 };
12184
12185 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12186     typename T6, typename T7, typename T8, typename T9, typename T10,
12187     typename T11, typename T12, typename T13>
12188 class ValueArray13 {
12189  public:
12190   ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12191       T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
12192       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
12193       v12_(v12), v13_(v13) {}
12194
12195   template <typename T>
12196   operator ParamGenerator<T>() const {
12197     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12198         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12199         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12200         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12201         static_cast<T>(v12_), static_cast<T>(v13_)};
12202     return ValuesIn(array);
12203   }
12204
12205  private:
12206   // No implementation - assignment is unsupported.
12207   void operator=(const ValueArray13& other);
12208
12209   const T1 v1_;
12210   const T2 v2_;
12211   const T3 v3_;
12212   const T4 v4_;
12213   const T5 v5_;
12214   const T6 v6_;
12215   const T7 v7_;
12216   const T8 v8_;
12217   const T9 v9_;
12218   const T10 v10_;
12219   const T11 v11_;
12220   const T12 v12_;
12221   const T13 v13_;
12222 };
12223
12224 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12225     typename T6, typename T7, typename T8, typename T9, typename T10,
12226     typename T11, typename T12, typename T13, typename T14>
12227 class ValueArray14 {
12228  public:
12229   ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12230       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3),
12231       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12232       v11_(v11), v12_(v12), v13_(v13), v14_(v14) {}
12233
12234   template <typename T>
12235   operator ParamGenerator<T>() const {
12236     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12237         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12238         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12239         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12240         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_)};
12241     return ValuesIn(array);
12242   }
12243
12244  private:
12245   // No implementation - assignment is unsupported.
12246   void operator=(const ValueArray14& other);
12247
12248   const T1 v1_;
12249   const T2 v2_;
12250   const T3 v3_;
12251   const T4 v4_;
12252   const T5 v5_;
12253   const T6 v6_;
12254   const T7 v7_;
12255   const T8 v8_;
12256   const T9 v9_;
12257   const T10 v10_;
12258   const T11 v11_;
12259   const T12 v12_;
12260   const T13 v13_;
12261   const T14 v14_;
12262 };
12263
12264 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12265     typename T6, typename T7, typename T8, typename T9, typename T10,
12266     typename T11, typename T12, typename T13, typename T14, typename T15>
12267 class ValueArray15 {
12268  public:
12269   ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12270       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2),
12271       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12272       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {}
12273
12274   template <typename T>
12275   operator ParamGenerator<T>() const {
12276     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12277         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12278         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12279         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12280         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12281         static_cast<T>(v15_)};
12282     return ValuesIn(array);
12283   }
12284
12285  private:
12286   // No implementation - assignment is unsupported.
12287   void operator=(const ValueArray15& other);
12288
12289   const T1 v1_;
12290   const T2 v2_;
12291   const T3 v3_;
12292   const T4 v4_;
12293   const T5 v5_;
12294   const T6 v6_;
12295   const T7 v7_;
12296   const T8 v8_;
12297   const T9 v9_;
12298   const T10 v10_;
12299   const T11 v11_;
12300   const T12 v12_;
12301   const T13 v13_;
12302   const T14 v14_;
12303   const T15 v15_;
12304 };
12305
12306 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12307     typename T6, typename T7, typename T8, typename T9, typename T10,
12308     typename T11, typename T12, typename T13, typename T14, typename T15,
12309     typename T16>
12310 class ValueArray16 {
12311  public:
12312   ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12313       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1),
12314       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
12315       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
12316       v16_(v16) {}
12317
12318   template <typename T>
12319   operator ParamGenerator<T>() const {
12320     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12321         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12322         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12323         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12324         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12325         static_cast<T>(v15_), static_cast<T>(v16_)};
12326     return ValuesIn(array);
12327   }
12328
12329  private:
12330   // No implementation - assignment is unsupported.
12331   void operator=(const ValueArray16& other);
12332
12333   const T1 v1_;
12334   const T2 v2_;
12335   const T3 v3_;
12336   const T4 v4_;
12337   const T5 v5_;
12338   const T6 v6_;
12339   const T7 v7_;
12340   const T8 v8_;
12341   const T9 v9_;
12342   const T10 v10_;
12343   const T11 v11_;
12344   const T12 v12_;
12345   const T13 v13_;
12346   const T14 v14_;
12347   const T15 v15_;
12348   const T16 v16_;
12349 };
12350
12351 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12352     typename T6, typename T7, typename T8, typename T9, typename T10,
12353     typename T11, typename T12, typename T13, typename T14, typename T15,
12354     typename T16, typename T17>
12355 class ValueArray17 {
12356  public:
12357   ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12358       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
12359       T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12360       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12361       v15_(v15), v16_(v16), v17_(v17) {}
12362
12363   template <typename T>
12364   operator ParamGenerator<T>() const {
12365     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12366         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12367         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12368         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12369         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12370         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_)};
12371     return ValuesIn(array);
12372   }
12373
12374  private:
12375   // No implementation - assignment is unsupported.
12376   void operator=(const ValueArray17& other);
12377
12378   const T1 v1_;
12379   const T2 v2_;
12380   const T3 v3_;
12381   const T4 v4_;
12382   const T5 v5_;
12383   const T6 v6_;
12384   const T7 v7_;
12385   const T8 v8_;
12386   const T9 v9_;
12387   const T10 v10_;
12388   const T11 v11_;
12389   const T12 v12_;
12390   const T13 v13_;
12391   const T14 v14_;
12392   const T15 v15_;
12393   const T16 v16_;
12394   const T17 v17_;
12395 };
12396
12397 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12398     typename T6, typename T7, typename T8, typename T9, typename T10,
12399     typename T11, typename T12, typename T13, typename T14, typename T15,
12400     typename T16, typename T17, typename T18>
12401 class ValueArray18 {
12402  public:
12403   ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12404       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12405       T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12406       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12407       v15_(v15), v16_(v16), v17_(v17), v18_(v18) {}
12408
12409   template <typename T>
12410   operator ParamGenerator<T>() const {
12411     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12412         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12413         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12414         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12415         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12416         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12417         static_cast<T>(v18_)};
12418     return ValuesIn(array);
12419   }
12420
12421  private:
12422   // No implementation - assignment is unsupported.
12423   void operator=(const ValueArray18& other);
12424
12425   const T1 v1_;
12426   const T2 v2_;
12427   const T3 v3_;
12428   const T4 v4_;
12429   const T5 v5_;
12430   const T6 v6_;
12431   const T7 v7_;
12432   const T8 v8_;
12433   const T9 v9_;
12434   const T10 v10_;
12435   const T11 v11_;
12436   const T12 v12_;
12437   const T13 v13_;
12438   const T14 v14_;
12439   const T15 v15_;
12440   const T16 v16_;
12441   const T17 v17_;
12442   const T18 v18_;
12443 };
12444
12445 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12446     typename T6, typename T7, typename T8, typename T9, typename T10,
12447     typename T11, typename T12, typename T13, typename T14, typename T15,
12448     typename T16, typename T17, typename T18, typename T19>
12449 class ValueArray19 {
12450  public:
12451   ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12452       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12453       T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
12454       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
12455       v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {}
12456
12457   template <typename T>
12458   operator ParamGenerator<T>() const {
12459     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12460         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12461         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12462         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12463         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12464         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12465         static_cast<T>(v18_), static_cast<T>(v19_)};
12466     return ValuesIn(array);
12467   }
12468
12469  private:
12470   // No implementation - assignment is unsupported.
12471   void operator=(const ValueArray19& other);
12472
12473   const T1 v1_;
12474   const T2 v2_;
12475   const T3 v3_;
12476   const T4 v4_;
12477   const T5 v5_;
12478   const T6 v6_;
12479   const T7 v7_;
12480   const T8 v8_;
12481   const T9 v9_;
12482   const T10 v10_;
12483   const T11 v11_;
12484   const T12 v12_;
12485   const T13 v13_;
12486   const T14 v14_;
12487   const T15 v15_;
12488   const T16 v16_;
12489   const T17 v17_;
12490   const T18 v18_;
12491   const T19 v19_;
12492 };
12493
12494 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12495     typename T6, typename T7, typename T8, typename T9, typename T10,
12496     typename T11, typename T12, typename T13, typename T14, typename T15,
12497     typename T16, typename T17, typename T18, typename T19, typename T20>
12498 class ValueArray20 {
12499  public:
12500   ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12501       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12502       T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
12503       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
12504       v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
12505       v19_(v19), v20_(v20) {}
12506
12507   template <typename T>
12508   operator ParamGenerator<T>() const {
12509     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12510         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12511         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12512         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12513         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12514         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12515         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_)};
12516     return ValuesIn(array);
12517   }
12518
12519  private:
12520   // No implementation - assignment is unsupported.
12521   void operator=(const ValueArray20& other);
12522
12523   const T1 v1_;
12524   const T2 v2_;
12525   const T3 v3_;
12526   const T4 v4_;
12527   const T5 v5_;
12528   const T6 v6_;
12529   const T7 v7_;
12530   const T8 v8_;
12531   const T9 v9_;
12532   const T10 v10_;
12533   const T11 v11_;
12534   const T12 v12_;
12535   const T13 v13_;
12536   const T14 v14_;
12537   const T15 v15_;
12538   const T16 v16_;
12539   const T17 v17_;
12540   const T18 v18_;
12541   const T19 v19_;
12542   const T20 v20_;
12543 };
12544
12545 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12546     typename T6, typename T7, typename T8, typename T9, typename T10,
12547     typename T11, typename T12, typename T13, typename T14, typename T15,
12548     typename T16, typename T17, typename T18, typename T19, typename T20,
12549     typename T21>
12550 class ValueArray21 {
12551  public:
12552   ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12553       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12554       T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
12555       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
12556       v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
12557       v18_(v18), v19_(v19), v20_(v20), v21_(v21) {}
12558
12559   template <typename T>
12560   operator ParamGenerator<T>() const {
12561     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12562         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12563         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12564         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12565         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12566         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12567         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12568         static_cast<T>(v21_)};
12569     return ValuesIn(array);
12570   }
12571
12572  private:
12573   // No implementation - assignment is unsupported.
12574   void operator=(const ValueArray21& other);
12575
12576   const T1 v1_;
12577   const T2 v2_;
12578   const T3 v3_;
12579   const T4 v4_;
12580   const T5 v5_;
12581   const T6 v6_;
12582   const T7 v7_;
12583   const T8 v8_;
12584   const T9 v9_;
12585   const T10 v10_;
12586   const T11 v11_;
12587   const T12 v12_;
12588   const T13 v13_;
12589   const T14 v14_;
12590   const T15 v15_;
12591   const T16 v16_;
12592   const T17 v17_;
12593   const T18 v18_;
12594   const T19 v19_;
12595   const T20 v20_;
12596   const T21 v21_;
12597 };
12598
12599 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12600     typename T6, typename T7, typename T8, typename T9, typename T10,
12601     typename T11, typename T12, typename T13, typename T14, typename T15,
12602     typename T16, typename T17, typename T18, typename T19, typename T20,
12603     typename T21, typename T22>
12604 class ValueArray22 {
12605  public:
12606   ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12607       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12608       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3),
12609       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12610       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
12611       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {}
12612
12613   template <typename T>
12614   operator ParamGenerator<T>() const {
12615     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12616         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12617         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12618         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12619         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12620         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12621         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12622         static_cast<T>(v21_), static_cast<T>(v22_)};
12623     return ValuesIn(array);
12624   }
12625
12626  private:
12627   // No implementation - assignment is unsupported.
12628   void operator=(const ValueArray22& other);
12629
12630   const T1 v1_;
12631   const T2 v2_;
12632   const T3 v3_;
12633   const T4 v4_;
12634   const T5 v5_;
12635   const T6 v6_;
12636   const T7 v7_;
12637   const T8 v8_;
12638   const T9 v9_;
12639   const T10 v10_;
12640   const T11 v11_;
12641   const T12 v12_;
12642   const T13 v13_;
12643   const T14 v14_;
12644   const T15 v15_;
12645   const T16 v16_;
12646   const T17 v17_;
12647   const T18 v18_;
12648   const T19 v19_;
12649   const T20 v20_;
12650   const T21 v21_;
12651   const T22 v22_;
12652 };
12653
12654 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12655     typename T6, typename T7, typename T8, typename T9, typename T10,
12656     typename T11, typename T12, typename T13, typename T14, typename T15,
12657     typename T16, typename T17, typename T18, typename T19, typename T20,
12658     typename T21, typename T22, typename T23>
12659 class ValueArray23 {
12660  public:
12661   ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12662       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12663       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2),
12664       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
12665       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
12666       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
12667       v23_(v23) {}
12668
12669   template <typename T>
12670   operator ParamGenerator<T>() const {
12671     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12672         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12673         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12674         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12675         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12676         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12677         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12678         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_)};
12679     return ValuesIn(array);
12680   }
12681
12682  private:
12683   // No implementation - assignment is unsupported.
12684   void operator=(const ValueArray23& other);
12685
12686   const T1 v1_;
12687   const T2 v2_;
12688   const T3 v3_;
12689   const T4 v4_;
12690   const T5 v5_;
12691   const T6 v6_;
12692   const T7 v7_;
12693   const T8 v8_;
12694   const T9 v9_;
12695   const T10 v10_;
12696   const T11 v11_;
12697   const T12 v12_;
12698   const T13 v13_;
12699   const T14 v14_;
12700   const T15 v15_;
12701   const T16 v16_;
12702   const T17 v17_;
12703   const T18 v18_;
12704   const T19 v19_;
12705   const T20 v20_;
12706   const T21 v21_;
12707   const T22 v22_;
12708   const T23 v23_;
12709 };
12710
12711 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12712     typename T6, typename T7, typename T8, typename T9, typename T10,
12713     typename T11, typename T12, typename T13, typename T14, typename T15,
12714     typename T16, typename T17, typename T18, typename T19, typename T20,
12715     typename T21, typename T22, typename T23, typename T24>
12716 class ValueArray24 {
12717  public:
12718   ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12719       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12720       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1),
12721       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
12722       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
12723       v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
12724       v22_(v22), v23_(v23), v24_(v24) {}
12725
12726   template <typename T>
12727   operator ParamGenerator<T>() const {
12728     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12729         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12730         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12731         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12732         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12733         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12734         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12735         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12736         static_cast<T>(v24_)};
12737     return ValuesIn(array);
12738   }
12739
12740  private:
12741   // No implementation - assignment is unsupported.
12742   void operator=(const ValueArray24& other);
12743
12744   const T1 v1_;
12745   const T2 v2_;
12746   const T3 v3_;
12747   const T4 v4_;
12748   const T5 v5_;
12749   const T6 v6_;
12750   const T7 v7_;
12751   const T8 v8_;
12752   const T9 v9_;
12753   const T10 v10_;
12754   const T11 v11_;
12755   const T12 v12_;
12756   const T13 v13_;
12757   const T14 v14_;
12758   const T15 v15_;
12759   const T16 v16_;
12760   const T17 v17_;
12761   const T18 v18_;
12762   const T19 v19_;
12763   const T20 v20_;
12764   const T21 v21_;
12765   const T22 v22_;
12766   const T23 v23_;
12767   const T24 v24_;
12768 };
12769
12770 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12771     typename T6, typename T7, typename T8, typename T9, typename T10,
12772     typename T11, typename T12, typename T13, typename T14, typename T15,
12773     typename T16, typename T17, typename T18, typename T19, typename T20,
12774     typename T21, typename T22, typename T23, typename T24, typename T25>
12775 class ValueArray25 {
12776  public:
12777   ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12778       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12779       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
12780       T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12781       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12782       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
12783       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {}
12784
12785   template <typename T>
12786   operator ParamGenerator<T>() const {
12787     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12788         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12789         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12790         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12791         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12792         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12793         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12794         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12795         static_cast<T>(v24_), static_cast<T>(v25_)};
12796     return ValuesIn(array);
12797   }
12798
12799  private:
12800   // No implementation - assignment is unsupported.
12801   void operator=(const ValueArray25& other);
12802
12803   const T1 v1_;
12804   const T2 v2_;
12805   const T3 v3_;
12806   const T4 v4_;
12807   const T5 v5_;
12808   const T6 v6_;
12809   const T7 v7_;
12810   const T8 v8_;
12811   const T9 v9_;
12812   const T10 v10_;
12813   const T11 v11_;
12814   const T12 v12_;
12815   const T13 v13_;
12816   const T14 v14_;
12817   const T15 v15_;
12818   const T16 v16_;
12819   const T17 v17_;
12820   const T18 v18_;
12821   const T19 v19_;
12822   const T20 v20_;
12823   const T21 v21_;
12824   const T22 v22_;
12825   const T23 v23_;
12826   const T24 v24_;
12827   const T25 v25_;
12828 };
12829
12830 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12831     typename T6, typename T7, typename T8, typename T9, typename T10,
12832     typename T11, typename T12, typename T13, typename T14, typename T15,
12833     typename T16, typename T17, typename T18, typename T19, typename T20,
12834     typename T21, typename T22, typename T23, typename T24, typename T25,
12835     typename T26>
12836 class ValueArray26 {
12837  public:
12838   ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12839       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12840       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12841       T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
12842       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
12843       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
12844       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {}
12845
12846   template <typename T>
12847   operator ParamGenerator<T>() const {
12848     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12849         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12850         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12851         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12852         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12853         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12854         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12855         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12856         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_)};
12857     return ValuesIn(array);
12858   }
12859
12860  private:
12861   // No implementation - assignment is unsupported.
12862   void operator=(const ValueArray26& other);
12863
12864   const T1 v1_;
12865   const T2 v2_;
12866   const T3 v3_;
12867   const T4 v4_;
12868   const T5 v5_;
12869   const T6 v6_;
12870   const T7 v7_;
12871   const T8 v8_;
12872   const T9 v9_;
12873   const T10 v10_;
12874   const T11 v11_;
12875   const T12 v12_;
12876   const T13 v13_;
12877   const T14 v14_;
12878   const T15 v15_;
12879   const T16 v16_;
12880   const T17 v17_;
12881   const T18 v18_;
12882   const T19 v19_;
12883   const T20 v20_;
12884   const T21 v21_;
12885   const T22 v22_;
12886   const T23 v23_;
12887   const T24 v24_;
12888   const T25 v25_;
12889   const T26 v26_;
12890 };
12891
12892 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12893     typename T6, typename T7, typename T8, typename T9, typename T10,
12894     typename T11, typename T12, typename T13, typename T14, typename T15,
12895     typename T16, typename T17, typename T18, typename T19, typename T20,
12896     typename T21, typename T22, typename T23, typename T24, typename T25,
12897     typename T26, typename T27>
12898 class ValueArray27 {
12899  public:
12900   ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12901       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12902       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12903       T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
12904       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
12905       v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
12906       v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
12907       v26_(v26), v27_(v27) {}
12908
12909   template <typename T>
12910   operator ParamGenerator<T>() const {
12911     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12912         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12913         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12914         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12915         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12916         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12917         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12918         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12919         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12920         static_cast<T>(v27_)};
12921     return ValuesIn(array);
12922   }
12923
12924  private:
12925   // No implementation - assignment is unsupported.
12926   void operator=(const ValueArray27& other);
12927
12928   const T1 v1_;
12929   const T2 v2_;
12930   const T3 v3_;
12931   const T4 v4_;
12932   const T5 v5_;
12933   const T6 v6_;
12934   const T7 v7_;
12935   const T8 v8_;
12936   const T9 v9_;
12937   const T10 v10_;
12938   const T11 v11_;
12939   const T12 v12_;
12940   const T13 v13_;
12941   const T14 v14_;
12942   const T15 v15_;
12943   const T16 v16_;
12944   const T17 v17_;
12945   const T18 v18_;
12946   const T19 v19_;
12947   const T20 v20_;
12948   const T21 v21_;
12949   const T22 v22_;
12950   const T23 v23_;
12951   const T24 v24_;
12952   const T25 v25_;
12953   const T26 v26_;
12954   const T27 v27_;
12955 };
12956
12957 template <typename T1, typename T2, typename T3, typename T4, typename T5,
12958     typename T6, typename T7, typename T8, typename T9, typename T10,
12959     typename T11, typename T12, typename T13, typename T14, typename T15,
12960     typename T16, typename T17, typename T18, typename T19, typename T20,
12961     typename T21, typename T22, typename T23, typename T24, typename T25,
12962     typename T26, typename T27, typename T28>
12963 class ValueArray28 {
12964  public:
12965   ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
12966       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
12967       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
12968       T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
12969       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
12970       v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
12971       v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
12972       v25_(v25), v26_(v26), v27_(v27), v28_(v28) {}
12973
12974   template <typename T>
12975   operator ParamGenerator<T>() const {
12976     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
12977         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
12978         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
12979         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
12980         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
12981         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
12982         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
12983         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
12984         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
12985         static_cast<T>(v27_), static_cast<T>(v28_)};
12986     return ValuesIn(array);
12987   }
12988
12989  private:
12990   // No implementation - assignment is unsupported.
12991   void operator=(const ValueArray28& other);
12992
12993   const T1 v1_;
12994   const T2 v2_;
12995   const T3 v3_;
12996   const T4 v4_;
12997   const T5 v5_;
12998   const T6 v6_;
12999   const T7 v7_;
13000   const T8 v8_;
13001   const T9 v9_;
13002   const T10 v10_;
13003   const T11 v11_;
13004   const T12 v12_;
13005   const T13 v13_;
13006   const T14 v14_;
13007   const T15 v15_;
13008   const T16 v16_;
13009   const T17 v17_;
13010   const T18 v18_;
13011   const T19 v19_;
13012   const T20 v20_;
13013   const T21 v21_;
13014   const T22 v22_;
13015   const T23 v23_;
13016   const T24 v24_;
13017   const T25 v25_;
13018   const T26 v26_;
13019   const T27 v27_;
13020   const T28 v28_;
13021 };
13022
13023 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13024     typename T6, typename T7, typename T8, typename T9, typename T10,
13025     typename T11, typename T12, typename T13, typename T14, typename T15,
13026     typename T16, typename T17, typename T18, typename T19, typename T20,
13027     typename T21, typename T22, typename T23, typename T24, typename T25,
13028     typename T26, typename T27, typename T28, typename T29>
13029 class ValueArray29 {
13030  public:
13031   ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13032       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13033       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13034       T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
13035       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
13036       v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
13037       v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
13038       v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {}
13039
13040   template <typename T>
13041   operator ParamGenerator<T>() const {
13042     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13043         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13044         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13045         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13046         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13047         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13048         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13049         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13050         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13051         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_)};
13052     return ValuesIn(array);
13053   }
13054
13055  private:
13056   // No implementation - assignment is unsupported.
13057   void operator=(const ValueArray29& other);
13058
13059   const T1 v1_;
13060   const T2 v2_;
13061   const T3 v3_;
13062   const T4 v4_;
13063   const T5 v5_;
13064   const T6 v6_;
13065   const T7 v7_;
13066   const T8 v8_;
13067   const T9 v9_;
13068   const T10 v10_;
13069   const T11 v11_;
13070   const T12 v12_;
13071   const T13 v13_;
13072   const T14 v14_;
13073   const T15 v15_;
13074   const T16 v16_;
13075   const T17 v17_;
13076   const T18 v18_;
13077   const T19 v19_;
13078   const T20 v20_;
13079   const T21 v21_;
13080   const T22 v22_;
13081   const T23 v23_;
13082   const T24 v24_;
13083   const T25 v25_;
13084   const T26 v26_;
13085   const T27 v27_;
13086   const T28 v28_;
13087   const T29 v29_;
13088 };
13089
13090 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13091     typename T6, typename T7, typename T8, typename T9, typename T10,
13092     typename T11, typename T12, typename T13, typename T14, typename T15,
13093     typename T16, typename T17, typename T18, typename T19, typename T20,
13094     typename T21, typename T22, typename T23, typename T24, typename T25,
13095     typename T26, typename T27, typename T28, typename T29, typename T30>
13096 class ValueArray30 {
13097  public:
13098   ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13099       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13100       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13101       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3),
13102       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
13103       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
13104       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
13105       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
13106       v29_(v29), v30_(v30) {}
13107
13108   template <typename T>
13109   operator ParamGenerator<T>() const {
13110     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13111         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13112         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13113         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13114         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13115         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13116         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13117         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13118         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13119         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13120         static_cast<T>(v30_)};
13121     return ValuesIn(array);
13122   }
13123
13124  private:
13125   // No implementation - assignment is unsupported.
13126   void operator=(const ValueArray30& other);
13127
13128   const T1 v1_;
13129   const T2 v2_;
13130   const T3 v3_;
13131   const T4 v4_;
13132   const T5 v5_;
13133   const T6 v6_;
13134   const T7 v7_;
13135   const T8 v8_;
13136   const T9 v9_;
13137   const T10 v10_;
13138   const T11 v11_;
13139   const T12 v12_;
13140   const T13 v13_;
13141   const T14 v14_;
13142   const T15 v15_;
13143   const T16 v16_;
13144   const T17 v17_;
13145   const T18 v18_;
13146   const T19 v19_;
13147   const T20 v20_;
13148   const T21 v21_;
13149   const T22 v22_;
13150   const T23 v23_;
13151   const T24 v24_;
13152   const T25 v25_;
13153   const T26 v26_;
13154   const T27 v27_;
13155   const T28 v28_;
13156   const T29 v29_;
13157   const T30 v30_;
13158 };
13159
13160 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13161     typename T6, typename T7, typename T8, typename T9, typename T10,
13162     typename T11, typename T12, typename T13, typename T14, typename T15,
13163     typename T16, typename T17, typename T18, typename T19, typename T20,
13164     typename T21, typename T22, typename T23, typename T24, typename T25,
13165     typename T26, typename T27, typename T28, typename T29, typename T30,
13166     typename T31>
13167 class ValueArray31 {
13168  public:
13169   ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13170       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13171       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13172       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2),
13173       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
13174       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
13175       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
13176       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
13177       v29_(v29), v30_(v30), v31_(v31) {}
13178
13179   template <typename T>
13180   operator ParamGenerator<T>() const {
13181     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13182         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13183         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13184         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13185         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13186         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13187         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13188         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13189         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13190         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13191         static_cast<T>(v30_), static_cast<T>(v31_)};
13192     return ValuesIn(array);
13193   }
13194
13195  private:
13196   // No implementation - assignment is unsupported.
13197   void operator=(const ValueArray31& other);
13198
13199   const T1 v1_;
13200   const T2 v2_;
13201   const T3 v3_;
13202   const T4 v4_;
13203   const T5 v5_;
13204   const T6 v6_;
13205   const T7 v7_;
13206   const T8 v8_;
13207   const T9 v9_;
13208   const T10 v10_;
13209   const T11 v11_;
13210   const T12 v12_;
13211   const T13 v13_;
13212   const T14 v14_;
13213   const T15 v15_;
13214   const T16 v16_;
13215   const T17 v17_;
13216   const T18 v18_;
13217   const T19 v19_;
13218   const T20 v20_;
13219   const T21 v21_;
13220   const T22 v22_;
13221   const T23 v23_;
13222   const T24 v24_;
13223   const T25 v25_;
13224   const T26 v26_;
13225   const T27 v27_;
13226   const T28 v28_;
13227   const T29 v29_;
13228   const T30 v30_;
13229   const T31 v31_;
13230 };
13231
13232 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13233     typename T6, typename T7, typename T8, typename T9, typename T10,
13234     typename T11, typename T12, typename T13, typename T14, typename T15,
13235     typename T16, typename T17, typename T18, typename T19, typename T20,
13236     typename T21, typename T22, typename T23, typename T24, typename T25,
13237     typename T26, typename T27, typename T28, typename T29, typename T30,
13238     typename T31, typename T32>
13239 class ValueArray32 {
13240  public:
13241   ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13242       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13243       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13244       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1),
13245       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
13246       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
13247       v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
13248       v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
13249       v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {}
13250
13251   template <typename T>
13252   operator ParamGenerator<T>() const {
13253     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13254         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13255         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13256         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13257         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13258         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13259         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13260         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13261         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13262         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13263         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_)};
13264     return ValuesIn(array);
13265   }
13266
13267  private:
13268   // No implementation - assignment is unsupported.
13269   void operator=(const ValueArray32& other);
13270
13271   const T1 v1_;
13272   const T2 v2_;
13273   const T3 v3_;
13274   const T4 v4_;
13275   const T5 v5_;
13276   const T6 v6_;
13277   const T7 v7_;
13278   const T8 v8_;
13279   const T9 v9_;
13280   const T10 v10_;
13281   const T11 v11_;
13282   const T12 v12_;
13283   const T13 v13_;
13284   const T14 v14_;
13285   const T15 v15_;
13286   const T16 v16_;
13287   const T17 v17_;
13288   const T18 v18_;
13289   const T19 v19_;
13290   const T20 v20_;
13291   const T21 v21_;
13292   const T22 v22_;
13293   const T23 v23_;
13294   const T24 v24_;
13295   const T25 v25_;
13296   const T26 v26_;
13297   const T27 v27_;
13298   const T28 v28_;
13299   const T29 v29_;
13300   const T30 v30_;
13301   const T31 v31_;
13302   const T32 v32_;
13303 };
13304
13305 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13306     typename T6, typename T7, typename T8, typename T9, typename T10,
13307     typename T11, typename T12, typename T13, typename T14, typename T15,
13308     typename T16, typename T17, typename T18, typename T19, typename T20,
13309     typename T21, typename T22, typename T23, typename T24, typename T25,
13310     typename T26, typename T27, typename T28, typename T29, typename T30,
13311     typename T31, typename T32, typename T33>
13312 class ValueArray33 {
13313  public:
13314   ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13315       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13316       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13317       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
13318       T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
13319       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
13320       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
13321       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
13322       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
13323       v33_(v33) {}
13324
13325   template <typename T>
13326   operator ParamGenerator<T>() const {
13327     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13328         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13329         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13330         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13331         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13332         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13333         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13334         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13335         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13336         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13337         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13338         static_cast<T>(v33_)};
13339     return ValuesIn(array);
13340   }
13341
13342  private:
13343   // No implementation - assignment is unsupported.
13344   void operator=(const ValueArray33& other);
13345
13346   const T1 v1_;
13347   const T2 v2_;
13348   const T3 v3_;
13349   const T4 v4_;
13350   const T5 v5_;
13351   const T6 v6_;
13352   const T7 v7_;
13353   const T8 v8_;
13354   const T9 v9_;
13355   const T10 v10_;
13356   const T11 v11_;
13357   const T12 v12_;
13358   const T13 v13_;
13359   const T14 v14_;
13360   const T15 v15_;
13361   const T16 v16_;
13362   const T17 v17_;
13363   const T18 v18_;
13364   const T19 v19_;
13365   const T20 v20_;
13366   const T21 v21_;
13367   const T22 v22_;
13368   const T23 v23_;
13369   const T24 v24_;
13370   const T25 v25_;
13371   const T26 v26_;
13372   const T27 v27_;
13373   const T28 v28_;
13374   const T29 v29_;
13375   const T30 v30_;
13376   const T31 v31_;
13377   const T32 v32_;
13378   const T33 v33_;
13379 };
13380
13381 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13382     typename T6, typename T7, typename T8, typename T9, typename T10,
13383     typename T11, typename T12, typename T13, typename T14, typename T15,
13384     typename T16, typename T17, typename T18, typename T19, typename T20,
13385     typename T21, typename T22, typename T23, typename T24, typename T25,
13386     typename T26, typename T27, typename T28, typename T29, typename T30,
13387     typename T31, typename T32, typename T33, typename T34>
13388 class ValueArray34 {
13389  public:
13390   ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13391       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13392       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13393       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13394       T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
13395       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
13396       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
13397       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
13398       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
13399       v33_(v33), v34_(v34) {}
13400
13401   template <typename T>
13402   operator ParamGenerator<T>() const {
13403     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13404         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13405         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13406         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13407         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13408         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13409         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13410         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13411         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13412         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13413         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13414         static_cast<T>(v33_), static_cast<T>(v34_)};
13415     return ValuesIn(array);
13416   }
13417
13418  private:
13419   // No implementation - assignment is unsupported.
13420   void operator=(const ValueArray34& other);
13421
13422   const T1 v1_;
13423   const T2 v2_;
13424   const T3 v3_;
13425   const T4 v4_;
13426   const T5 v5_;
13427   const T6 v6_;
13428   const T7 v7_;
13429   const T8 v8_;
13430   const T9 v9_;
13431   const T10 v10_;
13432   const T11 v11_;
13433   const T12 v12_;
13434   const T13 v13_;
13435   const T14 v14_;
13436   const T15 v15_;
13437   const T16 v16_;
13438   const T17 v17_;
13439   const T18 v18_;
13440   const T19 v19_;
13441   const T20 v20_;
13442   const T21 v21_;
13443   const T22 v22_;
13444   const T23 v23_;
13445   const T24 v24_;
13446   const T25 v25_;
13447   const T26 v26_;
13448   const T27 v27_;
13449   const T28 v28_;
13450   const T29 v29_;
13451   const T30 v30_;
13452   const T31 v31_;
13453   const T32 v32_;
13454   const T33 v33_;
13455   const T34 v34_;
13456 };
13457
13458 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13459     typename T6, typename T7, typename T8, typename T9, typename T10,
13460     typename T11, typename T12, typename T13, typename T14, typename T15,
13461     typename T16, typename T17, typename T18, typename T19, typename T20,
13462     typename T21, typename T22, typename T23, typename T24, typename T25,
13463     typename T26, typename T27, typename T28, typename T29, typename T30,
13464     typename T31, typename T32, typename T33, typename T34, typename T35>
13465 class ValueArray35 {
13466  public:
13467   ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13468       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13469       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13470       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13471       T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
13472       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
13473       v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
13474       v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
13475       v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
13476       v32_(v32), v33_(v33), v34_(v34), v35_(v35) {}
13477
13478   template <typename T>
13479   operator ParamGenerator<T>() const {
13480     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13481         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13482         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13483         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13484         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13485         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13486         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13487         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13488         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13489         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13490         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13491         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_)};
13492     return ValuesIn(array);
13493   }
13494
13495  private:
13496   // No implementation - assignment is unsupported.
13497   void operator=(const ValueArray35& other);
13498
13499   const T1 v1_;
13500   const T2 v2_;
13501   const T3 v3_;
13502   const T4 v4_;
13503   const T5 v5_;
13504   const T6 v6_;
13505   const T7 v7_;
13506   const T8 v8_;
13507   const T9 v9_;
13508   const T10 v10_;
13509   const T11 v11_;
13510   const T12 v12_;
13511   const T13 v13_;
13512   const T14 v14_;
13513   const T15 v15_;
13514   const T16 v16_;
13515   const T17 v17_;
13516   const T18 v18_;
13517   const T19 v19_;
13518   const T20 v20_;
13519   const T21 v21_;
13520   const T22 v22_;
13521   const T23 v23_;
13522   const T24 v24_;
13523   const T25 v25_;
13524   const T26 v26_;
13525   const T27 v27_;
13526   const T28 v28_;
13527   const T29 v29_;
13528   const T30 v30_;
13529   const T31 v31_;
13530   const T32 v32_;
13531   const T33 v33_;
13532   const T34 v34_;
13533   const T35 v35_;
13534 };
13535
13536 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13537     typename T6, typename T7, typename T8, typename T9, typename T10,
13538     typename T11, typename T12, typename T13, typename T14, typename T15,
13539     typename T16, typename T17, typename T18, typename T19, typename T20,
13540     typename T21, typename T22, typename T23, typename T24, typename T25,
13541     typename T26, typename T27, typename T28, typename T29, typename T30,
13542     typename T31, typename T32, typename T33, typename T34, typename T35,
13543     typename T36>
13544 class ValueArray36 {
13545  public:
13546   ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13547       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13548       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13549       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13550       T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
13551       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
13552       v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
13553       v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
13554       v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
13555       v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {}
13556
13557   template <typename T>
13558   operator ParamGenerator<T>() const {
13559     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13560         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13561         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13562         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13563         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13564         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13565         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13566         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13567         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13568         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13569         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13570         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13571         static_cast<T>(v36_)};
13572     return ValuesIn(array);
13573   }
13574
13575  private:
13576   // No implementation - assignment is unsupported.
13577   void operator=(const ValueArray36& other);
13578
13579   const T1 v1_;
13580   const T2 v2_;
13581   const T3 v3_;
13582   const T4 v4_;
13583   const T5 v5_;
13584   const T6 v6_;
13585   const T7 v7_;
13586   const T8 v8_;
13587   const T9 v9_;
13588   const T10 v10_;
13589   const T11 v11_;
13590   const T12 v12_;
13591   const T13 v13_;
13592   const T14 v14_;
13593   const T15 v15_;
13594   const T16 v16_;
13595   const T17 v17_;
13596   const T18 v18_;
13597   const T19 v19_;
13598   const T20 v20_;
13599   const T21 v21_;
13600   const T22 v22_;
13601   const T23 v23_;
13602   const T24 v24_;
13603   const T25 v25_;
13604   const T26 v26_;
13605   const T27 v27_;
13606   const T28 v28_;
13607   const T29 v29_;
13608   const T30 v30_;
13609   const T31 v31_;
13610   const T32 v32_;
13611   const T33 v33_;
13612   const T34 v34_;
13613   const T35 v35_;
13614   const T36 v36_;
13615 };
13616
13617 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13618     typename T6, typename T7, typename T8, typename T9, typename T10,
13619     typename T11, typename T12, typename T13, typename T14, typename T15,
13620     typename T16, typename T17, typename T18, typename T19, typename T20,
13621     typename T21, typename T22, typename T23, typename T24, typename T25,
13622     typename T26, typename T27, typename T28, typename T29, typename T30,
13623     typename T31, typename T32, typename T33, typename T34, typename T35,
13624     typename T36, typename T37>
13625 class ValueArray37 {
13626  public:
13627   ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13628       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13629       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13630       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13631       T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
13632       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
13633       v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
13634       v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
13635       v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
13636       v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
13637       v36_(v36), v37_(v37) {}
13638
13639   template <typename T>
13640   operator ParamGenerator<T>() const {
13641     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13642         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13643         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13644         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13645         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13646         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13647         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13648         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13649         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13650         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13651         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13652         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13653         static_cast<T>(v36_), static_cast<T>(v37_)};
13654     return ValuesIn(array);
13655   }
13656
13657  private:
13658   // No implementation - assignment is unsupported.
13659   void operator=(const ValueArray37& other);
13660
13661   const T1 v1_;
13662   const T2 v2_;
13663   const T3 v3_;
13664   const T4 v4_;
13665   const T5 v5_;
13666   const T6 v6_;
13667   const T7 v7_;
13668   const T8 v8_;
13669   const T9 v9_;
13670   const T10 v10_;
13671   const T11 v11_;
13672   const T12 v12_;
13673   const T13 v13_;
13674   const T14 v14_;
13675   const T15 v15_;
13676   const T16 v16_;
13677   const T17 v17_;
13678   const T18 v18_;
13679   const T19 v19_;
13680   const T20 v20_;
13681   const T21 v21_;
13682   const T22 v22_;
13683   const T23 v23_;
13684   const T24 v24_;
13685   const T25 v25_;
13686   const T26 v26_;
13687   const T27 v27_;
13688   const T28 v28_;
13689   const T29 v29_;
13690   const T30 v30_;
13691   const T31 v31_;
13692   const T32 v32_;
13693   const T33 v33_;
13694   const T34 v34_;
13695   const T35 v35_;
13696   const T36 v36_;
13697   const T37 v37_;
13698 };
13699
13700 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13701     typename T6, typename T7, typename T8, typename T9, typename T10,
13702     typename T11, typename T12, typename T13, typename T14, typename T15,
13703     typename T16, typename T17, typename T18, typename T19, typename T20,
13704     typename T21, typename T22, typename T23, typename T24, typename T25,
13705     typename T26, typename T27, typename T28, typename T29, typename T30,
13706     typename T31, typename T32, typename T33, typename T34, typename T35,
13707     typename T36, typename T37, typename T38>
13708 class ValueArray38 {
13709  public:
13710   ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13711       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13712       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13713       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13714       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3),
13715       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
13716       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
13717       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
13718       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
13719       v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
13720       v35_(v35), v36_(v36), v37_(v37), v38_(v38) {}
13721
13722   template <typename T>
13723   operator ParamGenerator<T>() const {
13724     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13725         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13726         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13727         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13728         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13729         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13730         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13731         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13732         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13733         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13734         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13735         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13736         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_)};
13737     return ValuesIn(array);
13738   }
13739
13740  private:
13741   // No implementation - assignment is unsupported.
13742   void operator=(const ValueArray38& other);
13743
13744   const T1 v1_;
13745   const T2 v2_;
13746   const T3 v3_;
13747   const T4 v4_;
13748   const T5 v5_;
13749   const T6 v6_;
13750   const T7 v7_;
13751   const T8 v8_;
13752   const T9 v9_;
13753   const T10 v10_;
13754   const T11 v11_;
13755   const T12 v12_;
13756   const T13 v13_;
13757   const T14 v14_;
13758   const T15 v15_;
13759   const T16 v16_;
13760   const T17 v17_;
13761   const T18 v18_;
13762   const T19 v19_;
13763   const T20 v20_;
13764   const T21 v21_;
13765   const T22 v22_;
13766   const T23 v23_;
13767   const T24 v24_;
13768   const T25 v25_;
13769   const T26 v26_;
13770   const T27 v27_;
13771   const T28 v28_;
13772   const T29 v29_;
13773   const T30 v30_;
13774   const T31 v31_;
13775   const T32 v32_;
13776   const T33 v33_;
13777   const T34 v34_;
13778   const T35 v35_;
13779   const T36 v36_;
13780   const T37 v37_;
13781   const T38 v38_;
13782 };
13783
13784 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13785     typename T6, typename T7, typename T8, typename T9, typename T10,
13786     typename T11, typename T12, typename T13, typename T14, typename T15,
13787     typename T16, typename T17, typename T18, typename T19, typename T20,
13788     typename T21, typename T22, typename T23, typename T24, typename T25,
13789     typename T26, typename T27, typename T28, typename T29, typename T30,
13790     typename T31, typename T32, typename T33, typename T34, typename T35,
13791     typename T36, typename T37, typename T38, typename T39>
13792 class ValueArray39 {
13793  public:
13794   ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13795       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13796       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13797       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13798       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2),
13799       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
13800       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
13801       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
13802       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
13803       v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
13804       v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {}
13805
13806   template <typename T>
13807   operator ParamGenerator<T>() const {
13808     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13809         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13810         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13811         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13812         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13813         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13814         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13815         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13816         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13817         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13818         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13819         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13820         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13821         static_cast<T>(v39_)};
13822     return ValuesIn(array);
13823   }
13824
13825  private:
13826   // No implementation - assignment is unsupported.
13827   void operator=(const ValueArray39& other);
13828
13829   const T1 v1_;
13830   const T2 v2_;
13831   const T3 v3_;
13832   const T4 v4_;
13833   const T5 v5_;
13834   const T6 v6_;
13835   const T7 v7_;
13836   const T8 v8_;
13837   const T9 v9_;
13838   const T10 v10_;
13839   const T11 v11_;
13840   const T12 v12_;
13841   const T13 v13_;
13842   const T14 v14_;
13843   const T15 v15_;
13844   const T16 v16_;
13845   const T17 v17_;
13846   const T18 v18_;
13847   const T19 v19_;
13848   const T20 v20_;
13849   const T21 v21_;
13850   const T22 v22_;
13851   const T23 v23_;
13852   const T24 v24_;
13853   const T25 v25_;
13854   const T26 v26_;
13855   const T27 v27_;
13856   const T28 v28_;
13857   const T29 v29_;
13858   const T30 v30_;
13859   const T31 v31_;
13860   const T32 v32_;
13861   const T33 v33_;
13862   const T34 v34_;
13863   const T35 v35_;
13864   const T36 v36_;
13865   const T37 v37_;
13866   const T38 v38_;
13867   const T39 v39_;
13868 };
13869
13870 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13871     typename T6, typename T7, typename T8, typename T9, typename T10,
13872     typename T11, typename T12, typename T13, typename T14, typename T15,
13873     typename T16, typename T17, typename T18, typename T19, typename T20,
13874     typename T21, typename T22, typename T23, typename T24, typename T25,
13875     typename T26, typename T27, typename T28, typename T29, typename T30,
13876     typename T31, typename T32, typename T33, typename T34, typename T35,
13877     typename T36, typename T37, typename T38, typename T39, typename T40>
13878 class ValueArray40 {
13879  public:
13880   ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13881       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13882       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13883       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13884       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1),
13885       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
13886       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
13887       v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
13888       v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
13889       v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
13890       v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
13891       v40_(v40) {}
13892
13893   template <typename T>
13894   operator ParamGenerator<T>() const {
13895     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13896         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13897         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13898         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13899         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13900         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13901         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13902         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13903         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13904         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13905         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13906         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13907         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13908         static_cast<T>(v39_), static_cast<T>(v40_)};
13909     return ValuesIn(array);
13910   }
13911
13912  private:
13913   // No implementation - assignment is unsupported.
13914   void operator=(const ValueArray40& other);
13915
13916   const T1 v1_;
13917   const T2 v2_;
13918   const T3 v3_;
13919   const T4 v4_;
13920   const T5 v5_;
13921   const T6 v6_;
13922   const T7 v7_;
13923   const T8 v8_;
13924   const T9 v9_;
13925   const T10 v10_;
13926   const T11 v11_;
13927   const T12 v12_;
13928   const T13 v13_;
13929   const T14 v14_;
13930   const T15 v15_;
13931   const T16 v16_;
13932   const T17 v17_;
13933   const T18 v18_;
13934   const T19 v19_;
13935   const T20 v20_;
13936   const T21 v21_;
13937   const T22 v22_;
13938   const T23 v23_;
13939   const T24 v24_;
13940   const T25 v25_;
13941   const T26 v26_;
13942   const T27 v27_;
13943   const T28 v28_;
13944   const T29 v29_;
13945   const T30 v30_;
13946   const T31 v31_;
13947   const T32 v32_;
13948   const T33 v33_;
13949   const T34 v34_;
13950   const T35 v35_;
13951   const T36 v36_;
13952   const T37 v37_;
13953   const T38 v38_;
13954   const T39 v39_;
13955   const T40 v40_;
13956 };
13957
13958 template <typename T1, typename T2, typename T3, typename T4, typename T5,
13959     typename T6, typename T7, typename T8, typename T9, typename T10,
13960     typename T11, typename T12, typename T13, typename T14, typename T15,
13961     typename T16, typename T17, typename T18, typename T19, typename T20,
13962     typename T21, typename T22, typename T23, typename T24, typename T25,
13963     typename T26, typename T27, typename T28, typename T29, typename T30,
13964     typename T31, typename T32, typename T33, typename T34, typename T35,
13965     typename T36, typename T37, typename T38, typename T39, typename T40,
13966     typename T41>
13967 class ValueArray41 {
13968  public:
13969   ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
13970       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
13971       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
13972       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
13973       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
13974       T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
13975       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
13976       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
13977       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
13978       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
13979       v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
13980       v39_(v39), v40_(v40), v41_(v41) {}
13981
13982   template <typename T>
13983   operator ParamGenerator<T>() const {
13984     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
13985         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
13986         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
13987         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
13988         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
13989         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
13990         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
13991         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
13992         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
13993         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
13994         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
13995         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
13996         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
13997         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_)};
13998     return ValuesIn(array);
13999   }
14000
14001  private:
14002   // No implementation - assignment is unsupported.
14003   void operator=(const ValueArray41& other);
14004
14005   const T1 v1_;
14006   const T2 v2_;
14007   const T3 v3_;
14008   const T4 v4_;
14009   const T5 v5_;
14010   const T6 v6_;
14011   const T7 v7_;
14012   const T8 v8_;
14013   const T9 v9_;
14014   const T10 v10_;
14015   const T11 v11_;
14016   const T12 v12_;
14017   const T13 v13_;
14018   const T14 v14_;
14019   const T15 v15_;
14020   const T16 v16_;
14021   const T17 v17_;
14022   const T18 v18_;
14023   const T19 v19_;
14024   const T20 v20_;
14025   const T21 v21_;
14026   const T22 v22_;
14027   const T23 v23_;
14028   const T24 v24_;
14029   const T25 v25_;
14030   const T26 v26_;
14031   const T27 v27_;
14032   const T28 v28_;
14033   const T29 v29_;
14034   const T30 v30_;
14035   const T31 v31_;
14036   const T32 v32_;
14037   const T33 v33_;
14038   const T34 v34_;
14039   const T35 v35_;
14040   const T36 v36_;
14041   const T37 v37_;
14042   const T38 v38_;
14043   const T39 v39_;
14044   const T40 v40_;
14045   const T41 v41_;
14046 };
14047
14048 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14049     typename T6, typename T7, typename T8, typename T9, typename T10,
14050     typename T11, typename T12, typename T13, typename T14, typename T15,
14051     typename T16, typename T17, typename T18, typename T19, typename T20,
14052     typename T21, typename T22, typename T23, typename T24, typename T25,
14053     typename T26, typename T27, typename T28, typename T29, typename T30,
14054     typename T31, typename T32, typename T33, typename T34, typename T35,
14055     typename T36, typename T37, typename T38, typename T39, typename T40,
14056     typename T41, typename T42>
14057 class ValueArray42 {
14058  public:
14059   ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14060       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14061       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14062       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14063       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14064       T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
14065       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
14066       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
14067       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
14068       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
14069       v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
14070       v39_(v39), v40_(v40), v41_(v41), v42_(v42) {}
14071
14072   template <typename T>
14073   operator ParamGenerator<T>() const {
14074     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14075         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14076         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14077         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14078         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14079         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14080         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14081         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14082         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14083         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14084         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14085         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14086         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14087         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14088         static_cast<T>(v42_)};
14089     return ValuesIn(array);
14090   }
14091
14092  private:
14093   // No implementation - assignment is unsupported.
14094   void operator=(const ValueArray42& other);
14095
14096   const T1 v1_;
14097   const T2 v2_;
14098   const T3 v3_;
14099   const T4 v4_;
14100   const T5 v5_;
14101   const T6 v6_;
14102   const T7 v7_;
14103   const T8 v8_;
14104   const T9 v9_;
14105   const T10 v10_;
14106   const T11 v11_;
14107   const T12 v12_;
14108   const T13 v13_;
14109   const T14 v14_;
14110   const T15 v15_;
14111   const T16 v16_;
14112   const T17 v17_;
14113   const T18 v18_;
14114   const T19 v19_;
14115   const T20 v20_;
14116   const T21 v21_;
14117   const T22 v22_;
14118   const T23 v23_;
14119   const T24 v24_;
14120   const T25 v25_;
14121   const T26 v26_;
14122   const T27 v27_;
14123   const T28 v28_;
14124   const T29 v29_;
14125   const T30 v30_;
14126   const T31 v31_;
14127   const T32 v32_;
14128   const T33 v33_;
14129   const T34 v34_;
14130   const T35 v35_;
14131   const T36 v36_;
14132   const T37 v37_;
14133   const T38 v38_;
14134   const T39 v39_;
14135   const T40 v40_;
14136   const T41 v41_;
14137   const T42 v42_;
14138 };
14139
14140 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14141     typename T6, typename T7, typename T8, typename T9, typename T10,
14142     typename T11, typename T12, typename T13, typename T14, typename T15,
14143     typename T16, typename T17, typename T18, typename T19, typename T20,
14144     typename T21, typename T22, typename T23, typename T24, typename T25,
14145     typename T26, typename T27, typename T28, typename T29, typename T30,
14146     typename T31, typename T32, typename T33, typename T34, typename T35,
14147     typename T36, typename T37, typename T38, typename T39, typename T40,
14148     typename T41, typename T42, typename T43>
14149 class ValueArray43 {
14150  public:
14151   ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14152       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14153       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14154       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14155       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14156       T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
14157       v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
14158       v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
14159       v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
14160       v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
14161       v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37),
14162       v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {}
14163
14164   template <typename T>
14165   operator ParamGenerator<T>() const {
14166     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14167         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14168         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14169         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14170         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14171         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14172         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14173         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14174         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14175         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14176         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14177         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14178         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14179         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14180         static_cast<T>(v42_), static_cast<T>(v43_)};
14181     return ValuesIn(array);
14182   }
14183
14184  private:
14185   // No implementation - assignment is unsupported.
14186   void operator=(const ValueArray43& other);
14187
14188   const T1 v1_;
14189   const T2 v2_;
14190   const T3 v3_;
14191   const T4 v4_;
14192   const T5 v5_;
14193   const T6 v6_;
14194   const T7 v7_;
14195   const T8 v8_;
14196   const T9 v9_;
14197   const T10 v10_;
14198   const T11 v11_;
14199   const T12 v12_;
14200   const T13 v13_;
14201   const T14 v14_;
14202   const T15 v15_;
14203   const T16 v16_;
14204   const T17 v17_;
14205   const T18 v18_;
14206   const T19 v19_;
14207   const T20 v20_;
14208   const T21 v21_;
14209   const T22 v22_;
14210   const T23 v23_;
14211   const T24 v24_;
14212   const T25 v25_;
14213   const T26 v26_;
14214   const T27 v27_;
14215   const T28 v28_;
14216   const T29 v29_;
14217   const T30 v30_;
14218   const T31 v31_;
14219   const T32 v32_;
14220   const T33 v33_;
14221   const T34 v34_;
14222   const T35 v35_;
14223   const T36 v36_;
14224   const T37 v37_;
14225   const T38 v38_;
14226   const T39 v39_;
14227   const T40 v40_;
14228   const T41 v41_;
14229   const T42 v42_;
14230   const T43 v43_;
14231 };
14232
14233 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14234     typename T6, typename T7, typename T8, typename T9, typename T10,
14235     typename T11, typename T12, typename T13, typename T14, typename T15,
14236     typename T16, typename T17, typename T18, typename T19, typename T20,
14237     typename T21, typename T22, typename T23, typename T24, typename T25,
14238     typename T26, typename T27, typename T28, typename T29, typename T30,
14239     typename T31, typename T32, typename T33, typename T34, typename T35,
14240     typename T36, typename T37, typename T38, typename T39, typename T40,
14241     typename T41, typename T42, typename T43, typename T44>
14242 class ValueArray44 {
14243  public:
14244   ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14245       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14246       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14247       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14248       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14249       T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
14250       v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
14251       v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
14252       v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
14253       v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
14254       v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36),
14255       v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42),
14256       v43_(v43), v44_(v44) {}
14257
14258   template <typename T>
14259   operator ParamGenerator<T>() const {
14260     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14261         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14262         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14263         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14264         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14265         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14266         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14267         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14268         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14269         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14270         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14271         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14272         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14273         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14274         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_)};
14275     return ValuesIn(array);
14276   }
14277
14278  private:
14279   // No implementation - assignment is unsupported.
14280   void operator=(const ValueArray44& other);
14281
14282   const T1 v1_;
14283   const T2 v2_;
14284   const T3 v3_;
14285   const T4 v4_;
14286   const T5 v5_;
14287   const T6 v6_;
14288   const T7 v7_;
14289   const T8 v8_;
14290   const T9 v9_;
14291   const T10 v10_;
14292   const T11 v11_;
14293   const T12 v12_;
14294   const T13 v13_;
14295   const T14 v14_;
14296   const T15 v15_;
14297   const T16 v16_;
14298   const T17 v17_;
14299   const T18 v18_;
14300   const T19 v19_;
14301   const T20 v20_;
14302   const T21 v21_;
14303   const T22 v22_;
14304   const T23 v23_;
14305   const T24 v24_;
14306   const T25 v25_;
14307   const T26 v26_;
14308   const T27 v27_;
14309   const T28 v28_;
14310   const T29 v29_;
14311   const T30 v30_;
14312   const T31 v31_;
14313   const T32 v32_;
14314   const T33 v33_;
14315   const T34 v34_;
14316   const T35 v35_;
14317   const T36 v36_;
14318   const T37 v37_;
14319   const T38 v38_;
14320   const T39 v39_;
14321   const T40 v40_;
14322   const T41 v41_;
14323   const T42 v42_;
14324   const T43 v43_;
14325   const T44 v44_;
14326 };
14327
14328 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14329     typename T6, typename T7, typename T8, typename T9, typename T10,
14330     typename T11, typename T12, typename T13, typename T14, typename T15,
14331     typename T16, typename T17, typename T18, typename T19, typename T20,
14332     typename T21, typename T22, typename T23, typename T24, typename T25,
14333     typename T26, typename T27, typename T28, typename T29, typename T30,
14334     typename T31, typename T32, typename T33, typename T34, typename T35,
14335     typename T36, typename T37, typename T38, typename T39, typename T40,
14336     typename T41, typename T42, typename T43, typename T44, typename T45>
14337 class ValueArray45 {
14338  public:
14339   ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14340       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14341       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14342       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14343       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14344       T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
14345       v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
14346       v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
14347       v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
14348       v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
14349       v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
14350       v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41),
14351       v42_(v42), v43_(v43), v44_(v44), v45_(v45) {}
14352
14353   template <typename T>
14354   operator ParamGenerator<T>() const {
14355     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14356         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14357         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14358         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14359         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14360         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14361         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14362         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14363         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14364         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14365         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14366         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14367         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14368         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14369         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
14370         static_cast<T>(v45_)};
14371     return ValuesIn(array);
14372   }
14373
14374  private:
14375   // No implementation - assignment is unsupported.
14376   void operator=(const ValueArray45& other);
14377
14378   const T1 v1_;
14379   const T2 v2_;
14380   const T3 v3_;
14381   const T4 v4_;
14382   const T5 v5_;
14383   const T6 v6_;
14384   const T7 v7_;
14385   const T8 v8_;
14386   const T9 v9_;
14387   const T10 v10_;
14388   const T11 v11_;
14389   const T12 v12_;
14390   const T13 v13_;
14391   const T14 v14_;
14392   const T15 v15_;
14393   const T16 v16_;
14394   const T17 v17_;
14395   const T18 v18_;
14396   const T19 v19_;
14397   const T20 v20_;
14398   const T21 v21_;
14399   const T22 v22_;
14400   const T23 v23_;
14401   const T24 v24_;
14402   const T25 v25_;
14403   const T26 v26_;
14404   const T27 v27_;
14405   const T28 v28_;
14406   const T29 v29_;
14407   const T30 v30_;
14408   const T31 v31_;
14409   const T32 v32_;
14410   const T33 v33_;
14411   const T34 v34_;
14412   const T35 v35_;
14413   const T36 v36_;
14414   const T37 v37_;
14415   const T38 v38_;
14416   const T39 v39_;
14417   const T40 v40_;
14418   const T41 v41_;
14419   const T42 v42_;
14420   const T43 v43_;
14421   const T44 v44_;
14422   const T45 v45_;
14423 };
14424
14425 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14426     typename T6, typename T7, typename T8, typename T9, typename T10,
14427     typename T11, typename T12, typename T13, typename T14, typename T15,
14428     typename T16, typename T17, typename T18, typename T19, typename T20,
14429     typename T21, typename T22, typename T23, typename T24, typename T25,
14430     typename T26, typename T27, typename T28, typename T29, typename T30,
14431     typename T31, typename T32, typename T33, typename T34, typename T35,
14432     typename T36, typename T37, typename T38, typename T39, typename T40,
14433     typename T41, typename T42, typename T43, typename T44, typename T45,
14434     typename T46>
14435 class ValueArray46 {
14436  public:
14437   ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14438       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14439       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14440       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14441       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14442       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3),
14443       v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
14444       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
14445       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
14446       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
14447       v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
14448       v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
14449       v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {}
14450
14451   template <typename T>
14452   operator ParamGenerator<T>() const {
14453     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14454         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14455         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14456         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14457         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14458         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14459         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14460         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14461         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14462         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14463         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14464         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14465         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14466         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14467         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
14468         static_cast<T>(v45_), static_cast<T>(v46_)};
14469     return ValuesIn(array);
14470   }
14471
14472  private:
14473   // No implementation - assignment is unsupported.
14474   void operator=(const ValueArray46& other);
14475
14476   const T1 v1_;
14477   const T2 v2_;
14478   const T3 v3_;
14479   const T4 v4_;
14480   const T5 v5_;
14481   const T6 v6_;
14482   const T7 v7_;
14483   const T8 v8_;
14484   const T9 v9_;
14485   const T10 v10_;
14486   const T11 v11_;
14487   const T12 v12_;
14488   const T13 v13_;
14489   const T14 v14_;
14490   const T15 v15_;
14491   const T16 v16_;
14492   const T17 v17_;
14493   const T18 v18_;
14494   const T19 v19_;
14495   const T20 v20_;
14496   const T21 v21_;
14497   const T22 v22_;
14498   const T23 v23_;
14499   const T24 v24_;
14500   const T25 v25_;
14501   const T26 v26_;
14502   const T27 v27_;
14503   const T28 v28_;
14504   const T29 v29_;
14505   const T30 v30_;
14506   const T31 v31_;
14507   const T32 v32_;
14508   const T33 v33_;
14509   const T34 v34_;
14510   const T35 v35_;
14511   const T36 v36_;
14512   const T37 v37_;
14513   const T38 v38_;
14514   const T39 v39_;
14515   const T40 v40_;
14516   const T41 v41_;
14517   const T42 v42_;
14518   const T43 v43_;
14519   const T44 v44_;
14520   const T45 v45_;
14521   const T46 v46_;
14522 };
14523
14524 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14525     typename T6, typename T7, typename T8, typename T9, typename T10,
14526     typename T11, typename T12, typename T13, typename T14, typename T15,
14527     typename T16, typename T17, typename T18, typename T19, typename T20,
14528     typename T21, typename T22, typename T23, typename T24, typename T25,
14529     typename T26, typename T27, typename T28, typename T29, typename T30,
14530     typename T31, typename T32, typename T33, typename T34, typename T35,
14531     typename T36, typename T37, typename T38, typename T39, typename T40,
14532     typename T41, typename T42, typename T43, typename T44, typename T45,
14533     typename T46, typename T47>
14534 class ValueArray47 {
14535  public:
14536   ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14537       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14538       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14539       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14540       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14541       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2),
14542       v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
14543       v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
14544       v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
14545       v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
14546       v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
14547       v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
14548       v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46),
14549       v47_(v47) {}
14550
14551   template <typename T>
14552   operator ParamGenerator<T>() const {
14553     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14554         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14555         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14556         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14557         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14558         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14559         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14560         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14561         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14562         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14563         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14564         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14565         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14566         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14567         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
14568         static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_)};
14569     return ValuesIn(array);
14570   }
14571
14572  private:
14573   // No implementation - assignment is unsupported.
14574   void operator=(const ValueArray47& other);
14575
14576   const T1 v1_;
14577   const T2 v2_;
14578   const T3 v3_;
14579   const T4 v4_;
14580   const T5 v5_;
14581   const T6 v6_;
14582   const T7 v7_;
14583   const T8 v8_;
14584   const T9 v9_;
14585   const T10 v10_;
14586   const T11 v11_;
14587   const T12 v12_;
14588   const T13 v13_;
14589   const T14 v14_;
14590   const T15 v15_;
14591   const T16 v16_;
14592   const T17 v17_;
14593   const T18 v18_;
14594   const T19 v19_;
14595   const T20 v20_;
14596   const T21 v21_;
14597   const T22 v22_;
14598   const T23 v23_;
14599   const T24 v24_;
14600   const T25 v25_;
14601   const T26 v26_;
14602   const T27 v27_;
14603   const T28 v28_;
14604   const T29 v29_;
14605   const T30 v30_;
14606   const T31 v31_;
14607   const T32 v32_;
14608   const T33 v33_;
14609   const T34 v34_;
14610   const T35 v35_;
14611   const T36 v36_;
14612   const T37 v37_;
14613   const T38 v38_;
14614   const T39 v39_;
14615   const T40 v40_;
14616   const T41 v41_;
14617   const T42 v42_;
14618   const T43 v43_;
14619   const T44 v44_;
14620   const T45 v45_;
14621   const T46 v46_;
14622   const T47 v47_;
14623 };
14624
14625 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14626     typename T6, typename T7, typename T8, typename T9, typename T10,
14627     typename T11, typename T12, typename T13, typename T14, typename T15,
14628     typename T16, typename T17, typename T18, typename T19, typename T20,
14629     typename T21, typename T22, typename T23, typename T24, typename T25,
14630     typename T26, typename T27, typename T28, typename T29, typename T30,
14631     typename T31, typename T32, typename T33, typename T34, typename T35,
14632     typename T36, typename T37, typename T38, typename T39, typename T40,
14633     typename T41, typename T42, typename T43, typename T44, typename T45,
14634     typename T46, typename T47, typename T48>
14635 class ValueArray48 {
14636  public:
14637   ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14638       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14639       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14640       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14641       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14642       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1),
14643       v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
14644       v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
14645       v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
14646       v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
14647       v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
14648       v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
14649       v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45),
14650       v46_(v46), v47_(v47), v48_(v48) {}
14651
14652   template <typename T>
14653   operator ParamGenerator<T>() const {
14654     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14655         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14656         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14657         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14658         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14659         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14660         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14661         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14662         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14663         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14664         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14665         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14666         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14667         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14668         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
14669         static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
14670         static_cast<T>(v48_)};
14671     return ValuesIn(array);
14672   }
14673
14674  private:
14675   // No implementation - assignment is unsupported.
14676   void operator=(const ValueArray48& other);
14677
14678   const T1 v1_;
14679   const T2 v2_;
14680   const T3 v3_;
14681   const T4 v4_;
14682   const T5 v5_;
14683   const T6 v6_;
14684   const T7 v7_;
14685   const T8 v8_;
14686   const T9 v9_;
14687   const T10 v10_;
14688   const T11 v11_;
14689   const T12 v12_;
14690   const T13 v13_;
14691   const T14 v14_;
14692   const T15 v15_;
14693   const T16 v16_;
14694   const T17 v17_;
14695   const T18 v18_;
14696   const T19 v19_;
14697   const T20 v20_;
14698   const T21 v21_;
14699   const T22 v22_;
14700   const T23 v23_;
14701   const T24 v24_;
14702   const T25 v25_;
14703   const T26 v26_;
14704   const T27 v27_;
14705   const T28 v28_;
14706   const T29 v29_;
14707   const T30 v30_;
14708   const T31 v31_;
14709   const T32 v32_;
14710   const T33 v33_;
14711   const T34 v34_;
14712   const T35 v35_;
14713   const T36 v36_;
14714   const T37 v37_;
14715   const T38 v38_;
14716   const T39 v39_;
14717   const T40 v40_;
14718   const T41 v41_;
14719   const T42 v42_;
14720   const T43 v43_;
14721   const T44 v44_;
14722   const T45 v45_;
14723   const T46 v46_;
14724   const T47 v47_;
14725   const T48 v48_;
14726 };
14727
14728 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14729     typename T6, typename T7, typename T8, typename T9, typename T10,
14730     typename T11, typename T12, typename T13, typename T14, typename T15,
14731     typename T16, typename T17, typename T18, typename T19, typename T20,
14732     typename T21, typename T22, typename T23, typename T24, typename T25,
14733     typename T26, typename T27, typename T28, typename T29, typename T30,
14734     typename T31, typename T32, typename T33, typename T34, typename T35,
14735     typename T36, typename T37, typename T38, typename T39, typename T40,
14736     typename T41, typename T42, typename T43, typename T44, typename T45,
14737     typename T46, typename T47, typename T48, typename T49>
14738 class ValueArray49 {
14739  public:
14740   ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14741       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14742       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14743       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14744       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14745       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48,
14746       T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
14747       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
14748       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
14749       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
14750       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
14751       v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
14752       v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
14753       v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {}
14754
14755   template <typename T>
14756   operator ParamGenerator<T>() const {
14757     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14758         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14759         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14760         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14761         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14762         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14763         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14764         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14765         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14766         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14767         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14768         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14769         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14770         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14771         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
14772         static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
14773         static_cast<T>(v48_), static_cast<T>(v49_)};
14774     return ValuesIn(array);
14775   }
14776
14777  private:
14778   // No implementation - assignment is unsupported.
14779   void operator=(const ValueArray49& other);
14780
14781   const T1 v1_;
14782   const T2 v2_;
14783   const T3 v3_;
14784   const T4 v4_;
14785   const T5 v5_;
14786   const T6 v6_;
14787   const T7 v7_;
14788   const T8 v8_;
14789   const T9 v9_;
14790   const T10 v10_;
14791   const T11 v11_;
14792   const T12 v12_;
14793   const T13 v13_;
14794   const T14 v14_;
14795   const T15 v15_;
14796   const T16 v16_;
14797   const T17 v17_;
14798   const T18 v18_;
14799   const T19 v19_;
14800   const T20 v20_;
14801   const T21 v21_;
14802   const T22 v22_;
14803   const T23 v23_;
14804   const T24 v24_;
14805   const T25 v25_;
14806   const T26 v26_;
14807   const T27 v27_;
14808   const T28 v28_;
14809   const T29 v29_;
14810   const T30 v30_;
14811   const T31 v31_;
14812   const T32 v32_;
14813   const T33 v33_;
14814   const T34 v34_;
14815   const T35 v35_;
14816   const T36 v36_;
14817   const T37 v37_;
14818   const T38 v38_;
14819   const T39 v39_;
14820   const T40 v40_;
14821   const T41 v41_;
14822   const T42 v42_;
14823   const T43 v43_;
14824   const T44 v44_;
14825   const T45 v45_;
14826   const T46 v46_;
14827   const T47 v47_;
14828   const T48 v48_;
14829   const T49 v49_;
14830 };
14831
14832 template <typename T1, typename T2, typename T3, typename T4, typename T5,
14833     typename T6, typename T7, typename T8, typename T9, typename T10,
14834     typename T11, typename T12, typename T13, typename T14, typename T15,
14835     typename T16, typename T17, typename T18, typename T19, typename T20,
14836     typename T21, typename T22, typename T23, typename T24, typename T25,
14837     typename T26, typename T27, typename T28, typename T29, typename T30,
14838     typename T31, typename T32, typename T33, typename T34, typename T35,
14839     typename T36, typename T37, typename T38, typename T39, typename T40,
14840     typename T41, typename T42, typename T43, typename T44, typename T45,
14841     typename T46, typename T47, typename T48, typename T49, typename T50>
14842 class ValueArray50 {
14843  public:
14844   ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
14845       T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
14846       T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
14847       T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
14848       T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
14849       T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49,
14850       T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
14851       v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
14852       v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
14853       v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
14854       v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
14855       v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
14856       v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
14857       v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {}
14858
14859   template <typename T>
14860   operator ParamGenerator<T>() const {
14861     const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
14862         static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
14863         static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
14864         static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
14865         static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
14866         static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
14867         static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
14868         static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
14869         static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
14870         static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
14871         static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
14872         static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
14873         static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
14874         static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
14875         static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
14876         static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
14877         static_cast<T>(v48_), static_cast<T>(v49_), static_cast<T>(v50_)};
14878     return ValuesIn(array);
14879   }
14880
14881  private:
14882   // No implementation - assignment is unsupported.
14883   void operator=(const ValueArray50& other);
14884
14885   const T1 v1_;
14886   const T2 v2_;
14887   const T3 v3_;
14888   const T4 v4_;
14889   const T5 v5_;
14890   const T6 v6_;
14891   const T7 v7_;
14892   const T8 v8_;
14893   const T9 v9_;
14894   const T10 v10_;
14895   const T11 v11_;
14896   const T12 v12_;
14897   const T13 v13_;
14898   const T14 v14_;
14899   const T15 v15_;
14900   const T16 v16_;
14901   const T17 v17_;
14902   const T18 v18_;
14903   const T19 v19_;
14904   const T20 v20_;
14905   const T21 v21_;
14906   const T22 v22_;
14907   const T23 v23_;
14908   const T24 v24_;
14909   const T25 v25_;
14910   const T26 v26_;
14911   const T27 v27_;
14912   const T28 v28_;
14913   const T29 v29_;
14914   const T30 v30_;
14915   const T31 v31_;
14916   const T32 v32_;
14917   const T33 v33_;
14918   const T34 v34_;
14919   const T35 v35_;
14920   const T36 v36_;
14921   const T37 v37_;
14922   const T38 v38_;
14923   const T39 v39_;
14924   const T40 v40_;
14925   const T41 v41_;
14926   const T42 v42_;
14927   const T43 v43_;
14928   const T44 v44_;
14929   const T45 v45_;
14930   const T46 v46_;
14931   const T47 v47_;
14932   const T48 v48_;
14933   const T49 v49_;
14934   const T50 v50_;
14935 };
14936
14937 # if GTEST_HAS_COMBINE
14938 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
14939 //
14940 // Generates values from the Cartesian product of values produced
14941 // by the argument generators.
14942 //
14943 template <typename T1, typename T2>
14944 class CartesianProductGenerator2
14945     : public ParamGeneratorInterface< ::testing::tuple<T1, T2> > {
14946  public:
14947   typedef ::testing::tuple<T1, T2> ParamType;
14948
14949   CartesianProductGenerator2(const ParamGenerator<T1>& g1,
14950       const ParamGenerator<T2>& g2)
14951       : g1_(g1), g2_(g2) {}
14952   virtual ~CartesianProductGenerator2() {}
14953
14954   virtual ParamIteratorInterface<ParamType>* Begin() const {
14955     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin());
14956   }
14957   virtual ParamIteratorInterface<ParamType>* End() const {
14958     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end());
14959   }
14960
14961  private:
14962   class Iterator : public ParamIteratorInterface<ParamType> {
14963    public:
14964     Iterator(const ParamGeneratorInterface<ParamType>* base,
14965       const ParamGenerator<T1>& g1,
14966       const typename ParamGenerator<T1>::iterator& current1,
14967       const ParamGenerator<T2>& g2,
14968       const typename ParamGenerator<T2>::iterator& current2)
14969         : base_(base),
14970           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
14971           begin2_(g2.begin()), end2_(g2.end()), current2_(current2)    {
14972       ComputeCurrentValue();
14973     }
14974     virtual ~Iterator() {}
14975
14976     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
14977       return base_;
14978     }
14979     // Advance should not be called on beyond-of-range iterators
14980     // so no component iterators must be beyond end of range, either.
14981     virtual void Advance() {
14982       assert(!AtEnd());
14983       ++current2_;
14984       if (current2_ == end2_) {
14985         current2_ = begin2_;
14986         ++current1_;
14987       }
14988       ComputeCurrentValue();
14989     }
14990     virtual ParamIteratorInterface<ParamType>* Clone() const {
14991       return new Iterator(*this);
14992     }
14993     virtual const ParamType* Current() const { return &current_value_; }
14994     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
14995       // Having the same base generator guarantees that the other
14996       // iterator is of the same type and we can downcast.
14997       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
14998           << "The program attempted to compare iterators "
14999           << "from different generators." << std::endl;
15000       const Iterator* typed_other =
15001           CheckedDowncastToActualType<const Iterator>(&other);
15002       // We must report iterators equal if they both point beyond their
15003       // respective ranges. That can happen in a variety of fashions,
15004       // so we have to consult AtEnd().
15005       return (AtEnd() && typed_other->AtEnd()) ||
15006          (
15007           current1_ == typed_other->current1_ &&
15008           current2_ == typed_other->current2_);
15009     }
15010
15011    private:
15012     Iterator(const Iterator& other)
15013         : base_(other.base_),
15014         begin1_(other.begin1_),
15015         end1_(other.end1_),
15016         current1_(other.current1_),
15017         begin2_(other.begin2_),
15018         end2_(other.end2_),
15019         current2_(other.current2_) {
15020       ComputeCurrentValue();
15021     }
15022
15023     void ComputeCurrentValue() {
15024       if (!AtEnd())
15025         current_value_ = ParamType(*current1_, *current2_);
15026     }
15027     bool AtEnd() const {
15028       // We must report iterator past the end of the range when either of the
15029       // component iterators has reached the end of its range.
15030       return
15031           current1_ == end1_ ||
15032           current2_ == end2_;
15033     }
15034
15035     // No implementation - assignment is unsupported.
15036     void operator=(const Iterator& other);
15037
15038     const ParamGeneratorInterface<ParamType>* const base_;
15039     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15040     // current[i]_ is the actual traversing iterator.
15041     const typename ParamGenerator<T1>::iterator begin1_;
15042     const typename ParamGenerator<T1>::iterator end1_;
15043     typename ParamGenerator<T1>::iterator current1_;
15044     const typename ParamGenerator<T2>::iterator begin2_;
15045     const typename ParamGenerator<T2>::iterator end2_;
15046     typename ParamGenerator<T2>::iterator current2_;
15047     ParamType current_value_;
15048   };  // class CartesianProductGenerator2::Iterator
15049
15050   // No implementation - assignment is unsupported.
15051   void operator=(const CartesianProductGenerator2& other);
15052
15053   const ParamGenerator<T1> g1_;
15054   const ParamGenerator<T2> g2_;
15055 };  // class CartesianProductGenerator2
15056
15057
15058 template <typename T1, typename T2, typename T3>
15059 class CartesianProductGenerator3
15060     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3> > {
15061  public:
15062   typedef ::testing::tuple<T1, T2, T3> ParamType;
15063
15064   CartesianProductGenerator3(const ParamGenerator<T1>& g1,
15065       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)
15066       : g1_(g1), g2_(g2), g3_(g3) {}
15067   virtual ~CartesianProductGenerator3() {}
15068
15069   virtual ParamIteratorInterface<ParamType>* Begin() const {
15070     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15071         g3_.begin());
15072   }
15073   virtual ParamIteratorInterface<ParamType>* End() const {
15074     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end());
15075   }
15076
15077  private:
15078   class Iterator : public ParamIteratorInterface<ParamType> {
15079    public:
15080     Iterator(const ParamGeneratorInterface<ParamType>* base,
15081       const ParamGenerator<T1>& g1,
15082       const typename ParamGenerator<T1>::iterator& current1,
15083       const ParamGenerator<T2>& g2,
15084       const typename ParamGenerator<T2>::iterator& current2,
15085       const ParamGenerator<T3>& g3,
15086       const typename ParamGenerator<T3>::iterator& current3)
15087         : base_(base),
15088           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15089           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15090           begin3_(g3.begin()), end3_(g3.end()), current3_(current3)    {
15091       ComputeCurrentValue();
15092     }
15093     virtual ~Iterator() {}
15094
15095     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15096       return base_;
15097     }
15098     // Advance should not be called on beyond-of-range iterators
15099     // so no component iterators must be beyond end of range, either.
15100     virtual void Advance() {
15101       assert(!AtEnd());
15102       ++current3_;
15103       if (current3_ == end3_) {
15104         current3_ = begin3_;
15105         ++current2_;
15106       }
15107       if (current2_ == end2_) {
15108         current2_ = begin2_;
15109         ++current1_;
15110       }
15111       ComputeCurrentValue();
15112     }
15113     virtual ParamIteratorInterface<ParamType>* Clone() const {
15114       return new Iterator(*this);
15115     }
15116     virtual const ParamType* Current() const { return &current_value_; }
15117     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
15118       // Having the same base generator guarantees that the other
15119       // iterator is of the same type and we can downcast.
15120       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
15121           << "The program attempted to compare iterators "
15122           << "from different generators." << std::endl;
15123       const Iterator* typed_other =
15124           CheckedDowncastToActualType<const Iterator>(&other);
15125       // We must report iterators equal if they both point beyond their
15126       // respective ranges. That can happen in a variety of fashions,
15127       // so we have to consult AtEnd().
15128       return (AtEnd() && typed_other->AtEnd()) ||
15129          (
15130           current1_ == typed_other->current1_ &&
15131           current2_ == typed_other->current2_ &&
15132           current3_ == typed_other->current3_);
15133     }
15134
15135    private:
15136     Iterator(const Iterator& other)
15137         : base_(other.base_),
15138         begin1_(other.begin1_),
15139         end1_(other.end1_),
15140         current1_(other.current1_),
15141         begin2_(other.begin2_),
15142         end2_(other.end2_),
15143         current2_(other.current2_),
15144         begin3_(other.begin3_),
15145         end3_(other.end3_),
15146         current3_(other.current3_) {
15147       ComputeCurrentValue();
15148     }
15149
15150     void ComputeCurrentValue() {
15151       if (!AtEnd())
15152         current_value_ = ParamType(*current1_, *current2_, *current3_);
15153     }
15154     bool AtEnd() const {
15155       // We must report iterator past the end of the range when either of the
15156       // component iterators has reached the end of its range.
15157       return
15158           current1_ == end1_ ||
15159           current2_ == end2_ ||
15160           current3_ == end3_;
15161     }
15162
15163     // No implementation - assignment is unsupported.
15164     void operator=(const Iterator& other);
15165
15166     const ParamGeneratorInterface<ParamType>* const base_;
15167     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15168     // current[i]_ is the actual traversing iterator.
15169     const typename ParamGenerator<T1>::iterator begin1_;
15170     const typename ParamGenerator<T1>::iterator end1_;
15171     typename ParamGenerator<T1>::iterator current1_;
15172     const typename ParamGenerator<T2>::iterator begin2_;
15173     const typename ParamGenerator<T2>::iterator end2_;
15174     typename ParamGenerator<T2>::iterator current2_;
15175     const typename ParamGenerator<T3>::iterator begin3_;
15176     const typename ParamGenerator<T3>::iterator end3_;
15177     typename ParamGenerator<T3>::iterator current3_;
15178     ParamType current_value_;
15179   };  // class CartesianProductGenerator3::Iterator
15180
15181   // No implementation - assignment is unsupported.
15182   void operator=(const CartesianProductGenerator3& other);
15183
15184   const ParamGenerator<T1> g1_;
15185   const ParamGenerator<T2> g2_;
15186   const ParamGenerator<T3> g3_;
15187 };  // class CartesianProductGenerator3
15188
15189
15190 template <typename T1, typename T2, typename T3, typename T4>
15191 class CartesianProductGenerator4
15192     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4> > {
15193  public:
15194   typedef ::testing::tuple<T1, T2, T3, T4> ParamType;
15195
15196   CartesianProductGenerator4(const ParamGenerator<T1>& g1,
15197       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
15198       const ParamGenerator<T4>& g4)
15199       : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
15200   virtual ~CartesianProductGenerator4() {}
15201
15202   virtual ParamIteratorInterface<ParamType>* Begin() const {
15203     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15204         g3_.begin(), g4_, g4_.begin());
15205   }
15206   virtual ParamIteratorInterface<ParamType>* End() const {
15207     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
15208         g4_, g4_.end());
15209   }
15210
15211  private:
15212   class Iterator : public ParamIteratorInterface<ParamType> {
15213    public:
15214     Iterator(const ParamGeneratorInterface<ParamType>* base,
15215       const ParamGenerator<T1>& g1,
15216       const typename ParamGenerator<T1>::iterator& current1,
15217       const ParamGenerator<T2>& g2,
15218       const typename ParamGenerator<T2>::iterator& current2,
15219       const ParamGenerator<T3>& g3,
15220       const typename ParamGenerator<T3>::iterator& current3,
15221       const ParamGenerator<T4>& g4,
15222       const typename ParamGenerator<T4>::iterator& current4)
15223         : base_(base),
15224           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15225           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15226           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
15227           begin4_(g4.begin()), end4_(g4.end()), current4_(current4)    {
15228       ComputeCurrentValue();
15229     }
15230     virtual ~Iterator() {}
15231
15232     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15233       return base_;
15234     }
15235     // Advance should not be called on beyond-of-range iterators
15236     // so no component iterators must be beyond end of range, either.
15237     virtual void Advance() {
15238       assert(!AtEnd());
15239       ++current4_;
15240       if (current4_ == end4_) {
15241         current4_ = begin4_;
15242         ++current3_;
15243       }
15244       if (current3_ == end3_) {
15245         current3_ = begin3_;
15246         ++current2_;
15247       }
15248       if (current2_ == end2_) {
15249         current2_ = begin2_;
15250         ++current1_;
15251       }
15252       ComputeCurrentValue();
15253     }
15254     virtual ParamIteratorInterface<ParamType>* Clone() const {
15255       return new Iterator(*this);
15256     }
15257     virtual const ParamType* Current() const { return &current_value_; }
15258     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
15259       // Having the same base generator guarantees that the other
15260       // iterator is of the same type and we can downcast.
15261       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
15262           << "The program attempted to compare iterators "
15263           << "from different generators." << std::endl;
15264       const Iterator* typed_other =
15265           CheckedDowncastToActualType<const Iterator>(&other);
15266       // We must report iterators equal if they both point beyond their
15267       // respective ranges. That can happen in a variety of fashions,
15268       // so we have to consult AtEnd().
15269       return (AtEnd() && typed_other->AtEnd()) ||
15270          (
15271           current1_ == typed_other->current1_ &&
15272           current2_ == typed_other->current2_ &&
15273           current3_ == typed_other->current3_ &&
15274           current4_ == typed_other->current4_);
15275     }
15276
15277    private:
15278     Iterator(const Iterator& other)
15279         : base_(other.base_),
15280         begin1_(other.begin1_),
15281         end1_(other.end1_),
15282         current1_(other.current1_),
15283         begin2_(other.begin2_),
15284         end2_(other.end2_),
15285         current2_(other.current2_),
15286         begin3_(other.begin3_),
15287         end3_(other.end3_),
15288         current3_(other.current3_),
15289         begin4_(other.begin4_),
15290         end4_(other.end4_),
15291         current4_(other.current4_) {
15292       ComputeCurrentValue();
15293     }
15294
15295     void ComputeCurrentValue() {
15296       if (!AtEnd())
15297         current_value_ = ParamType(*current1_, *current2_, *current3_,
15298             *current4_);
15299     }
15300     bool AtEnd() const {
15301       // We must report iterator past the end of the range when either of the
15302       // component iterators has reached the end of its range.
15303       return
15304           current1_ == end1_ ||
15305           current2_ == end2_ ||
15306           current3_ == end3_ ||
15307           current4_ == end4_;
15308     }
15309
15310     // No implementation - assignment is unsupported.
15311     void operator=(const Iterator& other);
15312
15313     const ParamGeneratorInterface<ParamType>* const base_;
15314     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15315     // current[i]_ is the actual traversing iterator.
15316     const typename ParamGenerator<T1>::iterator begin1_;
15317     const typename ParamGenerator<T1>::iterator end1_;
15318     typename ParamGenerator<T1>::iterator current1_;
15319     const typename ParamGenerator<T2>::iterator begin2_;
15320     const typename ParamGenerator<T2>::iterator end2_;
15321     typename ParamGenerator<T2>::iterator current2_;
15322     const typename ParamGenerator<T3>::iterator begin3_;
15323     const typename ParamGenerator<T3>::iterator end3_;
15324     typename ParamGenerator<T3>::iterator current3_;
15325     const typename ParamGenerator<T4>::iterator begin4_;
15326     const typename ParamGenerator<T4>::iterator end4_;
15327     typename ParamGenerator<T4>::iterator current4_;
15328     ParamType current_value_;
15329   };  // class CartesianProductGenerator4::Iterator
15330
15331   // No implementation - assignment is unsupported.
15332   void operator=(const CartesianProductGenerator4& other);
15333
15334   const ParamGenerator<T1> g1_;
15335   const ParamGenerator<T2> g2_;
15336   const ParamGenerator<T3> g3_;
15337   const ParamGenerator<T4> g4_;
15338 };  // class CartesianProductGenerator4
15339
15340
15341 template <typename T1, typename T2, typename T3, typename T4, typename T5>
15342 class CartesianProductGenerator5
15343     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5> > {
15344  public:
15345   typedef ::testing::tuple<T1, T2, T3, T4, T5> ParamType;
15346
15347   CartesianProductGenerator5(const ParamGenerator<T1>& g1,
15348       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
15349       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5)
15350       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
15351   virtual ~CartesianProductGenerator5() {}
15352
15353   virtual ParamIteratorInterface<ParamType>* Begin() const {
15354     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15355         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin());
15356   }
15357   virtual ParamIteratorInterface<ParamType>* End() const {
15358     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
15359         g4_, g4_.end(), g5_, g5_.end());
15360   }
15361
15362  private:
15363   class Iterator : public ParamIteratorInterface<ParamType> {
15364    public:
15365     Iterator(const ParamGeneratorInterface<ParamType>* base,
15366       const ParamGenerator<T1>& g1,
15367       const typename ParamGenerator<T1>::iterator& current1,
15368       const ParamGenerator<T2>& g2,
15369       const typename ParamGenerator<T2>::iterator& current2,
15370       const ParamGenerator<T3>& g3,
15371       const typename ParamGenerator<T3>::iterator& current3,
15372       const ParamGenerator<T4>& g4,
15373       const typename ParamGenerator<T4>::iterator& current4,
15374       const ParamGenerator<T5>& g5,
15375       const typename ParamGenerator<T5>::iterator& current5)
15376         : base_(base),
15377           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15378           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15379           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
15380           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
15381           begin5_(g5.begin()), end5_(g5.end()), current5_(current5)    {
15382       ComputeCurrentValue();
15383     }
15384     virtual ~Iterator() {}
15385
15386     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15387       return base_;
15388     }
15389     // Advance should not be called on beyond-of-range iterators
15390     // so no component iterators must be beyond end of range, either.
15391     virtual void Advance() {
15392       assert(!AtEnd());
15393       ++current5_;
15394       if (current5_ == end5_) {
15395         current5_ = begin5_;
15396         ++current4_;
15397       }
15398       if (current4_ == end4_) {
15399         current4_ = begin4_;
15400         ++current3_;
15401       }
15402       if (current3_ == end3_) {
15403         current3_ = begin3_;
15404         ++current2_;
15405       }
15406       if (current2_ == end2_) {
15407         current2_ = begin2_;
15408         ++current1_;
15409       }
15410       ComputeCurrentValue();
15411     }
15412     virtual ParamIteratorInterface<ParamType>* Clone() const {
15413       return new Iterator(*this);
15414     }
15415     virtual const ParamType* Current() const { return &current_value_; }
15416     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
15417       // Having the same base generator guarantees that the other
15418       // iterator is of the same type and we can downcast.
15419       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
15420           << "The program attempted to compare iterators "
15421           << "from different generators." << std::endl;
15422       const Iterator* typed_other =
15423           CheckedDowncastToActualType<const Iterator>(&other);
15424       // We must report iterators equal if they both point beyond their
15425       // respective ranges. That can happen in a variety of fashions,
15426       // so we have to consult AtEnd().
15427       return (AtEnd() && typed_other->AtEnd()) ||
15428          (
15429           current1_ == typed_other->current1_ &&
15430           current2_ == typed_other->current2_ &&
15431           current3_ == typed_other->current3_ &&
15432           current4_ == typed_other->current4_ &&
15433           current5_ == typed_other->current5_);
15434     }
15435
15436    private:
15437     Iterator(const Iterator& other)
15438         : base_(other.base_),
15439         begin1_(other.begin1_),
15440         end1_(other.end1_),
15441         current1_(other.current1_),
15442         begin2_(other.begin2_),
15443         end2_(other.end2_),
15444         current2_(other.current2_),
15445         begin3_(other.begin3_),
15446         end3_(other.end3_),
15447         current3_(other.current3_),
15448         begin4_(other.begin4_),
15449         end4_(other.end4_),
15450         current4_(other.current4_),
15451         begin5_(other.begin5_),
15452         end5_(other.end5_),
15453         current5_(other.current5_) {
15454       ComputeCurrentValue();
15455     }
15456
15457     void ComputeCurrentValue() {
15458       if (!AtEnd())
15459         current_value_ = ParamType(*current1_, *current2_, *current3_,
15460             *current4_, *current5_);
15461     }
15462     bool AtEnd() const {
15463       // We must report iterator past the end of the range when either of the
15464       // component iterators has reached the end of its range.
15465       return
15466           current1_ == end1_ ||
15467           current2_ == end2_ ||
15468           current3_ == end3_ ||
15469           current4_ == end4_ ||
15470           current5_ == end5_;
15471     }
15472
15473     // No implementation - assignment is unsupported.
15474     void operator=(const Iterator& other);
15475
15476     const ParamGeneratorInterface<ParamType>* const base_;
15477     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15478     // current[i]_ is the actual traversing iterator.
15479     const typename ParamGenerator<T1>::iterator begin1_;
15480     const typename ParamGenerator<T1>::iterator end1_;
15481     typename ParamGenerator<T1>::iterator current1_;
15482     const typename ParamGenerator<T2>::iterator begin2_;
15483     const typename ParamGenerator<T2>::iterator end2_;
15484     typename ParamGenerator<T2>::iterator current2_;
15485     const typename ParamGenerator<T3>::iterator begin3_;
15486     const typename ParamGenerator<T3>::iterator end3_;
15487     typename ParamGenerator<T3>::iterator current3_;
15488     const typename ParamGenerator<T4>::iterator begin4_;
15489     const typename ParamGenerator<T4>::iterator end4_;
15490     typename ParamGenerator<T4>::iterator current4_;
15491     const typename ParamGenerator<T5>::iterator begin5_;
15492     const typename ParamGenerator<T5>::iterator end5_;
15493     typename ParamGenerator<T5>::iterator current5_;
15494     ParamType current_value_;
15495   };  // class CartesianProductGenerator5::Iterator
15496
15497   // No implementation - assignment is unsupported.
15498   void operator=(const CartesianProductGenerator5& other);
15499
15500   const ParamGenerator<T1> g1_;
15501   const ParamGenerator<T2> g2_;
15502   const ParamGenerator<T3> g3_;
15503   const ParamGenerator<T4> g4_;
15504   const ParamGenerator<T5> g5_;
15505 };  // class CartesianProductGenerator5
15506
15507
15508 template <typename T1, typename T2, typename T3, typename T4, typename T5,
15509     typename T6>
15510 class CartesianProductGenerator6
15511     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5,
15512         T6> > {
15513  public:
15514   typedef ::testing::tuple<T1, T2, T3, T4, T5, T6> ParamType;
15515
15516   CartesianProductGenerator6(const ParamGenerator<T1>& g1,
15517       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
15518       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
15519       const ParamGenerator<T6>& g6)
15520       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
15521   virtual ~CartesianProductGenerator6() {}
15522
15523   virtual ParamIteratorInterface<ParamType>* Begin() const {
15524     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15525         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin());
15526   }
15527   virtual ParamIteratorInterface<ParamType>* End() const {
15528     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
15529         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end());
15530   }
15531
15532  private:
15533   class Iterator : public ParamIteratorInterface<ParamType> {
15534    public:
15535     Iterator(const ParamGeneratorInterface<ParamType>* base,
15536       const ParamGenerator<T1>& g1,
15537       const typename ParamGenerator<T1>::iterator& current1,
15538       const ParamGenerator<T2>& g2,
15539       const typename ParamGenerator<T2>::iterator& current2,
15540       const ParamGenerator<T3>& g3,
15541       const typename ParamGenerator<T3>::iterator& current3,
15542       const ParamGenerator<T4>& g4,
15543       const typename ParamGenerator<T4>::iterator& current4,
15544       const ParamGenerator<T5>& g5,
15545       const typename ParamGenerator<T5>::iterator& current5,
15546       const ParamGenerator<T6>& g6,
15547       const typename ParamGenerator<T6>::iterator& current6)
15548         : base_(base),
15549           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15550           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15551           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
15552           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
15553           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
15554           begin6_(g6.begin()), end6_(g6.end()), current6_(current6)    {
15555       ComputeCurrentValue();
15556     }
15557     virtual ~Iterator() {}
15558
15559     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15560       return base_;
15561     }
15562     // Advance should not be called on beyond-of-range iterators
15563     // so no component iterators must be beyond end of range, either.
15564     virtual void Advance() {
15565       assert(!AtEnd());
15566       ++current6_;
15567       if (current6_ == end6_) {
15568         current6_ = begin6_;
15569         ++current5_;
15570       }
15571       if (current5_ == end5_) {
15572         current5_ = begin5_;
15573         ++current4_;
15574       }
15575       if (current4_ == end4_) {
15576         current4_ = begin4_;
15577         ++current3_;
15578       }
15579       if (current3_ == end3_) {
15580         current3_ = begin3_;
15581         ++current2_;
15582       }
15583       if (current2_ == end2_) {
15584         current2_ = begin2_;
15585         ++current1_;
15586       }
15587       ComputeCurrentValue();
15588     }
15589     virtual ParamIteratorInterface<ParamType>* Clone() const {
15590       return new Iterator(*this);
15591     }
15592     virtual const ParamType* Current() const { return &current_value_; }
15593     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
15594       // Having the same base generator guarantees that the other
15595       // iterator is of the same type and we can downcast.
15596       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
15597           << "The program attempted to compare iterators "
15598           << "from different generators." << std::endl;
15599       const Iterator* typed_other =
15600           CheckedDowncastToActualType<const Iterator>(&other);
15601       // We must report iterators equal if they both point beyond their
15602       // respective ranges. That can happen in a variety of fashions,
15603       // so we have to consult AtEnd().
15604       return (AtEnd() && typed_other->AtEnd()) ||
15605          (
15606           current1_ == typed_other->current1_ &&
15607           current2_ == typed_other->current2_ &&
15608           current3_ == typed_other->current3_ &&
15609           current4_ == typed_other->current4_ &&
15610           current5_ == typed_other->current5_ &&
15611           current6_ == typed_other->current6_);
15612     }
15613
15614    private:
15615     Iterator(const Iterator& other)
15616         : base_(other.base_),
15617         begin1_(other.begin1_),
15618         end1_(other.end1_),
15619         current1_(other.current1_),
15620         begin2_(other.begin2_),
15621         end2_(other.end2_),
15622         current2_(other.current2_),
15623         begin3_(other.begin3_),
15624         end3_(other.end3_),
15625         current3_(other.current3_),
15626         begin4_(other.begin4_),
15627         end4_(other.end4_),
15628         current4_(other.current4_),
15629         begin5_(other.begin5_),
15630         end5_(other.end5_),
15631         current5_(other.current5_),
15632         begin6_(other.begin6_),
15633         end6_(other.end6_),
15634         current6_(other.current6_) {
15635       ComputeCurrentValue();
15636     }
15637
15638     void ComputeCurrentValue() {
15639       if (!AtEnd())
15640         current_value_ = ParamType(*current1_, *current2_, *current3_,
15641             *current4_, *current5_, *current6_);
15642     }
15643     bool AtEnd() const {
15644       // We must report iterator past the end of the range when either of the
15645       // component iterators has reached the end of its range.
15646       return
15647           current1_ == end1_ ||
15648           current2_ == end2_ ||
15649           current3_ == end3_ ||
15650           current4_ == end4_ ||
15651           current5_ == end5_ ||
15652           current6_ == end6_;
15653     }
15654
15655     // No implementation - assignment is unsupported.
15656     void operator=(const Iterator& other);
15657
15658     const ParamGeneratorInterface<ParamType>* const base_;
15659     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15660     // current[i]_ is the actual traversing iterator.
15661     const typename ParamGenerator<T1>::iterator begin1_;
15662     const typename ParamGenerator<T1>::iterator end1_;
15663     typename ParamGenerator<T1>::iterator current1_;
15664     const typename ParamGenerator<T2>::iterator begin2_;
15665     const typename ParamGenerator<T2>::iterator end2_;
15666     typename ParamGenerator<T2>::iterator current2_;
15667     const typename ParamGenerator<T3>::iterator begin3_;
15668     const typename ParamGenerator<T3>::iterator end3_;
15669     typename ParamGenerator<T3>::iterator current3_;
15670     const typename ParamGenerator<T4>::iterator begin4_;
15671     const typename ParamGenerator<T4>::iterator end4_;
15672     typename ParamGenerator<T4>::iterator current4_;
15673     const typename ParamGenerator<T5>::iterator begin5_;
15674     const typename ParamGenerator<T5>::iterator end5_;
15675     typename ParamGenerator<T5>::iterator current5_;
15676     const typename ParamGenerator<T6>::iterator begin6_;
15677     const typename ParamGenerator<T6>::iterator end6_;
15678     typename ParamGenerator<T6>::iterator current6_;
15679     ParamType current_value_;
15680   };  // class CartesianProductGenerator6::Iterator
15681
15682   // No implementation - assignment is unsupported.
15683   void operator=(const CartesianProductGenerator6& other);
15684
15685   const ParamGenerator<T1> g1_;
15686   const ParamGenerator<T2> g2_;
15687   const ParamGenerator<T3> g3_;
15688   const ParamGenerator<T4> g4_;
15689   const ParamGenerator<T5> g5_;
15690   const ParamGenerator<T6> g6_;
15691 };  // class CartesianProductGenerator6
15692
15693
15694 template <typename T1, typename T2, typename T3, typename T4, typename T5,
15695     typename T6, typename T7>
15696 class CartesianProductGenerator7
15697     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
15698         T7> > {
15699  public:
15700   typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;
15701
15702   CartesianProductGenerator7(const ParamGenerator<T1>& g1,
15703       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
15704       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
15705       const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7)
15706       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
15707   virtual ~CartesianProductGenerator7() {}
15708
15709   virtual ParamIteratorInterface<ParamType>* Begin() const {
15710     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15711         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
15712         g7_.begin());
15713   }
15714   virtual ParamIteratorInterface<ParamType>* End() const {
15715     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
15716         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end());
15717   }
15718
15719  private:
15720   class Iterator : public ParamIteratorInterface<ParamType> {
15721    public:
15722     Iterator(const ParamGeneratorInterface<ParamType>* base,
15723       const ParamGenerator<T1>& g1,
15724       const typename ParamGenerator<T1>::iterator& current1,
15725       const ParamGenerator<T2>& g2,
15726       const typename ParamGenerator<T2>::iterator& current2,
15727       const ParamGenerator<T3>& g3,
15728       const typename ParamGenerator<T3>::iterator& current3,
15729       const ParamGenerator<T4>& g4,
15730       const typename ParamGenerator<T4>::iterator& current4,
15731       const ParamGenerator<T5>& g5,
15732       const typename ParamGenerator<T5>::iterator& current5,
15733       const ParamGenerator<T6>& g6,
15734       const typename ParamGenerator<T6>::iterator& current6,
15735       const ParamGenerator<T7>& g7,
15736       const typename ParamGenerator<T7>::iterator& current7)
15737         : base_(base),
15738           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15739           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15740           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
15741           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
15742           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
15743           begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
15744           begin7_(g7.begin()), end7_(g7.end()), current7_(current7)    {
15745       ComputeCurrentValue();
15746     }
15747     virtual ~Iterator() {}
15748
15749     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15750       return base_;
15751     }
15752     // Advance should not be called on beyond-of-range iterators
15753     // so no component iterators must be beyond end of range, either.
15754     virtual void Advance() {
15755       assert(!AtEnd());
15756       ++current7_;
15757       if (current7_ == end7_) {
15758         current7_ = begin7_;
15759         ++current6_;
15760       }
15761       if (current6_ == end6_) {
15762         current6_ = begin6_;
15763         ++current5_;
15764       }
15765       if (current5_ == end5_) {
15766         current5_ = begin5_;
15767         ++current4_;
15768       }
15769       if (current4_ == end4_) {
15770         current4_ = begin4_;
15771         ++current3_;
15772       }
15773       if (current3_ == end3_) {
15774         current3_ = begin3_;
15775         ++current2_;
15776       }
15777       if (current2_ == end2_) {
15778         current2_ = begin2_;
15779         ++current1_;
15780       }
15781       ComputeCurrentValue();
15782     }
15783     virtual ParamIteratorInterface<ParamType>* Clone() const {
15784       return new Iterator(*this);
15785     }
15786     virtual const ParamType* Current() const { return &current_value_; }
15787     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
15788       // Having the same base generator guarantees that the other
15789       // iterator is of the same type and we can downcast.
15790       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
15791           << "The program attempted to compare iterators "
15792           << "from different generators." << std::endl;
15793       const Iterator* typed_other =
15794           CheckedDowncastToActualType<const Iterator>(&other);
15795       // We must report iterators equal if they both point beyond their
15796       // respective ranges. That can happen in a variety of fashions,
15797       // so we have to consult AtEnd().
15798       return (AtEnd() && typed_other->AtEnd()) ||
15799          (
15800           current1_ == typed_other->current1_ &&
15801           current2_ == typed_other->current2_ &&
15802           current3_ == typed_other->current3_ &&
15803           current4_ == typed_other->current4_ &&
15804           current5_ == typed_other->current5_ &&
15805           current6_ == typed_other->current6_ &&
15806           current7_ == typed_other->current7_);
15807     }
15808
15809    private:
15810     Iterator(const Iterator& other)
15811         : base_(other.base_),
15812         begin1_(other.begin1_),
15813         end1_(other.end1_),
15814         current1_(other.current1_),
15815         begin2_(other.begin2_),
15816         end2_(other.end2_),
15817         current2_(other.current2_),
15818         begin3_(other.begin3_),
15819         end3_(other.end3_),
15820         current3_(other.current3_),
15821         begin4_(other.begin4_),
15822         end4_(other.end4_),
15823         current4_(other.current4_),
15824         begin5_(other.begin5_),
15825         end5_(other.end5_),
15826         current5_(other.current5_),
15827         begin6_(other.begin6_),
15828         end6_(other.end6_),
15829         current6_(other.current6_),
15830         begin7_(other.begin7_),
15831         end7_(other.end7_),
15832         current7_(other.current7_) {
15833       ComputeCurrentValue();
15834     }
15835
15836     void ComputeCurrentValue() {
15837       if (!AtEnd())
15838         current_value_ = ParamType(*current1_, *current2_, *current3_,
15839             *current4_, *current5_, *current6_, *current7_);
15840     }
15841     bool AtEnd() const {
15842       // We must report iterator past the end of the range when either of the
15843       // component iterators has reached the end of its range.
15844       return
15845           current1_ == end1_ ||
15846           current2_ == end2_ ||
15847           current3_ == end3_ ||
15848           current4_ == end4_ ||
15849           current5_ == end5_ ||
15850           current6_ == end6_ ||
15851           current7_ == end7_;
15852     }
15853
15854     // No implementation - assignment is unsupported.
15855     void operator=(const Iterator& other);
15856
15857     const ParamGeneratorInterface<ParamType>* const base_;
15858     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
15859     // current[i]_ is the actual traversing iterator.
15860     const typename ParamGenerator<T1>::iterator begin1_;
15861     const typename ParamGenerator<T1>::iterator end1_;
15862     typename ParamGenerator<T1>::iterator current1_;
15863     const typename ParamGenerator<T2>::iterator begin2_;
15864     const typename ParamGenerator<T2>::iterator end2_;
15865     typename ParamGenerator<T2>::iterator current2_;
15866     const typename ParamGenerator<T3>::iterator begin3_;
15867     const typename ParamGenerator<T3>::iterator end3_;
15868     typename ParamGenerator<T3>::iterator current3_;
15869     const typename ParamGenerator<T4>::iterator begin4_;
15870     const typename ParamGenerator<T4>::iterator end4_;
15871     typename ParamGenerator<T4>::iterator current4_;
15872     const typename ParamGenerator<T5>::iterator begin5_;
15873     const typename ParamGenerator<T5>::iterator end5_;
15874     typename ParamGenerator<T5>::iterator current5_;
15875     const typename ParamGenerator<T6>::iterator begin6_;
15876     const typename ParamGenerator<T6>::iterator end6_;
15877     typename ParamGenerator<T6>::iterator current6_;
15878     const typename ParamGenerator<T7>::iterator begin7_;
15879     const typename ParamGenerator<T7>::iterator end7_;
15880     typename ParamGenerator<T7>::iterator current7_;
15881     ParamType current_value_;
15882   };  // class CartesianProductGenerator7::Iterator
15883
15884   // No implementation - assignment is unsupported.
15885   void operator=(const CartesianProductGenerator7& other);
15886
15887   const ParamGenerator<T1> g1_;
15888   const ParamGenerator<T2> g2_;
15889   const ParamGenerator<T3> g3_;
15890   const ParamGenerator<T4> g4_;
15891   const ParamGenerator<T5> g5_;
15892   const ParamGenerator<T6> g6_;
15893   const ParamGenerator<T7> g7_;
15894 };  // class CartesianProductGenerator7
15895
15896
15897 template <typename T1, typename T2, typename T3, typename T4, typename T5,
15898     typename T6, typename T7, typename T8>
15899 class CartesianProductGenerator8
15900     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
15901         T7, T8> > {
15902  public:
15903   typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;
15904
15905   CartesianProductGenerator8(const ParamGenerator<T1>& g1,
15906       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
15907       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
15908       const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
15909       const ParamGenerator<T8>& g8)
15910       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
15911           g8_(g8) {}
15912   virtual ~CartesianProductGenerator8() {}
15913
15914   virtual ParamIteratorInterface<ParamType>* Begin() const {
15915     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
15916         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
15917         g7_.begin(), g8_, g8_.begin());
15918   }
15919   virtual ParamIteratorInterface<ParamType>* End() const {
15920     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
15921         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
15922         g8_.end());
15923   }
15924
15925  private:
15926   class Iterator : public ParamIteratorInterface<ParamType> {
15927    public:
15928     Iterator(const ParamGeneratorInterface<ParamType>* base,
15929       const ParamGenerator<T1>& g1,
15930       const typename ParamGenerator<T1>::iterator& current1,
15931       const ParamGenerator<T2>& g2,
15932       const typename ParamGenerator<T2>::iterator& current2,
15933       const ParamGenerator<T3>& g3,
15934       const typename ParamGenerator<T3>::iterator& current3,
15935       const ParamGenerator<T4>& g4,
15936       const typename ParamGenerator<T4>::iterator& current4,
15937       const ParamGenerator<T5>& g5,
15938       const typename ParamGenerator<T5>::iterator& current5,
15939       const ParamGenerator<T6>& g6,
15940       const typename ParamGenerator<T6>::iterator& current6,
15941       const ParamGenerator<T7>& g7,
15942       const typename ParamGenerator<T7>::iterator& current7,
15943       const ParamGenerator<T8>& g8,
15944       const typename ParamGenerator<T8>::iterator& current8)
15945         : base_(base),
15946           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
15947           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
15948           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
15949           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
15950           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
15951           begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
15952           begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
15953           begin8_(g8.begin()), end8_(g8.end()), current8_(current8)    {
15954       ComputeCurrentValue();
15955     }
15956     virtual ~Iterator() {}
15957
15958     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
15959       return base_;
15960     }
15961     // Advance should not be called on beyond-of-range iterators
15962     // so no component iterators must be beyond end of range, either.
15963     virtual void Advance() {
15964       assert(!AtEnd());
15965       ++current8_;
15966       if (current8_ == end8_) {
15967         current8_ = begin8_;
15968         ++current7_;
15969       }
15970       if (current7_ == end7_) {
15971         current7_ = begin7_;
15972         ++current6_;
15973       }
15974       if (current6_ == end6_) {
15975         current6_ = begin6_;
15976         ++current5_;
15977       }
15978       if (current5_ == end5_) {
15979         current5_ = begin5_;
15980         ++current4_;
15981       }
15982       if (current4_ == end4_) {
15983         current4_ = begin4_;
15984         ++current3_;
15985       }
15986       if (current3_ == end3_) {
15987         current3_ = begin3_;
15988         ++current2_;
15989       }
15990       if (current2_ == end2_) {
15991         current2_ = begin2_;
15992         ++current1_;
15993       }
15994       ComputeCurrentValue();
15995     }
15996     virtual ParamIteratorInterface<ParamType>* Clone() const {
15997       return new Iterator(*this);
15998     }
15999     virtual const ParamType* Current() const { return &current_value_; }
16000     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
16001       // Having the same base generator guarantees that the other
16002       // iterator is of the same type and we can downcast.
16003       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
16004           << "The program attempted to compare iterators "
16005           << "from different generators." << std::endl;
16006       const Iterator* typed_other =
16007           CheckedDowncastToActualType<const Iterator>(&other);
16008       // We must report iterators equal if they both point beyond their
16009       // respective ranges. That can happen in a variety of fashions,
16010       // so we have to consult AtEnd().
16011       return (AtEnd() && typed_other->AtEnd()) ||
16012          (
16013           current1_ == typed_other->current1_ &&
16014           current2_ == typed_other->current2_ &&
16015           current3_ == typed_other->current3_ &&
16016           current4_ == typed_other->current4_ &&
16017           current5_ == typed_other->current5_ &&
16018           current6_ == typed_other->current6_ &&
16019           current7_ == typed_other->current7_ &&
16020           current8_ == typed_other->current8_);
16021     }
16022
16023    private:
16024     Iterator(const Iterator& other)
16025         : base_(other.base_),
16026         begin1_(other.begin1_),
16027         end1_(other.end1_),
16028         current1_(other.current1_),
16029         begin2_(other.begin2_),
16030         end2_(other.end2_),
16031         current2_(other.current2_),
16032         begin3_(other.begin3_),
16033         end3_(other.end3_),
16034         current3_(other.current3_),
16035         begin4_(other.begin4_),
16036         end4_(other.end4_),
16037         current4_(other.current4_),
16038         begin5_(other.begin5_),
16039         end5_(other.end5_),
16040         current5_(other.current5_),
16041         begin6_(other.begin6_),
16042         end6_(other.end6_),
16043         current6_(other.current6_),
16044         begin7_(other.begin7_),
16045         end7_(other.end7_),
16046         current7_(other.current7_),
16047         begin8_(other.begin8_),
16048         end8_(other.end8_),
16049         current8_(other.current8_) {
16050       ComputeCurrentValue();
16051     }
16052
16053     void ComputeCurrentValue() {
16054       if (!AtEnd())
16055         current_value_ = ParamType(*current1_, *current2_, *current3_,
16056             *current4_, *current5_, *current6_, *current7_, *current8_);
16057     }
16058     bool AtEnd() const {
16059       // We must report iterator past the end of the range when either of the
16060       // component iterators has reached the end of its range.
16061       return
16062           current1_ == end1_ ||
16063           current2_ == end2_ ||
16064           current3_ == end3_ ||
16065           current4_ == end4_ ||
16066           current5_ == end5_ ||
16067           current6_ == end6_ ||
16068           current7_ == end7_ ||
16069           current8_ == end8_;
16070     }
16071
16072     // No implementation - assignment is unsupported.
16073     void operator=(const Iterator& other);
16074
16075     const ParamGeneratorInterface<ParamType>* const base_;
16076     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
16077     // current[i]_ is the actual traversing iterator.
16078     const typename ParamGenerator<T1>::iterator begin1_;
16079     const typename ParamGenerator<T1>::iterator end1_;
16080     typename ParamGenerator<T1>::iterator current1_;
16081     const typename ParamGenerator<T2>::iterator begin2_;
16082     const typename ParamGenerator<T2>::iterator end2_;
16083     typename ParamGenerator<T2>::iterator current2_;
16084     const typename ParamGenerator<T3>::iterator begin3_;
16085     const typename ParamGenerator<T3>::iterator end3_;
16086     typename ParamGenerator<T3>::iterator current3_;
16087     const typename ParamGenerator<T4>::iterator begin4_;
16088     const typename ParamGenerator<T4>::iterator end4_;
16089     typename ParamGenerator<T4>::iterator current4_;
16090     const typename ParamGenerator<T5>::iterator begin5_;
16091     const typename ParamGenerator<T5>::iterator end5_;
16092     typename ParamGenerator<T5>::iterator current5_;
16093     const typename ParamGenerator<T6>::iterator begin6_;
16094     const typename ParamGenerator<T6>::iterator end6_;
16095     typename ParamGenerator<T6>::iterator current6_;
16096     const typename ParamGenerator<T7>::iterator begin7_;
16097     const typename ParamGenerator<T7>::iterator end7_;
16098     typename ParamGenerator<T7>::iterator current7_;
16099     const typename ParamGenerator<T8>::iterator begin8_;
16100     const typename ParamGenerator<T8>::iterator end8_;
16101     typename ParamGenerator<T8>::iterator current8_;
16102     ParamType current_value_;
16103   };  // class CartesianProductGenerator8::Iterator
16104
16105   // No implementation - assignment is unsupported.
16106   void operator=(const CartesianProductGenerator8& other);
16107
16108   const ParamGenerator<T1> g1_;
16109   const ParamGenerator<T2> g2_;
16110   const ParamGenerator<T3> g3_;
16111   const ParamGenerator<T4> g4_;
16112   const ParamGenerator<T5> g5_;
16113   const ParamGenerator<T6> g6_;
16114   const ParamGenerator<T7> g7_;
16115   const ParamGenerator<T8> g8_;
16116 };  // class CartesianProductGenerator8
16117
16118
16119 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16120     typename T6, typename T7, typename T8, typename T9>
16121 class CartesianProductGenerator9
16122     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
16123         T7, T8, T9> > {
16124  public:
16125   typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;
16126
16127   CartesianProductGenerator9(const ParamGenerator<T1>& g1,
16128       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
16129       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
16130       const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
16131       const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9)
16132       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
16133           g9_(g9) {}
16134   virtual ~CartesianProductGenerator9() {}
16135
16136   virtual ParamIteratorInterface<ParamType>* Begin() const {
16137     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
16138         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
16139         g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin());
16140   }
16141   virtual ParamIteratorInterface<ParamType>* End() const {
16142     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
16143         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
16144         g8_.end(), g9_, g9_.end());
16145   }
16146
16147  private:
16148   class Iterator : public ParamIteratorInterface<ParamType> {
16149    public:
16150     Iterator(const ParamGeneratorInterface<ParamType>* base,
16151       const ParamGenerator<T1>& g1,
16152       const typename ParamGenerator<T1>::iterator& current1,
16153       const ParamGenerator<T2>& g2,
16154       const typename ParamGenerator<T2>::iterator& current2,
16155       const ParamGenerator<T3>& g3,
16156       const typename ParamGenerator<T3>::iterator& current3,
16157       const ParamGenerator<T4>& g4,
16158       const typename ParamGenerator<T4>::iterator& current4,
16159       const ParamGenerator<T5>& g5,
16160       const typename ParamGenerator<T5>::iterator& current5,
16161       const ParamGenerator<T6>& g6,
16162       const typename ParamGenerator<T6>::iterator& current6,
16163       const ParamGenerator<T7>& g7,
16164       const typename ParamGenerator<T7>::iterator& current7,
16165       const ParamGenerator<T8>& g8,
16166       const typename ParamGenerator<T8>::iterator& current8,
16167       const ParamGenerator<T9>& g9,
16168       const typename ParamGenerator<T9>::iterator& current9)
16169         : base_(base),
16170           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
16171           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
16172           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
16173           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
16174           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
16175           begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
16176           begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
16177           begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
16178           begin9_(g9.begin()), end9_(g9.end()), current9_(current9)    {
16179       ComputeCurrentValue();
16180     }
16181     virtual ~Iterator() {}
16182
16183     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
16184       return base_;
16185     }
16186     // Advance should not be called on beyond-of-range iterators
16187     // so no component iterators must be beyond end of range, either.
16188     virtual void Advance() {
16189       assert(!AtEnd());
16190       ++current9_;
16191       if (current9_ == end9_) {
16192         current9_ = begin9_;
16193         ++current8_;
16194       }
16195       if (current8_ == end8_) {
16196         current8_ = begin8_;
16197         ++current7_;
16198       }
16199       if (current7_ == end7_) {
16200         current7_ = begin7_;
16201         ++current6_;
16202       }
16203       if (current6_ == end6_) {
16204         current6_ = begin6_;
16205         ++current5_;
16206       }
16207       if (current5_ == end5_) {
16208         current5_ = begin5_;
16209         ++current4_;
16210       }
16211       if (current4_ == end4_) {
16212         current4_ = begin4_;
16213         ++current3_;
16214       }
16215       if (current3_ == end3_) {
16216         current3_ = begin3_;
16217         ++current2_;
16218       }
16219       if (current2_ == end2_) {
16220         current2_ = begin2_;
16221         ++current1_;
16222       }
16223       ComputeCurrentValue();
16224     }
16225     virtual ParamIteratorInterface<ParamType>* Clone() const {
16226       return new Iterator(*this);
16227     }
16228     virtual const ParamType* Current() const { return &current_value_; }
16229     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
16230       // Having the same base generator guarantees that the other
16231       // iterator is of the same type and we can downcast.
16232       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
16233           << "The program attempted to compare iterators "
16234           << "from different generators." << std::endl;
16235       const Iterator* typed_other =
16236           CheckedDowncastToActualType<const Iterator>(&other);
16237       // We must report iterators equal if they both point beyond their
16238       // respective ranges. That can happen in a variety of fashions,
16239       // so we have to consult AtEnd().
16240       return (AtEnd() && typed_other->AtEnd()) ||
16241          (
16242           current1_ == typed_other->current1_ &&
16243           current2_ == typed_other->current2_ &&
16244           current3_ == typed_other->current3_ &&
16245           current4_ == typed_other->current4_ &&
16246           current5_ == typed_other->current5_ &&
16247           current6_ == typed_other->current6_ &&
16248           current7_ == typed_other->current7_ &&
16249           current8_ == typed_other->current8_ &&
16250           current9_ == typed_other->current9_);
16251     }
16252
16253    private:
16254     Iterator(const Iterator& other)
16255         : base_(other.base_),
16256         begin1_(other.begin1_),
16257         end1_(other.end1_),
16258         current1_(other.current1_),
16259         begin2_(other.begin2_),
16260         end2_(other.end2_),
16261         current2_(other.current2_),
16262         begin3_(other.begin3_),
16263         end3_(other.end3_),
16264         current3_(other.current3_),
16265         begin4_(other.begin4_),
16266         end4_(other.end4_),
16267         current4_(other.current4_),
16268         begin5_(other.begin5_),
16269         end5_(other.end5_),
16270         current5_(other.current5_),
16271         begin6_(other.begin6_),
16272         end6_(other.end6_),
16273         current6_(other.current6_),
16274         begin7_(other.begin7_),
16275         end7_(other.end7_),
16276         current7_(other.current7_),
16277         begin8_(other.begin8_),
16278         end8_(other.end8_),
16279         current8_(other.current8_),
16280         begin9_(other.begin9_),
16281         end9_(other.end9_),
16282         current9_(other.current9_) {
16283       ComputeCurrentValue();
16284     }
16285
16286     void ComputeCurrentValue() {
16287       if (!AtEnd())
16288         current_value_ = ParamType(*current1_, *current2_, *current3_,
16289             *current4_, *current5_, *current6_, *current7_, *current8_,
16290             *current9_);
16291     }
16292     bool AtEnd() const {
16293       // We must report iterator past the end of the range when either of the
16294       // component iterators has reached the end of its range.
16295       return
16296           current1_ == end1_ ||
16297           current2_ == end2_ ||
16298           current3_ == end3_ ||
16299           current4_ == end4_ ||
16300           current5_ == end5_ ||
16301           current6_ == end6_ ||
16302           current7_ == end7_ ||
16303           current8_ == end8_ ||
16304           current9_ == end9_;
16305     }
16306
16307     // No implementation - assignment is unsupported.
16308     void operator=(const Iterator& other);
16309
16310     const ParamGeneratorInterface<ParamType>* const base_;
16311     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
16312     // current[i]_ is the actual traversing iterator.
16313     const typename ParamGenerator<T1>::iterator begin1_;
16314     const typename ParamGenerator<T1>::iterator end1_;
16315     typename ParamGenerator<T1>::iterator current1_;
16316     const typename ParamGenerator<T2>::iterator begin2_;
16317     const typename ParamGenerator<T2>::iterator end2_;
16318     typename ParamGenerator<T2>::iterator current2_;
16319     const typename ParamGenerator<T3>::iterator begin3_;
16320     const typename ParamGenerator<T3>::iterator end3_;
16321     typename ParamGenerator<T3>::iterator current3_;
16322     const typename ParamGenerator<T4>::iterator begin4_;
16323     const typename ParamGenerator<T4>::iterator end4_;
16324     typename ParamGenerator<T4>::iterator current4_;
16325     const typename ParamGenerator<T5>::iterator begin5_;
16326     const typename ParamGenerator<T5>::iterator end5_;
16327     typename ParamGenerator<T5>::iterator current5_;
16328     const typename ParamGenerator<T6>::iterator begin6_;
16329     const typename ParamGenerator<T6>::iterator end6_;
16330     typename ParamGenerator<T6>::iterator current6_;
16331     const typename ParamGenerator<T7>::iterator begin7_;
16332     const typename ParamGenerator<T7>::iterator end7_;
16333     typename ParamGenerator<T7>::iterator current7_;
16334     const typename ParamGenerator<T8>::iterator begin8_;
16335     const typename ParamGenerator<T8>::iterator end8_;
16336     typename ParamGenerator<T8>::iterator current8_;
16337     const typename ParamGenerator<T9>::iterator begin9_;
16338     const typename ParamGenerator<T9>::iterator end9_;
16339     typename ParamGenerator<T9>::iterator current9_;
16340     ParamType current_value_;
16341   };  // class CartesianProductGenerator9::Iterator
16342
16343   // No implementation - assignment is unsupported.
16344   void operator=(const CartesianProductGenerator9& other);
16345
16346   const ParamGenerator<T1> g1_;
16347   const ParamGenerator<T2> g2_;
16348   const ParamGenerator<T3> g3_;
16349   const ParamGenerator<T4> g4_;
16350   const ParamGenerator<T5> g5_;
16351   const ParamGenerator<T6> g6_;
16352   const ParamGenerator<T7> g7_;
16353   const ParamGenerator<T8> g8_;
16354   const ParamGenerator<T9> g9_;
16355 };  // class CartesianProductGenerator9
16356
16357
16358 template <typename T1, typename T2, typename T3, typename T4, typename T5,
16359     typename T6, typename T7, typename T8, typename T9, typename T10>
16360 class CartesianProductGenerator10
16361     : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
16362         T7, T8, T9, T10> > {
16363  public:
16364   typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;
16365
16366   CartesianProductGenerator10(const ParamGenerator<T1>& g1,
16367       const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
16368       const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
16369       const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
16370       const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9,
16371       const ParamGenerator<T10>& g10)
16372       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
16373           g9_(g9), g10_(g10) {}
16374   virtual ~CartesianProductGenerator10() {}
16375
16376   virtual ParamIteratorInterface<ParamType>* Begin() const {
16377     return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
16378         g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
16379         g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin());
16380   }
16381   virtual ParamIteratorInterface<ParamType>* End() const {
16382     return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
16383         g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
16384         g8_.end(), g9_, g9_.end(), g10_, g10_.end());
16385   }
16386
16387  private:
16388   class Iterator : public ParamIteratorInterface<ParamType> {
16389    public:
16390     Iterator(const ParamGeneratorInterface<ParamType>* base,
16391       const ParamGenerator<T1>& g1,
16392       const typename ParamGenerator<T1>::iterator& current1,
16393       const ParamGenerator<T2>& g2,
16394       const typename ParamGenerator<T2>::iterator& current2,
16395       const ParamGenerator<T3>& g3,
16396       const typename ParamGenerator<T3>::iterator& current3,
16397       const ParamGenerator<T4>& g4,
16398       const typename ParamGenerator<T4>::iterator& current4,
16399       const ParamGenerator<T5>& g5,
16400       const typename ParamGenerator<T5>::iterator& current5,
16401       const ParamGenerator<T6>& g6,
16402       const typename ParamGenerator<T6>::iterator& current6,
16403       const ParamGenerator<T7>& g7,
16404       const typename ParamGenerator<T7>::iterator& current7,
16405       const ParamGenerator<T8>& g8,
16406       const typename ParamGenerator<T8>::iterator& current8,
16407       const ParamGenerator<T9>& g9,
16408       const typename ParamGenerator<T9>::iterator& current9,
16409       const ParamGenerator<T10>& g10,
16410       const typename ParamGenerator<T10>::iterator& current10)
16411         : base_(base),
16412           begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
16413           begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
16414           begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
16415           begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
16416           begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
16417           begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
16418           begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
16419           begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
16420           begin9_(g9.begin()), end9_(g9.end()), current9_(current9),
16421           begin10_(g10.begin()), end10_(g10.end()), current10_(current10)    {
16422       ComputeCurrentValue();
16423     }
16424     virtual ~Iterator() {}
16425
16426     virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
16427       return base_;
16428     }
16429     // Advance should not be called on beyond-of-range iterators
16430     // so no component iterators must be beyond end of range, either.
16431     virtual void Advance() {
16432       assert(!AtEnd());
16433       ++current10_;
16434       if (current10_ == end10_) {
16435         current10_ = begin10_;
16436         ++current9_;
16437       }
16438       if (current9_ == end9_) {
16439         current9_ = begin9_;
16440         ++current8_;
16441       }
16442       if (current8_ == end8_) {
16443         current8_ = begin8_;
16444         ++current7_;
16445       }
16446       if (current7_ == end7_) {
16447         current7_ = begin7_;
16448         ++current6_;
16449       }
16450       if (current6_ == end6_) {
16451         current6_ = begin6_;
16452         ++current5_;
16453       }
16454       if (current5_ == end5_) {
16455         current5_ = begin5_;
16456         ++current4_;
16457       }
16458       if (current4_ == end4_) {
16459         current4_ = begin4_;
16460         ++current3_;
16461       }
16462       if (current3_ == end3_) {
16463         current3_ = begin3_;
16464         ++current2_;
16465       }
16466       if (current2_ == end2_) {
16467         current2_ = begin2_;
16468         ++current1_;
16469       }
16470       ComputeCurrentValue();
16471     }
16472     virtual ParamIteratorInterface<ParamType>* Clone() const {
16473       return new Iterator(*this);
16474     }
16475     virtual const ParamType* Current() const { return &current_value_; }
16476     virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
16477       // Having the same base generator guarantees that the other
16478       // iterator is of the same type and we can downcast.
16479       GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
16480           << "The program attempted to compare iterators "
16481           << "from different generators." << std::endl;
16482       const Iterator* typed_other =
16483           CheckedDowncastToActualType<const Iterator>(&other);
16484       // We must report iterators equal if they both point beyond their
16485       // respective ranges. That can happen in a variety of fashions,
16486       // so we have to consult AtEnd().
16487       return (AtEnd() && typed_other->AtEnd()) ||
16488          (
16489           current1_ == typed_other->current1_ &&
16490           current2_ == typed_other->current2_ &&
16491           current3_ == typed_other->current3_ &&
16492           current4_ == typed_other->current4_ &&
16493           current5_ == typed_other->current5_ &&
16494           current6_ == typed_other->current6_ &&
16495           current7_ == typed_other->current7_ &&
16496           current8_ == typed_other->current8_ &&
16497           current9_ == typed_other->current9_ &&
16498           current10_ == typed_other->current10_);
16499     }
16500
16501    private:
16502     Iterator(const Iterator& other)
16503         : base_(other.base_),
16504         begin1_(other.begin1_),
16505         end1_(other.end1_),
16506         current1_(other.current1_),
16507         begin2_(other.begin2_),
16508         end2_(other.end2_),
16509         current2_(other.current2_),
16510         begin3_(other.begin3_),
16511         end3_(other.end3_),
16512         current3_(other.current3_),
16513         begin4_(other.begin4_),
16514         end4_(other.end4_),
16515         current4_(other.current4_),
16516         begin5_(other.begin5_),
16517         end5_(other.end5_),
16518         current5_(other.current5_),
16519         begin6_(other.begin6_),
16520         end6_(other.end6_),
16521         current6_(other.current6_),
16522         begin7_(other.begin7_),
16523         end7_(other.end7_),
16524         current7_(other.current7_),
16525         begin8_(other.begin8_),
16526         end8_(other.end8_),
16527         current8_(other.current8_),
16528         begin9_(other.begin9_),
16529         end9_(other.end9_),
16530         current9_(other.current9_),
16531         begin10_(other.begin10_),
16532         end10_(other.end10_),
16533         current10_(other.current10_) {
16534       ComputeCurrentValue();
16535     }
16536
16537     void ComputeCurrentValue() {
16538       if (!AtEnd())
16539         current_value_ = ParamType(*current1_, *current2_, *current3_,
16540             *current4_, *current5_, *current6_, *current7_, *current8_,
16541             *current9_, *current10_);
16542     }
16543     bool AtEnd() const {
16544       // We must report iterator past the end of the range when either of the
16545       // component iterators has reached the end of its range.
16546       return
16547           current1_ == end1_ ||
16548           current2_ == end2_ ||
16549           current3_ == end3_ ||
16550           current4_ == end4_ ||
16551           current5_ == end5_ ||
16552           current6_ == end6_ ||
16553           current7_ == end7_ ||
16554           current8_ == end8_ ||
16555           current9_ == end9_ ||
16556           current10_ == end10_;
16557     }
16558
16559     // No implementation - assignment is unsupported.
16560     void operator=(const Iterator& other);
16561
16562     const ParamGeneratorInterface<ParamType>* const base_;
16563     // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
16564     // current[i]_ is the actual traversing iterator.
16565     const typename ParamGenerator<T1>::iterator begin1_;
16566     const typename ParamGenerator<T1>::iterator end1_;
16567     typename ParamGenerator<T1>::iterator current1_;
16568     const typename ParamGenerator<T2>::iterator begin2_;
16569     const typename ParamGenerator<T2>::iterator end2_;
16570     typename ParamGenerator<T2>::iterator current2_;
16571     const typename ParamGenerator<T3>::iterator begin3_;
16572     const typename ParamGenerator<T3>::iterator end3_;
16573     typename ParamGenerator<T3>::iterator current3_;
16574     const typename ParamGenerator<T4>::iterator begin4_;
16575     const typename ParamGenerator<T4>::iterator end4_;
16576     typename ParamGenerator<T4>::iterator current4_;
16577     const typename ParamGenerator<T5>::iterator begin5_;
16578     const typename ParamGenerator<T5>::iterator end5_;
16579     typename ParamGenerator<T5>::iterator current5_;
16580     const typename ParamGenerator<T6>::iterator begin6_;
16581     const typename ParamGenerator<T6>::iterator end6_;
16582     typename ParamGenerator<T6>::iterator current6_;
16583     const typename ParamGenerator<T7>::iterator begin7_;
16584     const typename ParamGenerator<T7>::iterator end7_;
16585     typename ParamGenerator<T7>::iterator current7_;
16586     const typename ParamGenerator<T8>::iterator begin8_;
16587     const typename ParamGenerator<T8>::iterator end8_;
16588     typename ParamGenerator<T8>::iterator current8_;
16589     const typename ParamGenerator<T9>::iterator begin9_;
16590     const typename ParamGenerator<T9>::iterator end9_;
16591     typename ParamGenerator<T9>::iterator current9_;
16592     const typename ParamGenerator<T10>::iterator begin10_;
16593     const typename ParamGenerator<T10>::iterator end10_;
16594     typename ParamGenerator<T10>::iterator current10_;
16595     ParamType current_value_;
16596   };  // class CartesianProductGenerator10::Iterator
16597
16598   // No implementation - assignment is unsupported.
16599   void operator=(const CartesianProductGenerator10& other);
16600
16601   const ParamGenerator<T1> g1_;
16602   const ParamGenerator<T2> g2_;
16603   const ParamGenerator<T3> g3_;
16604   const ParamGenerator<T4> g4_;
16605   const ParamGenerator<T5> g5_;
16606   const ParamGenerator<T6> g6_;
16607   const ParamGenerator<T7> g7_;
16608   const ParamGenerator<T8> g8_;
16609   const ParamGenerator<T9> g9_;
16610   const ParamGenerator<T10> g10_;
16611 };  // class CartesianProductGenerator10
16612
16613
16614 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
16615 //
16616 // Helper classes providing Combine() with polymorphic features. They allow
16617 // casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
16618 // convertible to U.
16619 //
16620 template <class Generator1, class Generator2>
16621 class CartesianProductHolder2 {
16622  public:
16623 CartesianProductHolder2(const Generator1& g1, const Generator2& g2)
16624       : g1_(g1), g2_(g2) {}
16625   template <typename T1, typename T2>
16626   operator ParamGenerator< ::testing::tuple<T1, T2> >() const {
16627     return ParamGenerator< ::testing::tuple<T1, T2> >(
16628         new CartesianProductGenerator2<T1, T2>(
16629         static_cast<ParamGenerator<T1> >(g1_),
16630         static_cast<ParamGenerator<T2> >(g2_)));
16631   }
16632
16633  private:
16634   // No implementation - assignment is unsupported.
16635   void operator=(const CartesianProductHolder2& other);
16636
16637   const Generator1 g1_;
16638   const Generator2 g2_;
16639 };  // class CartesianProductHolder2
16640
16641 template <class Generator1, class Generator2, class Generator3>
16642 class CartesianProductHolder3 {
16643  public:
16644 CartesianProductHolder3(const Generator1& g1, const Generator2& g2,
16645     const Generator3& g3)
16646       : g1_(g1), g2_(g2), g3_(g3) {}
16647   template <typename T1, typename T2, typename T3>
16648   operator ParamGenerator< ::testing::tuple<T1, T2, T3> >() const {
16649     return ParamGenerator< ::testing::tuple<T1, T2, T3> >(
16650         new CartesianProductGenerator3<T1, T2, T3>(
16651         static_cast<ParamGenerator<T1> >(g1_),
16652         static_cast<ParamGenerator<T2> >(g2_),
16653         static_cast<ParamGenerator<T3> >(g3_)));
16654   }
16655
16656  private:
16657   // No implementation - assignment is unsupported.
16658   void operator=(const CartesianProductHolder3& other);
16659
16660   const Generator1 g1_;
16661   const Generator2 g2_;
16662   const Generator3 g3_;
16663 };  // class CartesianProductHolder3
16664
16665 template <class Generator1, class Generator2, class Generator3,
16666     class Generator4>
16667 class CartesianProductHolder4 {
16668  public:
16669 CartesianProductHolder4(const Generator1& g1, const Generator2& g2,
16670     const Generator3& g3, const Generator4& g4)
16671       : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
16672   template <typename T1, typename T2, typename T3, typename T4>
16673   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4> >() const {
16674     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4> >(
16675         new CartesianProductGenerator4<T1, T2, T3, T4>(
16676         static_cast<ParamGenerator<T1> >(g1_),
16677         static_cast<ParamGenerator<T2> >(g2_),
16678         static_cast<ParamGenerator<T3> >(g3_),
16679         static_cast<ParamGenerator<T4> >(g4_)));
16680   }
16681
16682  private:
16683   // No implementation - assignment is unsupported.
16684   void operator=(const CartesianProductHolder4& other);
16685
16686   const Generator1 g1_;
16687   const Generator2 g2_;
16688   const Generator3 g3_;
16689   const Generator4 g4_;
16690 };  // class CartesianProductHolder4
16691
16692 template <class Generator1, class Generator2, class Generator3,
16693     class Generator4, class Generator5>
16694 class CartesianProductHolder5 {
16695  public:
16696 CartesianProductHolder5(const Generator1& g1, const Generator2& g2,
16697     const Generator3& g3, const Generator4& g4, const Generator5& g5)
16698       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
16699   template <typename T1, typename T2, typename T3, typename T4, typename T5>
16700   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5> >() const {
16701     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5> >(
16702         new CartesianProductGenerator5<T1, T2, T3, T4, T5>(
16703         static_cast<ParamGenerator<T1> >(g1_),
16704         static_cast<ParamGenerator<T2> >(g2_),
16705         static_cast<ParamGenerator<T3> >(g3_),
16706         static_cast<ParamGenerator<T4> >(g4_),
16707         static_cast<ParamGenerator<T5> >(g5_)));
16708   }
16709
16710  private:
16711   // No implementation - assignment is unsupported.
16712   void operator=(const CartesianProductHolder5& other);
16713
16714   const Generator1 g1_;
16715   const Generator2 g2_;
16716   const Generator3 g3_;
16717   const Generator4 g4_;
16718   const Generator5 g5_;
16719 };  // class CartesianProductHolder5
16720
16721 template <class Generator1, class Generator2, class Generator3,
16722     class Generator4, class Generator5, class Generator6>
16723 class CartesianProductHolder6 {
16724  public:
16725 CartesianProductHolder6(const Generator1& g1, const Generator2& g2,
16726     const Generator3& g3, const Generator4& g4, const Generator5& g5,
16727     const Generator6& g6)
16728       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
16729   template <typename T1, typename T2, typename T3, typename T4, typename T5,
16730       typename T6>
16731   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6> >() const {
16732     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6> >(
16733         new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>(
16734         static_cast<ParamGenerator<T1> >(g1_),
16735         static_cast<ParamGenerator<T2> >(g2_),
16736         static_cast<ParamGenerator<T3> >(g3_),
16737         static_cast<ParamGenerator<T4> >(g4_),
16738         static_cast<ParamGenerator<T5> >(g5_),
16739         static_cast<ParamGenerator<T6> >(g6_)));
16740   }
16741
16742  private:
16743   // No implementation - assignment is unsupported.
16744   void operator=(const CartesianProductHolder6& other);
16745
16746   const Generator1 g1_;
16747   const Generator2 g2_;
16748   const Generator3 g3_;
16749   const Generator4 g4_;
16750   const Generator5 g5_;
16751   const Generator6 g6_;
16752 };  // class CartesianProductHolder6
16753
16754 template <class Generator1, class Generator2, class Generator3,
16755     class Generator4, class Generator5, class Generator6, class Generator7>
16756 class CartesianProductHolder7 {
16757  public:
16758 CartesianProductHolder7(const Generator1& g1, const Generator2& g2,
16759     const Generator3& g3, const Generator4& g4, const Generator5& g5,
16760     const Generator6& g6, const Generator7& g7)
16761       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
16762   template <typename T1, typename T2, typename T3, typename T4, typename T5,
16763       typename T6, typename T7>
16764   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6,
16765       T7> >() const {
16766     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> >(
16767         new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>(
16768         static_cast<ParamGenerator<T1> >(g1_),
16769         static_cast<ParamGenerator<T2> >(g2_),
16770         static_cast<ParamGenerator<T3> >(g3_),
16771         static_cast<ParamGenerator<T4> >(g4_),
16772         static_cast<ParamGenerator<T5> >(g5_),
16773         static_cast<ParamGenerator<T6> >(g6_),
16774         static_cast<ParamGenerator<T7> >(g7_)));
16775   }
16776
16777  private:
16778   // No implementation - assignment is unsupported.
16779   void operator=(const CartesianProductHolder7& other);
16780
16781   const Generator1 g1_;
16782   const Generator2 g2_;
16783   const Generator3 g3_;
16784   const Generator4 g4_;
16785   const Generator5 g5_;
16786   const Generator6 g6_;
16787   const Generator7 g7_;
16788 };  // class CartesianProductHolder7
16789
16790 template <class Generator1, class Generator2, class Generator3,
16791     class Generator4, class Generator5, class Generator6, class Generator7,
16792     class Generator8>
16793 class CartesianProductHolder8 {
16794  public:
16795 CartesianProductHolder8(const Generator1& g1, const Generator2& g2,
16796     const Generator3& g3, const Generator4& g4, const Generator5& g5,
16797     const Generator6& g6, const Generator7& g7, const Generator8& g8)
16798       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
16799           g8_(g8) {}
16800   template <typename T1, typename T2, typename T3, typename T4, typename T5,
16801       typename T6, typename T7, typename T8>
16802   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7,
16803       T8> >() const {
16804     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(
16805         new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>(
16806         static_cast<ParamGenerator<T1> >(g1_),
16807         static_cast<ParamGenerator<T2> >(g2_),
16808         static_cast<ParamGenerator<T3> >(g3_),
16809         static_cast<ParamGenerator<T4> >(g4_),
16810         static_cast<ParamGenerator<T5> >(g5_),
16811         static_cast<ParamGenerator<T6> >(g6_),
16812         static_cast<ParamGenerator<T7> >(g7_),
16813         static_cast<ParamGenerator<T8> >(g8_)));
16814   }
16815
16816  private:
16817   // No implementation - assignment is unsupported.
16818   void operator=(const CartesianProductHolder8& other);
16819
16820   const Generator1 g1_;
16821   const Generator2 g2_;
16822   const Generator3 g3_;
16823   const Generator4 g4_;
16824   const Generator5 g5_;
16825   const Generator6 g6_;
16826   const Generator7 g7_;
16827   const Generator8 g8_;
16828 };  // class CartesianProductHolder8
16829
16830 template <class Generator1, class Generator2, class Generator3,
16831     class Generator4, class Generator5, class Generator6, class Generator7,
16832     class Generator8, class Generator9>
16833 class CartesianProductHolder9 {
16834  public:
16835 CartesianProductHolder9(const Generator1& g1, const Generator2& g2,
16836     const Generator3& g3, const Generator4& g4, const Generator5& g5,
16837     const Generator6& g6, const Generator7& g7, const Generator8& g8,
16838     const Generator9& g9)
16839       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
16840           g9_(g9) {}
16841   template <typename T1, typename T2, typename T3, typename T4, typename T5,
16842       typename T6, typename T7, typename T8, typename T9>
16843   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
16844       T9> >() const {
16845     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
16846         T9> >(
16847         new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
16848         static_cast<ParamGenerator<T1> >(g1_),
16849         static_cast<ParamGenerator<T2> >(g2_),
16850         static_cast<ParamGenerator<T3> >(g3_),
16851         static_cast<ParamGenerator<T4> >(g4_),
16852         static_cast<ParamGenerator<T5> >(g5_),
16853         static_cast<ParamGenerator<T6> >(g6_),
16854         static_cast<ParamGenerator<T7> >(g7_),
16855         static_cast<ParamGenerator<T8> >(g8_),
16856         static_cast<ParamGenerator<T9> >(g9_)));
16857   }
16858
16859  private:
16860   // No implementation - assignment is unsupported.
16861   void operator=(const CartesianProductHolder9& other);
16862
16863   const Generator1 g1_;
16864   const Generator2 g2_;
16865   const Generator3 g3_;
16866   const Generator4 g4_;
16867   const Generator5 g5_;
16868   const Generator6 g6_;
16869   const Generator7 g7_;
16870   const Generator8 g8_;
16871   const Generator9 g9_;
16872 };  // class CartesianProductHolder9
16873
16874 template <class Generator1, class Generator2, class Generator3,
16875     class Generator4, class Generator5, class Generator6, class Generator7,
16876     class Generator8, class Generator9, class Generator10>
16877 class CartesianProductHolder10 {
16878  public:
16879 CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
16880     const Generator3& g3, const Generator4& g4, const Generator5& g5,
16881     const Generator6& g6, const Generator7& g7, const Generator8& g8,
16882     const Generator9& g9, const Generator10& g10)
16883       : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
16884           g9_(g9), g10_(g10) {}
16885   template <typename T1, typename T2, typename T3, typename T4, typename T5,
16886       typename T6, typename T7, typename T8, typename T9, typename T10>
16887   operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9,
16888       T10> >() const {
16889     return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9,
16890         T10> >(
16891         new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
16892             T10>(
16893         static_cast<ParamGenerator<T1> >(g1_),
16894         static_cast<ParamGenerator<T2> >(g2_),
16895         static_cast<ParamGenerator<T3> >(g3_),
16896         static_cast<ParamGenerator<T4> >(g4_),
16897         static_cast<ParamGenerator<T5> >(g5_),
16898         static_cast<ParamGenerator<T6> >(g6_),
16899         static_cast<ParamGenerator<T7> >(g7_),
16900         static_cast<ParamGenerator<T8> >(g8_),
16901         static_cast<ParamGenerator<T9> >(g9_),
16902         static_cast<ParamGenerator<T10> >(g10_)));
16903   }
16904
16905  private:
16906   // No implementation - assignment is unsupported.
16907   void operator=(const CartesianProductHolder10& other);
16908
16909   const Generator1 g1_;
16910   const Generator2 g2_;
16911   const Generator3 g3_;
16912   const Generator4 g4_;
16913   const Generator5 g5_;
16914   const Generator6 g6_;
16915   const Generator7 g7_;
16916   const Generator8 g8_;
16917   const Generator9 g9_;
16918   const Generator10 g10_;
16919 };  // class CartesianProductHolder10
16920
16921 # endif  // GTEST_HAS_COMBINE
16922
16923 }  // namespace internal
16924 }  // namespace testing
16925
16926 #endif  //  GTEST_HAS_PARAM_TEST
16927
16928 #endif  // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
16929
16930 #if GTEST_HAS_PARAM_TEST
16931
16932 namespace testing {
16933
16934 // Functions producing parameter generators.
16935 //
16936 // Google Test uses these generators to produce parameters for value-
16937 // parameterized tests. When a parameterized test case is instantiated
16938 // with a particular generator, Google Test creates and runs tests
16939 // for each element in the sequence produced by the generator.
16940 //
16941 // In the following sample, tests from test case FooTest are instantiated
16942 // each three times with parameter values 3, 5, and 8:
16943 //
16944 // class FooTest : public TestWithParam<int> { ... };
16945 //
16946 // TEST_P(FooTest, TestThis) {
16947 // }
16948 // TEST_P(FooTest, TestThat) {
16949 // }
16950 // INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
16951 //
16952
16953 // Range() returns generators providing sequences of values in a range.
16954 //
16955 // Synopsis:
16956 // Range(start, end)
16957 //   - returns a generator producing a sequence of values {start, start+1,
16958 //     start+2, ..., }.
16959 // Range(start, end, step)
16960 //   - returns a generator producing a sequence of values {start, start+step,
16961 //     start+step+step, ..., }.
16962 // Notes:
16963 //   * The generated sequences never include end. For example, Range(1, 5)
16964 //     returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
16965 //     returns a generator producing {1, 3, 5, 7}.
16966 //   * start and end must have the same type. That type may be any integral or
16967 //     floating-point type or a user defined type satisfying these conditions:
16968 //     * It must be assignable (have operator=() defined).
16969 //     * It must have operator+() (operator+(int-compatible type) for
16970 //       two-operand version).
16971 //     * It must have operator<() defined.
16972 //     Elements in the resulting sequences will also have that type.
16973 //   * Condition start < end must be satisfied in order for resulting sequences
16974 //     to contain any elements.
16975 //
16976 template <typename T, typename IncrementT>
16977 internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
16978   return internal::ParamGenerator<T>(
16979       new internal::RangeGenerator<T, IncrementT>(start, end, step));
16980 }
16981
16982 template <typename T>
16983 internal::ParamGenerator<T> Range(T start, T end) {
16984   return Range(start, end, 1);
16985 }
16986
16987 // ValuesIn() function allows generation of tests with parameters coming from
16988 // a container.
16989 //
16990 // Synopsis:
16991 // ValuesIn(const T (&array)[N])
16992 //   - returns a generator producing sequences with elements from
16993 //     a C-style array.
16994 // ValuesIn(const Container& container)
16995 //   - returns a generator producing sequences with elements from
16996 //     an STL-style container.
16997 // ValuesIn(Iterator begin, Iterator end)
16998 //   - returns a generator producing sequences with elements from
16999 //     a range [begin, end) defined by a pair of STL-style iterators. These
17000 //     iterators can also be plain C pointers.
17001 //
17002 // Please note that ValuesIn copies the values from the containers
17003 // passed in and keeps them to generate tests in RUN_ALL_TESTS().
17004 //
17005 // Examples:
17006 //
17007 // This instantiates tests from test case StringTest
17008 // each with C-string values of "foo", "bar", and "baz":
17009 //
17010 // const char* strings[] = {"foo", "bar", "baz"};
17011 // INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
17012 //
17013 // This instantiates tests from test case StlStringTest
17014 // each with STL strings with values "a" and "b":
17015 //
17016 // ::std::vector< ::std::string> GetParameterStrings() {
17017 //   ::std::vector< ::std::string> v;
17018 //   v.push_back("a");
17019 //   v.push_back("b");
17020 //   return v;
17021 // }
17022 //
17023 // INSTANTIATE_TEST_CASE_P(CharSequence,
17024 //                         StlStringTest,
17025 //                         ValuesIn(GetParameterStrings()));
17026 //
17027 //
17028 // This will also instantiate tests from CharTest
17029 // each with parameter values 'a' and 'b':
17030 //
17031 // ::std::list<char> GetParameterChars() {
17032 //   ::std::list<char> list;
17033 //   list.push_back('a');
17034 //   list.push_back('b');
17035 //   return list;
17036 // }
17037 // ::std::list<char> l = GetParameterChars();
17038 // INSTANTIATE_TEST_CASE_P(CharSequence2,
17039 //                         CharTest,
17040 //                         ValuesIn(l.begin(), l.end()));
17041 //
17042 template <typename ForwardIterator>
17043 internal::ParamGenerator<
17044   typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
17045 ValuesIn(ForwardIterator begin, ForwardIterator end) {
17046   typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
17047       ::value_type ParamType;
17048   return internal::ParamGenerator<ParamType>(
17049       new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
17050 }
17051
17052 template <typename T, size_t N>
17053 internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
17054   return ValuesIn(array, array + N);
17055 }
17056
17057 template <class Container>
17058 internal::ParamGenerator<typename Container::value_type> ValuesIn(
17059     const Container& container) {
17060   return ValuesIn(container.begin(), container.end());
17061 }
17062
17063 // Values() allows generating tests from explicitly specified list of
17064 // parameters.
17065 //
17066 // Synopsis:
17067 // Values(T v1, T v2, ..., T vN)
17068 //   - returns a generator producing sequences with elements v1, v2, ..., vN.
17069 //
17070 // For example, this instantiates tests from test case BarTest each
17071 // with values "one", "two", and "three":
17072 //
17073 // INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
17074 //
17075 // This instantiates tests from test case BazTest each with values 1, 2, 3.5.
17076 // The exact type of values will depend on the type of parameter in BazTest.
17077 //
17078 // INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
17079 //
17080 // Currently, Values() supports from 1 to 50 parameters.
17081 //
17082 template <typename T1>
17083 internal::ValueArray1<T1> Values(T1 v1) {
17084   return internal::ValueArray1<T1>(v1);
17085 }
17086
17087 template <typename T1, typename T2>
17088 internal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) {
17089   return internal::ValueArray2<T1, T2>(v1, v2);
17090 }
17091
17092 template <typename T1, typename T2, typename T3>
17093 internal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) {
17094   return internal::ValueArray3<T1, T2, T3>(v1, v2, v3);
17095 }
17096
17097 template <typename T1, typename T2, typename T3, typename T4>
17098 internal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) {
17099   return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4);
17100 }
17101
17102 template <typename T1, typename T2, typename T3, typename T4, typename T5>
17103 internal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4,
17104     T5 v5) {
17105   return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);
17106 }
17107
17108 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17109     typename T6>
17110 internal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3,
17111     T4 v4, T5 v5, T6 v6) {
17112   return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6);
17113 }
17114
17115 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17116     typename T6, typename T7>
17117 internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3,
17118     T4 v4, T5 v5, T6 v6, T7 v7) {
17119   return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5,
17120       v6, v7);
17121 }
17122
17123 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17124     typename T6, typename T7, typename T8>
17125 internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2,
17126     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {
17127   return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4,
17128       v5, v6, v7, v8);
17129 }
17130
17131 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17132     typename T6, typename T7, typename T8, typename T9>
17133 internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2,
17134     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {
17135   return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3,
17136       v4, v5, v6, v7, v8, v9);
17137 }
17138
17139 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17140     typename T6, typename T7, typename T8, typename T9, typename T10>
17141 internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1,
17142     T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) {
17143   return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1,
17144       v2, v3, v4, v5, v6, v7, v8, v9, v10);
17145 }
17146
17147 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17148     typename T6, typename T7, typename T8, typename T9, typename T10,
17149     typename T11>
17150 internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
17151     T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17152     T10 v10, T11 v11) {
17153   return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
17154       T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
17155 }
17156
17157 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17158     typename T6, typename T7, typename T8, typename T9, typename T10,
17159     typename T11, typename T12>
17160 internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17161     T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17162     T10 v10, T11 v11, T12 v12) {
17163   return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17164       T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);
17165 }
17166
17167 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17168     typename T6, typename T7, typename T8, typename T9, typename T10,
17169     typename T11, typename T12, typename T13>
17170 internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
17171     T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17172     T10 v10, T11 v11, T12 v12, T13 v13) {
17173   return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17174       T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);
17175 }
17176
17177 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17178     typename T6, typename T7, typename T8, typename T9, typename T10,
17179     typename T11, typename T12, typename T13, typename T14>
17180 internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17181     T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17182     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) {
17183   return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17184       T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
17185       v14);
17186 }
17187
17188 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17189     typename T6, typename T7, typename T8, typename T9, typename T10,
17190     typename T11, typename T12, typename T13, typename T14, typename T15>
17191 internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17192     T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
17193     T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) {
17194   return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17195       T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
17196       v13, v14, v15);
17197 }
17198
17199 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17200     typename T6, typename T7, typename T8, typename T9, typename T10,
17201     typename T11, typename T12, typename T13, typename T14, typename T15,
17202     typename T16>
17203 internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17204     T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
17205     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17206     T16 v16) {
17207   return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17208       T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
17209       v12, v13, v14, v15, v16);
17210 }
17211
17212 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17213     typename T6, typename T7, typename T8, typename T9, typename T10,
17214     typename T11, typename T12, typename T13, typename T14, typename T15,
17215     typename T16, typename T17>
17216 internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17217     T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
17218     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17219     T16 v16, T17 v17) {
17220   return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17221       T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
17222       v11, v12, v13, v14, v15, v16, v17);
17223 }
17224
17225 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17226     typename T6, typename T7, typename T8, typename T9, typename T10,
17227     typename T11, typename T12, typename T13, typename T14, typename T15,
17228     typename T16, typename T17, typename T18>
17229 internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17230     T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
17231     T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17232     T16 v16, T17 v17, T18 v18) {
17233   return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17234       T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
17235       v10, v11, v12, v13, v14, v15, v16, v17, v18);
17236 }
17237
17238 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17239     typename T6, typename T7, typename T8, typename T9, typename T10,
17240     typename T11, typename T12, typename T13, typename T14, typename T15,
17241     typename T16, typename T17, typename T18, typename T19>
17242 internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17243     T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
17244     T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
17245     T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) {
17246   return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17247       T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8,
17248       v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
17249 }
17250
17251 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17252     typename T6, typename T7, typename T8, typename T9, typename T10,
17253     typename T11, typename T12, typename T13, typename T14, typename T15,
17254     typename T16, typename T17, typename T18, typename T19, typename T20>
17255 internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17256     T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4,
17257     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
17258     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) {
17259   return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17260       T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7,
17261       v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20);
17262 }
17263
17264 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17265     typename T6, typename T7, typename T8, typename T9, typename T10,
17266     typename T11, typename T12, typename T13, typename T14, typename T15,
17267     typename T16, typename T17, typename T18, typename T19, typename T20,
17268     typename T21>
17269 internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17270     T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4,
17271     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
17272     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) {
17273   return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17274       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6,
17275       v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21);
17276 }
17277
17278 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17279     typename T6, typename T7, typename T8, typename T9, typename T10,
17280     typename T11, typename T12, typename T13, typename T14, typename T15,
17281     typename T16, typename T17, typename T18, typename T19, typename T20,
17282     typename T21, typename T22>
17283 internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17284     T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3,
17285     T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
17286     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
17287     T21 v21, T22 v22) {
17288   return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17289       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4,
17290       v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
17291       v20, v21, v22);
17292 }
17293
17294 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17295     typename T6, typename T7, typename T8, typename T9, typename T10,
17296     typename T11, typename T12, typename T13, typename T14, typename T15,
17297     typename T16, typename T17, typename T18, typename T19, typename T20,
17298     typename T21, typename T22, typename T23>
17299 internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17300     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2,
17301     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
17302     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
17303     T21 v21, T22 v22, T23 v23) {
17304   return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17305       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3,
17306       v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
17307       v20, v21, v22, v23);
17308 }
17309
17310 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17311     typename T6, typename T7, typename T8, typename T9, typename T10,
17312     typename T11, typename T12, typename T13, typename T14, typename T15,
17313     typename T16, typename T17, typename T18, typename T19, typename T20,
17314     typename T21, typename T22, typename T23, typename T24>
17315 internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17316     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2,
17317     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
17318     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
17319     T21 v21, T22 v22, T23 v23, T24 v24) {
17320   return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17321       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2,
17322       v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
17323       v19, v20, v21, v22, v23, v24);
17324 }
17325
17326 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17327     typename T6, typename T7, typename T8, typename T9, typename T10,
17328     typename T11, typename T12, typename T13, typename T14, typename T15,
17329     typename T16, typename T17, typename T18, typename T19, typename T20,
17330     typename T21, typename T22, typename T23, typename T24, typename T25>
17331 internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17332     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1,
17333     T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
17334     T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
17335     T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) {
17336   return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17337       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1,
17338       v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
17339       v18, v19, v20, v21, v22, v23, v24, v25);
17340 }
17341
17342 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17343     typename T6, typename T7, typename T8, typename T9, typename T10,
17344     typename T11, typename T12, typename T13, typename T14, typename T15,
17345     typename T16, typename T17, typename T18, typename T19, typename T20,
17346     typename T21, typename T22, typename T23, typename T24, typename T25,
17347     typename T26>
17348 internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17349     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17350     T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17351     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17352     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17353     T26 v26) {
17354   return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17355       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17356       T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
17357       v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26);
17358 }
17359
17360 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17361     typename T6, typename T7, typename T8, typename T9, typename T10,
17362     typename T11, typename T12, typename T13, typename T14, typename T15,
17363     typename T16, typename T17, typename T18, typename T19, typename T20,
17364     typename T21, typename T22, typename T23, typename T24, typename T25,
17365     typename T26, typename T27>
17366 internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17367     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
17368     T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17369     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17370     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17371     T26 v26, T27 v27) {
17372   return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17373       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17374       T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
17375       v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);
17376 }
17377
17378 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17379     typename T6, typename T7, typename T8, typename T9, typename T10,
17380     typename T11, typename T12, typename T13, typename T14, typename T15,
17381     typename T16, typename T17, typename T18, typename T19, typename T20,
17382     typename T21, typename T22, typename T23, typename T24, typename T25,
17383     typename T26, typename T27, typename T28>
17384 internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17385     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
17386     T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17387     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17388     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17389     T26 v26, T27 v27, T28 v28) {
17390   return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17391       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17392       T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
17393       v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
17394       v28);
17395 }
17396
17397 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17398     typename T6, typename T7, typename T8, typename T9, typename T10,
17399     typename T11, typename T12, typename T13, typename T14, typename T15,
17400     typename T16, typename T17, typename T18, typename T19, typename T20,
17401     typename T21, typename T22, typename T23, typename T24, typename T25,
17402     typename T26, typename T27, typename T28, typename T29>
17403 internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17404     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17405     T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17406     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17407     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17408     T26 v26, T27 v27, T28 v28, T29 v29) {
17409   return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17410       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17411       T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
17412       v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
17413       v27, v28, v29);
17414 }
17415
17416 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17417     typename T6, typename T7, typename T8, typename T9, typename T10,
17418     typename T11, typename T12, typename T13, typename T14, typename T15,
17419     typename T16, typename T17, typename T18, typename T19, typename T20,
17420     typename T21, typename T22, typename T23, typename T24, typename T25,
17421     typename T26, typename T27, typename T28, typename T29, typename T30>
17422 internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17423     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17424     T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
17425     T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
17426     T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
17427     T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) {
17428   return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17429       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17430       T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
17431       v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
17432       v26, v27, v28, v29, v30);
17433 }
17434
17435 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17436     typename T6, typename T7, typename T8, typename T9, typename T10,
17437     typename T11, typename T12, typename T13, typename T14, typename T15,
17438     typename T16, typename T17, typename T18, typename T19, typename T20,
17439     typename T21, typename T22, typename T23, typename T24, typename T25,
17440     typename T26, typename T27, typename T28, typename T29, typename T30,
17441     typename T31>
17442 internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17443     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17444     T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
17445     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17446     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
17447     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) {
17448   return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17449       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17450       T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
17451       v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
17452       v25, v26, v27, v28, v29, v30, v31);
17453 }
17454
17455 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17456     typename T6, typename T7, typename T8, typename T9, typename T10,
17457     typename T11, typename T12, typename T13, typename T14, typename T15,
17458     typename T16, typename T17, typename T18, typename T19, typename T20,
17459     typename T21, typename T22, typename T23, typename T24, typename T25,
17460     typename T26, typename T27, typename T28, typename T29, typename T30,
17461     typename T31, typename T32>
17462 internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17463     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17464     T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
17465     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17466     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
17467     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
17468     T32 v32) {
17469   return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17470       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17471       T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
17472       v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
17473       v24, v25, v26, v27, v28, v29, v30, v31, v32);
17474 }
17475
17476 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17477     typename T6, typename T7, typename T8, typename T9, typename T10,
17478     typename T11, typename T12, typename T13, typename T14, typename T15,
17479     typename T16, typename T17, typename T18, typename T19, typename T20,
17480     typename T21, typename T22, typename T23, typename T24, typename T25,
17481     typename T26, typename T27, typename T28, typename T29, typename T30,
17482     typename T31, typename T32, typename T33>
17483 internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17484     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17485     T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
17486     T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17487     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
17488     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
17489     T32 v32, T33 v33) {
17490   return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17491       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17492       T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8,
17493       v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
17494       v24, v25, v26, v27, v28, v29, v30, v31, v32, v33);
17495 }
17496
17497 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17498     typename T6, typename T7, typename T8, typename T9, typename T10,
17499     typename T11, typename T12, typename T13, typename T14, typename T15,
17500     typename T16, typename T17, typename T18, typename T19, typename T20,
17501     typename T21, typename T22, typename T23, typename T24, typename T25,
17502     typename T26, typename T27, typename T28, typename T29, typename T30,
17503     typename T31, typename T32, typename T33, typename T34>
17504 internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17505     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17506     T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
17507     T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
17508     T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
17509     T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
17510     T31 v31, T32 v32, T33 v33, T34 v34) {
17511   return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17512       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17513       T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7,
17514       v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
17515       v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34);
17516 }
17517
17518 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17519     typename T6, typename T7, typename T8, typename T9, typename T10,
17520     typename T11, typename T12, typename T13, typename T14, typename T15,
17521     typename T16, typename T17, typename T18, typename T19, typename T20,
17522     typename T21, typename T22, typename T23, typename T24, typename T25,
17523     typename T26, typename T27, typename T28, typename T29, typename T30,
17524     typename T31, typename T32, typename T33, typename T34, typename T35>
17525 internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17526     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17527     T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4,
17528     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
17529     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
17530     T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
17531     T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) {
17532   return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17533       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17534       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6,
17535       v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
17536       v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35);
17537 }
17538
17539 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17540     typename T6, typename T7, typename T8, typename T9, typename T10,
17541     typename T11, typename T12, typename T13, typename T14, typename T15,
17542     typename T16, typename T17, typename T18, typename T19, typename T20,
17543     typename T21, typename T22, typename T23, typename T24, typename T25,
17544     typename T26, typename T27, typename T28, typename T29, typename T30,
17545     typename T31, typename T32, typename T33, typename T34, typename T35,
17546     typename T36>
17547 internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17548     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17549     T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4,
17550     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
17551     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
17552     T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
17553     T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) {
17554   return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17555       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17556       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4,
17557       v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
17558       v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
17559       v34, v35, v36);
17560 }
17561
17562 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17563     typename T6, typename T7, typename T8, typename T9, typename T10,
17564     typename T11, typename T12, typename T13, typename T14, typename T15,
17565     typename T16, typename T17, typename T18, typename T19, typename T20,
17566     typename T21, typename T22, typename T23, typename T24, typename T25,
17567     typename T26, typename T27, typename T28, typename T29, typename T30,
17568     typename T31, typename T32, typename T33, typename T34, typename T35,
17569     typename T36, typename T37>
17570 internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17571     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17572     T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3,
17573     T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
17574     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
17575     T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
17576     T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
17577     T37 v37) {
17578   return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17579       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17580       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3,
17581       v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
17582       v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
17583       v34, v35, v36, v37);
17584 }
17585
17586 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17587     typename T6, typename T7, typename T8, typename T9, typename T10,
17588     typename T11, typename T12, typename T13, typename T14, typename T15,
17589     typename T16, typename T17, typename T18, typename T19, typename T20,
17590     typename T21, typename T22, typename T23, typename T24, typename T25,
17591     typename T26, typename T27, typename T28, typename T29, typename T30,
17592     typename T31, typename T32, typename T33, typename T34, typename T35,
17593     typename T36, typename T37, typename T38>
17594 internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17595     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17596     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2,
17597     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
17598     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
17599     T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
17600     T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
17601     T37 v37, T38 v38) {
17602   return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17603       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17604       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2,
17605       v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
17606       v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32,
17607       v33, v34, v35, v36, v37, v38);
17608 }
17609
17610 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17611     typename T6, typename T7, typename T8, typename T9, typename T10,
17612     typename T11, typename T12, typename T13, typename T14, typename T15,
17613     typename T16, typename T17, typename T18, typename T19, typename T20,
17614     typename T21, typename T22, typename T23, typename T24, typename T25,
17615     typename T26, typename T27, typename T28, typename T29, typename T30,
17616     typename T31, typename T32, typename T33, typename T34, typename T35,
17617     typename T36, typename T37, typename T38, typename T39>
17618 internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17619     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17620     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2,
17621     T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
17622     T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
17623     T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
17624     T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
17625     T37 v37, T38 v38, T39 v39) {
17626   return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17627       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17628       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1,
17629       v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
17630       v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,
17631       v32, v33, v34, v35, v36, v37, v38, v39);
17632 }
17633
17634 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17635     typename T6, typename T7, typename T8, typename T9, typename T10,
17636     typename T11, typename T12, typename T13, typename T14, typename T15,
17637     typename T16, typename T17, typename T18, typename T19, typename T20,
17638     typename T21, typename T22, typename T23, typename T24, typename T25,
17639     typename T26, typename T27, typename T28, typename T29, typename T30,
17640     typename T31, typename T32, typename T33, typename T34, typename T35,
17641     typename T36, typename T37, typename T38, typename T39, typename T40>
17642 internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17643     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17644     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1,
17645     T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
17646     T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
17647     T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27,
17648     T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35,
17649     T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) {
17650   return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17651       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17652       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17653       T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
17654       v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29,
17655       v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40);
17656 }
17657
17658 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17659     typename T6, typename T7, typename T8, typename T9, typename T10,
17660     typename T11, typename T12, typename T13, typename T14, typename T15,
17661     typename T16, typename T17, typename T18, typename T19, typename T20,
17662     typename T21, typename T22, typename T23, typename T24, typename T25,
17663     typename T26, typename T27, typename T28, typename T29, typename T30,
17664     typename T31, typename T32, typename T33, typename T34, typename T35,
17665     typename T36, typename T37, typename T38, typename T39, typename T40,
17666     typename T41>
17667 internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17668     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17669     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
17670     T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17671     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17672     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17673     T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
17674     T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) {
17675   return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17676       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17677       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17678       T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
17679       v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28,
17680       v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41);
17681 }
17682
17683 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17684     typename T6, typename T7, typename T8, typename T9, typename T10,
17685     typename T11, typename T12, typename T13, typename T14, typename T15,
17686     typename T16, typename T17, typename T18, typename T19, typename T20,
17687     typename T21, typename T22, typename T23, typename T24, typename T25,
17688     typename T26, typename T27, typename T28, typename T29, typename T30,
17689     typename T31, typename T32, typename T33, typename T34, typename T35,
17690     typename T36, typename T37, typename T38, typename T39, typename T40,
17691     typename T41, typename T42>
17692 internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17693     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17694     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
17695     T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17696     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17697     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17698     T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
17699     T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
17700     T42 v42) {
17701   return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17702       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17703       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17704       T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
17705       v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
17706       v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41,
17707       v42);
17708 }
17709
17710 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17711     typename T6, typename T7, typename T8, typename T9, typename T10,
17712     typename T11, typename T12, typename T13, typename T14, typename T15,
17713     typename T16, typename T17, typename T18, typename T19, typename T20,
17714     typename T21, typename T22, typename T23, typename T24, typename T25,
17715     typename T26, typename T27, typename T28, typename T29, typename T30,
17716     typename T31, typename T32, typename T33, typename T34, typename T35,
17717     typename T36, typename T37, typename T38, typename T39, typename T40,
17718     typename T41, typename T42, typename T43>
17719 internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17720     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17721     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
17722     T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17723     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17724     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17725     T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
17726     T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
17727     T42 v42, T43 v43) {
17728   return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17729       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17730       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17731       T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
17732       v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
17733       v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40,
17734       v41, v42, v43);
17735 }
17736
17737 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17738     typename T6, typename T7, typename T8, typename T9, typename T10,
17739     typename T11, typename T12, typename T13, typename T14, typename T15,
17740     typename T16, typename T17, typename T18, typename T19, typename T20,
17741     typename T21, typename T22, typename T23, typename T24, typename T25,
17742     typename T26, typename T27, typename T28, typename T29, typename T30,
17743     typename T31, typename T32, typename T33, typename T34, typename T35,
17744     typename T36, typename T37, typename T38, typename T39, typename T40,
17745     typename T41, typename T42, typename T43, typename T44>
17746 internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17747     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17748     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17749     T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
17750     T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
17751     T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
17752     T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
17753     T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
17754     T42 v42, T43 v43, T44 v44) {
17755   return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17756       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17757       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17758       T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
17759       v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
17760       v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39,
17761       v40, v41, v42, v43, v44);
17762 }
17763
17764 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17765     typename T6, typename T7, typename T8, typename T9, typename T10,
17766     typename T11, typename T12, typename T13, typename T14, typename T15,
17767     typename T16, typename T17, typename T18, typename T19, typename T20,
17768     typename T21, typename T22, typename T23, typename T24, typename T25,
17769     typename T26, typename T27, typename T28, typename T29, typename T30,
17770     typename T31, typename T32, typename T33, typename T34, typename T35,
17771     typename T36, typename T37, typename T38, typename T39, typename T40,
17772     typename T41, typename T42, typename T43, typename T44, typename T45>
17773 internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17774     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17775     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17776     T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
17777     T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
17778     T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
17779     T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
17780     T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
17781     T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) {
17782   return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17783       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17784       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17785       T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
17786       v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
17787       v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38,
17788       v39, v40, v41, v42, v43, v44, v45);
17789 }
17790
17791 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17792     typename T6, typename T7, typename T8, typename T9, typename T10,
17793     typename T11, typename T12, typename T13, typename T14, typename T15,
17794     typename T16, typename T17, typename T18, typename T19, typename T20,
17795     typename T21, typename T22, typename T23, typename T24, typename T25,
17796     typename T26, typename T27, typename T28, typename T29, typename T30,
17797     typename T31, typename T32, typename T33, typename T34, typename T35,
17798     typename T36, typename T37, typename T38, typename T39, typename T40,
17799     typename T41, typename T42, typename T43, typename T44, typename T45,
17800     typename T46>
17801 internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17802     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17803     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17804     T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
17805     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17806     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
17807     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
17808     T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
17809     T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) {
17810   return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17811       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17812       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17813       T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
17814       v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
17815       v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
17816       v38, v39, v40, v41, v42, v43, v44, v45, v46);
17817 }
17818
17819 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17820     typename T6, typename T7, typename T8, typename T9, typename T10,
17821     typename T11, typename T12, typename T13, typename T14, typename T15,
17822     typename T16, typename T17, typename T18, typename T19, typename T20,
17823     typename T21, typename T22, typename T23, typename T24, typename T25,
17824     typename T26, typename T27, typename T28, typename T29, typename T30,
17825     typename T31, typename T32, typename T33, typename T34, typename T35,
17826     typename T36, typename T37, typename T38, typename T39, typename T40,
17827     typename T41, typename T42, typename T43, typename T44, typename T45,
17828     typename T46, typename T47>
17829 internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17830     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17831     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17832     T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
17833     T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17834     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
17835     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
17836     T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
17837     T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) {
17838   return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17839       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17840       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17841       T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8,
17842       v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
17843       v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
17844       v38, v39, v40, v41, v42, v43, v44, v45, v46, v47);
17845 }
17846
17847 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17848     typename T6, typename T7, typename T8, typename T9, typename T10,
17849     typename T11, typename T12, typename T13, typename T14, typename T15,
17850     typename T16, typename T17, typename T18, typename T19, typename T20,
17851     typename T21, typename T22, typename T23, typename T24, typename T25,
17852     typename T26, typename T27, typename T28, typename T29, typename T30,
17853     typename T31, typename T32, typename T33, typename T34, typename T35,
17854     typename T36, typename T37, typename T38, typename T39, typename T40,
17855     typename T41, typename T42, typename T43, typename T44, typename T45,
17856     typename T46, typename T47, typename T48>
17857 internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17858     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17859     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17860     T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
17861     T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
17862     T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
17863     T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
17864     T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
17865     T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47,
17866     T48 v48) {
17867   return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17868       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17869       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17870       T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7,
17871       v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
17872       v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36,
17873       v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48);
17874 }
17875
17876 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17877     typename T6, typename T7, typename T8, typename T9, typename T10,
17878     typename T11, typename T12, typename T13, typename T14, typename T15,
17879     typename T16, typename T17, typename T18, typename T19, typename T20,
17880     typename T21, typename T22, typename T23, typename T24, typename T25,
17881     typename T26, typename T27, typename T28, typename T29, typename T30,
17882     typename T31, typename T32, typename T33, typename T34, typename T35,
17883     typename T36, typename T37, typename T38, typename T39, typename T40,
17884     typename T41, typename T42, typename T43, typename T44, typename T45,
17885     typename T46, typename T47, typename T48, typename T49>
17886 internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17887     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17888     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17889     T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
17890     T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
17891     T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
17892     T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
17893     T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38,
17894     T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46,
17895     T47 v47, T48 v48, T49 v49) {
17896   return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17897       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17898       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17899       T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6,
17900       v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
17901       v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35,
17902       v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49);
17903 }
17904
17905 template <typename T1, typename T2, typename T3, typename T4, typename T5,
17906     typename T6, typename T7, typename T8, typename T9, typename T10,
17907     typename T11, typename T12, typename T13, typename T14, typename T15,
17908     typename T16, typename T17, typename T18, typename T19, typename T20,
17909     typename T21, typename T22, typename T23, typename T24, typename T25,
17910     typename T26, typename T27, typename T28, typename T29, typename T30,
17911     typename T31, typename T32, typename T33, typename T34, typename T35,
17912     typename T36, typename T37, typename T38, typename T39, typename T40,
17913     typename T41, typename T42, typename T43, typename T44, typename T45,
17914     typename T46, typename T47, typename T48, typename T49, typename T50>
17915 internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
17916     T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
17917     T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
17918     T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4,
17919     T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
17920     T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
17921     T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
17922     T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37,
17923     T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45,
17924     T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) {
17925   return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
17926       T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
17927       T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
17928       T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4,
17929       v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
17930       v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
17931       v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,
17932       v48, v49, v50);
17933 }
17934
17935 // Bool() allows generating tests with parameters in a set of (false, true).
17936 //
17937 // Synopsis:
17938 // Bool()
17939 //   - returns a generator producing sequences with elements {false, true}.
17940 //
17941 // It is useful when testing code that depends on Boolean flags. Combinations
17942 // of multiple flags can be tested when several Bool()'s are combined using
17943 // Combine() function.
17944 //
17945 // In the following example all tests in the test case FlagDependentTest
17946 // will be instantiated twice with parameters false and true.
17947 //
17948 // class FlagDependentTest : public testing::TestWithParam<bool> {
17949 //   virtual void SetUp() {
17950 //     external_flag = GetParam();
17951 //   }
17952 // }
17953 // INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
17954 //
17955 inline internal::ParamGenerator<bool> Bool() {
17956   return Values(false, true);
17957 }
17958
17959 # if GTEST_HAS_COMBINE
17960 // Combine() allows the user to combine two or more sequences to produce
17961 // values of a Cartesian product of those sequences' elements.
17962 //
17963 // Synopsis:
17964 // Combine(gen1, gen2, ..., genN)
17965 //   - returns a generator producing sequences with elements coming from
17966 //     the Cartesian product of elements from the sequences generated by
17967 //     gen1, gen2, ..., genN. The sequence elements will have a type of
17968 //     tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
17969 //     of elements from sequences produces by gen1, gen2, ..., genN.
17970 //
17971 // Combine can have up to 10 arguments. This number is currently limited
17972 // by the maximum number of elements in the tuple implementation used by Google
17973 // Test.
17974 //
17975 // Example:
17976 //
17977 // This will instantiate tests in test case AnimalTest each one with
17978 // the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
17979 // tuple("dog", BLACK), and tuple("dog", WHITE):
17980 //
17981 // enum Color { BLACK, GRAY, WHITE };
17982 // class AnimalTest
17983 //     : public testing::TestWithParam<tuple<const char*, Color> > {...};
17984 //
17985 // TEST_P(AnimalTest, AnimalLooksNice) {...}
17986 //
17987 // INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
17988 //                         Combine(Values("cat", "dog"),
17989 //                                 Values(BLACK, WHITE)));
17990 //
17991 // This will instantiate tests in FlagDependentTest with all variations of two
17992 // Boolean flags:
17993 //
17994 // class FlagDependentTest
17995 //     : public testing::TestWithParam<tuple<bool, bool> > {
17996 //   virtual void SetUp() {
17997 //     // Assigns external_flag_1 and external_flag_2 values from the tuple.
17998 //     tie(external_flag_1, external_flag_2) = GetParam();
17999 //   }
18000 // };
18001 //
18002 // TEST_P(FlagDependentTest, TestFeature1) {
18003 //   // Test your code using external_flag_1 and external_flag_2 here.
18004 // }
18005 // INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
18006 //                         Combine(Bool(), Bool()));
18007 //
18008 template <typename Generator1, typename Generator2>
18009 internal::CartesianProductHolder2<Generator1, Generator2> Combine(
18010     const Generator1& g1, const Generator2& g2) {
18011   return internal::CartesianProductHolder2<Generator1, Generator2>(
18012       g1, g2);
18013 }
18014
18015 template <typename Generator1, typename Generator2, typename Generator3>
18016 internal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine(
18017     const Generator1& g1, const Generator2& g2, const Generator3& g3) {
18018   return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
18019       g1, g2, g3);
18020 }
18021
18022 template <typename Generator1, typename Generator2, typename Generator3,
18023     typename Generator4>
18024 internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
18025     Generator4> Combine(
18026     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18027         const Generator4& g4) {
18028   return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
18029       Generator4>(
18030       g1, g2, g3, g4);
18031 }
18032
18033 template <typename Generator1, typename Generator2, typename Generator3,
18034     typename Generator4, typename Generator5>
18035 internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
18036     Generator4, Generator5> Combine(
18037     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18038         const Generator4& g4, const Generator5& g5) {
18039   return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
18040       Generator4, Generator5>(
18041       g1, g2, g3, g4, g5);
18042 }
18043
18044 template <typename Generator1, typename Generator2, typename Generator3,
18045     typename Generator4, typename Generator5, typename Generator6>
18046 internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
18047     Generator4, Generator5, Generator6> Combine(
18048     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18049         const Generator4& g4, const Generator5& g5, const Generator6& g6) {
18050   return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
18051       Generator4, Generator5, Generator6>(
18052       g1, g2, g3, g4, g5, g6);
18053 }
18054
18055 template <typename Generator1, typename Generator2, typename Generator3,
18056     typename Generator4, typename Generator5, typename Generator6,
18057     typename Generator7>
18058 internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
18059     Generator4, Generator5, Generator6, Generator7> Combine(
18060     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18061         const Generator4& g4, const Generator5& g5, const Generator6& g6,
18062         const Generator7& g7) {
18063   return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
18064       Generator4, Generator5, Generator6, Generator7>(
18065       g1, g2, g3, g4, g5, g6, g7);
18066 }
18067
18068 template <typename Generator1, typename Generator2, typename Generator3,
18069     typename Generator4, typename Generator5, typename Generator6,
18070     typename Generator7, typename Generator8>
18071 internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
18072     Generator4, Generator5, Generator6, Generator7, Generator8> Combine(
18073     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18074         const Generator4& g4, const Generator5& g5, const Generator6& g6,
18075         const Generator7& g7, const Generator8& g8) {
18076   return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
18077       Generator4, Generator5, Generator6, Generator7, Generator8>(
18078       g1, g2, g3, g4, g5, g6, g7, g8);
18079 }
18080
18081 template <typename Generator1, typename Generator2, typename Generator3,
18082     typename Generator4, typename Generator5, typename Generator6,
18083     typename Generator7, typename Generator8, typename Generator9>
18084 internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
18085     Generator4, Generator5, Generator6, Generator7, Generator8,
18086     Generator9> Combine(
18087     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18088         const Generator4& g4, const Generator5& g5, const Generator6& g6,
18089         const Generator7& g7, const Generator8& g8, const Generator9& g9) {
18090   return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
18091       Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(
18092       g1, g2, g3, g4, g5, g6, g7, g8, g9);
18093 }
18094
18095 template <typename Generator1, typename Generator2, typename Generator3,
18096     typename Generator4, typename Generator5, typename Generator6,
18097     typename Generator7, typename Generator8, typename Generator9,
18098     typename Generator10>
18099 internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
18100     Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
18101     Generator10> Combine(
18102     const Generator1& g1, const Generator2& g2, const Generator3& g3,
18103         const Generator4& g4, const Generator5& g5, const Generator6& g6,
18104         const Generator7& g7, const Generator8& g8, const Generator9& g9,
18105         const Generator10& g10) {
18106   return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
18107       Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
18108       Generator10>(
18109       g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
18110 }
18111 # endif  // GTEST_HAS_COMBINE
18112
18113
18114
18115 # define TEST_P(test_case_name, test_name) \
18116   class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
18117       : public test_case_name { \
18118    public: \
18119     GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
18120     virtual void TestBody(); \
18121    private: \
18122     static int AddToRegistry() { \
18123       ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
18124           GetTestCasePatternHolder<test_case_name>(\
18125               #test_case_name, \
18126               ::testing::internal::CodeLocation(\
18127                   __FILE__, __LINE__))->AddTestPattern(\
18128                       #test_case_name, \
18129                       #test_name, \
18130                       new ::testing::internal::TestMetaFactory< \
18131                           GTEST_TEST_CLASS_NAME_(\
18132                               test_case_name, test_name)>()); \
18133       return 0; \
18134     } \
18135     static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
18136     GTEST_DISALLOW_COPY_AND_ASSIGN_(\
18137         GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
18138   }; \
18139   int GTEST_TEST_CLASS_NAME_(test_case_name, \
18140                              test_name)::gtest_registering_dummy_ = \
18141       GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
18142   void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
18143
18144 // The optional last argument to INSTANTIATE_TEST_CASE_P allows the user
18145 // to specify a function or functor that generates custom test name suffixes
18146 // based on the test parameters. The function should accept one argument of
18147 // type testing::TestParamInfo<class ParamType>, and return std::string.
18148 //
18149 // testing::PrintToStringParamName is a builtin test suffix generator that
18150 // returns the value of testing::PrintToString(GetParam()). It does not work
18151 // for std::string or C strings.
18152 //
18153 // Note: test names must be non-empty, unique, and may only contain ASCII
18154 // alphanumeric characters or underscore.
18155
18156 # define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
18157   ::testing::internal::ParamGenerator<test_case_name::ParamType> \
18158       gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
18159   ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
18160       const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
18161     return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
18162         (__VA_ARGS__)(info); \
18163   } \
18164   int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
18165       ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
18166           GetTestCasePatternHolder<test_case_name>(\
18167               #test_case_name, \
18168               ::testing::internal::CodeLocation(\
18169                   __FILE__, __LINE__))->AddTestCaseInstantiation(\
18170                       #prefix, \
18171                       &gtest_##prefix##test_case_name##_EvalGenerator_, \
18172                       &gtest_##prefix##test_case_name##_EvalGenerateName_, \
18173                       __FILE__, __LINE__)
18174
18175 }  // namespace testing
18176
18177 #endif  // GTEST_HAS_PARAM_TEST
18178
18179 #endif  // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
18180 // Copyright 2006, Google Inc.
18181 // All rights reserved.
18182 //
18183 // Redistribution and use in source and binary forms, with or without
18184 // modification, are permitted provided that the following conditions are
18185 // met:
18186 //
18187 //     * Redistributions of source code must retain the above copyright
18188 // notice, this list of conditions and the following disclaimer.
18189 //     * Redistributions in binary form must reproduce the above
18190 // copyright notice, this list of conditions and the following disclaimer
18191 // in the documentation and/or other materials provided with the
18192 // distribution.
18193 //     * Neither the name of Google Inc. nor the names of its
18194 // contributors may be used to endorse or promote products derived from
18195 // this software without specific prior written permission.
18196 //
18197 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18198 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18199 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18200 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18201 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18202 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18203 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18204 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
18205 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18206 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
18207 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18208 //
18209 // Author: wan@google.com (Zhanyong Wan)
18210 //
18211 // Google C++ Testing Framework definitions useful in production code.
18212
18213 #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
18214 #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
18215
18216 // When you need to test the private or protected members of a class,
18217 // use the FRIEND_TEST macro to declare your tests as friends of the
18218 // class.  For example:
18219 //
18220 // class MyClass {
18221 //  private:
18222 //   void MyMethod();
18223 //   FRIEND_TEST(MyClassTest, MyMethod);
18224 // };
18225 //
18226 // class MyClassTest : public testing::Test {
18227 //   // ...
18228 // };
18229 //
18230 // TEST_F(MyClassTest, MyMethod) {
18231 //   // Can call MyClass::MyMethod() here.
18232 // }
18233
18234 #define FRIEND_TEST(test_case_name, test_name)\
18235 friend class test_case_name##_##test_name##_Test
18236
18237 #endif  // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
18238 // Copyright 2008, Google Inc.
18239 // All rights reserved.
18240 //
18241 // Redistribution and use in source and binary forms, with or without
18242 // modification, are permitted provided that the following conditions are
18243 // met:
18244 //
18245 //     * Redistributions of source code must retain the above copyright
18246 // notice, this list of conditions and the following disclaimer.
18247 //     * Redistributions in binary form must reproduce the above
18248 // copyright notice, this list of conditions and the following disclaimer
18249 // in the documentation and/or other materials provided with the
18250 // distribution.
18251 //     * Neither the name of Google Inc. nor the names of its
18252 // contributors may be used to endorse or promote products derived from
18253 // this software without specific prior written permission.
18254 //
18255 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18256 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18257 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18258 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18259 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18260 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18261 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18262 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
18263 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18264 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
18265 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18266 //
18267 // Author: mheule@google.com (Markus Heule)
18268 //
18269
18270 #ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
18271 #define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
18272
18273 #include <iosfwd>
18274 #include <vector>
18275
18276 namespace testing {
18277
18278 // A copyable object representing the result of a test part (i.e. an
18279 // assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
18280 //
18281 // Don't inherit from TestPartResult as its destructor is not virtual.
18282 class GTEST_API_ TestPartResult {
18283  public:
18284   // The possible outcomes of a test part (i.e. an assertion or an
18285   // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
18286   enum Type {
18287     kSuccess,          // Succeeded.
18288     kNonFatalFailure,  // Failed but the test can continue.
18289     kFatalFailure      // Failed and the test should be terminated.
18290   };
18291
18292   // C'tor.  TestPartResult does NOT have a default constructor.
18293   // Always use this constructor (with parameters) to create a
18294   // TestPartResult object.
18295   TestPartResult(Type a_type,
18296                  const char* a_file_name,
18297                  int a_line_number,
18298                  const char* a_message)
18299       : type_(a_type),
18300         file_name_(a_file_name == NULL ? "" : a_file_name),
18301         line_number_(a_line_number),
18302         summary_(ExtractSummary(a_message)),
18303         message_(a_message) {
18304   }
18305
18306   // Gets the outcome of the test part.
18307   Type type() const { return type_; }
18308
18309   // Gets the name of the source file where the test part took place, or
18310   // NULL if it's unknown.
18311   const char* file_name() const {
18312     return file_name_.empty() ? NULL : file_name_.c_str();
18313   }
18314
18315   // Gets the line in the source file where the test part took place,
18316   // or -1 if it's unknown.
18317   int line_number() const { return line_number_; }
18318
18319   // Gets the summary of the failure message.
18320   const char* summary() const { return summary_.c_str(); }
18321
18322   // Gets the message associated with the test part.
18323   const char* message() const { return message_.c_str(); }
18324
18325   // Returns true iff the test part passed.
18326   bool passed() const { return type_ == kSuccess; }
18327
18328   // Returns true iff the test part failed.
18329   bool failed() const { return type_ != kSuccess; }
18330
18331   // Returns true iff the test part non-fatally failed.
18332   bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
18333
18334   // Returns true iff the test part fatally failed.
18335   bool fatally_failed() const { return type_ == kFatalFailure; }
18336
18337  private:
18338   Type type_;
18339
18340   // Gets the summary of the failure message by omitting the stack
18341   // trace in it.
18342   static std::string ExtractSummary(const char* message);
18343
18344   // The name of the source file where the test part took place, or
18345   // "" if the source file is unknown.
18346   std::string file_name_;
18347   // The line in the source file where the test part took place, or -1
18348   // if the line number is unknown.
18349   int line_number_;
18350   std::string summary_;  // The test failure summary.
18351   std::string message_;  // The test failure message.
18352 };
18353
18354 // Prints a TestPartResult object.
18355 std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
18356
18357 // An array of TestPartResult objects.
18358 //
18359 // Don't inherit from TestPartResultArray as its destructor is not
18360 // virtual.
18361 class GTEST_API_ TestPartResultArray {
18362  public:
18363   TestPartResultArray() {}
18364
18365   // Appends the given TestPartResult to the array.
18366   void Append(const TestPartResult& result);
18367
18368   // Returns the TestPartResult at the given index (0-based).
18369   const TestPartResult& GetTestPartResult(int index) const;
18370
18371   // Returns the number of TestPartResult objects in the array.
18372   int size() const;
18373
18374  private:
18375   std::vector<TestPartResult> array_;
18376
18377   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
18378 };
18379
18380 // This interface knows how to report a test part result.
18381 class TestPartResultReporterInterface {
18382  public:
18383   virtual ~TestPartResultReporterInterface() {}
18384
18385   virtual void ReportTestPartResult(const TestPartResult& result) = 0;
18386 };
18387
18388 namespace internal {
18389
18390 // This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
18391 // statement generates new fatal failures. To do so it registers itself as the
18392 // current test part result reporter. Besides checking if fatal failures were
18393 // reported, it only delegates the reporting to the former result reporter.
18394 // The original result reporter is restored in the destructor.
18395 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
18396 class GTEST_API_ HasNewFatalFailureHelper
18397     : public TestPartResultReporterInterface {
18398  public:
18399   HasNewFatalFailureHelper();
18400   virtual ~HasNewFatalFailureHelper();
18401   virtual void ReportTestPartResult(const TestPartResult& result);
18402   bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
18403  private:
18404   bool has_new_fatal_failure_;
18405   TestPartResultReporterInterface* original_reporter_;
18406
18407   GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
18408 };
18409
18410 }  // namespace internal
18411
18412 }  // namespace testing
18413
18414 #endif  // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
18415 // Copyright 2008 Google Inc.
18416 // All Rights Reserved.
18417 //
18418 // Redistribution and use in source and binary forms, with or without
18419 // modification, are permitted provided that the following conditions are
18420 // met:
18421 //
18422 //     * Redistributions of source code must retain the above copyright
18423 // notice, this list of conditions and the following disclaimer.
18424 //     * Redistributions in binary form must reproduce the above
18425 // copyright notice, this list of conditions and the following disclaimer
18426 // in the documentation and/or other materials provided with the
18427 // distribution.
18428 //     * Neither the name of Google Inc. nor the names of its
18429 // contributors may be used to endorse or promote products derived from
18430 // this software without specific prior written permission.
18431 //
18432 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18433 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18434 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18435 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18436 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18437 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18438 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18439 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
18440 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18441 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
18442 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18443 //
18444 // Author: wan@google.com (Zhanyong Wan)
18445
18446 #ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
18447 #define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
18448
18449 // This header implements typed tests and type-parameterized tests.
18450
18451 // Typed (aka type-driven) tests repeat the same test for types in a
18452 // list.  You must know which types you want to test with when writing
18453 // typed tests. Here's how you do it:
18454
18455 #if 0
18456
18457 // First, define a fixture class template.  It should be parameterized
18458 // by a type.  Remember to derive it from testing::Test.
18459 template <typename T>
18460 class FooTest : public testing::Test {
18461  public:
18462   ...
18463   typedef std::list<T> List;
18464   static T shared_;
18465   T value_;
18466 };
18467
18468 // Next, associate a list of types with the test case, which will be
18469 // repeated for each type in the list.  The typedef is necessary for
18470 // the macro to parse correctly.
18471 typedef testing::Types<char, int, unsigned int> MyTypes;
18472 TYPED_TEST_CASE(FooTest, MyTypes);
18473
18474 // If the type list contains only one type, you can write that type
18475 // directly without Types<...>:
18476 //   TYPED_TEST_CASE(FooTest, int);
18477
18478 // Then, use TYPED_TEST() instead of TEST_F() to define as many typed
18479 // tests for this test case as you want.
18480 TYPED_TEST(FooTest, DoesBlah) {
18481   // Inside a test, refer to TypeParam to get the type parameter.
18482   // Since we are inside a derived class template, C++ requires use to
18483   // visit the members of FooTest via 'this'.
18484   TypeParam n = this->value_;
18485
18486   // To visit static members of the fixture, add the TestFixture::
18487   // prefix.
18488   n += TestFixture::shared_;
18489
18490   // To refer to typedefs in the fixture, add the "typename
18491   // TestFixture::" prefix.
18492   typename TestFixture::List values;
18493   values.push_back(n);
18494   ...
18495 }
18496
18497 TYPED_TEST(FooTest, HasPropertyA) { ... }
18498
18499 #endif  // 0
18500
18501 // Type-parameterized tests are abstract test patterns parameterized
18502 // by a type.  Compared with typed tests, type-parameterized tests
18503 // allow you to define the test pattern without knowing what the type
18504 // parameters are.  The defined pattern can be instantiated with
18505 // different types any number of times, in any number of translation
18506 // units.
18507 //
18508 // If you are designing an interface or concept, you can define a
18509 // suite of type-parameterized tests to verify properties that any
18510 // valid implementation of the interface/concept should have.  Then,
18511 // each implementation can easily instantiate the test suite to verify
18512 // that it conforms to the requirements, without having to write
18513 // similar tests repeatedly.  Here's an example:
18514
18515 #if 0
18516
18517 // First, define a fixture class template.  It should be parameterized
18518 // by a type.  Remember to derive it from testing::Test.
18519 template <typename T>
18520 class FooTest : public testing::Test {
18521   ...
18522 };
18523
18524 // Next, declare that you will define a type-parameterized test case
18525 // (the _P suffix is for "parameterized" or "pattern", whichever you
18526 // prefer):
18527 TYPED_TEST_CASE_P(FooTest);
18528
18529 // Then, use TYPED_TEST_P() to define as many type-parameterized tests
18530 // for this type-parameterized test case as you want.
18531 TYPED_TEST_P(FooTest, DoesBlah) {
18532   // Inside a test, refer to TypeParam to get the type parameter.
18533   TypeParam n = 0;
18534   ...
18535 }
18536
18537 TYPED_TEST_P(FooTest, HasPropertyA) { ... }
18538
18539 // Now the tricky part: you need to register all test patterns before
18540 // you can instantiate them.  The first argument of the macro is the
18541 // test case name; the rest are the names of the tests in this test
18542 // case.
18543 REGISTER_TYPED_TEST_CASE_P(FooTest,
18544                            DoesBlah, HasPropertyA);
18545
18546 // Finally, you are free to instantiate the pattern with the types you
18547 // want.  If you put the above code in a header file, you can #include
18548 // it in multiple C++ source files and instantiate it multiple times.
18549 //
18550 // To distinguish different instances of the pattern, the first
18551 // argument to the INSTANTIATE_* macro is a prefix that will be added
18552 // to the actual test case name.  Remember to pick unique prefixes for
18553 // different instances.
18554 typedef testing::Types<char, int, unsigned int> MyTypes;
18555 INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
18556
18557 // If the type list contains only one type, you can write that type
18558 // directly without Types<...>:
18559 //   INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
18560
18561 #endif  // 0
18562
18563
18564 // Implements typed tests.
18565
18566 #if GTEST_HAS_TYPED_TEST
18567
18568 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
18569 //
18570 // Expands to the name of the typedef for the type parameters of the
18571 // given test case.
18572 # define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
18573
18574 // The 'Types' template argument below must have spaces around it
18575 // since some compilers may choke on '>>' when passing a template
18576 // instance (e.g. Types<int>)
18577 # define TYPED_TEST_CASE(CaseName, Types) \
18578   typedef ::testing::internal::TypeList< Types >::type \
18579       GTEST_TYPE_PARAMS_(CaseName)
18580
18581 # define TYPED_TEST(CaseName, TestName) \
18582   template <typename gtest_TypeParam_> \
18583   class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
18584       : public CaseName<gtest_TypeParam_> { \
18585    private: \
18586     typedef CaseName<gtest_TypeParam_> TestFixture; \
18587     typedef gtest_TypeParam_ TypeParam; \
18588     virtual void TestBody(); \
18589   }; \
18590   bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \
18591       ::testing::internal::TypeParameterizedTest< \
18592           CaseName, \
18593           ::testing::internal::TemplateSel< \
18594               GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \
18595           GTEST_TYPE_PARAMS_(CaseName)>::Register(\
18596               "", ::testing::internal::CodeLocation(__FILE__, __LINE__), \
18597               #CaseName, #TestName, 0); \
18598   template <typename gtest_TypeParam_> \
18599   void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()
18600
18601 #endif  // GTEST_HAS_TYPED_TEST
18602
18603 // Implements type-parameterized tests.
18604
18605 #if GTEST_HAS_TYPED_TEST_P
18606
18607 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
18608 //
18609 // Expands to the namespace name that the type-parameterized tests for
18610 // the given type-parameterized test case are defined in.  The exact
18611 // name of the namespace is subject to change without notice.
18612 # define GTEST_CASE_NAMESPACE_(TestCaseName) \
18613   gtest_case_##TestCaseName##_
18614
18615 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
18616 //
18617 // Expands to the name of the variable used to remember the names of
18618 // the defined tests in the given test case.
18619 # define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
18620   gtest_typed_test_case_p_state_##TestCaseName##_
18621
18622 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
18623 //
18624 // Expands to the name of the variable used to remember the names of
18625 // the registered tests in the given test case.
18626 # define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
18627   gtest_registered_test_names_##TestCaseName##_
18628
18629 // The variables defined in the type-parameterized test macros are
18630 // static as typically these macros are used in a .h file that can be
18631 // #included in multiple translation units linked together.
18632 # define TYPED_TEST_CASE_P(CaseName) \
18633   static ::testing::internal::TypedTestCasePState \
18634       GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
18635
18636 # define TYPED_TEST_P(CaseName, TestName) \
18637   namespace GTEST_CASE_NAMESPACE_(CaseName) { \
18638   template <typename gtest_TypeParam_> \
18639   class TestName : public CaseName<gtest_TypeParam_> { \
18640    private: \
18641     typedef CaseName<gtest_TypeParam_> TestFixture; \
18642     typedef gtest_TypeParam_ TypeParam; \
18643     virtual void TestBody(); \
18644   }; \
18645   static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
18646       GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\
18647           __FILE__, __LINE__, #CaseName, #TestName); \
18648   } \
18649   template <typename gtest_TypeParam_> \
18650   void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
18651
18652 # define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
18653   namespace GTEST_CASE_NAMESPACE_(CaseName) { \
18654   typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
18655   } \
18656   static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \
18657       GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
18658           __FILE__, __LINE__, #__VA_ARGS__)
18659
18660 // The 'Types' template argument below must have spaces around it
18661 // since some compilers may choke on '>>' when passing a template
18662 // instance (e.g. Types<int>)
18663 # define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
18664   bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
18665       ::testing::internal::TypeParameterizedTestCase<CaseName, \
18666           GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
18667           ::testing::internal::TypeList< Types >::type>::Register(\
18668               #Prefix, \
18669               ::testing::internal::CodeLocation(__FILE__, __LINE__), \
18670               &GTEST_TYPED_TEST_CASE_P_STATE_(CaseName), \
18671               #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))
18672
18673 #endif  // GTEST_HAS_TYPED_TEST_P
18674
18675 #endif  // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
18676
18677 // Depending on the platform, different string classes are available.
18678 // On Linux, in addition to ::std::string, Google also makes use of
18679 // class ::string, which has the same interface as ::std::string, but
18680 // has a different implementation.
18681 //
18682 // You can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
18683 // ::string is available AND is a distinct type to ::std::string, or
18684 // define it to 0 to indicate otherwise.
18685 //
18686 // If ::std::string and ::string are the same class on your platform
18687 // due to aliasing, you should define GTEST_HAS_GLOBAL_STRING to 0.
18688 //
18689 // If you do not define GTEST_HAS_GLOBAL_STRING, it is defined
18690 // heuristically.
18691
18692 namespace testing {
18693
18694 // Declares the flags.
18695
18696 // This flag temporary enables the disabled tests.
18697 GTEST_DECLARE_bool_(also_run_disabled_tests);
18698
18699 // This flag brings the debugger on an assertion failure.
18700 GTEST_DECLARE_bool_(break_on_failure);
18701
18702 // This flag controls whether Google Test catches all test-thrown exceptions
18703 // and logs them as failures.
18704 GTEST_DECLARE_bool_(catch_exceptions);
18705
18706 // This flag enables using colors in terminal output. Available values are
18707 // "yes" to enable colors, "no" (disable colors), or "auto" (the default)
18708 // to let Google Test decide.
18709 GTEST_DECLARE_string_(color);
18710
18711 // This flag sets up the filter to select by name using a glob pattern
18712 // the tests to run. If the filter is not given all tests are executed.
18713 GTEST_DECLARE_string_(filter);
18714
18715 // This flag causes the Google Test to list tests. None of the tests listed
18716 // are actually run if the flag is provided.
18717 GTEST_DECLARE_bool_(list_tests);
18718
18719 // This flag controls whether Google Test emits a detailed XML report to a file
18720 // in addition to its normal textual output.
18721 GTEST_DECLARE_string_(output);
18722
18723 // This flags control whether Google Test prints the elapsed time for each
18724 // test.
18725 GTEST_DECLARE_bool_(print_time);
18726
18727 // This flag specifies the random number seed.
18728 GTEST_DECLARE_int32_(random_seed);
18729
18730 // This flag sets how many times the tests are repeated. The default value
18731 // is 1. If the value is -1 the tests are repeating forever.
18732 GTEST_DECLARE_int32_(repeat);
18733
18734 // This flag controls whether Google Test includes Google Test internal
18735 // stack frames in failure stack traces.
18736 GTEST_DECLARE_bool_(show_internal_stack_frames);
18737
18738 // When this flag is specified, tests' order is randomized on every iteration.
18739 GTEST_DECLARE_bool_(shuffle);
18740
18741 // This flag specifies the maximum number of stack frames to be
18742 // printed in a failure message.
18743 GTEST_DECLARE_int32_(stack_trace_depth);
18744
18745 // When this flag is specified, a failed assertion will throw an
18746 // exception if exceptions are enabled, or exit the program with a
18747 // non-zero code otherwise.
18748 GTEST_DECLARE_bool_(throw_on_failure);
18749
18750 // When this flag is set with a "host:port" string, on supported
18751 // platforms test results are streamed to the specified port on
18752 // the specified host machine.
18753 GTEST_DECLARE_string_(stream_result_to);
18754
18755 // The upper limit for valid stack trace depths.
18756 const int kMaxStackTraceDepth = 100;
18757
18758 namespace internal {
18759
18760 class AssertHelper;
18761 class DefaultGlobalTestPartResultReporter;
18762 class ExecDeathTest;
18763 class NoExecDeathTest;
18764 class FinalSuccessChecker;
18765 class GTestFlagSaver;
18766 class StreamingListenerTest;
18767 class TestResultAccessor;
18768 class TestEventListenersAccessor;
18769 class TestEventRepeater;
18770 class UnitTestRecordPropertyTestHelper;
18771 class WindowsDeathTest;
18772 class UnitTestImpl* GetUnitTestImpl();
18773 void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
18774                                     const std::string& message);
18775
18776 }  // namespace internal
18777
18778 // The friend relationship of some of these classes is cyclic.
18779 // If we don't forward declare them the compiler might confuse the classes
18780 // in friendship clauses with same named classes on the scope.
18781 class Test;
18782 class TestCase;
18783 class TestInfo;
18784 class UnitTest;
18785
18786 // A class for indicating whether an assertion was successful.  When
18787 // the assertion wasn't successful, the AssertionResult object
18788 // remembers a non-empty message that describes how it failed.
18789 //
18790 // To create an instance of this class, use one of the factory functions
18791 // (AssertionSuccess() and AssertionFailure()).
18792 //
18793 // This class is useful for two purposes:
18794 //   1. Defining predicate functions to be used with Boolean test assertions
18795 //      EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
18796 //   2. Defining predicate-format functions to be
18797 //      used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
18798 //
18799 // For example, if you define IsEven predicate:
18800 //
18801 //   testing::AssertionResult IsEven(int n) {
18802 //     if ((n % 2) == 0)
18803 //       return testing::AssertionSuccess();
18804 //     else
18805 //       return testing::AssertionFailure() << n << " is odd";
18806 //   }
18807 //
18808 // Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
18809 // will print the message
18810 //
18811 //   Value of: IsEven(Fib(5))
18812 //     Actual: false (5 is odd)
18813 //   Expected: true
18814 //
18815 // instead of a more opaque
18816 //
18817 //   Value of: IsEven(Fib(5))
18818 //     Actual: false
18819 //   Expected: true
18820 //
18821 // in case IsEven is a simple Boolean predicate.
18822 //
18823 // If you expect your predicate to be reused and want to support informative
18824 // messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
18825 // about half as often as positive ones in our tests), supply messages for
18826 // both success and failure cases:
18827 //
18828 //   testing::AssertionResult IsEven(int n) {
18829 //     if ((n % 2) == 0)
18830 //       return testing::AssertionSuccess() << n << " is even";
18831 //     else
18832 //       return testing::AssertionFailure() << n << " is odd";
18833 //   }
18834 //
18835 // Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
18836 //
18837 //   Value of: IsEven(Fib(6))
18838 //     Actual: true (8 is even)
18839 //   Expected: false
18840 //
18841 // NB: Predicates that support negative Boolean assertions have reduced
18842 // performance in positive ones so be careful not to use them in tests
18843 // that have lots (tens of thousands) of positive Boolean assertions.
18844 //
18845 // To use this class with EXPECT_PRED_FORMAT assertions such as:
18846 //
18847 //   // Verifies that Foo() returns an even number.
18848 //   EXPECT_PRED_FORMAT1(IsEven, Foo());
18849 //
18850 // you need to define:
18851 //
18852 //   testing::AssertionResult IsEven(const char* expr, int n) {
18853 //     if ((n % 2) == 0)
18854 //       return testing::AssertionSuccess();
18855 //     else
18856 //       return testing::AssertionFailure()
18857 //         << "Expected: " << expr << " is even\n  Actual: it's " << n;
18858 //   }
18859 //
18860 // If Foo() returns 5, you will see the following message:
18861 //
18862 //   Expected: Foo() is even
18863 //     Actual: it's 5
18864 //
18865 class GTEST_API_ AssertionResult {
18866  public:
18867   // Copy constructor.
18868   // Used in EXPECT_TRUE/FALSE(assertion_result).
18869   AssertionResult(const AssertionResult& other);
18870
18871   GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
18872
18873   // Used in the EXPECT_TRUE/FALSE(bool_expression).
18874   //
18875   // T must be contextually convertible to bool.
18876   //
18877   // The second parameter prevents this overload from being considered if
18878   // the argument is implicitly convertible to AssertionResult. In that case
18879   // we want AssertionResult's copy constructor to be used.
18880   template <typename T>
18881   explicit AssertionResult(
18882       const T& success,
18883       typename internal::EnableIf<
18884           !internal::ImplicitlyConvertible<T, AssertionResult>::value>::type*
18885           /*enabler*/ = NULL)
18886       : success_(success) {}
18887
18888   GTEST_DISABLE_MSC_WARNINGS_POP_()
18889
18890   // Assignment operator.
18891   AssertionResult& operator=(AssertionResult other) {
18892     swap(other);
18893     return *this;
18894   }
18895
18896   // Returns true iff the assertion succeeded.
18897   operator bool() const { return success_; }  // NOLINT
18898
18899   // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
18900   AssertionResult operator!() const;
18901
18902   // Returns the text streamed into this AssertionResult. Test assertions
18903   // use it when they fail (i.e., the predicate's outcome doesn't match the
18904   // assertion's expectation). When nothing has been streamed into the
18905   // object, returns an empty string.
18906   const char* message() const {
18907     return message_.get() != NULL ?  message_->c_str() : "";
18908   }
18909   // TODO(vladl@google.com): Remove this after making sure no clients use it.
18910   // Deprecated; please use message() instead.
18911   const char* failure_message() const { return message(); }
18912
18913   // Streams a custom failure message into this object.
18914   template <typename T> AssertionResult& operator<<(const T& value) {
18915     AppendMessage(Message() << value);
18916     return *this;
18917   }
18918
18919   // Allows streaming basic output manipulators such as endl or flush into
18920   // this object.
18921   AssertionResult& operator<<(
18922       ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
18923     AppendMessage(Message() << basic_manipulator);
18924     return *this;
18925   }
18926
18927  private:
18928   // Appends the contents of message to message_.
18929   void AppendMessage(const Message& a_message) {
18930     if (message_.get() == NULL)
18931       message_.reset(new ::std::string);
18932     message_->append(a_message.GetString().c_str());
18933   }
18934
18935   // Swap the contents of this AssertionResult with other.
18936   void swap(AssertionResult& other);
18937
18938   // Stores result of the assertion predicate.
18939   bool success_;
18940   // Stores the message describing the condition in case the expectation
18941   // construct is not satisfied with the predicate's outcome.
18942   // Referenced via a pointer to avoid taking too much stack frame space
18943   // with test assertions.
18944   internal::scoped_ptr< ::std::string> message_;
18945 };
18946
18947 // Makes a successful assertion result.
18948 GTEST_API_ AssertionResult AssertionSuccess();
18949
18950 // Makes a failed assertion result.
18951 GTEST_API_ AssertionResult AssertionFailure();
18952
18953 // Makes a failed assertion result with the given failure message.
18954 // Deprecated; use AssertionFailure() << msg.
18955 GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
18956
18957 // The abstract class that all tests inherit from.
18958 //
18959 // In Google Test, a unit test program contains one or many TestCases, and
18960 // each TestCase contains one or many Tests.
18961 //
18962 // When you define a test using the TEST macro, you don't need to
18963 // explicitly derive from Test - the TEST macro automatically does
18964 // this for you.
18965 //
18966 // The only time you derive from Test is when defining a test fixture
18967 // to be used a TEST_F.  For example:
18968 //
18969 //   class FooTest : public testing::Test {
18970 //    protected:
18971 //     void SetUp() override { ... }
18972 //     void TearDown() override { ... }
18973 //     ...
18974 //   };
18975 //
18976 //   TEST_F(FooTest, Bar) { ... }
18977 //   TEST_F(FooTest, Baz) { ... }
18978 //
18979 // Test is not copyable.
18980 class GTEST_API_ Test {
18981  public:
18982   friend class TestInfo;
18983
18984   // Defines types for pointers to functions that set up and tear down
18985   // a test case.
18986   typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc;
18987   typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc;
18988
18989   // The d'tor is virtual as we intend to inherit from Test.
18990   virtual ~Test();
18991
18992   // Sets up the stuff shared by all tests in this test case.
18993   //
18994   // Google Test will call Foo::SetUpTestCase() before running the first
18995   // test in test case Foo.  Hence a sub-class can define its own
18996   // SetUpTestCase() method to shadow the one defined in the super
18997   // class.
18998   static void SetUpTestCase() {}
18999
19000   // Tears down the stuff shared by all tests in this test case.
19001   //
19002   // Google Test will call Foo::TearDownTestCase() after running the last
19003   // test in test case Foo.  Hence a sub-class can define its own
19004   // TearDownTestCase() method to shadow the one defined in the super
19005   // class.
19006   static void TearDownTestCase() {}
19007
19008   // Returns true iff the current test has a fatal failure.
19009   static bool HasFatalFailure();
19010
19011   // Returns true iff the current test has a non-fatal failure.
19012   static bool HasNonfatalFailure();
19013
19014   // Returns true iff the current test has a (either fatal or
19015   // non-fatal) failure.
19016   static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
19017
19018   // Logs a property for the current test, test case, or for the entire
19019   // invocation of the test program when used outside of the context of a
19020   // test case.  Only the last value for a given key is remembered.  These
19021   // are public static so they can be called from utility functions that are
19022   // not members of the test fixture.  Calls to RecordProperty made during
19023   // lifespan of the test (from the moment its constructor starts to the
19024   // moment its destructor finishes) will be output in XML as attributes of
19025   // the <testcase> element.  Properties recorded from fixture's
19026   // SetUpTestCase or TearDownTestCase are logged as attributes of the
19027   // corresponding <testsuite> element.  Calls to RecordProperty made in the
19028   // global context (before or after invocation of RUN_ALL_TESTS and from
19029   // SetUp/TearDown method of Environment objects registered with Google
19030   // Test) will be output as attributes of the <testsuites> element.
19031   static void RecordProperty(const std::string& key, const std::string& value);
19032   static void RecordProperty(const std::string& key, int value);
19033
19034  protected:
19035   // Creates a Test object.
19036   Test();
19037
19038   // Sets up the test fixture.
19039   virtual void SetUp();
19040
19041   // Tears down the test fixture.
19042   virtual void TearDown();
19043
19044  private:
19045   // Returns true iff the current test has the same fixture class as
19046   // the first test in the current test case.
19047   static bool HasSameFixtureClass();
19048
19049   // Runs the test after the test fixture has been set up.
19050   //
19051   // A sub-class must implement this to define the test logic.
19052   //
19053   // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
19054   // Instead, use the TEST or TEST_F macro.
19055   virtual void TestBody() = 0;
19056
19057   // Sets up, executes, and tears down the test.
19058   void Run();
19059
19060   // Deletes self.  We deliberately pick an unusual name for this
19061   // internal method to avoid clashing with names used in user TESTs.
19062   void DeleteSelf_() { delete this; }
19063
19064   const internal::scoped_ptr< GTEST_FLAG_SAVER_ > gtest_flag_saver_;
19065
19066   // Often a user misspells SetUp() as Setup() and spends a long time
19067   // wondering why it is never called by Google Test.  The declaration of
19068   // the following method is solely for catching such an error at
19069   // compile time:
19070   //
19071   //   - The return type is deliberately chosen to be not void, so it
19072   //   will be a conflict if void Setup() is declared in the user's
19073   //   test fixture.
19074   //
19075   //   - This method is private, so it will be another compiler error
19076   //   if the method is called from the user's test fixture.
19077   //
19078   // DO NOT OVERRIDE THIS FUNCTION.
19079   //
19080   // If you see an error about overriding the following function or
19081   // about it being private, you have mis-spelled SetUp() as Setup().
19082   struct Setup_should_be_spelled_SetUp {};
19083   virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
19084
19085   // We disallow copying Tests.
19086   GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
19087 };
19088
19089 typedef internal::TimeInMillis TimeInMillis;
19090
19091 // A copyable object representing a user specified test property which can be
19092 // output as a key/value string pair.
19093 //
19094 // Don't inherit from TestProperty as its destructor is not virtual.
19095 class TestProperty {
19096  public:
19097   // C'tor.  TestProperty does NOT have a default constructor.
19098   // Always use this constructor (with parameters) to create a
19099   // TestProperty object.
19100   TestProperty(const std::string& a_key, const std::string& a_value) :
19101     key_(a_key), value_(a_value) {
19102   }
19103
19104   // Gets the user supplied key.
19105   const char* key() const {
19106     return key_.c_str();
19107   }
19108
19109   // Gets the user supplied value.
19110   const char* value() const {
19111     return value_.c_str();
19112   }
19113
19114   // Sets a new value, overriding the one supplied in the constructor.
19115   void SetValue(const std::string& new_value) {
19116     value_ = new_value;
19117   }
19118
19119  private:
19120   // The key supplied by the user.
19121   std::string key_;
19122   // The value supplied by the user.
19123   std::string value_;
19124 };
19125
19126 // The result of a single Test.  This includes a list of
19127 // TestPartResults, a list of TestProperties, a count of how many
19128 // death tests there are in the Test, and how much time it took to run
19129 // the Test.
19130 //
19131 // TestResult is not copyable.
19132 class GTEST_API_ TestResult {
19133  public:
19134   // Creates an empty TestResult.
19135   TestResult();
19136
19137   // D'tor.  Do not inherit from TestResult.
19138   ~TestResult();
19139
19140   // Gets the number of all test parts.  This is the sum of the number
19141   // of successful test parts and the number of failed test parts.
19142   int total_part_count() const;
19143
19144   // Returns the number of the test properties.
19145   int test_property_count() const;
19146
19147   // Returns true iff the test passed (i.e. no test part failed).
19148   bool Passed() const { return !Failed(); }
19149
19150   // Returns true iff the test failed.
19151   bool Failed() const;
19152
19153   // Returns true iff the test fatally failed.
19154   bool HasFatalFailure() const;
19155
19156   // Returns true iff the test has a non-fatal failure.
19157   bool HasNonfatalFailure() const;
19158
19159   // Returns the elapsed time, in milliseconds.
19160   TimeInMillis elapsed_time() const { return elapsed_time_; }
19161
19162   // Returns the i-th test part result among all the results. i can range
19163   // from 0 to test_property_count() - 1. If i is not in that range, aborts
19164   // the program.
19165   const TestPartResult& GetTestPartResult(int i) const;
19166
19167   // Returns the i-th test property. i can range from 0 to
19168   // test_property_count() - 1. If i is not in that range, aborts the
19169   // program.
19170   const TestProperty& GetTestProperty(int i) const;
19171
19172  private:
19173   friend class TestInfo;
19174   friend class TestCase;
19175   friend class UnitTest;
19176   friend class internal::DefaultGlobalTestPartResultReporter;
19177   friend class internal::ExecDeathTest;
19178   friend class internal::TestResultAccessor;
19179   friend class internal::UnitTestImpl;
19180   friend class internal::WindowsDeathTest;
19181
19182   // Gets the vector of TestPartResults.
19183   const std::vector<TestPartResult>& test_part_results() const {
19184     return test_part_results_;
19185   }
19186
19187   // Gets the vector of TestProperties.
19188   const std::vector<TestProperty>& test_properties() const {
19189     return test_properties_;
19190   }
19191
19192   // Sets the elapsed time.
19193   void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
19194
19195   // Adds a test property to the list. The property is validated and may add
19196   // a non-fatal failure if invalid (e.g., if it conflicts with reserved
19197   // key names). If a property is already recorded for the same key, the
19198   // value will be updated, rather than storing multiple values for the same
19199   // key.  xml_element specifies the element for which the property is being
19200   // recorded and is used for validation.
19201   void RecordProperty(const std::string& xml_element,
19202                       const TestProperty& test_property);
19203
19204   // Adds a failure if the key is a reserved attribute of Google Test
19205   // testcase tags.  Returns true if the property is valid.
19206   // TODO(russr): Validate attribute names are legal and human readable.
19207   static bool ValidateTestProperty(const std::string& xml_element,
19208                                    const TestProperty& test_property);
19209
19210   // Adds a test part result to the list.
19211   void AddTestPartResult(const TestPartResult& test_part_result);
19212
19213   // Returns the death test count.
19214   int death_test_count() const { return death_test_count_; }
19215
19216   // Increments the death test count, returning the new count.
19217   int increment_death_test_count() { return ++death_test_count_; }
19218
19219   // Clears the test part results.
19220   void ClearTestPartResults();
19221
19222   // Clears the object.
19223   void Clear();
19224
19225   // Protects mutable state of the property vector and of owned
19226   // properties, whose values may be updated.
19227   internal::Mutex test_properites_mutex_;
19228
19229   // The vector of TestPartResults
19230   std::vector<TestPartResult> test_part_results_;
19231   // The vector of TestProperties
19232   std::vector<TestProperty> test_properties_;
19233   // Running count of death tests.
19234   int death_test_count_;
19235   // The elapsed time, in milliseconds.
19236   TimeInMillis elapsed_time_;
19237
19238   // We disallow copying TestResult.
19239   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
19240 };  // class TestResult
19241
19242 // A TestInfo object stores the following information about a test:
19243 //
19244 //   Test case name
19245 //   Test name
19246 //   Whether the test should be run
19247 //   A function pointer that creates the test object when invoked
19248 //   Test result
19249 //
19250 // The constructor of TestInfo registers itself with the UnitTest
19251 // singleton such that the RUN_ALL_TESTS() macro knows which tests to
19252 // run.
19253 class GTEST_API_ TestInfo {
19254  public:
19255   // Destructs a TestInfo object.  This function is not virtual, so
19256   // don't inherit from TestInfo.
19257   ~TestInfo();
19258
19259   // Returns the test case name.
19260   const char* test_case_name() const { return test_case_name_.c_str(); }
19261
19262   // Returns the test name.
19263   const char* name() const { return name_.c_str(); }
19264
19265   // Returns the name of the parameter type, or NULL if this is not a typed
19266   // or a type-parameterized test.
19267   const char* type_param() const {
19268     if (type_param_.get() != NULL)
19269       return type_param_->c_str();
19270     return NULL;
19271   }
19272
19273   // Returns the text representation of the value parameter, or NULL if this
19274   // is not a value-parameterized test.
19275   const char* value_param() const {
19276     if (value_param_.get() != NULL)
19277       return value_param_->c_str();
19278     return NULL;
19279   }
19280
19281   // Returns the file name where this test is defined.
19282   const char* file() const { return location_.file.c_str(); }
19283
19284   // Returns the line where this test is defined.
19285   int line() const { return location_.line; }
19286
19287   // Returns true if this test should run, that is if the test is not
19288   // disabled (or it is disabled but the also_run_disabled_tests flag has
19289   // been specified) and its full name matches the user-specified filter.
19290   //
19291   // Google Test allows the user to filter the tests by their full names.
19292   // The full name of a test Bar in test case Foo is defined as
19293   // "Foo.Bar".  Only the tests that match the filter will run.
19294   //
19295   // A filter is a colon-separated list of glob (not regex) patterns,
19296   // optionally followed by a '-' and a colon-separated list of
19297   // negative patterns (tests to exclude).  A test is run if it
19298   // matches one of the positive patterns and does not match any of
19299   // the negative patterns.
19300   //
19301   // For example, *A*:Foo.* is a filter that matches any string that
19302   // contains the character 'A' or starts with "Foo.".
19303   bool should_run() const { return should_run_; }
19304
19305   // Returns true iff this test will appear in the XML report.
19306   bool is_reportable() const {
19307     // For now, the XML report includes all tests matching the filter.
19308     // In the future, we may trim tests that are excluded because of
19309     // sharding.
19310     return matches_filter_;
19311   }
19312
19313   // Returns the result of the test.
19314   const TestResult* result() const { return &result_; }
19315
19316  private:
19317 #if GTEST_HAS_DEATH_TEST
19318   friend class internal::DefaultDeathTestFactory;
19319 #endif  // GTEST_HAS_DEATH_TEST
19320   friend class Test;
19321   friend class TestCase;
19322   friend class internal::UnitTestImpl;
19323   friend class internal::StreamingListenerTest;
19324   friend TestInfo* internal::MakeAndRegisterTestInfo(
19325       const char* test_case_name,
19326       const char* name,
19327       const char* type_param,
19328       const char* value_param,
19329       internal::CodeLocation code_location,
19330       internal::TypeId fixture_class_id,
19331       Test::SetUpTestCaseFunc set_up_tc,
19332       Test::TearDownTestCaseFunc tear_down_tc,
19333       internal::TestFactoryBase* factory);
19334
19335   // Constructs a TestInfo object. The newly constructed instance assumes
19336   // ownership of the factory object.
19337   TestInfo(const std::string& test_case_name,
19338            const std::string& name,
19339            const char* a_type_param,   // NULL if not a type-parameterized test
19340            const char* a_value_param,  // NULL if not a value-parameterized test
19341            internal::CodeLocation a_code_location,
19342            internal::TypeId fixture_class_id,
19343            internal::TestFactoryBase* factory);
19344
19345   // Increments the number of death tests encountered in this test so
19346   // far.
19347   int increment_death_test_count() {
19348     return result_.increment_death_test_count();
19349   }
19350
19351   // Creates the test object, runs it, records its result, and then
19352   // deletes it.
19353   void Run();
19354
19355   static void ClearTestResult(TestInfo* test_info) {
19356     test_info->result_.Clear();
19357   }
19358
19359   // These fields are immutable properties of the test.
19360   const std::string test_case_name_;     // Test case name
19361   const std::string name_;               // Test name
19362   // Name of the parameter type, or NULL if this is not a typed or a
19363   // type-parameterized test.
19364   const internal::scoped_ptr<const ::std::string> type_param_;
19365   // Text representation of the value parameter, or NULL if this is not a
19366   // value-parameterized test.
19367   const internal::scoped_ptr<const ::std::string> value_param_;
19368   internal::CodeLocation location_;
19369   const internal::TypeId fixture_class_id_;   // ID of the test fixture class
19370   bool should_run_;                 // True iff this test should run
19371   bool is_disabled_;                // True iff this test is disabled
19372   bool matches_filter_;             // True if this test matches the
19373                                     // user-specified filter.
19374   internal::TestFactoryBase* const factory_;  // The factory that creates
19375                                               // the test object
19376
19377   // This field is mutable and needs to be reset before running the
19378   // test for the second time.
19379   TestResult result_;
19380
19381   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
19382 };
19383
19384 // A test case, which consists of a vector of TestInfos.
19385 //
19386 // TestCase is not copyable.
19387 class GTEST_API_ TestCase {
19388  public:
19389   // Creates a TestCase with the given name.
19390   //
19391   // TestCase does NOT have a default constructor.  Always use this
19392   // constructor to create a TestCase object.
19393   //
19394   // Arguments:
19395   //
19396   //   name:         name of the test case
19397   //   a_type_param: the name of the test's type parameter, or NULL if
19398   //                 this is not a type-parameterized test.
19399   //   set_up_tc:    pointer to the function that sets up the test case
19400   //   tear_down_tc: pointer to the function that tears down the test case
19401   TestCase(const char* name, const char* a_type_param,
19402            Test::SetUpTestCaseFunc set_up_tc,
19403            Test::TearDownTestCaseFunc tear_down_tc);
19404
19405   // Destructor of TestCase.
19406   virtual ~TestCase();
19407
19408   // Gets the name of the TestCase.
19409   const char* name() const { return name_.c_str(); }
19410
19411   // Returns the name of the parameter type, or NULL if this is not a
19412   // type-parameterized test case.
19413   const char* type_param() const {
19414     if (type_param_.get() != NULL)
19415       return type_param_->c_str();
19416     return NULL;
19417   }
19418
19419   // Returns true if any test in this test case should run.
19420   bool should_run() const { return should_run_; }
19421
19422   // Gets the number of successful tests in this test case.
19423   int successful_test_count() const;
19424
19425   // Gets the number of failed tests in this test case.
19426   int failed_test_count() const;
19427
19428   // Gets the number of disabled tests that will be reported in the XML report.
19429   int reportable_disabled_test_count() const;
19430
19431   // Gets the number of disabled tests in this test case.
19432   int disabled_test_count() const;
19433
19434   // Gets the number of tests to be printed in the XML report.
19435   int reportable_test_count() const;
19436
19437   // Get the number of tests in this test case that should run.
19438   int test_to_run_count() const;
19439
19440   // Gets the number of all tests in this test case.
19441   int total_test_count() const;
19442
19443   // Returns true iff the test case passed.
19444   bool Passed() const { return !Failed(); }
19445
19446   // Returns true iff the test case failed.
19447   bool Failed() const { return failed_test_count() > 0; }
19448
19449   // Returns the elapsed time, in milliseconds.
19450   TimeInMillis elapsed_time() const { return elapsed_time_; }
19451
19452   // Returns the i-th test among all the tests. i can range from 0 to
19453   // total_test_count() - 1. If i is not in that range, returns NULL.
19454   const TestInfo* GetTestInfo(int i) const;
19455
19456   // Returns the TestResult that holds test properties recorded during
19457   // execution of SetUpTestCase and TearDownTestCase.
19458   const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }
19459
19460  private:
19461   friend class Test;
19462   friend class internal::UnitTestImpl;
19463
19464   // Gets the (mutable) vector of TestInfos in this TestCase.
19465   std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
19466
19467   // Gets the (immutable) vector of TestInfos in this TestCase.
19468   const std::vector<TestInfo*>& test_info_list() const {
19469     return test_info_list_;
19470   }
19471
19472   // Returns the i-th test among all the tests. i can range from 0 to
19473   // total_test_count() - 1. If i is not in that range, returns NULL.
19474   TestInfo* GetMutableTestInfo(int i);
19475
19476   // Sets the should_run member.
19477   void set_should_run(bool should) { should_run_ = should; }
19478
19479   // Adds a TestInfo to this test case.  Will delete the TestInfo upon
19480   // destruction of the TestCase object.
19481   void AddTestInfo(TestInfo * test_info);
19482
19483   // Clears the results of all tests in this test case.
19484   void ClearResult();
19485
19486   // Clears the results of all tests in the given test case.
19487   static void ClearTestCaseResult(TestCase* test_case) {
19488     test_case->ClearResult();
19489   }
19490
19491   // Runs every test in this TestCase.
19492   void Run();
19493
19494   // Runs SetUpTestCase() for this TestCase.  This wrapper is needed
19495   // for catching exceptions thrown from SetUpTestCase().
19496   void RunSetUpTestCase() { (*set_up_tc_)(); }
19497
19498   // Runs TearDownTestCase() for this TestCase.  This wrapper is
19499   // needed for catching exceptions thrown from TearDownTestCase().
19500   void RunTearDownTestCase() { (*tear_down_tc_)(); }
19501
19502   // Returns true iff test passed.
19503   static bool TestPassed(const TestInfo* test_info) {
19504     return test_info->should_run() && test_info->result()->Passed();
19505   }
19506
19507   // Returns true iff test failed.
19508   static bool TestFailed(const TestInfo* test_info) {
19509     return test_info->should_run() && test_info->result()->Failed();
19510   }
19511
19512   // Returns true iff the test is disabled and will be reported in the XML
19513   // report.
19514   static bool TestReportableDisabled(const TestInfo* test_info) {
19515     return test_info->is_reportable() && test_info->is_disabled_;
19516   }
19517
19518   // Returns true iff test is disabled.
19519   static bool TestDisabled(const TestInfo* test_info) {
19520     return test_info->is_disabled_;
19521   }
19522
19523   // Returns true iff this test will appear in the XML report.
19524   static bool TestReportable(const TestInfo* test_info) {
19525     return test_info->is_reportable();
19526   }
19527
19528   // Returns true if the given test should run.
19529   static bool ShouldRunTest(const TestInfo* test_info) {
19530     return test_info->should_run();
19531   }
19532
19533   // Shuffles the tests in this test case.
19534   void ShuffleTests(internal::Random* random);
19535
19536   // Restores the test order to before the first shuffle.
19537   void UnshuffleTests();
19538
19539   // Name of the test case.
19540   std::string name_;
19541   // Name of the parameter type, or NULL if this is not a typed or a
19542   // type-parameterized test.
19543   const internal::scoped_ptr<const ::std::string> type_param_;
19544   // The vector of TestInfos in their original order.  It owns the
19545   // elements in the vector.
19546   std::vector<TestInfo*> test_info_list_;
19547   // Provides a level of indirection for the test list to allow easy
19548   // shuffling and restoring the test order.  The i-th element in this
19549   // vector is the index of the i-th test in the shuffled test list.
19550   std::vector<int> test_indices_;
19551   // Pointer to the function that sets up the test case.
19552   Test::SetUpTestCaseFunc set_up_tc_;
19553   // Pointer to the function that tears down the test case.
19554   Test::TearDownTestCaseFunc tear_down_tc_;
19555   // True iff any test in this test case should run.
19556   bool should_run_;
19557   // Elapsed time, in milliseconds.
19558   TimeInMillis elapsed_time_;
19559   // Holds test properties recorded during execution of SetUpTestCase and
19560   // TearDownTestCase.
19561   TestResult ad_hoc_test_result_;
19562
19563   // We disallow copying TestCases.
19564   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
19565 };
19566
19567 // An Environment object is capable of setting up and tearing down an
19568 // environment.  You should subclass this to define your own
19569 // environment(s).
19570 //
19571 // An Environment object does the set-up and tear-down in virtual
19572 // methods SetUp() and TearDown() instead of the constructor and the
19573 // destructor, as:
19574 //
19575 //   1. You cannot safely throw from a destructor.  This is a problem
19576 //      as in some cases Google Test is used where exceptions are enabled, and
19577 //      we may want to implement ASSERT_* using exceptions where they are
19578 //      available.
19579 //   2. You cannot use ASSERT_* directly in a constructor or
19580 //      destructor.
19581 class Environment {
19582  public:
19583   // The d'tor is virtual as we need to subclass Environment.
19584   virtual ~Environment() {}
19585
19586   // Override this to define how to set up the environment.
19587   virtual void SetUp() {}
19588
19589   // Override this to define how to tear down the environment.
19590   virtual void TearDown() {}
19591  private:
19592   // If you see an error about overriding the following function or
19593   // about it being private, you have mis-spelled SetUp() as Setup().
19594   struct Setup_should_be_spelled_SetUp {};
19595   virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
19596 };
19597
19598 // The interface for tracing execution of tests. The methods are organized in
19599 // the order the corresponding events are fired.
19600 class TestEventListener {
19601  public:
19602   virtual ~TestEventListener() {}
19603
19604   // Fired before any test activity starts.
19605   virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
19606
19607   // Fired before each iteration of tests starts.  There may be more than
19608   // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
19609   // index, starting from 0.
19610   virtual void OnTestIterationStart(const UnitTest& unit_test,
19611                                     int iteration) = 0;
19612
19613   // Fired before environment set-up for each iteration of tests starts.
19614   virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
19615
19616   // Fired after environment set-up for each iteration of tests ends.
19617   virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
19618
19619   // Fired before the test case starts.
19620   virtual void OnTestCaseStart(const TestCase& test_case) = 0;
19621
19622   // Fired before the test starts.
19623   virtual void OnTestStart(const TestInfo& test_info) = 0;
19624
19625   // Fired after a failed assertion or a SUCCEED() invocation.
19626   virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
19627
19628   // Fired after the test ends.
19629   virtual void OnTestEnd(const TestInfo& test_info) = 0;
19630
19631   // Fired after the test case ends.
19632   virtual void OnTestCaseEnd(const TestCase& test_case) = 0;
19633
19634   // Fired before environment tear-down for each iteration of tests starts.
19635   virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
19636
19637   // Fired after environment tear-down for each iteration of tests ends.
19638   virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
19639
19640   // Fired after each iteration of tests finishes.
19641   virtual void OnTestIterationEnd(const UnitTest& unit_test,
19642                                   int iteration) = 0;
19643
19644   // Fired after all test activities have ended.
19645   virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
19646 };
19647
19648 // The convenience class for users who need to override just one or two
19649 // methods and are not concerned that a possible change to a signature of
19650 // the methods they override will not be caught during the build.  For
19651 // comments about each method please see the definition of TestEventListener
19652 // above.
19653 class EmptyTestEventListener : public TestEventListener {
19654  public:
19655   virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
19656   virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
19657                                     int /*iteration*/) {}
19658   virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {}
19659   virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
19660   virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
19661   virtual void OnTestStart(const TestInfo& /*test_info*/) {}
19662   virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {}
19663   virtual void OnTestEnd(const TestInfo& /*test_info*/) {}
19664   virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
19665   virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {}
19666   virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
19667   virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
19668                                   int /*iteration*/) {}
19669   virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
19670 };
19671
19672 // TestEventListeners lets users add listeners to track events in Google Test.
19673 class GTEST_API_ TestEventListeners {
19674  public:
19675   TestEventListeners();
19676   ~TestEventListeners();
19677
19678   // Appends an event listener to the end of the list. Google Test assumes
19679   // the ownership of the listener (i.e. it will delete the listener when
19680   // the test program finishes).
19681   void Append(TestEventListener* listener);
19682
19683   // Removes the given event listener from the list and returns it.  It then
19684   // becomes the caller's responsibility to delete the listener. Returns
19685   // NULL if the listener is not found in the list.
19686   TestEventListener* Release(TestEventListener* listener);
19687
19688   // Returns the standard listener responsible for the default console
19689   // output.  Can be removed from the listeners list to shut down default
19690   // console output.  Note that removing this object from the listener list
19691   // with Release transfers its ownership to the caller and makes this
19692   // function return NULL the next time.
19693   TestEventListener* default_result_printer() const {
19694     return default_result_printer_;
19695   }
19696
19697   // Returns the standard listener responsible for the default XML output
19698   // controlled by the --gtest_output=xml flag.  Can be removed from the
19699   // listeners list by users who want to shut down the default XML output
19700   // controlled by this flag and substitute it with custom one.  Note that
19701   // removing this object from the listener list with Release transfers its
19702   // ownership to the caller and makes this function return NULL the next
19703   // time.
19704   TestEventListener* default_xml_generator() const {
19705     return default_xml_generator_;
19706   }
19707
19708  private:
19709   friend class TestCase;
19710   friend class TestInfo;
19711   friend class internal::DefaultGlobalTestPartResultReporter;
19712   friend class internal::NoExecDeathTest;
19713   friend class internal::TestEventListenersAccessor;
19714   friend class internal::UnitTestImpl;
19715
19716   // Returns repeater that broadcasts the TestEventListener events to all
19717   // subscribers.
19718   TestEventListener* repeater();
19719
19720   // Sets the default_result_printer attribute to the provided listener.
19721   // The listener is also added to the listener list and previous
19722   // default_result_printer is removed from it and deleted. The listener can
19723   // also be NULL in which case it will not be added to the list. Does
19724   // nothing if the previous and the current listener objects are the same.
19725   void SetDefaultResultPrinter(TestEventListener* listener);
19726
19727   // Sets the default_xml_generator attribute to the provided listener.  The
19728   // listener is also added to the listener list and previous
19729   // default_xml_generator is removed from it and deleted. The listener can
19730   // also be NULL in which case it will not be added to the list. Does
19731   // nothing if the previous and the current listener objects are the same.
19732   void SetDefaultXmlGenerator(TestEventListener* listener);
19733
19734   // Controls whether events will be forwarded by the repeater to the
19735   // listeners in the list.
19736   bool EventForwardingEnabled() const;
19737   void SuppressEventForwarding();
19738
19739   // The actual list of listeners.
19740   internal::TestEventRepeater* repeater_;
19741   // Listener responsible for the standard result output.
19742   TestEventListener* default_result_printer_;
19743   // Listener responsible for the creation of the XML output file.
19744   TestEventListener* default_xml_generator_;
19745
19746   // We disallow copying TestEventListeners.
19747   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
19748 };
19749
19750 // A UnitTest consists of a vector of TestCases.
19751 //
19752 // This is a singleton class.  The only instance of UnitTest is
19753 // created when UnitTest::GetInstance() is first called.  This
19754 // instance is never deleted.
19755 //
19756 // UnitTest is not copyable.
19757 //
19758 // This class is thread-safe as long as the methods are called
19759 // according to their specification.
19760 class GTEST_API_ UnitTest {
19761  public:
19762   // Gets the singleton UnitTest object.  The first time this method
19763   // is called, a UnitTest object is constructed and returned.
19764   // Consecutive calls will return the same object.
19765   static UnitTest* GetInstance();
19766
19767   // Runs all tests in this UnitTest object and prints the result.
19768   // Returns 0 if successful, or 1 otherwise.
19769   //
19770   // This method can only be called from the main thread.
19771   //
19772   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
19773   int Run() GTEST_MUST_USE_RESULT_;
19774
19775   // Returns the working directory when the first TEST() or TEST_F()
19776   // was executed.  The UnitTest object owns the string.
19777   const char* original_working_dir() const;
19778
19779   // Returns the TestCase object for the test that's currently running,
19780   // or NULL if no test is running.
19781   const TestCase* current_test_case() const
19782       GTEST_LOCK_EXCLUDED_(mutex_);
19783
19784   // Returns the TestInfo object for the test that's currently running,
19785   // or NULL if no test is running.
19786   const TestInfo* current_test_info() const
19787       GTEST_LOCK_EXCLUDED_(mutex_);
19788
19789   // Returns the random seed used at the start of the current test run.
19790   int random_seed() const;
19791
19792 #if GTEST_HAS_PARAM_TEST
19793   // Returns the ParameterizedTestCaseRegistry object used to keep track of
19794   // value-parameterized tests and instantiate and register them.
19795   //
19796   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
19797   internal::ParameterizedTestCaseRegistry& parameterized_test_registry()
19798       GTEST_LOCK_EXCLUDED_(mutex_);
19799 #endif  // GTEST_HAS_PARAM_TEST
19800
19801   // Gets the number of successful test cases.
19802   int successful_test_case_count() const;
19803
19804   // Gets the number of failed test cases.
19805   int failed_test_case_count() const;
19806
19807   // Gets the number of all test cases.
19808   int total_test_case_count() const;
19809
19810   // Gets the number of all test cases that contain at least one test
19811   // that should run.
19812   int test_case_to_run_count() const;
19813
19814   // Gets the number of successful tests.
19815   int successful_test_count() const;
19816
19817   // Gets the number of failed tests.
19818   int failed_test_count() const;
19819
19820   // Gets the number of disabled tests that will be reported in the XML report.
19821   int reportable_disabled_test_count() const;
19822
19823   // Gets the number of disabled tests.
19824   int disabled_test_count() const;
19825
19826   // Gets the number of tests to be printed in the XML report.
19827   int reportable_test_count() const;
19828
19829   // Gets the number of all tests.
19830   int total_test_count() const;
19831
19832   // Gets the number of tests that should run.
19833   int test_to_run_count() const;
19834
19835   // Gets the time of the test program start, in ms from the start of the
19836   // UNIX epoch.
19837   TimeInMillis start_timestamp() const;
19838
19839   // Gets the elapsed time, in milliseconds.
19840   TimeInMillis elapsed_time() const;
19841
19842   // Returns true iff the unit test passed (i.e. all test cases passed).
19843   bool Passed() const;
19844
19845   // Returns true iff the unit test failed (i.e. some test case failed
19846   // or something outside of all tests failed).
19847   bool Failed() const;
19848
19849   // Gets the i-th test case among all the test cases. i can range from 0 to
19850   // total_test_case_count() - 1. If i is not in that range, returns NULL.
19851   const TestCase* GetTestCase(int i) const;
19852
19853   // Returns the TestResult containing information on test failures and
19854   // properties logged outside of individual test cases.
19855   const TestResult& ad_hoc_test_result() const;
19856
19857   // Returns the list of event listeners that can be used to track events
19858   // inside Google Test.
19859   TestEventListeners& listeners();
19860
19861  private:
19862   // Registers and returns a global test environment.  When a test
19863   // program is run, all global test environments will be set-up in
19864   // the order they were registered.  After all tests in the program
19865   // have finished, all global test environments will be torn-down in
19866   // the *reverse* order they were registered.
19867   //
19868   // The UnitTest object takes ownership of the given environment.
19869   //
19870   // This method can only be called from the main thread.
19871   Environment* AddEnvironment(Environment* env);
19872
19873   // Adds a TestPartResult to the current TestResult object.  All
19874   // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
19875   // eventually call this to report their results.  The user code
19876   // should use the assertion macros instead of calling this directly.
19877   void AddTestPartResult(TestPartResult::Type result_type,
19878                          const char* file_name,
19879                          int line_number,
19880                          const std::string& message,
19881                          const std::string& os_stack_trace)
19882       GTEST_LOCK_EXCLUDED_(mutex_);
19883
19884   // Adds a TestProperty to the current TestResult object when invoked from
19885   // inside a test, to current TestCase's ad_hoc_test_result_ when invoked
19886   // from SetUpTestCase or TearDownTestCase, or to the global property set
19887   // when invoked elsewhere.  If the result already contains a property with
19888   // the same key, the value will be updated.
19889   void RecordProperty(const std::string& key, const std::string& value);
19890
19891   // Gets the i-th test case among all the test cases. i can range from 0 to
19892   // total_test_case_count() - 1. If i is not in that range, returns NULL.
19893   TestCase* GetMutableTestCase(int i);
19894
19895   // Accessors for the implementation object.
19896   internal::UnitTestImpl* impl() { return impl_; }
19897   const internal::UnitTestImpl* impl() const { return impl_; }
19898
19899   // These classes and funcions are friends as they need to access private
19900   // members of UnitTest.
19901   friend class Test;
19902   friend class internal::AssertHelper;
19903   friend class internal::ScopedTrace;
19904   friend class internal::StreamingListenerTest;
19905   friend class internal::UnitTestRecordPropertyTestHelper;
19906   friend Environment* AddGlobalTestEnvironment(Environment* env);
19907   friend internal::UnitTestImpl* internal::GetUnitTestImpl();
19908   friend void internal::ReportFailureInUnknownLocation(
19909       TestPartResult::Type result_type,
19910       const std::string& message);
19911
19912   // Creates an empty UnitTest.
19913   UnitTest();
19914
19915   // D'tor
19916   virtual ~UnitTest();
19917
19918   // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
19919   // Google Test trace stack.
19920   void PushGTestTrace(const internal::TraceInfo& trace)
19921       GTEST_LOCK_EXCLUDED_(mutex_);
19922
19923   // Pops a trace from the per-thread Google Test trace stack.
19924   void PopGTestTrace()
19925       GTEST_LOCK_EXCLUDED_(mutex_);
19926
19927   // Protects mutable state in *impl_.  This is mutable as some const
19928   // methods need to lock it too.
19929   mutable internal::Mutex mutex_;
19930
19931   // Opaque implementation object.  This field is never changed once
19932   // the object is constructed.  We don't mark it as const here, as
19933   // doing so will cause a warning in the constructor of UnitTest.
19934   // Mutable state in *impl_ is protected by mutex_.
19935   internal::UnitTestImpl* impl_;
19936
19937   // We disallow copying UnitTest.
19938   GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
19939 };
19940
19941 // A convenient wrapper for adding an environment for the test
19942 // program.
19943 //
19944 // You should call this before RUN_ALL_TESTS() is called, probably in
19945 // main().  If you use gtest_main, you need to call this before main()
19946 // starts for it to take effect.  For example, you can define a global
19947 // variable like this:
19948 //
19949 //   testing::Environment* const foo_env =
19950 //       testing::AddGlobalTestEnvironment(new FooEnvironment);
19951 //
19952 // However, we strongly recommend you to write your own main() and
19953 // call AddGlobalTestEnvironment() there, as relying on initialization
19954 // of global variables makes the code harder to read and may cause
19955 // problems when you register multiple environments from different
19956 // translation units and the environments have dependencies among them
19957 // (remember that the compiler doesn't guarantee the order in which
19958 // global variables from different translation units are initialized).
19959 inline Environment* AddGlobalTestEnvironment(Environment* env) {
19960   return UnitTest::GetInstance()->AddEnvironment(env);
19961 }
19962
19963 // Initializes Google Test.  This must be called before calling
19964 // RUN_ALL_TESTS().  In particular, it parses a command line for the
19965 // flags that Google Test recognizes.  Whenever a Google Test flag is
19966 // seen, it is removed from argv, and *argc is decremented.
19967 //
19968 // No value is returned.  Instead, the Google Test flag variables are
19969 // updated.
19970 //
19971 // Calling the function for the second time has no user-visible effect.
19972 GTEST_API_ void InitGoogleTest(int* argc, char** argv);
19973
19974 // This overloaded version can be used in Windows programs compiled in
19975 // UNICODE mode.
19976 GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
19977
19978 namespace internal {
19979
19980 // Separate the error generating code from the code path to reduce the stack
19981 // frame size of CmpHelperEQ. This helps reduce the overhead of some sanitizers
19982 // when calling EXPECT_* in a tight loop.
19983 template <typename T1, typename T2>
19984 AssertionResult CmpHelperEQFailure(const char* lhs_expression,
19985                                    const char* rhs_expression,
19986                                    const T1& lhs, const T2& rhs) {
19987   return EqFailure(lhs_expression,
19988                    rhs_expression,
19989                    FormatForComparisonFailureMessage(lhs, rhs),
19990                    FormatForComparisonFailureMessage(rhs, lhs),
19991                    false);
19992 }
19993
19994 // The helper function for {ASSERT|EXPECT}_EQ.
19995 template <typename T1, typename T2>
19996 AssertionResult CmpHelperEQ(const char* lhs_expression,
19997                             const char* rhs_expression,
19998                             const T1& lhs,
19999                             const T2& rhs) {
20000 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4389 /* signed/unsigned mismatch */)
20001   if (lhs == rhs) {
20002     return AssertionSuccess();
20003   }
20004 GTEST_DISABLE_MSC_WARNINGS_POP_()
20005
20006   return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);
20007 }
20008
20009 // With this overloaded version, we allow anonymous enums to be used
20010 // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
20011 // can be implicitly cast to BiggestInt.
20012 GTEST_API_ AssertionResult CmpHelperEQ(const char* lhs_expression,
20013                                        const char* rhs_expression,
20014                                        BiggestInt lhs,
20015                                        BiggestInt rhs);
20016
20017 // The helper class for {ASSERT|EXPECT}_EQ.  The template argument
20018 // lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
20019 // is a null pointer literal.  The following default implementation is
20020 // for lhs_is_null_literal being false.
20021 template <bool lhs_is_null_literal>
20022 class EqHelper {
20023  public:
20024   // This templatized version is for the general case.
20025   template <typename T1, typename T2>
20026   static AssertionResult Compare(const char* lhs_expression,
20027                                  const char* rhs_expression,
20028                                  const T1& lhs,
20029                                  const T2& rhs) {
20030     return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
20031   }
20032
20033   // With this overloaded version, we allow anonymous enums to be used
20034   // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
20035   // enums can be implicitly cast to BiggestInt.
20036   //
20037   // Even though its body looks the same as the above version, we
20038   // cannot merge the two, as it will make anonymous enums unhappy.
20039   static AssertionResult Compare(const char* lhs_expression,
20040                                  const char* rhs_expression,
20041                                  BiggestInt lhs,
20042                                  BiggestInt rhs) {
20043     return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
20044   }
20045 };
20046
20047 // This specialization is used when the first argument to ASSERT_EQ()
20048 // is a null pointer literal, like NULL, false, or 0.
20049 template <>
20050 class EqHelper<true> {
20051  public:
20052   // We define two overloaded versions of Compare().  The first
20053   // version will be picked when the second argument to ASSERT_EQ() is
20054   // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or
20055   // EXPECT_EQ(false, a_bool).
20056   template <typename T1, typename T2>
20057   static AssertionResult Compare(
20058       const char* lhs_expression,
20059       const char* rhs_expression,
20060       const T1& lhs,
20061       const T2& rhs,
20062       // The following line prevents this overload from being considered if T2
20063       // is not a pointer type.  We need this because ASSERT_EQ(NULL, my_ptr)
20064       // expands to Compare("", "", NULL, my_ptr), which requires a conversion
20065       // to match the Secret* in the other overload, which would otherwise make
20066       // this template match better.
20067       typename EnableIf<!is_pointer<T2>::value>::type* = 0) {
20068     return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
20069   }
20070
20071   // This version will be picked when the second argument to ASSERT_EQ() is a
20072   // pointer, e.g. ASSERT_EQ(NULL, a_pointer).
20073   template <typename T>
20074   static AssertionResult Compare(
20075       const char* lhs_expression,
20076       const char* rhs_expression,
20077       // We used to have a second template parameter instead of Secret*.  That
20078       // template parameter would deduce to 'long', making this a better match
20079       // than the first overload even without the first overload's EnableIf.
20080       // Unfortunately, gcc with -Wconversion-null warns when "passing NULL to
20081       // non-pointer argument" (even a deduced integral argument), so the old
20082       // implementation caused warnings in user code.
20083       Secret* /* lhs (NULL) */,
20084       T* rhs) {
20085     // We already know that 'lhs' is a null pointer.
20086     return CmpHelperEQ(lhs_expression, rhs_expression,
20087                        static_cast<T*>(NULL), rhs);
20088   }
20089 };
20090
20091 // Separate the error generating code from the code path to reduce the stack
20092 // frame size of CmpHelperOP. This helps reduce the overhead of some sanitizers
20093 // when calling EXPECT_OP in a tight loop.
20094 template <typename T1, typename T2>
20095 AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2,
20096                                    const T1& val1, const T2& val2,
20097                                    const char* op) {
20098   return AssertionFailure()
20099          << "Expected: (" << expr1 << ") " << op << " (" << expr2
20100          << "), actual: " << FormatForComparisonFailureMessage(val1, val2)
20101          << " vs " << FormatForComparisonFailureMessage(val2, val1);
20102 }
20103
20104 // A macro for implementing the helper functions needed to implement
20105 // ASSERT_?? and EXPECT_??.  It is here just to avoid copy-and-paste
20106 // of similar code.
20107 //
20108 // For each templatized helper function, we also define an overloaded
20109 // version for BiggestInt in order to reduce code bloat and allow
20110 // anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
20111 // with gcc 4.
20112 //
20113 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20114
20115 #define GTEST_IMPL_CMP_HELPER_(op_name, op)\
20116 template <typename T1, typename T2>\
20117 AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
20118                                    const T1& val1, const T2& val2) {\
20119   if (val1 op val2) {\
20120     return AssertionSuccess();\
20121   } else {\
20122     return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
20123   }\
20124 }\
20125 GTEST_API_ AssertionResult CmpHelper##op_name(\
20126     const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
20127
20128 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20129
20130 // Implements the helper function for {ASSERT|EXPECT}_NE
20131 GTEST_IMPL_CMP_HELPER_(NE, !=);
20132 // Implements the helper function for {ASSERT|EXPECT}_LE
20133 GTEST_IMPL_CMP_HELPER_(LE, <=);
20134 // Implements the helper function for {ASSERT|EXPECT}_LT
20135 GTEST_IMPL_CMP_HELPER_(LT, <);
20136 // Implements the helper function for {ASSERT|EXPECT}_GE
20137 GTEST_IMPL_CMP_HELPER_(GE, >=);
20138 // Implements the helper function for {ASSERT|EXPECT}_GT
20139 GTEST_IMPL_CMP_HELPER_(GT, >);
20140
20141 #undef GTEST_IMPL_CMP_HELPER_
20142
20143 // The helper function for {ASSERT|EXPECT}_STREQ.
20144 //
20145 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20146 GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
20147                                           const char* s2_expression,
20148                                           const char* s1,
20149                                           const char* s2);
20150
20151 // The helper function for {ASSERT|EXPECT}_STRCASEEQ.
20152 //
20153 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20154 GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression,
20155                                               const char* s2_expression,
20156                                               const char* s1,
20157                                               const char* s2);
20158
20159 // The helper function for {ASSERT|EXPECT}_STRNE.
20160 //
20161 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20162 GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
20163                                           const char* s2_expression,
20164                                           const char* s1,
20165                                           const char* s2);
20166
20167 // The helper function for {ASSERT|EXPECT}_STRCASENE.
20168 //
20169 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20170 GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
20171                                               const char* s2_expression,
20172                                               const char* s1,
20173                                               const char* s2);
20174
20175
20176 // Helper function for *_STREQ on wide strings.
20177 //
20178 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20179 GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
20180                                           const char* s2_expression,
20181                                           const wchar_t* s1,
20182                                           const wchar_t* s2);
20183
20184 // Helper function for *_STRNE on wide strings.
20185 //
20186 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20187 GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
20188                                           const char* s2_expression,
20189                                           const wchar_t* s1,
20190                                           const wchar_t* s2);
20191
20192 }  // namespace internal
20193
20194 // IsSubstring() and IsNotSubstring() are intended to be used as the
20195 // first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
20196 // themselves.  They check whether needle is a substring of haystack
20197 // (NULL is considered a substring of itself only), and return an
20198 // appropriate error message when they fail.
20199 //
20200 // The {needle,haystack}_expr arguments are the stringified
20201 // expressions that generated the two real arguments.
20202 GTEST_API_ AssertionResult IsSubstring(
20203     const char* needle_expr, const char* haystack_expr,
20204     const char* needle, const char* haystack);
20205 GTEST_API_ AssertionResult IsSubstring(
20206     const char* needle_expr, const char* haystack_expr,
20207     const wchar_t* needle, const wchar_t* haystack);
20208 GTEST_API_ AssertionResult IsNotSubstring(
20209     const char* needle_expr, const char* haystack_expr,
20210     const char* needle, const char* haystack);
20211 GTEST_API_ AssertionResult IsNotSubstring(
20212     const char* needle_expr, const char* haystack_expr,
20213     const wchar_t* needle, const wchar_t* haystack);
20214 GTEST_API_ AssertionResult IsSubstring(
20215     const char* needle_expr, const char* haystack_expr,
20216     const ::std::string& needle, const ::std::string& haystack);
20217 GTEST_API_ AssertionResult IsNotSubstring(
20218     const char* needle_expr, const char* haystack_expr,
20219     const ::std::string& needle, const ::std::string& haystack);
20220
20221 #if GTEST_HAS_STD_WSTRING
20222 GTEST_API_ AssertionResult IsSubstring(
20223     const char* needle_expr, const char* haystack_expr,
20224     const ::std::wstring& needle, const ::std::wstring& haystack);
20225 GTEST_API_ AssertionResult IsNotSubstring(
20226     const char* needle_expr, const char* haystack_expr,
20227     const ::std::wstring& needle, const ::std::wstring& haystack);
20228 #endif  // GTEST_HAS_STD_WSTRING
20229
20230 namespace internal {
20231
20232 // Helper template function for comparing floating-points.
20233 //
20234 // Template parameter:
20235 //
20236 //   RawType: the raw floating-point type (either float or double)
20237 //
20238 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20239 template <typename RawType>
20240 AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
20241                                          const char* rhs_expression,
20242                                          RawType lhs_value,
20243                                          RawType rhs_value) {
20244   const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
20245
20246   if (lhs.AlmostEquals(rhs)) {
20247     return AssertionSuccess();
20248   }
20249
20250   ::std::stringstream lhs_ss;
20251   lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
20252          << lhs_value;
20253
20254   ::std::stringstream rhs_ss;
20255   rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
20256          << rhs_value;
20257
20258   return EqFailure(lhs_expression,
20259                    rhs_expression,
20260                    StringStreamToString(&lhs_ss),
20261                    StringStreamToString(&rhs_ss),
20262                    false);
20263 }
20264
20265 // Helper function for implementing ASSERT_NEAR.
20266 //
20267 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
20268 GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
20269                                                 const char* expr2,
20270                                                 const char* abs_error_expr,
20271                                                 double val1,
20272                                                 double val2,
20273                                                 double abs_error);
20274
20275 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
20276 // A class that enables one to stream messages to assertion macros
20277 class GTEST_API_ AssertHelper {
20278  public:
20279   // Constructor.
20280   AssertHelper(TestPartResult::Type type,
20281                const char* file,
20282                int line,
20283                const char* message);
20284   ~AssertHelper();
20285
20286   // Message assignment is a semantic trick to enable assertion
20287   // streaming; see the GTEST_MESSAGE_ macro below.
20288   void operator=(const Message& message) const;
20289
20290  private:
20291   // We put our data in a struct so that the size of the AssertHelper class can
20292   // be as small as possible.  This is important because gcc is incapable of
20293   // re-using stack space even for temporary variables, so every EXPECT_EQ
20294   // reserves stack space for another AssertHelper.
20295   struct AssertHelperData {
20296     AssertHelperData(TestPartResult::Type t,
20297                      const char* srcfile,
20298                      int line_num,
20299                      const char* msg)
20300         : type(t), file(srcfile), line(line_num), message(msg) { }
20301
20302     TestPartResult::Type const type;
20303     const char* const file;
20304     int const line;
20305     std::string const message;
20306
20307    private:
20308     GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
20309   };
20310
20311   AssertHelperData* const data_;
20312
20313   GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
20314 };
20315
20316 }  // namespace internal
20317
20318 #if GTEST_HAS_PARAM_TEST
20319 // The pure interface class that all value-parameterized tests inherit from.
20320 // A value-parameterized class must inherit from both ::testing::Test and
20321 // ::testing::WithParamInterface. In most cases that just means inheriting
20322 // from ::testing::TestWithParam, but more complicated test hierarchies
20323 // may need to inherit from Test and WithParamInterface at different levels.
20324 //
20325 // This interface has support for accessing the test parameter value via
20326 // the GetParam() method.
20327 //
20328 // Use it with one of the parameter generator defining functions, like Range(),
20329 // Values(), ValuesIn(), Bool(), and Combine().
20330 //
20331 // class FooTest : public ::testing::TestWithParam<int> {
20332 //  protected:
20333 //   FooTest() {
20334 //     // Can use GetParam() here.
20335 //   }
20336 //   virtual ~FooTest() {
20337 //     // Can use GetParam() here.
20338 //   }
20339 //   virtual void SetUp() {
20340 //     // Can use GetParam() here.
20341 //   }
20342 //   virtual void TearDown {
20343 //     // Can use GetParam() here.
20344 //   }
20345 // };
20346 // TEST_P(FooTest, DoesBar) {
20347 //   // Can use GetParam() method here.
20348 //   Foo foo;
20349 //   ASSERT_TRUE(foo.DoesBar(GetParam()));
20350 // }
20351 // INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
20352
20353 template <typename T>
20354 class WithParamInterface {
20355  public:
20356   typedef T ParamType;
20357   virtual ~WithParamInterface() {}
20358
20359   // The current parameter value. Is also available in the test fixture's
20360   // constructor. This member function is non-static, even though it only
20361   // references static data, to reduce the opportunity for incorrect uses
20362   // like writing 'WithParamInterface<bool>::GetParam()' for a test that
20363   // uses a fixture whose parameter type is int.
20364   const ParamType& GetParam() const {
20365     GTEST_CHECK_(parameter_ != NULL)
20366         << "GetParam() can only be called inside a value-parameterized test "
20367         << "-- did you intend to write TEST_P instead of TEST_F?";
20368     return *parameter_;
20369   }
20370
20371  private:
20372   // Sets parameter value. The caller is responsible for making sure the value
20373   // remains alive and unchanged throughout the current test.
20374   static void SetParam(const ParamType* parameter) {
20375     parameter_ = parameter;
20376   }
20377
20378   // Static value used for accessing parameter during a test lifetime.
20379   static const ParamType* parameter_;
20380
20381   // TestClass must be a subclass of WithParamInterface<T> and Test.
20382   template <class TestClass> friend class internal::ParameterizedTestFactory;
20383 };
20384
20385 template <typename T>
20386 const T* WithParamInterface<T>::parameter_ = NULL;
20387
20388 // Most value-parameterized classes can ignore the existence of
20389 // WithParamInterface, and can just inherit from ::testing::TestWithParam.
20390
20391 template <typename T>
20392 class TestWithParam : public Test, public WithParamInterface<T> {
20393 };
20394
20395 #endif  // GTEST_HAS_PARAM_TEST
20396
20397 // Macros for indicating success/failure in test code.
20398
20399 // ADD_FAILURE unconditionally adds a failure to the current test.
20400 // SUCCEED generates a success - it doesn't automatically make the
20401 // current test successful, as a test is only successful when it has
20402 // no failure.
20403 //
20404 // EXPECT_* verifies that a certain condition is satisfied.  If not,
20405 // it behaves like ADD_FAILURE.  In particular:
20406 //
20407 //   EXPECT_TRUE  verifies that a Boolean condition is true.
20408 //   EXPECT_FALSE verifies that a Boolean condition is false.
20409 //
20410 // FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
20411 // that they will also abort the current function on failure.  People
20412 // usually want the fail-fast behavior of FAIL and ASSERT_*, but those
20413 // writing data-driven tests often find themselves using ADD_FAILURE
20414 // and EXPECT_* more.
20415
20416 // Generates a nonfatal failure with a generic message.
20417 #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
20418
20419 // Generates a nonfatal failure at the given source file location with
20420 // a generic message.
20421 #define ADD_FAILURE_AT(file, line) \
20422   GTEST_MESSAGE_AT_(file, line, "Failed", \
20423                     ::testing::TestPartResult::kNonFatalFailure)
20424
20425 // Generates a fatal failure with a generic message.
20426 #define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
20427
20428 // Define this macro to 1 to omit the definition of FAIL(), which is a
20429 // generic name and clashes with some other libraries.
20430 #if !GTEST_DONT_DEFINE_FAIL
20431 # define FAIL() GTEST_FAIL()
20432 #endif
20433
20434 // Generates a success with a generic message.
20435 #define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
20436
20437 // Define this macro to 1 to omit the definition of SUCCEED(), which
20438 // is a generic name and clashes with some other libraries.
20439 #if !GTEST_DONT_DEFINE_SUCCEED
20440 # define SUCCEED() GTEST_SUCCEED()
20441 #endif
20442
20443 // Macros for testing exceptions.
20444 //
20445 //    * {ASSERT|EXPECT}_THROW(statement, expected_exception):
20446 //         Tests that the statement throws the expected exception.
20447 //    * {ASSERT|EXPECT}_NO_THROW(statement):
20448 //         Tests that the statement doesn't throw any exception.
20449 //    * {ASSERT|EXPECT}_ANY_THROW(statement):
20450 //         Tests that the statement throws an exception.
20451
20452 #define EXPECT_THROW(statement, expected_exception) \
20453   GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
20454 #define EXPECT_NO_THROW(statement) \
20455   GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
20456 #define EXPECT_ANY_THROW(statement) \
20457   GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
20458 #define ASSERT_THROW(statement, expected_exception) \
20459   GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
20460 #define ASSERT_NO_THROW(statement) \
20461   GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
20462 #define ASSERT_ANY_THROW(statement) \
20463   GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
20464
20465 // Boolean assertions. Condition can be either a Boolean expression or an
20466 // AssertionResult. For more information on how to use AssertionResult with
20467 // these macros see comments on that class.
20468 #define EXPECT_TRUE(condition) \
20469   GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \
20470                       GTEST_NONFATAL_FAILURE_)
20471 #define EXPECT_FALSE(condition) \
20472   GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
20473                       GTEST_NONFATAL_FAILURE_)
20474 #define ASSERT_TRUE(condition) \
20475   GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \
20476                       GTEST_FATAL_FAILURE_)
20477 #define ASSERT_FALSE(condition) \
20478   GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
20479                       GTEST_FATAL_FAILURE_)
20480
20481 // Includes the auto-generated header that implements a family of
20482 // generic predicate assertion macros.
20483 // Copyright 2006, Google Inc.
20484 // All rights reserved.
20485 //
20486 // Redistribution and use in source and binary forms, with or without
20487 // modification, are permitted provided that the following conditions are
20488 // met:
20489 //
20490 //     * Redistributions of source code must retain the above copyright
20491 // notice, this list of conditions and the following disclaimer.
20492 //     * Redistributions in binary form must reproduce the above
20493 // copyright notice, this list of conditions and the following disclaimer
20494 // in the documentation and/or other materials provided with the
20495 // distribution.
20496 //     * Neither the name of Google Inc. nor the names of its
20497 // contributors may be used to endorse or promote products derived from
20498 // this software without specific prior written permission.
20499 //
20500 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20501 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20502 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20503 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20504 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20505 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20506 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20507 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20508 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20509 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
20510 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20511
20512 // This file is AUTOMATICALLY GENERATED on 10/31/2011 by command
20513 // 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!
20514 //
20515 // Implements a family of generic predicate assertion macros.
20516
20517 #ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
20518 #define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
20519
20520 // Makes sure this header is not included before gtest.h.
20521 #ifndef GTEST_INCLUDE_GTEST_GTEST_H_
20522 # error Do not include gtest_pred_impl.h directly.  Include gtest.h instead.
20523 #endif  // GTEST_INCLUDE_GTEST_GTEST_H_
20524
20525 // This header implements a family of generic predicate assertion
20526 // macros:
20527 //
20528 //   ASSERT_PRED_FORMAT1(pred_format, v1)
20529 //   ASSERT_PRED_FORMAT2(pred_format, v1, v2)
20530 //   ...
20531 //
20532 // where pred_format is a function or functor that takes n (in the
20533 // case of ASSERT_PRED_FORMATn) values and their source expression
20534 // text, and returns a testing::AssertionResult.  See the definition
20535 // of ASSERT_EQ in gtest.h for an example.
20536 //
20537 // If you don't care about formatting, you can use the more
20538 // restrictive version:
20539 //
20540 //   ASSERT_PRED1(pred, v1)
20541 //   ASSERT_PRED2(pred, v1, v2)
20542 //   ...
20543 //
20544 // where pred is an n-ary function or functor that returns bool,
20545 // and the values v1, v2, ..., must support the << operator for
20546 // streaming to std::ostream.
20547 //
20548 // We also define the EXPECT_* variations.
20549 //
20550 // For now we only support predicates whose arity is at most 5.
20551 // Please email googletestframework@googlegroups.com if you need
20552 // support for higher arities.
20553
20554 // GTEST_ASSERT_ is the basic statement to which all of the assertions
20555 // in this file reduce.  Don't use this in your code.
20556
20557 #define GTEST_ASSERT_(expression, on_failure) \
20558   GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
20559   if (const ::testing::AssertionResult gtest_ar = (expression)) \
20560     ; \
20561   else \
20562     on_failure(gtest_ar.failure_message())
20563
20564
20565 // Helper function for implementing {EXPECT|ASSERT}_PRED1.  Don't use
20566 // this in your code.
20567 template <typename Pred,
20568           typename T1>
20569 AssertionResult AssertPred1Helper(const char* pred_text,
20570                                   const char* e1,
20571                                   Pred pred,
20572                                   const T1& v1) {
20573   if (pred(v1)) return AssertionSuccess();
20574
20575   return AssertionFailure() << pred_text << "("
20576                             << e1 << ") evaluates to false, where"
20577                             << "\n" << e1 << " evaluates to " << v1;
20578 }
20579
20580 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
20581 // Don't use this in your code.
20582 #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
20583   GTEST_ASSERT_(pred_format(#v1, v1), \
20584                 on_failure)
20585
20586 // Internal macro for implementing {EXPECT|ASSERT}_PRED1.  Don't use
20587 // this in your code.
20588 #define GTEST_PRED1_(pred, v1, on_failure)\
20589   GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
20590                                              #v1, \
20591                                              pred, \
20592                                              v1), on_failure)
20593
20594 // Unary predicate assertion macros.
20595 #define EXPECT_PRED_FORMAT1(pred_format, v1) \
20596   GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
20597 #define EXPECT_PRED1(pred, v1) \
20598   GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
20599 #define ASSERT_PRED_FORMAT1(pred_format, v1) \
20600   GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
20601 #define ASSERT_PRED1(pred, v1) \
20602   GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
20603
20604
20605
20606 // Helper function for implementing {EXPECT|ASSERT}_PRED2.  Don't use
20607 // this in your code.
20608 template <typename Pred,
20609           typename T1,
20610           typename T2>
20611 AssertionResult AssertPred2Helper(const char* pred_text,
20612                                   const char* e1,
20613                                   const char* e2,
20614                                   Pred pred,
20615                                   const T1& v1,
20616                                   const T2& v2) {
20617   if (pred(v1, v2)) return AssertionSuccess();
20618
20619   return AssertionFailure() << pred_text << "("
20620                             << e1 << ", "
20621                             << e2 << ") evaluates to false, where"
20622                             << "\n" << e1 << " evaluates to " << v1
20623                             << "\n" << e2 << " evaluates to " << v2;
20624 }
20625
20626 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
20627 // Don't use this in your code.
20628 #define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
20629   GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
20630                 on_failure)
20631
20632 // Internal macro for implementing {EXPECT|ASSERT}_PRED2.  Don't use
20633 // this in your code.
20634 #define GTEST_PRED2_(pred, v1, v2, on_failure)\
20635   GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
20636                                              #v1, \
20637                                              #v2, \
20638                                              pred, \
20639                                              v1, \
20640                                              v2), on_failure)
20641
20642 // Binary predicate assertion macros.
20643 #define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
20644   GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
20645 #define EXPECT_PRED2(pred, v1, v2) \
20646   GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
20647 #define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
20648   GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
20649 #define ASSERT_PRED2(pred, v1, v2) \
20650   GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
20651
20652
20653
20654 // Helper function for implementing {EXPECT|ASSERT}_PRED3.  Don't use
20655 // this in your code.
20656 template <typename Pred,
20657           typename T1,
20658           typename T2,
20659           typename T3>
20660 AssertionResult AssertPred3Helper(const char* pred_text,
20661                                   const char* e1,
20662                                   const char* e2,
20663                                   const char* e3,
20664                                   Pred pred,
20665                                   const T1& v1,
20666                                   const T2& v2,
20667                                   const T3& v3) {
20668   if (pred(v1, v2, v3)) return AssertionSuccess();
20669
20670   return AssertionFailure() << pred_text << "("
20671                             << e1 << ", "
20672                             << e2 << ", "
20673                             << e3 << ") evaluates to false, where"
20674                             << "\n" << e1 << " evaluates to " << v1
20675                             << "\n" << e2 << " evaluates to " << v2
20676                             << "\n" << e3 << " evaluates to " << v3;
20677 }
20678
20679 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
20680 // Don't use this in your code.
20681 #define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
20682   GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
20683                 on_failure)
20684
20685 // Internal macro for implementing {EXPECT|ASSERT}_PRED3.  Don't use
20686 // this in your code.
20687 #define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
20688   GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
20689                                              #v1, \
20690                                              #v2, \
20691                                              #v3, \
20692                                              pred, \
20693                                              v1, \
20694                                              v2, \
20695                                              v3), on_failure)
20696
20697 // Ternary predicate assertion macros.
20698 #define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
20699   GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
20700 #define EXPECT_PRED3(pred, v1, v2, v3) \
20701   GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
20702 #define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
20703   GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
20704 #define ASSERT_PRED3(pred, v1, v2, v3) \
20705   GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
20706
20707
20708
20709 // Helper function for implementing {EXPECT|ASSERT}_PRED4.  Don't use
20710 // this in your code.
20711 template <typename Pred,
20712           typename T1,
20713           typename T2,
20714           typename T3,
20715           typename T4>
20716 AssertionResult AssertPred4Helper(const char* pred_text,
20717                                   const char* e1,
20718                                   const char* e2,
20719                                   const char* e3,
20720                                   const char* e4,
20721                                   Pred pred,
20722                                   const T1& v1,
20723                                   const T2& v2,
20724                                   const T3& v3,
20725                                   const T4& v4) {
20726   if (pred(v1, v2, v3, v4)) return AssertionSuccess();
20727
20728   return AssertionFailure() << pred_text << "("
20729                             << e1 << ", "
20730                             << e2 << ", "
20731                             << e3 << ", "
20732                             << e4 << ") evaluates to false, where"
20733                             << "\n" << e1 << " evaluates to " << v1
20734                             << "\n" << e2 << " evaluates to " << v2
20735                             << "\n" << e3 << " evaluates to " << v3
20736                             << "\n" << e4 << " evaluates to " << v4;
20737 }
20738
20739 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
20740 // Don't use this in your code.
20741 #define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
20742   GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
20743                 on_failure)
20744
20745 // Internal macro for implementing {EXPECT|ASSERT}_PRED4.  Don't use
20746 // this in your code.
20747 #define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
20748   GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
20749                                              #v1, \
20750                                              #v2, \
20751                                              #v3, \
20752                                              #v4, \
20753                                              pred, \
20754                                              v1, \
20755                                              v2, \
20756                                              v3, \
20757                                              v4), on_failure)
20758
20759 // 4-ary predicate assertion macros.
20760 #define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
20761   GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
20762 #define EXPECT_PRED4(pred, v1, v2, v3, v4) \
20763   GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
20764 #define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
20765   GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
20766 #define ASSERT_PRED4(pred, v1, v2, v3, v4) \
20767   GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
20768
20769
20770
20771 // Helper function for implementing {EXPECT|ASSERT}_PRED5.  Don't use
20772 // this in your code.
20773 template <typename Pred,
20774           typename T1,
20775           typename T2,
20776           typename T3,
20777           typename T4,
20778           typename T5>
20779 AssertionResult AssertPred5Helper(const char* pred_text,
20780                                   const char* e1,
20781                                   const char* e2,
20782                                   const char* e3,
20783                                   const char* e4,
20784                                   const char* e5,
20785                                   Pred pred,
20786                                   const T1& v1,
20787                                   const T2& v2,
20788                                   const T3& v3,
20789                                   const T4& v4,
20790                                   const T5& v5) {
20791   if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
20792
20793   return AssertionFailure() << pred_text << "("
20794                             << e1 << ", "
20795                             << e2 << ", "
20796                             << e3 << ", "
20797                             << e4 << ", "
20798                             << e5 << ") evaluates to false, where"
20799                             << "\n" << e1 << " evaluates to " << v1
20800                             << "\n" << e2 << " evaluates to " << v2
20801                             << "\n" << e3 << " evaluates to " << v3
20802                             << "\n" << e4 << " evaluates to " << v4
20803                             << "\n" << e5 << " evaluates to " << v5;
20804 }
20805
20806 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
20807 // Don't use this in your code.
20808 #define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
20809   GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
20810                 on_failure)
20811
20812 // Internal macro for implementing {EXPECT|ASSERT}_PRED5.  Don't use
20813 // this in your code.
20814 #define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
20815   GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
20816                                              #v1, \
20817                                              #v2, \
20818                                              #v3, \
20819                                              #v4, \
20820                                              #v5, \
20821                                              pred, \
20822                                              v1, \
20823                                              v2, \
20824                                              v3, \
20825                                              v4, \
20826                                              v5), on_failure)
20827
20828 // 5-ary predicate assertion macros.
20829 #define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
20830   GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
20831 #define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
20832   GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
20833 #define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
20834   GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
20835 #define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
20836   GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
20837
20838
20839
20840 #endif  // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
20841
20842 // Macros for testing equalities and inequalities.
20843 //
20844 //    * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2
20845 //    * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
20846 //    * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
20847 //    * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
20848 //    * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
20849 //    * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
20850 //
20851 // When they are not, Google Test prints both the tested expressions and
20852 // their actual values.  The values must be compatible built-in types,
20853 // or you will get a compiler error.  By "compatible" we mean that the
20854 // values can be compared by the respective operator.
20855 //
20856 // Note:
20857 //
20858 //   1. It is possible to make a user-defined type work with
20859 //   {ASSERT|EXPECT}_??(), but that requires overloading the
20860 //   comparison operators and is thus discouraged by the Google C++
20861 //   Usage Guide.  Therefore, you are advised to use the
20862 //   {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
20863 //   equal.
20864 //
20865 //   2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
20866 //   pointers (in particular, C strings).  Therefore, if you use it
20867 //   with two C strings, you are testing how their locations in memory
20868 //   are related, not how their content is related.  To compare two C
20869 //   strings by content, use {ASSERT|EXPECT}_STR*().
20870 //
20871 //   3. {ASSERT|EXPECT}_EQ(v1, v2) is preferred to
20872 //   {ASSERT|EXPECT}_TRUE(v1 == v2), as the former tells you
20873 //   what the actual value is when it fails, and similarly for the
20874 //   other comparisons.
20875 //
20876 //   4. Do not depend on the order in which {ASSERT|EXPECT}_??()
20877 //   evaluate their arguments, which is undefined.
20878 //
20879 //   5. These macros evaluate their arguments exactly once.
20880 //
20881 // Examples:
20882 //
20883 //   EXPECT_NE(5, Foo());
20884 //   EXPECT_EQ(NULL, a_pointer);
20885 //   ASSERT_LT(i, array_size);
20886 //   ASSERT_GT(records.size(), 0) << "There is no record left.";
20887
20888 #define EXPECT_EQ(val1, val2) \
20889   EXPECT_PRED_FORMAT2(::testing::internal:: \
20890                       EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
20891                       val1, val2)
20892 #define EXPECT_NE(val1, val2) \
20893   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
20894 #define EXPECT_LE(val1, val2) \
20895   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
20896 #define EXPECT_LT(val1, val2) \
20897   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
20898 #define EXPECT_GE(val1, val2) \
20899   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
20900 #define EXPECT_GT(val1, val2) \
20901   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
20902
20903 #define GTEST_ASSERT_EQ(val1, val2) \
20904   ASSERT_PRED_FORMAT2(::testing::internal:: \
20905                       EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
20906                       val1, val2)
20907 #define GTEST_ASSERT_NE(val1, val2) \
20908   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
20909 #define GTEST_ASSERT_LE(val1, val2) \
20910   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
20911 #define GTEST_ASSERT_LT(val1, val2) \
20912   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
20913 #define GTEST_ASSERT_GE(val1, val2) \
20914   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
20915 #define GTEST_ASSERT_GT(val1, val2) \
20916   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
20917
20918 // Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
20919 // ASSERT_XY(), which clashes with some users' own code.
20920
20921 #if !GTEST_DONT_DEFINE_ASSERT_EQ
20922 # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
20923 #endif
20924
20925 #if !GTEST_DONT_DEFINE_ASSERT_NE
20926 # define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
20927 #endif
20928
20929 #if !GTEST_DONT_DEFINE_ASSERT_LE
20930 # define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
20931 #endif
20932
20933 #if !GTEST_DONT_DEFINE_ASSERT_LT
20934 # define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
20935 #endif
20936
20937 #if !GTEST_DONT_DEFINE_ASSERT_GE
20938 # define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
20939 #endif
20940
20941 #if !GTEST_DONT_DEFINE_ASSERT_GT
20942 # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
20943 #endif
20944
20945 // C-string Comparisons.  All tests treat NULL and any non-NULL string
20946 // as different.  Two NULLs are equal.
20947 //
20948 //    * {ASSERT|EXPECT}_STREQ(s1, s2):     Tests that s1 == s2
20949 //    * {ASSERT|EXPECT}_STRNE(s1, s2):     Tests that s1 != s2
20950 //    * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
20951 //    * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
20952 //
20953 // For wide or narrow string objects, you can use the
20954 // {ASSERT|EXPECT}_??() macros.
20955 //
20956 // Don't depend on the order in which the arguments are evaluated,
20957 // which is undefined.
20958 //
20959 // These macros evaluate their arguments exactly once.
20960
20961 #define EXPECT_STREQ(s1, s2) \
20962   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
20963 #define EXPECT_STRNE(s1, s2) \
20964   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
20965 #define EXPECT_STRCASEEQ(s1, s2) \
20966   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
20967 #define EXPECT_STRCASENE(s1, s2)\
20968   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
20969
20970 #define ASSERT_STREQ(s1, s2) \
20971   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
20972 #define ASSERT_STRNE(s1, s2) \
20973   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
20974 #define ASSERT_STRCASEEQ(s1, s2) \
20975   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
20976 #define ASSERT_STRCASENE(s1, s2)\
20977   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
20978
20979 // Macros for comparing floating-point numbers.
20980 //
20981 //    * {ASSERT|EXPECT}_FLOAT_EQ(val1, val2):
20982 //         Tests that two float values are almost equal.
20983 //    * {ASSERT|EXPECT}_DOUBLE_EQ(val1, val2):
20984 //         Tests that two double values are almost equal.
20985 //    * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
20986 //         Tests that v1 and v2 are within the given distance to each other.
20987 //
20988 // Google Test uses ULP-based comparison to automatically pick a default
20989 // error bound that is appropriate for the operands.  See the
20990 // FloatingPoint template class in gtest-internal.h if you are
20991 // interested in the implementation details.
20992
20993 #define EXPECT_FLOAT_EQ(val1, val2)\
20994   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
20995                       val1, val2)
20996
20997 #define EXPECT_DOUBLE_EQ(val1, val2)\
20998   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
20999                       val1, val2)
21000
21001 #define ASSERT_FLOAT_EQ(val1, val2)\
21002   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
21003                       val1, val2)
21004
21005 #define ASSERT_DOUBLE_EQ(val1, val2)\
21006   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
21007                       val1, val2)
21008
21009 #define EXPECT_NEAR(val1, val2, abs_error)\
21010   EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
21011                       val1, val2, abs_error)
21012
21013 #define ASSERT_NEAR(val1, val2, abs_error)\
21014   ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
21015                       val1, val2, abs_error)
21016
21017 // These predicate format functions work on floating-point values, and
21018 // can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
21019 //
21020 //   EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
21021
21022 // Asserts that val1 is less than, or almost equal to, val2.  Fails
21023 // otherwise.  In particular, it fails if either val1 or val2 is NaN.
21024 GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
21025                                    float val1, float val2);
21026 GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
21027                                     double val1, double val2);
21028
21029
21030 #if GTEST_OS_WINDOWS
21031
21032 // Macros that test for HRESULT failure and success, these are only useful
21033 // on Windows, and rely on Windows SDK macros and APIs to compile.
21034 //
21035 //    * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
21036 //
21037 // When expr unexpectedly fails or succeeds, Google Test prints the
21038 // expected result and the actual result with both a human-readable
21039 // string representation of the error, if available, as well as the
21040 // hex result code.
21041 # define EXPECT_HRESULT_SUCCEEDED(expr) \
21042     EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
21043
21044 # define ASSERT_HRESULT_SUCCEEDED(expr) \
21045     ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
21046
21047 # define EXPECT_HRESULT_FAILED(expr) \
21048     EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
21049
21050 # define ASSERT_HRESULT_FAILED(expr) \
21051     ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
21052
21053 #endif  // GTEST_OS_WINDOWS
21054
21055 // Macros that execute statement and check that it doesn't generate new fatal
21056 // failures in the current thread.
21057 //
21058 //   * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
21059 //
21060 // Examples:
21061 //
21062 //   EXPECT_NO_FATAL_FAILURE(Process());
21063 //   ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
21064 //
21065 #define ASSERT_NO_FATAL_FAILURE(statement) \
21066     GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
21067 #define EXPECT_NO_FATAL_FAILURE(statement) \
21068     GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
21069
21070 // Causes a trace (including the source file path, the current line
21071 // number, and the given message) to be included in every test failure
21072 // message generated by code in the current scope.  The effect is
21073 // undone when the control leaves the current scope.
21074 //
21075 // The message argument can be anything streamable to std::ostream.
21076 //
21077 // In the implementation, we include the current line number as part
21078 // of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
21079 // to appear in the same block - as long as they are on different
21080 // lines.
21081 #define SCOPED_TRACE(message) \
21082   ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
21083     __FILE__, __LINE__, ::testing::Message() << (message))
21084
21085 // Compile-time assertion for type equality.
21086 // StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
21087 // the same type.  The value it returns is not interesting.
21088 //
21089 // Instead of making StaticAssertTypeEq a class template, we make it a
21090 // function template that invokes a helper class template.  This
21091 // prevents a user from misusing StaticAssertTypeEq<T1, T2> by
21092 // defining objects of that type.
21093 //
21094 // CAVEAT:
21095 //
21096 // When used inside a method of a class template,
21097 // StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
21098 // instantiated.  For example, given:
21099 //
21100 //   template <typename T> class Foo {
21101 //    public:
21102 //     void Bar() { testing::StaticAssertTypeEq<int, T>(); }
21103 //   };
21104 //
21105 // the code:
21106 //
21107 //   void Test1() { Foo<bool> foo; }
21108 //
21109 // will NOT generate a compiler error, as Foo<bool>::Bar() is never
21110 // actually instantiated.  Instead, you need:
21111 //
21112 //   void Test2() { Foo<bool> foo; foo.Bar(); }
21113 //
21114 // to cause a compiler error.
21115 template <typename T1, typename T2>
21116 bool StaticAssertTypeEq() {
21117   (void)internal::StaticAssertTypeEqHelper<T1, T2>();
21118   return true;
21119 }
21120
21121 // Defines a test.
21122 //
21123 // The first parameter is the name of the test case, and the second
21124 // parameter is the name of the test within the test case.
21125 //
21126 // The convention is to end the test case name with "Test".  For
21127 // example, a test case for the Foo class can be named FooTest.
21128 //
21129 // Test code should appear between braces after an invocation of
21130 // this macro.  Example:
21131 //
21132 //   TEST(FooTest, InitializesCorrectly) {
21133 //     Foo foo;
21134 //     EXPECT_TRUE(foo.StatusIsOK());
21135 //   }
21136
21137 // Note that we call GetTestTypeId() instead of GetTypeId<
21138 // ::testing::Test>() here to get the type ID of testing::Test.  This
21139 // is to work around a suspected linker bug when using Google Test as
21140 // a framework on Mac OS X.  The bug causes GetTypeId<
21141 // ::testing::Test>() to return different values depending on whether
21142 // the call is from the Google Test framework itself or from user test
21143 // code.  GetTestTypeId() is guaranteed to always return the same
21144 // value, as it always calls GetTypeId<>() from the Google Test
21145 // framework.
21146 #define GTEST_TEST(test_case_name, test_name)\
21147   GTEST_TEST_(test_case_name, test_name, \
21148               ::testing::Test, ::testing::internal::GetTestTypeId())
21149
21150 // Define this macro to 1 to omit the definition of TEST(), which
21151 // is a generic name and clashes with some other libraries.
21152 #if !GTEST_DONT_DEFINE_TEST
21153 # define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
21154 #endif
21155
21156 // Defines a test that uses a test fixture.
21157 //
21158 // The first parameter is the name of the test fixture class, which
21159 // also doubles as the test case name.  The second parameter is the
21160 // name of the test within the test case.
21161 //
21162 // A test fixture class must be declared earlier.  The user should put
21163 // his test code between braces after using this macro.  Example:
21164 //
21165 //   class FooTest : public testing::Test {
21166 //    protected:
21167 //     virtual void SetUp() { b_.AddElement(3); }
21168 //
21169 //     Foo a_;
21170 //     Foo b_;
21171 //   };
21172 //
21173 //   TEST_F(FooTest, InitializesCorrectly) {
21174 //     EXPECT_TRUE(a_.StatusIsOK());
21175 //   }
21176 //
21177 //   TEST_F(FooTest, ReturnsElementCountCorrectly) {
21178 //     EXPECT_EQ(0, a_.size());
21179 //     EXPECT_EQ(1, b_.size());
21180 //   }
21181
21182 #define TEST_F(test_fixture, test_name)\
21183   GTEST_TEST_(test_fixture, test_name, test_fixture, \
21184               ::testing::internal::GetTypeId<test_fixture>())
21185
21186 }  // namespace testing
21187
21188 // Use this function in main() to run all tests.  It returns 0 if all
21189 // tests are successful, or 1 otherwise.
21190 //
21191 // RUN_ALL_TESTS() should be invoked after the command line has been
21192 // parsed by InitGoogleTest().
21193 //
21194 // This function was formerly a macro; thus, it is in the global
21195 // namespace and has an all-caps name.
21196 int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
21197
21198 inline int RUN_ALL_TESTS() {
21199   return ::testing::UnitTest::GetInstance()->Run();
21200 }
21201
21202 #endif  // GTEST_INCLUDE_GTEST_GTEST_H_